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