Changeset 13440 for branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dvodb.c
- Timestamp:
- May 21, 2007, 7:48:06 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dvodb.c
r13439 r13440 8 8 */ 9 9 10 enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE}; 11 10 12 // a single db field 11 13 typedef struct { 12 int fieldNumber; 14 char *name; 15 int extract; 16 int table; 17 int ID; 13 18 int magMode; 14 19 PhotCode *photcode; 15 20 } dvoField; 16 21 17 ParseFields (int argc, char **argv) { 22 // db boolean operations 23 typedef struct { 24 char *name; 25 char type; 26 int field; 27 float Float; 28 } dvoStack; 29 30 dvoField *ParseCmdlineFields (int argc, char **argv, int table, int *last, int *nfields) { 31 32 int i, Nfields, NFIELDS, 33 34 *nfields = 0; 35 Nfields = 0; 36 NFIELDS = 10; 37 ALLOCATE (fields, dvoField, NFIELDS); 18 38 19 39 // examine each argv[i] entry until we reach a where 20 for (i = 0; (i < argc) && strcasecmp (argv[i], "where"); i++) {40 for (i = 1; (i < argc) && strcasecmp (argv[i], "where"); i++) { 21 41 // split the word by "," 22 42 p = argv[i]; … … 32 52 // identify field for word 33 53 // need to know which type of fields to look for... 34 ParseAverageField (); 54 // xxx extend this more generally later 55 if (table == DVO_TABLE_MEASURE) { 56 status = ParseMeasureField (&fields[Nfields], field); 57 } 58 if (table == DVO_TABLE_AVERAGE) { 59 status = ParseAverageField (&fields[Nfields], field); 60 } 61 if (!status) { 62 gprint (GP_ERR, "unknown database field %s\n", field); 63 free (field); 64 free (fields); 65 return (NULL); 66 } 35 67 free (field); 68 69 Nfields ++; 70 CHECK_REALLOCATE (fields, dvoField, NFIELDS, Nfields, 10); 36 71 } 37 72 } 38 73 74 *last = i; 75 *nfields = Nfields; 76 return (fields); 77 }
Note:
See TracChangeset
for help on using the changeset viewer.
