按规范「注释只讲解作用,不掺杂历史原因,尽量英文」:把 includes 下 75 个 .vp 的中文 # 注释与三引号 docstring 改写为英文,每个注释块压到 2 行以内。 保留要点:作用、约束、危险警告(不得/必须/注意)、ABI 与类型约定(如 BYTEPTR | t.CPtr = i8** 的跨模块坍缩坑)、位宽/长度约定、fail-fast 要求、内存与句柄所有权。 未动:文件头注释(规范豁免,仍是中文)、运行时中文字符串常量(printf / fatal_error / MlirFail 等用户可见消息,属代码字面量)。 验证:独立脚本比对 HEAD 与工作区的代码骨架(剥离 # 注释与三引号 docstring 后的非空行)——75 个文件逐字节一致;行尾 CRLF/LF 未被改动;全文剩余中文仅 547 行头注释、0 条行尾注释。bootstrap 三重重编 SUCCESS;全量 77/77 顺序回归通过。
131 lines
3.9 KiB
Plaintext
131 lines
3.9 KiB
Plaintext
import t
|
|
|
|
|
|
# =============================================================================
|
|
# Uppercase aliases (Win32/TransPyC style)
|
|
# Note: INTPTR/UINTPTR are int*/unsigned int* pointer types here (historical), unlike the C intptr_t/uintptr_t integer types in the lowercase _t section below.
|
|
# =============================================================================
|
|
INT: t.CTypedef = int
|
|
INTPTR: t.CTypedef = int | t.CPtr
|
|
|
|
BOOL: t.CTypedef = int
|
|
UINT: t.CTypedef = uint
|
|
UINTPTR: t.CTypedef = UINT | t.CPtr
|
|
BYTE: t.CTypedef = uchar
|
|
BYTEPTR: t.CTypedef = BYTE | t.CPtr
|
|
WORD: t.CTypedef = uint16
|
|
DWORD: t.CTypedef = uint32
|
|
QWORD: t.CTypedef = uint64
|
|
TCHAR: t.CTypedef = char
|
|
CHARLIST: t.CTypedef = str | t.CPtr
|
|
VOID: t.CTypedef = void
|
|
|
|
SHORT: t.CTypedef = int16
|
|
SHORTPTR: t.CTypedef = int16 | t.CPtr
|
|
USHORT: t.CTypedef = uint16
|
|
USHORTPTR: t.CTypedef = uint16 | t.CPtr
|
|
|
|
LONGLONG: t.CTypedef = int64
|
|
ULONGLONG: t.CTypedef = uint64
|
|
LONG: t.CTypedef = int32
|
|
ULONG: t.CTypedef = uint32
|
|
|
|
WCHAR: t.CTypedef = WORD
|
|
WCHARPTR: t.CTypedef = WORD | t.CPtr
|
|
CHARPTR: t.CTypedef = char | t.CPtr
|
|
LPCSTR: t.CTypedef = t.CConst | char | t.CPtr
|
|
|
|
VOIDPTR: t.CTypedef = t.CPtr
|
|
FLOAT: t.CTypedef = float
|
|
DOUBLE: t.CTypedef = double
|
|
|
|
FLOAT8: t.CTypedef = t.CFloat8T
|
|
FLOAT16: t.CTypedef = t.CFloat16T
|
|
FLOAT32: t.CTypedef = t.CFloat32T
|
|
FLOAT64: t.CTypedef = double
|
|
FLOAT128: t.CTypedef = t.CFloat128T
|
|
|
|
|
|
# =============================================================================
|
|
# Fixed-width uppercase integer aliases
|
|
# =============================================================================
|
|
INT8: t.CTypedef = int8
|
|
INT16: t.CTypedef = int16
|
|
INT32: t.CTypedef = int32
|
|
INT64: t.CTypedef = int64
|
|
|
|
UINT8: t.CTypedef = uint8
|
|
UINT16: t.CTypedef = uint16
|
|
UINT32: t.CTypedef = uint32
|
|
UINT64: t.CTypedef = uint64
|
|
|
|
INT8PTR: t.CTypedef = int8 | t.CPtr
|
|
INT16PTR: t.CTypedef = int16 | t.CPtr
|
|
INT32PTR: t.CTypedef = int32 | t.CPtr
|
|
INT64PTR: t.CTypedef = int64 | t.CPtr
|
|
|
|
UINT8PTR: t.CTypedef = uint8 | t.CPtr
|
|
UINT16PTR: t.CTypedef = uint16 | t.CPtr
|
|
UINT32PTR: t.CTypedef = uint32 | t.CPtr
|
|
UINT64PTR: t.CTypedef = uint64 | t.CPtr
|
|
|
|
CHAR8: t.CTypedef = t.CChar8T
|
|
CHAR16: t.CTypedef = t.CChar16T
|
|
CHAR32: t.CTypedef = t.CChar32T
|
|
CHAR8PTR: t.CTypedef = t.CChar8T | t.CPtr
|
|
CHAR16PTR: t.CTypedef = t.CChar16T | t.CPtr
|
|
CHAR32PTR: t.CTypedef = t.CChar32T | t.CPtr
|
|
|
|
i8: t.CTypedef = int8
|
|
i16: t.CTypedef = int16
|
|
i32: t.CTypedef = int32
|
|
i64: t.CTypedef = int64
|
|
|
|
u8: t.CTypedef = uint8
|
|
u16: t.CTypedef = uint16
|
|
u32: t.CTypedef = uint32
|
|
u64: t.CTypedef = uint64
|
|
|
|
SIZE_T: t.CTypedef = sizet
|
|
SSIZE_T: t.CTypedef = t.CPtrDiffT
|
|
PTRDIFF_T: t.CTypedef = t.CPtrDiffT
|
|
|
|
|
|
# =============================================================================
|
|
# C standard library <stdint.h> type names (lowercase _t suffix)
|
|
# C standard type names provided here as typedefs; after `from stdint import *` you can use int8_t / size_t etc. directly.
|
|
# =============================================================================
|
|
int8_t: t.CTypedef = int8
|
|
int16_t: t.CTypedef = int16
|
|
int32_t: t.CTypedef = int32
|
|
int64_t: t.CTypedef = int64
|
|
|
|
uint8_t: t.CTypedef = uint8
|
|
uint16_t: t.CTypedef = uint16
|
|
uint32_t: t.CTypedef = uint32
|
|
uint64_t: t.CTypedef = uint64
|
|
|
|
size_t: t.CTypedef = sizet
|
|
ssize_t: t.CTypedef = t.CPtrDiffT
|
|
ptrdiff_t: t.CTypedef = t.CPtrDiffT
|
|
|
|
# intptr_t/uintptr_t are integer types large enough to hold a pointer (NOT pointers!)
|
|
# Different from the INTPTR/UINTPTR above (int pointers).
|
|
intptr_t: t.CTypedef = t.CIntPtrT
|
|
uintptr_t: t.CTypedef = t.CUIntPtrT
|
|
|
|
# Wide-character / character types
|
|
wchar_t: t.CTypedef = t.CWCharT
|
|
char8_t: t.CTypedef = t.CChar8T
|
|
char16_t: t.CTypedef = t.CChar16T
|
|
char32_t: t.CTypedef = t.CChar32T
|
|
|
|
# Floating-point specializations
|
|
float8_t: t.CTypedef = t.CFloat8T
|
|
float16_t: t.CTypedef = t.CFloat16T
|
|
float32_t: t.CTypedef = t.CFloat32T
|
|
float64_t: t.CTypedef = double
|
|
float128_t: t.CTypedef = t.CFloat128T
|
|
|
|
_Bool: t.CTypedef = bool
|