diff --git a/src/calculation/expression_parser.c b/src/calculation/expression_parser.c index aefeb499ee..ac2cda000c 100644 --- a/src/calculation/expression_parser.c +++ b/src/calculation/expression_parser.c @@ -389,7 +389,7 @@ typedef struct parser_env { unsigned char Token; unsigned char asn_op; - unsigned error_code; + ParseError error_code; void *numeric_value; void *(*trans_numeric)(unsigned char *digit_str, @@ -477,7 +477,7 @@ void exit_parser(parser_env_ptr pe) } /* exit_parser */ /* return parser error code */ -unsigned get_parse_error(parser_env_ptr pe) +ParseError get_parse_error(parser_env_ptr pe) { if (pe == NULL) return PARSER_NO_ERROR; diff --git a/src/calculation/fin_spl_protos.h b/src/calculation/fin_spl_protos.h index ccf84ad1e2..f178b54344 100644 --- a/src/calculation/fin_spl_protos.h +++ b/src/calculation/fin_spl_protos.h @@ -1,7 +1,29 @@ +/*************************************************************************** + * ------------------- + * create : Tue Jul 11 20:21:18 2000 + * copyright: (C) 2000 by Terry D. Boldt + * email : tboldt@attglobal.net + * ------------------- + ***************************************************************************/ +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +/*************************************************************************** + * Global Function Prototypes + * Tue Jul 11 20:21:18 2000 + * + ***************************************************************************/ + +#ifndef __FIN_SPL_PROTOS_H__ +#define __FIN_SPL_PROTOS_H__ /*==================================================*/ -/* expression_parser.c - */ +/* expression_parser.c */ /* Line Number: 344 */ parser_env_ptr init_parser( var_store_ptr predefined_vars, @@ -16,3 +38,5 @@ parser_env_ptr init_parser( void *right_value), void *negate_numeric(void *value), void free_numeric(void *numeric_value)); + +#endif diff --git a/src/calculation/finproto.h b/src/calculation/finproto.h index 6e7df02ed5..2e90cab747 100644 --- a/src/calculation/finproto.h +++ b/src/calculation/finproto.h @@ -19,6 +19,12 @@ * ***************************************************************************/ +#ifndef __FINPROTO_H__ +#define __FINPROTO_H__ + +#include + +#include "finvar.h" /*==================================================*/ /* fin.c @@ -112,7 +118,7 @@ void Amortization_free( /* Line Number: 377 */ void exit_parser(parser_env_ptr pe); /* Line Number: 400 */ -unsigned get_parse_error(parser_env_ptr pe); +ParseError get_parse_error(parser_env_ptr pe); /* Line Number: 408 */ var_store_ptr get_vars(parser_env_ptr pe); /* Line Number: 417 */ @@ -159,3 +165,5 @@ amort_sched_ptr amort_opt( void prt_amortization_schedule( amort_sched_ptr amortsched, /* amortization schedule to print */ FILE *ofile); /* output file */ + +#endif diff --git a/src/calculation/finvar.h b/src/calculation/finvar.h index c009ea5aca..022d63d1a1 100644 --- a/src/calculation/finvar.h +++ b/src/calculation/finvar.h @@ -19,6 +19,9 @@ * ***************************************************************************/ +#ifndef __FINVAR_H__ +#define __FINVAR_H__ + #if !defined( EOS ) #define EOS '\x000' #endif @@ -34,12 +37,16 @@ #define INT_TYPE '\x001' #define DBL_TYPE '\x002' -#define PARSER_NO_ERROR 0 -#define UNBALANCED_PARENS 1 -#define STACK_OVERFLOW 2 -#define STACK_UNDERFLOW 3 -#define UNDEFINED_CHARACTER 4 -#define NOT_A_VARIABLE 5 +typedef enum +{ + PARSER_NO_ERROR = 0, + UNBALANCED_PARENS, + STACK_OVERFLOW, + STACK_UNDERFLOW, + UNDEFINED_CHARACTER, + NOT_A_VARIABLE, + PARSER_NUM_ERRORS +} ParseError; #define UNUSED_VAR '\x000' #define USED_VAR '\x001' @@ -51,16 +58,15 @@ #define MUL_OP '*' #define ASN_OP '=' -/* The following structure is used by the expression parser to store named and temporary - * variables. - */ +/* The following structure is used by the expression parser to store + * named and temporary variables. */ /* structure used for storing variables - used by expression parser/evaluator */ typedef struct var_store *var_store_ptr; typedef struct var_store { - unsigned char *variable_name; /* vairable name if variable, NULL otherwise */ + unsigned char *variable_name; /* variable name if variable, NULL otherwise */ unsigned char use_flag; /* flag if variable has been assigned to */ unsigned char assign_flag; /* flag if variable is used */ void *value; /* pointer to imp[lementation defined numeric value */ @@ -75,7 +81,7 @@ typedef struct var_store { * evaluate arithmetic operators '+', '-', '/', '*' */ typedef struct numeric *numeric_ptr; typedef struct numeric { - unsigned char type; /* designates type of value */ + unsigned char type; /* designates type of value */ union { long int int_value; /* long integer value */ double dbl_value; /* double value */ @@ -215,3 +221,5 @@ typedef struct financial_info { } financial_info; typedef struct parser_env *parser_env_ptr; + +#endif