Merge branch 'master' of ssh://git.code.sf.net/p/newrpl/sources

This commit is contained in:
claudiol 2016-05-30 15:01:44 +00:00
commit 7ea93dacc6
5 changed files with 27 additions and 11 deletions

View file

@ -1115,7 +1115,7 @@ void halShowErrorMsg()
if(Exceptions!=EX_ERRORCODE) {
BINT xstart=scr.clipx;
if(*ExceptionPointer!=0) { // ONLY IF THERE'S A VALID COMMAND TO BLAME
if(ExceptionPointer!=0) { // ONLY IF THERE'S A VALID COMMAND TO BLAME
WORDPTR cmdname=halGetCommandName(ExceptionPointer);
if(cmdname) {
BYTEPTR start=(BYTEPTR)(cmdname+1);
@ -1142,7 +1142,7 @@ void halShowErrorMsg()
else {
// TRY TO DECOMPILE THE OPCODE THAT CAUSED THE ERROR
BINT xstart=scr.clipx;
if(*ExceptionPointer!=0) { // ONLY IF THERE'S A VALID COMMAND TO BLAME
if(ExceptionPointer!=0) { // ONLY IF THERE'S A VALID COMMAND TO BLAME
WORDPTR cmdname=halGetCommandName(ExceptionPointer);
if(cmdname) {
BYTEPTR start=(BYTEPTR)(cmdname+1);

View file

@ -661,6 +661,7 @@ register unsigned int value asm("r0");
if(value==__EX_RPLEXIT) {
// RAISE AN RPL EXCEPTION AND ISSUE A CONTINUE
Exceptions|=EX_EXITRPL;
ExceptionPointer=IPtr;
value=__EX_CONT;
}

View file

@ -375,6 +375,7 @@ void __attribute__ ((noinline)) throw_exception(char * message, unsigned int opt
if(value==__EX_RPLEXIT) {
Exceptions|=EX_EXITRPL;
ExceptionPointer=IPtr;
value=__EX_CONT;
}
@ -401,6 +402,7 @@ void __attribute__ ((noinline)) throw_dbgexception(char * message, unsigned int
if(value==__EX_RPLEXIT) {
Exceptions|=EX_EXITRPL;
ExceptionPointer=IPtr;
value=__EX_CONT;
}

View file

@ -1037,8 +1037,12 @@ void LIB_HANDLER()
BINT64 Ai1,Ai2,Bi1,Bi2,A,B,k;
REAL num;
BINT isneg;
rplReadNumberAsReal(rplPeekData(1),&num);
isneg=num.flags&F_NEGATIVE;
num.flags&=~F_NEGATIVE;
Ai1=0;
Ai2=1;
Bi1=1;
@ -1083,6 +1087,8 @@ void LIB_HANDLER()
mulReal(&RReg[3],&RReg[1],&RReg[0]);
addReal(&RReg[0],&RReg[2],&RReg[3]);
RReg[0].flags|=isneg;
rplNewRealFromRRegPush(0);
if(Exceptions) return;
rplNewBINTPush(B,DECBINT);

View file

@ -138,7 +138,7 @@ void LIB_HANDLER()
// EXTRACT THE OBJECT INTO A GC-SAFE POINTER
ScratchPointer1=rplPopData();
if(IS_FALSE(*ScratchPointer1)) {
if(rplIsFalse(ScratchPointer1)) {
// SKIP ALL OBJECTS UNTIL NEXT ELSE OR END
int count=0;
while( (count!=0) || ((*IPtr!=MKOPCODE(LIBRARY_NUMBER,ELSE))&&(*IPtr!=MKOPCODE(LIBRARY_NUMBER,ENDIF)))) {
@ -180,7 +180,7 @@ void LIB_HANDLER()
// EXTRACT OBJECT INTO A GC-SAFE POINTER
ScratchPointer1=rplPopData();
if(IS_FALSE(*ScratchPointer1)) {
if(rplIsFalse(ScratchPointer1)) {
// SKIP ALL OBJECTS UNTIL ENDTHEN
while(*IPtr!=MKOPCODE(LIBRARY_NUMBER,ENDTHEN)) {
if(*IPtr==MKOPCODE(LIBRARY_NUMBER,QSEMI)) { --IPtr; return; } // MALFORMED, JUST EXIT AT THE SEMI
@ -301,6 +301,8 @@ void LIB_HANDLER()
{
// INCREMENT THE COUNTER
if(nLAMBase==LAMTop) return; // NO ENVIRONMENT
if(*rplGetLAMn(0)!=IPtr) {
// MALFORMED FOR/NEXT LOOP
return;
@ -326,12 +328,12 @@ void LIB_HANDLER()
// CHECK IF COUNTER IS LESS THAN LIMIT
// BY CALLING THE OVERLOADED OPERATOR <= (LTE) OR >= GTE
if(IS_FALSE(**rplGetLAMn(3))) rplCallOvrOperator(OVR_LTE);
if(rplIsFalse(*rplGetLAMn(3))) rplCallOvrOperator(OVR_LTE);
else rplCallOvrOperator(OVR_GTE);
WORDPTR result=rplPopData();
if(IS_FALSE(*result)) {
if(rplIsFalse(result)) {
// EXIT THE LOOP BY DROPPING THE RETURN STACK
rplPopRet();
}
@ -353,6 +355,8 @@ void LIB_HANDLER()
return;
}
// INCREMENT THE COUNTER
if(nLAMBase==LAMTop) return; // NO ENVIRONMENT
if(*rplGetLAMn(0)!=IPtr) {
// MALFORMED FOR/NEXT LOOP
return;
@ -377,12 +381,12 @@ void LIB_HANDLER()
// CHECK IF COUNTER IS LESS THAN LIMIT
// BY CALLING THE OVERLOADED OPERATOR <= (LTE)
if(IS_FALSE(**rplGetLAMn(3))) rplCallOvrOperator(OVR_LTE);
if(rplIsFalse(*rplGetLAMn(3))) rplCallOvrOperator(OVR_LTE);
else rplCallOvrOperator(OVR_GTE);
WORDPTR result=rplPopData();
if(IS_FALSE(*result)) {
if(rplIsFalse(result)) {
// EXIT THE LOOP BY DROPPING THE RETURN STACK
rplPopRet();
}
@ -429,6 +433,8 @@ void LIB_HANDLER()
rplError(ERR_BADARGCOUNT);
return;
}
if(nLAMBase==LAMTop) return; // NO ENVIRONMENT
if(*rplGetLAMn(0)!=IPtr) {
// MALFORMED LOOP
return;
@ -438,7 +444,7 @@ void LIB_HANDLER()
WORDPTR result=rplPopData();
if(!IS_FALSE(*result)) {
if(!rplIsFalse(result)) {
// EXIT THE LOOP BY DROPPING THE RETURN STACK
rplPopRet();
}
@ -479,14 +485,15 @@ void LIB_HANDLER()
}
// BY DEFINITION, BINT 0 OR REAL 0.0 = FALSE, EVERYTHING ELSE IS TRUE
if(*rplGetLAMn(0)!=IPtr) {
if(nLAMBase==LAMTop) return; // NO ENVIRONMENT
if(**rplGetLAMn(0)!=CMD_ENDWHILE) {
// MALFORMED LOOP
return;
}
WORDPTR result=rplPopData();
if(IS_FALSE(*result)) {
if(rplIsFalse(result)) {
// EXIT THE LOOP BY DROPPING THE RETURN STACK
rplPopRet();
// JUMP TO THE TOP RETURN STACK, EITHER THE LOOP OR THE ABND WORD