Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
bed150bd
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
接近 2 年 前同步成功
通知
1
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bed150bd
编写于
3月 30, 2019
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[serialize] Start fleshing out object stack
上级
63c35651
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
72 addition
and
28 deletion
+72
-28
src/hb-serialize.hh
src/hb-serialize.hh
+66
-25
src/hb-vector.hh
src/hb-vector.hh
+6
-3
未找到文件。
src/hb-serialize.hh
浏览文件 @
bed150bd
...
...
@@ -39,6 +39,30 @@
struct
hb_serialize_context_t
{
typedef
unsigned
objidx_t
;
struct
object_t
{
void
fini
()
{
links
.
fini
();
}
struct
link_t
{
bool
wide
:
1
;
unsigned
offset
:
31
;
objidx_t
objidx
;
};
hb_bytes_t
bytes
;
hb_vector_t
<
link_t
>
links
;
};
struct
snapshot_t
{
char
*
head
,
*
tail
;
};
snapshot_t
snapshot
()
{
snapshot_t
s
=
{
head
,
tail
}
;
return
s
;
}
hb_serialize_context_t
(
void
*
start_
,
unsigned
int
size
)
{
this
->
start
=
(
char
*
)
start_
;
...
...
@@ -56,7 +80,8 @@ struct hb_serialize_context_t
this
->
tail
=
this
->
end
;
this
->
debug_depth
=
0
;
this
->
packed
.
resize
(
1
);
this
->
packed
.
resize
(
0
);
this
->
packed
.
push
()
->
bytes
.
arrayZ
=
this
->
end
;
this
->
current
.
resize
(
0
);
}
...
...
@@ -81,18 +106,53 @@ struct hb_serialize_context_t
this
->
start
,
this
->
end
,
(
unsigned
long
)
(
this
->
end
-
this
->
start
));
return
start_embed
<
Type
>
();
assert
(
!
current
.
length
);
return
push
<
Type
>
();
}
void
end_serialize
()
objidx_t
end_serialize
()
{
DEBUG_MSG_LEVEL
(
SERIALIZE
,
this
->
start
,
0
,
-
1
,
"end [%p..%p] serialized %
d
bytes; %s"
,
"end [%p..%p] serialized %
u
bytes; %s"
,
this
->
start
,
this
->
end
,
(
int
)
(
this
->
head
-
this
->
start
),
(
unsigned
)
(
this
->
head
-
this
->
start
),
this
->
successful
?
"successful"
:
"UNSUCCESSFUL"
);
assert
(
current
.
length
==
1
);
return
pop_pack
();
}
template
<
typename
Type
>
Type
*
push
()
{
current
.
push
(
snapshot
());
return
start_embed
<
Type
>
();
}
void
pop_discard
()
{
revert
(
current
.
pop
());
}
objidx_t
pop_pack
()
{
return
0
;
}
void
revert
(
snapshot_t
snap
)
{
assert
(
snap
.
head
<=
head
);
assert
(
tail
<=
snap
.
tail
);
head
=
snap
.
head
;
tail
=
snap
.
tail
;
discard_stale_objects
();
}
unsigned
int
length
()
const
{
return
this
->
head
-
this
->
start
;
}
void
discard_stale_objects
()
{
while
(
packed
.
length
>
1
&&
packed
.
tail
().
bytes
.
arrayZ
<
tail
)
packed
.
pop
();
assert
(
packed
.
tail
().
bytes
.
arrayZ
==
tail
);
}
unsigned
int
length
()
const
{
return
this
->
head
-
current
.
tail
().
head
;
}
void
align
(
unsigned
int
alignment
)
{
...
...
@@ -199,28 +259,9 @@ struct hb_serialize_context_t
private:
/* Stack of packed objects. Object 0 is always nil object. */
struct
object_t
{
void
fini
()
{
links
.
fini
();
}
struct
link_t
{
bool
wide
:
1
;
unsigned
offset
:
31
;
unsigned
objidx
;
};
hb_bytes_t
bytes
;
hb_vector_t
<
link_t
>
links
;
};
hb_vector_t
<
object_t
>
packed
;
/* Stack of currently under construction object locations. */
struct
snapshot_t
{
char
*
head
,
*
tail
;
};
snapshot_t
snapshot
()
{
snapshot_t
s
=
{
head
,
tail
}
;
return
s
;
}
hb_vector_t
<
snapshot_t
>
current
;
};
...
...
src/hb-vector.hh
浏览文件 @
bed150bd
...
...
@@ -87,6 +87,9 @@ struct hb_vector_t
return
arrayZ
()[
i
];
}
Type
&
tail
()
{
return
(
*
this
)[
length
-
1
];
}
const
Type
&
tail
()
const
{
return
(
*
this
)[
length
-
1
];
}
explicit
operator
bool
()
const
{
return
length
;
}
/* Sink interface. */
...
...
@@ -188,10 +191,10 @@ struct hb_vector_t
return
true
;
}
void
pop
()
Type
pop
()
{
if
(
!
length
)
return
;
length
--
;
if
(
!
length
)
return
Null
(
Type
)
;
return
arrayZ
()[
--
length
]
;
}
void
remove
(
unsigned
int
i
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录