返回介绍

31.12 Typespec

发布于 2020-09-09 22:56:04 字数 2076 浏览 1138 评论 0 收藏 0

NOTES

1) If the vpiTypedef is TRUE and the typedef creates an alias of another typedef, then the vpiTypedefAlias shall return a non null handle which represents the handle to the aliased typedef. For example:

typedef enum bit [0:2] {red, yellow, blue} primary_colors;
typdef primary_colors colors;

If “h1” is a handle to the typespec colors, its vpiType shall return a vpiEnumTypespec, the vpiTypedef property shall be true, the vpiName property shall return “colors”, the vpiTypedefAlias shall return a handle “h2” to the typespec “primary_colors” of vpiType vpiEnumTypespec. The vpiTypedef property shall be false for h2 and its vpiTypedefAlias shall return null.

2) vpiIndexTypespec relation is present only on associative arrays and returns the type that is used as the key into the associative array.

3) If the type of a type is vpiStruct or vpiUnion, then you can iterate over numbers to obtain the structure of the user-defined type. For each member the typespec relation from the member will detail its type.

4) The name of a typedef may be the empty string if the typedef is representing the type of a typedef field defined inline rather than via a typedef. For example:

typedef struct {
    struct {
        int a;
    }B
} C;

5) The typedef C has vpiTypedefType vpiStruct, a single field named B with vpiTypedefType vpiStruct. Obtaining the typedef of field B, you will obtain a typedef with no name and a single field, named "a" with vpiTypedefType of vpiInt.

6) If a type is defined as an alias of another type, it inherits the vpiType of this other type. For example:

typedef time my_time;
my_time t;

The vpiTypespec of the variable named “t” shall return a handle h1 to the typespec “my_time” whose vpiType shall be a vpiTimeTypespec. The vpiTypedefAlias applied to handle h1 shall return a typespec handle h2 to the predefined type “time”.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文