按根目录 新规范 迁移 R1/R2/R3/R4/R6/R7/R8/R9:指针 T* 后缀、内建类型短别名、c.Addr/c.Deref 单目化、c.Asm 改 __asm__、t.CDefine 改 define 软关键字、t.CEnum 改 enum。R4 对内建 cast 多参实参保留 c.Deref 原写法(单目化会致 TPC 类型退化)。验证:includes 52/52 编译通过,TransPyV 自举产物顺序回归 77/77 全通过。
133 lines
4.0 KiB
Plaintext
133 lines
4.0 KiB
Plaintext
import t
|
||
|
||
|
||
# =============================================================================
|
||
# 大写别名(Win32/TransPyC 风格)
|
||
# 注意:INTPTR/UINTPTR 在此模块中是 int*/unsigned int* 指针类型(历史命名)。
|
||
# 它们与 C 标准的 intptr_t/uintptr_t 整数类型不同,后者见下方小写 _t 区域。
|
||
# =============================================================================
|
||
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
|
||
|
||
|
||
# =============================================================================
|
||
# 定长整数大写别名
|
||
# =============================================================================
|
||
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 标准库 <stdint.h> 类型名(小写 _t 后缀)
|
||
# 这些是 C 语言标准类型名,从 _CNAME_ALIAS 挪到此处作为 typedef 提供。
|
||
# 用户 `from stdint import *` 后即可直接使用 int8_t / size_t 等。
|
||
# =============================================================================
|
||
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 是足以容纳指针的整数类型(不是指针!)
|
||
# 与上方的 INTPTR/UINTPTR(int 指针)语义不同。
|
||
intptr_t: t.CTypedef = t.CIntPtrT
|
||
uintptr_t: t.CTypedef = t.CUIntPtrT
|
||
|
||
# 宽字符 / 字符类型
|
||
wchar_t: t.CTypedef = t.CWCharT
|
||
char8_t: t.CTypedef = t.CChar8T
|
||
char16_t: t.CTypedef = t.CChar16T
|
||
char32_t: t.CTypedef = t.CChar32T
|
||
|
||
# 浮点特化类型
|
||
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
|