CmdCallbackI::CmdCallbackI( const Ice::ObjectAdapterPtr& adapter, const omero::cmd::HandlePrx handle, std::string category, bool closeHandle) : adapter(adapter), handle(handle), closeHandle(closeHandle){ doinit(category); };
CmdCallbackI::CmdCallbackI( const omero::client_ptr& client, const omero::cmd::HandlePrx handle, bool closeHandle) : adapter(client->getObjectAdapter()), handle(handle), closeHandle(closeHandle){ doinit(client->getCategory()); };
Statement *ParseFirstcallStatement() { Statement *snp; SYM *sp; int st; dfs.puts("<ParseFirstcall>"); snp = NewStatement(st_firstcall, TRUE); sp = allocSYM(); // sp->SetName(*(new std::string(snp->fcname))); sp->storage_class = sc_static; sp->value.i = nextlabel++; sp->tp = &stdbyte; st = lastst; lastst = kw_firstcall; // fake out doinit() doinit(sp); lastst = st; // doinit should set realname snp->fcname = my_strdup(sp->realname); snp->s1 = ParseStatement(); // Empty statements return NULL if (snp->s1) snp->s1->outer = snp; dfs.puts("</ParseFirstcall>"); return snp; }
int main(int argc, Char *argv[]) { int i; #ifdef MAC argc = 1; /* macsetup("Fitch",""); */ argv[0]="Fitch"; #endif #ifdef WIN32 phySetConsoleAttributes(); phyClearScreen(); #endif strcpy(progname,argv[0]); openfile(&infile,INFILE,"input file","r",argv[0],infilename); openfile(&outfile,OUTFILE,"output file","w",argv[0],outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; datasets = 1; firstset = true; doinit(); if (trout) openfile(&outtree,OUTTREE,"output tree file","w",argv[0],outtreename); for (i=0;i<spp;++i){ enterorder[i]=0;} for (ith = 1; ith <= datasets; ith++) { if (datasets > 1) { fprintf(outfile, "Data set # %ld:\n\n",ith); if (progress) printf("\nData set # %ld:\n\n",ith); } fitch_getinput(); for (jumb = 1; jumb <= njumble; jumb++) maketree(); firstset = false; if (eoln(infile)) { fscanf(infile, "%*[^\n]"); getc(infile); } } if (trout) FClose(outtree); FClose(outfile); FClose(infile); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif printf("Done.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif return 0; }
int main(int argc, Char *argv[]) { /* main program */ long i; #ifdef MAC argc = 1; /* macsetup("Contml",""); */ argv[0] = "Contml"; #endif init(argc, argv); emboss_getoptions("fcontml", argc, argv); progname = argv[0]; ibmpc = IBMCRT; ansi = ANSICRT; firstset = true; doinit(); for (ith = 1; ith <= datasets; ith++) { getinput(); if (ith == 1) firstset = false; if (datasets > 1) { fprintf(outfile, "Data set # %ld:\n\n", ith); if (progress) printf("\nData set # %ld:\n", ith); } for (jumb = 1; jumb <= njumble; jumb++) maketree(); if (usertree) for (i = 0; i < MAXSHIMOTREES; i++) free(l0gf[i]); } FClose(outfile); FClose(outtree); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif printf("\nDone.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif ajPhyloFreqDel(&phylofreq); ajPhyloTreeDelarray(&phylotrees); ajFileClose(&embossoutfile); ajFileClose(&embossouttree); embExit(); return 0; }
int main(int argc, Char *argv[]) { /* main program */ long i; #ifdef MAC argc = 1; /* macsetup("Contml",""); */ argv[0] = "Contml"; #endif init(argc, argv); progname = argv[0]; openfile(&infile,INFILE,"input file", "r",argv[0],infilename); openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; firstset = true; datasets = 1; doinit(); if (trout) openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename); for (ith = 1; ith <= datasets; ith++) { getinput(); if (ith == 1) firstset = false; if (datasets > 1) { fprintf(outfile, "Data set # %ld:\n\n", ith); if (progress) printf("\nData set # %ld:\n", ith); } for (jumb = 1; jumb <= njumble; jumb++) maketree(); if (usertree) for (i = 0; i < MAXSHIMOTREES; i++) free(l0gf[i]); } FClose(outfile); FClose(outtree); FClose(infile); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif printf("\nDone.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif return 0; }
int main(int argc, Char *argv[]) { /* main program */ #ifdef MAC argc = 1; /* macsetup("Neighbor",""); */ argv[0] = "Neighbor"; #endif #ifdef WIN32 phySetConsoleAttributes(); phyClearScreen(); #endif openfile(&infile,INFILE,"input file", "r",argv[0],infilename); openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; datasets = 1; doinit(); if (trout) openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename); ith = 1; while (ith <= datasets) { if (datasets > 1) { fprintf(outfile, "Data set # %ld:\n",ith); if (progress) printf("Data set # %ld:\n",ith); } getinput(); maketree(); if (eoln(infile)) { fscanf(infile, "%*[^\n]"); getc(infile); } ith++; } FClose(infile); FClose(outfile); FClose(outtree); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif printf("Done.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif return 0; }
int main(int argc, Char *argv[]) { /* distances from restriction sites or fragments */ #ifdef MAC argc = 1; /* macsetup("Restdist",""); */ argv[0] = "Restdist"; #endif #ifdef WIN32 phySetConsoleAttributes(); phyClearScreen(); #endif strcpy(progname,argv[0]); openfile(&infile,INFILE,"input data file","r",argv[0],infilename); openfile(&outfile,OUTFILE,"output file","w",argv[0],outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; datasets = 1; firstset = true; doinit(); for (ith = 1; ith <= datasets; ith++) { getinput(); if (ith == 1) firstset = false; if (datasets > 1 && progress) printf("\nData set # %ld:\n\n",ith); makedists(); writedists(); } FClose(infile); FClose(outfile); #ifdef MAC fixmacfile(outfilename); #endif printf("Done.\n\n"); #ifdef WIN32 phyRestoreConsoleAttributes(); #endif return 0; } /* distances from restriction sites or fragments */
int main(int argc, Char *argv[]) { /* Penny's branch-and-bound method */ /* Reads in the number of species, number of characters, options and data. Then finds all most parsimonious trees */ #ifdef MAC argc = 1; /* macsetup("Penny",""); */ argv[0] = "Penny"; #endif init(argc,argv); openfile(&infile,INFILE,"input file", "r",argv[0],infilename); openfile(&outfile,OUTFILE,"output file", "w",argv[0],outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; msets = 1; firstset = true; garbage = NULL; bits = 8*sizeof(long) - 1; doinit(); if (weights || justwts) openfile(&weightfile,WEIGHTFILE,"weights file","r",argv[0],weightfilename); if (trout) openfile(&outtree,OUTTREE,"output tree file", "w",argv[0],outtreename); if(ancvar) openfile(&ancfile,ANCFILE,"ancestors file", "r",argv[0],ancfilename); if(mixture) openfile(&mixfile,MIXFILE,"mixture file", "r",argv[0],mixfilename); for (ith = 1; ith <= msets; ith++) { if(firstset) { if (allsokal && !mixture) fprintf(outfile, "Camin-Sokal parsimony method\n\n"); if (allwagner && !mixture) fprintf(outfile, "Wagner parsimony method\n\n"); } doinput(); if (msets > 1 && !justwts) { fprintf(outfile, "Data set # %ld:\n\n",ith); if (progress) printf("\nData set # %ld:\n",ith); } if (justwts) { if(firstset && mixture && printdata) printmixture(outfile, wagner); fprintf(outfile, "Weights set # %ld:\n\n", ith); if (progress) printf("\nWeights set # %ld:\n\n", ith); } else if (mixture && printdata) printmixture(outfile, wagner); if (printdata) { if (weights || justwts) printweights(outfile, 0, chars, weight, "Characters"); if (ancvar) printancestors(outfile, anczero, ancone); } if (ith == 1) firstset = false; maketree(); } FClose(infile); FClose(outfile); FClose(outtree); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif #ifdef WIN32 phyRestoreConsoleAttributes(); #endif return 0; } /* Penny's branch-and-bound method */
/* * funcbody starts with the current symbol being either * the first parameter id or the begin for the local * block. If begin is the current symbol then funcbody * assumes that the function has no parameters. */ int ParseFunction(SYM *sp) { int poffset, i; int oldglobal; SYM *sp1, *sp2; Statement *stmt; if (sp==NULL) { fatal("Compiler error: ParseFunction: SYM is NULL\r\n"); } sp->stkname = stkname; if (verbose) printf("Parsing function: %s\r\n", sp->name); oldglobal = global_flag; global_flag = 0; poffset = 24; /* size of return block */ nparms = 0; iflevel = 0; // There could be unnamed parameters in a function prototype. if(lastst == id || 1) { /* declare parameters */ //while(lastst == id) { // names[nparms++] = litlate(lastid); // NextToken(); // if( lastst == comma) // NextToken(); // else // break; // } //needpunc(closepa); // dodecl(sc_member); /* declare parameters */ sp->parms = (SYM *)NULL; ParseParameterDeclarations(1); for(i = 0;i < nparms;++i) { if( (sp1 = search(names[i],&lsyms)) == NULL) sp1 = makeint(names[i]); //if( sp1->tp->size < 8 ) //{ // sp1->value.i = poffset;// + (8 - sp1->tp->size); // poffset += 8; //} //else //{ // sp1->value.i = poffset; // poffset += sp1->tp->size; //} sp1->value.i = poffset; // Check for aggregate types passed as parameters. Structs // and unions use the type size. // if (sp1->tp->type==bt_struct || sp1->tp->type==bt_union) { poffset += round8(sp1->tp->size); if (round8(sp1->tp->size) > 8) sp->IsLeaf = FALSE; // } // else // poffset += 8; //sp1->value.i = poffset; //poffset += 8; sp1->storage_class = sc_auto; sp1->nextparm = (SYM *)NULL; // record parameter list if (sp->parms == (SYM *)NULL) { sp->parms = sp1; } else { sp1->nextparm = sp->parms; sp->parms = sp1; } } // Process extra hidden parameter if (sp->tp->btp->type==bt_struct || sp->tp->btp->type==bt_union) { sp1 = makeint(litlate("_pHiddenStructPtr")); sp1->value.i = poffset; poffset += 8; sp1->storage_class = sc_auto; sp1->nextparm = (SYM *)NULL; // record parameter list if (sp->parms == (SYM *)NULL) { sp->parms = sp1; } else { sp1->nextparm = sp->parms; sp->parms = sp1; } nparms++; } } if (lastst == closepa) NextToken(); if (sp->tp->type == bt_pointer) { if (lastst==assign) { doinit(sp); } sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->NumParms = nparms; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; ReleaseLocalMemory(); /* release local symbols (parameters)*/ global_flag = oldglobal; return 1; } if (lastst == semicolon) { // Function prototype sp->IsPrototype = 1; sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->NumParms = nparms; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; ReleaseLocalMemory(); /* release local symbols (parameters)*/ goto j1; } else if(lastst != begin) { // NextToken(); ParseParameterDeclarations(2); // for old-style parameter list //needpunc(closepa); if (lastst==semicolon) { sp->IsPrototype = 1; sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->NumParms = nparms; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; ReleaseLocalMemory(); /* release local symbols (parameters)*/ } // Check for end of function parameter list. else if (funcdecl==2 && lastst==closepa) { ; } else { sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; sp->NumParms = nparms; stmt = ParseFunctionBody(sp); funcbottom(stmt); } } // error(ERR_BLOCK); else { sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; sp->NumParms = nparms; stmt = ParseFunctionBody(sp); funcbottom(stmt); } j1: global_flag = oldglobal; return 0; }
/* * process ParseSpecifierarations of the form: * * <type> <ParseSpecifier>, <ParseSpecifier>...; * * leaves the ParseSpecifierarations in the symbol table pointed to by * table and returns the number of bytes declared. al is the * allocation type to assign, ilc is the initial location * counter. if al is sc_member then no initialization will * be processed. ztype should be bt_struct for normal and in * structure ParseSpecifierarations and sc_union for in union ParseSpecifierarations. */ int declare(TABLE *table,int al,int ilc,int ztype) { SYM *sp, *sp1, *sp2; TYP *dhead; char stnm[200]; static long old_nbytes; int nbytes; nbytes = 0; ParseSpecifier(table); dhead = head; for(;;) { declid = 0; bit_width = -1; ParseDeclarationPrefix(ztype==bt_union); if( declid != 0) { /* otherwise just struct tag... */ sp = allocSYM(); sp->name = declid; sp->storage_class = al; if (bit_width > 0 && bit_offset > 0) { // share the storage word with the previously defined field nbytes = old_nbytes - ilc; } old_nbytes = ilc + nbytes; if (al != sc_member) { // sp->isTypedef = isTypedef; if (isTypedef) sp->storage_class = sc_typedef; isTypedef = FALSE; } while( (ilc + nbytes) % alignment(head)) { if( al != sc_member && al != sc_external && al != sc_auto) { dseg(); GenerateByte(0); } ++nbytes; } if( al == sc_static) { sp->value.i = nextlabel++; } else if( ztype == bt_union) sp->value.i = ilc; else if( al != sc_auto ) sp->value.i = ilc + nbytes; else sp->value.i = -(ilc + nbytes + head->size); if (bit_width == -1) sp->tp = head; else { sp->tp = allocTYP(); *(sp->tp) = *head; sp->tp->type = bt_bitfield; sp->tp->size = head->size;//tp_int.size; sp->tp->bit_width = bit_width; sp->tp->bit_offset = bit_offset; } if( (sp->tp->type == bt_func) && sp->storage_class == sc_global ) sp->storage_class = sc_external; if(ztype == bt_union) nbytes = imax(nbytes,sp->tp->size); else if(al != sc_external) nbytes += sp->tp->size; if( sp->tp->type == bt_ifunc && (sp1 = search(sp->name,table)) != 0 && sp1->tp->type == bt_func ) { sp1->tp = sp->tp; sp1->storage_class = sp->storage_class; // sp1->value.i = sp->value.i; sp1->IsPrototype = sp->IsPrototype; sp = sp1; } else { sp2 = search(sp->name,table); if (sp2 == NULL) insert(sp,table); else { if (funcdecl==2) sp2->tp = sp->tp; //else if (!sp2->IsPrototype) // insert(sp,table); } } if( sp->tp->type == bt_ifunc) { /* function body follows */ ParseFunction(sp); return nbytes; } if( (al == sc_global || al == sc_static) && sp->tp->type != bt_func && sp->storage_class!=sc_typedef) doinit(sp); } if (funcdecl==TRUE) { if (lastst==comma || lastst==semicolon) break; if (lastst==closepa) goto xit1; } else if (catchdecl==TRUE) { if (lastst==closepa) goto xit1; } else if (lastst == semicolon) break; needpunc(comma); if(declbegin(lastst) == 0) break; head = dhead; } NextToken(); xit1: return nbytes; }
int main(int argc, Char *argv[]) { /* Dollo or polymorphism parsimony by uphill search */ #ifdef MAC argc = 1; /* macsetup("Dollop",""); */ argv[0] = "Dollop"; #endif init(argc, argv); emboss_getoptions("fdollop", argc, argv); /* reads in spp, chars, and the data. Then calls maketree to construct the tree */ progname = argv[0]; ibmpc = IBMCRT; ansi = ANSICRT; garbage = NULL; firstset = true; bits = 8*sizeof(long) - 1; doinit(); if (dollo) fprintf(outfile, "Dollo"); else fprintf(outfile, "Polymorphism"); fprintf(outfile, " parsimony method\n\n"); if (printdata && justwts) fprintf(outfile, "%2ld species, %3ld characters\n\n", spp, chars); for (ith = 1; ith <= (msets); ith++) { if (msets > 1 && !justwts) { fprintf(outfile, "Data set # %ld:\n\n",ith); if (progress) printf("\nData set # %ld:\n",ith); } if (justwts){ fprintf(outfile, "Weights set # %ld:\n\n", ith); if (progress) printf("\nWeights set # %ld:\n\n", ith); } if (printdata && !justwts) fprintf(outfile, "%2ld species, %3ld characters\n\n", spp, chars); doinput(); if (ith == 1) firstset = false; for (jumb = 1; jumb <= njumble; jumb++) maketree(); } /* this would be an appropriate place to deallocate memory, including these items: */ free(steps); FClose(infile); FClose(outfile); FClose(outtree); #ifdef MAC fixmacfile(outfilename); fixmacfile(outtreename); #endif #ifdef WIN32 phyRestoreConsoleAttributes(); #endif embExit(); return 0; } /* Dollo or polymorphism parsimony by uphill search */
int yyparse(void) { struct { YYSTYPE yyv; int yys; } yys[YYMAXDEPTH], *yyp, *yypt; short *yyxi; int yyj, yym, yystate, yyn, yyg; long yychar; YYSTYPE save1, save2; int save3, save4; save1 = yylval; save2 = yyval; save3 = yynerrs; save4 = yyerrflag; yystate = 0; yychar = -1; yynerrs = 0; yyerrflag = 0; yyp = &yys[-1]; goto yystack; ret0: yyn = 0; goto ret; ret1: yyn = 1; goto ret; ret: yylval = save1; yyval = save2; yynerrs = save3; yyerrflag = save4; return yyn; yystack: /* put a state and value onto the stack */ if(yydebug >= 4) fprint(2, "char %s in %s", yytokname(yychar), yystatname(yystate)); yyp++; if(yyp >= &yys[YYMAXDEPTH]) { yyerror("yacc stack overflow"); goto ret1; } yyp->yys = yystate; yyp->yyv = yyval; yynewstate: yyn = yypact[yystate]; if(yyn <= YYFLAG) goto yydefault; /* simple state */ if(yychar < 0) yychar = yylex1(); yyn += yychar; if(yyn < 0 || yyn >= YYLAST) goto yydefault; yyn = yyact[yyn]; if(yychk[yyn] == yychar) { /* valid shift */ yychar = -1; yyval = yylval; yystate = yyn; if(yyerrflag > 0) yyerrflag--; goto yystack; } yydefault: /* default state action */ yyn = yydef[yystate]; if(yyn == -2) { if(yychar < 0) yychar = yylex1(); /* look through exception table */ for(yyxi=yyexca;; yyxi+=2) if(yyxi[0] == -1 && yyxi[1] == yystate) break; for(yyxi += 2;; yyxi += 2) { yyn = yyxi[0]; if(yyn < 0 || yyn == yychar) break; } yyn = yyxi[1]; if(yyn < 0) goto ret0; } if(yyn == 0) { /* error ... attempt to resume parsing */ switch(yyerrflag) { case 0: /* brand new error */ yyerror("syntax error"); yynerrs++; if(yydebug >= 1) { fprint(2, "%s", yystatname(yystate)); fprint(2, "saw %s\n", yytokname(yychar)); } case 1: case 2: /* incompletely recovered error ... try again */ yyerrflag = 3; /* find a state where "error" is a legal shift action */ while(yyp >= yys) { yyn = yypact[yyp->yys] + YYERRCODE; if(yyn >= 0 && yyn < YYLAST) { yystate = yyact[yyn]; /* simulate a shift of "error" */ if(yychk[yystate] == YYERRCODE) goto yystack; } /* the current yyp has no shift onn "error", pop stack */ if(yydebug >= 2) fprint(2, "error recovery pops state %d, uncovers %d\n", yyp->yys, (yyp-1)->yys ); yyp--; } /* there is no state on the stack with an error shift ... abort */ goto ret1; case 3: /* no shift yet; clobber input char */ if(yydebug >= 2) fprint(2, "error recovery discards %s\n", yytokname(yychar)); if(yychar == YYEOFCODE) goto ret1; yychar = -1; goto yynewstate; /* try again in the same state */ } } /* reduction by production yyn */ if(yydebug >= 2) fprint(2, "reduce %d in:\n\t%s", yyn, yystatname(yystate)); yypt = yyp; yyp -= yyr2[yyn]; yyval = (yyp+1)->yyv; yym = yyn; /* consult goto table to find next state */ yyn = yyr1[yyn]; yyg = yypgo[yyn]; yyj = yyg + yyp->yys + 1; if(yyj >= YYLAST || yychk[yystate=yyact[yyj]] != -yyn) yystate = yyact[yyg]; switch(yym) { case 3: #line 77 "cc.y" { dodecl(xdecl, lastclass, lasttype, Z); } break; case 5: #line 82 "cc.y" { lastdcl = T; firstarg = S; dodecl(xdecl, lastclass, lasttype, yypt[-0].yyv.node); if(lastdcl == T || lastdcl->etype != TFUNC) { diag(yypt[-0].yyv.node, "not a function"); lastdcl = types[TFUNC]; } thisfn = lastdcl; markdcl(); firstdcl = dclstack; argmark(yypt[-0].yyv.node, 0); } break; case 6: #line 96 "cc.y" { argmark(yypt[-2].yyv.node, 1); } break; case 7: #line 100 "cc.y" { Node *n; n = revertdcl(); if(n) yypt[-0].yyv.node = new(OLIST, n, yypt[-0].yyv.node); if(!debug['a'] && !debug['Z']) codgen(yypt[-0].yyv.node, yypt[-4].yyv.node); } break; case 8: #line 112 "cc.y" { dodecl(xdecl, lastclass, lasttype, yypt[-0].yyv.node); } break; case 9: #line 116 "cc.y" { yypt[-0].yyv.node = dodecl(xdecl, lastclass, lasttype, yypt[-0].yyv.node); } break; case 10: #line 120 "cc.y" { doinit(yypt[-3].yyv.node->sym, yypt[-3].yyv.node->type, 0L, yypt[-0].yyv.node); } break; case 13: #line 128 "cc.y" { yyval.node = new(OIND, yypt[-0].yyv.node, Z); yyval.node->garb = simpleg(yypt[-1].yyv.lval); } break; case 15: #line 136 "cc.y" { yyval.node = yypt[-1].yyv.node; } break; case 16: #line 140 "cc.y" { yyval.node = new(OFUNC, yypt[-3].yyv.node, yypt[-1].yyv.node); } break; case 17: #line 144 "cc.y" { yyval.node = new(OARRAY, yypt[-3].yyv.node, yypt[-1].yyv.node); } break; case 18: #line 153 "cc.y" { yyval.node = dodecl(adecl, lastclass, lasttype, Z); } break; case 19: #line 157 "cc.y" { yyval.node = yypt[-1].yyv.node; } break; case 20: #line 163 "cc.y" { dodecl(adecl, lastclass, lasttype, yypt[-0].yyv.node); yyval.node = Z; } break; case 21: #line 168 "cc.y" { yypt[-0].yyv.node = dodecl(adecl, lastclass, lasttype, yypt[-0].yyv.node); } break; case 22: #line 172 "cc.y" { long w; w = yypt[-3].yyv.node->sym->type->width; yyval.node = doinit(yypt[-3].yyv.node->sym, yypt[-3].yyv.node->type, 0L, yypt[-0].yyv.node); yyval.node = contig(yypt[-3].yyv.node->sym, yyval.node, w); } break; case 23: #line 180 "cc.y" { yyval.node = yypt[-2].yyv.node; if(yypt[-0].yyv.node != Z) { yyval.node = yypt[-0].yyv.node; if(yypt[-2].yyv.node != Z) yyval.node = new(OLIST, yypt[-2].yyv.node, yypt[-0].yyv.node); } } break; case 26: #line 197 "cc.y" { dodecl(pdecl, lastclass, lasttype, yypt[-0].yyv.node); } break; case 28: #line 207 "cc.y" { lasttype = yypt[-0].yyv.type; } break; case 30: #line 212 "cc.y" { lasttype = yypt[-0].yyv.type; } break; case 32: #line 218 "cc.y" { lastfield = 0; edecl(CXXX, lasttype, S); } break; case 34: #line 226 "cc.y" { dodecl(edecl, CXXX, lasttype, yypt[-0].yyv.node); } break; case 36: #line 233 "cc.y" { lastbit = 0; firstbit = 1; } break; case 37: #line 238 "cc.y" { yyval.node = new(OBIT, yypt[-2].yyv.node, yypt[-0].yyv.node); } break; case 38: #line 242 "cc.y" { yyval.node = new(OBIT, Z, yypt[-0].yyv.node); } break; case 39: #line 250 "cc.y" { yyval.node = (Z); } break; case 41: #line 257 "cc.y" { yyval.node = new(OIND, (Z), Z); yyval.node->garb = simpleg(yypt[-0].yyv.lval); } break; case 42: #line 262 "cc.y" { yyval.node = new(OIND, yypt[-0].yyv.node, Z); yyval.node->garb = simpleg(yypt[-1].yyv.lval); } break; case 45: #line 271 "cc.y" { yyval.node = new(OFUNC, yypt[-3].yyv.node, yypt[-1].yyv.node); } break; case 46: #line 275 "cc.y" { yyval.node = new(OARRAY, yypt[-3].yyv.node, yypt[-1].yyv.node); } break; case 47: #line 281 "cc.y" { yyval.node = new(OFUNC, (Z), Z); } break; case 48: #line 285 "cc.y" { yyval.node = new(OARRAY, (Z), yypt[-1].yyv.node); } break; case 49: #line 289 "cc.y" { yyval.node = yypt[-1].yyv.node; } break; case 51: #line 296 "cc.y" { yyval.node = new(OINIT, invert(yypt[-1].yyv.node), Z); } break; case 52: #line 302 "cc.y" { yyval.node = new(OARRAY, yypt[-1].yyv.node, Z); } break; case 53: #line 306 "cc.y" { yyval.node = new(OELEM, Z, Z); yyval.node->sym = yypt[-0].yyv.sym; } break; case 56: #line 315 "cc.y" { yyval.node = new(OLIST, yypt[-2].yyv.node, yypt[-1].yyv.node); } break; case 58: #line 320 "cc.y" { yyval.node = new(OLIST, yypt[-1].yyv.node, yypt[-0].yyv.node); } break; case 61: #line 328 "cc.y" { yyval.node = new(OLIST, yypt[-1].yyv.node, yypt[-0].yyv.node); } break; case 62: #line 333 "cc.y" { yyval.node = Z; } break; case 63: #line 337 "cc.y" { yyval.node = invert(yypt[-0].yyv.node); } break; case 65: #line 345 "cc.y" { yyval.node = new(OPROTO, yypt[-0].yyv.node, Z); yyval.node->type = yypt[-1].yyv.type; } break; case 66: #line 350 "cc.y" { yyval.node = new(OPROTO, yypt[-0].yyv.node, Z); yyval.node->type = yypt[-1].yyv.type; } break; case 67: #line 355 "cc.y" { yyval.node = new(ODOTDOT, Z, Z); } break; case 68: #line 359 "cc.y" { yyval.node = new(OLIST, yypt[-2].yyv.node, yypt[-0].yyv.node); } break; case 69: #line 365 "cc.y" { yyval.node = invert(yypt[-1].yyv.node); // if(yypt[-1].yyv.node != Z) // yyval.node = new(OLIST, yypt[-1].yyv.node, yyval.node); if(yyval.node == Z) yyval.node = new(OLIST, Z, Z); } break; case 70: #line 374 "cc.y" { yyval.node = Z; } break; case 71: #line 378 "cc.y" { yyval.node = new(OLIST, yypt[-1].yyv.node, yypt[-0].yyv.node); } break; case 72: #line 382 "cc.y" { yyval.node = new(OLIST, yypt[-1].yyv.node, yypt[-0].yyv.node); } break; case 74: #line 389 "cc.y" { yyval.node = new(OLIST, yypt[-1].yyv.node, yypt[-0].yyv.node); } break; case 75: #line 395 "cc.y" { yyval.node = new(OCASE, yypt[-1].yyv.node, Z); } break; case 76: #line 399 "cc.y" { yyval.node = new(OCASE, Z, Z); } break; case 77: #line 403 "cc.y" { yyval.node = new(OLABEL, dcllabel(yypt[-1].yyv.sym, 1), Z); } break; case 78: #line 409 "cc.y" { yyval.node = Z; } break; case 80: #line 414 "cc.y" { yyval.node = new(OLIST, yypt[-1].yyv.node, yypt[-0].yyv.node); } break; case 82: #line 421 "cc.y" { yyval.node = yypt[-0].yyv.node; } break; case 84: #line 427 "cc.y" { markdcl(); } break; case 85: #line 431 "cc.y" { yyval.node = revertdcl(); if(yyval.node) yyval.node = new(OLIST, yyval.node, yypt[-0].yyv.node); else yyval.node = yypt[-0].yyv.node; } break;
/* * process declarations of the form: * * <type> <specifier>, <specifier>...; * * leaves the declarations in the symbol table pointed to by * table and returns the number of bytes declared. al is the * allocation type to assign, ilc is the initial location * counter. if al is sc_member then no initialization will * be processed. ztype should be bt_struct for normal and in * structure ParseSpecifierarations and sc_union for in union ParseSpecifierarations. */ int declare(TABLE *table,int al,int ilc,int ztype) { SYM *sp, *sp1, *sp2; TYP *dhead, *tp1, *tp2; ENODE *ep1, *ep2; char stnm[200]; int op; int fd; int fn_doneinit = 0; int bcnt; static long old_nbytes; int nbytes; nbytes = 0; if (ParseSpecifier(table)) return nbytes; dhead = head; for(;;) { declid = (char *)NULL; bit_width = -1; ParseDeclarationPrefix(ztype==bt_union); // If a function declaration is taking place and just the type is // specified without a parameter name, assign an internal compiler // generated name. if (funcdecl>0 && funcdecl != 10 && declid==(char *)NULL) { sprintf(lastid, "_p%d", nparms); declid = litlate(lastid); names[nparms++] = declid; missingArgumentName = TRUE; } if( declid != NULL) { /* otherwise just struct tag... */ sp = allocSYM(); sp->name = declid; sp->storage_class = al; sp->isConst = isConst; if (bit_width > 0 && bit_offset > 0) { // share the storage word with the previously defined field nbytes = old_nbytes - ilc; } old_nbytes = ilc + nbytes; if (al != sc_member) { // sp->isTypedef = isTypedef; if (isTypedef) sp->storage_class = sc_typedef; isTypedef = FALSE; } if ((ilc + nbytes) % roundAlignment(head)) { if (al==sc_thread) tseg(); else dseg(); } bcnt = 0; while( (ilc + nbytes) % roundAlignment(head)) { ++nbytes; bcnt++; } if( al != sc_member && al != sc_external && al != sc_auto) { if (bcnt > 0) genstorage(bcnt); } // Set the struct member storage offset. if( al == sc_static || al==sc_thread) { sp->value.i = nextlabel++; } else if( ztype == bt_union) sp->value.i = ilc; else if( al != sc_auto ) sp->value.i = ilc + nbytes; // Auto variables are referenced negative to the base pointer // Structs need to be aligned on the boundary of the largest // struct element. If a struct is all chars this will be 2. // If a struct contains a pointer this will be 8. It has to // be the worst case alignment. else { sp->value.i = -(ilc + nbytes + roundSize(head)); } if (bit_width == -1) sp->tp = head; else { sp->tp = allocTYP(); *(sp->tp) = *head; sp->tp->type = bt_bitfield; sp->tp->size = head->size;//tp_int.size; sp->tp->bit_width = bit_width; sp->tp->bit_offset = bit_offset; } if (isConst) sp->tp->isConst = TRUE; if((sp->tp->type == bt_func) && sp->storage_class == sc_global ) sp->storage_class = sc_external; // Increase the storage allocation by the type size. if(ztype == bt_union) nbytes = imax(nbytes,roundSize(sp->tp)); else if(al != sc_external) { // If a pointer to a function is defined in a struct. if (isStructDecl && (sp->tp->type==bt_func || sp->tp->type==bt_ifunc)) nbytes += 8; else nbytes += roundSize(sp->tp); } if (sp->tp->type == bt_ifunc && (sp1 = search(sp->name,table)) != 0 && sp1->tp->type == bt_func ) { sp1->tp = sp->tp; sp1->storage_class = sp->storage_class; sp1->value.i = sp->value.i; sp1->IsPrototype = sp->IsPrototype; sp = sp1; } else { sp2 = search(sp->name,table); if (sp2 == NULL) insert(sp,table); else { if (funcdecl==2) sp2->tp = sp->tp; //else if (!sp2->IsPrototype) // insert(sp,table); } } if (needParseFunction) { needParseFunction = FALSE; fn_doneinit = ParseFunction(sp); if (sp->tp->type != bt_pointer) return nbytes; } // if(sp->tp->type == bt_ifunc) { /* function body follows */ // ParseFunction(sp); // return nbytes; // } if( (al == sc_global || al == sc_static || al==sc_thread) && !fn_doneinit && sp->tp->type != bt_func && sp->tp->type != bt_ifunc && sp->storage_class!=sc_typedef) doinit(sp); } if (funcdecl>0) { if (lastst==comma || lastst==semicolon) break; if (lastst==closepa) goto xit1; } else if (catchdecl==TRUE) { if (lastst==closepa) goto xit1; } else if (lastst == semicolon) break; else if (lastst == assign) { tp1 = nameref(&ep1); op = en_assign; // NextToken(); tp2 = asnop(&ep2); if( tp2 == 0 || !IsLValue(ep1) ) error(ERR_LVALUE); else { tp1 = forcefit(&ep1,tp1,&ep2,tp2); ep1 = makenode(op,ep1,ep2); } sp->initexp = ep1; if (lastst==semicolon) break; } needpunc(comma); if(declbegin(lastst) == 0) break; head = dhead; } NextToken(); xit1: return nbytes; }
PyMODINIT_FUNC PyInit_jpeg(void) { return doinit(); }
/* * funcbody starts with the current symbol being either * the first parameter id or the begin for the local * block. If begin is the current symbol then funcbody * assumes that the function has no parameters. */ int ParseFunction(SYM *sp) { int i; SYM *sp1, *sp2, *pl, *osp; Statement *stmt; int nump; __int16 *ta; int nn; std::string name; dfs.puts("<ParseFunction>\n"); isFuncBody = true; if (sp==NULL) { fatal("Compiler error: ParseFunction: SYM is NULL\r\n"); } dfs.printf("***********************************\n"); dfs.printf("***********************************\n"); dfs.printf("***********************************\n"); if (sp->parent) dfs.printf("Parent: %s\n", (char *)sp->GetParentPtr()->name->c_str()); dfs.printf("Parsing function: %s\n", (char *)sp->name->c_str()); dfs.printf("***********************************\n"); dfs.printf("***********************************\n"); dfs.printf("***********************************\n"); sp->stkname = stkname; if (verbose) printf("Parsing function: %s\r\n", (char *)sp->name->c_str()); nump = nparms; iflevel = 0; // There could be unnamed parameters in a function prototype. dfs.printf("A"); // declare parameters // Building a parameter list here allows both styles of parameter // declarations. the original 'C' style is parsed here. Originally the // parameter types appeared as list after the parenthesis and before the // function body. sp->BuildParameterList(&nump); dfs.printf("B"); sp->mangledName = sp->BuildSignature(1); // build against parameters // If the symbol has a parent then it must be a class // method. Search the parent table(s) for matching // signatures. osp = sp; name = *sp->name; if (sp->parent) { SYM *sp2; dfs.printf("PArent Class:%s|",(char *)sp->GetParentPtr()->name->c_str()); sp2 = sp->GetParentPtr()->Find(name); if (sp2) { dfs.printf("Found at least inexact match"); sp2 = sp->FindExactMatch(TABLE::matchno); } if (sp2 == nullptr) error(ERR_METHOD_NOTFOUND); else sp = sp2; sp->PrintParameterTypes(); } else { if (gsyms[0].Find(name)) { sp = TABLE::match[TABLE::matchno-1]; } } dfs.printf("C"); if (sp != osp) { dfs.printf("ParseFunction: sp changed\n"); osp->params.CopyTo(&sp->params); osp->proto.CopyTo(&sp->proto); sp->derivitives = osp->derivitives; sp->mangledName = osp->mangledName; // Should free osp here. It's not needed anymore } if (lastst == closepa) { NextToken(); } dfs.printf("D"); if (sp->tp->type == bt_pointer) { if (lastst==assign) { doinit(sp); } sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->NumParms = nump; sp->IsVirtual = isVirtual; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; // ReleaseLocalMemory(); /* release local symbols (parameters)*/ return 1; } dfs.printf("E"); if (lastst == semicolon) { // Function prototype dfs.printf("e"); sp->IsPrototype = 1; sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->IsVirtual = isVirtual; sp->NumParms = nump; sp->params.MoveTo(&sp->proto); isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; // ReleaseLocalMemory(); /* release local symbols (parameters)*/ goto j1; } else if(lastst != begin) { dfs.printf("F"); // NextToken(); ParameterDeclaration::Parse(2); // for old-style parameter list //needpunc(closepa); if (lastst==semicolon) { sp->IsPrototype = 1; sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->IsVirtual = isVirtual; sp->NumParms = nump; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; // ReleaseLocalMemory(); /* release local symbols (parameters)*/ } // Check for end of function parameter list. else if (funcdecl==2 && lastst==closepa) { ; } else { sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->IsVirtual = isVirtual; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; sp->NumParms = nump; stmt = ParseFunctionBody(sp); funcbottom(stmt); } } // error(ERR_BLOCK); else { dfs.printf("G"); sp->IsNocall = isNocall; sp->IsPascal = isPascal; sp->IsKernel = isKernel; sp->IsInterrupt = isInterrupt; sp->IsTask = isTask; sp->IsVirtual = isVirtual; isPascal = FALSE; isKernel = FALSE; isOscall = FALSE; isInterrupt = FALSE; isTask = FALSE; isNocall = FALSE; sp->NumParms = nump; stmt = ParseFunctionBody(sp); funcbottom(stmt); } j1: dfs.printf("F"); dfs.puts("</ParseFunction>\n"); return 0; }
void BfVM::initialize(const QList<BfOpcode> &bfSource) { doinit(bfSource); }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { /* main program */ double *outputval, *inputval; int mrows, ncols; if (nrhs != 1) { mexPrintf("Format for calling 'NEIGHBOR' executable:\n"); mexPrintf("\tNEIGHBOR( <outgrno> )\n"); mexErrMsgTxt("Wrong number of input args."); } /* Read in the argument: either a double or NULL '[]' */ if (((mxIsDouble(prhs[0]) != 1) & (!mxIsEmpty(prhs[0]))) == 1) { mexErrMsgTxt("The argument should be a double.\n"); } else if (((mxIsDouble(prhs[0]) == 1) & (!mxIsEmpty(prhs[0])) == 1)) { mrows = mxGetM(prhs[0]); ncols = mxGetN(prhs[0]); if ((mrows * ncols) > 1) mexErrMsgTxt("The argument should be a single value.\n"); else { inputval = mxGetPr(prhs[0]); outgrno = (long)*inputval; } } else if (mxIsEmpty(prhs[0])) { mexErrMsgTxt("numDouble = NULL\n"); } else mexErrMsgTxt("ERROR in <input_double> processing code.\n"); openfile(&infile,INFILE,"input file", "r","Neighbor",infilename); openfile(&outfile,OUTFILE,"output file", "w","Neighbor",outfilename); ibmpc = IBMCRT; ansi = ANSICRT; mulsets = false; datasets = 1; doinit(); if (trout){ openfile(&outtree,OUTTREE,"output tree file", "w","Neighbor",outtreename); /* The next line is added to make a 'real' rooted tree -- James J. Cai 6/6/2006 */ putc('(', outtree); } ith = 1; while (ith <= datasets) { if (datasets > 1) { fprintf(outfile, "Data set # %ld:\n",ith); if (progress) mexPrintf("Data set # %ld:\n",ith); } inputoptions(); maketree(); if (eoln(infile) && (ith < datasets)) scan_eoln(infile); ith++; } FClose(infile); FClose(outfile); FClose(outtree); freerest(); /* mexPrintf("Done.\n\n"); */ plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL); outputval = mxGetPr(plhs[0]); /* memcpy(output, 1.0, sizeof(double)); */ outputval[0] = 0; return; }
PyMODINIT_FUNC initjpeg(void) { doinit(); }