[Tinyos-commits] CVS: tinyos-1.x/tos/lib/VM/languages/motlle/mate
Motlle.h, 1.2, 1.3 MotlleObjectsM.nc, 1.2, 1.3 MotlleTypes.nc,
1.2, 1.3
David Gay
idgay at users.sourceforge.net
Thu Oct 13 17:21:41 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9616
Modified Files:
Motlle.h MotlleObjectsM.nc MotlleTypes.nc
Log Message:
symbols
Index: Motlle.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/Motlle.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Motlle.h 30 Nov 2004 18:52:42 -0000 1.2
--- Motlle.h 14 Oct 2005 00:21:39 -0000 1.3
***************
*** 63,66 ****
--- 63,67 ----
type_function, // norep
itype_primitive, // rep: atom, user: type_function
+ type_symbol, // rep: atom
// synthetic types
***************
*** 75,78 ****
--- 76,80 ----
typedef float vreal;
typedef avalue vprimitive;
+ typedef avalue vsymbol;
typedef uint8_t instruction;
Index: MotlleObjectsM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/MotlleObjectsM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MotlleObjectsM.nc 30 Nov 2004 18:52:42 -0000 1.2
--- MotlleObjectsM.nc 14 Oct 2005 00:21:39 -0000 1.3
***************
*** 7,13 ****
}
implementation {
! // Atoms: 0 is null, 1-n are the primitives
enum {
! ATOM_NULL = 0
};
--- 7,22 ----
}
implementation {
! #include "primitive_args.h"
!
! enum {
! NUM_PRIMITIVES = sizeof mp_args / sizeof *mp_args
! };
!
! // Atoms: 0 is null, 1-n are the primitives, n+1 onwards are symbols
enum {
! ATOM_NULL,
! ATOM_FIRST_PRIMITIVE,
! ATOM_LAST_PRIMITIVE = ATOM_FIRST_PRIMITIVE + NUM_PRIMITIVES - 1,
! ATOM_FIRST_SYMBOL
};
***************
*** 20,24 ****
return type_real;
if (call V.atomp(x))
! return call V.atom(x) == ATOM_NULL ? type_null : type_function;
t = call V.ptype(call V.pointer(x));
switch (t)
--- 29,42 ----
return type_real;
if (call V.atomp(x))
! {
! avalue a = call V.atom(x);
!
! if (a == ATOM_NULL)
! return type_null;
! if (a <= ATOM_LAST_PRIMITIVE)
! return type_function;
! return type_symbol;
! }
!
t = call V.ptype(call V.pointer(x));
switch (t)
***************
*** 35,39 ****
return type_real;
if (call V.atomp(x))
! return call V.atom(x) == ATOM_NULL ? type_null : itype_primitive;
return call V.ptype(call V.pointer(x));
}
--- 53,66 ----
return type_real;
if (call V.atomp(x))
! {
! avalue a = call V.atom(x);
!
! if (a == ATOM_NULL)
! return type_null;
! if (a <= ATOM_LAST_PRIMITIVE)
! return itype_primitive;
! return type_symbol;
! }
!
return call V.ptype(call V.pointer(x));
}
***************
*** 81,85 ****
MINLINE command bool T.primitivep(mvalue x) {
! return call V.atomp(x) && call V.atom(x) != ATOM_NULL;
}
--- 108,118 ----
MINLINE command bool T.primitivep(mvalue x) {
! if (call V.atomp(x))
! {
! avalue a = call V.atom(x);
!
! return a >= ATOM_FIRST_PRIMITIVE && a <= ATOM_LAST_PRIMITIVE;
! }
! return FALSE;
}
***************
*** 90,93 ****
--- 123,130 ----
}
+ MINLINE command bool T.symbolp(mvalue x) {
+ return call V.atomp(x) && call V.atom(x) >= ATOM_FIRST_SYMBOL;
+ }
+
MINLINE command vcode T.code(mvalue x) {
***************
*** 120,124 ****
MINLINE command vprimitive T.primitive(mvalue x) {
! return call V.atom(x) - 1;
}
--- 157,165 ----
MINLINE command vprimitive T.primitive(mvalue x) {
! return call V.atom(x) - ATOM_FIRST_PRIMITIVE;
! }
!
! MINLINE command vsymbol T.symbol(mvalue x) {
! return call V.atom(x) - ATOM_FIRST_SYMBOL;
}
***************
*** 153,157 ****
MINLINE command mvalue T.make_primitive(vprimitive x) {
! return call V.make_atom(x + 1);
}
--- 194,202 ----
MINLINE command mvalue T.make_primitive(vprimitive x) {
! return call V.make_atom(x + ATOM_FIRST_PRIMITIVE);
! }
!
! MINLINE command mvalue T.make_symbol(vsymbol x) {
! return call V.make_atom(x + ATOM_FIRST_SYMBOL);
}
***************
*** 206,211 ****
}
- #include "primitive_args.h"
-
MINLINE command int8_t T.primitive_args(vprimitive x) {
return motlle_primitive_args(x);
--- 251,254 ----
Index: MotlleTypes.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/MotlleTypes.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MotlleTypes.nc 30 Nov 2004 18:52:42 -0000 1.2
--- MotlleTypes.nc 14 Oct 2005 00:21:39 -0000 1.3
***************
*** 16,19 ****
--- 16,20 ----
command bool primitivep(mvalue x);
command bool listp(mvalue x);
+ command bool symbolp(mvalue x);
command vcode code(mvalue x);
***************
*** 25,28 ****
--- 26,30 ----
command vreal real(mvalue x);
command vprimitive primitive(mvalue x);
+ command vsymbol symbol(mvalue x);
command mvalue make_code(vcode x);
***************
*** 34,37 ****
--- 36,40 ----
command mvalue make_real(vreal x);
command mvalue make_primitive(vprimitive x);
+ command mvalue make_symbol(vsymbol x);
command vstring alloc_string(msize size);
More information about the Tinyos-commits
mailing list