More progress in decimal port.

This commit is contained in:
claudio 2015-08-08 20:31:54 -04:00
parent eaa6b63fcb
commit fc877ec1c9
26 changed files with 98 additions and 166 deletions

View file

@ -757,7 +757,7 @@ void downKeyHandler(BINT keymsg)
if(rplDepthData()>=1) {
WORDPTR ptr=rplPeekData(1);
WORDPTR text=rplDecompile(ptr,0);
WORDPTR text=rplDecompile(ptr,DECOMP_EDIT);
if(Exceptions) {
halShowErrorMsg();
Exceptions=0;

View file

@ -848,12 +848,12 @@ void rplDecompAppendString2(BYTEPTR str,BINT len)
#define SAVED_POINTERS 4
WORDPTR rplDecompile(WORDPTR object,BINT embedded)
WORDPTR rplDecompile(WORDPTR object,BINT flags)
{
LIBHANDLER han;
BINT infixmode=0;
WORDPTR *SavedRSTop;
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
SavedRSTop=RSTop;
// SAVE ALL DECOMPILER POINTERS
@ -879,7 +879,7 @@ WORDPTR rplDecompile(WORDPTR object,BINT embedded)
// START DECOMPILE LOOP
// CREATE A STRING AT THE END OF TEMPOB
if(!embedded) CompileEnd=TempObEnd;
if(!(flags&DECOMP_EMBEDDED)) CompileEnd=TempObEnd;
// SKIPOB TO DETERMINE END OF COMPILATION
EndOfObject=rplSkipOb(object);
@ -888,7 +888,7 @@ WORDPTR rplDecompile(WORDPTR object,BINT embedded)
*ValidateTop++=DecompileObject; // STORE START OF OBJECT FOR QUICK SKIPPING
// HERE ALL POINTERS ARE STORED IN GC-UPDATEABLE AREA
if(!embedded) {
if(!(flags&DECOMP_EMBEDDED)) {
// CREATE EMPTY STRING AT END OF TEMPOB
rplCompileAppend(MKPROLOG(DOSTRING,0));
DecompStringEnd=CompileEnd;
@ -901,7 +901,7 @@ WORDPTR rplDecompile(WORDPTR object,BINT embedded)
// CALL LIBRARY HANDLER TO DECOMPILE
han=rplGetLibHandler(LIBNUM(*DecompileObject));
CurOpcode=MKOPCODE(0,OPCODE_DECOMPILE);
CurOpcode=MKOPCODE(0,(flags&DECOMP_EDIT)? OPCODE_DECOMPEDIT:OPCODE_DECOMPILE);
if(ValidateTop>RSTop) CurrentConstruct=**(ValidateTop-1);
else CurrentConstruct=0;
@ -918,7 +918,7 @@ WORDPTR rplDecompile(WORDPTR object,BINT embedded)
if(RStkSize<=(ValidateTop-RStk)) growRStk(ValidateTop-RStk+RSTKSLACK);
if(Exceptions) {
LAMTop=LAMTopSaved;
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
// RESTORE ALL POINTERS BEFORE RETURNING
SavedDecompObject=*--RSTop;
LAMTopSaved=(WORDPTR *)*--RSTop;
@ -947,7 +947,7 @@ WORDPTR rplDecompile(WORDPTR object,BINT embedded)
if(!infixmode) InfixOpTop=ValidateTop;
if(RStkSize<=(InfixOpTop+1-(WORDPTR)RStk)) growRStk(InfixOpTop-(WORDPTR)RStk+RSTKSLACK);
if(Exceptions) { LAMTop=LAMTopSaved;
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
// RESTORE ALL POINTERS BEFORE RETURNING
SavedDecompObject=*--RSTop;
LAMTopSaved=(WORDPTR *)*--RSTop;
@ -1005,7 +1005,7 @@ end_of_expression:
if(RStkSize<=(InfixOpTop+1-(WORDPTR)RStk)) growRStk(InfixOpTop-(WORDPTR)RStk+RSTKSLACK);
if(Exceptions) {
LAMTop=LAMTopSaved;
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
// RESTORE ALL POINTERS BEFORE RETURNING
SavedDecompObject=*--RSTop;
LAMTopSaved=(WORDPTR *)*--RSTop;
@ -1075,14 +1075,14 @@ end_of_expression:
break;
case TITYPE_PREFIXOP:
// DECOMPILE THE OPERATOR NOW!
CurOpcode=MKOPCODE(LIBNUM(*DecompileObject),OPCODE_DECOMPILE);
CurOpcode=MKOPCODE(LIBNUM(*DecompileObject),(flags&DECOMP_EDIT)? OPCODE_DECOMPEDIT:OPCODE_DECOMPILE);
(*handler)();
// IGNORE THE RESULT OF DECOMPILATION
if(RetNum!=OK_CONTINUE) {
Exceptions|=EX_BADOPCODE;
ExceptionPointer=IPtr;
LAMTop=LAMTopSaved; // RESTORE ENVIRONMENTS
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
// RESTORE ALL POINTERS BEFORE RETURNING
SavedDecompObject=*--RSTop;
LAMTopSaved=(WORDPTR *)*--RSTop;
@ -1100,7 +1100,7 @@ end_of_expression:
case TITYPE_FUNCTION:
default:
// DECOMPILE THE OPERATOR NOW, THEN ADD PARENTHESIS FOR THE LIST
CurOpcode=MKOPCODE(LIBNUM(*DecompileObject),OPCODE_DECOMPILE);
CurOpcode=MKOPCODE(LIBNUM(*DecompileObject),(flags&DECOMP_EDIT)? OPCODE_DECOMPEDIT:OPCODE_DECOMPILE);
RetNum=-1;
if(handler) (*handler)();
// IGNORE THE RESULT OF DECOMPILATION
@ -1163,7 +1163,7 @@ end_of_expression:
if(no_output==0) {
BINT libnum=LIBNUM(Operator);
DecompileObject=&Operator;
CurOpcode=MKOPCODE(libnum,OPCODE_DECOMPILE);
CurOpcode=MKOPCODE(libnum,(flags&DECOMP_EDIT)? OPCODE_DECOMPEDIT:OPCODE_DECOMPILE);
handler=rplGetLibHandler(libnum);
RetNum=-1;
@ -1233,7 +1233,7 @@ end_of_expression:
BINT libnum=LIBNUM(Operator);
DecompileObject=&Operator;
CurOpcode=MKOPCODE(libnum,OPCODE_DECOMPILE);
CurOpcode=MKOPCODE(libnum,(flags&DECOMP_EDIT)? OPCODE_DECOMPEDIT:OPCODE_DECOMPILE);
handler=rplGetLibHandler(libnum);
RetNum=-1;
@ -1349,7 +1349,7 @@ end_of_expression:
BINT libnum=LIBNUM(*(InfixOpTop-2));
SavedDecompObject=DecompileObject;
DecompileObject=InfixOpTop-2;
CurOpcode=MKOPCODE(libnum,OPCODE_DECOMPILE);
CurOpcode=MKOPCODE(libnum,(flags&DECOMP_EDIT)? OPCODE_DECOMPEDIT:OPCODE_DECOMPILE);
handler=rplGetLibHandler(libnum);
RetNum=-1;
@ -1460,7 +1460,7 @@ end_of_expression:
// DONE, HERE WE HAVE THE STRING FINISHED
if(!embedded) {
if(!(flags&DECOMP_EMBEDDED)) {
// STORE THE SIZE OF THE STRING IN WORDS IN THE PROLOG
*(CompileEnd-1)=MKPROLOG(DOSTRING+((-(WORD)DecompStringEnd)&3),(((WORD)DecompStringEnd-(WORD)CompileEnd)+3)>>2);
CompileEnd=rplSkipOb(CompileEnd-1);
@ -1474,7 +1474,7 @@ end_of_expression:
// ENLARGE TEMPOB AS NEEDED
growTempOb((BINT)(CompileEnd-TempOb)+TEMPOBSLACK);
if(Exceptions) {
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
// RESTORE ALL POINTERS BEFORE RETURNING
SavedDecompObject=*--RSTop;
LAMTopSaved=(WORDPTR *)*--RSTop;
@ -1486,7 +1486,7 @@ end_of_expression:
}
}
if(embedded) {
if(flags&DECOMP_EMBEDDED) {
// RESTORE ALL POINTERS BEFORE RETURNING
SavedDecompObject=*--RSTop;
LAMTopSaved=(WORDPTR *)*--RSTop;

View file

@ -1604,6 +1604,7 @@ void add_real(REAL *r,REAL *a,REAL *b)
skipbwords=totalwords;
totalwords=((Context.precdigits+7)>>3)+2;
skipbwords-=totalwords;
result->flags|=F_APPROX;
}
// COPY THE VAULE a TO THE result
@ -1632,11 +1633,18 @@ void add_real(REAL *r,REAL *a,REAL *b)
else add_long(result->data+totalwords-alen+wordshift+skipbwords,b->data+skipbwords,b->len-skipbwords);
}
} else {
// THERE'S NO OVERLAP WITHIN THE CURRENT PRECISION
// DON'T DO THE ADDITION, BUT MARK THE RESULT AS APPROXIMATED
result->flags|=F_APPROX;
}
// NO CARRY CORRECTION
result->len=totalwords;
result->flags|=F_NOTNORMALIZED;
result->flags|=F_NOTNORMALIZED | ((a->flags|b->flags)&F_APPROX);
result->exp=a->exp-((totalwords-a->len)<<3);
// NO ROUNDING OR TRUNCATION
@ -3512,7 +3520,7 @@ BINT ltReal(REAL *a,REAL *b)
int digits_a,digits_b;
digits_a=sig_digits(a->data[a->len-1])+((a->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+b->exp;
if(digits_a>digits_b) {
// ABS(A)>ABS(B)
@ -3606,126 +3614,12 @@ BINT gtReal(REAL *a,REAL *b)
BINT lteReal(REAL *a,REAL *b)
{
// TEST 1, SIGN
if((a->flags^b->flags)&F_NEGATIVE) {
// BOTH NUMBERS HAVE DIFFERENT SIGNS
if(a->flags&F_NEGATIVE) return 1;
else return 0;
}
// NUMBERS HAVE THE SAME SIGNS
// CHECK FOR SPECIALS
if((a->flags|b->flags)&F_NOTANUMBER) {
// IF ANY OF THE NUMBERS IS NOT A NUMBER, THE COMPARISON MAKES NO SENSE
// COMPARISONS ARE ALWAYS FALSE
return 0;
}
if(a->flags&F_INFINITY) {
if(a->flags&F_NEGATIVE) {
// A <= B
return 1;
}
else {
// A >= B
if(b->flags&F_INFINITY) return 1;
return 0;
}
}
// TEST 2, POSITION OF THE MOST SIGNIFICANT DIGIT
int digits_a,digits_b;
digits_a=sig_digits(a->data[a->len-1])+((a->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+a->exp;
if(digits_a>digits_b) {
// ABS(A)>ABS(B)
if(a->flags&F_NEGATIVE) return 1; // A<B
return 0;
}
if(digits_a<digits_b) {
// ABS(A)<ABS(B)
if(a->flags&F_NEGATIVE) return 0; // A>B
return 1;
}
// HERE NUMBERS HAVE THE SAME SIGN AND SAME ORDER OF MAGNITUDE
// NEED TO DO A SUBTRACTION
REAL c;
c.data=allocRegister();
sub_real(&c,a,b);
normalize(&c);
if(c.len==1 && c.data[0]==0) { freeRegister(c.data); return 1; }
freeRegister(c.data);
if(c.flags&F_NEGATIVE) return 1;
return 0;
return !gtReal(a,b);
}
BINT gteReal(REAL *a,REAL *b)
{
// TEST 1, SIGN
if((a->flags^b->flags)&F_NEGATIVE) {
// BOTH NUMBERS HAVE DIFFERENT SIGNS
if(a->flags&F_NEGATIVE) return 0;
else return 1;
}
// NUMBERS HAVE THE SAME SIGNS
// CHECK FOR SPECIALS
if((a->flags|b->flags)&F_NOTANUMBER) {
// IF ANY OF THE NUMBERS IS NOT A NUMBER, THE COMPARISON MAKES NO SENSE
// COMPARISONS ARE ALWAYS FALSE
return 0;
}
if(a->flags&F_INFINITY) {
if(!(a->flags&F_NEGATIVE)) {
// A >= B
return 1;
}
else {
// A <= B
if(b->flags&F_INFINITY) return 1;
return 0;
}
}
// TEST 2, POSITION OF THE MOST SIGNIFICANT DIGIT
int digits_a,digits_b;
digits_a=sig_digits(a->data[a->len-1])+((a->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+a->exp;
if(digits_a>digits_b) {
// ABS(A)>ABS(B)
if(a->flags&F_NEGATIVE) return 0; // A<B
return 1;
}
if(digits_a<digits_b) {
// ABS(A)<ABS(B)
if(a->flags&F_NEGATIVE) return 1; // A>B
return 0;
}
// HERE NUMBERS HAVE THE SAME SIGN AND SAME ORDER OF MAGNITUDE
// NEED TO DO A SUBTRACTION
REAL c;
c.data=allocRegister();
sub_real(&c,a,b);
normalize(&c);
if(c.len==1 && c.data[0]==0) { freeRegister(c.data); return 1; } // A==B
freeRegister(c.data);
if(c.flags&F_NEGATIVE) return 0;
return 1;
return !ltReal(a,b);
}
BINT eqReal(REAL *a,REAL *b)
@ -3753,7 +3647,7 @@ BINT eqReal(REAL *a,REAL *b)
int digits_a,digits_b;
digits_a=sig_digits(a->data[a->len-1])+((a->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+b->exp;
if(digits_a!=digits_b) return 0;
@ -3810,7 +3704,7 @@ BINT cmpReal(REAL *a,REAL *b)
int digits_a,digits_b;
digits_a=sig_digits(a->data[a->len-1])+((a->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+a->exp;
digits_b=sig_digits(b->data[b->len-1])+((b->len-1)<<3)+b->exp;
if(digits_a>digits_b) {
// ABS(A)>ABS(B)

View file

@ -422,7 +422,7 @@ void LIB_HANDLER()
// THIS IS UNREACHABLE CODE HERE
}
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:
// DecompileObject = Ptr to prolog of object to decompile

View file

@ -385,6 +385,8 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:
// DecompileObject = Ptr to prolog of object to decompile

View file

@ -737,6 +737,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -894,6 +894,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -125,6 +125,7 @@ void LIB_HANDLER()
RetNum=ERR_NOTMINE;
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -174,6 +174,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,(WORDPTR)LIB_OPCODES,LIB_NUMCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:

View file

@ -1165,6 +1165,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:
@ -1175,6 +1176,7 @@ void LIB_HANDLER()
// RetNum = enum DecompileErrors
if(ISPROLOG(*DecompileObject)) {
rplDecompAppendString((BYTEPTR)"[ ");
BINT rows=MATROWS(*(DecompileObject+1)),cols=MATCOLS(*(DecompileObject+1));
@ -1193,7 +1195,7 @@ void LIB_HANDLER()
{
BINT offset=*(DecompileObject+2+i*cols+j);
rplDecompile(DecompileObject+offset,1); // RUN EMBEDDED
rplDecompile(DecompileObject+offset,DECOMP_EMBEDDED | ((CurOpcode==OPCODE_DECOMPEDIT)? DECOMP_EDIT:0)); // RUN EMBEDDED
if(Exceptions) { RetNum=ERR_INVALID; return; }
rplDecompAppendChar(' ');
}

View file

@ -2580,6 +2580,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -197,6 +197,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -318,6 +318,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -697,6 +697,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -684,6 +684,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -726,6 +726,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -409,6 +409,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -157,6 +157,7 @@ void LIB_HANDLER()
// SINCE THIS IS THE LAST LIBRARY TO BE EVALUATED, DO ONE LAST PASS TO COMPILE IT AS AN IDENT
// EITHER LAM OR IN USEROB
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -817,6 +817,7 @@ void LIB_HANDLER()
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -449,21 +449,16 @@ void LIB_HANDLER()
BINT isapprox=0;
BINT tlen=TokenLen;
if(strptr[tlen-1]=='.') {
// NUMBERS ENDING IN A DOT ARE APPROXIMATED
isapprox|=APPROX_BIT;
--tlen;
}
newRealFromText(&RReg[0],(char *)TokenStart,tlen);
if(RReg[0].flags&F_ERROR) {
// THERE WAS SOME ERROR DURING THE CONVERSION, PROBABLY A SYNTAX ERROR
RetNum=ERR_NOTMINE;
return;
}
if(RReg[0].flags&F_APPROX) isapprox=APPROX_BIT;
// WRITE THE PROLOG
rplCompileAppend(MKPROLOG(LIBRARY_NUMBER|isapprox,1+RReg[0].len));
// PACK THE INFORMATION
@ -480,6 +475,9 @@ void LIB_HANDLER()
RetNum=OK_CONTINUE;
return;
}
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:
// DecompileObject = Ptr to WORD of object to decompile
@ -503,25 +501,32 @@ void LIB_HANDLER()
BigNumLimit.exp=12;
SmallNumLimit.exp=-4;
BINT *Format;
BINT Format;
if(ltReal(&realnum,&SmallNumLimit)) Format=&FmtSmall;
else if(gtReal(&realnum,&BigNumLimit)) Format=&FmtLarge;
else Format=&FmtNormal;
if(ltReal(&realnum,&SmallNumLimit)) Format=FmtSmall;
else if(gtReal(&realnum,&BigNumLimit)) Format=FmtLarge;
else Format=FmtNormal;
if(CurOpcode==OPCODE_DECOMPEDIT) Format|=FMT_CODE;
// ESTIMATE THE MAXIMUM STRING LENGTH AND RESERVE THE MEMORY
BYTEPTR string=(BYTEPTR)DecompStringEnd;
BYTEPTR string;
BINT len=formatlengthReal(&realnum,*Format);
BINT len=formatlengthReal(&realnum,Format);
rplDecompAppendString2(string,len);
// RESERVE THE MEMORY FIRST
rplDecompAppendString2(DecompStringEnd,len);
// NOW USE IT
string=(BYTEPTR)DecompStringEnd;
string-=len;
if(Exceptions) {
RetNum=ERR_INVALID;
return;
}
DecompStringEnd=(WORDPTR) formatReal(&realnum,string,*Format,Locale);
DecompStringEnd=(WORDPTR) formatReal(&realnum,string,Format,Locale);
RetNum=OK_CONTINUE;

View file

@ -958,6 +958,7 @@ void LIB_HANDLER()
rplCompileAppend((WORD)( (result>>32)&0xffffffff));
RetNum=OK_CONTINUE;
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -897,6 +897,7 @@ void LIB_HANDLER()
libCompileCmds(LIBRARY_NUMBER,(char **)LIB_NAMES,NULL,LIB_NUMBEROFCMDS);
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -294,6 +294,7 @@ void LIB_HANDLER()
return;
case OPCODE_DECOMPEDIT:
case OPCODE_DECOMPILE:
// DECOMPILE RECEIVES:

View file

@ -21,9 +21,10 @@
#define OPCODE_COMPILE 0x7FFFF
#define OPCODE_COMPILECONT 0x7FFFE
#define OPCODE_DECOMPILE 0x7FFFD
#define OPCODE_VALIDATE 0x7FFFC
#define OPCODE_PROBETOKEN 0x7FFFB
#define OPCODE_GETINFO 0x7FFFA
#define OPCODE_DECOMPEDIT 0x7FFFC
#define OPCODE_VALIDATE 0x7FFFB
#define OPCODE_PROBETOKEN 0x7FFFA
#define OPCODE_GETINFO 0x7FFF9
#define OPCODE_LIBREMOVE 0x7FFF1
#define OPCODE_LIBINSTALL 0x7FFF0

View file

@ -100,6 +100,11 @@ extern "C" {
#include "sysvars.h"
// INTERNAL TRANSCENDENTAL FUNCTIONS
void hyp_exp(REAL *);
void hyp_ln(REAL *);
@ -147,15 +152,18 @@ extern void shrinkTempBlocks(WORD newtotalsize);
// COMPILER FUNCTIONS IN COMPILER.C
extern WORDPTR rplCompile(BYTEPTR string, BINT len, BINT addwrapper);
extern void rplCompileAppend(WORD word);
extern WORDPTR rplCompileAppendWords(BINT nwords);
extern void rplCompileRemoveWords(BINT nwords);
#define DECOMP_EMBEDDED 1
#define DECOMP_EDIT 2
// DECOMPILER FUNCTIONS
extern WORDPTR rplDecompile(WORDPTR object, BINT embedded);
extern WORDPTR rplDecompile(WORDPTR object, BINT flags);
extern void rplDecompAppendChar(BYTE c);
extern void rplDecompAppendString(BYTEPTR str);
extern void rplDecompAppendString2(BYTEPTR str,BINT len);

View file

@ -39,6 +39,7 @@ extern void lib72_handler();
extern void lib4080_handler();
extern void lib4090_handler();
void dummy_libhandler()
{
if(ISPROLOG(CurOpcode)) return;
@ -51,15 +52,18 @@ switch(OPCODE(CurOpcode))
// --------------------
// LIBRARIES ARE FORCED TO ALWAYS HANDLE THE STANDARD OPCODES
case OPCODE_LIBINSTALL:
RetNum=ERR_INVALID;
return;
case OPCODE_COMPILE:
RetNum=ERR_NOTMINE;
return;
case OPCODE_DECOMPILE:
RetNum=ERR_INVALID;
return;
}
RetNum=ERR_INVALID;
Exceptions|=EX_BADOPCODE;
ExceptionPointer=IPtr;
return;
}