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