value_locals.h File Reference

This reference page is linked to from the following overview topics: Local Variables in MAXScript Exposed Functions, Local Value Arrays.


Go to the source code of this file.

Defines

#define  one_value_local(n1)
#define  one_typed_value_local(n1)
#define  two_value_locals(n1, n2)
#define  two_typed_value_locals(n1, n2)
#define  three_value_locals(n1, n2, n3)
#define  three_typed_value_locals(n1, n2, n3)
#define  four_value_locals(n1, n2, n3, n4)
#define  four_typed_value_locals(n1, n2, n3, n4)
#define  five_value_locals(n1, n2, n3, n4, n5)
#define  five_typed_value_locals(n1, n2, n3, n4, n5)
#define  six_value_locals(n1, n2, n3, n4, n5, n6)
#define  six_typed_value_locals(n1, n2, n3, n4, n5, n6)
#define  seven_value_locals(n1, n2, n3, n4, n5, n6, n7)
#define  seven_typed_value_locals(n1, n2, n3, n4, n5, n6, n7)
#define  eight_value_locals(n1, n2, n3, n4, n5, n6, n7, n8)
#define  eight_typed_value_locals(n1, n2, n3, n4, n5, n6, n7, n8)
#define  nine_value_locals(n1, n2, n3, n4, n5, n6, n7, n8, n9)
#define  nine_typed_value_locals(n1, n2, n3, n4, n5, n6, n7, n8, n9)
#define  ten_value_locals(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10)
#define  ten_typed_value_locals(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10)
#define  eleven_value_locals(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11)
#define  eleven_typed_value_locals(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11)
#define  value_local_array(var, count)
#define  pop_value_local_array(var)   thread_local(current_locals_frame) = (Value**)var[-1];
#define  value_temp_array(var, count)
#define  value_temp_array0(var)
#define  realloc_value_temp_array(var, count, old_count)
#define  pop_value_temp_array(var)
#define  return_value(r)
#define  return_value_no_pop(r)
#define  return_protected(r)
#define  pop_value_locals()   thread_local(current_locals_frame) = vl.link;
#define  reset_locals_frame()   thread_local(current_locals_frame) = (Value**)&vl;
#define  reset_locals_array_frame(var)   thread_local(current_locals_frame) = &var[-2];
#define  clear_current_frames()
#define  save_current_frames()
#define  restore_current_frames()
#define  save_current_source()
#define  restore_current_source()
#define  save_current_source_no_pos()
#define  restore_current_source_no_pos()
#define  save_current_source_pos()
#define  restore_current_source_pos()
#define  save_current_source_to_frame()
#define  save_current_source_to_frame_no_pos()
#define  save_current_source_to_frame_pos()
#define  save_current_source_to_frame_no_file()
#define  push_control(_c)
#define  pop_control()   thread_local(current_controller) = _save_cc;
#define  save_error_source_data()
#define  clear_error_source_data()

Define Documentation

#define one_value_local (   n1 )
Value:
struct { int count; Value** link; Value* n1; } vl =             \
        { 1, NULL, NULL };                                          \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 11 of file value_locals.h.

#define one_typed_value_local (   n1 )
Value:
struct { int count; Value** link; n1; } vl =                    \
        { 1, NULL, NULL };                                          \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 17 of file value_locals.h.

#define two_value_locals (   n1,
  n2 
)
Value:
struct { int count; Value** link; Value *n1, *n2; } vl =        \
        { 2, NULL, NULL, NULL };                                    \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 23 of file value_locals.h.

#define two_typed_value_locals (   n1,
  n2 
)
Value:
struct { int count; Value** link; n1; n2; } vl =                \
        { 2, NULL, NULL, NULL };                                    \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 29 of file value_locals.h.

#define three_value_locals (   n1,
  n2,
  n3 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3; } vl =   \
        { 3, NULL, NULL, NULL, NULL };                              \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 35 of file value_locals.h.

#define three_typed_value_locals (   n1,
  n2,
  n3 
)
Value:
struct { int count; Value** link; n1; n2; n3; } vl =            \
        { 3, NULL, NULL, NULL, NULL };                              \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 41 of file value_locals.h.

