mirror of
https://git.code.sf.net/p/newrpl/sources
synced 2024-11-16 19:51:25 +01:00
Added MEMCHECK and MEMFIX commands.
This commit is contained in:
parent
a74b306254
commit
d96e89ea4e
3 changed files with 46 additions and 3 deletions
|
@ -37,7 +37,9 @@ static const HALFWORD const libnumberlist[]={ LIBRARY_NUMBER,0 };
|
|||
|
||||
// LIST OF COMMANDS EXPORTED, CHANGE FOR EACH LIBRARY
|
||||
#define CMD_LIST \
|
||||
CMD(TICKS)
|
||||
CMD(TICKS), \
|
||||
CMD(MEMCHECK), \
|
||||
CMD(MEMFIX)
|
||||
|
||||
|
||||
// ADD MORE OPCODES HERE
|
||||
|
@ -84,6 +86,34 @@ void LIB_HANDLER()
|
|||
rplNewBINTPush(ticks,DECBINT);
|
||||
return;
|
||||
}
|
||||
case MEMCHECK:
|
||||
{
|
||||
// SYSTEM SANITY CHECK
|
||||
|
||||
if(rplVerifyDStack(0)) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
if(rplVerifyRStack()) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
if(rplVerifyTempOb()) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
if(rplVerifyDirectories(0)) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
case MEMFIX:
|
||||
{
|
||||
if(rplVerifyDStack(0)) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
if(rplVerifyRStack()) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
if(rplVerifyTempOb()) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
if(rplVerifyDirectories(0)) rplPushDataNoGrow((WORDPTR)one_bint);
|
||||
else rplPushDataNoGrow((WORDPTR)zero_bint);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
case TRANSCENTABLE:
|
||||
|
|
|
@ -226,6 +226,19 @@ extern void rplGCollect();
|
|||
void rplBackup(void (*writefunc)(unsigned int));
|
||||
void rplRestoreBackup(void (*readfunc)(unsigned int));
|
||||
|
||||
// SYSTEM SANITY CHECKS
|
||||
BINT rplVerifyObject(WORDPTR obj);
|
||||
BINT rplIsTempObPointer(WORDPTR ptr);
|
||||
BINT rplVerifyObjPointer(WORDPTR ptr);
|
||||
BINT rplVerifyDStack(BINT fix);
|
||||
BINT rplVerifyRStack();
|
||||
BINT rplVerifyTempOb();
|
||||
BINT rplVerifyDirectories(BINT fix);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// LAM FUNCTIONS
|
||||
|
|
|
@ -101,7 +101,7 @@ return 0;
|
|||
BINT rplVerifyDStack(BINT fix)
|
||||
{
|
||||
BINT errors=0;
|
||||
WORDPTR *stkptr=DSTop;
|
||||
WORDPTR *stkptr=DSTop-1;
|
||||
WORDPTR *bottom=DStkBottom;
|
||||
|
||||
do {
|
||||
|
@ -153,7 +153,7 @@ return 1;
|
|||
|
||||
BINT rplVerifyRStack()
|
||||
{
|
||||
WORDPTR *stkptr=RSTop;
|
||||
WORDPTR *stkptr=RSTop-1;
|
||||
|
||||
while(stkptr>=RStk) {
|
||||
if((stkptr>=DStk)&&(stkptr<DSTop)) {
|
||||
|
|
Loading…
Reference in a new issue