=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/option.c,v retrieving revision 1.14 retrieving revision 1.21 diff -u -p -r1.14 -r1.21 --- OpenXM/src/kan96xx/Kan/option.c 2003/11/20 09:20:36 1.14 +++ OpenXM/src/kan96xx/Kan/option.c 2020/10/06 11:33:46 1.21 @@ -1,5 +1,6 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/option.c,v 1.13 2003/08/21 02:30:23 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/option.c,v 1.20 2016/03/31 05:27:34 takayama Exp $ */ #include +#include #include "datatype.h" #include "stackm.h" #include "extern.h" @@ -7,8 +8,10 @@ #include "kclass.h" #include "lookup.h" #include +#include "mysig.h" extern void ctrlC(); +void warningOption(char *str); struct object KsystemVariable(ob) @@ -17,6 +20,7 @@ struct object KsystemVariable(ob) /* Don't forget to write the keys in usage.c */ extern int PrintDollar; extern int Wrap; + extern int COutput; extern struct ring *CurrentRingp; extern int Verbose; extern int UseCriterion1; @@ -57,9 +61,14 @@ struct object KsystemVariable(ob) extern int DoCancel; extern int DebugContentReduction; extern int QuoteMode; + extern int RestrictedMode, RestrictedMode_saved; + extern int UseDsmall; int n,i; - struct object ob1,ob2,ob3,ob4; + struct object ob1 = OINIT; + struct object ob2 = OINIT; + struct object ob3 = OINIT; + struct object ob4 = OINIT; struct object rob = NullObject; switch (getoaSize(ob)) { case 1: /* get the value */ @@ -70,6 +79,8 @@ struct object KsystemVariable(ob) rob = KpoInteger(PrintDollar); }else if (strcmp(ob1.lc.str,"Wrap") == 0) { rob = KpoInteger(Wrap); + }else if (strcmp(ob1.lc.str,"COutput") == 0) { + rob = KpoInteger(COutput); }else if (strcmp(ob1.lc.str,"P") == 0) { rob = KpoInteger(CurrentRingp->p); }else if (strcmp(ob1.lc.str,"N") == 0) { @@ -184,6 +195,8 @@ struct object KsystemVariable(ob) rob = KpoString(RightBracket); }else if (strcmp(ob1.lc.str,"SecureMode")==0) { rob = KpoInteger(SecureMode); + }else if (strcmp(ob1.lc.str,"RestrictedMode")==0) { + rob = KpoInteger(RestrictedMode); }else if (strcmp(ob1.lc.str,"Ecart")==0) { rob = KpoInteger(Ecart); }else if (strcmp(ob1.lc.str,"EcartAutomaticHomogenization")==0) { @@ -196,6 +209,8 @@ struct object KsystemVariable(ob) rob = KpoInteger(DebugContentReduction); }else if (strcmp(ob1.lc.str,"QuoteMode")==0) { rob = KpoInteger(QuoteMode); + }else if (strcmp(ob1.lc.str,"UseDsmall")==0) { + rob = KpoInteger(UseDsmall); }else{ warningKan("KsystemVariable():Unknown key word.\n"); } @@ -220,6 +235,9 @@ struct object KsystemVariable(ob) P = ob2.lc.ival; Q should be set here too. CurrentRingp->p = P; rob = KpoInteger(P); */ + }else if (strcmp(ob1.lc.str,"COutput") == 0) { + COutput = ob2.lc.ival; + rob = KpoInteger(COutput); }else if (strcmp(ob1.lc.str,"NN") == 0) { if (ob2.lc.ival <= CurrentRingp->n && ob2.lc.ival >= CurrentRingp->m) { CurrentRingp->nn = ob2.lc.ival; @@ -268,8 +286,8 @@ struct object KsystemVariable(ob) rob = KpoInteger(Strict2); }else if (strcmp(ob1.lc.str,"SigIgn") == 0) { SigIgn = ob2.lc.ival; - if (SigIgn) signal(SIGINT,SIG_IGN); - else signal(SIGINT,ctrlC); + if (SigIgn) mysignal(SIGINT,SIG_IGN); + else mysignal(SIGINT,ctrlC); rob = KpoInteger(SigIgn); }else if (strcmp(ob1.lc.str,"KSPushEnvMode") == 0) { KSPushEnvMode = ob2.lc.ival; @@ -314,6 +332,14 @@ struct object KsystemVariable(ob) errorKan1("%s\n","You cannot weaken the security level."); } rob = KpoInteger(SecureMode); + }else if (strcmp(ob1.lc.str,"RestrictedMode") == 0) { + if (KopInteger(ob2) >= RestrictedMode) { + RestrictedMode = KopInteger(ob2); + RestrictedMode_saved = RestrictedMode; + }else{ + errorKan1("%s\n","You cannot weaken the RestrictedMode level."); + } + rob = KpoInteger(RestrictedMode); }else if (strcmp(ob1.lc.str,"Ecart") == 0) { Ecart = KopInteger(ob2); rob = KpoInteger(Ecart); @@ -332,6 +358,9 @@ struct object KsystemVariable(ob) }else if (strcmp(ob1.lc.str,"QuoteMode") == 0) { QuoteMode = KopInteger(ob2); rob = KpoInteger(QuoteMode); + }else if (strcmp(ob1.lc.str,"UseDsmall") == 0) { + UseDsmall = KopInteger(ob2); + rob = KpoInteger(UseDsmall); }else{ warningKan("KsystemVariable():Unknown key word.\n"); } @@ -439,7 +468,7 @@ struct object KsystemVariable(ob) return(rob); } -warningOption(str) +void warningOption(str) char *str; { fprintf(stderr,"Warning(option.c): %s\n",str);