=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2018/builtin/ctrl.c,v retrieving revision 1.3 retrieving revision 1.7 diff -u -p -r1.3 -r1.7 --- OpenXM_contrib2/asir2018/builtin/ctrl.c 2019/03/06 10:43:25 1.3 +++ OpenXM_contrib2/asir2018/builtin/ctrl.c 2022/04/03 00:49:25 1.7 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2018/builtin/ctrl.c,v 1.2 2018/09/28 08:20:27 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2018/builtin/ctrl.c,v 1.6 2022/01/27 01:29:31 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -70,6 +70,11 @@ static struct { char *release; char *full; char *lang; +#if defined(VISUAL) + int ver_major; + int ver_minor; + int ver_build; +#endif } sysinfo; void Pctrl(); @@ -115,6 +120,7 @@ extern int ASIRLOADPATH_LEN; extern int No_ox_reset; extern int plot_by_bigfloat; extern int debug_plot; +extern int debug_pari; static struct keyval { char *key; @@ -136,7 +142,7 @@ static struct keyval { {"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."}, {"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."}, {"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."}, @@ -165,6 +171,7 @@ static struct keyval { {"zerorewrite",&zerorewrite,""}, {"itvplotsize",&Itvplot,""}, #endif + {"debug_pari",&debug_pari,"If set to 1, ox_pari is executed with the message window."}, {0,0}, }; @@ -434,8 +441,13 @@ static char *get_lang() char *c, *p, *q; c = setlocale(LC_ALL, NULL); /* saving current locale */ p = setlocale(LC_ALL, ""); - q = (char *)MALLOC(strlen(p)+1); - strcpy(q,p); + if ( p != 0 ) { + q = (char *)MALLOC(strlen(p)+1); + strcpy(q,p); + } else { + q = (char *)MALLOC(2); + strcpy(q,"C"); + } setlocale(LC_ALL, c); /* restoring current locale */ return q; } @@ -519,6 +531,8 @@ static char *osnameNT(int major, int minor) return "Windows8"; }else if (major == 6 && minor == 3) { return "Windows8.1"; + }else if (major == 10 && minor == 0) { + return "Windows10"; } return "unknown"; } @@ -547,6 +561,28 @@ static char *get_lang() 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() { int arch64 = 0; @@ -562,6 +598,14 @@ static void get_sysinfo() v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); 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.arch = "x86";