#define four_value_locals (   n1,
  n2,
  n3,
  n4 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4; } vl =  \
        { 4, NULL, NULL, NULL, NULL, NULL };                            \
    vl.link = thread_local(current_locals_frame);                       \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 47 of file value_locals.h.

#define four_typed_value_locals (   n1,
  n2,
  n3,
  n4 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; } vl =        \
        { 4, NULL, NULL, NULL, NULL, NULL };                        \
    vl.link = thread_local(current_locals_frame);                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 53 of file value_locals.h.

#define five_value_locals (   n1,
  n2,
  n3,
  n4,
  n5 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5; } vl = \
        { 5, NULL, NULL, NULL, NULL, NULL, NULL };                          \
    vl.link = thread_local(current_locals_frame);                           \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 59 of file value_locals.h.

#define five_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; } vl =            \
        { 5, NULL, NULL, NULL, NULL, NULL, NULL };                          \
    vl.link = thread_local(current_locals_frame);                           \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 65 of file value_locals.h.

#define six_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6; } vl = \
        { 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                         \
    vl.link = thread_local(current_locals_frame);                                \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 71 of file value_locals.h.

#define six_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; } vl =        \
        { 6, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                    \
    vl.link = thread_local(current_locals_frame);                           \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 77 of file value_locals.h.

#define seven_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7; } vl = \
        { 7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                        \
    vl.link = thread_local(current_locals_frame);                                     \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 83 of file value_locals.h.

#define seven_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; } vl =    \
        { 7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };              \
    vl.link = thread_local(current_locals_frame);                           \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 89 of file value_locals.h.

#define eight_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7, *n8; } vl = \
        { 8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                       \
    vl.link = thread_local(current_locals_frame);                                          \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 95 of file value_locals.h.

#define eight_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; n8; } vl =    \
        { 8, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };            \
    vl.link = thread_local(current_locals_frame);                               \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 101 of file value_locals.h.

#define nine_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8,
  n9 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7, *n8, *n9; } vl = \
        { 9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                      \
    vl.link = thread_local(current_locals_frame);                                               \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 108 of file value_locals.h.

#define nine_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8,
  n9 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; n8; n9; } vl =    \
        { 9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };          \
    vl.link = thread_local(current_locals_frame);                                   \
    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 114 of file value_locals.h.

#define ten_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8,
  n9,
  n10 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7, *n8, *n9, *n10; } vl =   \
        { 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                   \
        vl.link = thread_local(current_locals_frame);                                               \
        thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 120 of file value_locals.h.

#define ten_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8,
  n9,
  n10 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; n8; n9; n10; } vl =   \
        { 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };   \
        vl.link = thread_local(current_locals_frame);                               \
        thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 126 of file value_locals.h.

#define eleven_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8,
  n9,
  n10,
  n11 
)
Value:
struct { int count; Value** link; Value *n1, *n2, *n3, *n4, *n5, *n6, *n7, *n8, *n9, *n10, *n11; } vl = \
        { 11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };                 \
        vl.link = thread_local(current_locals_frame);                                                   \
        thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 132 of file value_locals.h.

#define eleven_typed_value_locals (   n1,
  n2,
  n3,
  n4,
  n5,
  n6,
  n7,
  n8,
  n9,
  n10,
  n11 
)
Value:
struct { int count; Value** link; n1; n2; n3; n4; n5; n6; n7; n8; n9; n10; n11; } vl =  \
        { 11, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; \
        vl.link = thread_local(current_locals_frame);                                   \
        thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 138 of file value_locals.h.

#define value_local_array (   var,
  count 
)
Value:
{                               \
    var = &((Value**)_alloca(((count) + 2) * sizeof(Value*)))[2];   \
    memset(var, 0, (count) * sizeof(Value*));                       \
   var[-2] = (Value*)(static_cast<INT_PTR>(count));            \
    var[-1] = (Value*)thread_local(current_locals_frame);           \
    thread_local(current_locals_frame) = &var[-2]; }

Definition at line 144 of file value_locals.h.

#define pop_value_local_array (   var )    thread_local(current_locals_frame) = (Value**)var[-1];

Definition at line 151 of file value_locals.h.

