mathomatic/lib/mathomatic.h

35 lines
2.1 KiB
C

/*
* Include file for user programs using the Mathomatic symbolic math library API.
*/
#ifndef MATHO_EXTERNS_H
typedef struct MathoMatic MathoMatic;
#endif
extern MathoMatic *newtMathoMatic(void);
extern void closetMathoMatic(MathoMatic *mathomatic);
extern int matho_init(MathoMatic* mathomatic); /* one-time Mathomatic initialization */
extern int matho_process(MathoMatic* mathomatic, char *input, char **outputp); /* Mathomatic command or expression input */
extern int matho_parse(MathoMatic* mathomatic, char *input, char **outputp); /* Mathomatic expression or equation input */
extern void matho_clear(MathoMatic* mathomatic); /* Restart Mathomatic quickly and cleanly, replaces clear_all(). */
extern void free_mem(void); /* Free all allocated memory before quitting Mathomatic, if operating system doesn't when done. */
/* Mathomatic becomes unusable after free_mem(), until matho_init() is called again. */
/* Only Symbian OS is known to need a call to free_mem() before quitting. */
extern int load_rc(MathoMatic* mathomatic, int return_true_if_no_file, FILE *ofp); /* Load Mathomatic startup set options from ~/.mathomaticrc, should allow "set save" to work. */
extern int matho_cur_equation(MathoMatic * mathomatic); /* current equation space number (origin 0) */
extern int matho_result_en(MathoMatic * mathomatic); /* Equation number of the API's returned result, */
/* if the result is also stored in an equation space, */
/* otherwise -1 for no equation number associated with result. */
/* Set by the last call to matho_parse() or matho_process(). */
/* Useful if you want to know where the result string is from, */
/* to act on it with further commands. */
extern const char *matho_get_warning_str(MathoMatic * mathomatic); /* optional warning message generated by the last command */
extern void matho_set_warning_str(MathoMatic * mathomatic, const char *ws);
extern void matho_set_error_str(MathoMatic * mathomatic, const char *ws);
extern int matho_get_abort_flag(MathoMatic* mathomatic);
extern void matho_inc_abort_flag(MathoMatic* mathomatic);