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