[BACK]Return to option.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Annotation of OpenXM/src/kan96xx/Kan/option.c, Revision 1.18

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>