[BACK]Return to ctrl.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2018 / builtin

Diff for /OpenXM_contrib2/asir2018/builtin/ctrl.c between version 1.1 and 1.7

version 1.1, 2018/09/19 05:45:05 version 1.7, 2022/04/03 00:49:25
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM$   * $OpenXM: OpenXM_contrib2/asir2018/builtin/ctrl.c,v 1.6 2022/01/27 01:29:31 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 70  static struct {
Line 70  static struct {
   char *release;    char *release;
   char *full;    char *full;
   char *lang;    char *lang;
   #if defined(VISUAL)
     int ver_major;
     int ver_minor;
     int ver_build;
   #endif
 } sysinfo;  } sysinfo;
   
 void Pctrl();  void Pctrl();
Line 115  extern int ASIRLOADPATH_LEN;
Line 120  extern int ASIRLOADPATH_LEN;
 extern int No_ox_reset;  extern int No_ox_reset;
 extern int plot_by_bigfloat;  extern int plot_by_bigfloat;
 extern int debug_plot;  extern int debug_plot;
   extern int debug_pari;
   
 static struct keyval {  static struct keyval {
   char *key;    char *key;
Line 136  static struct keyval {
Line 142  static struct keyval {
   {"f4_nocheck",&f4_nocheck,"If set to 1, correctness check of the result of modular computation are omitted in nd_f4()."},    {"f4_nocheck",&f4_nocheck,"If set to 1, correctness check of the result of modular computation are omitted in nd_f4()."},
   {"fake_ox_reset",&No_ox_reset,"Determines the treatment of OX reset request for a server which does not implement the reset protocol."},    {"fake_ox_reset",&No_ox_reset,"Determines the treatment of OX reset request for a server which does not implement the reset protocol."},
   {"fortran_output",&fortran_output,"If set to 1, ** is used instead of ^ for representing the power."},    {"fortran_output",&fortran_output,"If set to 1, ** is used instead of ^ for representing the power."},
   {"hex",&hex_output,"If set to 1, integers are printed by the hexadecimal notation."},    {"hex",&hex_output,"If set to 1 (to 2), integers are printed by the hexadecimal (binary) notation."},
   {"hideargs",&hideargs,"If set to 1, the arguments of a function call are not printed."},    {"hideargs",&hideargs,"If set to 1, the arguments of a function call are not printed."},
   {"message",&do_message,"If set to 1, an opening message is printed in ox_asir and ox_plot."},    {"message",&do_message,"If set to 1, an opening message is printed in ox_asir and ox_plot."},
   {"new_hensel",&use_new_hensel,"If set to 1, a function hensel2() is used in the univariate factorizer over Q."},    {"new_hensel",&use_new_hensel,"If set to 1, a function hensel2() is used in the univariate factorizer over Q."},
Line 165  static struct keyval {
Line 171  static struct keyval {
   {"zerorewrite",&zerorewrite,""},    {"zerorewrite",&zerorewrite,""},
   {"itvplotsize",&Itvplot,""},    {"itvplotsize",&Itvplot,""},
 #endif  #endif
     {"debug_pari",&debug_pari,"If set to 1, ox_pari is executed with the message window."},
   {0,0},    {0,0},
 };  };
   
Line 202  LIST create_control_values(int withdesc)
Line 209  LIST create_control_values(int withdesc)
   n = sizeof(ctrls)/sizeof(struct keyval)-1;    n = sizeof(ctrls)/sizeof(struct keyval)-1;
   top = 0;    top = 0;
   for ( i = n-1; i >= 0; i-- ) {    for ( i = n-1; i >= 0; i-- ) {
     STOQ(*(ctrls[i].val),val);      STOZ(*(ctrls[i].val),val);
     list = create_control_value(ctrls[i].key,(Obj)val,ctrls[i].desc,withdesc);      list = create_control_value(ctrls[i].key,(Obj)val,ctrls[i].desc,withdesc);
     MKNODE(top1,list,top); top = top1;      MKNODE(top1,list,top); top = top1;
   }    }
 /* adj */  /* adj */
   Risa_GC_get_adj(&nm,&dv); UTOQ(nm,num); UTOQ(dv,den); divq((Q)num,(Q)den,&adj);    Risa_GC_get_adj(&nm,&dv); UTOZ(nm,num); UTOZ(dv,den); divq((Q)num,(Q)den,&adj);
   descstr = "Determines the parameter for Boehm's GC.";    descstr = "Determines the parameter for Boehm's GC.";
   list = create_control_value("adj",(Obj)adj,descstr,withdesc);    list = create_control_value("adj",(Obj)adj,descstr,withdesc);
   MKNODE(top1,list,top); top = top1;    MKNODE(top1,list,top); top = top1;
Line 227  LIST create_control_values(int withdesc)
Line 234  LIST create_control_values(int withdesc)
     }      }
   }    }
   MKLIST(l,node);    MKLIST(l,node);
   descstr = "List of paths in ASIRLOADPATHt.";    descstr = "List of paths in ASIRLOADPATH.";
   list = create_control_value("loadpath",(Obj)l,descstr,withdesc);    list = create_control_value("loadpath",(Obj)l,descstr,withdesc);
   MKNODE(top1,list,top); top = top1;    MKNODE(top1,list,top); top = top1;
   
 /* oxpari_id */  /* oxpari_id */
   if(!ox_pari_stream_initialized) {    if(!ox_pari_stream_initialized) {
     STOQ(-1,val);      STOZ(-1,val);
   } else val = ox_pari_stream;    } else val = ox_pari_stream;
   descstr = "Id of ox_pari.";    descstr = "Id of ox_pari.";
   list = create_control_value("oxpari_id",(Obj)val,descstr,withdesc);    list = create_control_value("oxpari_id",(Obj)val,descstr,withdesc);
