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

Annotation of OpenXM_contrib2/asir2000/engine/init.c, Revision 1.1.1.1

1.1       noro        1: /* $OpenXM: OpenXM/src/asir99/engine/init.c,v 1.1.1.1 1999/11/10 08:12:26 noro Exp $ */
                      2: #include "ca.h"
                      3: #include "version.h"
                      4:
                      5: struct oN oUNIN,oTWON,oTHREEN,oFOURN,oFIVEN,oSIXN,oSEVENN,oEIGHTN;
                      6: struct oQ oUNIQ,oTWOQ,oTHREEQ,oFOURQ,oFIVEQ,oSIXQ,oSEVENQ,oEIGHTQ;
                      7:
                      8: struct oUP2 oONEUP2;
                      9:
                     10: N ONEN = &oUNIN;
                     11: Q ONE = &oUNIQ;
                     12: Q TWO = &oTWOQ;
                     13: Q THREE = &oTHREEQ;
                     14: Q FOUR = &oFOURQ;
                     15: Q FIVE = &oFIVEQ;
                     16: Q SIX = &oSIXQ;
                     17: Q SEVEN = &oSEVENQ;
                     18: Q EIGHT = &oEIGHTQ;
                     19:
                     20: LM THREE_LM,FOUR_LM,EIGHT_LM;
                     21:
                     22: struct oR oUNIR;
                     23: struct oMQ oUNIMQ;
                     24: struct oLM oUNILM;
                     25: struct oC oIU;
                     26: struct oUSINT oVOID;
                     27:
                     28: MQ ONEM = &oUNIMQ;
                     29: LM ONELM = &oUNILM;
                     30: UP2 ONEUP2 = &oONEUP2;
                     31: C IU = &oIU;
                     32: USINT VOIDobj = &oVOID;
                     33:
                     34: int bigfloat;
                     35: int nez = 1;
                     36: int current_mod = 0;
                     37:
                     38: #if PARI
                     39: #if defined(THINK_C)
                     40: int paristack = 1<<16;
                     41: #else
                     42: int paristack = 1<<20;
                     43: #endif
                     44:
                     45: void (*addnumt[])() = { addq, addreal, addalg, addbf, addcplx, addmi, addlm, addgf2n, addgfpn };
                     46: void (*subnumt[])() = { subq, subreal, subalg, subbf, subcplx, submi, sublm, subgf2n, subgfpn };
                     47: void (*mulnumt[])() = { mulq, mulreal, mulalg, mulbf, mulcplx, mulmi, mullm, mulgf2n, mulgfpn };
                     48: void (*divnumt[])() = { divq, divreal, divalg, divbf, divcplx, divmi, divlm, divgf2n, divgfpn };
                     49: void (*pwrnumt[])() = { pwrq, pwrreal, pwralg, pwrbf, pwrcplx, pwrmi, pwrlm, pwrgf2n, pwrgfpn };
                     50: void (*chsgnnumt[])() = { chsgnq, chsgnreal, chsgnalg, chsgnbf, chsgncplx, chsgnmi, chsgnlm, chsgngf2n, chsgngfpn };
                     51: int (*cmpnumt[])() = { cmpq, cmpreal, cmpalg, cmpbf, cmpcplx, cmpmi, cmplm, cmpgf2n, cmpgfpn };
                     52: #else
                     53: void (*addnumt[])() = { addq, addreal, addalg, 0, addcplx, addmi, addlm, addgf2n, addgfpn };
                     54: void (*subnumt[])() = { subq, subreal, subalg, 0, subcplx, submi, sublm, subgf2n, subgfpn };
                     55: void (*mulnumt[])() = { mulq, mulreal, mulalg, 0, mulcplx, mulmi, mullm, mulgf2n, mulgfpn };
                     56: void (*divnumt[])() = { divq, divreal, divalg, 0, divcplx, divmi, divlm, divgf2n,divgfpn };
                     57: void (*pwrnumt[])() = { pwrq, pwrreal, pwralg, 0, pwrcplx, pwrmi, pwrlm, pwrgf2n, pwrgfpn };
                     58: void (*chsgnnumt[])() = { chsgnq, chsgnreal, chsgnalg, 0, chsgncplx, chsgnmi, chsgnlm, chsgngf2n, chsgngfpn };
                     59: int (*cmpnumt[])() = { cmpq, cmpreal, cmpalg, 0, cmpcplx, cmpmi, cmplm, cmpgf2n, cmpgfpn };
                     60: #endif
                     61:
                     62: double get_current_time();
                     63:
                     64: void nglob_init() {
                     65:        PL(&oUNIN) = 1; BD(&oUNIN)[0] = 1;
                     66:        PL(&oTWON) = 1; BD(&oTWON)[0] = 2;
                     67:        PL(&oTHREEN) = 1; BD(&oTHREEN)[0] = 3;
                     68:        PL(&oFOURN) = 1; BD(&oFOURN)[0] = 4;
                     69:        PL(&oFIVEN) = 1; BD(&oFIVEN)[0] = 5;
                     70:        PL(&oSIXN) = 1; BD(&oSIXN)[0] = 6;
                     71:        PL(&oSEVENN) = 1; BD(&oSEVENN)[0] = 7;
                     72:        PL(&oEIGHTN) = 1; BD(&oEIGHTN)[0] = 8;
                     73:
                     74:        oONEUP2.w = 1; oONEUP2.b[0] = 1;
                     75:
                     76:        OID(&oUNIQ) = O_N; NID(&oUNIQ) = N_Q;
                     77:        SGN(&oUNIQ) = 1; NM(&oUNIQ) = &oUNIN; DN(&oUNIQ) = 0;
                     78:
                     79:        OID(&oTWOQ) = O_N; NID(&oTWOQ) = N_Q;
                     80:        SGN(&oTWOQ) = 1; NM(&oTWOQ) = &oTWON; DN(&oTWOQ) = 0;
                     81:
                     82:        OID(&oTHREEQ) = O_N; NID(&oTHREEQ) = N_Q;
                     83:        SGN(&oTHREEQ) = 1; NM(&oTHREEQ) = &oTHREEN; DN(&oTHREEQ) = 0;
                     84:
                     85:        OID(&oFOURQ) = O_N; NID(&oFOURQ) = N_Q;
                     86:        SGN(&oFOURQ) = 1; NM(&oFOURQ) = &oFOURN; DN(&oFOURQ) = 0;
                     87:
                     88:        OID(&oFIVEQ) = O_N; NID(&oFIVEQ) = N_Q;
                     89:        SGN(&oFIVEQ) = 1; NM(&oFIVEQ) = &oFIVEN; DN(&oFIVEQ) = 0;
                     90:
                     91:        OID(&oSIXQ) = O_N; NID(&oSIXQ) = N_Q;
                     92:        SGN(&oSIXQ) = 1; NM(&oSIXQ) = &oSIXN; DN(&oSIXQ) = 0;
                     93:
                     94:        OID(&oSEVENQ) = O_N; NID(&oSEVENQ) = N_Q;
                     95:        SGN(&oSEVENQ) = 1; NM(&oSEVENQ) = &oSEVENN; DN(&oSEVENQ) = 0;
                     96:
                     97:        OID(&oEIGHTQ) = O_N; NID(&oEIGHTQ) = N_Q;
                     98:        SGN(&oEIGHTQ) = 1; NM(&oEIGHTQ) = &oEIGHTN; DN(&oEIGHTQ) = 0;
                     99:
                    100:        OID(&oUNIR) = O_R; NM(&oUNIR) = (P)&oUNIQ; DN(&oUNIR) = (P)&oUNIQ; oUNIR.reduced = 1;
                    101:        OID(&oUNIMQ) = O_N; NID(&oUNIMQ) = N_M; CONT(&oUNIMQ) = 1;
                    102:        OID(&oUNILM) = O_N; NID(&oUNILM) = N_LM; BDY(&oUNILM) = ONEN;
                    103:        OID(&oIU) = O_N; NID(&oIU) = N_C; oIU.r = 0; oIU.i = (Num)ONE;
                    104:
                    105:        MKLM(&oTHREEN,THREE_LM);
                    106:        MKLM(&oFOURN,FOUR_LM);
                    107:        MKLM(&oEIGHTN,EIGHT_LM);
                    108:
                    109:        OID(&oVOID) = O_VOID;
                    110:
                    111: /* moved to parse/main.c */
                    112: #if 0
                    113: #if PARI
                    114:        risa_pari_init();
                    115: #endif
                    116:        srandom((int)get_current_time());
                    117: #endif
                    118:        init_up2_tab();
                    119: }
                    120:
                    121: extern double gctime;
                    122: double suspend_start;
                    123: double suspended_time=0;
                    124:
                    125: void get_eg(p)
                    126: struct oEGT *p;
                    127: {
                    128:        p->exectime = get_clock() - gctime - suspended_time; p->gctime = gctime;
                    129: }
                    130:
                    131: void init_eg(eg)
                    132: struct oEGT *eg;
                    133: {
                    134:        bzero((char *)eg,sizeof(struct oEGT));
                    135: }
                    136:
                    137: void add_eg(base,start,end)
                    138: struct oEGT *base,*start,*end;
                    139: {
                    140:        base->exectime += end->exectime - start->exectime;
                    141:        base->gctime += end->gctime - start->gctime;
                    142: }
                    143:
                    144: void print_eg(item,eg)
                    145: char *item;
                    146: struct oEGT *eg;
                    147: {
                    148:        printf("%s=(%.4g,%.4g)",item,eg->exectime,eg->gctime);
                    149: }
                    150:
                    151: void print_split_eg(start,end)
                    152: struct oEGT *start,*end;
                    153: {
                    154:        struct oEGT base;
                    155:
                    156:        init_eg(&base); add_eg(&base,start,end);
                    157:        printf("(%.4g,%.4g)",base.exectime,base.gctime);
                    158: }
                    159:
                    160: void print_split_e(start,end)
                    161: struct oEGT *start,*end;
                    162: {
                    163:        struct oEGT base;
                    164:
                    165:        init_eg(&base); add_eg(&base,start,end);
                    166:        printf("(%.4g)",base.exectime);
                    167: }
                    168:
                    169: void suspend_timer() {
                    170:        suspend_start = get_clock();
                    171: }
                    172:
                    173: void resume_timer() {
                    174:        suspended_time += get_clock()-suspend_start;
                    175: }
                    176:
                    177: extern int lm_lazy, up_lazy;
                    178: extern GC_dont_gc;
                    179:
                    180: void reset_engine() {
                    181:        lm_lazy = 0; up_lazy = 0;
                    182:        GC_dont_gc = 0;
                    183: }
                    184:
                    185: unsigned int get_asir_version() {
                    186:        return ASIR_VERSION;
                    187: }

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