[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/standalone compile.c, 1.6, 1.7 dump.c, 1.3, 1.4 dump.h, 1.2, 1.3 global.c, 1.3, 1.4 mate_machine.inc, 1.2, 1.3 scheme.c, 1.4, 1.5 scheme.txt, 1.1, 1.2

David Gay idgay at users.sourceforge.net
Thu Oct 13 17:20:33 PDT 2005


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

Modified Files:
	compile.c dump.c dump.h global.c mate_machine.inc scheme.c 
	scheme.txt 
Log Message:
bug fixes
symbol -> mate dump


Index: compile.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/compile.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** compile.c	7 Oct 2005 19:00:47 -0000	1.6
--- compile.c	14 Oct 2005 00:20:31 -0000	1.7
***************
*** 193,200 ****
  static value make_gsymbol(const char *name, fncode fn)
  {
    struct symbol *gsym;
  
!   table_set((fn ? fnglobals(fn) : globals)->gsymbols, name, makeint(1), &gsym);
  
    return gsym;
  }
--- 193,209 ----
  static value make_gsymbol(const char *name, fncode fn)
  {
+   struct table *gsymbols = (fn ? fnglobals(fn) : globals)->gsymbols;
    struct symbol *gsym;
  
!   if (!table_lookup(gsymbols, name, &gsym)) 
!     {
!       struct string *s;
  
+       GCPRO1(gsymbols);
+       s = alloc_string(name);
+       SET_READONLY(s);
+       GCPOP(1);
+       gsym = table_add_fast(gsymbols, s, makeint(table_entries(gsymbols)));
+     }
    return gsym;
  }

Index: dump.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/dump.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** dump.c	19 May 2005 17:23:48 -0000	1.3
--- dump.c	14 Oct 2005 00:20:31 -0000	1.4
***************
*** 34,38 ****
  static max_value *new_remote_globals;
  static uvalue remote_globals_length;
! static struct global_state *remote_gstate;
  static bool remote_error;
  
--- 34,38 ----
  static max_value *new_remote_globals;
  static uvalue remote_globals_length;
! struct global_state *remote_gstate;
  static bool remote_error;
  

Index: dump.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/dump.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** dump.h	30 Nov 2004 18:52:44 -0000	1.2
--- dump.h	14 Oct 2005 00:20:31 -0000	1.3
***************
*** 27,29 ****
--- 27,32 ----
  */
  
+ /* valid during a remote_save */
+ extern struct global_state *remote_gstate;
+ 
  #endif

Index: global.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/global.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** global.c	6 Oct 2005 23:38:00 -0000	1.3
--- global.c	14 Oct 2005 00:20:31 -0000	1.4
***************
*** 37,41 ****
  
    GCPRO1(machine);
!   gstate = (struct global_state *)allocate_record(type_vector, 7);
    GCPRO1(gstate);
    gstate->modules = alloc_table(DEF_TABLE_SIZE);
--- 37,41 ----
  
    GCPRO1(machine);
!   gstate = (struct global_state *)allocate_record(type_vector, 8);
    GCPRO1(gstate);
    gstate->modules = alloc_table(DEF_TABLE_SIZE);
***************
*** 61,65 ****
  
    GCPRO1(gstate);
!   newp = (struct global_state *)allocate_record(type_vector, 7);
    GCPRO1(newp);
    tmp  = copy_table(gstate->modules); newp->modules = tmp;
--- 61,65 ----
  
    GCPRO1(gstate);
!   newp = (struct global_state *)allocate_record(type_vector, 8);
    GCPRO1(newp);
    tmp  = copy_table(gstate->modules); newp->modules = tmp;

Index: mate_machine.inc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/mate_machine.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** mate_machine.inc	30 Nov 2004 18:52:44 -0000	1.2
--- mate_machine.inc	14 Oct 2005 00:20:31 -0000	1.3
***************
*** 3,6 ****
--- 3,8 ----
  #include "primitives.h"
  #include "mate_machine.h"
+ #include "table.h"
+ #include "global.h"
  
  typedef u16 mate_header_type;
***************
*** 16,19 ****
--- 18,36 ----
  };
  
+ static bool mate_gsymbol(struct symbol *sym, max_value *oval)
+ {
+   struct symbol *gsym;
+ 
+   if (INTEGERP(sym->data) &&
+       table_lookup(remote_gstate->gsymbols, sym->name->str, &gsym) &&
+       gsym == sym)
+     {
+       *oval =  MATE_MAKE_ATOM(intval(sym->data) + mate_machine_specification.primop_count + 1);
+       return TRUE;
+     }
+   else
+     return FALSE;
+ }
+ 
  static max_value mate_forward(value x)
  {
***************
*** 33,36 ****
--- 50,61 ----
      return *(u32 *)&((struct mudlle_float *)obj)->d;
  
+   if (obj->type == type_symbol)
+     {
+       max_value val;
+ 
+       if (mate_gsymbol((struct symbol *)obj, &val))
+ 	return val;
+     }
+ 
    if (!obj->forwarded)
      save_copy_and_scan(&mate_machine_specification.layout, obj);

Index: scheme.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/scheme.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** scheme.c	7 Oct 2005 19:00:47 -0000	1.4
--- scheme.c	14 Oct 2005 00:20:31 -0000	1.5
***************
*** 685,690 ****
  	  }
      }
-   /* Annoyingly, small changes make this code hard to share with
-      generate_execute */
    if (nargs >= 16)
      log_error(l, "no more than 15 arguments allowed");
--- 685,688 ----

Index: scheme.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/standalone/scheme.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** scheme.txt	6 Oct 2005 23:38:01 -0000	1.1
--- scheme.txt	14 Oct 2005 00:20:31 -0000	1.2
***************
*** 1,4 ****
--- 1,12 ----
  missing:
    (lambda (x1 x2 . rest) ...)
+   `(...)
+   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:
***************
*** 7,8 ****
--- 15,32 ----
    (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:
+   on motes, 
+     numbers are either 15 bit ints, or 16 bit ints + 32-bit floats
+   on pcs,
+     numbers are 31 bit ints
+   eqv? and eq? are the same
+ 
+ todo(?)
+   booleans
+   standard procedures corresponding to builtins as values
+   cond, case, and, or
+   more scheme-like lexing
+   global symbols as atoms on motes



More information about the Tinyos-commits mailing list