IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 25, 2012, 6:39:11 AM (14 years ago)
Author:
eugene
Message:

add :char type to read vectors (very crude: sets vector to ascii value of first char); update reindex to handle duplicates; add mmatch function (equiv to avmatch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/read_vectors.c

    r33662 r34461  
    2222
    2323// vector types
    24 enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME};
     24enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME, COLTYPE_CHAR};
    2525
    2626int read_vectors (int argc, char **argv) {
     
    101101      if (!strcasecmp(ptr, "float")) { coltype[i] = COLTYPE_FLT; }
    102102      if (!strcasecmp(ptr, "int"))   { coltype[i] = COLTYPE_INT; }
     103      if (!strcasecmp(ptr, "char"))  { coltype[i] = COLTYPE_CHAR; }
    103104      if (!strcasecmp(ptr, "time"))  { coltype[i] = COLTYPE_TIME; }
    104105      if (!coltype[i]) goto bad_colname;
     
    143144  NELEM = 1000;
    144145  for (i = 0; i < Nvec; i++) {
    145     if (coltype[i] == COLTYPE_INT) {
     146    if ((coltype[i] == COLTYPE_INT) || (coltype[i] == COLTYPE_CHAR)) {
    146147      ResetVector (vec[i], OPIHI_INT, NELEM);
    147148    } else {
     
    195196      for (i = 0; i < Nvec; i++) {
    196197        int ivalue;
     198        char cvalue;
    197199        double dvalue;
    198200        time_t tvalue;
     
    203205            readStatus = IsCSV ? iparse_csv (&ivalue, col[i], c0) : iparse (&ivalue, col[i], c0);
    204206            vec[i][0].elements.Int[Nelem] = readStatus ? ivalue : 0;
     207            break;
     208          case COLTYPE_CHAR:
     209            readStatus = IsCSV ? charparse_csv (&cvalue, col[i], c0) : charparse (&cvalue, col[i], c0);
     210            vec[i][0].elements.Int[Nelem] = readStatus ? cvalue : 0;
    205211            break;
    206212          case COLTYPE_FLT:
Note: See TracChangeset for help on using the changeset viewer.