manning@chamber.caltech.edu (Evan Marshall Manning) (09/18/90)
On my current project I need to read in an external ascii table and allow it to access fields in internal structures and specify calls to certain calls. I would also like to use constants from #defines and enums in the tables. My current approach includes an internal desciptor structure for each structure: assert_less( config.data_start, pipe.dest_code, sap.rcvr[MAX_RCVRS], 34, sap.snr, sap.obs, 56 : sap.obs) ; ':' starts output arguments The tables might have entries that look like: typedef enum { TYPE_SHORT, TYPE_LONG, TYPE_DOUBLE, TYPE_STRING } type_id_type; typedef struct { char field_name[MAX_NAME_LEN]; type_id_type field_type; int field_offset; } struct_table_type; struct_table_type status[] = { {"format_type", TYPE_SHORT, offsetof(FMSTATUS, fm_format_type)}, {"obs", TYPE_SHORT, offsetof(FMSTATUS, fm_obs)}, {"input_cnt", TYPE_SHORT, offsetof(FMSTATUS, fm_input_cnt)}, {"output_cnt", TYPE_SHORT, offsetof(FMSTATUS, fm_output_cnt)}, } But of course this requires manually maintaining the parallel FMSTATUS and status[] tables. Has anybody done anything like this? Thanks. *************************************************************************** Your eyes are weary from staring at the CRT for so | Evan M. Manning long. You feel sleepy. Notice how restful it is | is to watch the cursor blink. Close your eyes. The |manning@gap.cco.caltech.edu opinions stated above are yours. You cannot | manning@mars.jpl.nasa.gov imagine why you ever felt otherwise. | gleeper@tybalt.caltech.edu