1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | static char rcsid[] = "$Header: /exports/cvsroot-2/cvsroot/Singular/tesths.cc,v 1.1.1.1 1997-03-19 13:18:43 obachman Exp $"; |
---|
5 | /* $Log: not supported by cvs2svn $ |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * ABSTRACT - initialize SINGULARs components, run Script and start SHELL |
---|
10 | */ |
---|
11 | |
---|
12 | #define S_VERSION1 "version: 0.9.3" |
---|
13 | #define S_VERSION2 "February 1997" |
---|
14 | |
---|
15 | #ifndef macintosh |
---|
16 | #include <unistd.h> |
---|
17 | #endif |
---|
18 | #include <string.h> |
---|
19 | #include <stdio.h> |
---|
20 | #include <stddef.h> |
---|
21 | #include <stdlib.h> |
---|
22 | #include <time.h> |
---|
23 | |
---|
24 | #include "mod2.h" |
---|
25 | #include "tok.h" |
---|
26 | #include "ipshell.h" |
---|
27 | #include "febase.h" |
---|
28 | #include "cntrlc.h" |
---|
29 | #include "mmemory.h" |
---|
30 | #include "version.h" |
---|
31 | #include "silink.h" |
---|
32 | |
---|
33 | /*0 implementation*/ |
---|
34 | |
---|
35 | int sVERSION=VERSION; |
---|
36 | int sS_SUBVERSION=S_SUBVERSION; |
---|
37 | int main( /* main entry to Singular */ |
---|
38 | int argc, /* number of parameter */ |
---|
39 | char** argv) /* parameter array */ |
---|
40 | { |
---|
41 | /*. initialize components */ |
---|
42 | siRandomStart=inits(); |
---|
43 | #ifdef INIT_BUG |
---|
44 | jjInitTab1(); |
---|
45 | #endif |
---|
46 | #ifdef GENTABLE |
---|
47 | extern ttGen1(); |
---|
48 | extern ttGen2(); |
---|
49 | #ifdef HAVE_MPSR |
---|
50 | extern mpsr_ttGen(); // For initialization of (CMD, MP_COP) tables |
---|
51 | mpsr_ttGen(); |
---|
52 | #endif |
---|
53 | ttGen1(); |
---|
54 | ttGen2(); |
---|
55 | #else |
---|
56 | int i; |
---|
57 | char * thisfile = argv[0]; |
---|
58 | /*. process parameters */ |
---|
59 | for (;(argc > 1) && (!feBatch); --argc, ++argv) |
---|
60 | { |
---|
61 | if ((argv[1][0] != '-') ||(argv[1][1] == '-')) |
---|
62 | break; |
---|
63 | for (i=1;argv[1][i]!='\0';i++) |
---|
64 | { |
---|
65 | switch (argv[1][i]) |
---|
66 | { |
---|
67 | case 'V': |
---|
68 | case 'v':{ |
---|
69 | printf("Singular %s%c %s(%d) %s %s\n", |
---|
70 | S_VERSION1,(VERSION%10)+'a',S_VERSION2, |
---|
71 | S_SUBVERSION,__DATE__,__TIME__); |
---|
72 | printf("with "); |
---|
73 | #ifdef HAVE_LIBFACTORY |
---|
74 | printf("factory,"); |
---|
75 | #endif |
---|
76 | #ifdef HAVE_LIBFACTORY |
---|
77 | printf("fac(p),"); |
---|
78 | #endif |
---|
79 | #ifdef SRING |
---|
80 | printf("super algebra,"); |
---|
81 | #endif |
---|
82 | #ifdef DRING |
---|
83 | printf("Weyl algebra,"); |
---|
84 | #endif |
---|
85 | #ifdef HAVE_GMP |
---|
86 | printf("GMP,"); |
---|
87 | #endif |
---|
88 | #ifdef HAVE_DBM |
---|
89 | printf("DBM,"); |
---|
90 | #endif |
---|
91 | #ifdef HAVE_MPSR |
---|
92 | printf("MP,"); |
---|
93 | #endif |
---|
94 | #ifdef HAVE_READLINE |
---|
95 | printf("RL,"); |
---|
96 | #endif |
---|
97 | #ifdef HAVE_FEREAD |
---|
98 | printf("SRL,"); |
---|
99 | #endif |
---|
100 | #ifdef TEST |
---|
101 | printf("TESTs,"); |
---|
102 | #endif |
---|
103 | #if YYDEBUG |
---|
104 | printf("YYDEBUG,"); |
---|
105 | #endif |
---|
106 | #ifdef MDEBUG |
---|
107 | printf("MDEBUG=%d,",MDEBUG); |
---|
108 | #endif |
---|
109 | #ifndef __OPTIMIZE__ |
---|
110 | printf("-g,"); |
---|
111 | #endif |
---|
112 | printf("random=%d\n",siRandomStart); |
---|
113 | #ifdef MSDOS |
---|
114 | char *p=getenv("SPATH"); |
---|
115 | #else |
---|
116 | char *p=getenv("SingularPath"); |
---|
117 | #endif |
---|
118 | if (p!=NULL) |
---|
119 | printf("search path:%s\n\n",p); |
---|
120 | else |
---|
121 | printf("standard search path:/usr/local/Singular\n\n"); |
---|
122 | break; |
---|
123 | } |
---|
124 | case 'e': if ((argv[1][i+1]>'0') && (argv[1][i+1]<='9')) |
---|
125 | { |
---|
126 | i++; |
---|
127 | si_echo = (int)(argv[1][i] - '0'); |
---|
128 | } |
---|
129 | else si_echo = 2; |
---|
130 | break; |
---|
131 | case 'r': siRandomStart = 0; |
---|
132 | while((argv[1][i+1]>='0') && (argv[1][i+1]<='9')) |
---|
133 | { |
---|
134 | i++; |
---|
135 | siRandomStart = siRandomStart*10+(int)(argv[1][i] - '0'); |
---|
136 | } |
---|
137 | #ifdef buildin_rand |
---|
138 | siSeed=siRandomStart; |
---|
139 | #else |
---|
140 | srand((unsigned int)siRandomStart); |
---|
141 | #endif |
---|
142 | break; |
---|
143 | case 'x': tclmode=TRUE; |
---|
144 | break; |
---|
145 | #ifdef HAVE_MPSR |
---|
146 | case 'b': feBatch=TRUE; |
---|
147 | #endif |
---|
148 | case 'q': verbose &= ~(Sy_bit(0)|Sy_bit(V_LOAD_LIB)); |
---|
149 | break; |
---|
150 | case 't': |
---|
151 | #ifdef HAVE_FEREAD |
---|
152 | fe_use_fgets=TRUE; |
---|
153 | #endif |
---|
154 | break; |
---|
155 | default : printf("Unknown option -%c\n",argv[1][i]); |
---|
156 | printf("Usage: %s [-bteqvx] [file]\n",thisfile); |
---|
157 | exit(1); |
---|
158 | } |
---|
159 | } |
---|
160 | } |
---|
161 | |
---|
162 | /*. say hello */ |
---|
163 | if (BVERBOSE(0)) |
---|
164 | { |
---|
165 | printf( |
---|
166 | " Welcome to SINGULAR /\n" |
---|
167 | " A Computer Algebra System o<\n" |
---|
168 | " for Algebraic Geometry and Singularity Theory \\\n\n" |
---|
169 | "by: G.-M. Greuel, G. Pfister, H. Schoenemann\n" |
---|
170 | "Fachbereich Mathematik der Universitaet, D-67653 Kaiserslautern\n" |
---|
171 | "contributions: O.Bachmann,W.Decker,H.Grassmann,B.Martin,M.Messollen,W.Neumann,\n" |
---|
172 | "W.Pohl,T.Siebert,R.Stobbe e-mail: singular@mathematik.uni-kl.de\n"); |
---|
173 | printf("%s%c %s",S_VERSION1,VERSION%10+'a',S_VERSION2); |
---|
174 | printf(" (%d)\n\nPlease note: EVERY COMMAND MUST END WITH A SEMICOLON \";" |
---|
175 | "\"\n(e.g. help; help command; help General syntax; help ring; quit;)\n\n", |
---|
176 | S_SUBVERSION); |
---|
177 | } |
---|
178 | else |
---|
179 | if (!feBatch) |
---|
180 | { |
---|
181 | #ifdef macintosh |
---|
182 | memcpy(stderr,stdout,sizeof(FILE)); |
---|
183 | #else |
---|
184 | dup2(1,2); |
---|
185 | #endif |
---|
186 | } |
---|
187 | slStandardInit(); |
---|
188 | #ifdef HAVE_DLD |
---|
189 | dlInit(thisfile); |
---|
190 | #endif |
---|
191 | myynest=0; |
---|
192 | /* if script is given */ |
---|
193 | if ((argc > 1)&&(argv[1][0]!='-')) |
---|
194 | { |
---|
195 | /* read and run the Script */ |
---|
196 | iiPStart(NULL,argv[1],NULL); |
---|
197 | } |
---|
198 | /* start shell */ |
---|
199 | #ifdef HAVE_MPSR |
---|
200 | if (feBatch) |
---|
201 | { |
---|
202 | return Batch_do(argc,argv); |
---|
203 | } |
---|
204 | #endif |
---|
205 | #ifndef macintosh |
---|
206 | #if defined(HAVE_FEREAD) || defined(HAVE_READLINE) |
---|
207 | fe_set_input_mode(); |
---|
208 | #endif |
---|
209 | #endif |
---|
210 | yyparse(); |
---|
211 | #endif |
---|
212 | return 0; |
---|
213 | } |
---|