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);
 }
Beispiel #3
0
 internal WordInterpreted(T0Comp owner, string name,
                          int numLocals, Opcode[] code, string[] toResolve)
     : base(owner, name)
 {
     this.Code      = code;
     this.toResolve = toResolve;
     NumLocals      = numLocals;
 }
Beispiel #4
0
 internal WordData(T0Comp owner, string name,
                   string baseBlobName, int offset)
     : base(owner, name)
 {
     this.baseBlobName = baseBlobName;
     this.offset       = offset;
     StackEffect       = new SType(0, 1);
 }
Beispiel #5
0
 internal WordData(T0Comp owner, string name,
                   ConstData blob, int offset)
     : base(owner, name)
 {
     this.blob   = blob;
     this.offset = offset;
     StackEffect = new SType(0, 1);
 }
Beispiel #6
0
    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;
 }
Beispiel #8
0
 internal ConstData(T0Comp ctx)
 {
     ID  = ctx.NextBlobID();
     buf = new byte[4];
     len = 0;
 }
Beispiel #9
0
    internal override ConstData GetDataBlock(T0Comp ctx)
    {
        TPointerBlob bp = val.ptr as TPointerBlob;

        return(bp == null ? null : bp.Blob);
    }
Beispiel #10
0
 internal WordNative(T0Comp owner, string name,
                     SType stackEffect, NativeRun code)
     : this(owner, name, code)
 {
     StackEffect = stackEffect;
 }
Beispiel #11
0
 internal WordNative(T0Comp owner, string name, NativeRun code)
     : base(owner, name)
 {
     this.code = code;
 }
Beispiel #12
0
 internal virtual void Execute(T0Comp ctx, CPU cpu)
 {
     throw new Exception("value is not an xt: " + ToString());
 }
Beispiel #13
0
 internal Word(T0Comp owner, string name)
 {
     TC          = owner;
     Name        = name;
     StackEffect = SType.UNKNOWN;
 }
Beispiel #14
0
 internal TPointerBlob(T0Comp owner, string s)
 {
     Blob = new ConstData(owner);
     Blob.AddString(s);
 }
Beispiel #15
0
 internal override void Execute(T0Comp ctx, CPU cpu)
 {
     Resolve(ctx);
     Target.Run(cpu);
 }
Beispiel #16
0
 /*
  * 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);
 }
Beispiel #17
0
 /*
  * 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);
 }
Beispiel #18
0
 /*
  * 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);
 }