Move structs used to hold custom operators and functions into new header

This commit is contained in:
Danila Fedorin 2018-02-11 22:34:46 -08:00
parent 74034c7b76
commit 3de3f1ec00
2 changed files with 42 additions and 37 deletions

41
include/custom.h Normal file
View File

@ -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

View File

@ -6,41 +6,7 @@
#include "table.h" #include "table.h"
#include "parser.h" #include "parser.h"
#include "result.h" #include "result.h"
#include "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;
};
/** /**
* The main struct of libabacus, * The main struct of libabacus,
@ -65,8 +31,6 @@ struct libab_s {
libab_table table; libab_table table;
}; };
typedef struct libab_operator_s libab_operator;
typedef struct libab_function_s libab_function;
typedef struct libab_s libab; typedef struct libab_s libab;
/** /**