Files
Viper_VRTE/builtins.vp
T
TermiNexus 2992674783 feat(types): rowptr/REnum 迁移工作区快照 + GSList/PrintModule 临时 DBGCHAIN 护栏
把此前未提交的 rowptr 迁移整体入库(42 文件,含 ast/llvmlite/hashlib/json/zlib 等签名 rowptr 化)。临时诊断(用后移除):linkedlist.vp GSList[T].append 链完整性四检、__module.vp PrintModule Function.Params/param 指针野值护栏([DBGCHAIN] 前缀 + fflush + exit)。
2026-09-05 14:51:40 +08:00

57 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import stdint as __stdint
import t
# ============================================================
# 内置函数(Python 语义,自动与 builtins 关联,无需显式 import)
# ord: 字符 → ASCII 码(int)
# chr: ASCII 码 → 字符(t.CChar)
# min/max: 数值比较取小/大值(double 参数,int/float 实参经
# coerce_to_type 无损提升;返回值由调用侧 coerce 到目标类型)
# ============================================================
def ord(s: t.CChar) -> int:
return s
def chr(i: int) -> t.CChar:
return i
def min(a: double, b: double) -> double:
if a < b:
return a
return b
def max(a: double, b: double) -> double:
if a > b:
return a
return b
# rowptr 已内置于编译器(TPC/TPV 双端),作为语法保留字,不可重定义:
# rowptr[T] 固定表示"裸指针,指向原始类型 T"(等价 t.CPtr[T])。
size_t: t.CTypedef = t.CSizeT
int8: t.CTypedef = t.CInt8T
int16: t.CTypedef = t.CInt16T
int32: t.CTypedef = t.CInt32T
int64: t.CTypedef = t.CInt64T
uint8: t.CTypedef = t.CUInt8T
uint16: t.CTypedef = t.CUInt16T
uint32: t.CTypedef = t.CUInt32T
uint64: t.CTypedef = t.CUInt64T
intfast8: t.CTypedef = t.CIntFast8T
intfast16: t.CTypedef = t.CIntFast16T
intfast32: t.CTypedef = t.CIntFast32T
intfast64: t.CTypedef = t.CIntFast64T
uintfast8: t.CTypedef = t.CUIntFast8T
uintfast16: t.CTypedef = t.CUIntFast16T
uintfast32: t.CTypedef = t.CUIntFast32T
uintfast64: t.CTypedef = t.CUIntFast64T
intleast8: t.CTypedef = t.CIntLeast8T
intleast16: t.CTypedef = t.CIntLeast16T
intleast32: t.CTypedef = t.CIntLeast32T
intleast64: t.CTypedef = t.CIntLeast64T
uintleast8: t.CTypedef = t.CUIntLeast8T
uintleast16: t.CTypedef = t.CUIntLeast16T
uintleast32: t.CTypedef = t.CUIntLeast32T
uintleast64: t.CTypedef = t.CUIntLeast64T