IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 24, 2020, 2:44:55 PM (6 years ago)
Author:
eugene
Message:

rename libfits byte-type to gfbyte to avoid collisions

Location:
trunk/Ohana/src/libfits
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/include/gfitsio.h

    r41395 r41422  
    1818# endif /* NEWLINE */
    1919
    20 /* gfits_bintable_format returns 'byte' as the type associated with one-byte logical (non-char) values */
    21 typedef unsigned char byte;
     20/* gfits_bintable_format returns 'gfbyte' as the type associated with one-byte logical (non-char) values */
     21typedef unsigned char gfbyte;
    2222
    2323/********** FITS Constants *********/
  • trunk/Ohana/src/libfits/table/F_compress_T.c

    r39530 r41422  
    191191        goto got_cmptype;
    192192      }
    193       if (!strcmp (fields[field].datatype, "byte") ||
     193      if (!strcmp (fields[field].datatype, "gfbyte") ||
    194194          !strcmp (fields[field].datatype, "char")) {
    195195        strcpy (fields[field].zctype, "GZIP_1");
     
    208208
    209209    // OVERRIDE: GZIP_2 invalid for B (use GZIP_1)
    210     if (!strcasecmp (fields[field].zctype, "GZIP_2") && !strcmp (fields[field].datatype, "byte")) {
     210    if (!strcasecmp (fields[field].zctype, "GZIP_2") && !strcmp (fields[field].datatype, "gfbyte")) {
    211211      strcpy (fields[field].zctype, "GZIP_1");
    212212    }
  • trunk/Ohana/src/libfits/table/F_get_column.c

    r41395 r41422  
    8888    }
    8989  }
    90   if (!strcmp (type, "byte")) {
     90  if (!strcmp (type, "gfbyte")) {
    9191    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
    9292      if (!directCopy) { *(char *)Pout = *(char *)Pin*Bscale + Bzero; }
     
    159159  /* convert data in-situ with correct type, byte swap and Bzero/Bscale */
    160160  if (!strcmp (type, "char")) return TRUE;
    161   if (!strcmp (type, "byte")) return TRUE;
     161  if (!strcmp (type, "gfbyte")) return TRUE;
    162162
    163163  /* check existing table dimensions */
  • trunk/Ohana/src/libfits/table/F_set_column.c

    r41395 r41422  
    132132  }
    133133
    134   if (!strcmp (type, "byte")) {
     134  if (!strcmp (type, "gfbyte")) {
    135135    for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) {
    136136      *(char *)Pout = (*(char *)Pin - Bzero) / Bscale;
     
    338338
    339339  SET_VALUES("char",       char, "char", char, SWAP_NONE, 1);
    340   SET_VALUES("byte",       byte, "char", char, SWAP_NONE, 1);
     340  SET_VALUES("gfbyte",   gfbyte, "char", char, SWAP_NONE, 1);
    341341  SET_VALUES("short",     short, "char", char, SWAP_BYTE, 1);
    342342  SET_VALUES("int",         int, "char", char, SWAP_WORD, 1);
     
    345345  SET_VALUES("double",   double, "char", char, SWAP_DBLE, 1);
    346346
    347   SET_VALUES("char",       char, "byte", byte, SWAP_NONE, 1);
    348   SET_VALUES("byte",       byte, "byte", byte, SWAP_NONE, 1);
    349   SET_VALUES("short",     short, "byte", byte, SWAP_BYTE, 1);
    350   SET_VALUES("int",         int, "byte", byte, SWAP_WORD, 1);
    351   SET_VALUES("int64_t", int64_t, "byte", byte, SWAP_DBLE, 1);
    352   SET_VALUES("float",     float, "byte", byte, SWAP_WORD, 1);
    353   SET_VALUES("double",   double, "byte", byte, SWAP_DBLE, 1);
     347  SET_VALUES("char",       char, "gfbyte", gfbyte, SWAP_NONE, 1);
     348  SET_VALUES("gfbyte",   gfbyte, "gfbyte", gfbyte, SWAP_NONE, 1);
     349  SET_VALUES("short",     short, "gfbyte", gfbyte, SWAP_BYTE, 1);
     350  SET_VALUES("int",         int, "gfbyte", gfbyte, SWAP_WORD, 1);
     351  SET_VALUES("int64_t", int64_t, "gfbyte", gfbyte, SWAP_DBLE, 1);
     352  SET_VALUES("float",     float, "gfbyte", gfbyte, SWAP_WORD, 1);
     353  SET_VALUES("double",   double, "gfbyte", gfbyte, SWAP_DBLE, 1);
    354354
    355355  SET_VALUES("char",       char, "short", short, SWAP_NONE, 2);
    356   SET_VALUES("byte",       byte, "short", short, SWAP_NONE, 2);
     356  SET_VALUES("gfbyte",   gfbyte, "short", short, SWAP_NONE, 2);
    357357  SET_VALUES("short",     short, "short", short, SWAP_BYTE, 2);
    358358  SET_VALUES("int",         int, "short", short, SWAP_WORD, 2);
     
    362362
    363363  SET_VALUES("char",       char, "int", int, SWAP_NONE, 4);
    364   SET_VALUES("byte",       byte, "int", int, SWAP_NONE, 4);
     364  SET_VALUES("gfbyte",   gfbyte, "int", int, SWAP_NONE, 4);
    365365  SET_VALUES("short",     short, "int", int, SWAP_BYTE, 4);
    366366  SET_VALUES("int",         int, "int", int, SWAP_WORD, 4);
     
    370370
    371371  SET_VALUES("char",       char, "int64_t", int64_t, SWAP_NONE, 8);
    372   SET_VALUES("byte",       byte, "int64_t", int64_t, SWAP_NONE, 8);
     372  SET_VALUES("gfbyte",   gfbyte, "int64_t", int64_t, SWAP_NONE, 8);
    373373  SET_VALUES("short",     short, "int64_t", int64_t, SWAP_BYTE, 8);
    374374  SET_VALUES("int",         int, "int64_t", int64_t, SWAP_WORD, 8);
     
    378378
    379379  SET_VALUES("char",       char, "float", float, SWAP_NONE, 4);
    380   SET_VALUES("byte",       byte, "float", float, SWAP_NONE, 4);
     380  SET_VALUES("gfbyte",   gfbyte, "float", float, SWAP_NONE, 4);
    381381  SET_VALUES("short",     short, "float", float, SWAP_BYTE, 4);
    382382  SET_VALUES("int",         int, "float", float, SWAP_WORD, 4);
     
    386386
    387387  SET_VALUES("char",       char, "double", double, SWAP_NONE, 8);
    388   SET_VALUES("byte",       byte, "double", double, SWAP_NONE, 8);
     388  SET_VALUES("gfbyte",   gfbyte, "double", double, SWAP_NONE, 8);
    389389  SET_VALUES("short",     short, "double", double, SWAP_BYTE, 8);
    390390  SET_VALUES("int",         int, "double", double, SWAP_WORD, 8);
  • trunk/Ohana/src/libfits/table/F_table_format.c

    r39399 r41422  
    2424  switch (*Fchar) {
    2525  case  'X':
    26     { *Nbytes = 1;  strcpy (type, "byte");   *Nval = 1 + (int) Nv / 8; }
     26    { *Nbytes = 1;  strcpy (type, "gfbyte");   *Nval = 1 + (int) Nv / 8; }
    2727    break;
    2828  case  'L':
    29     { *Nbytes = 1;  strcpy (type, "byte");   *Nval = Nv;               }
     29    { *Nbytes = 1;  strcpy (type, "gfbyte");   *Nval = Nv;               }
    3030    break;
    3131  case  'A':
     
    3333    break;
    3434  case  'B':
    35     { *Nbytes = 1;  strcpy (type, "byte");   *Nval = Nv;               }
     35    { *Nbytes = 1;  strcpy (type, "gfbyte");   *Nval = Nv;               }
    3636    break;
    3737  case  'I':
     
    108108 
    109109  Type = 'x';
     110  if (Fchar == 'D') { *Nbytes = 1;  strcpy (type, "double"); Type = 'e'; *Nval = Nv; }
     111  if (Fchar == 'E') { *Nbytes = 1;  strcpy (type, "float");  Type = 'e'; *Nval = Nv; }
    110112  if (Fchar == 'F') { *Nbytes = 1;  strcpy (type, "float");  Type = 'f'; *Nval = Nv; }
    111113  if (Fchar == 'I') { *Nbytes = 1;  strcpy (type, "int");    Type = 'd'; *Nval = Nv; }
     
    284286      }
    285287    }
    286     if (!strcmp (type, "byte"))   {
     288    if (!strcmp (type, "gfbyte"))   {
    287289      for (j = 0; j < Ny; j++) {
    288290        for (n = 0; n < Nval; n++) {
     
    377379      }
    378380    }
    379     if (!strcmp (type, "byte"))   {
     381    if (!strcmp (type, "gfbyte"))   {
    380382      for (j = 0; j < Ny; j++) {
    381383        for (n = 0; n < Nval; n++) {
  • trunk/Ohana/src/libfits/test/tablecomp.c

    r39457 r41422  
    4545  ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header");
    4646
    47   ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte",  "none", 1.0, 0.0), "defined byte column");
     47  ok (gfits_define_bintable_column (&header, "B", "VAL_B", "gfbyte", "none", 1.0, 0.0), "defined byte column");
    4848  ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short",  "none", 1.0, 0.0), "defined short column");
    4949  ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int",    "none", 1.0, 0.0),  "defined int column");
     
    114114  off_t Nrow;
    115115
    116   char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),    "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     116  char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "gfbyte"),  "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    117117  short   *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),   "read short   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    118118  int     *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"),     "read int     table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     
    142142  }
    143143
    144   ok (!NVAL_B_bad, "byte    values match (input vs output)");
     144  ok (!NVAL_B_bad, "gfbyte  values match (input vs output)");
    145145  ok (!NVAL_I_bad, "short   values match (input vs output)");
    146146  ok (!NVAL_J_bad, "int     values match (input vs output)");
     
    183183  ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header");
    184184
    185   ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte",   "none", 1.0, 0.0), "defined byte column");
    186   ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short",  "none", 1.0, 0.0), "defined short column");
    187   ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int",    "none", 1.0, 0.0), "defined int column");
    188   ok (gfits_define_bintable_column (&header, "K", "VAL_K", "long",   "none", 1.0, 0.0), "defined long column");
    189   ok (gfits_define_bintable_column (&header, "E", "VAL_E", "float",  "degree", 1.0, 0.0),   "defined float column");
    190   ok (gfits_define_bintable_column (&header, "D", "VAL_D", "double", "degree", 1.0, 0.0),   "defined double column");
     185  ok (gfits_define_bintable_column (&header, "B", "VAL_B", "gfbyte", "none",  1.0, 0.0), "defined byte column");
     186  ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short",  "none",   1.0, 0.0), "defined short column");
     187  ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int",    "none",   1.0, 0.0), "defined int column");
     188  ok (gfits_define_bintable_column (&header, "K", "VAL_K", "long",   "none",   1.0, 0.0), "defined long column");
     189  ok (gfits_define_bintable_column (&header, "E", "VAL_E", "float",  "degree", 1.0, 0.0), "defined float column");
     190  ok (gfits_define_bintable_column (&header, "D", "VAL_D", "double", "degree", 1.0, 0.0), "defined double column");
    191191 
    192192  // generate the output array that carries the data
     
    247247  off_t Nrow;
    248248
    249   char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),    "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     249  char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "gfbyte"),  "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    250250  short   *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),   "read short   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    251251  int     *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"),     "read int     table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     
    271271  }
    272272
    273   ok (!NVAL_B_bad, "byte    values match (input vs output)");
     273  ok (!NVAL_B_bad, "gfbyte  values match (input vs output)");
    274274  ok (!NVAL_I_bad, "short   values match (input vs output)");
    275275  ok (!NVAL_J_bad, "int     values match (input vs output)");
     
    383383  ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header");
    384384
    385   ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte",  "none", 1.0, 0.0), "defined byte column");
     385  ok (gfits_define_bintable_column (&header, "B", "VAL_B", "gfbyte", "none", 1.0, 0.0), "defined byte column");
    386386  ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short",  "none", 1.0, 0.0), "defined short column");
    387387  ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int",    "none", 1.0, 0.0),  "defined int column");
     
    444444  off_t Nrow;
    445445
    446   char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),    "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     446  char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "gfbyte"),  "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    447447  short   *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),   "read short   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
    448448  int     *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"),     "read int     table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
     
    472472  }
    473473
    474   ok (!NVAL_B_bad, "byte    values match (input vs output)");
     474  ok (!NVAL_B_bad, "gfbyte  values match (input vs output)");
    475475  ok (!NVAL_I_bad, "short   values match (input vs output)");
    476476  ok (!NVAL_J_bad, "int     values match (input vs output)");
Note: See TracChangeset for help on using the changeset viewer.