static thing_th *dup_cell(thing_th *thing) { switch(th_kind(thing)) { case number_k: return Number(sym(thing)); case string_k: return String(sym(thing)); case atom_k: return Atom(sym(thing)); case cons_k: return Cons(Car(thing), Cdr(thing)); case error_k: return Err(Cdr(thing)); case procedure_k: return Proc(Car(thing), Cdr(thing)); case macro_k: return Mac(Car(thing), Cdr(thing)); case gen_k: return Gen(Car(thing), Cdr(thing)); case routine_k: return Routine(call_rt(thing)); case method_k: return Method(call_rt(thing)); case grid_k: return duplicate_grid(thing); case null_k: return NULL; } }
VOID Image(IMG img, void * v) { cout << "IMG = " << IMG_Name(img) << endl; for( SEC sec=IMG_SecHead(img); SEC_Valid(sec) ; sec=SEC_Next(sec) ) { if ( SEC_IsExecutable(sec) ) { for( RTN rtn=SEC_RtnHead(sec); RTN_Valid(rtn) ; rtn=RTN_Next(rtn) ) Routine(rtn,v); } } }
/** * \fn void main(void) * \brief The main entry of the program will initialize runtime parameters and keep looping routine. */ void main(void) { if (!Initialize()) { /* hang if initialization failed */ for(;;); } TurnOnStartupIndicator(); /* queue startup packets for transmission */ UNUSED(HandleModConStartup()); for (;;) { CRG_ArmCOP(); Routine(); CRG_DisarmCOP(); } }
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: Routine(hModule); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: Cleanup(); break; } return TRUE; }
int establish_root_environment(void) { spawn_env(NULL, Primordial_Grid(GC_SKIPREG)); rootEnvironment=Car(env); rootBacros=Grid(); unknownSymbolError=Err(Cons(String("Unknown symbol"), NULL)); Set(rootEnvironment, "nil", NULL); Set(rootEnvironment, "true", Atom("true")); Set(rootEnvironment, "add", Routine(&dirty_sum)); Set(rootEnvironment, "+", Get(rootEnvironment, "add")); Set(rootEnvironment, "subtract", Routine(&dirty_sub)); Set(rootEnvironment, "-", Get(rootEnvironment, "subtract")); Set(rootEnvironment, "if", Method(&funky_if)); Set(rootEnvironment, "&ver", String("Funky Lisp Draft 3")); Set(rootEnvironment, "set!", Routine(&funky_set)); Set(rootEnvironment, "print_", Routine(&funky_print)); Set(rootEnvironment, "list", Routine(&funky_list)); Set(rootEnvironment, "pair", Routine(&funky_pair)); Set(rootEnvironment, "grid", Routine(&funky_grid)); Set(rootEnvironment, "get", Routine(&funky_grid_get)); Set(rootEnvironment, "quote", Method(&funky_quote)); Set(rootEnvironment, "apply", Routine(&apply)); Set(rootEnvironment, "mac", Method(&funky_macro)); Set(rootEnvironment, "def", Method(&funky_def)); Set(rootEnvironment, "head", Routine(&funky_head)); Set(rootEnvironment, "rest_", Routine(&funky_rest)); Set(rootEnvironment, "last", Routine(&funky_last)); Set(rootEnvironment, "err", Routine(&funky_err)); Set(rootEnvironment, "dump", Routine(&funky_dump)); Set(rootEnvironment, "&bacros", rootBacros); Set(rootEnvironment, ">", Routine(&funky_greater_than)); Set(rootEnvironment, "<", Routine(&funky_less_than)); Set(rootEnvironment, "=", Routine(&funky_equivalent)); Set(rootEnvironment, "not", Routine(&funky_not_operator)); Set(rootEnvironment, "eval", Method(&funky_evaluator)); Set(rootEnvironment, "true?", Routine(&funky_truthy)); Set(rootEnvironment, "false?", Routine(&funky_nilly)); Set(rootEnvironment, "lambda?", Routine(&funky_callable)); Set(rootEnvironment, "atom?", Routine(&funky_is_atom)); Set(rootEnvironment, "gen?", Routine(&funky_is_gen)); Set(rootEnvironment, "len", Routine(&funky_length)); Set(rootEnvironment, "gen", Routine(&funky_gen)); Set(rootEnvironment, "cons", Routine(&funky_cons)); Set(rootEnvironment, "append", Routine(&funky_append)); Set(rootEnvironment, "error?", Routine(&funky_is_error)); Set(rootEnvironment, "grid?", Routine(&funky_is_grid)); Set(rootEnvironment, "txt-concatenate_", Routine(&funky_make_txt)); Set(rootEnvironment, "type", Routine(&funky_type_symbol)); Set(rootEnvironment, UNKNOWN_HANDLER, Atom(UNKNOWN_LIT)); establish_bacros(rootBacros); return new_env(); }
void AutoRoutine::Run() { m_active = true; Routine(); }
VOID Routine_Instrument <T>::__instrument (RTN rtn, VOID * v) { reinterpret_cast <T *> (v)->handle_instrument (Routine (rtn)); }