Annotation of OpenXM/src/kan96xx/Kan/option.c, Revision 1.20
1.20 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/option.c,v 1.19 2016/03/31 03:22:54 takayama Exp $ */
1.1 maekawa 2: #include <stdio.h>
3: #include "datatype.h"
4: #include "stackm.h"
5: #include "extern.h"
6: #include "gradedset.h"
7: #include "kclass.h"
8: #include "lookup.h"
9: #include <signal.h>
1.20 ! takayama 10: #include "mysig.h"
1.1 maekawa 11:
12: extern void ctrlC();
13:
14:
15: struct object KsystemVariable(ob)
1.5 takayama 16: struct object ob; /* Sarray */
1.1 maekawa 17: {
18: /* Don't forget to write the keys in usage.c */
19: extern int PrintDollar;
20: extern int Wrap;
1.18 takayama 21: extern int COutput;
1.1 maekawa 22: extern struct ring *CurrentRingp;
23: extern int Verbose;
24: extern int UseCriterion1;
25: extern int UseCriterion2B;
26: extern int ReduceLowerTerms;
27: extern int CheckHomogenization;
28: extern int Homogenize;
29: extern int Statistics;
1.3 takayama 30: extern int AutoReduce;
1.1 maekawa 31: extern int Osp;
32: extern struct operandStack StandardStack;
33: extern struct operandStack ErrorStack;
34: extern int ErrorMessageMode;
35: extern int WarningMessageMode;
36: extern int CatchCtrlC;
37: extern int Strict;
38: extern struct context *CurrentContextp;
39: extern struct context *PrimitiveContextp;
40: extern int Strict2;
41: extern int SigIgn;
42: extern int KSPushEnvMode;
43: extern int KanGBmessage;
44: extern int TimerOn;
45: extern int OutputStyle;
46: extern int Sugar;
47: extern int Homogenize_vec;
48: extern int CmoDMSOutputOption;
49: extern int DebugReductionRed; /* hidden option */
1.9 takayama 50: extern int DebugReductionEcart;
1.1 maekawa 51: extern char *VersionString;
52: extern int AvoidTheSameRing;
1.2 takayama 53: extern char *LeftBracket;
54: extern char *RightBracket;
1.4 takayama 55: extern int SecureMode;
1.7 takayama 56: extern int Ecart;
1.8 takayama 57: extern int EcartAutomaticHomogenization;
1.11 takayama 58: extern int TraceLift;
1.12 takayama 59: extern int DoCancel;
1.13 takayama 60: extern int DebugContentReduction;
1.14 takayama 61: extern int QuoteMode;
1.15 takayama 62: extern int RestrictedMode, RestrictedMode_saved;
1.17 takayama 63: extern int UseDsmall;
1.1 maekawa 64:
65: int n,i;
1.16 takayama 66: struct object ob1 = OINIT;
67: struct object ob2 = OINIT;
68: struct object ob3 = OINIT;
69: struct object ob4 = OINIT;
1.1 maekawa 70: struct object rob = NullObject;
71: switch (getoaSize(ob)) {
72: case 1: /* get the value */
73: ob1 = getoa(ob,0);
74: switch(ob1.tag) {
75: case Sdollar:
76: if (strcmp(ob1.lc.str,"PrintDollar") == 0) {
1.5 takayama 77: rob = KpoInteger(PrintDollar);
1.1 maekawa 78: }else if (strcmp(ob1.lc.str,"Wrap") == 0) {
1.5 takayama 79: rob = KpoInteger(Wrap);
1.18 takayama 80: }else if (strcmp(ob1.lc.str,"COutput") == 0) {
81: rob = KpoInteger(COutput);
1.1 maekawa 82: }else if (strcmp(ob1.lc.str,"P") == 0) {
1.5 takayama 83: rob = KpoInteger(CurrentRingp->p);
1.1 maekawa 84: }else if (strcmp(ob1.lc.str,"N") == 0) {
1.5 takayama 85: rob = KpoInteger(CurrentRingp->n);
1.1 maekawa 86: }else if (strcmp(ob1.lc.str,"NN") == 0) {
1.5 takayama 87: rob = KpoInteger(CurrentRingp->nn);
1.1 maekawa 88: }else if (strcmp(ob1.lc.str,"M") == 0) {
1.5 takayama 89: rob = KpoInteger(CurrentRingp->m);
1.1 maekawa 90: }else if (strcmp(ob1.lc.str,"MM") == 0) {
1.5 takayama 91: rob = KpoInteger(CurrentRingp->mm);
1.1 maekawa 92: }else if (strcmp(ob1.lc.str,"L") == 0) {
1.5 takayama 93: rob = KpoInteger(CurrentRingp->l);
1.1 maekawa 94: }else if (strcmp(ob1.lc.str,"LL") == 0) {
1.5 takayama 95: rob = KpoInteger(CurrentRingp->ll);
1.1 maekawa 96: }else if (strcmp(ob1.lc.str,"C") == 0) {
1.5 takayama 97: rob = KpoInteger(CurrentRingp->c);
1.1 maekawa 98: }else if (strcmp(ob1.lc.str,"CC") == 0) {
1.5 takayama 99: rob = KpoInteger(CurrentRingp->cc);
1.1 maekawa 100: }else if (strcmp(ob1.lc.str,"CurrentRingp") == 0) {
1.5 takayama 101: rob = KpoRingp(CurrentRingp);
1.1 maekawa 102: }else if (strcmp(ob1.lc.str,"Verbose") == 0) {
1.5 takayama 103: rob = KpoInteger(Verbose);
1.1 maekawa 104: }else if (strcmp(ob1.lc.str,"UseCriterion1") == 0) {
1.5 takayama 105: rob = KpoInteger(UseCriterion1);
1.1 maekawa 106: }else if (strcmp(ob1.lc.str,"UseCriterion2B") == 0) {
1.5 takayama 107: rob = KpoInteger(UseCriterion2B);
1.1 maekawa 108: }else if (strcmp(ob1.lc.str,"ReduceLowerTerms") == 0) {
1.5 takayama 109: rob = KpoInteger(ReduceLowerTerms);
1.1 maekawa 110: }else if (strcmp(ob1.lc.str,"CheckHomogenization") == 0) {
1.5 takayama 111: rob = KpoInteger(CheckHomogenization);
1.1 maekawa 112: }else if (strcmp(ob1.lc.str,"Homogenize") == 0) {
1.5 takayama 113: rob = KpoInteger(Homogenize);
1.1 maekawa 114: }else if (strcmp(ob1.lc.str,"Statistics") == 0) {
1.5 takayama 115: rob = KpoInteger(Statistics);
1.3 takayama 116: }else if (strcmp(ob1.lc.str,"AutoReduce") == 0) {
1.5 takayama 117: rob = KpoInteger(AutoReduce);
1.1 maekawa 118: }else if (strcmp(ob1.lc.str,"StackPointer") == 0) {
1.5 takayama 119: rob = KpoInteger(Osp);
1.1 maekawa 120: }else if (strcmp(ob1.lc.str,"StandardOperandStack") == 0) {
1.5 takayama 121: rob.tag = Sclass;
122: rob.lc.ival = CLASSNAME_OPERANDSTACK;
123: rob.rc.voidp = &StandardStack;
1.1 maekawa 124: }else if (strcmp(ob1.lc.str,"ErrorStack") == 0) {
1.5 takayama 125: rob.tag = Sclass;
126: rob.lc.ival = CLASSNAME_OPERANDSTACK;
127: rob.rc.voidp = &ErrorStack;
1.1 maekawa 128: }else if (strcmp(ob1.lc.str,"ErrorMessageMode") == 0) {
1.5 takayama 129: rob = KpoInteger(ErrorMessageMode);
1.1 maekawa 130: }else if (strcmp(ob1.lc.str,"WarningMessageMode") == 0) {
1.5 takayama 131: rob = KpoInteger(WarningMessageMode);
1.1 maekawa 132: }else if (strcmp(ob1.lc.str,"CatchCtrlC") == 0) {
1.5 takayama 133: rob = KpoInteger(CatchCtrlC);
134: /* If you catch ctrlc in KSexecuteString. */
1.1 maekawa 135: }else if (strcmp(ob1.lc.str,"Strict") == 0) {
1.5 takayama 136: rob = KpoInteger(Strict);
1.1 maekawa 137: }else if (strcmp(ob1.lc.str,"CurrentContextp") == 0) {
1.5 takayama 138: rob.tag = Sclass;
139: rob.lc.ival = CLASSNAME_CONTEXT;
140: rob.rc.voidp = CurrentContextp;
1.1 maekawa 141: }else if (strcmp(ob1.lc.str,"PrimitiveContextp") == 0) {
1.5 takayama 142: rob.tag = Sclass;
143: rob.lc.ival = CLASSNAME_CONTEXT;
144: rob.rc.voidp = PrimitiveContextp;
1.1 maekawa 145: }else if (strcmp(ob1.lc.str,"NullContextp") == 0) {
1.5 takayama 146: rob.tag = Sclass;
147: rob.lc.ival = CLASSNAME_CONTEXT;
148: rob.rc.voidp = (struct context *)NULL;
1.1 maekawa 149: }else if (strcmp(ob1.lc.str,"Strict2") == 0) {
1.5 takayama 150: rob = KpoInteger(Strict2);
1.1 maekawa 151: }else if (strcmp(ob1.lc.str,"SigIgn") == 0) {
1.5 takayama 152: rob = KpoInteger(SigIgn);
1.1 maekawa 153: }else if (strcmp(ob1.lc.str,"KSPushEnvMode") == 0) {
1.5 takayama 154: rob = KpoInteger(KSPushEnvMode);
1.1 maekawa 155: }else if (strcmp(ob1.lc.str,"KanGBmessage") == 0) {
1.5 takayama 156: rob = KpoInteger(KanGBmessage);
1.1 maekawa 157: }else if (strcmp(ob1.lc.str,"TimerOn") == 0) {
1.5 takayama 158: rob = KpoInteger(TimerOn);
1.1 maekawa 159: }else if (strcmp(ob1.lc.str,"orderMatrix") == 0) {
1.5 takayama 160: rob = KgetOrderMatrixOfCurrentRing();
1.1 maekawa 161: }else if (strcmp(ob1.lc.str,"gbListTower") == 0) {
1.5 takayama 162: if (CurrentRingp->gbListTower == NULL) rob = NullObject;
163: else rob = *((struct object *)(CurrentRingp->gbListTower));
1.1 maekawa 164: }else if (strcmp(ob1.lc.str,"outputOrder") == 0) {
1.5 takayama 165: n = CurrentRingp->n;
166: ob1 = newObjectArray(n*2);
167: for (i=0; i<2*n; i++) {
168: putoa(ob1,i,KpoInteger(CurrentRingp->outputOrder[i]));
169: }
170: rob = ob1;
1.1 maekawa 171: }else if (strcmp(ob1.lc.str,"multSymbol") == 0) {
1.5 takayama 172: rob = KpoInteger(OutputStyle);
1.1 maekawa 173: }else if (strcmp(ob1.lc.str,"Sugar") == 0) {
1.5 takayama 174: rob = KpoInteger(Sugar);
1.1 maekawa 175: }else if (strcmp(ob1.lc.str,"Homogenize_vec") == 0) {
1.5 takayama 176: rob = KpoInteger(Homogenize_vec);
1.1 maekawa 177: }else if (strcmp(ob1.lc.str,"Schreyer")==0) {
1.5 takayama 178: rob = KpoInteger( CurrentRingp->schreyer );
1.1 maekawa 179: }else if (strcmp(ob1.lc.str,"ringName")==0) {
1.5 takayama 180: rob = KpoString( CurrentRingp->name );
1.1 maekawa 181: }else if (strcmp(ob1.lc.str,"CmoDMSOutputOption")==0) {
1.5 takayama 182: rob = KpoInteger( CmoDMSOutputOption );
1.1 maekawa 183: }else if (strcmp(ob1.lc.str,"Version")==0) {
1.5 takayama 184: rob = KpoString(VersionString);
1.1 maekawa 185: }else if (strcmp(ob1.lc.str,"RingStack")==0) {
1.5 takayama 186: KsetUpRing(NullObject,NullObject,NullObject,NullObject,NullObject);
187: rob = KSpop(); /* This is exceptional style */
1.1 maekawa 188: }else if (strcmp(ob1.lc.str,"AvoidTheSameRing")==0) {
1.5 takayama 189: rob = KpoInteger(AvoidTheSameRing);
1.2 takayama 190: }else if (strcmp(ob1.lc.str,"LeftBracket")==0) {
1.5 takayama 191: rob = KpoString(LeftBracket);
1.2 takayama 192: }else if (strcmp(ob1.lc.str,"RightBracket")==0) {
1.5 takayama 193: rob = KpoString(RightBracket);
1.4 takayama 194: }else if (strcmp(ob1.lc.str,"SecureMode")==0) {
1.5 takayama 195: rob = KpoInteger(SecureMode);
1.15 takayama 196: }else if (strcmp(ob1.lc.str,"RestrictedMode")==0) {
197: rob = KpoInteger(RestrictedMode);
1.7 takayama 198: }else if (strcmp(ob1.lc.str,"Ecart")==0) {
199: rob = KpoInteger(Ecart);
1.8 takayama 200: }else if (strcmp(ob1.lc.str,"EcartAutomaticHomogenization")==0) {
201: rob = KpoInteger(EcartAutomaticHomogenization);
1.11 takayama 202: }else if (strcmp(ob1.lc.str,"TraceLift")==0) {
203: rob = KpoInteger(TraceLift);
1.12 takayama 204: }else if (strcmp(ob1.lc.str,"DoCancel")==0) {
205: rob = KpoInteger(DoCancel);
1.13 takayama 206: }else if (strcmp(ob1.lc.str,"DebugContentReduction")==0) {
207: rob = KpoInteger(DebugContentReduction);
1.14 takayama 208: }else if (strcmp(ob1.lc.str,"QuoteMode")==0) {
209: rob = KpoInteger(QuoteMode);
1.17 takayama 210: }else if (strcmp(ob1.lc.str,"UseDsmall")==0) {
211: rob = KpoInteger(UseDsmall);
1.1 maekawa 212: }else{
1.5 takayama 213: warningKan("KsystemVariable():Unknown key word.\n");
1.1 maekawa 214: }
215: break;
216: default:
217: warningKan("KsystemVariable():Invalid argument\n");
218: break;
219: }
220: break;
221: case 2: /* set value */
222: ob1 = getoa(ob,0);
223: ob2 = getoa(ob,1);
224: switch (Lookup[ob1.tag][ob2.tag]) {
225: case SdollarSinteger:
226: if (strcmp(ob1.lc.str,"PrintDollar") == 0) {
1.5 takayama 227: PrintDollar = ob2.lc.ival;
228: rob = KpoInteger(PrintDollar);
1.1 maekawa 229: }else if (strcmp(ob1.lc.str,"Wrap") == 0) {
1.5 takayama 230: Wrap = ob2.lc.ival;
231: rob = KpoInteger(Wrap);
232: /*}else if (strcmp(ob1.lc.str,"P") == 0) {
233: P = ob2.lc.ival; Q should be set here too.
234: CurrentRingp->p = P;
235: rob = KpoInteger(P); */
1.18 takayama 236: }else if (strcmp(ob1.lc.str,"COutput") == 0) {
237: COutput = ob2.lc.ival;
238: rob = KpoInteger(COutput);
1.1 maekawa 239: }else if (strcmp(ob1.lc.str,"NN") == 0) {
1.5 takayama 240: if (ob2.lc.ival <= CurrentRingp->n && ob2.lc.ival >= CurrentRingp->m) {
241: CurrentRingp->nn = ob2.lc.ival;
242: }else{
243: warningKan("New value of NN is out of bound.");
244: }
245: rob = KpoInteger(ob1.lc.ival);
1.1 maekawa 246: }else if (strcmp(ob1.lc.str,"Verbose") == 0) {
1.5 takayama 247: Verbose = ob2.lc.ival;
248: rob = KpoInteger(Verbose);
1.1 maekawa 249: }else if (strcmp(ob1.lc.str,"UseCriterion1") == 0) {
1.5 takayama 250: UseCriterion1 = ob2.lc.ival;
251: rob = KpoInteger(UseCriterion1);
1.1 maekawa 252: }else if (strcmp(ob1.lc.str,"UseCriterion2B") == 0) {
1.5 takayama 253: UseCriterion2B = ob2.lc.ival;
254: rob = KpoInteger(UseCriterion2B);
1.1 maekawa 255: }else if (strcmp(ob1.lc.str,"ReduceLowerTerms") == 0) {
1.5 takayama 256: ReduceLowerTerms = ob2.lc.ival;
257: rob = KpoInteger(ReduceLowerTerms);
1.1 maekawa 258: }else if (strcmp(ob1.lc.str,"CheckHomogenization") == 0) {
1.5 takayama 259: CheckHomogenization = ob2.lc.ival;
260: rob = KpoInteger(CheckHomogenization);
1.1 maekawa 261: }else if (strcmp(ob1.lc.str,"Homogenize") == 0) {
1.5 takayama 262: Homogenize = ob2.lc.ival;
263: rob = KpoInteger(Homogenize);
1.1 maekawa 264: }else if (strcmp(ob1.lc.str,"Statistics") == 0) {
1.5 takayama 265: Statistics = ob2.lc.ival;
266: rob = KpoInteger(Statistics);
1.3 takayama 267: }else if (strcmp(ob1.lc.str,"AutoReduce") == 0) {
1.5 takayama 268: AutoReduce = ob2.lc.ival;
269: rob = KpoInteger(AutoReduce);
1.1 maekawa 270: }else if (strcmp(ob1.lc.str,"ErrorMessageMode") == 0) {
1.5 takayama 271: ErrorMessageMode = ob2.lc.ival;
272: rob = KpoInteger(ErrorMessageMode);
1.1 maekawa 273: }else if (strcmp(ob1.lc.str,"WarningMessageMode") == 0) {
1.5 takayama 274: WarningMessageMode = ob2.lc.ival;
275: rob = KpoInteger(WarningMessageMode);
1.1 maekawa 276: }else if (strcmp(ob1.lc.str,"CatchCtrlC") == 0) {
1.5 takayama 277: CatchCtrlC = ob2.lc.ival;
278: rob = KpoInteger(CatchCtrlC);
1.1 maekawa 279: }else if (strcmp(ob1.lc.str,"Strict") == 0) {
1.5 takayama 280: Strict = ob2.lc.ival;
281: rob = KpoInteger(Strict);
1.1 maekawa 282: }else if (strcmp(ob1.lc.str,"Strict2") == 0) {
1.5 takayama 283: Strict2 = ob2.lc.ival;
284: rob = KpoInteger(Strict2);
1.1 maekawa 285: }else if (strcmp(ob1.lc.str,"SigIgn") == 0) {
1.5 takayama 286: SigIgn = ob2.lc.ival;
1.19 takayama 287: if (SigIgn) mysignal(SIGINT,SIG_IGN);
288: else mysignal(SIGINT,ctrlC);
1.5 takayama 289: rob = KpoInteger(SigIgn);
1.1 maekawa 290: }else if (strcmp(ob1.lc.str,"KSPushEnvMode") == 0) {
1.5 takayama 291: KSPushEnvMode = ob2.lc.ival;
292: rob = KpoInteger(KSPushEnvMode);
1.1 maekawa 293: }else if (strcmp(ob1.lc.str,"KanGBmessage") == 0) {
1.5 takayama 294: KanGBmessage = ob2.lc.ival;
295: rob = KpoInteger(KanGBmessage);
1.1 maekawa 296: }else if (strcmp(ob1.lc.str,"TimerOn") == 0) {
1.5 takayama 297: TimerOn = ob2.lc.ival;
298: rob = KpoInteger(TimerOn);
1.1 maekawa 299: }else if (strcmp(ob1.lc.str,"multSymbol") == 0) {
1.5 takayama 300: OutputStyle = KopInteger(ob2);
301: rob = KpoInteger(OutputStyle);
1.1 maekawa 302: }else if (strcmp(ob1.lc.str,"Sugar") == 0) {
1.5 takayama 303: Sugar = KopInteger(ob2);
304: if (Sugar && ReduceLowerTerms) {
305: ReduceLowerTerms = 0;
306: warningKan("ReduceLowerTerms is automatically set to 0, because Sugar = 1.");
307: /* You cannot use both ReduceLowerTerms and sugar.
308: See gb.c, reduction_sugar. */
309: }
310: rob = KpoInteger(Sugar);
1.1 maekawa 311: }else if (strcmp(ob1.lc.str,"Homogenize_vec") == 0) {
1.5 takayama 312: Homogenize_vec = KopInteger(ob2);
313: rob = KpoInteger(Homogenize_vec);
1.1 maekawa 314: }else if (strcmp(ob1.lc.str,"CmoDMSOutputOption") == 0) {
1.5 takayama 315: CmoDMSOutputOption = KopInteger(ob2);
316: rob = KpoInteger(CmoDMSOutputOption);
1.1 maekawa 317: }else if (strcmp(ob1.lc.str,"DebugReductionRed") == 0) {
1.5 takayama 318: DebugReductionRed = KopInteger(ob2);
319: rob = KpoInteger(DebugReductionRed);
1.9 takayama 320: }else if (strcmp(ob1.lc.str,"DebugReductionEcart") == 0) {
321: DebugReductionEcart = KopInteger(ob2);
322: rob = KpoInteger(DebugReductionEcart);
1.1 maekawa 323: }else if (strcmp(ob1.lc.str,"AvoidTheSameRing") == 0) {
1.5 takayama 324: AvoidTheSameRing = KopInteger(ob2);
325: rob = KpoInteger(AvoidTheSameRing);
1.4 takayama 326: }else if (strcmp(ob1.lc.str,"SecureMode") == 0) {
1.5 takayama 327: if (KopInteger(ob2) >= SecureMode) {
328: SecureMode = KopInteger(ob2);
329: }else{
330: errorKan1("%s\n","You cannot weaken the security level.");
331: }
332: rob = KpoInteger(SecureMode);
1.15 takayama 333: }else if (strcmp(ob1.lc.str,"RestrictedMode") == 0) {
334: if (KopInteger(ob2) >= RestrictedMode) {
335: RestrictedMode = KopInteger(ob2);
336: RestrictedMode_saved = RestrictedMode;
337: }else{
338: errorKan1("%s\n","You cannot weaken the RestrictedMode level.");
339: }
340: rob = KpoInteger(RestrictedMode);
1.7 takayama 341: }else if (strcmp(ob1.lc.str,"Ecart") == 0) {
342: Ecart = KopInteger(ob2);
343: rob = KpoInteger(Ecart);
1.8 takayama 344: }else if (strcmp(ob1.lc.str,"EcartAutomaticHomogenization") == 0) {
1.10 takayama 345: EcartAutomaticHomogenization = KopInteger(ob2);
1.8 takayama 346: rob = KpoInteger(EcartAutomaticHomogenization);
1.11 takayama 347: }else if (strcmp(ob1.lc.str,"TraceLift") == 0) {
348: TraceLift = KopInteger(ob2);
349: rob = KpoInteger(TraceLift);
1.12 takayama 350: }else if (strcmp(ob1.lc.str,"DoCancel") == 0) {
351: DoCancel = KopInteger(ob2);
352: rob = KpoInteger(DoCancel);
1.13 takayama 353: }else if (strcmp(ob1.lc.str,"DebugContentReduction") == 0) {
354: DebugContentReduction = KopInteger(ob2);
355: rob = KpoInteger(DebugContentReduction);
1.14 takayama 356: }else if (strcmp(ob1.lc.str,"QuoteMode") == 0) {
357: QuoteMode = KopInteger(ob2);
358: rob = KpoInteger(QuoteMode);
1.17 takayama 359: }else if (strcmp(ob1.lc.str,"UseDsmall") == 0) {
360: UseDsmall = KopInteger(ob2);
361: rob = KpoInteger(UseDsmall);
1.1 maekawa 362: }else{
1.5 takayama 363: warningKan("KsystemVariable():Unknown key word.\n");
1.1 maekawa 364: }
365: break;
366: case SdollarSdollar:
367: if (strcmp(ob1.lc.str,"ringName") == 0) {
1.5 takayama 368: CurrentRingp->name = KopString(ob2);
369: rob = KpoString(CurrentRingp->name);
1.2 takayama 370: }else if (strcmp(ob1.lc.str,"LeftBracket") == 0) {
1.5 takayama 371: LeftBracket = KopString(ob2);
372: rob = KpoString(LeftBracket);
1.2 takayama 373: }else if (strcmp(ob1.lc.str,"RightBracket") == 0) {
1.5 takayama 374: RightBracket = KopString(ob2);
375: rob = KpoString(RightBracket);
1.1 maekawa 376: }else{
1.5 takayama 377: warningKan("KsystemVariable():Unknown key word.\n");
1.1 maekawa 378: }
379: break;
380: case SdollarSring:
381: if (strcmp(ob1.lc.str,"CurrentRingp") == 0) {
1.5 takayama 382: CurrentRingp = ob2.lc.ringp;
383: rob = KpoRingp(CurrentRingp);
1.1 maekawa 384: }else{
1.5 takayama 385: warningKan("KsystemVariable():Unknown key word.\n");
1.1 maekawa 386: }
387: break;
388: case SdollarSclass:
389: if (strcmp(ob1.lc.str,"PrimitiveContextp") == 0) {
1.5 takayama 390: if (ectag(ob2) == CLASSNAME_CONTEXT) {
391: PrimitiveContextp = (struct context *)ob2.rc.voidp;
392: rob = ob2;
393: }else{
394: warningKan("The second argument must be class.context.\n");
395: rob = NullObject;
396: }
1.1 maekawa 397: }else {
1.5 takayama 398: warningKan("KsystemVariable():Unknown key word.\n");
1.1 maekawa 399: }
400: break;
401: case SdollarSlist:
402: if (strcmp(ob1.lc.str,"gbListTower") == 0) {
1.5 takayama 403: if (AvoidTheSameRing)
404: warningKan("Changing gbListTower may cause a trouble under AvoidTheSameRing == 1.");
405: CurrentRingp->gbListTower = newObject();
406: *((struct object *)(CurrentRingp->gbListTower)) = ob2;
407: rob = *((struct object *)(CurrentRingp->gbListTower));
1.1 maekawa 408: }else {
1.5 takayama 409: warningKan("KsystemVariable(): Unknown key word to set value.\n");
1.1 maekawa 410: }
411: break;
412: case SdollarSarray:
413: if (strcmp(ob1.lc.str,"outputOrder") == 0) {
1.5 takayama 414: rob = KsetOutputOrder(ob2,CurrentRingp);
1.1 maekawa 415: }else if (strcmp(ob1.lc.str,"variableNames") == 0) {
1.5 takayama 416: rob = KsetVariableNames(ob2,CurrentRingp);
1.1 maekawa 417: }else {
1.5 takayama 418: warningKan("KsystemVariable(): Unknown key word to set value.\n");
1.1 maekawa 419: }
420: break;
421: default:
422: warningKan("KsystemVariable():Invalid argument.\n");
423: }
424: break;
425: case 3:
426: ob1 = getoa(ob,0); ob2 = getoa(ob,1); ob3 = getoa(ob,2);
427: switch(Lookup[ob1.tag][ob2.tag]) {
428: case SdollarSdollar:
429: if (strcmp(ob2.lc.str,"var") == 0) {
1.5 takayama 430: if (strcmp(ob1.lc.str,"x")==0) {
431: if (ob3.tag != Sinteger) {
432: warningKan("[$x$ $var$ ? ] The 3rd argument must be integer.");
433: break;
434: }
435: if (ob3.lc.ival >= 0 && ob3.lc.ival < CurrentRingp->n) {
436: rob = KpoString(CurrentRingp->x[ob3.lc.ival]);
437: }else{
438: warningKan("[$x$ $var$ ? ] The 3rd argument is out of range.");
439: break;
440: }
441: }else if (strcmp(ob1.lc.str,"D")==0) {
442: if (ob3.tag != Sinteger) {
443: warningKan("[$D$ $var$ ? ] The 3rd argument must be integer.");
444: break;
445: }
446: if (ob3.lc.ival >= 0 && ob3.lc.ival < CurrentRingp->n) {
447: rob = KpoString(CurrentRingp->D[ob3.lc.ival]);
448: }else{
449: warningKan("[$D$ $var$ ? ] The 3rd argument is out of range.");
450: break;
451: }
452: }
1.1 maekawa 453: }else{
1.5 takayama 454: warningKan("KsystemVariable(): Invalid argument.\n");
1.1 maekawa 455: }
456: break;
457: default:
458: warningKan("KsystemVariable(): Invalid argument.\n");
459: break;
460: }
461: break;
462: default:
463: warningKan("KsystemVariable():Invalid argument.\n");
464: break;
465: }
466: return(rob);
467: }
468:
469: warningOption(str)
1.5 takayama 470: char *str;
1.1 maekawa 471: {
472: fprintf(stderr,"Warning(option.c): %s\n",str);
473: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>