Rename *ll* and *ul* to ll and ul in make-defint-assumptions
[maxima.git] / archive / o / try.c
blobee11744cea34f8efdb2107bd8bc7b26f95fc2c9a
2 #include "const.h"
3 #include "plot.h"
6 #undef TRUE
7 #undef FALSE
8 #undef CALL
11 #include <stdio.h>
12 #ifdef AIX3
13 #include <sys/select.h>
14 #endif
15 #include <rpc/rpc.h>
16 #define MAX_ARRAY(x) (x ? x : 20000)
17 #define CHECK(x) if (!x) {fprintf(stderr,"xdr failed"); exit(1);}
20 struct value_function
21 { char * body ;
22 int length;
23 char *name;
24 struct value *constants;
27 struct value*
28 complex(a,r,i)
29 double r,i;
30 struct value *a;
31 { a->type= CMPLX;
32 a->v.cmplx_val.real = r;
33 a->v.cmplx_val.imag = i;
34 return a;
36 struct value*
37 integer(a,i)
38 int i;
39 struct value *a;
40 { a->type= INT;
41 a->v.int_val = i;
42 return a;
46 struct value *
47 xdr_read_values(xdrsp,length,result)
48 struct value **result;
49 int *length;
50 XDR *xdrsp;
51 {int n;
52 struct value *ans;
53 int type;
54 CHECK(xdr_int(xdrsp,&n));
55 *length = n;
56 *result = ans = (void *)malloc(sizeof(struct value)*n);
57 while (--n >= 0)
58 { xdr_int(type,&type);
59 if (type == CMPLX)
60 { CHECK(xdr_double(xdrsp,&(ans->v.cmplx_val.real)));
61 CHECK(xdr_double(xdrsp,&(ans->v.cmplx_val.imag)));
62 ans->type = CMPLX;
64 else
65 if (type == INT)
66 { CHECK(xdr_int(xdrsp,&(ans->v.int_val)));
67 ans->type = INT;
69 else
70 if (type == REAL)
71 { CHECK(xdr_double(xdrsp,&(ans->v.cmplx_val.real)));
72 ans->v.cmplx_val.imag = 0.0 ;
73 ans->type = CMPLX;
76 return 0;
79 main(argc,argv )
80 char *argv[];
82 {XDR xdrs;
83 int invoked=0;
84 int length;
85 struct value a;
86 xdrstdio_create(&xdrs, stdin, XDR_DECODE);
88 xdrstdio_create(&xdrs, stdin, XDR_DECODE);
89 DO_ARGS:
90 { struct value_function f;
91 f.body=0;
92 f.constants=0;
93 CHECK(xdr_bytes(&xdrs,&f.body,&f.length,MAX_ARRAY(0)));
94 CHECK(xdr_read_values(&xdrs,&length,&f.constants));
96 /* invoke the function */
97 push(complex(&a,atod(argv[1]),atod(argv[2])));
99 execute_fun(&f);
101 exit(0);}}}