=================================================================== RCS file: /home/cvs/OpenXM/src/ox_toolkit/ox_toolkit.h,v retrieving revision 1.32 retrieving revision 1.43 diff -u -p -r1.32 -r1.43 --- OpenXM/src/ox_toolkit/ox_toolkit.h 2005/07/26 12:52:05 1.32 +++ OpenXM/src/ox_toolkit/ox_toolkit.h 2016/08/23 02:24:19 1.43 @@ -1,23 +1,23 @@ /* -*- mode: C -*- */ -/* $OpenXM: OpenXM/src/ox_toolkit/ox_toolkit.h,v 1.31 2005/07/20 17:48:03 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_toolkit/ox_toolkit.h,v 1.42 2016/07/14 08:16:19 ohara Exp $ */ #ifndef _OX_TOOLKIT_H_ - #define _OX_TOOLKIT_H_ -#ifdef __cplusplus -extern "C" { -#endif #include #include +#include #include #include #include #include -#define OX_PROTOCOL_VERSION 20050304 -#define OX_TOOLKIT_VERSION "ox_toolkit version 2005.7.20" +#if defined(_MSC_VER) +#include +#else +#include +#endif #define MALLOC(x) GC_MALLOC((x)) #define MALLOC_ATOMIC(x) GC_MALLOC_ATOMIC((x)) @@ -25,14 +25,24 @@ extern "C" { /* #define FREE(x) free((x)) */ #define FREE(x) +#ifdef __cplusplus +extern "C" { +#endif + #if !defined(__GNUC__) && !defined(__inline__) #define __inline__ #endif /* Mathcap Local Database */ typedef struct { - int *cmd; - int *cmo; + int tag; + int flag; +} table; + +typedef struct mathcap { + table *cmotbl; + table *smtbl; + char **opts; } mathcap; /* OpenXM File Descripter */ @@ -52,6 +62,18 @@ typedef struct OXFILE{ double (*receive_double)(struct OXFILE *oxfp); } OXFILE; +#if 0 +#define OX_FD_SETSIZE FD_SETSIZE +#else +#define OX_FD_SETSIZE 32 +#endif + +typedef struct { + int count; + fd_set fdset; + OXFILE *p[OX_FD_SETSIZE]; +} OXFILE_set; + typedef struct cmo { int tag; } cmo; @@ -113,12 +135,21 @@ typedef struct { typedef struct { int tag; - cmo *num; /* Bunshi (cmo_zz) */ - cmo *den; /* Bunbo (cmo_zz) */ + mpq_t mpq; } cmo_qq; typedef struct { int tag; + mpfr_t mpfr; +} cmo_bf; + +typedef struct { + int tag; + cmo *re,*im; +} cmo_complex; + +typedef struct { + int tag; double d; /* machine dependent */ } cmo_double; @@ -178,8 +209,8 @@ cmo_int32* new_cmo_int32(int i); cmo_string* new_cmo_string(char* s); cmo_mathcap* new_cmo_mathcap(cmo* ob); cmo_list* new_cmo_list(); -cmo_list* new_cmo_list_set(void *a[], int n); -cmo_list* new_cmo_list_map(void *a[], int n, void *(* mapf)(void *)); +cmo_list* new_cmo_list_array(void *a[], int n); +cmo_list* new_cmo_list_array_map(void *a[], int n, void *(* mapf)(void *)); cmo_monomial32* new_cmo_monomial32(); cmo_monomial32* new_cmo_monomial32_size(int size); cmo_zz* new_cmo_zz(); @@ -188,9 +219,13 @@ cmo_zz* new_cmo_zz_set_si(int integer); cmo_zz* new_cmo_zz_set_mpz(mpz_ptr z); cmo_zz* new_cmo_zz_noinit(); cmo_zz* new_cmo_zz_set_string(char* s); -cmo_qq* new_cmo_qq_noinit(); +cmo_qq* new_cmo_qq(); cmo_qq* new_cmo_qq_set_mpq(mpq_ptr q); cmo_qq* new_cmo_qq_set_mpz(mpz_ptr num, mpz_ptr den); +cmo_bf* new_cmo_bf(); +cmo_bf* new_cmo_bf_set_mpfr(mpfr_ptr q); +cmo_complex* new_cmo_complex(); +cmo_complex* new_cmo_complex_set_re_im(cmo *re,cmo *im); cmo_zero* new_cmo_zero(); cmo_double* new_cmo_double(double d); cmo_distributed_polynomial* new_cmo_distributed_polynomial(); @@ -251,8 +286,7 @@ cmo_list* list_append_monomial(cmo_list* , cm cmo_list* list_appendl(cmo_list*, ...); int list_length(cmo_list* ); cmo* list_nth(cmo_list* , int n); -void** list_to_array(cmo_list *c); -void** list_to_array_map(cmo_list *c, void *(* mapf)(void *)); +cmo* list_first_cmo(cmo_list *); int cmolen_cmo(cmo* m); void dump_buffer_init(char *s); @@ -263,6 +297,8 @@ void dump_ox_data(ox_data* m); void print_cmo(cmo* c); void resize_mpz(mpz_ptr mpz, int size); +int cmo_to_int(cmo *n); + typedef cmo *(*hook_t)(OXFILE *, cmo *); int add_hook_before_send_cmo(hook_t func); @@ -282,9 +318,11 @@ char* get_symbol_by_tag(int tag); /* for mathcap database */ mathcap *new_mathcap(); -void mathcap_init(char *version, char *sysname); +void mathcap_init(int ver, char *vstr, char *sysname, int cmos[], int sms[]); +void mathcap_init2(int ver, char *vstr, char *sysname, int cmos[], int sms[], char *options[]); cmo_mathcap* mathcap_get(mathcap *); mathcap *mathcap_update(mathcap *, cmo_mathcap *mc); +int mathcap_allowQ_cmo(mathcap *, cmo *ob); int oxf_read(void *buffer, size_t size, size_t num, OXFILE *oxfp); int oxf_write(void *buffer, size_t size, size_t num, OXFILE *oxfp);