- CallGenBase:字段声明处直接给默认值,InitCallGen 不再逐字段赋值 - CallGenFd/CallGenDispatch:@t.NoVTable 改 novirtual,清理过时注释 - VLogger:LogLevel 改 enum、t.CDefine 改 define 关键字、Logger|t.CPtr 改 Logger*、longjmp 用 rawptr - Generator:_g_gen 由 Generator|t.CPtr 改为 Generator* - CallGenProp:合并续行
463 lines
26 KiB
Plaintext
463 lines
26 KiB
Plaintext
import string
|
||
import lib.core.CompilerFactory as CompilerFactory
|
||
import t, c
|
||
from stdint import *
|
||
import stdio
|
||
import stdlib
|
||
import memhub
|
||
import llvmlite
|
||
import lib.core.Gen.BaseGenMixin as BaseGenMixin
|
||
import lib.core.Gen.Type.TypeGenBase as TypeGenBase
|
||
import lib.core.Gen.Type.TypeGenMixin as TypeGenMixin
|
||
import lib.core.Gen.Type.TypeGenCDef as TypeGenCDef
|
||
import lib.core.Gen.Type.TypeGenCType as TypeGenCType
|
||
import lib.core.Gen.Type.TypeGenResolve as TypeGenResolve
|
||
import lib.core.Gen.Type.TypeGenErr as TypeGenErr
|
||
import lib.core.Gen.StructGenMixin as StructGenMixin
|
||
import lib.core.Gen.Expr.ExprGenBase as ExprGenBase
|
||
import lib.core.Gen.Expr.ExprGenMixin as ExprGenMixin
|
||
import lib.core.Gen.Expr.ExprGenConst as ExprGenConst
|
||
import lib.core.Gen.Expr.ExprGenFstr as ExprGenFstr
|
||
import lib.core.Gen.Expr.ExprGenOps as ExprGenOps
|
||
import lib.core.Gen.Expr.ExprGenCdef as ExprGenCdef
|
||
import lib.core.Gen.Expr.ExprGenName as ExprGenName
|
||
import lib.core.Gen.Expr.ExprGenAttr as ExprGenAttr
|
||
import lib.core.Gen.Expr.ExprGenCls as ExprGenCls
|
||
import lib.core.Gen.Call.CallGenBase as CallGenBase
|
||
import lib.core.Gen.Call.CallGenCBuiltin as CallGenCBuiltin
|
||
import lib.core.Gen.Call.CallGenLeafKit as CallGenLeafKit
|
||
import lib.core.Gen.Call.CallGenCtor as CallGenCtor
|
||
import lib.core.Gen.Call.CallGenCall as CallGenCall
|
||
import lib.core.Gen.Call.CallGenMixin as CallGenMixin
|
||
import lib.core.Gen.Call.CallGenDispatch as CallGenDispatch
|
||
import lib.core.Gen.Call.CallGenLib as CallGenLib
|
||
import lib.core.Gen.Call.CallGenVt as CallGenVt
|
||
import lib.core.Gen.Call.CallGenVa as CallGenVa
|
||
import lib.core.Gen.Call.CallGenProp as CallGenProp
|
||
import lib.core.Gen.Call.CallGenFd as CallGenFd
|
||
import lib.core.Gen.Func.FuncGenBase as FuncGenBase
|
||
import lib.core.Gen.Func.FuncGenDef as FuncGenDef
|
||
import lib.core.Gen.Func.FuncGenMixin as FuncGenMixin
|
||
import lib.core.Gen.Class.ClassGenBase as ClassGenBase
|
||
import lib.core.Gen.Class.ClassGenMixin as ClassGenMixin
|
||
import lib.core.Gen.Class.ClassGenEnum as ClassGenEnum
|
||
import lib.core.Gen.Class.ClassGenGeneric as ClassGenGeneric
|
||
import lib.core.Gen.Class.ClassGenVTable as ClassGenVTable
|
||
import lib.core.Gen.Class.ClassGenDef as ClassGenDef
|
||
import lib.core.Gen.ImportsGenMixin as ImportsGenMixin
|
||
import lib.core.Gen.Stmt.StmtGenCifMixin as StmtGenCifMixin
|
||
import lib.core.Gen.Stmt.StmtGenDeclMixin as StmtGenDeclMixin
|
||
import lib.core.Gen.Stmt.StmtGenMixin as StmtGenMixin
|
||
import lib.core.Gen.MatchGenMixin as MatchGenMixin
|
||
import lib.core.Gen.AssignGenMixin as AssignGenMixin
|
||
import lib.core.Gen.AsyncGenMixin as AsyncGenMixin
|
||
import lib.core.Gen.VarGenMixin as VarGenMixin
|
||
import lib.core.Gen.TranslatorGenMixin as TranslatorGenMixin
|
||
|
||
|
||
# ============================================================
|
||
# Generator - 生成器(双向引用组合架构)
|
||
# ============================================================
|
||
novirtual class Generator:
|
||
"""生成器:持所有 GenMixin 子对象指针(双向引用组合)"""
|
||
|
||
# ---- 子对象指针(46 个,永久池) ----
|
||
BaseGen: rawptr[BaseGenMixin.BaseGenMixin]
|
||
TypeGenBase: rawptr[TypeGenBase.TypeGenBase]
|
||
TypeGen: rawptr[TypeGenMixin.TypeGenMixin]
|
||
TypeGenCDef: rawptr[TypeGenCDef.TypeGenCDef]
|
||
TypeGenCType: rawptr[TypeGenCType.TypeGenCType]
|
||
TypeGenResolve: rawptr[TypeGenResolve.TypeGenResolve]
|
||
TypeGenErr: rawptr[TypeGenErr.TypeGenErr]
|
||
StructGen: rawptr[StructGenMixin.StructGenMixin]
|
||
ExprGenBase: rawptr[ExprGenBase.ExprGenBase]
|
||
ExprGen: rawptr[ExprGenMixin.ExprGenMixin]
|
||
ExprGenConst: rawptr[ExprGenConst.ExprGenConst]
|
||
ExprGenFstr: rawptr[ExprGenFstr.ExprGenFstr]
|
||
ExprGenOps: rawptr[ExprGenOps.ExprGenOps]
|
||
ExprGenCdef: rawptr[ExprGenCdef.ExprGenCdef]
|
||
ExprGenName: rawptr[ExprGenName.ExprGenName]
|
||
ExprGenAttr: rawptr[ExprGenAttr.ExprGenAttr]
|
||
ExprGenCls: rawptr[ExprGenCls.ExprGenCls]
|
||
CallGenBase: rawptr[CallGenBase.CallGenBase]
|
||
CallGenCBuiltin: rawptr[CallGenCBuiltin.CallGenCBuiltin]
|
||
CallGenLeafKit: rawptr[CallGenLeafKit.CallGenLeafKit]
|
||
CallGenCtor: rawptr[CallGenCtor.CallGenCtor]
|
||
CallGenCall: rawptr[CallGenCall.CallGenCall]
|
||
CallGen: rawptr[CallGenMixin.CallGenMixin]
|
||
CallGenDispatch: rawptr[CallGenDispatch.CallGenDispatch]
|
||
CallGenLib: rawptr[CallGenLib.CallGenLib]
|
||
CallGenVt: rawptr[CallGenVt.CallGenVt]
|
||
CallGenVa: rawptr[CallGenVa.CallGenVa]
|
||
CallGenProp: rawptr[CallGenProp.CallGenProp]
|
||
CallGenFd: rawptr[CallGenFd.CallGenFd]
|
||
FuncGenBase: rawptr[FuncGenBase.FuncGenBase]
|
||
FuncGenDef: rawptr[FuncGenDef.FuncGenDef]
|
||
FuncGen: rawptr[FuncGenMixin.FuncGenMixin]
|
||
ClassGenBase: rawptr[ClassGenBase.ClassGenBase]
|
||
ClassGen: rawptr[ClassGenMixin.ClassGenMixin]
|
||
ClassGenEnum: rawptr[ClassGenEnum.ClassGenEnum]
|
||
ClassGenGeneric: rawptr[ClassGenGeneric.ClassGenGeneric]
|
||
ClassGenVTable: rawptr[ClassGenVTable.ClassGenVTable]
|
||
ClassGenDef: rawptr[ClassGenDef.ClassGenDef]
|
||
ImportsGen: rawptr[ImportsGenMixin.ImportsGenMixin]
|
||
StmtGenCif: rawptr[StmtGenCifMixin.StmtGenCifMixin]
|
||
StmtGenDecl: rawptr[StmtGenDeclMixin.StmtGenDeclMixin]
|
||
StmtGen: rawptr[StmtGenMixin.StmtGenMixin]
|
||
MatchGen: rawptr[MatchGenMixin.MatchGenMixin]
|
||
AssignGen: rawptr[AssignGenMixin.AssignGenMixin]
|
||
AsyncGen: rawptr[AsyncGenMixin.AsyncGenMixin]
|
||
VarGen: rawptr[VarGenMixin.VarGenMixin]
|
||
TranslatorGen: rawptr[TranslatorGenMixin.TranslatorGenMixin]
|
||
|
||
def __init__(self, pool: memhub.MemBuddy*):
|
||
if self is None:
|
||
return
|
||
# ---- alloc 46 个子对象 + 回指(永久池,fail-fast) ----
|
||
SubBaseGen: rawptr[BaseGenMixin.BaseGenMixin] = CompilerFactory.factory.PermPool.alloc(BaseGenMixin.BaseGenMixin.__sizeof__())
|
||
if SubBaseGen is None:
|
||
stdio.printf("FAIL: BaseGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubBaseGen, 0, BaseGenMixin.BaseGenMixin.__sizeof__())
|
||
SubBaseGen.Gen = self
|
||
self.BaseGen = SubBaseGen
|
||
SubTypeGenBase: rawptr[TypeGenBase.TypeGenBase] = CompilerFactory.factory.PermPool.alloc(TypeGenBase.TypeGenBase.__sizeof__())
|
||
if SubTypeGenBase is None:
|
||
stdio.printf("FAIL: TypeGenBase alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTypeGenBase, 0, TypeGenBase.TypeGenBase.__sizeof__())
|
||
SubTypeGenBase.Gen = self
|
||
self.TypeGenBase = SubTypeGenBase
|
||
SubTypeGen: rawptr[TypeGenMixin.TypeGenMixin] = CompilerFactory.factory.PermPool.alloc(TypeGenMixin.TypeGenMixin.__sizeof__())
|
||
if SubTypeGen is None:
|
||
stdio.printf("FAIL: TypeGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTypeGen, 0, TypeGenMixin.TypeGenMixin.__sizeof__())
|
||
SubTypeGen.Gen = self
|
||
self.TypeGen = SubTypeGen
|
||
SubTypeGenCDef: rawptr[TypeGenCDef.TypeGenCDef] = CompilerFactory.factory.PermPool.alloc(TypeGenCDef.TypeGenCDef.__sizeof__())
|
||
if SubTypeGenCDef is None:
|
||
stdio.printf("FAIL: TypeGenCDef alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTypeGenCDef, 0, TypeGenCDef.TypeGenCDef.__sizeof__())
|
||
SubTypeGenCDef.Gen = self
|
||
self.TypeGenCDef = SubTypeGenCDef
|
||
SubTypeGenCType: rawptr[TypeGenCType.TypeGenCType] = CompilerFactory.factory.PermPool.alloc(TypeGenCType.TypeGenCType.__sizeof__())
|
||
if SubTypeGenCType is None:
|
||
stdio.printf("FAIL: TypeGenCType alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTypeGenCType, 0, TypeGenCType.TypeGenCType.__sizeof__())
|
||
SubTypeGenCType.Gen = self
|
||
self.TypeGenCType = SubTypeGenCType
|
||
SubTypeGenResolve: rawptr[TypeGenResolve.TypeGenResolve] = CompilerFactory.factory.PermPool.alloc(TypeGenResolve.TypeGenResolve.__sizeof__())
|
||
if SubTypeGenResolve is None:
|
||
stdio.printf("FAIL: TypeGenResolve alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTypeGenResolve, 0, TypeGenResolve.TypeGenResolve.__sizeof__())
|
||
SubTypeGenResolve.Gen = self
|
||
self.TypeGenResolve = SubTypeGenResolve
|
||
SubTypeGenErr: rawptr[TypeGenErr.TypeGenErr] = CompilerFactory.factory.PermPool.alloc(TypeGenErr.TypeGenErr.__sizeof__())
|
||
if SubTypeGenErr is None:
|
||
stdio.printf("FAIL: TypeGenErr alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTypeGenErr, 0, TypeGenErr.TypeGenErr.__sizeof__())
|
||
SubTypeGenErr.Gen = self
|
||
self.TypeGenErr = SubTypeGenErr
|
||
SubStructGen: rawptr[StructGenMixin.StructGenMixin] = CompilerFactory.factory.PermPool.alloc(StructGenMixin.StructGenMixin.__sizeof__())
|
||
if SubStructGen is None:
|
||
stdio.printf("FAIL: StructGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubStructGen, 0, StructGenMixin.StructGenMixin.__sizeof__())
|
||
SubStructGen.Gen = self
|
||
self.StructGen = SubStructGen
|
||
SubExprGenBase: rawptr[ExprGenBase.ExprGenBase] = CompilerFactory.factory.PermPool.alloc(ExprGenBase.ExprGenBase.__sizeof__())
|
||
if SubExprGenBase is None:
|
||
stdio.printf("FAIL: ExprGenBase alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenBase, 0, ExprGenBase.ExprGenBase.__sizeof__())
|
||
SubExprGenBase.Gen = self
|
||
self.ExprGenBase = SubExprGenBase
|
||
SubExprGen: rawptr[ExprGenMixin.ExprGenMixin] = CompilerFactory.factory.PermPool.alloc(ExprGenMixin.ExprGenMixin.__sizeof__())
|
||
if SubExprGen is None:
|
||
stdio.printf("FAIL: ExprGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGen, 0, ExprGenMixin.ExprGenMixin.__sizeof__())
|
||
SubExprGen.Gen = self
|
||
self.ExprGen = SubExprGen
|
||
SubExprGenConst: rawptr[ExprGenConst.ExprGenConst] = CompilerFactory.factory.PermPool.alloc(ExprGenConst.ExprGenConst.__sizeof__())
|
||
if SubExprGenConst is None:
|
||
stdio.printf("FAIL: ExprGenConst alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenConst, 0, ExprGenConst.ExprGenConst.__sizeof__())
|
||
SubExprGenConst.Gen = self
|
||
self.ExprGenConst = SubExprGenConst
|
||
SubExprGenFstr: rawptr[ExprGenFstr.ExprGenFstr] = CompilerFactory.factory.PermPool.alloc(ExprGenFstr.ExprGenFstr.__sizeof__())
|
||
if SubExprGenFstr is None:
|
||
stdio.printf("FAIL: ExprGenFstr alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenFstr, 0, ExprGenFstr.ExprGenFstr.__sizeof__())
|
||
SubExprGenFstr.Gen = self
|
||
self.ExprGenFstr = SubExprGenFstr
|
||
SubExprGenOps: rawptr[ExprGenOps.ExprGenOps] = CompilerFactory.factory.PermPool.alloc(ExprGenOps.ExprGenOps.__sizeof__())
|
||
if SubExprGenOps is None:
|
||
stdio.printf("FAIL: ExprGenOps alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenOps, 0, ExprGenOps.ExprGenOps.__sizeof__())
|
||
SubExprGenOps.Gen = self
|
||
self.ExprGenOps = SubExprGenOps
|
||
SubExprGenCdef: rawptr[ExprGenCdef.ExprGenCdef] = CompilerFactory.factory.PermPool.alloc(ExprGenCdef.ExprGenCdef.__sizeof__())
|
||
if SubExprGenCdef is None:
|
||
stdio.printf("FAIL: ExprGenCdef alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenCdef, 0, ExprGenCdef.ExprGenCdef.__sizeof__())
|
||
SubExprGenCdef.Gen = self
|
||
self.ExprGenCdef = SubExprGenCdef
|
||
SubExprGenName: rawptr[ExprGenName.ExprGenName] = CompilerFactory.factory.PermPool.alloc(ExprGenName.ExprGenName.__sizeof__())
|
||
if SubExprGenName is None:
|
||
stdio.printf("FAIL: ExprGenName alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenName, 0, ExprGenName.ExprGenName.__sizeof__())
|
||
SubExprGenName.Gen = self
|
||
self.ExprGenName = SubExprGenName
|
||
SubExprGenAttr: rawptr[ExprGenAttr.ExprGenAttr] = CompilerFactory.factory.PermPool.alloc(ExprGenAttr.ExprGenAttr.__sizeof__())
|
||
if SubExprGenAttr is None:
|
||
stdio.printf("FAIL: ExprGenAttr alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenAttr, 0, ExprGenAttr.ExprGenAttr.__sizeof__())
|
||
SubExprGenAttr.Gen = self
|
||
self.ExprGenAttr = SubExprGenAttr
|
||
SubExprGenCls: rawptr[ExprGenCls.ExprGenCls] = CompilerFactory.factory.PermPool.alloc(ExprGenCls.ExprGenCls.__sizeof__())
|
||
if SubExprGenCls is None:
|
||
stdio.printf("FAIL: ExprGenCls alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubExprGenCls, 0, ExprGenCls.ExprGenCls.__sizeof__())
|
||
SubExprGenCls.Gen = self
|
||
self.ExprGenCls = SubExprGenCls
|
||
SubCallGenBase: rawptr[CallGenBase.CallGenBase] = CompilerFactory.factory.PermPool.alloc(CallGenBase.CallGenBase.__sizeof__())
|
||
if SubCallGenBase is None:
|
||
stdio.printf("FAIL: CallGenBase alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenBase, 0, CallGenBase.CallGenBase.__sizeof__())
|
||
SubCallGenBase.Gen = self
|
||
self.CallGenBase = SubCallGenBase
|
||
SubCallGenCBuiltin: rawptr[CallGenCBuiltin.CallGenCBuiltin] = CompilerFactory.factory.PermPool.alloc(CallGenCBuiltin.CallGenCBuiltin.__sizeof__())
|
||
if SubCallGenCBuiltin is None:
|
||
stdio.printf("FAIL: CallGenCBuiltin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenCBuiltin, 0, CallGenCBuiltin.CallGenCBuiltin.__sizeof__())
|
||
SubCallGenCBuiltin.Gen = self
|
||
self.CallGenCBuiltin = SubCallGenCBuiltin
|
||
SubCallGenLeafKit: rawptr[CallGenLeafKit.CallGenLeafKit] = CompilerFactory.factory.PermPool.alloc(CallGenLeafKit.CallGenLeafKit.__sizeof__())
|
||
if SubCallGenLeafKit is None:
|
||
stdio.printf("FAIL: CallGenLeafKit alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenLeafKit, 0, CallGenLeafKit.CallGenLeafKit.__sizeof__())
|
||
SubCallGenLeafKit.Gen = self
|
||
self.CallGenLeafKit = SubCallGenLeafKit
|
||
SubCallGenCtor: rawptr[CallGenCtor.CallGenCtor] = CompilerFactory.factory.PermPool.alloc(CallGenCtor.CallGenCtor.__sizeof__())
|
||
if SubCallGenCtor is None:
|
||
stdio.printf("FAIL: CallGenCtor alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenCtor, 0, CallGenCtor.CallGenCtor.__sizeof__())
|
||
SubCallGenCtor.Gen = self
|
||
self.CallGenCtor = SubCallGenCtor
|
||
SubCallGenCall: rawptr[CallGenCall.CallGenCall] = CompilerFactory.factory.PermPool.alloc(CallGenCall.CallGenCall.__sizeof__())
|
||
if SubCallGenCall is None:
|
||
stdio.printf("FAIL: CallGenCall alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenCall, 0, CallGenCall.CallGenCall.__sizeof__())
|
||
SubCallGenCall.Gen = self
|
||
self.CallGenCall = SubCallGenCall
|
||
SubCallGen: rawptr[CallGenMixin.CallGenMixin] = CompilerFactory.factory.PermPool.alloc(CallGenMixin.CallGenMixin.__sizeof__())
|
||
if SubCallGen is None:
|
||
stdio.printf("FAIL: CallGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGen, 0, CallGenMixin.CallGenMixin.__sizeof__())
|
||
SubCallGen.Gen = self
|
||
self.CallGen = SubCallGen
|
||
SubCallGenDispatch: rawptr[CallGenDispatch.CallGenDispatch] = CompilerFactory.factory.PermPool.alloc(CallGenDispatch.CallGenDispatch.__sizeof__())
|
||
if SubCallGenDispatch is None:
|
||
stdio.printf("FAIL: CallGenDispatch alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenDispatch, 0, CallGenDispatch.CallGenDispatch.__sizeof__())
|
||
SubCallGenDispatch.Gen = self
|
||
self.CallGenDispatch = SubCallGenDispatch
|
||
SubCallGenLib: rawptr[CallGenLib.CallGenLib] = CompilerFactory.factory.PermPool.alloc(CallGenLib.CallGenLib.__sizeof__())
|
||
if SubCallGenLib is None:
|
||
stdio.printf("FAIL: CallGenLib alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenLib, 0, CallGenLib.CallGenLib.__sizeof__())
|
||
SubCallGenLib.Gen = self
|
||
self.CallGenLib = SubCallGenLib
|
||
SubCallGenVt: rawptr[CallGenVt.CallGenVt] = CompilerFactory.factory.PermPool.alloc(CallGenVt.CallGenVt.__sizeof__())
|
||
if SubCallGenVt is None:
|
||
stdio.printf("FAIL: CallGenVt alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenVt, 0, CallGenVt.CallGenVt.__sizeof__())
|
||
SubCallGenVt.Gen = self
|
||
self.CallGenVt = SubCallGenVt
|
||
SubCallGenVa: rawptr[CallGenVa.CallGenVa] = CompilerFactory.factory.PermPool.alloc(CallGenVa.CallGenVa.__sizeof__())
|
||
if SubCallGenVa is None:
|
||
stdio.printf("FAIL: CallGenVa alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenVa, 0, CallGenVa.CallGenVa.__sizeof__())
|
||
SubCallGenVa.Gen = self
|
||
self.CallGenVa = SubCallGenVa
|
||
SubCallGenProp: rawptr[CallGenProp.CallGenProp] = CompilerFactory.factory.PermPool.alloc(CallGenProp.CallGenProp.__sizeof__())
|
||
if SubCallGenProp is None:
|
||
stdio.printf("FAIL: CallGenProp alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenProp, 0, CallGenProp.CallGenProp.__sizeof__())
|
||
SubCallGenProp.Gen = self
|
||
self.CallGenProp = SubCallGenProp
|
||
SubCallGenFd: rawptr[CallGenFd.CallGenFd] = CompilerFactory.factory.PermPool.alloc(CallGenFd.CallGenFd.__sizeof__())
|
||
if SubCallGenFd is None:
|
||
stdio.printf("FAIL: CallGenFd alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubCallGenFd, 0, CallGenFd.CallGenFd.__sizeof__())
|
||
SubCallGenFd.Gen = self
|
||
self.CallGenFd = SubCallGenFd
|
||
SubFuncGenBase: rawptr[FuncGenBase.FuncGenBase] = CompilerFactory.factory.PermPool.alloc(FuncGenBase.FuncGenBase.__sizeof__())
|
||
if SubFuncGenBase is None:
|
||
stdio.printf("FAIL: FuncGenBase alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubFuncGenBase, 0, FuncGenBase.FuncGenBase.__sizeof__())
|
||
SubFuncGenBase.Gen = self
|
||
self.FuncGenBase = SubFuncGenBase
|
||
SubFuncGenDef: rawptr[FuncGenDef.FuncGenDef] = CompilerFactory.factory.PermPool.alloc(FuncGenDef.FuncGenDef.__sizeof__())
|
||
if SubFuncGenDef is None:
|
||
stdio.printf("FAIL: FuncGenDef alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubFuncGenDef, 0, FuncGenDef.FuncGenDef.__sizeof__())
|
||
SubFuncGenDef.Gen = self
|
||
self.FuncGenDef = SubFuncGenDef
|
||
SubFuncGen: rawptr[FuncGenMixin.FuncGenMixin] = CompilerFactory.factory.PermPool.alloc(FuncGenMixin.FuncGenMixin.__sizeof__())
|
||
if SubFuncGen is None:
|
||
stdio.printf("FAIL: FuncGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubFuncGen, 0, FuncGenMixin.FuncGenMixin.__sizeof__())
|
||
SubFuncGen.Gen = self
|
||
self.FuncGen = SubFuncGen
|
||
SubClassGenBase: rawptr[ClassGenBase.ClassGenBase] = CompilerFactory.factory.PermPool.alloc(ClassGenBase.ClassGenBase.__sizeof__())
|
||
if SubClassGenBase is None:
|
||
stdio.printf("FAIL: ClassGenBase alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubClassGenBase, 0, ClassGenBase.ClassGenBase.__sizeof__())
|
||
SubClassGenBase.Gen = self
|
||
self.ClassGenBase = SubClassGenBase
|
||
SubClassGen: rawptr[ClassGenMixin.ClassGenMixin] = CompilerFactory.factory.PermPool.alloc(ClassGenMixin.ClassGenMixin.__sizeof__())
|
||
if SubClassGen is None:
|
||
stdio.printf("FAIL: ClassGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubClassGen, 0, ClassGenMixin.ClassGenMixin.__sizeof__())
|
||
SubClassGen.Gen = self
|
||
self.ClassGen = SubClassGen
|
||
SubClassGenEnum: rawptr[ClassGenEnum.ClassGenEnum] = CompilerFactory.factory.PermPool.alloc(ClassGenEnum.ClassGenEnum.__sizeof__())
|
||
if SubClassGenEnum is None:
|
||
stdio.printf("FAIL: ClassGenEnum alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubClassGenEnum, 0, ClassGenEnum.ClassGenEnum.__sizeof__())
|
||
SubClassGenEnum.Gen = self
|
||
self.ClassGenEnum = SubClassGenEnum
|
||
SubClassGenGeneric: rawptr[ClassGenGeneric.ClassGenGeneric] = CompilerFactory.factory.PermPool.alloc(ClassGenGeneric.ClassGenGeneric.__sizeof__())
|
||
if SubClassGenGeneric is None:
|
||
stdio.printf("FAIL: ClassGenGeneric alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubClassGenGeneric, 0, ClassGenGeneric.ClassGenGeneric.__sizeof__())
|
||
SubClassGenGeneric.Gen = self
|
||
self.ClassGenGeneric = SubClassGenGeneric
|
||
SubClassGenVTable: rawptr[ClassGenVTable.ClassGenVTable] = CompilerFactory.factory.PermPool.alloc(ClassGenVTable.ClassGenVTable.__sizeof__())
|
||
if SubClassGenVTable is None:
|
||
stdio.printf("FAIL: ClassGenVTable alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubClassGenVTable, 0, ClassGenVTable.ClassGenVTable.__sizeof__())
|
||
SubClassGenVTable.Gen = self
|
||
self.ClassGenVTable = SubClassGenVTable
|
||
SubClassGenDef: rawptr[ClassGenDef.ClassGenDef] = CompilerFactory.factory.PermPool.alloc(ClassGenDef.ClassGenDef.__sizeof__())
|
||
if SubClassGenDef is None:
|
||
stdio.printf("FAIL: ClassGenDef alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubClassGenDef, 0, ClassGenDef.ClassGenDef.__sizeof__())
|
||
SubClassGenDef.Gen = self
|
||
self.ClassGenDef = SubClassGenDef
|
||
SubImportsGen: rawptr[ImportsGenMixin.ImportsGenMixin] = CompilerFactory.factory.PermPool.alloc(ImportsGenMixin.ImportsGenMixin.__sizeof__())
|
||
if SubImportsGen is None:
|
||
stdio.printf("FAIL: ImportsGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubImportsGen, 0, ImportsGenMixin.ImportsGenMixin.__sizeof__())
|
||
SubImportsGen.Gen = self
|
||
self.ImportsGen = SubImportsGen
|
||
SubStmtGenCif: rawptr[StmtGenCifMixin.StmtGenCifMixin] = CompilerFactory.factory.PermPool.alloc(StmtGenCifMixin.StmtGenCifMixin.__sizeof__())
|
||
if SubStmtGenCif is None:
|
||
stdio.printf("FAIL: StmtGenCifMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubStmtGenCif, 0, StmtGenCifMixin.StmtGenCifMixin.__sizeof__())
|
||
SubStmtGenCif.Gen = self
|
||
self.StmtGenCif = SubStmtGenCif
|
||
SubStmtGenDecl: rawptr[StmtGenDeclMixin.StmtGenDeclMixin] = CompilerFactory.factory.PermPool.alloc(StmtGenDeclMixin.StmtGenDeclMixin.__sizeof__())
|
||
if SubStmtGenDecl is None:
|
||
stdio.printf("FAIL: StmtGenDeclMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubStmtGenDecl, 0, StmtGenDeclMixin.StmtGenDeclMixin.__sizeof__())
|
||
SubStmtGenDecl.Gen = self
|
||
self.StmtGenDecl = SubStmtGenDecl
|
||
SubStmtGen: rawptr[StmtGenMixin.StmtGenMixin] = CompilerFactory.factory.PermPool.alloc(StmtGenMixin.StmtGenMixin.__sizeof__())
|
||
if SubStmtGen is None:
|
||
stdio.printf("FAIL: StmtGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubStmtGen, 0, StmtGenMixin.StmtGenMixin.__sizeof__())
|
||
SubStmtGen.Gen = self
|
||
self.StmtGen = SubStmtGen
|
||
SubMatchGen: rawptr[MatchGenMixin.MatchGenMixin] = CompilerFactory.factory.PermPool.alloc(MatchGenMixin.MatchGenMixin.__sizeof__())
|
||
if SubMatchGen is None:
|
||
stdio.printf("FAIL: MatchGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubMatchGen, 0, MatchGenMixin.MatchGenMixin.__sizeof__())
|
||
SubMatchGen.Gen = self
|
||
self.MatchGen = SubMatchGen
|
||
SubAssignGen: rawptr[AssignGenMixin.AssignGenMixin] = CompilerFactory.factory.PermPool.alloc(AssignGenMixin.AssignGenMixin.__sizeof__())
|
||
if SubAssignGen is None:
|
||
stdio.printf("FAIL: AssignGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubAssignGen, 0, AssignGenMixin.AssignGenMixin.__sizeof__())
|
||
SubAssignGen.Gen = self
|
||
self.AssignGen = SubAssignGen
|
||
SubVarGen: rawptr[VarGenMixin.VarGenMixin] = CompilerFactory.factory.PermPool.alloc(VarGenMixin.VarGenMixin.__sizeof__())
|
||
if SubVarGen is None:
|
||
stdio.printf("FAIL: VarGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubVarGen, 0, VarGenMixin.VarGenMixin.__sizeof__())
|
||
SubVarGen.Gen = self
|
||
self.VarGen = SubVarGen
|
||
SubTranslatorGen: rawptr[TranslatorGenMixin.TranslatorGenMixin] = CompilerFactory.factory.PermPool.alloc(TranslatorGenMixin.TranslatorGenMixin.__sizeof__())
|
||
if SubTranslatorGen is None:
|
||
stdio.printf("FAIL: TranslatorGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubTranslatorGen, 0, TranslatorGenMixin.TranslatorGenMixin.__sizeof__())
|
||
SubTranslatorGen.Gen = self
|
||
self.TranslatorGen = SubTranslatorGen
|
||
SubAsyncGen: rawptr[AsyncGenMixin.AsyncGenMixin] = CompilerFactory.factory.PermPool.alloc(AsyncGenMixin.AsyncGenMixin.__sizeof__())
|
||
if SubAsyncGen is None:
|
||
stdio.printf("FAIL: AsyncGenMixin alloc failed\n")
|
||
stdlib.exit(1)
|
||
string.memset(SubAsyncGen, 0, AsyncGenMixin.AsyncGenMixin.__sizeof__())
|
||
SubAsyncGen.Gen = self
|
||
self.AsyncGen = SubAsyncGen
|
||
|
||
# ---- 初始化各子对象字段(Init* 方法内联调用) ----
|
||
SubBaseGen.InitBaseGen(pool)
|
||
SubTypeGenBase.InitTypeGen()
|
||
SubCallGenBase.InitCallGen()
|
||
SubStructGen.InitStructGen()
|
||
SubClassGenBase.InitClassGen()
|
||
SubExprGenBase.InitExprGen()
|
||
SubImportsGen.InitImportsGen()
|
||
SubStmtGenCif.InitStmtGen()
|
||
SubAssignGen.InitAssignGen()
|
||
|
||
|
||
# ============================================================
|
||
# 全局生成器单例(组合架构兼容层)
|
||
# ============================================================
|
||
_g_gen: Generator* = None
|