1 #include "defs.h"
2 
3 # define   MSP    2500000
4 # define    MM      400
5 # define    MV     25000
6 # define   NPT     4000
7 # define   PSP    1000000
8 # define  SVSP     75000
9 # define    MP      500
10 # define  MPR       500
11 # define  MDIM       300
12 # define    MB       80
13 char slg,con,check,inf1[80],inf2[80],inf3[80],inf4[80],inf5[80],inf6[80],
14      outf1[80];
15 /* inf1 always gpname.inmat
16    inf2 always gpname.words
17    inf3 gpname.sg (but gpname.outperm if -o set)
18    inf4 given as arguments (see Info.3)
19 Warning: Sequence of arguments must be as described in Info.3, or
20          chaos will result.
21    inf5 used to remember gpname
22    inf6 =gpname.sg.rel if -t set. later =gpname.cbmats.
23    outf1 = inf4"mat"
24 */
25 int msp=MSP,psp=PSP,svsp=SVSP;
26 short mm=MM,mv=MV,mp=MP,mpt=NPT,
27       mpr=MPR,mdim=MDIM,mb=MB,
28       mspace[MSP],*vec[MV],**mat[MM],pinv[MPR],perm[PSP],sv[SVSP],cp[5*NPT],
29       *pptr[MP],*svptr[MB],base[MB],lorb[MB];
30 
31 int
main(int argc,char * argv[])32 main (int argc, char *argv[])
33 { short arg;  char c,err;
34   check=0; err=0; arg=1; if (argc<=arg) {err=1; goto error;}
35   slg=1;
36   c=argv[arg][0];
37   while (c=='-')
38   { c=argv[arg][1]; if (c=='o') slg=0;
39     else if (c=='t') check=1;
40     else {err=1; goto error; }
41     arg++; if (argc<=arg) {err=1; goto error; }
42     c=argv[arg][0];
43   }
44   strcpy(inf1,argv[arg]);strcat(inf1,".");strcpy(inf2,inf1);strcpy(inf3,inf1);
45   strcpy(inf4,inf1); strcpy(inf5,inf1); strcpy(inf6,inf1);
46   strcat(inf1,"inmat"); strcat(inf2,"words");
47   if (slg) strcat(inf3,"sg"); else strcat(inf3,"outperm");
48   if (check) strcat(inf6,"sg.rel");
49   if (mcprog()== -1) exit(1);
50   while(1)
51 /* Generate filenames for conprog
52    con is set 1 when argument "pg" is encountered.
53    At this stage, all matrices are inverted and transposed, and
54    basis changes to the module are made to triangularize the action
55    of P, and provide definitions in the PCP of P.d(M)
56    if the filename is preceded by a '-', then con is put =2,
57    and inverses of matrices are output.
58 */
59   { arg++; if (argc<=arg) break;
60     if (strcmp(argv[arg],"pg")==0)
61     { con=1; strcpy(inf6,inf5); strcat(inf6,"cbmats");}
62     else if (argv[arg][0]=='-') con=2;
63     else con=0;
64     strcpy(inf4,inf5);
65     if (con==2) strcat(inf4,argv[arg]+1); else strcat(inf4,argv[arg]);
66     strcpy(outf1,inf4); strcat(outf1,"mat");
67     if (conprog(con)== -1) exit(1);
68   }
69 error:
70   if (err)
71   { fprintf(stderr,"Usage:    matcalc [-o] [-t] gpname\n");
72     fprintf(stderr," [inf4] [inf4] ...\n");
73     exit(1);
74   }
75   else exit(0);
76 }
77