/************************************************************************* * * * BASIC CONSTANTS AND PREDEFINITIONS * * * * (To include in any program using functions) * * * * ---------------------------------------------------------------------- * * Alain Reverchon, 1988-1990, Paris et Londres [BIBLI 14] * * * * C++ english version by J-P Moreau, Paris * * (reduced to meet the need of fonction.cpp). * * (www.jpmoreau.fr) * *************************************************************************/ #include #include #include #include #define AR_MAXCHAMP 200 #define AR_OUI 1 #define AR_NON 0 #define AR_AVECAPPRO 1 #define AR_SANSAPPRO 0 #define AR_GRAND 1E9 #define AR_PI 4*atan(1) #define COPYNOM(zd, zs) memcpy ((char *) zd, \ (char *) zs, sizeof (ar_nombre)) // ------------------------------ Functions of ARMATH.CPP extern char ar_temp [], ar_temp_2 []; extern int ar_init_math (void); extern void ar_pause (void); extern int ar_arret_demande (void); extern void ar_calcule_rationnel (double, long*, long*); extern void ar_aff_rationnel (double); extern void ar_aff_long (char*, long); extern void ar_aff_long_ln (char*, long); extern void ar_aff_reel (char*, double, int); extern void ar_aff_reel_ln (char*, double, int); typedef struct { int ftype; void *val; char txt [30]; } AR_CHAMP; extern AR_CHAMP *ar_ch; // ---------------------- TO ANALYZE AND EVALUATE FUNCTIONS // list of accepted unitary operators enum ar_op_unaire {FMOINS, FPLUS, FSIN, FCOS, FTAN, FARCSIN, FARCCOS, FARCTAN, FSH, FCH, FTH, FARGSH, FARGCH, FARGTH, FABS, FINT, FFRAC, FFACT, FEXP, FLOG, FSQRT}; //this type can store a function formula to analyse typedef struct { char *debut; //string - example "2*sin(x)/x - 7*x" int maxlen; //length of formula to analyse } ar_fonction; //this type can store any number (integer, rational p/q or real) (1) typedef struct { int reel; //case integer double valeur; //case real long p, q; //case rational (p/q) } ar_nombre; // (1) this type is also used in programs using polynomials // (under the name ar_number). // ------------------------------ Functions of FONCTION.CPP extern ar_fonction ar_glob_f, ar_glob_g; extern double ar_glob_x, ar_glob_y, ar_glob_tab_y []; extern int ar_glob_dim; extern double (*ar_val_fn) (int); extern char *ar_form_cur; extern double ar_evalue (void); extern double ar_val_tab (int); extern double ar_evalue_fonction (ar_fonction*, double (*)(int)); extern double ar_eval_f (double); extern double ar_eval_g (double); extern double ar_eval_fxy (double, double); extern double ar_eval_gxy (double, double); extern double ar_eval_fyi (double, double*); extern int ar_anal_fonction (char *, ar_fonction *); extern int ar_anal_fonc_xyi (char *, ar_fonction *); extern int ar_analyse_fonction (char*, int, int (*)(char*,int), char*, int*); extern void ar_decompile_fonction (char *, char *); // end of file armath.h