#define value_temp_array (   var,
  count 
)
Value:
{                           \
    var = &((Value**)ms_malloc(((count) + 2) * sizeof(Value*)))[2]; \
    memset(var, 0, (count) * sizeof(Value*));                       \
   var[-2] = (Value*)(static_cast<INT_PTR>(count));            \
   var[-1] = (Value*)thread_local(current_locals_frame);       \
   thread_local(current_locals_frame) = &var[-2];}

Definition at line 154 of file value_locals.h.

#define value_temp_array0 (   var )
Value:
{                              \
   var = &((Value**)ms_malloc(2 * sizeof(Value*)))[2];   \
   var[-2] = 0; \
    var[-1] = (Value*)thread_local(current_locals_frame);           \
    thread_local(current_locals_frame) = &var[-2];}

Definition at line 164 of file value_locals.h.

#define realloc_value_temp_array (   var,
  count,
  old_count 
)
Value:
{                       \
    Value **oldPointer = &var[-2];                                              \
    Value **sframe = thread_local(current_locals_frame);                        \
    var = &((Value**)ms_realloc(&var[-2], ((count) + 2) * sizeof(Value*)))[2];      \
    if ((count) > (old_count))                                                  \
        memset(&var[(old_count)], 0, ((count) - (old_count)) * sizeof(Value*)); \
   var[-2] = (Value*)(static_cast<INT_PTR>(count));               \
    Value **newPointer = &var[-2];                                              \
    if (sframe == oldPointer)                                                   \
    {   thread_local(current_locals_frame) = newPointer;                        \
        DbgAssert( newPointer != (Value**)newPointer[1] );                      \
    }                                                                           \
    else                                                                        \
    {   Value **frame;                                                          \
        for (frame = sframe; frame && (Value**)frame[1] != oldPointer && frame != (Value**)frame[1]; frame = (Value**)frame[1]);    \
        if (frame) {                                                            \
            DbgAssert( frame != (Value**)frame[1] );                            \
            frame[1] = (Value*)newPointer;                                      \
        }                                                                       \
    }                                                                           \
    }

Definition at line 171 of file value_locals.h.

#define pop_value_temp_array (   var )
Value:
{                           \
    Value **oldPointer = &var[-2];                              \
/*  Value **sframe = thread_local(current_locals_frame); */     \
    Value **head = (Value**)var[-1];                            \
    thread_local(current_locals_frame) = head;                  \
    ms_free(oldPointer);                                            \
    }

Definition at line 194 of file value_locals.h.

#define return_value (   r )
Value:
{                                       \
    thread_local(current_result) = r;                           \
    thread_local(current_locals_frame) = vl.link;               \
    return r; }

Definition at line 202 of file value_locals.h.

#define return_value_no_pop (   r )
Value:
{                               \
    thread_local(current_result) = r;                           \
    return r; }

Definition at line 207 of file value_locals.h.

#define return_protected (   r )
Value:
{                                   \
    thread_local(current_result) = r;                           \
    return r; }

Definition at line 211 of file value_locals.h.

#define pop_value_locals ( )    thread_local(current_locals_frame) = vl.link;

Definition at line 215 of file value_locals.h.

#define reset_locals_frame ( )    thread_local(current_locals_frame) = (Value**)&vl;

Definition at line 218 of file value_locals.h.

#define reset_locals_array_frame (   var )    thread_local(current_locals_frame) = &var[-2];

Definition at line 221 of file value_locals.h.

#define clear_current_frames ( )
Value:
{                               \
    thread_local(current_locals_frame) = NULL;                  \
    thread_local(current_frame) = NULL;}

Definition at line 224 of file value_locals.h.

#define save_current_frames ( )
Value:
Value** _sclf = thread_local(current_locals_frame);         \
    Value** _scsf = thread_local(current_scan_frame);           \
    Value** _scf = thread_local(current_frame);

Definition at line 228 of file value_locals.h.

#define restore_current_frames ( )
Value:
{                               \
    thread_local(current_locals_frame) = _sclf;                 \
    thread_local(current_scan_frame) = _scsf;                   \
    thread_local(current_frame) = _scf;}

Definition at line 233 of file value_locals.h.

#define save_current_source ( )
Value:
Value* _save_source = thread_local(source_file);            \
    MSZipPackage* _save_pkg = thread_local(current_pkg);        \
    unsigned int  _save_pos = thread_local(source_pos);         \
    unsigned int _save_line = thread_local(source_line);        \
    DWORD _save_flags = thread_local(source_flags);

