457 lines
25 KiB
Plaintext
457 lines
25 KiB
Plaintext
import string
|
|
import lib.core.CompilerFactory as CompilerFactory
|
|
from stdint import *
|
|
import stdio
|
|
import stdlib
|
|
import memhub
|
|
import mlirlite
|
|
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 - generator (bidirectional-reference composition architecture)
|
|
novirtual class Generator:
|
|
"""Generator holding pointers to all GenMixin sub-objects (bidirectional composition)."""
|
|
|
|
# ---- sub-object pointers (46, permanent pool) ----
|
|
BaseGen: BaseGenMixin.BaseGenMixin*
|
|
TypeGenBase: TypeGenBase.TypeGenBase*
|
|
TypeGen: TypeGenMixin.TypeGenMixin*
|
|
TypeGenCDef: TypeGenCDef.TypeGenCDef*
|
|
TypeGenCType: TypeGenCType.TypeGenCType*
|
|
TypeGenResolve: TypeGenResolve.TypeGenResolve*
|
|
TypeGenErr: TypeGenErr.TypeGenErr*
|
|
StructGen: StructGenMixin.StructGenMixin*
|
|
ExprGenBase: ExprGenBase.ExprGenBase*
|
|
ExprGen: ExprGenMixin.ExprGenMixin*
|
|
ExprGenConst: ExprGenConst.ExprGenConst*
|
|
ExprGenFstr: ExprGenFstr.ExprGenFstr*
|
|
ExprGenOps: ExprGenOps.ExprGenOps*
|
|
ExprGenCdef: ExprGenCdef.ExprGenCdef*
|
|
ExprGenName: ExprGenName.ExprGenName*
|
|
ExprGenAttr: ExprGenAttr.ExprGenAttr*
|
|
ExprGenCls: ExprGenCls.ExprGenCls*
|
|
CallGenBase: CallGenBase.CallGenBase*
|
|
CallGenCBuiltin: CallGenCBuiltin.CallGenCBuiltin*
|
|
CallGenLeafKit: CallGenLeafKit.CallGenLeafKit*
|
|
CallGenCtor: CallGenCtor.CallGenCtor*
|
|
CallGenCall: CallGenCall.CallGenCall*
|
|
CallGen: CallGenMixin.CallGenMixin*
|
|
CallGenDispatch: CallGenDispatch.CallGenDispatch*
|
|
CallGenLib: CallGenLib.CallGenLib*
|
|
CallGenVt: CallGenVt.CallGenVt*
|
|
CallGenVa: CallGenVa.CallGenVa*
|
|
CallGenProp: CallGenProp.CallGenProp*
|
|
CallGenFd: CallGenFd.CallGenFd*
|
|
FuncGenBase: FuncGenBase.FuncGenBase*
|
|
FuncGenDef: FuncGenDef.FuncGenDef*
|
|
FuncGen: FuncGenMixin.FuncGenMixin*
|
|
ClassGenBase: ClassGenBase.ClassGenBase*
|
|
ClassGen: ClassGenMixin.ClassGenMixin*
|
|
ClassGenEnum: ClassGenEnum.ClassGenEnum*
|
|
ClassGenGeneric: ClassGenGeneric.ClassGenGeneric*
|
|
ClassGenVTable: ClassGenVTable.ClassGenVTable*
|
|
ClassGenDef: ClassGenDef.ClassGenDef*
|
|
ImportsGen: ImportsGenMixin.ImportsGenMixin*
|
|
StmtGenCif: StmtGenCifMixin.StmtGenCifMixin*
|
|
StmtGenDecl: StmtGenDeclMixin.StmtGenDeclMixin*
|
|
StmtGen: StmtGenMixin.StmtGenMixin*
|
|
MatchGen: MatchGenMixin.MatchGenMixin*
|
|
AssignGen: AssignGenMixin.AssignGenMixin*
|
|
AsyncGen: AsyncGenMixin.AsyncGenMixin*
|
|
VarGen: VarGenMixin.VarGenMixin*
|
|
TranslatorGen: TranslatorGenMixin.TranslatorGenMixin*
|
|
|
|
def __init__(self, pool: memhub.MemBuddy*):
|
|
if self is None: return
|
|
# ---- alloc 46 sub-objects + back-pointers (permanent pool, fail-fast) ----
|
|
SubBaseGen: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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
|
|
|
|
# ---- initialize sub-object fields (Init* methods called inline) ----
|
|
SubBaseGen.InitBaseGen(pool)
|
|
SubTypeGenBase.InitTypeGen()
|
|
SubCallGenBase.InitCallGen()
|
|
SubStructGen.InitStructGen()
|
|
SubClassGenBase.InitClassGen()
|
|
SubExprGenBase.InitExprGen()
|
|
SubImportsGen.InitImportsGen()
|
|
SubStmtGenCif.InitStmtGen()
|
|
SubAssignGen.InitAssignGen()
|
|
|
|
|
|
# global generator singleton (composition-architecture compatibility layer)
|
|
_g_gen: Generator* = None
|