Changeset 41422 for trunk/Ohana/src/libfits
- Timestamp:
- Sep 24, 2020, 2:44:55 PM (6 years ago)
- Location:
- trunk/Ohana/src/libfits
- Files:
-
- 6 edited
-
include/gfitsio.h (modified) (1 diff)
-
table/F_compress_T.c (modified) (2 diffs)
-
table/F_get_column.c (modified) (2 diffs)
-
table/F_set_column.c (modified) (7 diffs)
-
table/F_table_format.c (modified) (5 diffs)
-
test/tablecomp.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/include/gfitsio.h
r41395 r41422 18 18 # endif /* NEWLINE */ 19 19 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 */ 21 typedef unsigned char gfbyte; 22 22 23 23 /********** FITS Constants *********/ -
trunk/Ohana/src/libfits/table/F_compress_T.c
r39530 r41422 191 191 goto got_cmptype; 192 192 } 193 if (!strcmp (fields[field].datatype, " byte") ||193 if (!strcmp (fields[field].datatype, "gfbyte") || 194 194 !strcmp (fields[field].datatype, "char")) { 195 195 strcpy (fields[field].zctype, "GZIP_1"); … … 208 208 209 209 // 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")) { 211 211 strcpy (fields[field].zctype, "GZIP_1"); 212 212 } -
trunk/Ohana/src/libfits/table/F_get_column.c
r41395 r41422 88 88 } 89 89 } 90 if (!strcmp (type, " byte")) {90 if (!strcmp (type, "gfbyte")) { 91 91 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 92 92 if (!directCopy) { *(char *)Pout = *(char *)Pin*Bscale + Bzero; } … … 159 159 /* convert data in-situ with correct type, byte swap and Bzero/Bscale */ 160 160 if (!strcmp (type, "char")) return TRUE; 161 if (!strcmp (type, " byte")) return TRUE;161 if (!strcmp (type, "gfbyte")) return TRUE; 162 162 163 163 /* check existing table dimensions */ -
trunk/Ohana/src/libfits/table/F_set_column.c
r41395 r41422 132 132 } 133 133 134 if (!strcmp (type, " byte")) {134 if (!strcmp (type, "gfbyte")) { 135 135 for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) { 136 136 *(char *)Pout = (*(char *)Pin - Bzero) / Bscale; … … 338 338 339 339 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); 341 341 SET_VALUES("short", short, "char", char, SWAP_BYTE, 1); 342 342 SET_VALUES("int", int, "char", char, SWAP_WORD, 1); … … 345 345 SET_VALUES("double", double, "char", char, SWAP_DBLE, 1); 346 346 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); 354 354 355 355 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); 357 357 SET_VALUES("short", short, "short", short, SWAP_BYTE, 2); 358 358 SET_VALUES("int", int, "short", short, SWAP_WORD, 2); … … 362 362 363 363 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); 365 365 SET_VALUES("short", short, "int", int, SWAP_BYTE, 4); 366 366 SET_VALUES("int", int, "int", int, SWAP_WORD, 4); … … 370 370 371 371 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); 373 373 SET_VALUES("short", short, "int64_t", int64_t, SWAP_BYTE, 8); 374 374 SET_VALUES("int", int, "int64_t", int64_t, SWAP_WORD, 8); … … 378 378 379 379 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); 381 381 SET_VALUES("short", short, "float", float, SWAP_BYTE, 4); 382 382 SET_VALUES("int", int, "float", float, SWAP_WORD, 4); … … 386 386 387 387 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); 389 389 SET_VALUES("short", short, "double", double, SWAP_BYTE, 8); 390 390 SET_VALUES("int", int, "double", double, SWAP_WORD, 8); -
trunk/Ohana/src/libfits/table/F_table_format.c
r39399 r41422 24 24 switch (*Fchar) { 25 25 case 'X': 26 { *Nbytes = 1; strcpy (type, " byte"); *Nval = 1 + (int) Nv / 8; }26 { *Nbytes = 1; strcpy (type, "gfbyte"); *Nval = 1 + (int) Nv / 8; } 27 27 break; 28 28 case 'L': 29 { *Nbytes = 1; strcpy (type, " byte"); *Nval = Nv; }29 { *Nbytes = 1; strcpy (type, "gfbyte"); *Nval = Nv; } 30 30 break; 31 31 case 'A': … … 33 33 break; 34 34 case 'B': 35 { *Nbytes = 1; strcpy (type, " byte"); *Nval = Nv; }35 { *Nbytes = 1; strcpy (type, "gfbyte"); *Nval = Nv; } 36 36 break; 37 37 case 'I': … … 108 108 109 109 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; } 110 112 if (Fchar == 'F') { *Nbytes = 1; strcpy (type, "float"); Type = 'f'; *Nval = Nv; } 111 113 if (Fchar == 'I') { *Nbytes = 1; strcpy (type, "int"); Type = 'd'; *Nval = Nv; } … … 284 286 } 285 287 } 286 if (!strcmp (type, " byte")) {288 if (!strcmp (type, "gfbyte")) { 287 289 for (j = 0; j < Ny; j++) { 288 290 for (n = 0; n < Nval; n++) { … … 377 379 } 378 380 } 379 if (!strcmp (type, " byte")) {381 if (!strcmp (type, "gfbyte")) { 380 382 for (j = 0; j < Ny; j++) { 381 383 for (n = 0; n < Nval; n++) { -
trunk/Ohana/src/libfits/test/tablecomp.c
r39457 r41422 45 45 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 46 46 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"); 48 48 ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short", "none", 1.0, 0.0), "defined short column"); 49 49 ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int", "none", 1.0, 0.0), "defined int column"); … … 114 114 off_t Nrow; 115 115 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"); 117 117 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"); 118 118 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"); … … 142 142 } 143 143 144 ok (!NVAL_B_bad, " bytevalues match (input vs output)");144 ok (!NVAL_B_bad, "gfbyte values match (input vs output)"); 145 145 ok (!NVAL_I_bad, "short values match (input vs output)"); 146 146 ok (!NVAL_J_bad, "int values match (input vs output)"); … … 183 183 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 184 184 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"); 191 191 192 192 // generate the output array that carries the data … … 247 247 off_t Nrow; 248 248 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"); 250 250 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"); 251 251 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"); … … 271 271 } 272 272 273 ok (!NVAL_B_bad, " bytevalues match (input vs output)");273 ok (!NVAL_B_bad, "gfbyte values match (input vs output)"); 274 274 ok (!NVAL_I_bad, "short values match (input vs output)"); 275 275 ok (!NVAL_J_bad, "int values match (input vs output)"); … … 383 383 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 384 384 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"); 386 386 ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short", "none", 1.0, 0.0), "defined short column"); 387 387 ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int", "none", 1.0, 0.0), "defined int column"); … … 444 444 off_t Nrow; 445 445 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"); 447 447 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"); 448 448 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"); … … 472 472 } 473 473 474 ok (!NVAL_B_bad, " bytevalues match (input vs output)");474 ok (!NVAL_B_bad, "gfbyte values match (input vs output)"); 475 475 ok (!NVAL_I_bad, "short values match (input vs output)"); 476 476 ok (!NVAL_J_bad, "int values match (input vs output)");
Note:
See TracChangeset
for help on using the changeset viewer.
