Changeset 68

Show
Ignore:
Timestamp:
03/02/06 23:56:07 (3 years ago)
Author:
krobillard
Message:

Replaced OR_BIG_ENDIAN with BIG_ENDIAN.
Added _validateEnv().

Location:
trunk/orca
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/ovalue.c

    r54 r68  
    278278 
    279279 
    280 /** 
    281   Initialize scripting environment. 
    282   Call orFreeEnv() when finished with the interpreter. 
    283  
    284   If dataStackSize is less than 512 it will be set to 512. 
    285   If callStackSize is less than 64 it will be set to 64. 
    286 */ 
    287 void orInitEnv( OEnv* env, int dataStackSize, int callStackSize ) 
    288 { 
     280#ifdef DEBUG 
     281static void _validateEnv() 
     282{ 
     283    int i; 
     284    OValue val; 
     285 
    289286#if 0 
    290287    printf( "sizeof(OValue)      %d\n", sizeof(OValue) ); 
     
    297294 
    298295    assert( sizeof(OValue) == 16 ); 
     296 
     297    // Make sure endianess is correct. 
     298    i = 1; 
     299#if defined(__BIG_ENDIAN__) 
     300    assert(0 == *(char*)&i && "Undefine __BIG_ENDIAN__"); 
     301#else 
     302    assert(1 == *(char*)&i && "Define __BIG_ENDIAN__"); 
     303#endif 
     304 
     305    // Make sure double is aligned on 8 byte boundary. 
     306    assert( ((char*) &val) + 8 == ((char*) &orDecimal(&val)) ); 
     307} 
     308#endif 
     309 
     310 
     311/** 
     312  Initialize scripting environment. 
     313  Call orFreeEnv() when finished with the interpreter. 
     314 
     315  If dataStackSize is less than 512 it will be set to 512. 
     316  If callStackSize is less than 64 it will be set to 64. 
     317*/ 
     318void orInitEnv( OEnv* env, int dataStackSize, int callStackSize ) 
     319{ 
     320#ifdef DEBUG 
     321    _validateEnv(); 
     322#endif 
    299323 
    300324    orEnv = env; 
     
    394418    wval = orIntern( &ctx, "native", 6, 0 ); 
    395419    *wval = *res; 
    396  
    397     // Makes sure double is aligned on 8 byte boundary. 
    398     assert( ((char*) res) + 8 == ((char*) &orDecimal(res)) ); 
    399420 
    400421    orNative( orNativeNative, "native" ); 
  • trunk/orca/ovalue.h

    r63 r68  
    3636#define OR_VERSION_STR  "0.0.24" 
    3737#define OR_VERSION      0x000024 
    38  
    39  
    40 #if defined(__APPLE__) && defined(__BIG_ENDIAN__) 
    41 #define OR_BIG_ENDIAN   1 
    42 #endif 
    4338 
    4439 
     
    548543#define orClrBit(array,n)   (array[(n)>>3] &= ~(1<<((n)&7))) 
    549544 
    550 #ifdef OR_BIG_ENDIAN 
     545#ifdef __BIG_ENDIAN__ 
    551546#define orSetTF(val,t)      *((uint32_t*) &(val)->type) = t << 24 
    552547#else