IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42311


Ignore:
Timestamp:
Dec 1, 2022, 10:01:56 AM (4 years ago)
Author:
eugene
Message:

enable subset for string-type vectors; allow "set a = b" for string-type vectors

Location:
trunk/Ohana/src/opihi
Files:
2 edited

Legend:

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

    r35109 r42311  
    8181    }
    8282  }
     83  if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_FLT)) {
     84    opihi_flt *vt = tvec[0].elements.Flt;
     85    for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) {
     86      if (!*vt) continue;
     87      ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);
     88      Npts++;
     89    }
     90  }
     91  if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_INT)) {
     92    opihi_int *vt = tvec[0].elements.Int;
     93    for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) {
     94      if (!*vt) continue;
     95      ovec[0].elements.Str[Npts] = strcreate (ivec[0].elements.Str[i]);
     96      Npts++;
     97    }
     98  }
    8399
    84100  // free up unused memory
  • trunk/Ohana/src/opihi/lib.shell/stack_math.c

    r42080 r42311  
    16191619  OUT[0].vector = InitVector ();
    16201620  OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/
     1621
     1622  if (V1->vector->type == OPIHI_STR) {
     1623    ResetVector (OUT->vector, V1->vector->type, V1->vector->Nelements);
     1624    for (i = 0; i < V1->vector->Nelements; i++) {
     1625      OUT->vector->elements.Str[i] = strcreate (V1->vector->elements.Str[i]);
     1626    }
     1627    goto escape;
     1628  }
    16211629
    16221630# define V_FUNC(OP,FTYPE) {                                             \
Note: See TracChangeset for help on using the changeset viewer.