int main() { table *tab; field **defs; if(db_open("db")) { g_error("db_open"); return 1; } tab = table_open("test"); if(!tab) { g_error("table_open"); return 1; } defs = table_get_field_defs(tab); while(!table_end(tab)) { } if(db_close()) { g_error("db_clos "); return 1; } return 0; }
/** * Child finished resolution * * @v mux Name resolution multiplexer * @v rc Return status code */ static void resmux_child_close ( struct resolv_mux *mux, int rc ) { /* Restart child interface */ intf_restart ( &mux->child, rc ); /* If this resolution succeeded, stop now */ if ( rc == 0 ) { DBGC ( mux, "RESOLV %p succeeded using method %s\n", mux, mux->resolver->name ); goto finished; } /* Attempt next child resolver, if possible */ mux->resolver++; if ( mux->resolver >= table_end ( RESOLVERS ) ) { DBGC ( mux, "RESOLV %p failed to resolve name\n", mux ); goto finished; } if ( ( rc = resmux_try ( mux ) ) != 0 ) goto finished; /* Next resolver is now running */ return; finished: intf_shutdown ( &mux->parent, rc ); }
static void table_object(void* T) { fprintf(stdout, "\t__table__ -> {\n" "\t object=>0x%p,\n" "\t size=>%d,\n" "\t empty=>'%s',\n" "\t begin=>0x%p,\n" "\t end=>0x%p,\n" "\t}\n", T, table_size(T), (table_empty(T) ? "yes" : "no"), table_begin(T), table_end(T) ); }
int lang_p(char* ptr,U32 cnt){ // printf("lang_p: [%.*s] %d\n", cnt,ptr,cnt); //-------------------------------------------------- // address of operator // if((cnt>1)&&('&'==*ptr)){ // return lang_ref(ptr+1,cnt-1); // } switch(cnt){ case 1: // if(0==strncmp(ptr,"+",1)) { return lang_operator(ptr,cnt); } // if(0==strncmp(ptr,"&",1)) { return lang_ref); } if(0==strncmp(ptr,";",1)) { return lang_return(); } if(0==strncmp(ptr,"q",1)) { return lang_q(); } if(0==strncmp(ptr,"t",1)) { return lang_t(); } if(0==strncmp(ptr,"(",1)) { return interpret_compuntil(")",1);} if(0==strncmp(ptr,"{",1)) { int ret = interpret_compuntil("}",1); //printf("{...} %d\n",ret); if(ret){ //don't let interpreter erase us! var->run_ptr = var->data_ptr; //printf("update: run_table is at %08p\n",var->run_table); var->run_table = table_end(var->data_ptr); return 1; } else { return 0; } } break; case 2: if(0==strncmp(ptr,"if",2)) { return lang_if(); } if(0==strncmp(ptr,"//",2)) { src_skip_line(); return 1;} if(0==strncmp(ptr,"do",2)) return lang_compile_with_rstack("system'core'do",3); break; case 3: if(0==strncmp(ptr,"ref",3)) { return lang_ref(); } break; case 4: if(0==strncmp(ptr,"href",4)) { return lang_href(); } if(0==strncmp(ptr,"else",4)) { return lang_else(); } if(0==strncmp(ptr,"into",4)) { return lang_oper("into",4); } if(0==strncmp(ptr,"loop",4)) return lang_compile_with_rstack("system'core'loop",-3); break; case 5: if(0==strncmp(ptr,"times",5)) { return lang_times(); } if(0==strncmp(ptr,"begin",5)) return lang_compile_with_rstack("system'core'begin",1); if(0==strncmp(ptr,"+loop",5)) return lang_compile_with_rstack("system'core'+loop",-3); //return lang_begin(); // if(0==strncmp(ptr,"begxx",5)) // return lang_compile_with_rstack("system'core'begin",1); break; } return 0; }