Changeset 20936 for trunk/Ohana/src/opihi/dvo/dbCheckStack.c
- Timestamp:
- Dec 7, 2008, 3:31:01 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/dbCheckStack.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/dbCheckStack.c
r20818 r20936 1 1 # 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? 2 8 3 9 int dbCheckStack (dbStack *stack, int Nstack, int table, dbField **inFields, int *inNfields) { 4 10 5 11 int i, j, status, NFIELDS, Nfields; 6 char *c ;12 char *c1, *c2; 7 13 dbField *fields; 8 14 … … 14 20 15 21 for (i = 0; i < Nstack; i++) { 16 if (stack[i].type == 'X') {22 if (stack[i].type == DB_STACK_VALUE) { 17 23 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 22 34 continue; 23 35 } … … 44 56 code = GetPhotcodebyName (tmpstring); 45 57 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; 48 60 continue; 49 61 } … … 60 72 if (j < Nfields) { 61 73 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 } 63 78 stack[i].name = NULL; 64 stack[i].Float = 0.0; 79 stack[i].FltValue = 0.0; 80 stack[i].IntValue = 0; 65 81 continue; 66 82 } 67 83 68 84 // this must be a field : is it a valid name? 85 status = FALSE; 69 86 if (table == DVO_TABLE_MEASURE) { 70 87 status = ParseMeasureField (&fields[Nfields], stack[i].name); … … 73 90 status = ParseAverageField (&fields[Nfields], stack[i].name); 74 91 } 92 if (table == DVO_TABLE_IMAGE) { 93 status = ParseImageField (&fields[Nfields], stack[i].name); 94 } 75 95 if (!status) { 76 gprint (GP_ERR, "unknown database field %s\n", stack[i].name);77 96 goto failure; 78 97 } 79 98 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 } 81 103 stack[i].name = NULL; 82 stack[i].Float = 0.0; 104 stack[i].FltValue = 0.0; // 'F' 105 stack[i].IntValue = 0; // 'f' 83 106 84 107 Nfields ++;
Note:
See TracChangeset
for help on using the changeset viewer.
