|
From: Keith J. <bu...@us...> - 2003-08-07 17:10:00
|
Update of /cvsroot/cup-language/cup/src
In directory sc8-pr-cvs1:/tmp/cvs-serv24091/cup/src
Modified Files:
cup.c cup.h.in cupvm.c
Log Message:
Added != (NEQ) and == (EQ). Also finished NOT opcode.
Index: cup.c
===================================================================
RCS file: /cvsroot/cup-language/cup/src/cup.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** cup.c 7 Aug 2003 14:09:40 -0000 1.28
--- cup.c 7 Aug 2003 17:09:57 -0000 1.29
***************
*** 480,483 ****
--- 480,488 ----
ret = cup_new_value(CUPTYPE_STRING, buf);
}
+ else if (v1->type == CUPTYPE_FLOAT)
+ {
+ sprintf(buf, "%f", (float) v1->data.val_float);
+ ret = cup_new_value(CUPTYPE_STRING, buf);
+ }
else if (v1->type == CUPTYPE_STRING)
{
***************
*** 487,492 ****
else
{
! sprintf(buf, "Not Implemented");
! ret = cup_new_value(CUPTYPE_STRING, buf);
}
--- 492,499 ----
else
{
! cupvm_tb(vm, "tostring() builtin", "data type not implemented");
! if (!v1->references)
! cupvm_value_free(v1);
! return;
}
Index: cup.h.in
===================================================================
RCS file: /cvsroot/cup-language/cup/src/cup.h.in,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** cup.h.in 7 Aug 2003 14:09:40 -0000 1.16
--- cup.h.in 7 Aug 2003 17:09:57 -0000 1.17
***************
*** 184,187 ****
--- 184,188 ----
CUPOP_NOT, // SP = ! POP(SP)
CUPOP_EQ, // SP = POP(SP) == POP(SP)
+ CUPOP_NEQ, // SP = POP(SP) != POP(SP)
CUPOP_JMP, // PC = ARG
Index: cupvm.c
===================================================================
RCS file: /cvsroot/cup-language/cup/src/cupvm.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** cupvm.c 7 Aug 2003 14:09:40 -0000 1.7
--- cupvm.c 7 Aug 2003 17:09:57 -0000 1.8
***************
*** 269,272 ****
--- 269,277 ----
ret = cup_new_value(CUPTYPE_STRING, buf);
}
+ else if (v1->type == CUPTYPE_FLOAT)
+ {
+ sprintf(buf, "%f", (float) v1->data.val_float);
+ ret = cup_new_value(CUPTYPE_STRING, buf);
+ }
else if (v1->type == CUPTYPE_STRING)
{
***************
*** 276,281 ****
else
{
! sprintf(buf, "Not Implemented");
! ret = cup_new_value(CUPTYPE_STRING, buf);
}
--- 281,288 ----
else
{
! cupvm_tb(vm, "tostring() builtin", "data type not implemented");
! if (!v1->references)
! cupvm_value_free(v1);
! return;
}
|