gen_table * make_gen_tables (insn_table *isa, decode_table *rules) { gen_table *gen = ZALLOC (gen_table); gen->isa = isa; gen->rules = rules; if (options.gen.multi_sim) { gen_list **last = &gen->tables; model_entry *model; filter *processors; if (options.model_filter != NULL) processors = options.model_filter; else processors = isa->model->processors; for (model = isa->model->models; model != NULL; model = model->next) { if (filter_is_member (processors, model->name)) { *last = make_table (isa, rules, model); last = &(*last)->next; } } } else { gen->tables = make_table (isa, rules, NULL); } return gen; }
int map_enter(lua_State *L,struct map *m,struct object *obj) { struct tile *tl = tile_withpos(m,&obj->cur); if (tl == NULL) { luaL_error(L,"[map_enter]invalid pos[%d:%d]",obj->cur.x,obj->cur.y); return -1; } struct point bl,tr; if (calc_rect(m,&obj->cur,obj->range,&bl,&tr) < 0) { luaL_error(L,"[map_enter]invalid pos[%d:%d],range[%d]",obj->cur.x,obj->cur.y,obj->range); return -1; } int sindex = 1; int oindex = 1; int x,y; for(y = bl.y;y <= tr.y;y++) { for(x = bl.x;x <= tr.x;x++) { struct tile *tl = tile_withrc(m,y,x); if (tl == NULL) return -1; struct dlink *dl = tile_level(tl, COMMON_LEVEL); make_table(L,dl,obj,-1,&sindex,&oindex,0); if (obj->level != COMMON_LEVEL) { dl = tile_level(tl, obj->level); make_table(L,dl,obj,-1,&sindex,&oindex,0); } } } tile_push(tl, obj->level, &obj->node); return 0; }
machine *make_machine() { machine *ret = NEW(machine); ret->base_frame = make_frame(NULL, make_table(), make_table(), make_table(), NULL, PAUSE); incref(ret->base_frame); ret->current_frame = ret->base_frame; incref(ret->current_frame); ret->now = ret->base_frame; incref(ret->now); ret->accumulator = NULL; ret->paused = 0; ret->trace = make_stack_trace(arg("bottom-of-the-barrel"), NULL, NULL); incref(ret->trace); add_builtins(ret); add_builtin_numbers(ret); add_builtin_strings(ret); add_builtin_files(ret); return ret; }
int luaopen_tex (lua_State *L) { luaL_register(L, "tex", texlib); make_table(L,"attribute","getattribute","setattribute"); make_table(L,"dimen","getdimen","setdimen"); make_table(L,"count","getcount","setcount"); make_table(L,"toks","gettoks","settoks"); make_table(L,"box","getbox","setbox"); make_table(L,"lists","getlist","setlist"); make_table(L,"wd","getboxwd","setboxwd"); make_table(L,"ht","getboxht","setboxht"); make_table(L,"dp","getboxdp","setboxdp"); /* make the meta entries */ /* fetch it back */ luaL_newmetatable(L,"tex_meta"); lua_pushstring(L, "__index"); lua_pushcfunction(L, gettex); lua_settable(L, -3); lua_pushstring(L, "__newindex"); lua_pushcfunction(L, settex); lua_settable(L, -3); lua_setmetatable(L,-2); /* meta to itself */ /* initialize the I/O stack: */ spindles = xmalloc(sizeof(spindle)); spindle_index = 0; spindles[0].head = NULL; spindles[0].tail = NULL; spindle_size = 1; return 1; }
static void primop_make_table(long argc) { long capacity = (argc == 1)? the_long(1,*sp) : 0; if (capacity < 1) capacity = 1; else if (capacity > MAX_TABLE_SIZE) error(sp[0],"too big of a capacity for a table"); if (argc == 1) *sp = make_table(capacity); else *--sp = make_table(capacity); }
void CLhaArchive::read_pt_len(short nn, short nbit, short i_special) { short i, c, n; n = getbits(nbit); if (n == 0) { c = getbits(nbit); for (i = 0; i < nn; i++) gpHufData->pt_len[i] = 0; for (i = 0; i < 256; i++) gpHufData->pt_table[i] = c; } else { i = 0; while (i < n) { c = bitbuf >> (16 - 3); if (c == 7) { unsigned short mask = 1 << (16 - 4); while (mask & bitbuf) { mask >>= 1; c++; } } fillbuf((c < 7) ? 3 : c - 3); gpHufData->pt_len[i++] = (unsigned char)c; if (i == i_special) { c = getbits(2); while (--c >= 0) gpHufData->pt_len[i++] = 0; } } while (i < nn) gpHufData->pt_len[i++] = 0; make_table(nn, gpHufData->pt_len, 8, gpHufData->pt_table); }
int buzzvm_swarm_others(buzzvm_t vm) { buzzvm_lnum_assert(vm, 1); /* Get the id of the current swarm */ buzzvm_lload(vm, 0); buzzvm_pushs(vm, buzzvm_string_register(vm, "id")); buzzvm_tget(vm); uint16_t id1 = buzzvm_stack_at(vm, 1)->i.value; /* Get the swarm entry */ uint8_t* x = buzzdict_get(vm->swarms, &id1, uint8_t); if(!x) { vm->state = BUZZVM_STATE_ERROR; vm->error = BUZZVM_ERROR_SWARM; return BUZZVM_STATE_ERROR; } /* Get the id of the new swarm to create */ buzzvm_lload(vm, 1); buzzvm_type_assert(vm, 1, BUZZTYPE_INT); uint16_t id2 = buzzvm_stack_at(vm, 1)->i.value; /* Add a new entry for the swarm */ uint8_t v = *x ? 0 : 1; buzzdict_set(vm->swarms, &id2, &v); /* Send update, if necessary */ if(v) buzzoutmsg_queue_append_swarm_joinleave( vm->outmsgs, BUZZMSG_SWARM_JOIN, id2); /* Create a table to return */ make_table(vm, id2); /* Return */ return buzzvm_ret1(vm); }
static void read_pt_len(int nn, int nbit, int i_special) { int i, c, n; unsigned short mask; n = getbits(nbit); if (n == 0) { c = getbits(nbit); for (i = 0; i < nn; i++) pt_len[i] = 0; for (i = 0; i < 256; i++) pt_table[i] = c; } else { i = 0; while (i < n) { c = bitbuf >> (BITBUFSIZ - 3); if (c == 7) { mask = 1U << (BITBUFSIZ - 1 - 3); while (mask & bitbuf) { mask >>= 1; c++; } } fillbuf((c < 7) ? 3 : c - 3); pt_len[i++] = c; if (i == i_special) { c = getbits(2); while (--c >= 0) pt_len[i++] = 0; } } while (i < nn) pt_len[i++] = 0; make_table(nn, pt_len, 8, pt_table); }
int main(int argc, char *argv[]) { SWRESET(generation); SWRESET(normalisation); SWRESET(split); SWRESET(construction); SWRESET(final); SWRESET(sampling); SWRESET(total); if (argc > 1) { omp_set_num_threads(atoi(argv[1])); } int j; SWTICK(total); #pragma omp parallel { #pragma omp master printf("Running with %d threads\n", omp_get_num_threads()); srand48_r(omp_get_thread_num(), buffer); } for (j = 0; j < 100; j++) { float *weights = malloc(NUM_SIDES * sizeof(float)); float *dartboard = malloc(NUM_SIDES * sizeof(float)); int *aliases = malloc(NUM_SIDES * sizeof(int)); int i; SWTICK(generation); #pragma omp parallel for shared(weights) for (i = 0; i < NUM_SIDES; i++) { double w; drand48_r(buffer, &w); weights[i] = (float) w; } SWTOCK(generation); SWTICK(normalisation); normalise(weights, NUM_SIDES); SWTOCK(normalisation); make_table(weights, dartboard, aliases, NUM_SIDES); SWTICK(sampling); #pragma omp parallel for shared(dartboard, aliases) schedule(static) for (i = 0; i < NUM_ROLLS; i++) { roll(dartboard, aliases, NUM_SIDES, buffer); } SWTOCK(sampling); free(aliases); free(dartboard); free(weights); } SWTOCK(total); print_interval("Weight generation", SWGET(generation)); print_interval("Normalisation", SWGET(normalisation)); print_interval("Table split", SWGET(split)); print_interval("Table construction", SWGET(construction)); print_interval("Table final", SWGET(final)); print_interval("Sampling", SWGET(sampling)); print_interval("Total", SWGET(total)); return 0; }
/* Initialises texturing, lighting, display lists, and everything else associated with the model. */ void myinit(void) { GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0}; GLfloat mat_shininess[] = {50.0}; GLfloat light_position1[] = {1.0, 1.0, 1.0, 0.0}; GLfloat light_position2[] = {-1.0, 1.0, 1.0, 0.0}; glClearColor(0.0, 0.0, 0.0, 0.0); obj = gluNewQuadric(); make_table(); make_image(); /* Set up Texturing */ glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, 3, IMAGE_WIDTH, IMAGE_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, image); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); /* Set up Lighting */ glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); glLightfv(GL_LIGHT0, GL_POSITION, light_position1); glLightfv(GL_LIGHT1, GL_POSITION, light_position2); /* Initial render mode is with full shading and LIGHT 0 enabled. */ glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glDisable(GL_ALPHA_TEST); glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable(GL_COLOR_MATERIAL); glShadeModel(GL_SMOOTH); /* Initialise display lists */ glNewList(list_piston_shaded, GL_COMPILE); draw_piston(); glEndList(); glNewList(list_flywheel_shaded, GL_COMPILE); draw_flywheel(); glEndList(); gluQuadricTexture(obj, GL_TRUE); glNewList(list_piston_texture, GL_COMPILE); draw_piston(); glEndList(); glNewList(list_flywheel_texture, GL_COMPILE); draw_flywheel(); glEndList(); gluQuadricTexture(obj, GL_FALSE); }
int luaopen_lua(lua_State * L, char *fname) { luaL_register(L, "lua", lualib); make_table(L, "bytecode", "getbytecode", "setbytecode"); make_table(L, "name", "getluaname", "setluaname"); lua_newtable(L); lua_setfield(L, LUA_REGISTRYINDEX, "bytecode_shadow"); lua_pushstring(L, LUA_VERSION); lua_setfield(L, -2, "version"); if (fname == NULL) { lua_pushnil(L); } else { lua_pushstring(L, fname); } lua_setfield(L, -2, "startupfile"); return 1; }
int _aoi_viewlist(lua_State *L) { struct aoi_context *aoi = lua_touserdata(L, 1); struct object *obj = lua_touserdata(L, 2); struct tile *tl = tile_withpos(&aoi->map,&obj->cur); if (tl == NULL) { luaL_error(L,"[_aoi_viewlist]invalid pos[%d:%d]",obj->cur.x,obj->cur.y); return 0; } struct point bl,tr; if (calc_rect(&aoi->map,&obj->cur,obj->range,&bl,&tr) < 0) { luaL_error(L,"[_aoi_viewlist]invalid pos[%d:%d],range[%d]",obj->cur.x,obj->cur.y,obj->range); return 0; } lua_newtable(L); int sindex = 1; int oindex = 1; int x,y; for(y = bl.y;y <= tr.y;y++) { for(x = bl.x;x <= tr.x;x++) { struct tile *tl = tile_withrc(&aoi->map,y,x); if (tl == NULL) { luaL_error(L,"[_aoi_viewlist]invalid rc[%d:%d],range[%d]",y,x); return 0; } struct dlink *dl = tile_level(tl, COMMON_LEVEL); make_table(L,dl,obj,-1,&sindex,&oindex,1); if (obj->level != COMMON_LEVEL) { dl = tile_level(tl, obj->level); make_table(L,dl,obj,-1,&sindex,&oindex,1); } } } return 1; }
int main () { int sfd; printf("\n\nThe Client List is:"); display_clist(); make_table(); sfd = startServer(); serverLoop(sfd); return 0; }
void start() { make_table(); usb_init(); while(1) { alive(); usb_wait_ep1(); } }
int main ( int argc, char *argv[] ) { char sip[16]; int cfd; make_table(); strcpy(sip, (argc == 2) ? argv[1] : DEFAULT_SERVER); cfd = serverConnect(sip); Talk_to_server (cfd); close(cfd); return 0; }
//------------------------------------------------------------------------------ void webcam_t::make_scene() { if(!info -> current_webcam) return; webcam_t *WC = (webcam_t*) info -> current_webcam; if(WC->reshaped) { WC->reshaped = false; glutReshapeWindow(WC->W,WC->H); } vector_t C = *WC->pos - *WC->G; GLfloat x = C.x + WC->offset[0]*WC->N->x + WC->offset[1]*WC->T->x; GLfloat y = C.y + WC->offset[0]*WC->N->y + WC->offset[1]*WC->T->y; GLfloat z = -*WC->z - WC->offset[2]; GLfloat dx = WC->direction[0]*WC->N->x + WC->direction[1]*WC->T->x; GLfloat dy = WC->direction[0]*WC->N->y + WC->direction[1]*WC->T->y; GLfloat dz = -WC->direction[2]; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Efface le frame buffer et le Z-buffer glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // glEnable(GL_POLYGON_SMOOTH); glMatrixMode(GL_MODELVIEW); //Choisit la matrice MODELVIEW glLoadIdentity(); //Réinitialise la matrice gluLookAt(x,y,z, x+dx,y+dy,z+dz, 0.,0.,-1.); make_table(); for(unsigned int i=0;i<info->objets_mobiles.size();i++) if(info->objets_mobiles[i]->type != OBJ_ROBOT) info->objets_mobiles[i]->draw3D(); for(unsigned int i=0;i<info->objets_mobiles.size();i++) if(info->objets_mobiles[i]->type == OBJ_ROBOT) info->objets_mobiles[i]->draw3D(); for(unsigned int i=0;i<info->objets_fixes.size();i++) if(!info->objets_fixes[i]->inverse) info->objets_fixes[i]->draw3D(); glReadBuffer(GL_BACK); glReadPixels(0,0,WC->W,WC->H,GL_RGB, GL_UNSIGNED_BYTE, WC->pixels); WC->done = true; }
static void primop_table(long argc) { if (argc & 1) error(sp[0], "table requires an even number of arguments"); else { object *pBindings, tbl = make_table(argc/2); long i; pBindings = VECTOR_ELEMENTS(TABLE_BINDINGS(tbl)); for (i=0; i<argc; i++) *pBindings++ = *sp++; *--sp = tbl; } }
//------------------------------------------------------------------------------ // Returns OID associated with a table //------------------------------------------------------------------------------ erydbSystemCatalog::OID tableOid(const SimpleColumn* sc, boost::shared_ptr<erydbSystemCatalog> cat) { if (sc->schemaName().empty()) return execplan::CNX_VTABLE_ID; if (sc->isEryDB() == false) return 0; erydbSystemCatalog::ROPair p = cat->tableRID(make_table(sc->schemaName(), sc->tableName())); return p.objnum; }
class_binder(lua_State* L, const char* name) : L(L) , metatable(make_table(L)) , methods(make_table(L)) , types(make_table(L)) , convops(make_table(L)) , statics(make_table(L)) , bases(make_table(L)) { stack st(L); st.push(metatable); st.set_table_field(-1, "__index", methods); st.set_table_field(-1, "__gc", finalize); st.set_table_field(-1, "convops", convops); st.set_table_field(-1, "bases", bases); st.set_table_field(-1, "name", name); st.set_table_field(stack::registry_index, class_id<T>(), metatable); st.set_table_field(stack::globals_index, name, statics); st.pop(1); }
int buzzvm_swarm_create(buzzvm_t vm) { buzzvm_lnum_assert(vm, 1); /* Get the id */ buzzvm_lload(vm, 1); buzzvm_type_assert(vm, 1, BUZZTYPE_INT); uint16_t id = buzzvm_stack_at(vm, 1)->i.value; /* Add a new entry if necessary */ if(!buzzdict_exists(vm->swarms, &id)) { uint8_t v = 0; buzzdict_set(vm->swarms, &id, &v); } /* Create a table to return */ make_table(vm, id); /* Return */ return buzzvm_ret1(vm); }
int buzzneighbors_reset(buzzvm_t vm) { if(vm->state != BUZZVM_STATE_READY) return vm->state; /* Make new table */ buzzobj_t t; vm->state = make_table(vm, &t); if(vm->state != BUZZVM_STATE_READY) return vm->state; /* Add extra methods */ function_register(t, "broadcast", buzzneighbors_broadcast); function_register(t, "listen", buzzneighbors_listen); function_register(t, "ignore", buzzneighbors_ignore); /* Register table as global symbol */ buzzvm_pushs(vm, buzzvm_string_register(vm, "neighbors", 1)); buzzvm_push(vm, t); buzzvm_gstore(vm); return vm->state; }
int buzzneighbors_kin(buzzvm_t vm) { buzzvm_lnum_assert(vm, 0); /* Initialize the swarm id to 'unknown' */ int32_t swarmid = -1; /* If the swarm stack is not empty, look for the swarm id */ if(!buzzdarray_isempty(vm->swarmstack)) { /* Get position in swarm stack */ uint16_t sstackpos = 1; if(buzzdarray_size(vm->lsyms->syms) > 1) sstackpos = buzzdarray_get(vm->lsyms->syms, 1, buzzobj_t)->i.value; /* Get swarm id */ if(sstackpos <= buzzdarray_size(vm->swarmstack)) swarmid = buzzdarray_get(vm->swarmstack, buzzdarray_size(vm->swarmstack) - sstackpos, uint16_t); } /* Get the self table */ buzzvm_lload(vm, 0); buzzvm_type_assert(vm, 1, BUZZTYPE_TABLE); /* Get the data table */ buzzvm_pushs(vm, buzzvm_string_register(vm, "data", 1)); buzzvm_tget(vm); buzzobj_t data = buzzvm_stack_at(vm, 1); /* Create a new table as return value */ buzzobj_t t; vm->state = make_table(vm, &t); if(vm->state != BUZZVM_STATE_READY) return vm->state; /* If data is available, filter it */ if(data->o.type == BUZZTYPE_TABLE) { /* Create a new data table */ buzzobj_t kindata = buzzheap_newobj(vm->heap, BUZZTYPE_TABLE); /* Filter the neighbors in data and add them to kindata */ struct neighbor_filter_s fdata = { .vm = vm, .swarm_id = swarmid, .result = kindata->t.value }; buzzdict_foreach(data->t.value, neighbor_filter_kin, &fdata); /* Add kindata as the "data" field in t */ buzzvm_push(vm, t); buzzvm_pushs(vm, buzzvm_string_register(vm, "data", 1)); buzzvm_push(vm, kindata); buzzvm_tput(vm); } /* Return the table */ buzzvm_push(vm, t); return buzzvm_ret1(vm); }
int main (int argc, char *argv[]) { char *df=0; char *rf=0; int c; if (argc < 2) usage(argv); while ( (c=getopt(argc, argv, "vVr:d:o:l:")) != EOF) { switch (c) { case 'v' : verbose = true; break; case 'V' : printf("%s: V%s Db=%s\n", basename(argv[0]), progversion, dbv); exit(1); case 'd' : df = strdup(optarg); break; case 'r' : rf = strdup(optarg); break; case 'o' : ortszone = atoi(optarg); break; case 'l' : numlen = atoi(optarg); break; } } if (verbose) stdoutisatty = isatty(fileno(stdout)); read_rzfile(rf); make_table(); write_db(df); /* Uff this got longer as I thought, C is a real low level language - now it's clear, why I prefer Perl */ return(EXIT_SUCCESS); }
static void read_pt_len (lzh_globals_x *G, int nn, int nbit, int i_special) { int i, n; short c; ushort mask; n = getbits (G, nbit); if (n == 0) { c = getbits (G, nbit); for (i = 0; i < nn; i++) G->pt_len[i] = 0; for (i = 0; i < 256; i++) G->pt_table[i] = c; } else { i = 0; while (i < n) { c = G->bitbuf >> (BITBUFSIZ - 3); if (c == 7) { mask = 1U << (BITBUFSIZ - 1 - 3); while (mask & G->bitbuf) { mask >>= 1; c++; } } fillbuf (G, (c < 7) ? 3 : c - 3); G->pt_len[i++] = c; if (i == i_special) { c = getbits (G, 2); while (--c >= 0) G->pt_len[i++] = 0; } } while (i < nn) G->pt_len[i++] = 0; make_table (G, nn, G->pt_len, 8, G->pt_table); }
int main(void) { FILE *p_file_c, *p_file_h; p_file_c = fopen("pcm_tables_CA9.c", "wb"); p_file_h = fopen("pcm_tables_CA9.h", "wb"); make_table(p_file_c, p_file_h, "pcm_in_bourm1_rx", "signals/bourm1_rx.pcm"); make_table(p_file_c, p_file_h, "pcm_in_AirBatucada_44k", "signals/AirBatucada_44k.pcm"); make_table(p_file_c, p_file_h, "pcm_ref_bourm1_rx_biquad_eq_CA9", "reference/bourm1_rx_biquad_eq_CA9.pcm"); make_table(p_file_c, p_file_h, "pcm_ref_AirBatucada_44k_biquad_eq1_CA9", "reference/AirBatucada_44k_biquad_eq1_CA9.pcm"); make_table(p_file_c, p_file_h, "pcm_ref_AirBatucada_44k_biquad_eq2_CA9", "reference/AirBatucada_44k_biquad_eq2_CA9.pcm"); make_table(p_file_c, p_file_h, "pcm_ref_bourm1_rx_FIR_eq_CA9", "reference/bourm1_rx_FIR_eq_CA9.pcm"); make_table(p_file_c, p_file_h, "pcm_ref_AirBatucada_44k_FIR_eq1_CA9", "reference/AirBatucada_44k_FIR_eq1_CA9.pcm"); make_table(p_file_c, p_file_h, "pcm_ref_AirBatucada_44k_FIR_eq2_CA9", "reference/AirBatucada_44k_FIR_eq2_CA9.pcm"); fclose(p_file_c); fclose(p_file_h); return 0; }
static USHORT read_tree_p(void){ USHORT i,n; n = GETBITS(5); DROPBITS(5); if (n>0){ for (i=0; i<n; i++) { pt_len[i] = (UCHAR)GETBITS(4); DROPBITS(4); } for (i=n; i<np; i++) pt_len[i] = 0; if (make_table(np,pt_len,8,pt_table)) return 1; } else { n = GETBITS(5); DROPBITS(5); for (i=0; i<np; i++) pt_len[i] = 0; for (i=0; i<256; i++) pt_table[i] = n; } return 0; }
static USHORT read_tree_c(void){ USHORT i,n; n = GETBITS(9); DROPBITS(9); if (n>0){ for (i=0; i<n; i++) { c_len[i] = (UCHAR)GETBITS(5); DROPBITS(5); } for (i=n; i<510; i++) c_len[i] = 0; if (make_table(510,c_len,12,c_table)) return 1; } else { n = GETBITS(9); DROPBITS(9); for (i=0; i<510; i++) c_len[i] = 0; for (i=0; i<4096; i++) c_table[i] = n; } return 0; }
value make_constant(constant c) { struct obj *cst; switch (c->vclass) { case cst_string: cst = (value)alloc_string_length(c->u.string.str, c->u.string.len); cst->flags |= OBJ_READONLY | OBJ_IMMUTABLE; return cst; case cst_list: return make_list(c->u.constants); case cst_array: return make_array(c->u.constants); case cst_int: return makeint(c->u.integer); case cst_float: return (value)alloc_mudlle_float(c->u.mudlle_float); case cst_bigint: return make_bigint(c->u.bigint_str); case cst_table: return make_table(c->u.constants); case cst_symbol: return make_symbol(c->u.constpair); default: abort(); } }
value make_constant(constant c, bool save_location, fncode fn) { struct obj *cst; switch (c->vclass) { case cst_string: cst = (value)alloc_string(c->u.string); SET_READONLY(cst); SET_IMMUTABLE(cst); return cst; case cst_gsymbol: return make_gsymbol(c->u.string, fn); case cst_quote: return make_quote(c, save_location, fn); case cst_list: return make_list(c, c->u.constants, 1, save_location, fn); case cst_array: return make_array(c->u.constants, fn); case cst_int: return makeint(c->u.integer); case cst_float: return alloc_mudlle_float(c->u.mudlle_float); case cst_table: return make_table(c->u.constants, fn); case cst_symbol: return make_symbol(c->u.constpair, fn); default: abort(); } }
int main() { int i,j; if(make_table()) { for(i=0;i<PROG;i++) { printf("\n"); for(j=0;j<LANG;j++) printf(" %f ",cmp_tim[i][j]); } printf("\n"); for(i=0;i<PROG;i++) { printf("\n"); for(j=0;j<LANG;j++) printf(" %f ",cmp_mem[i][j]); } printf("\n"); for(i=0;i<PROG;i++) { printf("\n"); for(j=0;j<LANG;j++) printf(" %f ",run_tim[i][j]); } printf("\n"); for(i=0;i<PROG;i++) { printf("\n"); for(j=0;j<LANG;j++) printf(" %f ",run_mem[i][j]); } printf("\n"); } else printf("failed to open file...\n"); return 1; }