Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:04

0001 #ifndef MAD_VAR_H
0002 #define MAD_VAR_H
0003 
0004 // types
0005 
0006 struct in_cmd;
0007 struct name_list;
0008 struct command_list;
0009 struct expression;
0010 
0011 struct constant
0012 {
0013   char name[NAME_L];
0014   struct expression* exp;     /* pointer to defining expression (always) */
0015   double value;
0016   int stamp;
0017 };
0018 
0019 struct variable
0020 {
0021   char name[NAME_L];
0022   int status;                 /* 0 value not evaluated, 1 evaluated */
0023   int type;                   /* 0 constant, 1 direct, 2 deferred, 3 string */
0024   int val_type;               /* 0 int 1 double (0..2) */
0025   char* string;               /* pointer to string if 3 */
0026   struct expression* expr;    /* pointer to defining expression (0..2) */
0027   double value;               /* (0..2) */
0028   int stamp;
0029 };
0030 
0031 struct var_list         /* contains list of variable pointers sorted by name */
0032 {
0033   int stamp;
0034   char name[NAME_L];
0035   int  max,                     /* max. pointer array size */
0036        curr;                    /* current occupation */
0037   struct name_list* list;       /* index list of names */
0038   struct variable** vars;       /* variable pointer list */
0039 };
0040 
0041 // interface
0042 
0043 void             enter_variable(struct in_cmd*); /* stores variable contained in cmd */
0044 struct variable* new_variable(const char* name, double val, int val_type, int type, struct expression*, char* string);
0045 double           variable_value(struct variable*);
0046 
0047 struct var_list* new_var_list(int length);
0048 struct var_list* clone_var_list(struct var_list*);
0049 struct var_list* delete_var_list(struct var_list*);
0050 void             add_to_var_list(struct variable*, struct var_list*, int flag);
0051 struct variable* find_variable(const char* name, struct var_list*);
0052 
0053 char*   make_string_variable(char* string);
0054 void    write_vars(struct var_list*, struct command_list*, FILE*, int noexpr);
0055 void    write_vars_8(struct var_list*, struct command_list*, FILE*);
0056 void    set_variable(const char* name, double* value);
0057 void    set_stringvar(const char* name, char* string);
0058 double  get_variable(const char* name);
0059 char*   get_varstring(const char* name);
0060 void    get_defined_constants(void);
0061 
0062 #endif // MAD_VAR_H
0063