Line 284  void Pctrl(NODE arg,Obj *rp)
Line 291  void Pctrl(NODE arg,Obj *rp)
     /* special treatment is necessary for "adj" */      /* special treatment is necessary for "adj" */
     if ( argc(arg) == 1 ) {      if ( argc(arg) == 1 ) {
       Risa_GC_get_adj(&nm,&dv);        Risa_GC_get_adj(&nm,&dv);
       UTOQ(dv,num);        UTOZ(dv,num);
       UTOQ(nm,den);        UTOZ(nm,den);
       divq((Q)num,(Q)den,(Q *)rp);        divq((Q)num,(Q)den,(Q *)rp);
     } else {      } else {
       absq((Q)ARG1(arg),&c);        absq((Q)ARG1(arg),&c);
Line 293  void Pctrl(NODE arg,Obj *rp)
Line 300  void Pctrl(NODE arg,Obj *rp)
         error("ctrl : adj : invalid argument");          error("ctrl : adj : invalid argument");
       nmq(c,&num);        nmq(c,&num);
       dnq(c,&den);        dnq(c,&den);
       Risa_GC_set_adj(QTOS(den),QTOS(num));        Risa_GC_set_adj(ZTOS(den),ZTOS(num));
       *rp = (Obj)c;        *rp = (Obj)c;
     }      }
     return;      return;