Definition at line 238 of file value_locals.h.

#define restore_current_source ( )
Value:
{                               \
    thread_local(source_file) = _save_source;                   \
    thread_local(current_pkg) = _save_pkg;                      \
    thread_local(source_pos) = _save_pos;                       \
    thread_local(source_line) = _save_line;                     \
    thread_local(source_flags) = _save_flags;}

Definition at line 245 of file value_locals.h.

#define save_current_source_no_pos ( )
Value:
Value* _save_source = thread_local(source_file);            \
    MSZipPackage* _save_pkg = thread_local(current_pkg);        \
    DWORD _save_flags = thread_local(source_flags);

Definition at line 252 of file value_locals.h.

#define restore_current_source_no_pos ( )
Value:
{                       \
    thread_local(source_file) = _save_source;                   \
    thread_local(current_pkg) = _save_pkg;                      \
    thread_local(source_flags) = _save_flags;}

Definition at line 257 of file value_locals.h.

#define save_current_source_pos ( )
Value:
unsigned int  _save_pos = thread_local(source_pos);         \
    unsigned int _save_line = thread_local(source_line);        \
    DWORD _save_flags = thread_local(source_flags);

Definition at line 262 of file value_locals.h.

#define restore_current_source_pos ( )
Value:
{                           \
    thread_local(source_pos) = _save_pos;                       \
    thread_local(source_line) = _save_line;                     \
    thread_local(source_flags) = _save_flags;}

Definition at line 267 of file value_locals.h.

#define save_current_source_to_frame ( )
Value:
{                       \
    Value** _frame = thread_local(current_scan_frame);          \
    if (_frame) _frame[3] = thread_local(source_file);          \
    if (_frame) _frame[4] = (Value*)thread_local(source_pos);   \
    if (_frame) _frame[8] = (Value*)thread_local(source_line);  \
    if (_frame) _frame[7] = (Value*)static_cast<DWORD_PTR>(thread_local(source_flags));}

Definition at line 272 of file value_locals.h.

#define save_current_source_to_frame_no_pos ( )
Value:
{                   \
    Value** _frame = thread_local(current_scan_frame);          \
    if (_frame) _frame[3] = thread_local(source_file);          \
    if (_frame) _frame[7] = (Value*)static_cast<DWORD_PTR>(thread_local(source_flags));}

Definition at line 279 of file value_locals.h.

#define save_current_source_to_frame_pos ( )
Value:
{                   \
    Value** _frame = thread_local(current_scan_frame);          \
    if (_frame) _frame[4] = (Value*)thread_local(source_pos);   \
    if (_frame) _frame[8] = (Value*)thread_local(source_line);}

Definition at line 284 of file value_locals.h.

#define save_current_source_to_frame_no_file ( )
Value:
{               \
    Value** _frame = thread_local(current_scan_frame);          \
    if (_frame) _frame[4] = (Value*)thread_local(source_pos);   \
    if (_frame) _frame[8] = (Value*)thread_local(source_line);}

Definition at line 289 of file value_locals.h.

#define push_control (   _c )
Value:
Control* _save_cc = thread_local(current_controller);       \
    thread_local(current_controller) = _c;

Definition at line 294 of file value_locals.h.

#define pop_control ( )    thread_local(current_controller) = _save_cc;

Definition at line 298 of file value_locals.h.

#define save_error_source_data ( )
Value:
{                               \
    thread_local(err_source_file) = thread_local(source_file);  \
    thread_local(err_source_pos) = thread_local(source_pos);    \
    thread_local(err_source_line)= thread_local(source_line);   \
    thread_local(err_source_flags) = thread_local(source_flags);\
    thread_local(err_occurred) = TRUE;}

Definition at line 306 of file value_locals.h.

#define clear_error_source_data ( )
Value:
{                               \
    thread_local(err_source_file) = NULL;                       \
    thread_local(err_source_pos) = 0;                           \
    thread_local(err_source_flags) = 0;                         \
    thread_local(err_source_line) = 0;                          \
    thread_local(err_occurred) = FALSE;}

Definition at line 317 of file value_locals.h.