internal void Resolve(T0Comp ctx) { if (Target == null) { Target = ctx.Lookup(Name); } }
internal override Word GetReference(T0Comp ctx) { if (target == null) { throw new Exception("Unresolved call target"); } return(target); }
internal WordInterpreted(T0Comp owner, string name, int numLocals, Opcode[] code, string[] toResolve) : base(owner, name) { this.Code = code; this.toResolve = toResolve; NumLocals = numLocals; }
internal WordData(T0Comp owner, string name, string baseBlobName, int offset) : base(owner, name) { this.baseBlobName = baseBlobName; this.offset = offset; StackEffect = new SType(0, 1); }
internal WordData(T0Comp owner, string name, ConstData blob, int offset) : base(owner, name) { this.blob = blob; this.offset = offset; StackEffect = new SType(0, 1); }
internal override Word GetReference(T0Comp ctx) { TPointerXT xt = val.ptr as TPointerXT; if (xt == null) { return(null); } xt.Resolve(ctx); return(xt.Target); }
/* * Create a new instance, with the specified word name. */ internal WordBuilder(T0Comp TC, string name) { this.TC = TC; this.name = name; cfStack = new int[16]; cfPtr = -1; code = new List <Opcode>(); toResolve = new List <string>(); locals = new Dictionary <string, int>(); jumpToLast = true; StackEffect = SType.UNKNOWN; }
internal ConstData(T0Comp ctx) { ID = ctx.NextBlobID(); buf = new byte[4]; len = 0; }
internal override ConstData GetDataBlock(T0Comp ctx) { TPointerBlob bp = val.ptr as TPointerBlob; return(bp == null ? null : bp.Blob); }
internal WordNative(T0Comp owner, string name, SType stackEffect, NativeRun code) : this(owner, name, code) { StackEffect = stackEffect; }
internal WordNative(T0Comp owner, string name, NativeRun code) : base(owner, name) { this.code = code; }
internal virtual void Execute(T0Comp ctx, CPU cpu) { throw new Exception("value is not an xt: " + ToString()); }
internal Word(T0Comp owner, string name) { TC = owner; Name = name; StackEffect = SType.UNKNOWN; }
internal TPointerBlob(T0Comp owner, string s) { Blob = new ConstData(owner); Blob.AddString(s); }
internal override void Execute(T0Comp ctx, CPU cpu) { Resolve(ctx); Target.Run(cpu); }
/* * Get the Word that this opcode references; this can happen * only with "call" and "const" opcodes. For all other opcodes, * this method returns null. */ internal virtual Word GetReference(T0Comp ctx) { return(null); }
/* * If this value is an XT, then execute it. Otherwise, an exception * is thrown. */ internal void Execute(T0Comp ctx, CPU cpu) { ToXT().Execute(ctx, cpu); }
/* * Get the data block that this opcode references; this can happen * only with "const" opcodes. For all other opcodes, this method * returns null. */ internal virtual ConstData GetDataBlock(T0Comp ctx) { return(null); }