[BACK]Return to ctrl.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / builtin

Annotation of OpenXM_contrib2/asir2000/builtin/ctrl.c, Revision 1.7

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>