Other Functions



double adime_evaluate(const char *equation, int *error, double (*var)(const char *name));
Helper function for evaluating arithmetic expressions, which may be useful in your programs even though it isn't really logically connected to the other functions (i.e. it's not a gui function). It evaluates the provided equation, returning the result, and storing a nonzero value in `error' if anything goes wrong. If the `var' function is not NULL, this will be called whenever a variable is encountered in the expression, allowing you to look up and return a suitable value for it. For more information on the expressions, see expressi.txt
See also: adime_uevaluate.

double adime_uevaluate(const char *equation, int *error, double (*var)(const char *name));
Like `adime_evaluate()', but tweaked to fit Adime's purposes better: It silently accepts an empty string without error (being equivalent to "0"), it supports Unicode and it gives an error if the result is NaN.
See also: adime_evaluate.

void adime_double2string(double x, char *buf);
Function for pretty-printing floating point numbers: The number gets at most 10 digits to the left of the decimal point, at most 9 to the right of it, and at most 10 totally. If the absolute value of the number is >= 10000000000 or < 0.000001, it is written in exponential form instead. Exponential form has at most 6 digits in the mantissa, so that the total number of digits never exceeds 9. Does not support Unicode.
See also: adime_udouble2string.

void adime_udouble2string(double val, char *buf)
Unicode-aware version of `adime_double2string()'.
See also: adime_double2string.

char *adime_scancode_to_short_name(int scancode, char *buf)
Converts a keyboard scancode to a string. The string is exactly the text after `KEY_' in the macro name for the key (so the function returns "DELETE" if you feed it with KEY_DELETE). Returns the buffer, or NULL if the scancode didn't match any known key.
See also: adime_scancode_to_pretty_name, adime_short_name_to_scancode.

char *adime_scancode_to_pretty_name(int scancode, char *buf)
The result from `adime_scancode_to_short_name()' is sometimes an abbreviation and may contain underscores. You may want to use this function instead if you are going to display the result for the user: it returns more user-friendly strings.
See also: adime_scancode_to_short_name, adime_short_name_to_scancode.

int adime_short_name_to_scancode(const char *short_name)
Given the name for a key as a string (in the format given by `adime_scancode_to_short_name()'), this function returns the scancode for the key, or -1 if the string doesn't represent any known scancode.
See also: adime_scancode_to_short_name, adime_scancode_to_pretty_name.

Back to Contents