Changeset 31 for trunk/orca/ovalue.h

Show
Ignore:
Timestamp:
02/08/06 01:35:49 (3 years ago)
Author:
krobillard
Message:

Overflow of the quick hold stack is now caught.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/ovalue.h

    r27 r31  
    118118 
    119119#define OR_INVALID_HOLD -1 
     120#define OR_MAX_QHOLDS   256 
    120121 
    121122 
     
    358359 
    359360    OHold*      quickHolds; 
    360     OHold*      quickHoldsTop; 
     361    int         quickHoldsUsed; 
    361362 
    362363#ifdef OR_CONFIG_NUMBER_ARRAYS 
     
    497498#define orIsNumber(t)   ((t == OT_INTEGER) || (t == OT_DECIMAL)) 
    498499 
     500#define orRefAvail(n) \ 
     501    (((OR_MAX_QHOLDS - 1) - orEnv->quickHoldsUsed) > n) 
     502 
     503#define orRefAvailErr(n) \ 
     504    if( ! orRefAvail(n) ) { \ 
     505        orErrorT(OR_ERROR_INTERNAL, "Hold stack overflow"); \ 
     506        return; } 
     507 
    499508#define orRefPush(type,index) \ 
    500     orEnv->quickHoldsTop->dataType = type; \ 
    501     orEnv->quickHoldsTop->which = index; \ 
    502     ++orEnv->quickHoldsTop 
    503  
    504 #define orRefPop(count)         orEnv->quickHoldsTop -= count 
     509    orEnv->quickHolds[ orEnv->quickHoldsUsed ].dataType = type; \ 
     510    orEnv->quickHolds[ orEnv->quickHoldsUsed ].which = index; \ 
     511    ++orEnv->quickHoldsUsed 
     512 
     513#define orRefPop(count)         orEnv->quickHoldsUsed -= count 
    505514 
    506515#define orWordVal(wv,blk,val) \