00001 #ifndef hoccontext_h 00002 #define hoccontext_h 00003 00004 extern "C" { 00005 00006 extern Object* hoc_thisobject; 00007 extern Objectdata* hoc_top_level_data; 00008 extern Symlist* hoc_top_level_symlist; 00009 extern Symlist* hoc_symlist; 00010 00011 #define HocTopContextSet \ 00012 HocContext hcref; \ 00013 HocContext* hc_ = 0; if (hoc_thisobject) {hc_ = hc_save_and_set_to_top_(&hcref);} 00014 00015 #define HocContextRestore \ 00016 if (hc_) { hc_restore_(hc_); } 00017 00018 typedef struct HocContext { 00019 Object* obj; 00020 Objectdata* obd; 00021 Symlist* sl; 00022 } HocContext; 00023 00024 HocContext* hc_save_and_set_to_top_(HocContext* hc) { 00025 hc->obj = hoc_thisobject; 00026 hc->obd = hoc_objectdata; 00027 hc->sl = hoc_symlist; 00028 hoc_thisobject = 0; 00029 hoc_objectdata = hoc_top_level_data; 00030 hoc_symlist = hoc_top_level_symlist; 00031 return hc; 00032 } 00033 void hc_restore_(HocContext* hc) { 00034 hoc_thisobject = hc->obj; 00035 hoc_objectdata = hc->obd; 00036 hoc_symlist = hc->sl; 00037 } 00038 00039 } 00040 #endif