* below for the exact things that are available.
*/
-#ifndef _SHELL_MATH_
-#define _SHELL_MATH_
+#ifndef SHELL_MATH_H
+#define SHELL_MATH_H 1
+
+PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
#if ENABLE_SH_MATH_SUPPORT_64
typedef long long arith_t;
#define arith_t_fmt "%lld"
-#define strto_arith_t strtoll
+#define strto_arith_t strtoull
#else
typedef long arith_t;
#define arith_t_fmt "%ld"
-#define strto_arith_t strtol
+#define strto_arith_t strtoul
#endif
-typedef const char *(*arith_var_lookup_t)(const char *name);
-typedef void (*arith_var_set_t)(const char *name, const char *val, int flags);
-typedef char *(*arith_var_endofname_t)(const char *name);
+/* ash's and hush's endofname is the same, so... */
+# define is_name(c) ((c) == '_' || isalpha((unsigned char)(c)))
+# define is_in_name(c) ((c) == '_' || isalnum((unsigned char)(c)))
+const char* FAST_FUNC endofname(const char *name);
+
+typedef const char* FAST_FUNC (*arith_var_lookup_t)(const char *name);
+typedef void FAST_FUNC (*arith_var_set_t)(const char *name, const char *val);
+//typedef const char* FAST_FUNC (*arith_var_endofname_t)(const char *name);
+
typedef struct arith_eval_hooks {
- arith_var_lookup_t lookupvar;
- arith_var_set_t setvar;
- arith_var_endofname_t endofname;
+ arith_var_lookup_t lookupvar;
+ arith_var_set_t setvar;
+// arith_var_endofname_t endofname;
} arith_eval_hooks_t;
arith_t arith(const char *expr, int *perrcode, arith_eval_hooks_t*);
+POP_SAVED_FUNCTION_VISIBILITY
+
#endif