From 3de3f1ec00d02e7665673a910f239e225363553f Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sun, 11 Feb 2018 22:34:46 -0800 Subject: [PATCH] Move structs used to hold custom operators and functions into new header --- include/custom.h | 41 +++++++++++++++++++++++++++++++++++++++++ include/libabacus.h | 38 +------------------------------------- 2 files changed, 42 insertions(+), 37 deletions(-) create mode 100644 include/custom.h diff --git a/include/custom.h b/include/custom.h new file mode 100644 index 0000000..0bb83df --- /dev/null +++ b/include/custom.h @@ -0,0 +1,41 @@ +#ifndef LIBABACUS_CUSTOM_H +#define LIBABACUS_CUSTOM_H + +/** + * A function pointer that is called + * to execute a certain type of function. + */ +typedef void(*libab_function_ptr)(); + +/** + * A struct that holds informatiion + * about an operator that has been + * registered with libabacus. + */ +struct libab_operator_s { + /** + * The precedence of the operator. + */ + int precedence; + /** + * The functionality of the operator. + */ + libab_function_ptr function; +}; + +/** + * A struct that holds information + * about an function that has been + * registered with libabacus. + */ +struct libab_function_s { + /** + * The functionality of the function. + */ + libab_function_ptr function; +}; + +typedef struct libab_operator_s libab_operator; +typedef struct libab_function_s libab_function; + +#endif diff --git a/include/libabacus.h b/include/libabacus.h index 2719834..5880b76 100644 --- a/include/libabacus.h +++ b/include/libabacus.h @@ -6,41 +6,7 @@ #include "table.h" #include "parser.h" #include "result.h" - -/** - * A function pointer that is called - * to execute a certain type of function. - */ -typedef void(*libab_function_ptr)(); - -/** - * A struct that holds informatiion - * about an operator that has been - * registered with libabacus. - */ -struct libab_operator_s { - /** - * The precedence of the operator. - */ - int precedence; - /** - * The functionality of the operator. - */ - libab_function_ptr function; -}; - -/** - * A struct that holds information - * about an function that has been - * registered with libabacus. - */ -struct libab_function_s { - /** - * The functionality of the function. - */ - libab_function_ptr function; -}; - +#include "custom.h" /** * The main struct of libabacus, @@ -65,8 +31,6 @@ struct libab_s { libab_table table; }; -typedef struct libab_operator_s libab_operator; -typedef struct libab_function_s libab_function; typedef struct libab_s libab; /**