IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 7, 2008, 3:31:01 PM (18 years ago)
Author:
eugene
Message:

big update from eam_branch_20081124 with updates to Opihi math

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/dbCheckStack.c

    r20818 r20936  
    11# include "dvoshell.h"
     2
     3// XXX we are using a fairly bogus set of char values to distinguish a few cases:
     4// 's', 'S' : value is a scalar (upper == float; lower == int)
     5// 'f', 'F' : value is a field (upper == float; lower == int)
     6// 't', 'T' : value is a temp scalar (upper == float; lower == int)
     7// these would be better done using bit values to test for field? temp? float?
    28
    39int dbCheckStack (dbStack *stack, int Nstack, int table, dbField **inFields, int *inNfields) {
    410
    511  int i, j, status, NFIELDS, Nfields;
    6   char *c;
     12  char *c1, *c2;
    713  dbField *fields;
    814
     
    1420
    1521  for (i = 0; i < Nstack; i++) {
    16     if (stack[i].type == 'X') {
     22    if (stack[i].type == DB_STACK_VALUE) {
    1723
    18       /** if this is a number, put it on the list of scalers and move on **/
    19       stack[i].Float = strtod (stack[i].name, &c);
    20       if (c == stack[i].name + strlen (stack[i].name)) {
    21         stack[i].type  = 'S';
     24      /** if this is a number, put it on the list of scalars and move on.  assume value is
     25       * an int unless proven otherwise **/
     26      stack[i].FltValue = strtod (stack[i].name, &c1);
     27      stack[i].IntValue = strtol (stack[i].name, &c2, 0);
     28      if (c2 == stack[i].name + strlen (stack[i].name)) {
     29        stack[i].type  |= DB_STACK_INT;
     30        continue;
     31      }
     32      if (c1 == stack[i].name + strlen (stack[i].name)) {
     33        // this is a float value
    2234        continue;
    2335      }
     
    4456          code = GetPhotcodebyName (tmpstring);
    4557          if (code) {
    46               stack[i].Float = code->code;
    47               stack[i].type  = 'S';
     58              stack[i].IntValue = code->code;
     59              stack[i].type = DB_STACK_INT;
    4860              continue;
    4961          }
     
    6072      if (j < Nfields) {
    6173        stack[i].field = j;
    62         stack[i].type  = 'F';
     74        stack[i].type |= DB_STACK_FIELD;
     75        if (fields[j].type == OPIHI_INT) {
     76          stack[i].type |= DB_STACK_INT;
     77        }
    6378        stack[i].name  = NULL;
    64         stack[i].Float = 0.0;
     79        stack[i].FltValue = 0.0;
     80        stack[i].IntValue =   0;
    6581        continue;
    6682      }
    6783
    6884      // this must be a field : is it a valid name?
     85      status = FALSE;
    6986      if (table == DVO_TABLE_MEASURE) {
    7087        status = ParseMeasureField (&fields[Nfields], stack[i].name);
     
    7390        status = ParseAverageField (&fields[Nfields], stack[i].name);
    7491      }
     92      if (table == DVO_TABLE_IMAGE) {
     93        status = ParseImageField (&fields[Nfields], stack[i].name);
     94      }
    7595      if (!status) {
    76         gprint (GP_ERR, "unknown database field %s\n", stack[i].name);
    7796        goto failure;
    7897      }
    7998      stack[i].field = Nfields;
    80       stack[i].type  = 'F';
     99      stack[i].type |= DB_STACK_FIELD;
     100      if (fields[Nfields].type == OPIHI_INT) {
     101        stack[i].type |= DB_STACK_INT;
     102      }
    81103      stack[i].name  = NULL;
    82       stack[i].Float = 0.0;
     104      stack[i].FltValue = 0.0; // 'F'
     105      stack[i].IntValue =   0; // 'f'
    83106
    84107      Nfields ++;
Note: See TracChangeset for help on using the changeset viewer.