IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 21, 2007, 7:48:06 AM (19 years ago)
Author:
eugene
Message:

working towards full boolean db expressions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dvodb.c

    r13439 r13440  
    88*/
    99
     10enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE};
     11
    1012// a single db field
    1113typedef struct {
    12   int fieldNumber;
     14  char *name;
     15  int extract;
     16  int table;
     17  int ID;
    1318  int magMode;
    1419  PhotCode *photcode;
    1520} dvoField;
    1621
    17 ParseFields (int argc, char **argv) {
     22// db boolean operations
     23typedef struct {
     24  char   *name;
     25  char    type;
     26  int     field;
     27  float   Float;
     28} dvoStack;
     29
     30dvoField *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);
    1838
    1939  // 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++) {
    2141    // split the word by ","
    2242    p = argv[i];
     
    3252      // identify field for word
    3353      // 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      }
    3567      free (field);
     68
     69      Nfields ++;
     70      CHECK_REALLOCATE (fields, dvoField, NFIELDS, Nfields, 10);
    3671    }
    3772  }
    3873
     74  *last = i;
     75  *nfields = Nfields;
     76  return (fields);
     77}
Note: See TracChangeset for help on using the changeset viewer.