From 9d2608e353967b85d91a5be76fdbdcf8acce736d Mon Sep 17 00:00:00 2001 From: claudiol Date: Thu, 10 Aug 2017 19:29:30 -0400 Subject: [PATCH] Fixed bugs in debugging with SST and local variables. Fixed bug HIDELOCALS fails to track variables. Implemented SEQ in RPL. --- firmware/hal_keyboard.c | 10 +++++----- newrpl-comp.c | 3 ++- newrpl/lib-32-lam.c | 34 ++++++++++++++++++++++------------ newrpl/lib-62-lists.c | 23 ++++++++++++++++++----- newrpl/lib-65-system.c | 19 ++++++++++++++++--- newrpl/lib-nine-docol2.c | 5 ++++- newrpl/rpl-objects/lib-62.nrpl | 20 ++++++++++++++++++++ newrpl/rpl-objects/lib-65.nrpl | 15 +++++++++++++++ 8 files changed, 102 insertions(+), 27 deletions(-) diff --git a/firmware/hal_keyboard.c b/firmware/hal_keyboard.c index 2f83c28..cad7b25 100644 --- a/firmware/hal_keyboard.c +++ b/firmware/hal_keyboard.c @@ -494,9 +494,9 @@ if(iseval) { } else { - // RETURN STACK WAS INTACT, RESTORE THE REST - if(LAMTop>LAMs+lamsave) LAMTop=LAMs+lamsave; - if(nLAMBase>LAMs+nlambase) nLAMBase=LAMs+nlambase; + // RETURN STACK WAS INTACT, IT HALTED AT OUR OWN SECONDARY + //if(LAMTop>LAMs+lamsave) LAMTop=LAMs+lamsave; + //if(nLAMBase>LAMs+nlambase) nLAMBase=LAMs+nlambase; // DON'T ALTER THE INSTRUCTION POINTER OF THE HALTED PROGRAM rplClearErrors(); @@ -613,8 +613,8 @@ if(iseval) { } else { // RETURN STACK WAS INTACT, RESTORE THE REST - if(LAMTop>LAMs+lamsave) LAMTop=LAMs+lamsave; - if(nLAMBase>LAMs+nlambase) nLAMBase=LAMs+nlambase; + //if(LAMTop>LAMs+lamsave) LAMTop=LAMs+lamsave; + //if(nLAMBase>LAMs+nlambase) nLAMBase=LAMs+nlambase; // DON'T ALTER THE INSTRUCTION POINTER OF THE HALTED PROGRAM rplClearErrors(); diff --git a/newrpl-comp.c b/newrpl-comp.c index 78d47a2..aca36d9 100644 --- a/newrpl-comp.c +++ b/newrpl-comp.c @@ -93,7 +93,8 @@ void compShowErrorMsg(char *inputfile,char *mainbuffer,FILE *stream) fprintf(stream," error: "); // TODO: GET NEW TRANSLATABLE MESSAGES WORDPTR message=uiGetLibMsg(ErrorCode); - fwrite((char *)(message+1),1,rplStrSize(message),stream); + if(!message) fprintf(stream," %d in library %d\n",ErrorCode&0x7f,LIBFROMMSG(ErrorCode)); + else fwrite((char *)(message+1),1,rplStrSize(message),stream); } fprintf(stream,"\n"); } diff --git a/newrpl/lib-32-lam.c b/newrpl/lib-32-lam.c index 961b0fd..370cfe3 100644 --- a/newrpl/lib-32-lam.c +++ b/newrpl/lib-32-lam.c @@ -868,14 +868,29 @@ void LIB_HANDLER() } else { // THIS WOULD CREATE A LOCAL THAT CANNOT BE TRACED - // BY THE COMPILER. DISABLE PUTLAM/GETLAM OPTIMIZATION - // FOR THE REST OF THIS ENVIRONMENT + // BY THE COMPILER. JUST USE AN INVALID NAME. - // ISSUE A SYNTAX ERROR, LSTO REQUIRES A COMPILE-TIME VARIABLE NAME - RetNum=ERR_SYNTAX; - return; + // THIS IS NOT A VALID LAM, LEAVE AS IDENT + + rplCompileAppend(MKOPCODE(LIBRARY_NUMBER,LSTO)); + + // TRACK LAM CREATION IN THE CURRENT ENVIRONMENT + if(!notrack) { + // DO WE NEED A NEW ENVIRONMENT? + + if(rplNeedNewLAMEnvCompiler()) { // CREATE A NEW ENVIRONMENT IF NEEDED + rplCreateLAMEnvironment(*(ValidateTop-1)); + } + rplCreateLAM((WORDPTR)zero_bint,(WORDPTR)zero_bint); + } + else { + // CREATE A BARRIER TO PREVENT ANY MORE PUTLAM/GETLAM REFERENCES BEYOND THIS POINT + rplCreateLAMEnvironment((WORDPTR)lameval_seco); // CREATE A NEW ENVIRONMENT OWNED BY A DOCOL SECONDARY + } + RetNum=OK_CONTINUE; + return; + } - } } @@ -887,7 +902,7 @@ void LIB_HANDLER() // HIDELOCALS NEEDS SPECIAL CONSIDERATION TO CREATE LAMS AT COMPILE TIME, OR TRACING WILL BE OFF BY 1 - if((TokenLen==10) && (!utf8ncmp((char *)TokenStart,"HIDELOCALS",4))) + if((TokenLen==10) && (!utf8ncmp((char *)TokenStart,"HIDELOCALS",10))) { // CHECK IF THE PREVIOUS OBJECT IS A QUOTED IDENT? @@ -934,12 +949,8 @@ void LIB_HANDLER() } - if(object