Annotation of OpenXM_contrib2/asir2000/builtin/ctrl.c, Revision 1.6
1.6 ! noro 1: /* $OpenXM: OpenXM_contrib2/asir2000/builtin/ctrl.c,v 1.5 2000/02/07 03:21:42 noro Exp $ */
1.1 noro 2: #include "ca.h"
3: #include "parse.h"
4:
5: void Pctrl();
6:
7: struct ftab ctrl_tab[] = {
8: {"ctrl",Pctrl,-2},
9: {0,0,0},
10: };
11:
12: extern int prtime,nez,echoback,bigfloat;
13: extern int GC_free_space_numerator,GC_free_space_divisor,debug_up,no_prompt;
14: extern int GC_max_heap_size,Verbose,hideargs,hex_output,do_server_in_X11;
15: extern int do_message;
1.4 noro 16: extern int ox_batch,ox_check,ox_exchange_mathcap;
1.1 noro 17: extern int f4_nocheck;
1.3 noro 18: extern int fortran_output;
1.1 noro 19:
20: static struct {
21: char *key;
22: int *val;
23: } ctrls[] = {
24: {"cputime",&prtime},
25: {"nez",&nez},
26: {"echo",&echoback},
1.6 ! noro 27: #if DO_PLOT
1.1 noro 28: {"bigfloat",&bigfloat},
1.6 ! noro 29: #endif
1.1 noro 30: {"verbose",&Verbose},
31: {"hideargs",&hideargs},
32: {"hex",&hex_output},
33: {"debug_window",&do_server_in_X11},
34: {"message",&do_message},
35: {"debug_up",&debug_up},
36: {"no_prompt",&no_prompt},
37: {"ox_batch",&ox_batch},
38: {"ox_check",&ox_check},
1.5 noro 39: {"ox_exchange_mathcap",&ox_exchange_mathcap},
1.1 noro 40: {"f4_nocheck",&f4_nocheck},
1.3 noro 41: {"fortran_output",&fortran_output},
1.1 noro 42: {0,0},
43: };
44:
45: void Pctrl(arg,rp)
46: NODE arg;
47: Q *rp;
48: {
49: int t,i;
50: N num,den;
51: Q c;
52: char *key;
53: char buf[BUFSIZ];
54:
55: if ( !arg ) {
56: *rp = 0;
57: return;
58: }
59: key = BDY((STRING)ARG0(arg));
60: if ( !strcmp(key,"adj") ) {
61: /* special treatment is necessary for "adj" */
62: if ( argc(arg) == 1 ) {
63: UTON(GC_free_space_divisor,num);
64: UTON(GC_free_space_numerator,den);
65: } else {
66: c = (Q)ARG1(arg);
67: if ( !c )
68: error("ctrl : adj : invalid argument");
69: num = NM(c);
70: den = !DN(c)?ONEN:DN(c);
71: GC_free_space_divisor = BD(num)[0];
72: GC_free_space_numerator = BD(den)[0];
73: }
74: NDTOQ(num,den,1,*rp);
75: return;
76: }
77: for ( i = 0; ctrls[i].key; i++ )
78: if ( !strcmp(key,ctrls[i].key) )
79: break;
80: if ( ctrls[i].key ) {
81: if ( argc(arg) == 1 )
82: t = *ctrls[i].val;
83: else
84: *ctrls[i].val = t = QTOS((Q)ARG1(arg));
85: STOQ(t,*rp);
86: } else {
87: sprintf(buf,"ctrl : %s : no such key",key);
88: error(buf);
89: }
90: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>