Annotation of OpenXM_contrib2/asir2000/builtin/ctrl.c, Revision 1.57
1.8 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.9 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.8 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.57 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/builtin/ctrl.c,v 1.56 2018/03/28 07:44:05 noro Exp $
1.8 noro 49: */
1.1 noro 50: #include "ca.h"
51: #include "parse.h"
1.42 ohara 52: #include <string.h>
1.48 fujimoto 53: #if defined(VISUAL) || defined(__MINGW32__)
1.42 ohara 54: #include <windows.h>
1.44 ohara 55: #include <winnls.h>
1.42 ohara 56: #else
1.44 ohara 57: #include <locale.h>
1.42 ohara 58: #include <unistd.h>
59: #include <sys/types.h>
60: #include <sys/socket.h>
61: #include <sys/wait.h>
1.43 ohara 62: #include <sys/utsname.h>
1.42 ohara 63: #endif
64:
65: static struct {
66: char *type;
67: char *kernel;
68: char *name;
69: char *arch;
70: char *release;
71: char *full;
1.44 ohara 72: char *lang;
1.42 ohara 73: } sysinfo;
1.1 noro 74:
75: void Pctrl();
1.42 ohara 76: void Psysinfo(LIST *rp);
77: static void get_sysinfo();
1.1 noro 78:
79: struct ftab ctrl_tab[] = {
80: {"ctrl",Pctrl,-2},
1.30 noro 81: {"asir_env",Pctrl,-2},
1.42 ohara 82: {"sysinfo", Psysinfo, 0},
1.1 noro 83: {0,0,0},
84: };
85:
1.33 noro 86: extern int error_in_timer;
1.45 noro 87: extern int prtime,nez,echoback,bigfloat,evalef;
1.39 ohara 88: extern int debug_up;
1.1 noro 89: extern int GC_max_heap_size,Verbose,hideargs,hex_output,do_server_in_X11;
1.36 noro 90: extern int do_message,do_terse;
1.4 noro 91: extern int ox_batch,ox_check,ox_exchange_mathcap;
1.1 noro 92: extern int f4_nocheck;
1.16 saito 93: extern int StrassenSize;
1.22 saito 94: extern int outputstyle;
1.3 noro 95: extern int fortran_output;
1.13 noro 96: extern int real_digit;
1.27 noro 97: extern int real_binary;
1.31 noro 98: extern int allow_laurent;
1.12 saito 99: #if defined(INTERVAL)
100: extern int zerorewrite;
1.38 saito 101: extern int Itvplot;
1.12 saito 102: #endif
1.11 noro 103: extern int double_output;
1.14 noro 104: extern int use_new_hensel;
1.15 noro 105: extern int print_quote;
1.20 noro 106: extern int show_crossref;
1.24 noro 107: extern Obj user_defined_prompt;
1.28 ohara 108: extern int asir_setenv;
1.32 noro 109: extern int show_orderspec;
1.34 noro 110: extern int no_debug_on_error;
1.37 noro 111: extern int diag_period;
1.40 noro 112: extern int weight_check;
1.41 ohara 113: extern char **ASIRLOADPATH;
114: extern int ASIRLOADPATH_LEN;
1.51 noro 115: extern int No_ox_reset;
1.54 noro 116: extern int plot_by_bigfloat;
117: extern int debug_plot;
1.1 noro 118:
1.56 noro 119: static struct keyval {
1.1 noro 120: char *key;
121: int *val;
1.56 noro 122: char *desc;
1.1 noro 123: } ctrls[] = {
1.57 ! noro 124: {"StrassenSize",&StrassenSize,"Determines the parameter in Strassen-Winograd matrix multiplication algorithm."},
! 125: {"allow_laurent",&allow_laurent,"If set to 1, negative exponents are allowed in monomials."},
! 126: {"asir_setenv",&asir_setenv,"Not used."},
! 127: {"bigfloat",&bigfloat,"If set to 1, MPFR bigfloat functions are used for floating point evaluation." },
1.56 noro 128: {"cputime",&prtime,"If set to 1, the CPU time at the toplevel is shown." },
1.57 ! noro 129: {"debug_up",&debug_up,"If set to 1, some debug messages are printed in special functions for univariate polynomials."},
! 130: {"debug_window",&do_server_in_X11,"If set to 1, an input window for debugging remote server are shown."},
! 131: {"diag_period",&diag_period,"Determines the frequency of the intermediate inter-reduction in nd_gr()."},
! 132: {"double_output",&double_output,"If set to 1, floating point numbers are printed in the style ddd.ddd."},
1.56 noro 133: {"echo",&echoback,"If set to 1, characters read by the input function are printed." },
1.57 ! noro 134: {"error_in_timer",&error_in_timer,"If set to 1, the usual error handler is executed when the timer is expired."},
1.56 noro 135: {"evalef",&evalef,"If set to 1, elementary functions are evaluated immediately."},
1.57 ! noro 136: {"f4_nocheck",&f4_nocheck,"If set to 1, correctness check of the result of modular computation are omitted in nd_f4()."},
! 137: {"fake_ox_reset",&No_ox_reset,"Determines the treatment of OX reset request for a server which does not implement the reset protocol."},
! 138: {"fortran_output",&fortran_output,"If set to 1, ** is used instead of ^ for representing the power."},
! 139: {"hex",&hex_output,"If set to 1, integers are printed by the hexadecimal notation."},
1.56 noro 140: {"hideargs",&hideargs,"If set to 1, the arguments of a function call are not printed."},
141: {"message",&do_message,"If set to 1, an opening message is printed in ox_asir and ox_plot."},
1.57 ! noro 142: {"new_hensel",&use_new_hensel,"If set to 1, a function hensel2() is used in the univariate factorizer over Q."},
! 143: {"nez",&nez,"If set to 1, a new version of EZGCD implementation is used." },
! 144: {"no_debug_on_error",&no_debug_on_error,"If set to 1, the debug mode is not used."},
! 145: {"no_ox_reset",&No_ox_reset,"Determines the treatment of OX reset request for a server which does not implement the reset protocol."},
1.56 noro 146: {"no_prompt",&do_quiet,"If set to 1, prompts are not shown."},
1.57 ! noro 147: {"outputstyle",&outputstyle,"If set to 1, structured data such as matrices and vectors are printed in the style mat(...), vect(...)."},
1.56 noro 148: {"ox_batch",&ox_batch,"If set to 1, the OX stream are not flushed at each sending of an OX data."},
149: {"ox_check",&ox_check,"If set to 1, mathcap check is done for OpenXM date communication."},
150: {"ox_exchange_mathcap",&ox_exchange_mathcap,"If set to 1, mathcaps are exchanged."},
1.57 ! noro 151: {"print_quote",&print_quote,"Determines the behavior of the printed form of a quote."},
! 152: {"quiet_mode",&do_quiet,"If set to 1, the copyright notices are not printed at the beginning of the session."},
! 153: {"real_binary",&real_binary,"If set to 1, a floating point number is printed by the binary notation."},
1.56 noro 154: {"real_digit",&real_digit,"Determines the number of digits to appear after the decimal point."},
155: {"show_crossref",&show_crossref,"If set to 1, cross-references are shown when a program file is loaded."},
156: {"show_orderspec",&show_orderspec,"If set to 1, the specification of a composite term order is printed upon its creation."},
1.57 ! noro 157: {"terse",&do_terse,"If set to 1, messages are not printed when user-defined callbacks are executed."},
! 158: {"verbose",&Verbose,"If set to 1, a warning is printed if a function is redefined."},
1.56 noro 159: {"weight_check",&weight_check,"If set to 1, an overflow check for the given weight vector is done before starting the Groebner basis computation."},
1.55 noro 160: #if defined(DO_PLOT)
1.56 noro 161: {"plot_by_bigfloat",&plot_by_bigfloat,"If set to 1, computation is done by using MPFR bigfloat functions in ox_plot."},
162: {"debug_plot",&debug_plot,"If set to 1, ox_plot is executed with the message window."},
1.55 noro 163: #endif
1.12 saito 164: #if defined(INTERVAL)
1.56 noro 165: {"zerorewrite",&zerorewrite,""},
166: {"itvplotsize",&Itvplot,""},
1.12 saito 167: #endif
1.1 noro 168: {0,0},
169: };
170:
1.57 ! noro 171: LIST create_control_values(int withdesc)
1.56 noro 172: {
173: int n,i;
174: NODE top,top1,nd;
175: LIST list;
176: STRING key,desc;
177: Q val;
178:
179: n = sizeof(ctrls)/sizeof(struct keyval)-1;
180: top = 0;
181: for ( i = n-1; i >= 0; i-- ) {
182: MKSTR(key,ctrls[i].key);
183: MKSTR(desc,ctrls[i].desc);
184: STOQ(*(ctrls[i].val),val);
1.57 ! noro 185: if ( withdesc )
! 186: nd = mknode(3,key,val,desc);
! 187: else
! 188: nd = mknode(2,key,val);
1.56 noro 189: MKLIST(list,nd);
190: MKNODE(top1,list,top);
191: top = top1;
192: }
193: MKLIST(list,top);
194: return list;
195: }
196:
1.53 noro 197: void Pctrl(NODE arg,Q *rp)
1.1 noro 198: {
1.57 ! noro 199: int t,i,n,desc=0;
1.39 ohara 200: int nm,dv;
1.1 noro 201: N num,den;
202: Q c;
203: char *key;
204: char buf[BUFSIZ];
1.24 noro 205: char *str;
1.41 ohara 206: STRING s;
1.57 ! noro 207: NODE node,p,opt;
1.41 ohara 208: LIST list;
1.50 ohara 209: P f;
1.57 ! noro 210: Obj value;
1.49 ohara 211: extern Q ox_pari_stream;
212: extern int ox_pari_stream_initialized;
1.50 ohara 213: extern P ox_pari_starting_function;
1.1 noro 214:
215: if ( !arg ) {
1.57 ! noro 216: if ( current_option ) {
! 217: for ( opt = current_option; opt; opt = NEXT(opt) ) {
! 218: p = BDY((LIST)BDY(opt));
! 219: key = BDY((STRING)BDY(p));
! 220: value = (Obj)BDY(NEXT(p));
! 221: if ( !strcmp(key,"desc") && value ) {
! 222: desc = value ? 1 : 0;
! 223: break;
! 224: }
! 225: }
! 226: }
! 227: *rp = create_control_values(desc);
1.1 noro 228: return;
229: }
230: key = BDY((STRING)ARG0(arg));
231: if ( !strcmp(key,"adj") ) {
232: /* special treatment is necessary for "adj" */
233: if ( argc(arg) == 1 ) {
1.39 ohara 234: Risa_GC_get_adj(&nm,&dv);
235: UTON(dv,num);
236: UTON(nm,den);
1.1 noro 237: } else {
238: c = (Q)ARG1(arg);
239: if ( !c )
240: error("ctrl : adj : invalid argument");
241: num = NM(c);
242: den = !DN(c)?ONEN:DN(c);
1.39 ohara 243: dv = BD(num)[0];
244: nm = BD(den)[0];
245: Risa_GC_set_adj(nm,dv);
1.1 noro 246: }
247: NDTOQ(num,den,1,*rp);
1.24 noro 248: return;
249: } else if ( !strcmp(key,"prompt") ) {
250: /* special treatment is necessary for "prompt" */
251: if ( argc(arg) == 1 ) {
1.26 takayama 252: if ((!do_quiet) && (user_defined_prompt == (Obj)0)) *rp=ONE;
253: else *rp = (Q)user_defined_prompt;
1.24 noro 254: } else {
255: c = (Q)ARG1(arg);
1.25 noro 256: if ( !c ) {
257: do_quiet = 1;
258: user_defined_prompt = 0;
259: *rp = 0;
260: } else if ( OID(c) == O_STR ) {
261: str = BDY((STRING)c);
262: for ( i = 0, n = 0; str[i]; i++ )
263: if ( str[i] == '%' )
264: n++;
265: if ( n >= 2 )
266: error("ctrl : prompt : invalid prompt specification");
1.24 noro 267: do_quiet = 1;
268: user_defined_prompt = (Obj)c;
269: *rp = c;
270: } else if ( NUM(c) && RATN(c) && UNIQ(c) ) {
271: user_defined_prompt = 0;
272: do_quiet = 0;
273: } else {
274: error("ctrl : prompt : invalid argument");
275: }
276: }
1.1 noro 277: return;
1.41 ohara 278: } else if ( !strcmp(key,"loadpath") ) {
279: *rp = 0;
280: if ( argc(arg) == 1 ) {
281: if( ASIRLOADPATH[0] ) {
282: for(i=0; ASIRLOADPATH[i]; i++) {
283: }
284: for(i--,p=NULL; i>=0; i--,p=node) {
285: MKSTR(s,ASIRLOADPATH[i]);
286: MKNODE(node,s,p);
287: }
288: MKLIST(list,node);
1.53 noro 289: *rp = (Q)list;
1.41 ohara 290: }
291: } else {
292: list = (LIST)ARG1(arg);
293: if ( OID(list) == O_LIST ) {
294: for(i=0,p=BDY(list); p; i++,p=NEXT(p)) {
295: s=(STRING)BDY(p);
296: if(!s || OID(s)!=O_STR) {
297: error("ctrl : loadpath : invalid argument");
298: }
299: }
300: if(i >= ASIRLOADPATH_LEN) {
301: ASIRLOADPATH_LEN = i+1;
302: ASIRLOADPATH = (char **)MALLOC(sizeof(char *)*ASIRLOADPATH_LEN);
303: }
304: for(i=0,p=BDY(list); p; i++,p=NEXT(p)) {
305: ASIRLOADPATH[i] = (char *)BDY((STRING)BDY(p));
306: }
307: ASIRLOADPATH[i] = NULL;
308: }else {
309: error("ctrl : loadpath : invalid argument");
310: }
311: }
312: return;
1.49 ohara 313: } else if ( !strcmp(key,"oxpari_id") ) {
314: if ( argc(arg) == 1 ) {
315: if(!ox_pari_stream_initialized) {
316: t=-1;
317: STOQ(t,*rp);
318: }else {
319: *rp = ox_pari_stream;
320: }
321: }else {
322: c = (Q)ARG1(arg);
323: if ( !c || ( NUM(c) && INT(c) && SGN(c)>0 ) ) {
324: ox_pari_stream_initialized = 1;
325: ox_pari_stream = c;
326: *rp = c;
327: }else {
328: t=-1;
329: STOQ(t,*rp);
330: }
331: }
332: return;
1.50 ohara 333: } else if ( !strcmp(key,"oxpari_start") ) {
334: if ( argc(arg) == 1 ) {
1.53 noro 335: *rp = (Q)ox_pari_starting_function;
1.50 ohara 336: } else {
1.53 noro 337: f = (P)ARG1(arg);
1.50 ohara 338: if ( !f || OID(f) == O_P) {
339: ox_pari_starting_function = f;
1.53 noro 340: *rp = (Q)f;
1.50 ohara 341: }else {
342: *rp = 0;
343: }
344: }
345: return;
1.1 noro 346: }
347: for ( i = 0; ctrls[i].key; i++ )
348: if ( !strcmp(key,ctrls[i].key) )
349: break;
350: if ( ctrls[i].key ) {
351: if ( argc(arg) == 1 )
352: t = *ctrls[i].val;
353: else
354: *ctrls[i].val = t = QTOS((Q)ARG1(arg));
355: STOQ(t,*rp);
356: } else {
357: sprintf(buf,"ctrl : %s : no such key",key);
358: error(buf);
359: }
360: }
1.42 ohara 361:
362: void Psysinfo(LIST *rp)
363: {
364: int i;
365: NODE n,p;
1.44 ohara 366: STRING s[7];
1.42 ohara 367:
368: get_sysinfo();
369: MKSTR(s[0],sysinfo.type); MKSTR(s[1],sysinfo.kernel); MKSTR(s[2],sysinfo.name);
370: MKSTR(s[3],sysinfo.arch); MKSTR(s[4],sysinfo.release); MKSTR(s[5],sysinfo.full);
1.44 ohara 371: MKSTR(s[6],sysinfo.lang);
372: for(i=6,p=NULL; i>=0; i--,p=n) {
1.42 ohara 373: MKNODE(n,s[i],p);
374: }
375: MKLIST(*rp,n);
376: }
377:
1.48 fujimoto 378: #if !defined(VISUAL) && !defined(__MINGW32__)
1.44 ohara 379:
380: static char *get_lang()
381: {
382: char *c, *p, *q;
383: c = setlocale(LC_ALL, NULL); /* saving current locale */
384: p = setlocale(LC_ALL, "");
385: q = (char *)MALLOC(strlen(p)+1);
386: strcpy(q,p);
387: setlocale(LC_ALL, c); /* restoring current locale */
388: return q;
389: }
390:
1.43 ohara 391: static char *myuname(char *option)
1.42 ohara 392: {
393: char buf[BUFSIZ];
394: char *s;
1.43 ohara 395: int fd[2], status, pid;
1.42 ohara 396: *buf = 0;
397: if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) < 0) {
1.43 ohara 398: *buf = 0; return NULL;
1.42 ohara 399: }
1.43 ohara 400: pid = fork();
401: if (pid < 0) {
402: return NULL;
403: }else if (pid == 0) {
1.42 ohara 404: dup2(fd[1], 1);
1.43 ohara 405: close(2);
1.42 ohara 406: execlp("uname", "uname", option, NULL);
407: }
1.43 ohara 408: waitpid(pid, &status, 0);
409: if (status) { /* error */
410: return NULL;
411: }
1.42 ohara 412: s = buf;
413: if( !read(fd[0], s, BUFSIZ-1) || (s = strchr(s, '\n')) ) {
414: *s = 0;
415: }
416: close(fd[0]);
417: close(fd[1]);
418: s = (char *)MALLOC(strlen(buf)+1);
419: strcpy(s, buf);
420: return s;
421: }
422:
423: static void get_sysinfo()
424: {
1.43 ohara 425: static struct utsname u;
1.42 ohara 426: static int initialized = 0;
427: if (initialized) {
428: return;
429: }
430: initialized = 1;
1.43 ohara 431: uname(&u);
432: sysinfo.kernel = u.sysname;
1.42 ohara 433: #if defined(__DARWIN__)
434: sysinfo.type = "macosx";
435: sysinfo.name = sysinfo.kernel;
436: #else
437: sysinfo.type = "unix";
1.43 ohara 438: sysinfo.name = myuname("-o"); // not work on Darwin
439: if (!sysinfo.name) {
440: sysinfo.name = sysinfo.kernel;
441: }
1.42 ohara 442: #endif
1.43 ohara 443: sysinfo.arch = u.machine;
444: sysinfo.release= u.release;
445: sysinfo.full = myuname("-a");
1.44 ohara 446: sysinfo.lang = get_lang();
1.42 ohara 447: }
448:
449: #else
450:
451: /* http://msdn.microsoft.com/ja-jp/library/windows/desktop/ms724834%28v=vs.85%29.aspx */
452: static char *osnameNT(int major, int minor)
453: {
454: if ((major == 3 && minor == 51) || (major == 4 && minor == 0)) {
455: return "WindowsNT";
456: }else if (major == 5 && minor == 0) {
457: return "Windows2000";
458: }else if (major == 5 && minor == 1) {
459: return "WindowsXP";
460: }else if (major == 5 && minor == 2) {
461: return "Windows2003 Server";
462: }else if (major == 6 && minor == 0) {
463: return "WindowsVista";
464: }else if (major == 6 && minor == 1) {
465: return "Windows7";
466: }else if (major == 6 && minor == 2) {
467: return "Windows8";
468: }else if (major == 6 && minor == 3) {
469: return "Windows8.1";
470: }
471: return "unknown";
472: }
473:
474: static char *osname95(int major, int minor)
475: {
476: if (major == 4 && minor == 0) {
477: return "Windows95";
478: }else if (major == 4 && minor == 10) {
479: return "Windows98";
480: }else if (major == 4 && minor == 90) {
481: return "WindowsMe";
482: }
483: return "unknown";
484: }
485:
1.44 ohara 486: static char *get_lang()
487: {
488: char lang[BUFSIZ];
489: char *s;
490: if(GetLocaleInfo(GetUserDefaultLCID(), LOCALE_SISO639LANGNAME, lang, BUFSIZ)) {
491: s = (char *)MALLOC(strlen(lang)+1);
492: strcpy(s,lang);
493: return s;
494: }
495: return "en"; // English
496: }
497:
1.42 ohara 498: static void get_sysinfo()
499: {
500: int arch64 = 0;
501: char buf[BUFSIZ];
502: OSVERSIONINFO v;
503: char *s;
504: static int initialized = 0;
505:
506: if (initialized) {
507: return;
508: }
509: initialized = 1;
510:
511: v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
512: GetVersionEx(&v);
513:
514: sysinfo.type = "windows";
515: sysinfo.arch = "x86";
516: sprintf(buf, "%d.%d.%d", v.dwMajorVersion, v.dwMinorVersion, v.dwBuildNumber);
517: s = (char *)MALLOC(strlen(buf)+1);
518: strcpy(s, buf);
519: sysinfo.release = s;
520:
521: if (v.dwPlatformId == VER_PLATFORM_WIN32_NT) {
522: sysinfo.kernel = "WindowsNT";
523: sysinfo.name = osnameNT(v.dwMajorVersion, v.dwMinorVersion);
524:
525: #if defined(_WIN64)
526: sysinfo.arch = "x86_64";
527: #else
528: // IsWow64Process exists on WindowsXP SP2 or later
529: if(GetProcAddress(GetModuleHandle("kernel32.dll"), "IsWow64Process")) {
530: IsWow64Process(GetCurrentProcess(),&arch64);
531: if(arch64) {
532: sysinfo.arch = "x86_64";
533: }
534: }
535: #endif
536: }else { /* v.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS */
537: sysinfo.kernel = "Windows95";
538: sysinfo.name = osname95(v.dwMajorVersion, v.dwMinorVersion);
539: }
540: sprintf(buf, "%s %s %s %s %s", sysinfo.kernel, sysinfo.release, sysinfo.name, v.szCSDVersion, sysinfo.arch);
541: s = (char *)MALLOC(strlen(buf)+1);
542: strcpy(s, buf);
543: sysinfo.full = s;
1.44 ohara 544: sysinfo.lang = get_lang();
1.42 ohara 545: }
546:
547: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>