matho_process(3)

NAME
matho_process - Process Mathomatic command or expression input

SYNOPSIS
int matho_process(char *input, char **outputp);

DESCRIPTION
Process a Mathomatic command or enter an expression into an equation space. The command or expression ASCII string is given as "input", the resulting output string is stored in "*outputp".

matho_init(3) must have been called only one time before this to initialize the Mathomatic symbolic math engine. Use matho_clear(3) as many times as you want to restart Mathomatic for the next group of operations.

This function works just like typing something into the Mathomatic prompt. To only parse any expression or equation and store it, use matho-parse(3).

If this returns true (non-zero), the command or input was successful, and the resulting expression output string is stored in "*outputp". That is a malloc()ed text string which must be free()d after use to return the memory used by the string. The equation number of the equation space that the output expression is additionally stored in (if any) is available in the global "result_en", otherwise result_en = -1.

If this returns false, the command or input failed and a text error message is always stored in "*outputp". The error message is a constant string and should NOT be free()d.

Some commands, like the set command, will return no output when successful, setting "*outputp" to NULL.

The resulting output string can safely be ignored by calling this function with "outputp" set to NULL.

FILE
lib.c