Annotation of researchv10no/cmd/pret/pret4.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: #include "pret.h"
                      3: 
                      4: struct PROCTABLE proctable[MAXPROC];           /* index to process names */
                      5: 
                      6: int nrprocs = 0;
                      7: 
                      8: procsize(n, m, k)
                      9: {      proctable[n].nrstates = m;
                     10:        proctable[n].unreach = k;
                     11: }
                     12: 
                     13: newprocname(str, repl)
                     14:        char *str;
                     15: { register int i;
                     16: 
                     17:        for (i = 0; i < nrprocs; i++)
                     18:                if (strcmp(str, proctable[i].name) == 0)
                     19:                        break;
                     20: 
                     21:        if (i == nrprocs)
                     22:        {       if (nrprocs >= MAXPROC)
                     23:                        whoops("too many processes");
                     24:                proctable[i].nrstates = 0;
                     25:                proctable[i].unreach = 0;
                     26:                proctable[i].replic = repl;
                     27:                strcpy(proctable[nrprocs++].name, str);
                     28:        } else
                     29:                yyerror("process redeclared, %s", str);
                     30: 
                     31:        return i;
                     32: }
                     33: 
                     34: numprocs(fd)
                     35:        FILE *fd;
                     36: {
                     37:        extern int extras;
                     38:        fprintf(fd, "%d processes\n", nrprocs+extras);
                     39: }
                     40: 
                     41: chatter()
                     42: {      int i;
                     43:        extern int verbose, nrqs, nrmesgs, nrrefs, assertion, inertion, extras;
                     44: 
                     45:        if (verbose)
                     46:        {       i = ((assertion != -1) + (inertion != -1));
                     47:                printf("\nOverview:\n========\n");
                     48:                printf("%d queue%s:\n", nrqs, (nrqs==1)?"":"s");
                     49:                listqs();
                     50:                printf("%d process%s:\n",
                     51:                                nrprocs+extras, (nrprocs+extras==1)?"":"es");
                     52:                listprs();
                     53:                printf("%d procedure%s:\n", nrrefs, (nrrefs==1)?"":"s");
                     54:                listrefs();
                     55:                printf("%d assertion%s\n", i, (i==1)?"":"s");
                     56:        }
                     57: }
                     58: 
                     59: listprs()
                     60: {      int i, k;
                     61: 
                     62:        for (i = 0; i < nrprocs; i++)
                     63:        {       printf("\t%2d", i+1);
                     64:                if (proctable[i].replic != NONE)
                     65:                        printf("x%d", proctable[i].replic);
                     66:                printf("\t%s, ", proctable[i].name);
                     67:                for (k = strlen(proctable[i].name)+1; k < 10; k++)
                     68:                        putchar(' ');
                     69:                k = proctable[i].nrstates;
                     70:                printf("%d state%s", k, (k!=1)?"s":"");
                     71:                if ((k = proctable[i].unreach) > 0)
                     72:                        printf(" (%d unreachable state%s)", k, (k>1)?"s":"");
                     73:                putchar('\n');
                     74:        }
                     75: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.