]> git.mxchange.org Git - flightgear.git/blob - LaRCsim/ls_sym.h
a5c53b12ea93e1316b07ab9f729a68997648d3d8
[flightgear.git] / LaRCsim / ls_sym.h
1 /***************************************************************************
2
3         TITLE:          ls_sym.h
4         
5 ----------------------------------------------------------------------------
6
7         FUNCTION:       Header file for symbol table routines
8
9 ----------------------------------------------------------------------------
10
11         MODULE STATUS:  production
12
13 ----------------------------------------------------------------------------
14
15         GENEALOGY:      Created 930629 by E. B. Jackson
16
17 ----------------------------------------------------------------------------
18
19         DESIGNED BY:    Bruce Jackson
20         
21         CODED BY:       same
22         
23         MAINTAINED BY:  
24
25 ----------------------------------------------------------------------------
26
27         MODIFICATION HISTORY:
28         
29         DATE    PURPOSE                                         BY
30
31         950227  Added header and declarations for ls_print_findsym_error(),
32                 ls_get_double(), and ls_get_double() routines.  EBJ
33
34         950302  Added structure for symbol description.         EBJ
35         
36         950306  Added ls_get_sym_val() and ls_set_sym_val() routines.
37                 This is now the production version.             EBJ
38         
39         CURRENT RCS HEADER:
40
41 $Header$
42 $Log$
43 Revision 1.1  1997/05/29 00:10:00  curt
44 Initial Flight Gear revision.
45
46  * Revision 1.9  1995/03/07  12:52:33  bjax
47  * This production version now specified ls_get_sym_val() and ls_put_sym_val().
48  *
49  * Revision 1.6.1.2  1995/03/06  18:45:41  bjax
50  * Added def'n of ls_get_sym_val() and ls_set_sym_val(); changed symbol_rec
51  * Addr field from void * to char *.
52  *  EBJ
53  *
54  * Revision 1.6.1.1  1995/03/03  01:17:44  bjax
55  * Experimental version with just ls_get_double and ls_set_double() routines.
56  *
57  * Revision 1.6  1995/02/27  19:50:49  bjax
58  * Added header and declarations for ls_print_findsym_error(),
59  * ls_get_double(), and ls_set_double().  EBJ
60  *
61
62 ----------------------------------------------------------------------------
63
64         REFERENCES:
65
66 ----------------------------------------------------------------------------
67
68         CALLED BY:
69
70 ----------------------------------------------------------------------------
71
72         CALLS TO:
73
74 ----------------------------------------------------------------------------
75
76         INPUTS:
77
78 ----------------------------------------------------------------------------
79
80         OUTPUTS:
81
82 --------------------------------------------------------------------------*/
83
84 /* Return codes */
85
86 #define SYM_NOT_LOADED -2
87 #define SYM_UNEXPECTED_ERR -1
88 #define SYM_OK 0
89 #define SYM_OPEN_ERR 1
90 #define SYM_NO_SYMS 2
91 #define SYM_MOD_NOT_FOUND 3
92 #define SYM_VAR_NOT_FOUND 4
93 #define SYM_NOT_SCALAR 5
94 #define SYM_NOT_STATIC 6
95 #define SYM_MEMORY_ERR 7 
96 #define SYM_UNMATCHED_PAREN 8
97 #define SYM_BAD_SYNTAX 9
98 #define SYM_INDEX_BOUNDS_ERR 10
99
100 typedef enum {Unknown, Char, UChar, SHint, USHint, Sint, Uint, Slng, Ulng, flt, dbl} vartype;
101
102 typedef char            SYMBOL_NAME[64];
103 typedef vartype         SYMBOL_TYPE;
104
105
106
107 typedef struct
108 {
109     SYMBOL_NAME Mod_Name;
110     SYMBOL_NAME Par_Name;
111     SYMBOL_TYPE Par_Type;
112     SYMBOL_NAME Alias;
113     char        *Addr;
114 }       symbol_rec;
115
116
117 extern int      ls_findsym( const char *modname, const char *varname, 
118                             char **addr, vartype *vtype );
119   
120 extern void     ls_print_findsym_error(int result, 
121                                        char *mod_name, 
122                                        char *var_name);
123   
124 extern double   ls_get_double(vartype sym_type, void *addr );
125   
126 extern void     ls_set_double(vartype sym_type, void *addr, double value );
127
128 extern double   ls_get_sym_val( symbol_rec *symrec, int *error );
129
130         /* This routine attempts to return the present value of the symbol
131            described in symbol_rec. If Addr is non-zero, the value of that
132            location, interpreted as type double, will be returned. If Addr
133            is zero, and Mod_Name and Par_Name are both not null strings, 
134            the ls_findsym() routine is used to try to obtain the address
135            by looking at debugger symbol tables in the executable image, and
136            the value of the double contained at that address is returned, 
137            and the symbol record is updated to contain the address of that
138            symbol. If an error is discovered, 'error' will be non-zero and
139            and error message is printed on stderr.                      */
140
141 extern void     ls_set_sym_val( symbol_rec *symrec, double value );
142
143         /* This routine sets the value of a double at the location pointed
144            to by the symbol_rec's Addr field, if Addr is non-zero. If Addr
145            is zero, and Mod_Name and Par_Name are both not null strings, 
146            the ls_findsym() routine is used to try to obtain the address
147            by looking at debugger symbol tables in the executable image, and
148            the value of the double contained at that address is returned, 
149            and the symbol record is updated to contain the address of that
150            symbol. If an error is discovered, 'error' will be non-zero and
151            and error message is printed on stderr.                      */
152
153
154
155