static int alldiagrams(FILE * fd, int nsub) { marktp bh; varptr totnum, totdenum, rnum; long pos_c1,pos_c2; int deg1,deg2,tmpn1,tmpn2, nC; catrec cr; deninforec dendescript; mark_(&bh); tmpNameMax=0; initinfo(); initdegnames(); writeF("{\n"); writeF("REAL N,D,R; COMPLEX Prop;\n"); pos_c1= ftell(outFile); writeF("%70s\n",""); writeF("if(CalcConst) C%d(C);\n",nsub); while(FREAD1(dendescript,fd) == 1) { fseek(catalog,dendescript.cr_pos,SEEK_SET); FREAD1(cr,catalog); ++(diagrcount); if(!noPict)writpict(cr.ndiagr_ + inftmp->firstdiagpos - 1); whichArchive(cr.nFile,'r'); fseek(archiv,cr.factpos,SEEK_SET); readvardef(archiv); readpolynom(&totnum); readpolynom(&totdenum); clearvardef(); fseek(archiv,cr.rnumpos,SEEK_SET); readvardef(archiv); readpolynom(&rnum); clearvardef(); fortwriter("N",totnum); fortwriter("D",totdenum); fortwriter("R",rnum); writeF("R*=(N/D);\n"); if(nin+nout>3) { writeF("Prop=1"); writeDenominators(&dendescript); writeF("R*=creal(Prop);\n"); writeF(" if(R>Fmax) Fmax=R; else if(R<-Fmax) Fmax=-R;\n"); } else writeF(";\n"); if(!noCChain)calcColor(cr.ndiagr_+inftmp->firstdiagpos); writeF("ans+=R;\n"); } whichArchive(0,0); writeF("\n}\nreturn ans;\n}\n"); deg1=cleardegnames(); tmpn1=tmpNameMax; tmpNameMax=0; initdegnames(); writeF("\nstatic void C%d(REAL*C)\n{\n",nsub); writeF(" REAL* V=va_ext;\n"); pos_c2= ftell(outFile); writeF("%70s\n",""); nC=write_const(); if(nC==0) nC=1; writeF("}\n"); fseek(outFile,pos_c1,SEEK_SET); writeF("static REAL C[%d];",nC); if(deg1) writeF("REAL S[%d];",deg1); if(tmpn1) writeF("REAL tmp[%d];",tmpn1); fseek(outFile,pos_c2,SEEK_SET); deg2=cleardegnames(); tmpn2=tmpNameMax; if(deg2) writeF("REAL S[%d];",deg2) ; if(tmpn2) writeF("REAL tmp[%d];",tmpn2 ); fseek(outFile,0,SEEK_END); release_(&bh); if( escpressed()) return 1; else return 0; }
static void onediagram(deninforec* dendescript) { catrec cr; marktp bh; varptr totnum, totdenum, rnum; long pos_c; int deg1,nConst; mark_(&bh); tmpNameMax=0; initinfo(); initdegnames(); fseek(catalog,dendescript->cr_pos,SEEK_SET); FREAD1(cr,catalog); ++(diagrcount); whichArchive(cr.nFile,'r'); fseek(archiv,cr.factpos,SEEK_SET); readvardef(archiv); readpolynom(&totnum); readpolynom(&totdenum); clearvardef(); fseek(archiv,cr.rnumpos,SEEK_SET); readvardef(archiv); readpolynom(&rnum); clearvardef(); { outFileOpen("%sresults%cf%d.c",pathtouser,f_slash,diagrcount); labl(); writeF("#include\"num_out.h\"\n"); writeF("#include\"num_in.h\"\n"); } writeF("extern FNN F%d_ext;\n",diagrcount); writeF("static void C%d(REAL * C)\n{\n",diagrcount); writeF("REAL* V=va_ext;\n"); pos_c= ftell(outFile); writeF("%80s\n",""); nConst=write_const(); deg1=cleardegnames(); writeF("}\n"); fseek(outFile,pos_c,SEEK_SET); if(deg1) writeF("REAL S[%d];",deg1); if(tmpNameMax) writeF("REAL tmp[%d];",tmpNameMax ); fseek(outFile,0,SEEK_END); tmpNameMax=0; initdegnames(); writeF("REAL F%d_ext(double GG,REAL*DP,REAL*Q0,COMPLEX*Q1,REAL*Q2)\n{\n",diagrcount); if(!noPict) writpict(cr.ndiagr_ + inftmp->firstdiagpos - 1); writeF("REAL N,D,R; COMPLEX Prop;\n"); writeF("REAL * V=va_ext;\n"); pos_c= ftell(outFile); writeF("%80s\n",""); writeF("if(CalcConst) C%d(C);\n",diagrcount); fortwriter("N",totnum); fortwriter("D",totdenum); fortwriter("R",rnum); writeF("R*=(N/D);\n"); writeF("Prop=1"); writeDenominators(dendescript); writeF("R*=creal(Prop);\n"); if(!noCChain)calcColor(cr.ndiagr_+inftmp->firstdiagpos); writeF(" return R;\n"); writeF("}\n"); deg1=cleardegnames(); if(nConst==0) nConst=1; fseek(outFile,pos_c,SEEK_SET); writeF("static REAL C[%d];",nConst); if(deg1) writeF("REAL S[%d];",deg1); if(tmpNameMax) writeF("REAL tmp[%d];",tmpNameMax ); fseek(outFile,0,SEEK_END); outFileClose(); release_(&bh); }
int compileall(void) {int n_sub, ndel, ncalc, nrest; long recpos; int i,k, pNum[MAXINOUT+1]; char procname[STRSIZ]; infoptr inf; outputLanguage='I'; catalog=fopen(CATALOG_NAME,"rb"); archiv =fopen(ARCHIV_NAME,"rb"); initvararray(0,'R'); firstVar=nmodelvar; if( !strcmp( modelvars[firstVar].varname,strongconst)) firstVar--; initinfo(); menuq=fopen(MENUQ_NAME,"rb"); nprc_=0; for(n_sub=1;n_sub<=subproc_sq;n_sub++) { rd_menu(2,n_sub,procname,&ndel,&ncalc,&nrest,&recpos); if (nrest != 0) { messanykey(10,10, "All diagrams in the subprocess must be\ncalculated or marked as deleted"); return -1; } if (ncalc != 0) { findPrtclNum(procname,pNum); for(i=0;i<nin+nout;i++) { strcpy(allcanal[nprc_].prtclnames[i], prtclbase[pNum[i+1]-1].name); allcanal[nprc_].prtclmasses[i]= &(vararr[modelVarPos(prtclbase[pNum[i+1]-1].massidnt)].tmpvalue); } compileprocess(n_sub,&allcanal[nprc_].codeptr, &allcanal[nprc_].denominators); nprc_++; } } fclose(menuq); fclose(catalog); fclose(archiv); if(nprc_ == 0) { messanykey(10,10, " Set of calculated diagrams for this processis is empty"); return -1; } inf = info; while (inf != NULL) { if (inf->consttype == numb) { inf->rval = inf->ival; inf->consttype = rnumb ; } inf = inf->next; } nin_ = nin; nout_= nout; nvar_=0; nfunc_=0; for (k=1;k<=nmodelvar; k++) { if(vararr[k].used) { if( modelvars[k].func) nfunc_++;else nvar_++;} } return 0; }
int main(int argc, char **argv) { int c, ret; char *termtype; FILE *f; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); termtype = getenv("TERM"); if (termtype == NULL || (argv[0][0] == 'c' && !isatty(1))) termtype = "lpr"; while ((c = getopt(argc, argv, "it:T:")) != -1) switch(c) { case 't': case 'T': /* for nroff compatibility */ termtype = optarg; break; case 'i': iflag = 1; break; default: fprintf(stderr, _("Usage: %s [ -i ] [ -tTerm ] file...\n"), program_invocation_short_name); return EXIT_FAILURE; } setupterm(termtype, 1, &ret); switch(ret) { case 1: break; default: warnx(_("trouble reading terminfo")); /* fall through to ... */ case 0: /* No such terminal type - assume dumb */ setupterm("dumb", 1, (int *)0); break; } initinfo(); if ( (tigetflag("os") && ENTER_BOLD==NULL ) || (tigetflag("ul") && ENTER_UNDERLINE==NULL && UNDER_CHAR==NULL)) must_overstrike = 1; initbuf(); if (optind == argc) filter(stdin); else for (; optind<argc; optind++) { f = fopen(argv[optind],"r"); if (!f) err(EXIT_FAILURE, _("%s: open failed"), argv[optind]); filter(f); } if (ferror(stdout) || fclose(stdout)) return EXIT_FAILURE; return EXIT_SUCCESS; }
void biosmain(void) { BOOL show_initinfo; /* TRUE if welcome screen must be displayed */ BYTE *p; bios_init(); /* Initialize the BIOS */ trap1( 0x30 ); /* initial test, if BDOS works: Sversion() */ if (!HAS_RTC) trap1( 0x2b, os_dosdate); /* set initial date in GEMDOS format: Tsetdate() */ /* Steem needs this to initialize its GEMDOS hard disk emulation. * This may change drvbits. See Steem sources: * File steem/code/emulator.cpp, function intercept_bios(). */ Drvmap(); /* * if it's not the first boot, we use the existing bootdev. * this allows a boot device that was selected via the welcome * screen to persist across warm boots. */ if (first_boot) bootdev = blkdev_avail(DEFAULT_BOOTDEV) ? DEFAULT_BOOTDEV : FLOPPY_BOOTDEV; #if INITINFO_DURATION == 0 show_initinfo = FALSE; #elif ALWAYS_SHOW_INITINFO show_initinfo = TRUE; #else show_initinfo = first_boot; #endif if (show_initinfo) bootdev = initinfo(); /* show the welcome screen */ KDEBUG(("bootdev = %d\n", bootdev)); /* boot eventually from a block device (floppy or harddisk) */ blkdev_boot(); defdrv = bootdev; trap1( 0x0e , defdrv ); /* Set boot drive: Dsetdrv(defdrv) */ #if ENABLE_RESET_RESIDENT run_reset_resident(); /* see comments above */ #endif /* * build default environment, just a PATH= string */ strcpy(default_env,PATH_ENV); p = default_env + sizeof(PATH_ENV); /* point to first byte of path string */ strcpy(p,DEF_PATH); *p = 'A' + defdrv; /* fix up drive letter */ p += sizeof(DEF_PATH); *p = '\0'; /* terminate with double nul */ #if WITH_CLI if (early_cli) { /* run an early console */ PD *pd = (PD *) trap1_pexec(PE_BASEPAGE, "", "", default_env); pd->p_tbase = (LONG) coma_start; pd->p_tlen = pd->p_dlen = pd->p_blen = 0; trap1_pexec(PE_GOTHENFREE, "", pd, ""); } #endif autoexec(); /* autoexec PRGs from AUTO folder */ /* clear commandline */ if(cmdload != 0) { /* Pexec a program called COMMAND.PRG */ trap1_pexec(PE_LOADGO, "COMMAND.PRG", "", default_env); } else if (exec_os) { /* start the default (ROM) shell */ PD *pd; pd = (PD *) trap1_pexec(PE_BASEPAGE, "", "", default_env); pd->p_tbase = (LONG) exec_os; pd->p_tlen = pd->p_dlen = pd->p_blen = 0; trap1_pexec(PE_GO, "", pd, ""); } #if CONF_WITH_SHUTDOWN /* try to shutdown the machine / close the emulator */ shutdown(); #endif /* hide cursor */ cprintf("\033f"); kcprintf(_("System halted!\n")); halt(); }