[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/standalone scheme.c, 1.5, 1.6 scheme.txt, 1.2, 1.3

David Gay idgay at users.sourceforge.net
Sun Oct 23 10:21:46 PDT 2005


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

Modified Files:
	scheme.c scheme.txt 
Log Message:
more tinyscheme changes


Index: scheme.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/scheme.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scheme.c	14 Oct 2005 00:20:31 -0000	1.5
--- scheme.c	23 Oct 2005 17:21:44 -0000	1.6
***************
*** 64,70 ****
    int builtin;
  } builtins[] = {
!   { "+", 2, b_add },
    { "<", 2, b_lt },
    { ">", 2, b_gt },
  };
  
--- 64,94 ----
    int builtin;
  } builtins[] = {
!   { NULL, 0, last_builtin },
!   { "eq?", 2, b_eq },
!   { "eqv?", 2, b_eq },
!   { "=", 2, b_eq },
    { "<", 2, b_lt },
+   { "<=", 2, b_le },
    { ">", 2, b_gt },
+   { ">=", 2, b_ge },
+   { "|", -1, b_bitor },
+   { "^", -1, b_bitor },
+   { "&", -1, b_bitor },
+   { "<<", 2, b_shift_left },
+   { ">>", 2, b_shift_right },
+   { "~", 1, b_bitnot },
+   { "+", -1, b_add },
+   { "-", 2, b_subtract },
+   { "-", 1, b_negate },
+   { "*", -1, b_multiply },
+   { "/", 2, b_divide },
+   { "remainder", 2, b_remainder },
+   { "not", 1, b_not },
+   { "any-ref", 2, b_ref },
+   { "vector-ref", 2, b_ref },
+   { "string-ref", 2, b_ref },
+   { "any-set!", 3, b_set },
+   { "vector-set!", 3, b_set },
+   { "string-set!", 3, b_set },
  };
  
***************
*** 73,82 ****
    int i;
  
!   for (i = 0; i < sizeof builtins / sizeof *builtins; i++)
!     if (nargs == builtins[i].nargs &&
  	!strcmp(name, builtins[i].name))
!       return builtins[i].builtin;
  
!   return last_builtin;
  }
  
--- 97,106 ----
    int i;
  
!   for (i = 1; i < sizeof builtins / sizeof *builtins; i++)
!     if ((nargs == builtins[i].nargs || builtins[i].nargs == -1) &&
  	!strcmp(name, builtins[i].name))
!       return i;
  
!   return -1;
  }
  
***************
*** 94,98 ****
  	}
      }
!   return last_builtin;
  }
  
--- 118,122 ----
  	}
      }
!   return -1;
  }
  
***************
*** 115,119 ****
  			fncode fn)
  {
!   int builtin = is_builtin_call(condition, fn);
  
    switch (builtin)
--- 139,143 ----
  			fncode fn)
  {
!   int builtin = builtins[is_builtin_call(condition, fn)].builtin;
  
    switch (builtin)
***************
*** 705,710 ****
  	  int builtin = lookup_builtin(name, nargs);
  
! 	  if (builtin != last_builtin)
! 	    ins0(builtin_ops[builtin], fn);
  	  else
  	    mexecute(l, offset, name, nargs, fn);
--- 729,744 ----
  	  int builtin = lookup_builtin(name, nargs);
  
! 	  if (builtin != -1)
! 	    {
! 	      int i, count;
! 
! 	      if (builtins[builtin].nargs == -1)
! 		count = nargs - 1;
! 	      else
! 		count = 1;
! 
! 	      for (i = 0; i < count; i++)
! 		ins0(builtin_ops[builtins[builtin].builtin], fn);
! 	    }
  	  else
  	    mexecute(l, offset, name, nargs, fn);

Index: scheme.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/scheme.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scheme.txt	14 Oct 2005 00:20:31 -0000	1.2
--- scheme.txt	23 Oct 2005 17:21:44 -0000	1.3
***************
*** 4,20 ****
    named let (would need tail recursion to be useful)
    tail recursion elimination
    standard procedures:
      input and output
!     most of the scheme number stuff
!     call-with-current-continuation
!     symbol->string, string->symbol (on motes)
  
  changes:
    (lambda allargs ...)
      makes allargs a vector, not a list
    (if cond truecase)
      returns an undefined result even when truecase is executed
    chars are ints
    booleans are ints (0 is false), #t, #f are missing
  
  comments:
--- 4,35 ----
    named let (would need tail recursion to be useful)
    tail recursion elimination
+   no delayed evaluation
    standard procedures:
      input and output
!     scheme number stuff:
!       exact->ineact, inexact->exact, exact?, inexact?
!       all complex number stuff
!       rationalize, numerator, denominator
!       lcm, gcd
!     control flow:
!       call-with-current-continuation
!       dynamic-wind
!       eval&co
!     strings and characters:
!       character functions
!       string-append, substring, string{-ci}relop?
!       number->string, string->number
!       symbol->string, string->symbol
  
  changes:
    (lambda allargs ...)
      makes allargs a vector, not a list
+   (apply proc vector)
    (if cond truecase)
      returns an undefined result even when truecase is executed
    chars are ints
    booleans are ints (0 is false), #t, #f are missing
+   make-vector doesn't have a fill argument
+   make-string doesn't have a fill argument
  
  comments:
***************
*** 30,32 ****
    cond, case, and, or
    more scheme-like lexing
!   global symbols as atoms on motes
--- 45,76 ----
    cond, case, and, or
    more scheme-like lexing
! 
! 
! procedures to do:
!   map (extend to vectors and strings)
!   for-each (idem)
!   vector->list
!   list->vector
!   string->list
!   list->string
!   length (both strings & vecs)
!   string
!   symbol?
!   equal?
!   memq/memv/member
!   assq/assv/assoc
!   list-ref, list-tail
!   reverse
!   append
!   c[ad]*r
!   sin, cos, tan, asin, acos, atan, exp, log, sqrt, expt
!   round
!   quotient, remainder, modulo
!   +, -, *, /
!   min, max
!   zero?, positive?, negative?, odd?, even?
!   =, <, >, <=, >=
!   real?
! 
! procedures added:
!   |, &, ^, <<, >>



More information about the Tinyos-commits mailing list