1 | /***************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | *****************************************/ |
---|
4 | /* $Id: extra.cc,v 1.27 1998-01-16 14:29:47 krueger Exp $ */ |
---|
5 | /* |
---|
6 | * ABSTRACT: general interface to internals of Singular ("system" command) |
---|
7 | */ |
---|
8 | |
---|
9 | #include <stdlib.h> |
---|
10 | #include <stdio.h> |
---|
11 | #include <string.h> |
---|
12 | #include <ctype.h> |
---|
13 | #include "mod2.h" |
---|
14 | |
---|
15 | #ifndef macintosh |
---|
16 | #ifdef TIME_WITH_SYS_TIME |
---|
17 | # include <time.h> |
---|
18 | # ifdef HAVE_SYS_TIME_H |
---|
19 | # include <sys/time.h> |
---|
20 | # endif |
---|
21 | #else |
---|
22 | # ifdef HAVE_SYS_TIME_H |
---|
23 | # include <sys/time.h> |
---|
24 | # else |
---|
25 | # include <time.h> |
---|
26 | # endif |
---|
27 | #endif |
---|
28 | #ifdef HAVE_SYS_TIMES_H |
---|
29 | #include <sys/times.h> |
---|
30 | #endif |
---|
31 | |
---|
32 | #include <unistd.h> |
---|
33 | #endif |
---|
34 | |
---|
35 | #include "tok.h" |
---|
36 | #include "ipid.h" |
---|
37 | #include "polys.h" |
---|
38 | #include "kutil.h" |
---|
39 | #include "cntrlc.h" |
---|
40 | #include "stairc.h" |
---|
41 | #include "ipshell.h" |
---|
42 | #include "algmap.h" |
---|
43 | #include "modulop.h" |
---|
44 | #include "febase.h" |
---|
45 | #include "matpol.h" |
---|
46 | #include "longalg.h" |
---|
47 | #include "ideals.h" |
---|
48 | #include "kstd1.h" |
---|
49 | #include "syz.h" |
---|
50 | #include "polys.h" |
---|
51 | |
---|
52 | #ifdef STDTRACE |
---|
53 | //#include "comm.h" |
---|
54 | #endif |
---|
55 | |
---|
56 | #ifdef HAVE_FACTORY |
---|
57 | #define SI_DONT_HAVE_GLOBAL_VARS |
---|
58 | #include "clapsing.h" |
---|
59 | #include "clapconv.h" |
---|
60 | #include "kstdfac.h" |
---|
61 | #include "fglmcomb.cc" |
---|
62 | #include "fglm.h" |
---|
63 | #endif |
---|
64 | |
---|
65 | #include "silink.h" |
---|
66 | #include "mpsr.h" |
---|
67 | |
---|
68 | //void emStart(); |
---|
69 | /*2 |
---|
70 | * the "system" command |
---|
71 | */ |
---|
72 | BOOLEAN jjSYSTEM(leftv res, leftv h) |
---|
73 | { |
---|
74 | if(h->Typ() == STRING_CMD) |
---|
75 | { |
---|
76 | /*==================== lib ==================================*/ |
---|
77 | if(strcmp((char*)(h->Data()),"LIB")==0) |
---|
78 | { |
---|
79 | idhdl hh=idroot->get((char*)h->next->Data(),0); |
---|
80 | if ((hh!=NULL)&&(IDTYP(hh)==PROC_CMD)) |
---|
81 | { |
---|
82 | res->rtyp=STRING_CMD; |
---|
83 | res->data=mstrdup(iiGetLibName(IDPROC(hh))); |
---|
84 | if (res->data==NULL) res->data=mstrdup(""); |
---|
85 | return FALSE; |
---|
86 | } |
---|
87 | else |
---|
88 | Warn("`%s` not found",(char*)h->next->Data()); |
---|
89 | } |
---|
90 | else |
---|
91 | /*==================== proclist =================================*/ |
---|
92 | if(strcmp((char*)(h->Data()),"proclist")==0) |
---|
93 | { |
---|
94 | int piShowProcList(); |
---|
95 | res->rtyp=STRING_CMD; |
---|
96 | res->data=(void *)mstrdup(""); |
---|
97 | piShowProcList(); |
---|
98 | return FALSE; |
---|
99 | } |
---|
100 | else |
---|
101 | /*==================== version ==================================*/ |
---|
102 | if(strcmp((char*)(h->Data()),"version")==0) |
---|
103 | { |
---|
104 | res->rtyp=INT_CMD; |
---|
105 | res->data=(void *)SINGULAR_VERSION; |
---|
106 | return FALSE; |
---|
107 | } |
---|
108 | else |
---|
109 | /*==================== gen ==================================*/ |
---|
110 | if(strcmp((char*)(h->Data()),"gen")==0) |
---|
111 | { |
---|
112 | res->rtyp=INT_CMD; |
---|
113 | res->data=(void *)npGen; |
---|
114 | return FALSE; |
---|
115 | } |
---|
116 | else |
---|
117 | /*==================== sh ==================================*/ |
---|
118 | #ifndef macintosh |
---|
119 | if(strcmp((char*)(h->Data()),"sh")==0) |
---|
120 | { |
---|
121 | #ifndef MSDOS |
---|
122 | #ifdef HAVE_FEREAD |
---|
123 | fe_temp_reset(); |
---|
124 | #endif |
---|
125 | #endif |
---|
126 | res->rtyp=INT_CMD; |
---|
127 | if (h->next==NULL) res->data = (void *)system("/bin/sh"); |
---|
128 | else res->data = (void*) system((char*)(h->next->Data())); |
---|
129 | #ifndef MSDOS |
---|
130 | #ifdef HAVE_FEREAD |
---|
131 | fe_temp_set(); |
---|
132 | #endif |
---|
133 | #endif |
---|
134 | return FALSE; |
---|
135 | } |
---|
136 | else |
---|
137 | #endif |
---|
138 | /*==================== with ==================================*/ |
---|
139 | if(strcmp((char*)(h->Data()),"with")==0) |
---|
140 | { |
---|
141 | if (h->next==NULL) |
---|
142 | { |
---|
143 | res->rtyp=STRING_CMD; |
---|
144 | res->data=(void *)mstrdup(versionString()); |
---|
145 | return FALSE; |
---|
146 | } |
---|
147 | else if (h->next->Typ()==STRING_CMD) |
---|
148 | { |
---|
149 | #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else |
---|
150 | char *s=(char *)h->next->Data(); |
---|
151 | res->rtyp=INT_CMD; |
---|
152 | #ifdef DRING |
---|
153 | TEST_FOR("DRING") |
---|
154 | #endif |
---|
155 | #ifdef HAVE_DBM |
---|
156 | TEST_FOR("DBM") |
---|
157 | #endif |
---|
158 | #ifdef HAVE_DLD |
---|
159 | TEST_FOR("DLD") |
---|
160 | #endif |
---|
161 | #ifdef HAVE_GMP |
---|
162 | TEST_FOR("gmp") |
---|
163 | #endif |
---|
164 | #ifdef HAVE_FACTORY |
---|
165 | TEST_FOR("factory") |
---|
166 | #endif |
---|
167 | #ifdef HAVE_LIBFAC_P |
---|
168 | TEST_FOR("libfac") |
---|
169 | #endif |
---|
170 | #ifdef HAVE_MPSR |
---|
171 | TEST_FOR("MP") |
---|
172 | #endif |
---|
173 | #ifdef HAVE_READLINE |
---|
174 | TEST_FOR("readline") |
---|
175 | #endif |
---|
176 | #ifdef HAVE_TCL |
---|
177 | TEST_FOR("tcl") |
---|
178 | #endif |
---|
179 | #ifdef SRING |
---|
180 | TEST_FOR("SRING") |
---|
181 | #endif |
---|
182 | #ifdef TEST_MAC_ORDER |
---|
183 | TEST_FOR("MAC_ORDER"); |
---|
184 | #endif |
---|
185 | ; |
---|
186 | return FALSE; |
---|
187 | #undef TEST_FOR |
---|
188 | } |
---|
189 | return TRUE; |
---|
190 | } |
---|
191 | else |
---|
192 | /*==================== pid ==================================*/ |
---|
193 | #ifndef MSDOS |
---|
194 | #ifndef macintosh |
---|
195 | if (strcmp((char*)(h->Data()),"pid")==0) |
---|
196 | { |
---|
197 | res->rtyp=INT_CMD; |
---|
198 | res->data=(void *)getpid(); |
---|
199 | return FALSE; |
---|
200 | } |
---|
201 | else |
---|
202 | #endif |
---|
203 | #endif |
---|
204 | /*==================== getenv ==================================*/ |
---|
205 | if (strcmp((char*)(h->Data()),"getenv")==0) |
---|
206 | { |
---|
207 | if ((h->next!=NULL) && (h->next->Typ()==STRING_CMD)) |
---|
208 | { |
---|
209 | res->rtyp=STRING_CMD; |
---|
210 | char *r=getenv((char *)h->next->Data()); |
---|
211 | if (r==NULL) r=""; |
---|
212 | res->data=(void *)mstrdup(r); |
---|
213 | return FALSE; |
---|
214 | } |
---|
215 | else |
---|
216 | { |
---|
217 | WerrorS("string expected"); |
---|
218 | } |
---|
219 | } |
---|
220 | else |
---|
221 | /*==================== tty ==================================*/ |
---|
222 | #ifndef macintosh |
---|
223 | #ifndef MSDOS |
---|
224 | if (strcmp((char*)(h->Data()),"tty")==0) |
---|
225 | { |
---|
226 | #ifdef HAVE_FEREAD |
---|
227 | #ifdef HAVE_ATEXIT |
---|
228 | fe_reset_input_mode(); |
---|
229 | #else |
---|
230 | fe_reset_input_mode(0,NULL); |
---|
231 | #endif |
---|
232 | #elif defined(HAVE_READLINE) |
---|
233 | system("stty sane"); |
---|
234 | #endif |
---|
235 | if ((h->next!=NULL)&&(h->next->Typ()==INT_CMD)) |
---|
236 | { |
---|
237 | fe_use_fgets=(int)h->next->Data(); |
---|
238 | fe_set_input_mode(); |
---|
239 | } |
---|
240 | return FALSE; |
---|
241 | } |
---|
242 | else |
---|
243 | #endif |
---|
244 | #endif |
---|
245 | /*==================== HC ==================================*/ |
---|
246 | if (strcmp((char*)(h->data),"HC")==0) |
---|
247 | { |
---|
248 | res->rtyp=INT_CMD; |
---|
249 | res->data=(void *)HCord; |
---|
250 | return FALSE; |
---|
251 | } |
---|
252 | else |
---|
253 | /*==================== random ==================================*/ |
---|
254 | if(strcmp((char*)(h->Data()),"random")==0) |
---|
255 | { |
---|
256 | if ((h->next!=NULL) &&(h->next->Typ()==INT_CMD)) |
---|
257 | { |
---|
258 | siRandomStart=(int)h->next->Data(); |
---|
259 | #ifdef buildin_rand |
---|
260 | siSeed=siRandomStart; |
---|
261 | #else |
---|
262 | srand((unsigned int)siRandomStart); |
---|
263 | #endif |
---|
264 | return FALSE; |
---|
265 | } |
---|
266 | else |
---|
267 | WerrorS("int expected"); |
---|
268 | } |
---|
269 | else |
---|
270 | /*==================== LaScala ==================================*/ |
---|
271 | if(strcmp((char*)(h->Data()),"LaScala")==0) |
---|
272 | { |
---|
273 | if ((h->next!=NULL) |
---|
274 | &&((h->next->Typ()==IDEAL_CMD)||(h->next->Typ()==MODUL_CMD))) |
---|
275 | { |
---|
276 | int dummy; |
---|
277 | res->data=(void *)syLaScala3((ideal)h->next->Data(),&dummy); |
---|
278 | mmTest(res->data,sizeof(ssyStrategy)); |
---|
279 | syStrategy s=(syStrategy)res->data; |
---|
280 | for (int i=s->length;i>=0;i--) |
---|
281 | { |
---|
282 | if (s->res[i]!=NULL) |
---|
283 | idTest(s->res[i]); |
---|
284 | } |
---|
285 | res->rtyp=RESOLUTION_CMD; |
---|
286 | return FALSE; |
---|
287 | } |
---|
288 | else |
---|
289 | WerrorS("ideal/module expected"); |
---|
290 | } |
---|
291 | else |
---|
292 | /*==================== naIdeal ==================================*/ |
---|
293 | if(strcmp((char*)(h->Data()),"naIdeal")==0) |
---|
294 | { |
---|
295 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
296 | { |
---|
297 | naSetIdeal((ideal)h->next->Data()); |
---|
298 | return FALSE; |
---|
299 | } |
---|
300 | else |
---|
301 | WerrorS("ideal expected"); |
---|
302 | } |
---|
303 | else |
---|
304 | /*==================== isSqrFree =============================*/ |
---|
305 | #ifdef HAVE_FACTORY |
---|
306 | if(strcmp((char*)(h->Data()),"isSqrFree")==0) |
---|
307 | { |
---|
308 | if ((h->next!=NULL) &&(h->next->Typ()==POLY_CMD)) |
---|
309 | { |
---|
310 | res->rtyp=INT_CMD; |
---|
311 | res->data=(void *)singclap_isSqrFree((poly)h->next->Data()); |
---|
312 | return FALSE; |
---|
313 | } |
---|
314 | else |
---|
315 | WerrorS("poly expected"); |
---|
316 | } |
---|
317 | else |
---|
318 | #endif |
---|
319 | /*==================== neworder =============================*/ |
---|
320 | #ifdef HAVE_LIBFAC_P |
---|
321 | if(strcmp((char*)(h->Data()),"neworder")==0) |
---|
322 | { |
---|
323 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
324 | { |
---|
325 | res->rtyp=STRING_CMD; |
---|
326 | res->data=(void *)singclap_neworder((ideal)h->next->Data()); |
---|
327 | return FALSE; |
---|
328 | } |
---|
329 | else |
---|
330 | WerrorS("ideal expected"); |
---|
331 | } |
---|
332 | else |
---|
333 | #endif |
---|
334 | /*==================== alarm ==================================*/ |
---|
335 | #ifndef macintosh |
---|
336 | #ifndef MSDOS |
---|
337 | #ifndef atarist |
---|
338 | #ifdef unix |
---|
339 | if(strcmp((char*)(h->Data()),"alarm")==0) |
---|
340 | { |
---|
341 | if ((h->next!=NULL) &&(h->next->Typ()==INT_CMD)) |
---|
342 | { |
---|
343 | // standard variant -> SIGALARM (standard: abort) |
---|
344 | //alarm((unsigned)h->next->Data()); |
---|
345 | // process time (user +system): SIGVTALARM |
---|
346 | struct itimerval t,o; |
---|
347 | memset(&t,0,sizeof(t)); |
---|
348 | t.it_value.tv_sec =(unsigned)h->next->Data(); |
---|
349 | setitimer(ITIMER_VIRTUAL,&t,&o); |
---|
350 | return FALSE; |
---|
351 | } |
---|
352 | else |
---|
353 | WerrorS("int expected"); |
---|
354 | } |
---|
355 | else |
---|
356 | #endif |
---|
357 | #endif |
---|
358 | #endif |
---|
359 | #endif |
---|
360 | /*==================== red =============================*/ |
---|
361 | #if 0 |
---|
362 | if(strcmp((char*)(h->Data()),"red")==0) |
---|
363 | { |
---|
364 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
365 | { |
---|
366 | res->rtyp=IDEAL_CMD; |
---|
367 | res->data=(void *)stdred((ideal)h->next->Data(),NULL,testHomog,NULL); |
---|
368 | setFlag(res,FLAG_STD); |
---|
369 | return FALSE; |
---|
370 | } |
---|
371 | else |
---|
372 | WerrorS("ideal expected"); |
---|
373 | } |
---|
374 | else |
---|
375 | #endif |
---|
376 | /*==================== writemat ==================================*/ |
---|
377 | // if(strcmp((char*)(h->Data()),"writemat")==0) |
---|
378 | // { |
---|
379 | // if (h->next!=NULL) |
---|
380 | // { |
---|
381 | // leftv v=h->next; |
---|
382 | // if (v->Typ() == STRING_CMD) |
---|
383 | // { |
---|
384 | // char *filename = (char *)v->Data(); |
---|
385 | // v = v->next; |
---|
386 | // if (v->Typ()==MATRIX_CMD) |
---|
387 | // { |
---|
388 | // FILE *outfile = fopen(filename,"a"); |
---|
389 | // if (outfile==NULL) |
---|
390 | // { |
---|
391 | // Werror("cannot write to file %s",filename); |
---|
392 | // return TRUE; |
---|
393 | // } |
---|
394 | // matrix m=(matrix)v->Data(); |
---|
395 | // fprintf(outfile,"%d\n%d\n",MATROWS(m),MATCOLS(m)); |
---|
396 | // char *s = iiStringMatrix(m,2); |
---|
397 | // fprintf(outfile,"%s\n",s); |
---|
398 | // FreeL((ADDRESS)s); |
---|
399 | // fclose(outfile); |
---|
400 | // return FALSE; |
---|
401 | // } |
---|
402 | // else |
---|
403 | // { |
---|
404 | // WerrorS("matrix expected"); |
---|
405 | // } |
---|
406 | // } |
---|
407 | // else |
---|
408 | // { |
---|
409 | // WerrorS("string expected"); |
---|
410 | // } |
---|
411 | // } |
---|
412 | // else |
---|
413 | // WerrorS("matrix expected"); |
---|
414 | // } |
---|
415 | // else |
---|
416 | #ifdef HAVE_FACTORY |
---|
417 | /*==================== pdivide ====================*/ |
---|
418 | if (strcmp((char*)(h->Data()),"pdivide")==0) |
---|
419 | { |
---|
420 | if (h->next!=NULL && h->next->next!=NULL && |
---|
421 | h->next->Typ()==POLY_CMD && h->next->next->Typ()==POLY_CMD) |
---|
422 | { |
---|
423 | res->rtyp=POLY_CMD; |
---|
424 | res->data=(void*)(singclap_pdivide((poly)(h->next->Data()), |
---|
425 | (poly)(h->next->next->Data()))); |
---|
426 | return FALSE; |
---|
427 | } |
---|
428 | else |
---|
429 | WerrorS("poly expected"); |
---|
430 | } |
---|
431 | else |
---|
432 | #endif |
---|
433 | /*==================== algfetch =====================*/ |
---|
434 | if (strcmp((char*)(h->Data()),"algfetch")==0) |
---|
435 | { |
---|
436 | int k; |
---|
437 | idhdl w; |
---|
438 | ideal i0, i1; |
---|
439 | leftv v=h->next; |
---|
440 | ring r0=(ring)v->Data(); |
---|
441 | v = v->next; |
---|
442 | w = r0->idroot->get(v->Name(),myynest); |
---|
443 | i0 = IDIDEAL(w); |
---|
444 | i1 = idInit(IDELEMS(i0),i0->rank); |
---|
445 | for (k=0; k<IDELEMS(i1); k++) |
---|
446 | { |
---|
447 | i1->m[k] = maAlgpolyFetch(r0, i0->m[k]); |
---|
448 | } |
---|
449 | res->rtyp = IDEAL_CMD; |
---|
450 | res->data = (void*)i1; |
---|
451 | return FALSE; |
---|
452 | } |
---|
453 | else |
---|
454 | /*==================== algmap =======================*/ |
---|
455 | if (strcmp((char*)(h->Data()),"algmap")==0) |
---|
456 | { |
---|
457 | int k; |
---|
458 | idhdl w; |
---|
459 | ideal i0, i1, i, j; |
---|
460 | leftv v=h->next; |
---|
461 | ring r0=(ring)v->Data(); |
---|
462 | v = v->next; |
---|
463 | w = r0->idroot->get(v->Name(),myynest); |
---|
464 | i0 = IDIDEAL(w); |
---|
465 | v = v->next; |
---|
466 | i = (ideal)v->Data(); |
---|
467 | v = v->next; |
---|
468 | j = (ideal)v->Data(); |
---|
469 | i1 = idInit(IDELEMS(i0),i0->rank); |
---|
470 | for (k=0; k<IDELEMS(i1); k++) |
---|
471 | { |
---|
472 | i1->m[k] = maAlgpolyMap(r0, i0->m[k], i, j); |
---|
473 | } |
---|
474 | res->rtyp = IDEAL_CMD; |
---|
475 | res->data = (void*)i1; |
---|
476 | return FALSE; |
---|
477 | } |
---|
478 | else |
---|
479 | /*==================== indsetall =============================*/ |
---|
480 | if(strcmp((char*)(h->Data()),"indsetall")==0) |
---|
481 | { |
---|
482 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
483 | { |
---|
484 | int i=0; |
---|
485 | if (h->next->next!=NULL) |
---|
486 | { |
---|
487 | if (h->next->next->Typ()==INT_CMD) |
---|
488 | i=(int)h->next->next->Data(); |
---|
489 | else |
---|
490 | { |
---|
491 | Warn("int expected"); |
---|
492 | } |
---|
493 | } |
---|
494 | res->rtyp=LIST_CMD; |
---|
495 | res->data=(void *)scIndIndset((ideal)h->next->Data(),i,currQuotient); |
---|
496 | return FALSE; |
---|
497 | } |
---|
498 | else |
---|
499 | WerrorS("ideal expected"); |
---|
500 | } |
---|
501 | else |
---|
502 | #ifdef STDTRACE |
---|
503 | /*==================== trace =============================*/ |
---|
504 | /* Parameter : Ideal, Liste mit Links. */ |
---|
505 | if(strcmp((char*)(h->Data()),"stdtrace")==0) |
---|
506 | { |
---|
507 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
508 | { |
---|
509 | leftv root = NULL, |
---|
510 | ptr = NULL, |
---|
511 | lv = NULL; |
---|
512 | lists l = NULL; |
---|
513 | ideal I = (ideal)(h->next->Data()); |
---|
514 | lists links = (lists)(h->next->next->Data()); |
---|
515 | tHomog hom = testHomog; |
---|
516 | int rw = (int)(h->next->next->next->Data()); |
---|
517 | |
---|
518 | if(I==NULL) |
---|
519 | PrintS("I==NULL\n"); |
---|
520 | for(int i=0; i <= links->nr ; i++) |
---|
521 | { |
---|
522 | lv = (leftv)Alloc0(sizeof(sleftv)); |
---|
523 | lv->Copy(&(links->m[i])); |
---|
524 | if(root==NULL) |
---|
525 | root=lv; |
---|
526 | if(ptr==NULL) |
---|
527 | { |
---|
528 | ptr=lv; |
---|
529 | ptr->next=NULL; |
---|
530 | } |
---|
531 | else |
---|
532 | { |
---|
533 | ptr->next=lv; |
---|
534 | ptr=lv; |
---|
535 | } |
---|
536 | } |
---|
537 | ptr->next=NULL; |
---|
538 | l=TraceStd(root,rw,I,currQuotient,testHomog,NULL); |
---|
539 | idSkipZeroes(((ideal)l->m[0].Data())); |
---|
540 | res->rtyp=LIST_CMD; |
---|
541 | res->data=(void *) l; |
---|
542 | res->next=NULL; |
---|
543 | root->CleanUp(); |
---|
544 | Free(root,sizeof(sleftv)); |
---|
545 | return FALSE; |
---|
546 | } |
---|
547 | else |
---|
548 | WerrorS("ideal expected"); |
---|
549 | } |
---|
550 | else |
---|
551 | #endif |
---|
552 | #ifdef HAVE_FACTORY |
---|
553 | /*==================== fastcomb =============================*/ |
---|
554 | if(strcmp((char*)(h->Data()),"fastcomb")==0) |
---|
555 | { |
---|
556 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
557 | { |
---|
558 | int i=0; |
---|
559 | if (h->next->next!=NULL) |
---|
560 | { |
---|
561 | if (h->next->next->Typ()!=POLY_CMD) |
---|
562 | { |
---|
563 | Warn("Wrong types for poly= comb(ideal,poly)"); |
---|
564 | } |
---|
565 | } |
---|
566 | res->rtyp=POLY_CMD; |
---|
567 | res->data=(void *)fglmLinearCombination((ideal)h->next->Data(),(poly)h->next->next->Data()); |
---|
568 | return FALSE; |
---|
569 | } |
---|
570 | else |
---|
571 | WerrorS("ideal expected"); |
---|
572 | } |
---|
573 | else |
---|
574 | /*==================== comb =============================*/ |
---|
575 | if(strcmp((char*)(h->Data()),"comb")==0) |
---|
576 | { |
---|
577 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
578 | { |
---|
579 | int i=0; |
---|
580 | if (h->next->next!=NULL) |
---|
581 | { |
---|
582 | if (h->next->next->Typ()!=POLY_CMD) |
---|
583 | { |
---|
584 | Warn("Wrong types for poly= comb(ideal,poly)"); |
---|
585 | } |
---|
586 | } |
---|
587 | res->rtyp=POLY_CMD; |
---|
588 | res->data=(void *)fglmNewLinearCombination((ideal)h->next->Data(),(poly)h->next->next->Data()); |
---|
589 | return FALSE; |
---|
590 | } |
---|
591 | else |
---|
592 | WerrorS("ideal expected"); |
---|
593 | } |
---|
594 | else |
---|
595 | /*==================== finduni =============================*/ |
---|
596 | if(strcmp((char*)(h->Data()),"finduni")==0) |
---|
597 | { |
---|
598 | if ((h->next!=NULL) &&(h->next->Typ()==IDEAL_CMD)) |
---|
599 | { |
---|
600 | res->rtyp=IDEAL_CMD; |
---|
601 | res->data=(void *)FindUnivariateWrapper((ideal)h->next->Data()); |
---|
602 | return FALSE; |
---|
603 | } |
---|
604 | else |
---|
605 | WerrorS("ideal expected"); |
---|
606 | } |
---|
607 | else |
---|
608 | #endif |
---|
609 | /*==================== divcount & mcount =============================*/ |
---|
610 | #ifdef MONOM_COUNT |
---|
611 | if (strcmp((char*)(h->Data()),"mcount")==0) |
---|
612 | { |
---|
613 | extern void OutputMonomCount(); |
---|
614 | OutputMonomCount(); |
---|
615 | return FALSE; |
---|
616 | } |
---|
617 | else if (strcmp((char*)(h->Data()),"mreset")==0) |
---|
618 | { |
---|
619 | extern void ResetMonomCount(); |
---|
620 | ResetMonomCount(); |
---|
621 | return FALSE; |
---|
622 | } |
---|
623 | else |
---|
624 | #endif |
---|
625 | #ifdef DIV_COUNT |
---|
626 | if (strcmp((char*)(h->Data()),"dcount")==0) |
---|
627 | { |
---|
628 | extern void OutputDivCount(); |
---|
629 | OutputDivCount(); |
---|
630 | return FALSE; |
---|
631 | } |
---|
632 | else if (strcmp((char*)(h->Data()),"dreset")==0) |
---|
633 | { |
---|
634 | extern void ResetDivCount(); |
---|
635 | ResetDivCount(); |
---|
636 | return FALSE; |
---|
637 | } |
---|
638 | else |
---|
639 | #endif |
---|
640 | /*==================== barstep =============================*/ |
---|
641 | if(strcmp((char*)(h->Data()),"barstep")==0) |
---|
642 | { |
---|
643 | if ((h->next!=NULL) &&(h->next->Typ()==MATRIX_CMD)) |
---|
644 | { |
---|
645 | if (h->next->next!=NULL) |
---|
646 | { |
---|
647 | if (h->next->next->Typ()!=POLY_CMD) |
---|
648 | { |
---|
649 | Warn("Wrong types for barstep(matrix,poly)"); |
---|
650 | } |
---|
651 | } |
---|
652 | int r,c; |
---|
653 | poly div=(poly)h->next->next->Data(); |
---|
654 | res->rtyp=MATRIX_CMD; |
---|
655 | res->data=(void *)mpOneStepBareiss((matrix)h->next->Data(), |
---|
656 | &div,&r,&c); |
---|
657 | Print("div: ");pWrite(div); |
---|
658 | Print("rows: %d, cols: %d\n",r,c); |
---|
659 | pDelete(&div); |
---|
660 | return FALSE; |
---|
661 | } |
---|
662 | else |
---|
663 | WerrorS("matrix expected"); |
---|
664 | } |
---|
665 | } |
---|
666 | |
---|
667 | /*============================================================*/ |
---|
668 | WerrorS("not implemented\n"); |
---|
669 | return TRUE; |
---|
670 | } |
---|