version 1.25, 2003/09/15 09:31:41 |
version 1.35, 2008/08/01 08:29:40 |
|
|
/* -*- mode: C -*- */ |
/* -*- mode: C -*- */ |
/* $OpenXM: OpenXM/src/ox_toolkit/ox_toolkit.h,v 1.24 2003/08/21 12:44:06 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_toolkit/ox_toolkit.h,v 1.34 2007/03/14 10:30:54 ohara Exp $ */ |
|
|
#ifndef _OX_TOOLKIT_H_ |
#ifndef _OX_TOOLKIT_H_ |
|
|
#define _OX_TOOLKIT_H_ |
#define _OX_TOOLKIT_H_ |
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
|
#include <stdio.h> |
#include <stdio.h> |
#if defined(WITH_GMP) |
|
#include <gmp.h> |
#include <gmp.h> |
#else |
|
#include "gmp_fake.h" |
|
#endif /* WITH_GMP */ |
|
#include <ox/cmotag.h> |
#include <ox/cmotag.h> |
#include <ox/oxMessageTag.h> |
#include <ox/oxMessageTag.h> |
#include <ox/smCommand.h> |
#include <ox/smCommand.h> |
|
|
/* #define FREE(x) free((x)) */ |
/* #define FREE(x) free((x)) */ |
#define FREE(x) |
#define FREE(x) |
|
|
|
#ifdef __cplusplus |
|
extern "C" { |
|
#endif |
|
|
#if !defined(__GNUC__) && !defined(__inline__) |
#if !defined(__GNUC__) && !defined(__inline__) |
#define __inline__ |
#define __inline__ |
#endif |
#endif |
Line 54 typedef struct OXFILE{ |
|
Line 50 typedef struct OXFILE{ |
|
char *wbuf; |
char *wbuf; |
int wbuf_size; |
int wbuf_size; |
int wbuf_count; |
int wbuf_count; |
|
int (*send_double)(struct OXFILE *oxfp, double int64); |
|
double (*receive_double)(struct OXFILE *oxfp); |
} OXFILE; |
} OXFILE; |
|
|
typedef struct cmo { |
typedef struct cmo { |
Line 117 typedef struct { |
|
Line 115 typedef struct { |
|
|
|
typedef struct { |
typedef struct { |
int tag; |
int tag; |
cmo *num; /* Bunshi (cmo_zz) */ |
mpq_t mpq; |
cmo *den; /* Bunbo (cmo_zz) */ |
|
} cmo_qq; |
} cmo_qq; |
|
|
typedef struct { |
typedef struct { |
Line 150 typedef struct { |
|
Line 147 typedef struct { |
|
cmo *coef; /* ZZ, QQ, int32, Poly_in_1var, Tree, Zero, DPoly */ |
cmo *coef; /* ZZ, QQ, int32, Poly_in_1var, Tree, Zero, DPoly */ |
} cmo_recursive_polynomial; |
} cmo_recursive_polynomial; |
|
|
|
typedef struct { |
|
int tag; |
|
cmo_string *name; |
|
cmo_list *attributes; |
|
cmo_list *leaves; |
|
} cmo_tree; |
|
|
|
typedef struct { |
|
int tag; |
|
cmo_list *args; |
|
cmo_tree *body; |
|
} cmo_lambda; |
|
|
typedef cmo ox; |
typedef cmo ox; |
|
|
typedef ox ox_sync_ball; |
typedef ox ox_sync_ball; |
Line 169 cmo_int32* new_cmo_int32(int i); |
|
Line 179 cmo_int32* new_cmo_int32(int i); |
|
cmo_string* new_cmo_string(char* s); |
cmo_string* new_cmo_string(char* s); |
cmo_mathcap* new_cmo_mathcap(cmo* ob); |
cmo_mathcap* new_cmo_mathcap(cmo* ob); |
cmo_list* new_cmo_list(); |
cmo_list* new_cmo_list(); |
|
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(); |
cmo_monomial32* new_cmo_monomial32_size(int size); |
cmo_monomial32* new_cmo_monomial32_size(int size); |
cmo_zz* new_cmo_zz(); |
cmo_zz* new_cmo_zz(); |
Line 177 cmo_zz* new_cmo_zz_set_si(int integer); |
|
Line 189 cmo_zz* new_cmo_zz_set_si(int integer); |
|
cmo_zz* new_cmo_zz_set_mpz(mpz_ptr z); |
cmo_zz* new_cmo_zz_set_mpz(mpz_ptr z); |
cmo_zz* new_cmo_zz_noinit(); |
cmo_zz* new_cmo_zz_noinit(); |
cmo_zz* new_cmo_zz_set_string(char* s); |
cmo_zz* new_cmo_zz_set_string(char* s); |
|
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_zero* new_cmo_zero(); |
cmo_zero* new_cmo_zero(); |
cmo_double* new_cmo_double(double d); |
cmo_double* new_cmo_double(double d); |
cmo_distributed_polynomial* new_cmo_distributed_polynomial(); |
cmo_distributed_polynomial* new_cmo_distributed_polynomial(); |
Line 185 cmo_ring_by_name* new_cmo_ring_by_name(cmo* ob); |
|
Line 200 cmo_ring_by_name* new_cmo_ring_by_name(cmo* ob); |
|
cmo_indeterminate* new_cmo_indeterminate(cmo* ob); |
cmo_indeterminate* new_cmo_indeterminate(cmo* ob); |
cmo_polynomial_in_one_variable* new_cmo_polynomial_in_one_variable(int var); |
cmo_polynomial_in_one_variable* new_cmo_polynomial_in_one_variable(int var); |
cmo_recursive_polynomial* new_cmo_recursive_polynomial(cmo_list* ringdef, cmo* coef); |
cmo_recursive_polynomial* new_cmo_recursive_polynomial(cmo_list* ringdef, cmo* coef); |
|
cmo_tree* new_cmo_tree(cmo_string* name, cmo_list *attributes, cmo_list *leaves); |
|
cmo_lambda* new_cmo_lambda(cmo_list* args, cmo_tree* body); |
cmo_error2* new_cmo_error2(cmo* ob); |
cmo_error2* new_cmo_error2(cmo* ob); |
|
|
ox_data* new_ox_data(cmo* c); |
ox_data* new_ox_data(cmo* c); |
Line 195 char* new_string_set_cmo(cmo* m); |
|
Line 212 char* new_string_set_cmo(cmo* m); |
|
|
|
cmo_error2* make_error_object(int err_code, cmo* ob); |
cmo_error2* make_error_object(int err_code, cmo* ob); |
|
|
|
cmo* ox_parse_lisp(char *s); |
|
|
/* Low level API */ |
/* Low level API */ |
cmo* receive_cmo(OXFILE *fp); |
cmo* receive_cmo(OXFILE *fp); |
cmo* receive_cmo_tag(OXFILE *fp, int tag); |
cmo* receive_cmo_tag(OXFILE *fp, int tag); |
Line 253 int add_hook_after_send_cmo(hook_t func); |
|
Line 272 int add_hook_after_send_cmo(hook_t func); |
|
#define PFLAG_ADDREV 1 |
#define PFLAG_ADDREV 1 |
|
|
typedef struct symbol *symbol_t; |
typedef struct symbol *symbol_t; |
|
|
void setflag_parse(int flag); |
|
cmo *parse(); |
|
void init_parser(char *s); |
|
|
|
symbol_t lookup_by_symbol(char *key); |
symbol_t lookup_by_symbol(char *key); |
symbol_t lookup_by_token(int tok); |
symbol_t lookup_by_token(int tok); |