Line 364  void Pctrl(NODE arg,Obj *rp)
Line 371  void Pctrl(NODE arg,Obj *rp)
   } else if ( !strcmp(key,"oxpari_id") ) {    } else if ( !strcmp(key,"oxpari_id") ) {
     if ( argc(arg) == 1 ) {      if ( argc(arg) == 1 ) {
       if(!ox_pari_stream_initialized) {        if(!ox_pari_stream_initialized) {
         STOQ(-1,z);          STOZ(-1,z);
         *rp = (Obj)z;          *rp = (Obj)z;
       }else {        }else {
         *rp = (Obj)ox_pari_stream;          *rp = (Obj)ox_pari_stream;
Line 376  void Pctrl(NODE arg,Obj *rp)
Line 383  void Pctrl(NODE arg,Obj *rp)
         ox_pari_stream = (Z)c;          ox_pari_stream = (Z)c;
         *rp = (Obj)c;          *rp = (Obj)c;
       }else {        }else {
         STOQ(-1,z);          STOZ(-1,z);
         *rp = (Obj)z;          *rp = (Obj)z;
       }        }
     }      }
Line 402  void Pctrl(NODE arg,Obj *rp)
Line 409  void Pctrl(NODE arg,Obj *rp)
     if ( argc(arg) == 1 )      if ( argc(arg) == 1 )
       t = *ctrls[i].val;        t = *ctrls[i].val;
     else      else
       *ctrls[i].val = t = QTOS((Q)ARG1(arg));        *ctrls[i].val = t = ZTOS((Q)ARG1(arg));
     STOQ(t,z);      STOZ(t,z);
     *rp = (Obj)z;      *rp = (Obj)z;
   } else {    } else {
     sprintf(buf,"ctrl : %s : no such key",key);      sprintf(buf,"ctrl : %s : no such key",key);
Line 434  static char *get_lang()
Line 441  static char *get_lang()
     char *c, *p, *q;      char *c, *p, *q;
     c = setlocale(LC_ALL, NULL); /* saving current locale */      c = setlocale(LC_ALL, NULL); /* saving current locale */
     p = setlocale(LC_ALL, "");      p = setlocale(LC_ALL, "");
     q = (char *)MALLOC(strlen(p)+1);      if ( p != 0 ) {
     strcpy(q,p);        q = (char *)MALLOC(strlen(p)+1);
         strcpy(q,p);
       } else {
         q = (char *)MALLOC(2);
         strcpy(q,"C");
       }
     setlocale(LC_ALL, c);        /* restoring current locale */      setlocale(LC_ALL, c);        /* restoring current locale */
     return q;      return q;
 }  }
Line 519  static char *osnameNT(int major, int minor)
Line 531  static char *osnameNT(int major, int minor)
         return "Windows8";          return "Windows8";
     }else if (major == 6 && minor == 3) {      }else if (major == 6 && minor == 3) {
         return "Windows8.1";          return "Windows8.1";
       }else if (major == 10 && minor == 0) {
           return "Windows10";
     }      }
     return "unknown";      return "unknown";
 }  }
Line 547  static char *get_lang()
Line 561  static char *get_lang()
     return "en"; // English      return "en"; // English
 }  }
   
   void get_version_win8(int *major,int *minor,int *build)
   {
       char *res;
       char fname[4096]; /* fullpath of kernel32.dll (_MAX_PATH==260)*/
       char cmd[4096];
       int size;
       char *version_string;
       struct LANGANDCODEPAGE {
           WORD language;
           WORD codepage;
       }* lang;
       sprintf(fname,"%s\\system32\\kernel32.dll", getenv("SYSTEMROOT"));
       size=GetFileVersionInfoSize(fname,0);
       res = (char *)MALLOC(size+1);
       if(GetFileVersionInfo(fname,0,size+1,res)) {
           VerQueryValue(res,"\\VarFileInfo\\Translation",&lang,&size);
           sprintf(cmd,"\\StringFileInfo\\%04x%04x\\ProductVersion",lang->language,lang->codepage);
           VerQueryValue(res,cmd,&version_string,&size);
           sscanf(version_string,"%d.%d.%d.",major,minor,build);
       }
   }
   
 static void get_sysinfo()  static void get_sysinfo()
 {  {
     int arch64 = 0;      int arch64 = 0;
Line 562  static void get_sysinfo()
Line 598  static void get_sysinfo()
   
     v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);      v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
     GetVersionEx(&v);      GetVersionEx(&v);
       /* Windows8 == version 6.2 */
       if (v.dwPlatformId == VER_PLATFORM_WIN32_NT
           && v.dwMajorVersion == 6 && v.dwMinorVersion >= 2) {
           get_version_win8(&v.dwMajorVersion, &v.dwMinorVersion, &v.dwBuildNumber);
       }
       sysinfo.ver_major=v.dwMajorVersion;
       sysinfo.ver_minor=v.dwMinorVersion;
       sysinfo.ver_build=v.dwBuildNumber;
   
     sysinfo.type = "windows";      sysinfo.type = "windows";
     sysinfo.arch = "x86";      sysinfo.arch = "x86";

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

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