[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime .cvsignore, 1.1, 1.2 FNarithM.nc, 1.3, 1.4 FNbasic.nc, 1.2, 1.3 FNlist.nc, 1.3, 1.4 FNlistM.nc, 1.5, 1.6 FNseq.nc, 1.2, 1.3 FNseqM.nc, 1.4, 1.5 FNstring.nc, 1.2, 1.3 FNstringM.nc, 1.4, 1.5

David Gay idgay at users.sourceforge.net
Tue Oct 25 09:54:12 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv806/runtime

Modified Files:
	.cvsignore FNarithM.nc FNbasic.nc FNlist.nc FNlistM.nc 
	FNseq.nc FNseqM.nc FNstring.nc FNstringM.nc 
Log Message:
compile error fixes


Index: .cvsignore
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** .cvsignore	19 May 2005 17:41:37 -0000	1.1
--- .cvsignore	25 Oct 2005 16:54:08 -0000	1.2
***************
*** 1 ****
--- 1,2 ----
  gen
+ sgen

Index: FNarithM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNarithM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** FNarithM.nc	25 Oct 2005 00:01:25 -0000	1.3
--- FNarithM.nc	25 Oct 2005 16:54:08 -0000	1.4
***************
*** 57,61 ****
  
    //FN min: n1 n2 ... -> n. n = min(n1, n2, ...)
!   command result_t Min.execute(uint8_t instr, MateContext* context) {
      if (nargs < 1)
        call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
--- 57,61 ----
  
    //FN min: n1 n2 ... -> n. n = min(n1, n2, ...)
!   command result_t Min.execute(uint8_t nargs, MateContext* context) {
      if (nargs < 1)
        call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
***************
*** 70,74 ****
  	    if (call T.int_intp(x, y))
  	      {
! 		if (call T.intv(y) M call T.intv(x))
  		  x = y;
  	      }
--- 70,74 ----
  	    if (call T.int_intp(x, y))
  	      {
! 		if (call T.intv(y) < call T.intv(x))
  		  x = y;
  	      }

Index: FNbasic.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNbasic.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FNbasic.nc	30 Nov 2004 18:52:43 -0000	1.2
--- FNbasic.nc	25 Oct 2005 16:54:08 -0000	1.3
***************
*** 2,5 ****
--- 2,6 ----
    provides {
      interface MateBytecode as FunctionP;
+     interface MateBytecode as SymbolP;
      interface MateBytecode as Apply;
      interface MateBytecode as Error;
***************
*** 11,14 ****
--- 12,16 ----
  
    FunctionP = FNbasicM.FunctionP;
+   SymbolP = FNbasicM.SymbolP;
    Apply = FNbasicM.Apply;
    Error = FNbasicM.Error;

Index: FNlist.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNlist.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** FNlist.nc	23 Oct 2005 21:58:01 -0000	1.3
--- FNlist.nc	25 Oct 2005 16:54:08 -0000	1.4
***************
*** 8,15 ****
      interface MateBytecode as SetCdrB;
      interface MateBytecode as List;
-     interface MateBytecode as Memq;
-     interface MateBytecode as Memv;
-     interface MateBytecode as Assq;
-     interface MateBytecode as Assv;
      interface MateBytecode as ListTail;
      interface MateBytecode as ListRef;
--- 8,11 ----
***************
*** 40,47 ****
    SetCdrB = FNlistM.SetCdrB;
    List = FNlistM.List;
-   Memq = FNlistM.Memq;
-   Memv = FNlistM.Memv;
-   Assq = FNlistM.Assq;
-   Assv = FNlistM.Assv;
    ListTail = FNlistM.ListTail;
    ListRef = FNlistM.ListRef;
--- 36,39 ----

Index: FNlistM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNlistM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FNlistM.nc	25 Oct 2005 00:39:10 -0000	1.5
--- FNlistM.nc	25 Oct 2005 16:54:08 -0000	1.6
***************
*** 8,15 ****
      interface MateBytecode as SetCdrB;
      interface MateBytecode as List;
-     interface MateBytecode as Memq;
-     interface MateBytecode as Memv;
-     interface MateBytecode as Assq;
-     interface MateBytecode as Assv;
      interface MateBytecode as ListTail;
      interface MateBytecode as ListRef;
--- 8,11 ----
***************
*** 38,50 ****
  }
  implementation {
-   bool valid_list(MateContext *context, mvalue l, msize *len) {
-     bool ok = call T.valid_list(l, len);
- 
-     if (!ok)
-       call E.error(context, MOTLLE_ERROR_BAD_VALUE);
-     
-     return ok;
-   }
- 
    //FN cons: x1 x2 -> l. Make a new pair from elements x1 & x2
    command result_t Cons.execute(uint8_t instr, MateContext* context) {
--- 34,37 ----
***************
*** 163,275 ****
    }
  
-   //FN assq: l x1 -> x2. Returns first element of l whose car is x1,
-   //   or false if there is no such element.
-   command result_t Assq.execute(uint8_t nargs, MateContext* context) {
-     mvalue l = call S.pop(context, 1);
-     mvalue x = call S.pop(context, 1);
-     msize len;
-     mvalue result;
- 
-     if (valid_list(context, l, &len))
-       {
- 	for (;;)
- 	  {
- 	    vpair p;
- 	    mvalue pcar;
- 
- 	    if (call T.nilp(l))
- 	      {
- 		result = call T.nil();
- 		break;
- 	      }
- 
- 	    p = call T.pair(l);
- 	    pcar = call V.read(&p->car);
- 	    if (call T.pairp(pcar))
- 	      {
- 		vpair elem = call T.pair(pcar);
- 
- 		if (x == call V.read(&elem->car))
- 		  {
- 		    result = pcar;
- 		    break;
- 		  }
- 	      }
- 	    l = call V.read(&p->cdr);
- 	  }
- 	call S.qpush(context, result);
-       }
-     return SUCCESS;
-   }
- 
-   command uint8_t Assq.byteLength() {
-     return 1;
-   }
- 
-   //FN assv: l x1 -> x2. Returns first element of l whose car is x1,
-   //   or false if there is no such element.
-   command result_t Assv.execute(uint8_t nargs, MateContext* context) {
-     return call Assq.execute(nargs, context);
-   }
- 
-   command uint8_t Assv.byteLength() {
-     return 1;
-   }
- 
-   //FN memq: l1 x -> l2. Returns l1 starting at the first element which is x,
-   //   or false if there is no such element.
-   command result_t Memq.execute(uint8_t nargs, MateContext* context) {
-     mvalue l = call S.pop(context, 1);
-     mvalue x = call S.pop(context, 1);
-     msize len;
-     mvalue result;
- 
-     if (valid_list(context, l, &len))
-       {
- 	for (;;)
- 	  {
- 	    vpair p;
- 
- 	    if (call T.nilp(l))
- 	      {
- 		result = call T.nil();
- 		break;
- 	      }
- 
- 	    p = call T.pair(l);
- 	    if (call V.read(&p->car) == x)
- 	      {
- 		result = p;
- 		break;
- 	      }
- 	    l = call V.read(&p->cdr);
- 	  }
- 	call S.qpush(context, result);
-       }
-     return SUCCESS;
-   }
- 
-   command uint8_t Memq.byteLength() {
-     return 1;
-   }
- 
-   //FN memv: l1 x -> l2. Returns l1 starting at the first element which is x,
-   //   or false if there is no such element.
-   command result_t Memv.execute(uint8_t nargs, MateContext* context) {
-     return call Memq.execute(nargs, context);
-   }
- 
-   command uint8_t Memv.byteLength() {
-     return 1;
-   }
- 
    //FN list-tail: l1 n -> l2. Returns the nth cdr of l2
    command result_t ListTail.execute(uint8_t nargs, MateContext* context) {
!     mvalue mn = call S.pop(context, n);
      mvalue l = call S.pop(context, 1);
  
      if (call T.intp(mn))
        {
! 	vint n = call T.inv(mn);
  
  	if (n < 0)
--- 150,161 ----
    }
  
    //FN list-tail: l1 n -> l2. Returns the nth cdr of l2
    command result_t ListTail.execute(uint8_t nargs, MateContext* context) {
!     mvalue mn = call S.pop(context, 1);
      mvalue l = call S.pop(context, 1);
  
      if (call T.intp(mn))
        {
! 	vint n = call T.intv(mn);
  
  	if (n < 0)
***************
*** 288,291 ****
--- 174,179 ----
      else
        call E.error(context, MOTLLE_ERROR_BAD_TYPE);
+ 
+     return SUCCESS;
    }
  
***************
*** 296,305 ****
    //FN list-ref: l1 n -> l2. Returns the nth car of l2
    command result_t ListRef.execute(uint8_t nargs, MateContext* context) {
!     mvalue mn = call S.pop(context, n);
      mvalue l = call S.pop(context, 1);
  
      if (call T.intp(mn))
        {
! 	vint n = call T.inv(mn);
  
  	if (n < 0)
--- 184,193 ----
    //FN list-ref: l1 n -> l2. Returns the nth car of l2
    command result_t ListRef.execute(uint8_t nargs, MateContext* context) {
!     mvalue mn = call S.pop(context, 1);
      mvalue l = call S.pop(context, 1);
  
      if (call T.intp(mn))
        {
! 	vint n = call T.intv(mn);
  
  	if (n < 0)
***************
*** 327,406 ****
      else
        call E.error(context, MOTLLE_ERROR_BAD_TYPE);
-   }
- 
-   command uint8_t ListRef.byteLength() {
-     return 1;
-   }
- 
-   //FN reverse: l1 -> l2. Reverse list l1
-   command result_t Reverse.execute(uint8_t instr, MateContext* context) {
-     mvalue x = call S.pop(context, 1), result = call T.nil();
-     msize len, i;
- 
-     if (valid_list(context, x, &len))
-       {
- 	while (!call T.nilp(x))
- 	  {
- 	    vpair p = call T.pair(x);
- 
- 	    x = call V.read(&p->cdr);
- 	    GCPRO1(x);
- 	    result = call T.alloc_list(call V.read(&p->car), result);
- 	    GCPOP1(x);
- 	    if (!result)
- 	      return SUCCESS;
- 	  }
- 	call S.qpush(context, result);
-       }
-     return SUCCESS;
-   }
- 
-   command uint8_t Reverse.byteLength() {
-     return 1;
-   }
- 
-   //FN append: l1 l2 -> l3. Append list l1 to l2.
-   command result_t Append.execute(uint8_t instr, MateContext* context) {
-     mvalue l2 = call S.pop(context, 1);
-     mvalue l1 = call S.pop(context, 1);
-     msize len, i;
- 
-     if (call T.nilp(l1))
-       call S.qpush(context, l2);
-     else if (valid_list(context, l1, &len))
-       {
- 	/* Make n element list, then fill it in (this avoids
- 	   constantly protecting/unprotecting and accessing x) */
- 	GCPRO1(x);
- 	result = make_list(len);
- 	GCPOP1(x);
  
- 	if (result)
- 	  {
- 	    mvalue scanr = result;
- 
- 	    for (;;)
- 	      {
- 		vpair pl1 = call T.pair(l1);
- 		vpair pr = call T.pair(scanr);
- 
- 		call V.write(&pr->car, call V.read(&pl1->car));
- 		l1 = call V.read(&pl1->cdr);
- 
- 		if (call T.nilp(l1))
- 		  {
- 		    call V.write(&pr->cdr, l2);
- 		    break;
- 		  }
- 		else
- 		  scanr = call V.read(&pr->cdr);
- 	      }
- 	    call S.qpush(context, result);
- 	  }
-       }
      return SUCCESS;
    }
  
!   command uint8_t Append.byteLength() {
      return 1;
    }
--- 215,223 ----
      else
        call E.error(context, MOTLLE_ERROR_BAD_TYPE);
  
      return SUCCESS;
    }
  
!   command uint8_t ListRef.byteLength() {
      return 1;
    }
***************
*** 408,412 ****
  #define CAR(l) (l = l && call T.pairp(l) ? call V.read(&(call T.pair(l))->car) : NULL)
  #define CDR(l) (l = l && call T.pairp(l) ? call V.read(&(call T.pair(l))->cdr) : NULL)
! #define PUSH(l) (if (l) call S.qpush(context, l); else call E.error(context, MOTLLE_ERROR_BAD_TYPE))
  
    //FN car: l -> x. Returns first element of pair l
--- 225,229 ----
  #define CAR(l) (l = l && call T.pairp(l) ? call V.read(&(call T.pair(l))->car) : NULL)
  #define CDR(l) (l = l && call T.pairp(l) ? call V.read(&(call T.pair(l))->cdr) : NULL)
! #define PUSH(l) if (l) call S.qpush(context, l); else call E.error(context, MOTLLE_ERROR_BAD_TYPE)
  
    //FN car: l -> x. Returns first element of pair l
***************
*** 579,583 ****
  
    //FN cdadr: l -> x. cdr(car(cdr(l)))
!   command result_t Cdaar.execute(uint8_t instr, MateContext* context) {
      mvalue l = call S.pop(context, 1);
  
--- 396,400 ----
  
    //FN cdadr: l -> x. cdr(car(cdr(l)))
!   command result_t Cdadr.execute(uint8_t instr, MateContext* context) {
      mvalue l = call S.pop(context, 1);
  
***************
*** 595,599 ****
  
    //FN cddar: l -> x. cdr(cdr(car(l)))
!   command result_t Cdaar.execute(uint8_t instr, MateContext* context) {
      mvalue l = call S.pop(context, 1);
  
--- 412,416 ----
  
    //FN cddar: l -> x. cdr(cdr(car(l)))
!   command result_t Cddar.execute(uint8_t instr, MateContext* context) {
      mvalue l = call S.pop(context, 1);
  
***************
*** 611,615 ****
  
    //FN cdddr: l -> x. cdr(cdr(cdr(l)))
!   command result_t Cdaar.execute(uint8_t instr, MateContext* context) {
      mvalue l = call S.pop(context, 1);
  
--- 428,432 ----
  
    //FN cdddr: l -> x. cdr(cdr(cdr(l)))
!   command result_t Cdddr.execute(uint8_t instr, MateContext* context) {
      mvalue l = call S.pop(context, 1);
  

Index: FNseq.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNseq.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FNseq.nc	25 Oct 2005 15:45:08 -0000	1.2
--- FNseq.nc	25 Oct 2005 16:54:08 -0000	1.3
***************
*** 9,16 ****
      interface MateBytecode as Length;
      interface MotlleFrame as MapFrame;
!   }
  }
  implementation {
!   components FNseqM, MProxy;
  
    ForEach = FNseqM.ForEach;
--- 9,22 ----
      interface MateBytecode as Length;
      interface MotlleFrame as MapFrame;
!     interface MateBytecode as Memq;
!     interface MateBytecode as Memv;
!     interface MateBytecode as Assq;
!     interface MateBytecode as Assv;
!     interface MateBytecode as Reverse;
!     interface MateBytecode as Append;
!  }
  }
  implementation {
!   components FNseqM, MProxy, MOPcall;
  
    ForEach = FNseqM.ForEach;
***************
*** 21,24 ****
--- 27,36 ----
    Length = FNseqM.Length;
    MapFrame = FNseqM.MapFrame;
+   Memq = FNseqM.Memq;
+   Memv = FNseqM.Memv;
+   Assq = FNseqM.Assq;
+   Assv = FNseqM.Assv;
+   Reverse = FNseqM.Reverse;
+   Append = FNseqM.Append;
  
    FNseqM.GC -> MProxy;
***************
*** 27,29 ****
--- 39,43 ----
    FNseqM.E -> MProxy;
    FNseqM.V -> MProxy;
+   FNseqM.Exec -> MOPcall.Exec;
+   FNseqM.MapFrame <- MProxy.MotlleFrame[MOTLLE_MAP_FRAME];
  }

Index: FNseqM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNseqM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FNseqM.nc	25 Oct 2005 00:39:10 -0000	1.4
--- FNseqM.nc	25 Oct 2005 16:54:08 -0000	1.5
***************
*** 9,12 ****
--- 9,18 ----
      interface MateBytecode as Length;
      interface MotlleFrame as MapFrame;
+     interface MateBytecode as Memq;
+     interface MateBytecode as Memv;
+     interface MateBytecode as Assq;
+     interface MateBytecode as Assv;
+     interface MateBytecode as Reverse;
+     interface MateBytecode as Append;
    }
    uses {
***************
*** 16,19 ****
--- 22,26 ----
      interface MateError as E;
      interface MotlleValues as V;
+     interface MateBytecode as Exec;
    }
  }
***************
*** 102,106 ****
  		vpair p = call T.pair(scan);
  
! 		call V.write(&p->car, call T.make_int(s->data[i]));
  		scan = call V.read(&p->cdr);
  	      }
--- 109,113 ----
  		vpair p = call T.pair(scan);
  
! 		call V.write(&p->car, call T.make_int(s->str[i]));
  		scan = call V.read(&p->cdr);
  	      }
***************
*** 136,140 ****
  		vpair p = call T.pair(x);
  
! 		vzll V.write(&v->data[i], p->car);
  		x = call V.read(&p->cdr);
  	      }
--- 143,147 ----
  		vpair p = call T.pair(x);
  
! 		call V.write(&v->data[i], call V.read(&p->car));
  		x = call V.read(&p->cdr);
  	      }
***************
*** 170,174 ****
  
  		if (call T.intp(car))
! 		  s->data[i] = call T.intv(car);
  		else
  		  call E.error(context, MOTLLE_ERROR_BAD_VALUE);
--- 177,181 ----
  
  		if (call T.intp(car))
! 		  s->str[i] = call T.intv(car);
  		else
  		  call E.error(context, MOTLLE_ERROR_BAD_VALUE);
***************
*** 203,206 ****
--- 210,382 ----
    }
  
+   //FN assq: l x1 -> x2. Returns first element of l whose car is x1,
+   //   or false if there is no such element.
+   command result_t Assq.execute(uint8_t nargs, MateContext* context) {
+     mvalue x = call S.pop(context, 1);
+     mvalue l = call S.pop(context, 1);
+     msize len;
+     mvalue result;
+ 
+     if (valid_list(context, l, &len))
+       {
+ 	for (;;)
+ 	  {
+ 	    vpair p;
+ 	    mvalue pcar;
+ 
+ 	    if (call T.nullp(l))
+ 	      {
+ 		result = call T.nil();
+ 		break;
+ 	      }
+ 
+ 	    p = call T.pair(l);
+ 	    pcar = call V.read(&p->car);
+ 	    if (call T.pairp(pcar))
+ 	      {
+ 		vpair elem = call T.pair(pcar);
+ 
+ 		if (x == call V.read(&elem->car))
+ 		  {
+ 		    result = pcar;
+ 		    break;
+ 		  }
+ 	      }
+ 	    l = call V.read(&p->cdr);
+ 	  }
+ 	call S.qpush(context, result);
+       }
+     return SUCCESS;
+   }
+ 
+   command uint8_t Assq.byteLength() {
+     return 1;
+   }
+ 
+   //FN assv: l x1 -> x2. Returns first element of l whose car is x1,
+   //   or false if there is no such element.
+   command result_t Assv.execute(uint8_t nargs, MateContext* context) {
+     return call Assq.execute(nargs, context);
+   }
+ 
+   command uint8_t Assv.byteLength() {
+     return 1;
+   }
+ 
+   //FN memq: l1 x -> l2. Returns l1 starting at the first element which is x,
+   //   or false if there is no such element.
+   command result_t Memq.execute(uint8_t nargs, MateContext* context) {
+     mvalue x = call S.pop(context, 1);
+     mvalue l = call S.pop(context, 1);
+     msize len;
+ 
+     if (valid_list(context, l, &len))
+       {
+ 	for (;;)
+ 	  {
+ 	    vpair p;
+ 
+ 	    if (call T.nullp(l))
+ 	      break;
+ 
+ 	    p = call T.pair(l);
+ 	    if (call V.read(&p->car) == x)
+ 	      break;
+ 	    l = call V.read(&p->cdr);
+ 	  }
+ 	call S.qpush(context, l);
+       }
+     return SUCCESS;
+   }
+ 
+   command uint8_t Memq.byteLength() {
+     return 1;
+   }
+ 
+   //FN memv: l1 x -> l2. Returns l1 starting at the first element which is x,
+   //   or false if there is no such element.
+   command result_t Memv.execute(uint8_t nargs, MateContext* context) {
+     return call Memq.execute(nargs, context);
+   }
+ 
+   command uint8_t Memv.byteLength() {
+     return 1;
+   }
+ 
+   //FN reverse: l1 -> l2. Reverse list l1
+   command result_t Reverse.execute(uint8_t instr, MateContext* context) {
+     mvalue x = call S.pop(context, 1), result = call T.nil();
+     msize len;
+ 
+     if (valid_list(context, x, &len))
+       {
+ 	while (!call T.nullp(x))
+ 	  {
+ 	    vpair p = call T.pair(x);
+ 
+ 	    x = call V.read(&p->cdr);
+ 	    GCPRO1(x);
+ 	    p = call T.alloc_list(call V.read(&p->car), result);
+ 	    GCPOP1(x);
+ 	    if (!p)
+ 	      return SUCCESS;
+ 	    result = call T.make_pair(p);
+ 	  }
+ 	call S.qpush(context, result);
+       }
+     return SUCCESS;
+   }
+ 
+   command uint8_t Reverse.byteLength() {
+     return 1;
+   }
+ 
+   //FN append: l1 l2 -> l3. Append list l1 to l2.
+   command result_t Append.execute(uint8_t instr, MateContext* context) {
+     mvalue l2 = call S.pop(context, 1);
+     mvalue l1 = call S.pop(context, 1);
+     msize len;
+     mvalue result;
+ 
+     if (call T.nullp(l1))
+       call S.qpush(context, l2);
+     else if (valid_list(context, l1, &len))
+       {
+ 	/* Make n element list, then fill it in (this avoids
+ 	   constantly protecting/unprotecting and accessing x) */
+ 	GCPRO1(l1);
+ 	result = make_list(len);
+ 	GCPOP1(l1);
+ 
+ 	if (result)
+ 	  {
+ 	    mvalue scanr = result;
+ 
+ 	    for (;;)
+ 	      {
+ 		vpair pl1 = call T.pair(l1);
+ 		vpair pr = call T.pair(scanr);
+ 
+ 		call V.write(&pr->car, call V.read(&pl1->car));
+ 		l1 = call V.read(&pl1->cdr);
+ 
+ 		if (call T.nullp(l1))
+ 		  {
+ 		    call V.write(&pr->cdr, l2);
+ 		    break;
+ 		  }
+ 		else
+ 		  scanr = call V.read(&pr->cdr);
+ 	      }
+ 	    call S.qpush(context, result);
+ 	  }
+       }
+     return SUCCESS;
+   }
+ 
+   command uint8_t Append.byteLength() {
+     return 1;
+   }
+ 
    struct map_frame {
      msize idx, len;
***************
*** 230,240 ****
      mvalue arg = call S.getOtherFrame(sp, i);
  
!     if (call T.vectorp(x))
!       return call V.read(&(call T.vector(x))->data[idx]);
!     else if (call T.stringp(x))
!       return call T.make_int((call T.string(x))->data[idx]);
      else
        {
! 	vpair p = call T.pair(x);
  
  	call S.putOtherFrame(sp, i, call V.read(&p->cdr));
--- 406,416 ----
      mvalue arg = call S.getOtherFrame(sp, i);
  
!     if (call T.vectorp(arg))
!       return call V.read(&(call T.vector(arg))->data[idx]);
!     else if (call T.stringp(arg))
!       return call T.make_int((call T.string(arg))->str[idx]);
      else
        {
! 	vpair p = call T.pair(arg);
  
  	call S.putOtherFrame(sp, i, call V.read(&p->cdr));
***************
*** 246,255 ****
    command void MapFrame.execute(MateContext *context, void *vframe) {
      struct map_frame *frame = vframe;
!     uint8_t i, nargs = map_frame->nargs;
  
!     if (map_frame->idx != 0)
        call S.pop(context, 1); // get rid of the old result
  
!     if (map_frame->idx++ == len)
        {
  	/* Done. Get rid of the frame and old arguments. */
--- 422,431 ----
    command void MapFrame.execute(MateContext *context, void *vframe) {
      struct map_frame *frame = vframe;
!     uint8_t i, nargs = frame->nargs, idx = frame->idx++;
  
!     if (idx != 0)
        call S.pop(context, 1); // get rid of the old result
  
!     if (idx == frame->len)
        {
  	/* Done. Get rid of the frame and old arguments. */
***************
*** 264,269 ****
        {
  	for (i = 0; i < nargs; i++)
! 	  call S.qpush(context, map_arg(map_frame->sp, idx, i));
! 	call S.qpush(context, call S.getOtherFrame(map_frame->sp, nargs));
  	call Exec.execute(OP_MEXEC4 + nargs, context);
        }
--- 440,445 ----
        {
  	for (i = 0; i < nargs; i++)
! 	  call S.qpush(context, map_arg(frame->sp, idx, i));
! 	call S.qpush(context, call S.getOtherFrame(frame->sp, nargs));
  	call Exec.execute(OP_MEXEC4 + nargs, context);
        }
***************
*** 275,279 ****
  
    void push_map_frame(MateContext *context, uint8_t nargs, msize len) {
!     struct map_frame *map_frame;
      void *map_sp = call S.sp(context);
  
--- 451,455 ----
  
    void push_map_frame(MateContext *context, uint8_t nargs, msize len) {
!     struct map_frame *frame;
      void *map_sp = call S.sp(context);
  
***************
*** 294,297 ****
--- 470,474 ----
      bool first = TRUE;
      uint8_t i;
+     mvalue fn;
  
      /* Check min/max args */
***************
*** 302,306 ****
        }
  
!     mvalue fn = call S.get(context, nargs);
      if (!call T.functionp(fn))
        {
--- 479,483 ----
        }
  
!     fn = call S.get(context, nargs);
      if (!call T.functionp(fn))
        {
***************
*** 312,315 ****
--- 489,494 ----
      for (i = 0; i < nargs; i++)
        {
+ 	msize nlen;
+ 
  	if (!map_length(context, i, &nlen))
  	  return FALSE;
***************
*** 331,335 ****
    //   Each xi must have the same length. The result is undefined.
    command result_t ForEach.execute(uint8_t nargs, MateContext* context) {
!     msize len = 0, idx;
  
      if (check_map_args(context, nargs, &len))
--- 510,514 ----
    //   Each xi must have the same length. The result is undefined.
    command result_t ForEach.execute(uint8_t nargs, MateContext* context) {
!     msize len;
  
      if (check_map_args(context, nargs, &len))
***************
*** 344,348 ****
  
  #if 0
!   //FN map: fn x1 ... -> x.: apply fn to the n-tuple formed by taking
    //   one element from each xi list/vector/string.
    //   Each xi must have the same length. The result is the result of
--- 523,527 ----
  
  #if 0
!   //xFN map: fn x1 ... -> x.: apply fn to the n-tuple formed by taking
    //   one element from each xi list/vector/string.
    //   Each xi must have the same length. The result is the result of

Index: FNstring.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNstring.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FNstring.nc	30 Nov 2004 18:52:43 -0000	1.2
--- FNstring.nc	25 Oct 2005 16:54:08 -0000	1.3
***************
*** 2,5 ****
--- 2,6 ----
    provides {
      interface MateBytecode as StringP;
+     interface MateBytecode as String;
      interface MateBytecode as MakeString;
      interface MateBytecode as StringLength;
***************
*** 11,14 ****
--- 12,16 ----
  
    StringP = FNstringM.StringP;
+   String = FNstringM.String;
    MakeString = FNstringM.MakeString;
    StringLength = FNstringM.StringLength;

Index: FNstringM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNstringM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** FNstringM.nc	25 Oct 2005 00:39:10 -0000	1.4
--- FNstringM.nc	25 Oct 2005 16:54:08 -0000	1.5
***************
*** 2,5 ****
--- 2,6 ----
    provides {
      interface MateBytecode as StringP;
+     interface MateBytecode as String;
      interface MateBytecode as MakeString;
      interface MateBytecode as StringLength;
***************
*** 88,92 ****
        {
  	while (nargs-- > 0)
! 	  s->data[nargs] = call T.intv(call S.pop(context, 1));
  	call S.push(context, call T.make_string(s));
        }
--- 89,93 ----
        {
  	while (nargs-- > 0)
! 	  s->str[nargs] = call T.intv(call S.pop(context, 1));
  	call S.push(context, call T.make_string(s));
        }



More information about the Tinyos-commits mailing list