[Tinyos-commits]
CVS: tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime
FNseqM.nc, 1.6, 1.7 Makefile, 1.4, 1.5 SFNarith.nc, 1.1,
1.2 SFNarithM.nc, 1.1, 1.2 SFNrealM.nc, 1.2, 1.3
David Gay
idgay at users.sourceforge.net
Tue Oct 25 15:33:23 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-serv26029/mate/runtime
Modified Files:
FNseqM.nc Makefile SFNarith.nc SFNarithM.nc SFNrealM.nc
Log Message:
-s option to mload to specify scheme code
Index: FNseqM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/FNseqM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** FNseqM.nc 25 Oct 2005 18:21:06 -0000 1.6
--- FNseqM.nc 25 Oct 2005 22:33:21 -0000 1.7
***************
*** 442,447 ****
}
! mvalue map_arg(void *sp, msize idx, uint8_t i) {
! mvalue arg = call S.getOtherFrame(sp, i);
if (call T.vectorp(arg))
--- 442,454 ----
}
! struct foreach_frame {
! msize idx, len;
! uint8_t nargs;
! uint16_t retpc;
! void *sp;
! };
!
! mvalue map_arg(struct foreach_frame *frame, msize idx, uint8_t i) {
! mvalue arg = call S.getOtherFrame(frame->sp, frame->nargs - 1 - i);
if (call T.vectorp(arg))
***************
*** 453,457 ****
vpair p = call T.pair(arg);
! call S.putOtherFrame(sp, i, call V.read(&p->cdr));
return call V.read(&p->car);
--- 460,464 ----
vpair p = call T.pair(arg);
! call S.putOtherFrame(frame->sp, frame->nargs - 1 - i, call V.read(&p->cdr));
return call V.read(&p->car);
***************
*** 459,469 ****
}
- struct foreach_frame {
- msize idx, len;
- uint8_t nargs;
- uint16_t retpc;
- void *sp;
- };
-
void foreach_execute(MateContext *context, struct foreach_frame *frame,
mvalue result) {
--- 466,469 ----
***************
*** 481,485 ****
{
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);
--- 481,485 ----
{
for (i = 0; i < nargs; i++)
! call S.qpush(context, map_arg(frame, idx, i));
call S.qpush(context, call S.getOtherFrame(frame->sp, nargs));
call Exec.execute(OP_MEXEC4 + nargs, context);
***************
*** 598,601 ****
}
}
-
-
--- 598,599 ----
Index: Makefile
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 25 Oct 2005 15:43:21 -0000 1.4
--- Makefile 25 Oct 2005 22:33:21 -0000 1.5
***************
*** 1,4 ****
INTFN = FNarithM.nc FNbasicM.nc FNlistM.nc FNstringM.nc FNvectorM.nc FNseqM.nc
! SCHEMEINTFN = $(INTFN) SFNarithM.nc
FLOATFN = FNrealM.nc
SCHEMEFLOATFN = $(FLOATFN) SFNrealM.nc
--- 1,4 ----
INTFN = FNarithM.nc FNbasicM.nc FNlistM.nc FNstringM.nc FNvectorM.nc FNseqM.nc
! SCHEMEINTFN = $(INTFN) SFNarithM.nc SFNmagic.nc
FLOATFN = FNrealM.nc
SCHEMEFLOATFN = $(FLOATFN) SFNrealM.nc
Index: SFNarith.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/SFNarith.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SFNarith.nc 25 Oct 2005 00:01:25 -0000 1.1
--- SFNarith.nc 25 Oct 2005 22:33:21 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
interface MateBytecode as PositiveP;
interface MateBytecode as NegativeP;
+ interface MateBytecode as ZeroP;
interface MateBytecode as OddP;
interface MateBytecode as EvenP;
***************
*** 16,20 ****
interface MateBytecode as Xor;
interface MateBytecode as Quotient;
! interface MateBytecode as Remainder;
interface MateBytecode as Modulo;
}
--- 17,21 ----
interface MateBytecode as Xor;
interface MateBytecode as Quotient;
! interface MateBytecode as SRemainder;
interface MateBytecode as Modulo;
}
***************
*** 32,35 ****
--- 33,37 ----
PositiveP = SFNarithM.PositiveP;
NegativeP = SFNarithM.NegativeP;
+ ZeroP = SFNarithM.ZeroP;
OddP = SFNarithM.OddP;
EvenP = SFNarithM.EvenP;
***************
*** 38,42 ****
Xor = SFNarithM.Xor;
Quotient = SFNarithM.Quotient;
! Remainder = SFNarithM.Remainder;
Modulo = SFNarithM.Modulo;
--- 40,44 ----
Xor = SFNarithM.Xor;
Quotient = SFNarithM.Quotient;
! SRemainder = SFNarithM.SRemainder;
Modulo = SFNarithM.Modulo;
Index: SFNarithM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/SFNarithM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SFNarithM.nc 25 Oct 2005 00:01:25 -0000 1.1
--- SFNarithM.nc 25 Oct 2005 22:33:21 -0000 1.2
***************
*** 10,13 ****
--- 10,14 ----
interface MateBytecode as PositiveP;
interface MateBytecode as NegativeP;
+ interface MateBytecode as ZeroP;
interface MateBytecode as OddP;
interface MateBytecode as EvenP;
***************
*** 16,20 ****
interface MateBytecode as Xor;
interface MateBytecode as Quotient;
! interface MateBytecode as Remainder;
interface MateBytecode as Modulo;
}
--- 17,21 ----
interface MateBytecode as Xor;
interface MateBytecode as Quotient;
! interface MateBytecode as SRemainder;
interface MateBytecode as Modulo;
}
***************
*** 145,152 ****
//FN +: n1 ... -> n. n = n1 + ...
! command result_t Add.execute(uint8_t instr, MateContext* context) {
mvalue x = call T.make_int(0);
! while (--nargs)
{
mvalue y = pop_number(context);
--- 146,153 ----
//FN +: n1 ... -> n. n = n1 + ...
! command result_t Add.execute(uint8_t nargs, MateContext* context) {
mvalue x = call T.make_int(0);
! while (nargs--)
{
mvalue y = pop_number(context);
***************
*** 167,174 ****
//FN *: n1 ... -> n. n = n1 * ...
! command result_t Multiply.execute(uint8_t instr, MateContext* context) {
mvalue x = call T.make_int(1);
! while (--nargs)
{
mvalue y = pop_number(context);
--- 168,175 ----
//FN *: n1 ... -> n. n = n1 * ...
! command result_t Multiply.execute(uint8_t nargs, MateContext* context) {
mvalue x = call T.make_int(1);
! while (nargs--)
{
mvalue y = pop_number(context);
***************
*** 202,206 ****
else if (nargs == 2)
{
! mvalue x = call S.pop(context, 1), y = call S.pop(context, 1);
if (call T.int_intp(x, y))
--- 203,208 ----
else if (nargs == 2)
{
! mvalue y = call S.pop(context, 1);
! mvalue x = call S.pop(context, 1);
if (call T.int_intp(x, y))
***************
*** 227,231 ****
//FN |: n1 ... -> n. n = n1 | ...
! command result_t Or.execute(uint8_t instr, MateContext* context) {
if (nargs < 1)
call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
--- 229,233 ----
//FN |: n1 ... -> n. n = n1 | ...
! command result_t Or.execute(uint8_t nargs, MateContext* context) {
if (nargs < 1)
call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
***************
*** 236,240 ****
while (--nargs)
x |= ipop_number(context);
! call S.qpush(context, x);
}
--- 238,242 ----
while (--nargs)
x |= ipop_number(context);
! call S.qpush(context, call T.make_int(x));
}
***************
*** 247,251 ****
//FN &: n1 ... -> n. n = n1 & ...
! command result_t And.execute(uint8_t instr, MateContext* context) {
if (nargs < 1)
call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
--- 249,253 ----
//FN &: n1 ... -> n. n = n1 & ...
! command result_t And.execute(uint8_t nargs, MateContext* context) {
if (nargs < 1)
call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
***************
*** 256,260 ****
while (--nargs)
x &= ipop_number(context);
! call S.qpush(context, x);
}
return SUCCESS;
--- 258,262 ----
while (--nargs)
x &= ipop_number(context);
! call S.qpush(context, call T.make_int(x));
}
return SUCCESS;
***************
*** 266,270 ****
//FN ^: n1 ... -> n. n = n1 ^ ...
! command result_t Xor.execute(uint8_t instr, MateContext* context) {
if (nargs < 1)
call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
--- 268,272 ----
//FN ^: n1 ... -> n. n = n1 ^ ...
! command result_t Xor.execute(uint8_t nargs, MateContext* context) {
if (nargs < 1)
call E.error(context, MOTLLE_ERROR_WRONG_PARAMETERS);
***************
*** 275,279 ****
while (--nargs)
x ^= ipop_number(context);
! call S.qpush(context, x);
}
return SUCCESS;
--- 277,281 ----
while (--nargs)
x ^= ipop_number(context);
! call S.qpush(context, call T.make_int(x));
}
return SUCCESS;
***************
*** 285,289 ****
//FN odd?: n -> b. True if n is odd
! command result_t OddP.execute(uint8_t instr, MateContext* context) {
call S.qpush(context, call T.make_bool(ipop_number(context) & 1));
return SUCCESS;
--- 287,291 ----
//FN odd?: n -> b. True if n is odd
! command result_t OddP.execute(uint8_t nargs, MateContext* context) {
call S.qpush(context, call T.make_bool(ipop_number(context) & 1));
return SUCCESS;
***************
*** 295,299 ****
//FN even?: n -> b. True if n is even
! command result_t EvenP.execute(uint8_t instr, MateContext* context) {
call S.qpush(context, call T.make_bool(!(ipop_number(context) & 1)));
return SUCCESS;
--- 297,301 ----
//FN even?: n -> b. True if n is even
! command result_t EvenP.execute(uint8_t nargs, MateContext* context) {
call S.qpush(context, call T.make_bool(!(ipop_number(context) & 1)));
return SUCCESS;
***************
*** 305,309 ****
//FN zero?: n -> b. True if n is zero
! command result_t ZeroP.execute(uint8_t instr, MateContext* context) {
mvalue x = call S.pop(context, 1);
--- 307,311 ----
//FN zero?: n -> b. True if n is zero
! command result_t ZeroP.execute(uint8_t nargs, MateContext* context) {
mvalue x = call S.pop(context, 1);
***************
*** 322,326 ****
//FN positive?: n -> b. True if n is positive
! command result_t PositiveP.execute(uint8_t instr, MateContext* context) {
mvalue x = call S.pop(context, 1);
--- 324,328 ----
//FN positive?: n -> b. True if n is positive
! command result_t PositiveP.execute(uint8_t nargs, MateContext* context) {
mvalue x = call S.pop(context, 1);
***************
*** 339,343 ****
//FN negative?: n -> b. True if n is negative
! command result_t NegativeP.execute(uint8_t instr, MateContext* context) {
mvalue x = call S.pop(context, 1);
--- 341,345 ----
//FN negative?: n -> b. True if n is negative
! command result_t NegativeP.execute(uint8_t nargs, MateContext* context) {
mvalue x = call S.pop(context, 1);
***************
*** 358,362 ****
//FN quotient: n1 n2 -> n3. n3 = integer division of n1, n2
! command result_t Quotient.execute(uint8_t instr, MateContext* context) {
mvalue y = call S.pop(context, 1);
mvalue x = call S.pop(context, 1);
--- 360,364 ----
//FN quotient: n1 n2 -> n3. n3 = integer division of n1, n2
! command result_t Quotient.execute(uint8_t nargs, MateContext* context) {
mvalue y = call S.pop(context, 1);
mvalue x = call S.pop(context, 1);
***************
*** 382,386 ****
//FN remainder: n1 n2 -> n3. n3 = integer division of n1, n2
! command result_t Remainder.execute(uint8_t instr, MateContext* context) {
mvalue y = call S.pop(context, 1);
mvalue x = call S.pop(context, 1);
--- 384,388 ----
//FN remainder: n1 n2 -> n3. n3 = integer division of n1, n2
! command result_t SRemainder.execute(uint8_t nargs, MateContext* context) {
mvalue y = call S.pop(context, 1);
mvalue x = call S.pop(context, 1);
***************
*** 401,410 ****
}
! command uint8_t Remainder.byteLength() {
return 1;
}
//FN modulo: n1 n2 -> n3. n3 = integer division of n1, n2
! command result_t Modulo.execute(uint8_t instr, MateContext* context) {
mvalue y = call S.pop(context, 1);
mvalue x = call S.pop(context, 1);
--- 403,412 ----
}
! command uint8_t SRemainder.byteLength() {
return 1;
}
//FN modulo: n1 n2 -> n3. n3 = integer division of n1, n2
! command result_t Modulo.execute(uint8_t nargs, MateContext* context) {
mvalue y = call S.pop(context, 1);
mvalue x = call S.pop(context, 1);
***************
*** 420,424 ****
vint r = ix % iy;
! if (r < 0 && iy > 0 || r > 0 && iy < 0)
r += iy;
call S.qpush(context, call T.make_int(r));
--- 422,426 ----
vint r = ix % iy;
! if ((r < 0 && iy > 0) || (r > 0 && iy < 0))
r += iy;
call S.qpush(context, call T.make_int(r));
Index: SFNrealM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/VM/languages/motlle/mate/runtime/SFNrealM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SFNrealM.nc 25 Oct 2005 00:39:10 -0000 1.2
--- SFNrealM.nc 25 Oct 2005 22:33:21 -0000 1.3
***************
*** 30,34 ****
else if (nargs == 2)
{
! vreal x = fpop_number(context), y = fpop_number(context);
if (y == 0)
call E.error(context, MOTLLE_ERROR_DIVIDE_BY_ZERO);
--- 30,36 ----
else if (nargs == 2)
{
! vreal y = fpop_number(context);
! vreal x = fpop_number(context);
!
if (y == 0)
call E.error(context, MOTLLE_ERROR_DIVIDE_BY_ZERO);
More information about the Tinyos-commits
mailing list