static void louddiagrexpr(prgcodeptr* prg, deninforec * dendescript) {prgcodeptr pntr; int i; catrec cr; polyvars allVars={0,NULL}; vardef=&allVars; fseek(catalog,dendescript->cr_pos,SEEK_SET); FREAD1(cr,catalog); pntr = *prg; *prg = (prgcodeptr)getmem_(sizeof(prgcoderec)); (*prg)->next = pntr; fseek(archiv,cr.factpos,SEEK_SET); readvardef(); readpolynom(&(*prg)->totn); readpolynom(&(*prg)->totd); clearvardef(); fseek(archiv,cr.rnumpos,SEEK_SET); readvardef(); readpolynom(&(*prg)->rnum); clearvardef(); (*prg)->denorno=dendescript->tot_den; for (i = 0; i < (*prg)->denorno ; i++) { (*prg)->power[i] = dendescript->denarr[i].power; (*prg)->order_num[i] = dendescript->denarr[i].order_num; (*prg)->width[i] = dendescript->denarr[i].width; } }
static void prepareprocinform(void) {int ndel, ncalc, nrest; long recpos; char txt[STRSIZ]; int i, k; csdiagram csd; char * mass; int nn; int nsubs; inf = NULL; fseek(menuq,0,SEEK_SET); for (nsubs=1;nsubs<=subproc_sq;nsubs++) { inftmp = inf; inf = (procinfptr)getmem_((unsigned)sizeof(procinfrec)); inf->next = inftmp; rd_menu(2,nsubs,txt,&ndel,&ncalc,&nrest,&recpos); inf->firstdiagpos = recpos; getprtcls(txt,inf->p_name); for (i = 0; i < nin + nout; i++) { locateinbase(inf->p_name[i],&nn); mass=prtclbase[nn-1].massidnt; if (strcmp(mass,"0")) {for(k=1; k<=nmodelvar; k++) if(strcmp(modelvars[k].varname,mass)==0) break;} else k=0; if(k>nmodelvar){ printf("mass %s is not defined\n",mass); exit(125);} inf->p_masspos[i] = k; inf->p_code[i]=prtclbase1[nn].N; } for (i = nin + nout; i < MAXINOUT; i++) { strcpy(inf->p_name[i],"***"); inf->p_masspos[i] = 0; } fseek(diagrq,recpos*sizeof(csdiagram),SEEK_SET); inf->tot = 0; for (i = 1; i <= ndel + ncalc + nrest; i++) { FREAD1(csd,diagrq); if (csd.status == 1) ++(inf->tot); } if(inf->tot==0) for (i = 0; i < nin + nout; i++) inf->p_masspos[i]=0; } nsubs--; revers((void **)&inf); }
int create_(char *pname, unsigned int *psw, void *ustack, int narg, void *argptr) /* create creates a new PCB containing the information to make the program "runnable" in the OS. It locates an unused slot in the Process Table, initializes it, and attaches it to the end of the process queue. It expects as parameters: ptr to the process name, address of the initial psw of the process, the address of a memory area to be used a the process's user stack (if 0 then allocate the space for it), the number of parameters to be passed as child processes, and the address of an array containing the parameters to be passed to the child. */ { int pos = 0; /* position in the table */ int i; /* loop index for registers */ P_(PTSEM); /* locate empty slot in process table */ while (PTable[pos].state != UNUSED && pos < PTSIZE) pos++; if (pos == PTSIZE) return -1; /* table full */ else { pinct++; /* assign type */ memcpy(PTable[pos].type, "PCB ", 4); /* assign pin */ PTable[pos].pin = pinct; /* assign name */ memcpy(PTable[pos].name, pname, 8); /* assign state of NEW */ PTable[pos].state = NEW; /* allocate stack space */ PTable[pos].kernal = getmem_(0x1000); if (ustack == 0) PTable[pos].user = getmem_(0x1000); else PTable[pos].user = ustack; /* copy contents of parameter array on to user stack */ memcpy(PTable[pos].user, argptr, narg*4); /* initialize PSW */ PTable[pos].psw[0] = psw[0]; PTable[pos].psw[1] = psw[1]; /* initialize registers */ for (i=0; i<16; i++) PTable[pos].regs[i] = 0xFAFAFAFA; PTable[pos].regs[11] = psw[1]; PTable[pos].regs[12] = (unsigned int)PTable[pos].user; PTable[pos].regs[13] = (int)KILL; /* initialize semact and owned semaphore array */ PTable[pos].semact = 0; for (i=0; i<MAXSEMAS; i++) PTable[pos].owns[i] = NULL; /* initialize OKToSend and OKToRecieve semaphores */ PTable[pos].OKToSend = getsem_(0, &(PTable[pos])); PTable[pos].OKToReceive = getsem_(0, &PTable[pos]); /* initialize msglen and SenderPIN to 0 */ PTable[pos].msglen = 0; PTable[pos].SenderPIN = 0; /* place the new process on the ready Q */ enQ(&(PTable[pos]), &Ready); return pinct; } } /* end create_() */
void denominatorStatistic(int nsub, int * n_swidth, int *n_twidth, int * n_0width, denlist * allDenominators, FILE * fd) { int i; catrec cr; denlist den_, den_tmp; deninforec dendescript={0}; (*n_swidth) = 0; (*n_twidth) = 0; (*n_0width) = 0; den_ =NULL; fseek(catalog,0,SEEK_SET); while (FREAD1(cr,catalog)) { if (cr.nsub_ == nsub) { whichArchive(cr.nFile,'r'); dendescript.cr_pos = ftell(catalog) - sizeof(cr); fseek(archiv,cr.denompos,SEEK_SET); readDenominators(); dendescript.tot_den=denrno; for (i = 0; i < dendescript.tot_den; i++) { dendescript.denarr[i].power=denom[i].power; dendescript.denarr[i].width=denom[i].width; den_tmp = den_; while (den_tmp != NULL && ( strcmp(denom[i].momStr,den_tmp->momStr) || denom[i].mass!=den_tmp->mass || denom[i].width!=den_tmp->width ) ) den_tmp=den_tmp->next; if(den_tmp == NULL) { den_tmp = (denlist)getmem_((unsigned)sizeof(denlistrec)); den_tmp->next = den_; strcpy(den_tmp->momStr,denom[i].momStr); den_tmp->mass=denom[i].mass; den_tmp->width=denom[i].width; den_tmp->stype= stype(denom[i].momStr); den_ = den_tmp; if(denom[i].width) { if(den_tmp->stype) den_tmp->order_num= ++(*n_swidth); else den_tmp->order_num= ++(*n_twidth); } else den_tmp->order_num= ++(*n_0width); } dendescript.denarr[i].order_num=den_tmp->order_num; dendescript.denarr[i].stype=den_tmp->stype; } if(fd) FWRITE1(dendescript,fd); } /* if CR.nsub_ =nsub */ } /* if(ArchNum) fclose(archiv); */ whichArchive(0,0); *allDenominators=den_; }