void FTread(char *ifname, unsigned ofntsize, int monochrome, sSelection *selects, unsigned num_selects, sList *glyphs, sList *ranges, unsigned *_bmpsurface) { FT_Library library; FT_Error error; FT_Face face; FT_ULong charcode; FT_UInt glyphindex; FT_Bitmap bmp; FT_Render_Mode rendermode = monochrome ? FT_RENDER_MODE_MONO : FT_RENDER_MODE_NORMAL; unsigned bmpsurface = 0; assert(ifname); assert(glyphs); // init library error = FT_Init_FreeType(&library); if(error) mexit(1, "ERR: FT_Init_FreeType(&library) failed !"); // load font error = FT_New_Face(library, ifname, 0, &face); if(error == FT_Err_Unknown_File_Format) mexit(1, "ERR: Unsupported file !"); else if (error) { mexit(1, "ERR: FT_New_Face(library, \"%s\", ...) failed !", ifname); } if(verbose) { printf("%d num_glyphs\n", (int)face->num_glyphs); printf("%d num_fixed_sizes\n", face->num_fixed_sizes); if(face->num_fixed_sizes) { unsigned i; for(i=0; i<face->num_fixed_sizes; i++) printf(" %.2f;%u,%u\n", (float)face->available_sizes[i].size / 64.0, (unsigned int)face->available_sizes[i].x_ppem>>6, (unsigned int)face->available_sizes[i].y_ppem>>6); } }
int main(int argc, char *argv[]) { minit(argc,argv); pingpong(0); mloop(); pingpong(2); mexit(); return(0); }
static void JNICALL object_free(jvmtiEnv* jvmti, jlong tag) { menter(jvmti, vm_death_lock); { if ( !vm_death_active ) { get_agent(jvmti)->object_free(jvmti, tag); } } mexit(jvmti, vm_death_lock); }
static void JNICALL thread_end(jvmtiEnv *jvmti, JNIEnv *env, jthread thread) { menter(jvmti, vm_death_lock); { if ( !vm_death_active ) { get_agent(jvmti)->thread_end(jvmti, env, thread); } } mexit(jvmti, vm_death_lock); }
static void JNICALL monitor_waited(jvmtiEnv* jvmti, JNIEnv *env, jthread thread, jobject object, jboolean timed_out) { menter(jvmti, vm_death_lock); { if ( !vm_death_active ) { get_agent(jvmti)->monitor_waited(jvmti, env, thread, object, timed_out); } } mexit(jvmti, vm_death_lock); }
static void JNICALL monitor_contended_entered(jvmtiEnv* jvmti, JNIEnv *env, jthread thread, jobject object) { menter(jvmti, vm_death_lock); { if ( !vm_death_active ) { get_agent(jvmti)->monitor_contended_entered(jvmti, env, thread, object); } } mexit(jvmti, vm_death_lock); }
tuck void reallocaccounting(Engine *E, Maddr addr, void *oldaddr, char *ID) { int i; if (addr == 0) { mprint(E, NULL, siminfo, "realloc failed for \"%s\"\n", ID); mmblocksdisplay(E); mexit(E, "", -1); } for (i = 0; i < E->nmemblocks; i++) { int nentries = E->memblocks[i].allocs - E->memblocks[i].frees; if (!strncmp(E->memblocks[i].ID, ID, MMALLOC_MAXIDSTRLEN)) { E->memblocks[i].addrs[nentries] = addr; E->memblocks[i].reallocs++; return; } } if (!E->memblocks[i].valid) { mprint(E, NULL, siminfo, "Attempt to realloc an unalloc'd chunk, ID = [%s]\n", ID); mmblocksdisplay(E); mexit(E, "", -1); } return; }
static void JNICALL vm_death(jvmtiEnv *jvmti, JNIEnv *env) { jvmtiError err; Agent *agent; /* Block all callbacks */ menter(jvmti, vm_death_lock); { /* Set flag for other callbacks */ vm_death_active = JNI_TRUE; /* Inform Agent instance of VM_DEATH */ agent = get_agent(jvmti); agent->vm_death(jvmti, env); /* Reclaim space of Agent */ err = jvmti->SetEnvironmentLocalStorage((const void*)NULL); check_jvmti_error(jvmti, err, "set env local storage"); delete agent; } mexit(jvmti, vm_death_lock); }
State * superHnewstate(Engine *E, double xloc, double yloc, double zloc, char *trajfilename) { int i; State *S; char *logfilename; S = (State *)mcalloc(E, 1, sizeof(State), "(State *)S"); if (S == NULL) { mexit(E, "Failed to allocate memory for State *S.", -1); } S->superH = (SuperHState *)mcalloc(E, 1, sizeof(SuperHState), "S->superH"); if (S->superH == NULL) { mexit(E, "Failed to allocate memory for S->superH.", -1); } S->MEM = (uchar *)mcalloc(E, 1, DEFLT_MEMSIZE, "(uchar *)S->MEM"); if (S->MEM == NULL) { mexit(E, "Failed to allocate memory for S->MEM.", -1); } S->superH->B = (SuperHBuses *)mcalloc(E, 1, sizeof(SuperHBuses), "(SuperHBuses *)S->superH->B"); if (S->superH->B == NULL) { mexit(E, "Failed to allocate memory for S->superH->B.", -1); } S->N = (Numa *)mcalloc(E, 1, sizeof(Numa), "(Numa *)S->N"); if (S->N == NULL) { mexit(E, "Failed to allocate memory for S->N.", -1); } S->N->count = 0; /* Actual entries are allocated when a region is installed */ S->N->regions = (Numaregion **)mcalloc(E, MAX_NUMA_REGIONS, sizeof(Numaregion*), "(Numaregion **)S->N->regions"); if (S->N->regions == NULL) { mexit(E, "Failed to allocate memory for S->N->regions.", -1); } S->Nstack = (Numa *)mcalloc(E, 1, sizeof(Numa), "(Numa *)S->Nstack"); if (S->Nstack == NULL) { mexit(E, "Failed to allocate memory for S->Nstack.", -1); } S->Nstack->count = 0; /* Actual entries are allocated when a region is installed */ S->Nstack->regions = (Numaregion **)mcalloc(E, MAX_NUMA_REGIONS, sizeof(Numaregion*), "(Numaregion **)S->Nstack->regions"); if (S->Nstack->regions == NULL) { mexit(E, "Failed to allocate memory for S->Nstack->regions.", -1); } S->RT = (Regtraces *)mcalloc(E, 1, sizeof(Regtraces), "(Regtraces *)S->RT"); if (S->RT == NULL) { mexit(E, "Failed to allocate memory for S->RT.", -1); } S->RT->count = 0; /* Actual entries are allocated when a region is installed */ S->RT->regvts = (Regvt **)mcalloc(E, MAX_REG_TRACERS, sizeof(Regvt*), "(Regvt **)S->RT->regvts"); if (S->RT->regvts == NULL) { mexit(E, "Failed to allocate memory for S->RT->regvts.", -1); } if (SF_SIMLOG) { logfilename = (char *)mcalloc(E, 1, MAX_NAMELEN*sizeof(char), "logfilename in machine-hitachi-sh.c"); if (logfilename == NULL) { mexit(E, "Failed to allocate memory for logfilename.", -1); } msnprint(logfilename, MAX_NAMELEN, "simlog.node%d", E->nnodes); S->logfd = mcreate(logfilename, M_OWRITE|M_OTRUNCATE); mfree(E, logfilename, "char * logfilename in machine-hitachi-sh.c"); if (S->logfd < 0) { mexit(E, "Could not open logfile for writing.", -1); } } E->cp = S; E->sp[E->nnodes] = S; mprint(E, NULL, siminfo, "New node created with node ID %d\n", E->nnodes); /* Update the min cycle time */ E->mincycpsec = PICOSEC_MAX; E->maxcycpsec = 0; for (i = 0; i < E->nnodes; i++) { E->mincycpsec = min(E->mincycpsec, E->sp[i]->CYCLETIME); E->maxcycpsec = max(E->maxcycpsec, E->sp[i]->CYCLETIME); } S->dumpregs = superHdumpregs; S->dumpsysregs = superHdumpsysregs; S->fatalaction = superHfatalaction; S->stallaction = superHstallaction; S->settimerintrdelay = superHsettimerintrdelay; S->take_nic_intr = superHtake_nic_intr; S->take_timer_intr = superHtake_timer_intr; S->take_batt_intr = superHtake_batt_intr; S->check_batt_intr = superHcheck_batt_intr; S->check_nic_intr = superHcheck_nic_intr; S->cache_init = superHcache_init; S->resetcpu = superHresetcpu; S->step = superHstep; S->cyclestep = superHstep; S->faststep = superHfaststep; S->dumppipe = superHdumppipe; S->pipeflush = superHpipeflush; /* Most of the device registers are SH7708 specific */ S->devreadbyte = dev7708readbyte; S->devreadword = dev7708readword; S->devreadlong = dev7708readlong; S->devwritebyte = dev7708writebyte; S->devwriteword = dev7708writeword; S->devwritelong = dev7708writelong; S->split = superHsplit; S->vmtranslate = superHvmtranslate; S->dumptlb = superHdumptlb; S->cache_deactivate = superHcache_deactivate; S->cache_printstats = superHcache_printstats; S->writebyte = superHwritebyte; S->xloc = xloc; S->yloc = yloc; S->zloc = zloc; if (trajfilename != NULL) { S->trajfilename = (char *)mcalloc(E, 1, strlen(trajfilename)+1, "S->trajfilename in "SF_FILE_MACRO); if (S->trajfilename == nil) { mexit(E, "mcalloc failed for S->trajfilename in "SF_FILE_MACRO, -1); } strcpy(S->trajfilename, trajfilename); } S->NODE_ID = E->baseid + E->nnodes; /* Must know correct number of nodes in resetcpu() */ E->nnodes++; S->resetcpu(E, S); S->superH->nicintrQ = (InterruptQ *)mcalloc(E, 1, sizeof(InterruptQ), "InterruptQ *nicintrQ in superHnewstate()"); if (S->superH->nicintrQ == NULL) { mexit(E, "Failed to allocate memory for InterruptQ *nicintrQ in superHnewstate().", -1); } S->superH->nicintrQ->hd = (Interrupt *)mcalloc(E, 1, sizeof(Interrupt), "Interrupt *S->superH->nicintrQ->hd in superHnewstate()"); S->superH->nicintrQ->tl = (Interrupt *)mcalloc(E, 1, sizeof(Interrupt), "Interrupt *S->superH->nicintrQ->tl in superHnewstate()"); if (S->superH->nicintrQ->hd == NULL || S->superH->nicintrQ->tl == NULL) { mexit(E, "Failed to allocate memory for S->superH->nicintrQ->hd | S->superH->nicintrQ->tl.", -1); } S->superH->excpQ = (InterruptQ *)mcalloc(E, 1, sizeof(InterruptQ), "InterruptQ *excpQ in superHnewstate()"); if (S->superH->excpQ == NULL) { mexit(E, "Failed to allocate memory for InterruptQ *excpQ in superHnewstate().", -1); } S->superH->excpQ->hd = (Interrupt *)mcalloc(E, 1, sizeof(Interrupt), "Interrupt *S->superH->excpQ->hd in superHnewstate()"); S->superH->excpQ->tl = (Interrupt *)mcalloc(E, 1, sizeof(Interrupt), "Interrupt *S->superH->excpQ->tl in superHnewstate()"); if (S->superH->excpQ->hd == NULL || S->superH->excpQ->tl == NULL) { mexit(E, "Failed to allocate memory for S->superH->excpQ->hd | S->superH->excpQ->tl.", -1); } return S; }
int main(int argc, char *argv[]) { char * ifname = NULL; // input filename char * ofname = NULL; // output filename unsigned ofntsize = 10; // output font size char * ofmtstr = "A5I3"; // format string unsigned ofmtdesc = DFT_TEX_FMT_A5I3; int monochrome = 0; // monochrome rendering of the font sSelection selects[MAX_SELECTS]; unsigned num_selects = 0; sList ranges, glyphs; RESET(&ranges, sList); RESET(&glyphs, sList); unsigned bmpsurface; // total surface of the caracters float bmpavesize; // average size of the texture (width and height) unsigned bmpfixedwidth; // chosen width based on the average size // parse arguments static struct option long_options[] = { // argument following (if any) {"verbose", no_argument, 0, 'v'}, // {"input-file", required_argument, 0, 'i'}, // filename {"output-file", required_argument, 0, 'o'}, // filename {"dump-file-prefix", required_argument, 0, 'd'}, // filename prefix {"texture-format", required_argument, 0, 'f'}, // texture format {"monochrome", no_argument, 0, 'm'}, // monochrome rendering {"palette-first-trans", no_argument, 0, 't'}, // {"font-size", required_argument, 0, 's'}, // integer (in pixels) {"select", required_argument, 0, 'l'}, // couple of hex integers 0x#:0x# (one of the two maybe omitted) {0, 0, 0, 0} }; // TODO : color selection of BG and FG of each face (remove palette-first-trans and replace it with FG=trans) // TODO : usage char options_desc[] = "vi:o:d:f:mts:l:"; int option_index; int c; while(1) { option_index = 0; c = getopt_long(argc, argv, options_desc, long_options, &option_index); if(c == -1) break; switch (c) { case 0: /* If this option set a flag, do nothing else now. */ if (long_options[option_index].flag != 0) break; printf ("option %s", long_options[option_index].name); if (optarg) printf (" with arg %s", optarg); printf ("\n"); break; case 'v': verbose++; break; case 'i': // input file ifname = optarg; break; case 'o': // output file ofname = optarg; break; case 'd': // dump file dofname = optarg; break; case 'f': // texture format ofmtstr = optarg; ofmtdesc &= ~DFT_TEX_FMTMASK; unsigned fmt = dft_get_tex_fmt(ofmtstr); if(!fmt) mexit(1, "ERR: Invalid texture format \"%s\"", ofmtstr); ofmtdesc |= fmt; break; case 'm': monochrome = 1; break; case 't': ofmtdesc |= DFT_TEX_PAL1TRANS; break; case 's': // font size ofntsize = atoi(optarg); break; case 'l': // selection if(num_selects >= MAX_SELECTS) mexit(1, "ERR: Too many selections (the max is %d)", MAX_SELECTS); if(sel_add(selects, &num_selects, optarg)) mexit(1, "ERR: Invalid selection argument \"%s\"", optarg); break; case '?': // parse error default: abort(); } } // check mandatory arguments and their validity // check input filename if(!ifname) mexit(1, "ERR: No input filename"); // check ouput filename if(!ofname) mexit(1, "ERR: No output filename"); // print input arguments and default values printf("Input FreeType font : %s\n", ifname); printf("Output dft font : %s\n", ofname); printf("Output texture format : %s (%04x)\n", ofmtstr, ofmtdesc); printf("Output rendering type : %s\n", monochrome ? "monochrome" : "grayscale"); printf("Output font size : %d\n", ofntsize); if(num_selects) { printf("Convert only this subset of the font :\n"); for(c=0; c<num_selects; c++) printf(selects[c].end?" 0x%08X:0x%08X\n":" 0x%08X:0x__END___\n",selects[c].start, selects[c].end); } else printf("Convert the entire font\n"); // read the font and fill glyphs, ranges and bmpsurface FTread(ifname, ofntsize, monochrome, selects, num_selects, &glyphs, &ranges, &bmpsurface); bmpavesize = sqrt((float)bmpsurface); bmpfixedwidth = (int)pow(2, ceil(log(bmpavesize)/log(2))); // the next 2^k if(verbose) { printf("%d range(s)\n", ranges.count); printf("%d glyphs(s)\n", glyphs.count); printf("%d surface (px²)\n", bmpsurface); printf("%.1fx%.1f average size (px)\n", bmpavesize, bmpavesize); printf("%d fixed width (px)\n", bmpfixedwidth); } // dump size data dump_glyphs_size(dofname, &glyphs); // we now have the data in ranges and glyphs, we can create the dft file unsigned w = bmpfixedwidth, h; // optimise the position of the caracters on the texture (with a fixed width) genplacement(&glyphs, w, &h); if(verbose) printf("texsize=%dx%d\n", w, h); if(verbose) printf("efficiency = %.1f%%\n", 100.0*(float)bmpsurface/(float)(w*h)); // dump position data dump_glyphs_positions(dofname, &glyphs); // write to dft file sDFT_RANGES *dftranges; sDFT_MAP *dftmap; sDFT_TEXTURE *dfttexture; sDFT_PALETTE *dftpalette; dft_new_ranges(&ranges, &dftranges); dft_new_map(&glyphs, &dftmap); dft_new_texture(&glyphs, w, h, ofmtdesc, &dfttexture, &dftpalette); dft_write(ofname, dftranges, dftmap, dfttexture, dftpalette); dft_cleanup(dftranges, dftmap, dfttexture, dftpalette); // free data void delglyph(sDFT_GLYPH *glyph) { if(glyph->bitmap) free(glyph->bitmap); free(glyph); } L_dropall(&glyphs, (datahandler)delglyph); L_dropall(&ranges, free); if(verbose) malloc_stats(); return 0; }
tuck void allocaccounting(Engine *E, Maddr addr, char *ID) { int i; if (addr == 0) { mprint(E, NULL, siminfo, "malloc/calloc failed for \"%s\"\n", ID); mmblocksdisplay(E); mexit(E, "", -1); } if (E->nmemblocks == MMALLOC_MAXALLOCBLOCKS) { mprint(E, NULL, siminfo, "Ran out of memblocks. Exiting...\n"); mmblocksdisplay(E); mexit(E, "", -1); } for (i = 0; i < E->nmemblocks; i++) { if (!strncmp(E->memblocks[i].ID, ID, MMALLOC_MAXIDSTRLEN)) { int nentries = E->memblocks[i].allocs - E->memblocks[i].frees; if (nentries >= MMALLOC_MAXALLOCS) { mprint(E, NULL, siminfo, "Ran out of memblock[].addrs[]. Exiting...\n"); mmblocksdisplay(E); mexit(E, "", -1); } E->memblocks[i].addrs[nentries] = addr; E->memblocks[i].allocs++; return; } } strncpy(E->memblocks[i].ID, ID, MMALLOC_MAXIDSTRLEN); if (!E->memblocks[i].mallocd) { E->memblocks[i].addrs = (uvlong *)calloc(MMALLOC_MAXALLOCS, sizeof(Maddr)); if (E->memblocks[i].addrs == NULL) { mprint(E, NULL, siminfo, "Could not allocate memory for (Maddr *)memblocks[i].addrs\n"); mexit(E, "", -1); } E->memblocks[i].mallocd = 1; } E->memblocks[i].addrs[0] = addr; E->memblocks[i].allocs = 1; E->memblocks[i].frees = 0; E->memblocks[i].reallocs = 0; E->memblocks[i].valid = 1; E->nmemblocks++; return; }
void munchinput(Engine *E, char *buf) { int eaten = 0; if (strlen(buf) > 0) { while (eaten < strlen(buf)) { char *tptr; Datum *t1; t1 = (Datum *) mmalloc(E, sizeof(Datum), "Datum *t1 in munchinput(), main.c"); if (t1 == NULL) { mprint(E, NULL, siminfo, "Could not allocate memory for Datum *t1"); mexit(E, "See above messages.", -1); } t1->next = NULL; t1->prev = NULL; t1->value = 0; t1->data = (char*) mmalloc(E, (strlen(buf)+1)*sizeof(char), "char *t1->data in munchinput(), main.c"); if (t1->data == NULL) { mfree(E, t1, "char *t1 in main.c"); mprint(E, NULL, siminfo, "Could not allocate memory for char *t1->data"); mexit(E, "See above messages.", -1); } tptr = t1->data; /* Throw away all chars till we see a non-sepchar */ while (isasmsep(buf[eaten]) && (eaten < strlen(buf))) { eaten++; } /* */ /* I refer to tokens such as '(' etc. as "sticky": */ /* they may be "stuck" onto another token, and are */ /* NOT separators : we have to allocate a list entry */ /* for them. So, get one sticky char: */ /* */ if (issticky(buf[eaten])) { *tptr++ = buf[eaten++]; } else while(!isasmsep(buf[eaten]) && !issticky(buf[eaten]) && (eaten < strlen(buf)) ) { /* */ /* Get all non sepchars into t1->data */ /* If we see a quoted string, "*" (_not_ */ /* '*'), gobble it including any sepchars, */ /* till end of input (we get line @a time) */ /* or matching quote. */ /* */ if (buf[eaten] == '"') { /* Discard opening quote: */ eaten++; /* Must make not to go past newline: */ while ((buf[eaten] != '"') && (buf[eaten] != '\n') && (eaten < strlen(buf))) { *tptr++ = buf[eaten++]; } /* Discard trailing quote if its there: */ if (eaten < strlen(buf) && (buf[eaten] == '"')) { eaten++; } } else { *tptr++ = buf[eaten++]; } } *tptr = '\0'; /* If we actually ate any food, put it in our stomach */ if (tptr != t1->data) { if ((E->istream.head == NULL) || (E->istream.tail == NULL)) { E->istream.tail = E->istream.head = E->istream.masthead = t1; /* */ /* NOTE tail and head now point to the lone datum */ /* and they _both_ have null pre- and next-. */ /* */ E->istream.masthead->prev = NULL; E->istream.masthead->next = NULL; E->istream.head->prev = NULL; E->istream.head->next = NULL; E->istream.tail->prev = NULL; E->istream.tail->next = NULL; } else { /* */ /* Add new datum to _tail_ of list. MUST keep it FIFO */ /* for the asm to be parsed correctly. */ /* */ t1->next = E->istream.tail; E->istream.tail->prev = t1; E->istream.tail = t1; } } else { mfree(E, t1->data, "t1->data in munchinput"); mfree(E, t1, "t1 in munchinput"); } /* careful : DO NOT free t1 ! */ } } return; }
void scan_labels_and_globalvars(Engine *E) { ulong tmp_pc; Datum *tmpistream = E->istream.tail; while (tmpistream != NULL) { /* If it is new a label, add it to labellist */ if (tmpistream->data[strlen(tmpistream->data)-1] == ':') { Datum* tmplabel = (Datum *) mmalloc(E, sizeof(Datum), "Datum *tmplabel in parser-driver.c, ~line 174"); if (tmplabel == NULL) { mprint(E, NULL, siminfo, "Could not allocate memory for Datum *tmplabel, main.c"); mexit(E, "See above messages.", -1); } tmplabel->next = NULL; tmplabel->prev = NULL; tmplabel->data = (char*)mmalloc(E, strlen(tmpistream->data)*sizeof(char), "char *tmplabel->data in scan_labels...(), main.c"); if (tmplabel->data == NULL) { mfree(E, tmplabel, "tmplabel in scan_labels_and_globalvars"); mprint(E, NULL, siminfo, "Could not allocate memory for char *tmplabel->data, main.c"); mexit(E, "See above messages.", -1); } tmplabel->value = E->cp->PC; strncpy(tmplabel->data, tmpistream->data, strlen(tmpistream->data) - 1); tmplabel->data[strlen(tmpistream->data)-1] = '\0'; if ((E->labellist.head == NULL) || (E->labellist.tail == NULL)) { //mprint(E, NULL, siminfo, "New label list\n"); E->labellist.tail = E->labellist.head = tmplabel; E->labellist.head->prev = NULL; E->labellist.head->next = NULL; E->labellist.tail->prev = NULL; E->labellist.tail->next = NULL; } else { //mprint(E, NULL, siminfo, "Adding new item to label list"); /* */ /* Add new datum to _tail_ of list. */ /* */ tmplabel->next = E->labellist.tail; E->labellist.tail->prev = tmplabel; E->labellist.tail = tmplabel; } } /* If it is a global definition (".comm"), add it to labellist */ if (!strcmp(tmpistream->data, ".comm")) { Datum* tmplabel = (Datum *) mmalloc(E, sizeof(Datum), "Datum *tmplabel in scan_labels...(), main.c"); if (tmplabel == NULL) { mprint(E, NULL, siminfo, "Could not allocate memory for Datum *tmplabel, main.c"); mexit(E, "See above messages.", -1); } /* Token we just passed is global var name */ tmpistream = tmpistream->prev; if (tmpistream == NULL) { mprint(E, NULL, siminfo, "Badly formed input stream: \".comm\" without a var name"); mexit(E, "See above messages.", -1); } //mprint(E, NULL, siminfo, "Found a global var definition, var name = [%s]\n", // tmpistream->data); tmplabel->next = NULL; tmplabel->prev = NULL; tmplabel->data = (char*)mmalloc(E, strlen(tmpistream->data)*sizeof(char), "char *tmplabel->data in parser-driver.c, ~line 250"); tmplabel->value = E->cp->PC; if (tmplabel->data == NULL) { mfree(E, tmplabel, "tmplabel in scan_labels_and_globalvars"); mprint(E, NULL, siminfo, "Could not allocate memory for char* tmplabel->data, main.c"); mexit(E, "See above messages.", -1); } strncpy(tmplabel->data, tmpistream->data, strlen(tmpistream->data)); /* We went one step back. Step forward again */ tmpistream = tmpistream->next; if ((E->labellist.head == NULL) || (E->labellist.tail == NULL)) { //mprint(E, NULL, siminfo, "New label list\n"); E->labellist.tail = E->labellist.head = tmplabel; E->labellist.head->prev = NULL; E->labellist.head->next = NULL; E->labellist.tail->prev = NULL; E->labellist.tail->next = NULL; } else { //mprint(E, NULL, siminfo, "Adding new item to label list"); /* */ /* Add new datum to _tail_ of list. */ /* */ tmplabel->next = E->labellist.tail; E->labellist.tail->prev = tmplabel; E->labellist.tail = tmplabel; } } tmpistream = tmpistream->next; } //mprint(E, NULL, siminfo, "Done scan_labels_and_globalvars()...\n"); //mprint(E, NULL, siminfo, "Calling yyparse(), with SCANNING flag set\n\n\n"); E->scanning = 1; tmp_pc = E->cp->PC; yyparse(); E->cp->PC = tmp_pc; E->scanning = 0; //mprint(E, NULL, siminfo, "Done assigning true disp's to labels.\n\n"); /* We screwed up istream.head, so reset it : */ E->istream.head = E->istream.masthead; return; }