- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/Ohana
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/Ohana merged eligible /branches/eam_branches/Ohana.20100407 27635-27772 /branches/pap_delete/Ohana 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/tap_branches/Ohana/src/libfits/table/F_get_column.c
r16810 r27838 1 1 # include <ohana.h> 2 2 # include <gfitsio.h> 3 #include <inttypes.h> 3 4 # define SWAP_BYTE { \ 4 5 char tmp; \ … … 15 16 tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; } 16 17 17 void *gfits_get_bintable_column_data (Header *header, FTable *table, char *label, char *type, int *Nrow, int *Ncol) { 18 19 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 18 void *gfits_get_bintable_column_data (Header *header, FTable *table, char *label, char *type, off_t *Nrow, int *Ncol) { 19 20 off_t Nx, Ny; 21 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 20 22 char tlabel[80], field[80], format[80], tmpline[16]; 21 23 char *Pin, *Pout, *array; … … 49 51 50 52 /* check existing table dimensions */ 51 gfits_scan (header, "NAXIS1", "% d", 1,&Nx);52 gfits_scan (header, "NAXIS2", "% d", 1,&Ny);53 gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx); 54 gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny); 53 55 54 56 /* scan columns to find insert point */ … … 93 95 } 94 96 } 97 if (!strcmp (type, "int64_t")) { 98 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 99 # ifdef BYTE_SWAP 100 SWAP_DBLE; 101 # endif 102 *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero; 103 } 104 } 95 105 if (!strcmp (type, "float")) { 96 106 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { … … 144 154 int gfits_get_bintable_column (Header *header, FTable *table, char *label, void **data) { 145 155 146 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 156 off_t Nx, Ny; 157 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 147 158 char tlabel[80], field[80], format[80], type[16], tmpline[16]; 148 159 char *Pin, *Pout, *array; … … 176 187 177 188 /* check existing table dimensions */ 178 gfits_scan (header, "NAXIS1", "% d", 1,&Nx);179 gfits_scan (header, "NAXIS2", "% d", 1,&Ny);189 gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx); 190 gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny); 180 191 181 192 /* scan columns to find insert point */ … … 218 229 # endif 219 230 *(int *)Pout = *(int *)Pin*Bscale + Bzero; 231 } 232 } 233 if (!strcmp (type, "int64_t")) { 234 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 235 # ifdef BYTE_SWAP 236 SWAP_DBLE; 237 # endif 238 *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero; 220 239 } 221 240 } … … 290 309 int gfits_get_table_column (Header *header, FTable *table, char *label, void **data) { 291 310 292 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 311 off_t Nx, Ny; 312 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 293 313 char tlabel[80], field[80], format[80], cformat[80], type[16], tmp[16]; 294 314 char *array, *Pin, *Pout, *line; … … 316 336 317 337 /* check existing table dimensions */ 318 gfits_scan (header, "NAXIS1", "% d", 1,&Nx);319 gfits_scan (header, "NAXIS2", "% d", 1,&Ny);338 gfits_scan (header, "NAXIS1", "%lld", 1, (long long *) &Nx); 339 gfits_scan (header, "NAXIS2", "%lld", 1, (long long *) &Ny); 320 340 321 341 /* scan columns to find insert point */ … … 349 369 } 350 370 } 371 if (!strcmp (type, "int64_t")) { 372 ALLOCATE (array, char, Ny*8); 373 Pout = array; 374 for (i = 0; i < Ny; i++, Pin+=Nx, Pout+=8) { 375 memcpy (line, Pin, Nval*Nbytes); 376 sscanf (line, "%" PRId64, (int64_t *)Pout); 377 } 378 } 351 379 if (!strcmp (type, "float")) { 352 380 ALLOCATE (array, char, Ny*4);
Note:
See TracChangeset
for help on using the changeset viewer.
