[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.17

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

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