Changeset 16139
- Timestamp:
- Jan 18, 2008, 2:52:14 PM (18 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 10 edited
-
elixir/src/ConfigInit.c (modified) (2 diffs)
-
imregister/imreg/SetSignals.c (modified) (2 diffs)
-
libdvo/Makefile (modified) (1 diff)
-
libfits/matrix/F_load_M.c (modified) (3 diffs)
-
libfits/matrix/F_read_portion.c (modified) (3 diffs)
-
libfits/matrix/F_read_segment.c (modified) (3 diffs)
-
libfits/matrix/F_write_M.c (modified) (4 diffs)
-
libfits/table/F_get_column.c (modified) (6 diffs)
-
libfits/table/F_set_column.c (modified) (6 diffs)
-
opihi/cmd.data/book_commands.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/elixir/src/ConfigInit.c
r13322 r16139 52 52 signal (SIGTTIN, SIG_IGN); 53 53 signal (SIGTTOU, SIG_IGN); 54 signal (SIGPOLL, SIG_IGN);55 54 signal (SIGPROF, SIG_IGN); 56 55 signal (SIGURG, SIG_IGN); … … 59 58 60 59 /* signals which are not always defined */ 60 # ifdef SIGPOLL 61 signal (SIGPOLL, SIG_IGN); 62 # endif 61 63 # ifdef SIGPWR 62 64 signal (SIGPWR, SIG_DIE); /* power failure (Sys V) */ -
trunk/Ohana/src/imregister/imreg/SetSignals.c
r13322 r16139 43 43 signal (SIGTTIN, SIG_IGN); 44 44 signal (SIGTTOU, SIG_IGN); 45 signal (SIGPOLL, SIG_IGN);46 45 signal (SIGPROF, SIG_IGN); 47 46 signal (SIGURG, SIG_IGN); … … 50 49 51 50 /* signals which are not always defined */ 51 # ifdef SIGPOLL 52 signal (SIGPOLL, SIG_IGN); 53 # endif 52 54 # ifdef SIGPWR 53 55 signal (SIGPWR, SIG_DIE); /* power failure (Sys V) */ -
trunk/Ohana/src/libdvo/Makefile
r16093 r16139 91 91 92 92 $(AINC)/autocode.h: $(AINCS) $(ADEF)/autocode.h $(ADEF)/common.h 93 echo "make $@ from $^"93 @echo "make $@ from $^" 94 94 cd $(AUTO) && make $@ 95 95 96 96 # generic rule for AINCS 97 97 $(AINC)/%.h : $(ADEF)/%.d $(ADEF)/autocode.h $(ADEF)/common.h 98 echo "make $@ from $^"98 @echo "make $@ from $^" 99 99 cd $(AUTO) && make $@ 100 100 101 101 # generic rule for ASRC 102 102 $(ASRC)/%.c : $(ADEF)/%.d $(ADEF)/autocode.c $(AINC)/%.h 103 echo "make $@ from $^"103 @echo "make $@ from $^" 104 104 cd $(AUTO) && make $@ 105 105 106 106 # generic rule for AOBJS 107 107 $(ASRC)/%.$(ARCH).o : $(ASRC)/%.c 108 echo "make $@ from $^"108 @echo "make $@ from $^" 109 109 cd $(AUTO) && make $@ 110 110 -
trunk/Ohana/src/libfits/matrix/F_load_M.c
r15751 r16139 14 14 15 15 int i, nbytes, Nbytes; 16 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;17 int perpix;18 16 19 17 matrix[0].bitpix = header[0].bitpix; … … 40 38 41 39 # ifdef BYTE_SWAP 40 { 41 int perpix; 42 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 43 42 44 perpix = abs(header[0].bitpix) / 8; 43 45 if (perpix > 1) { … … 84 86 } 85 87 } 88 } 86 89 # endif 87 90 -
trunk/Ohana/src/libfits/matrix/F_read_portion.c
r15743 r16139 13 13 FILE *f; 14 14 Header header; 15 int status, i, nbytes, Nbytes, Nrec; 16 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp; 17 int perpix; 15 int status, nbytes, Nbytes, Nrec; 18 16 19 17 status = gfits_read_header (filename, &header); … … 54 52 55 53 # ifdef BYTE_SWAP 54 { 55 int i, perpix; 56 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp; 57 56 58 perpix = abs(header.bitpix) / 8; 57 59 if (perpix > 1) { … … 98 100 } 99 101 } 102 } 100 103 # endif 101 104 -
trunk/Ohana/src/libfits/matrix/F_read_segment.c
r15743 r16139 38 38 int status, i, nbytes, Nbytes, Nskip, NbytesData; 39 39 int wantaxis[FT_MAX_NAXES][2]; 40 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;41 40 double tmp; 42 int perpix;43 41 44 42 for (i = 0; i < FT_MAX_NAXES; i++) { … … 97 95 98 96 # ifdef BYTE_SWAP 97 { 98 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp; 99 int perpix; 100 99 101 perpix = abs(header[0].bitpix) / 8; 100 102 if (perpix > 1) { … … 141 143 } 142 144 } 145 } 143 146 # endif 144 147 -
trunk/Ohana/src/libfits/matrix/F_write_M.c
r7054 r16139 21 21 int gfits_fwrite_matrix (FILE *f, Matrix *matrix) { 22 22 23 int i, status, nbytes, Nbytes; 24 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 25 int perpix; 23 int status, nbytes, Nbytes; 26 24 27 25 status = TRUE; … … 30 28 if the size is wrong, it probably should simply pad the fwrite statement. 31 29 better policy should be defined (ie, matrix.size always correct blocking?) 32 */30 */ 33 31 34 32 if (matrix[0].size % FT_RECORD_SIZE) … … 39 37 /* this is a bit cumbersome: swap all words, write out file, then swap back... */ 40 38 # ifdef BYTE_SWAP 41 perpix = abs(matrix[0].bitpix) / 8; 42 if (perpix > 1) { 43 byte0 = (unsigned char *) matrix[0].buffer; 44 byte1 = (unsigned char *) matrix[0].buffer + 1; 45 byte2 = (unsigned char *) matrix[0].buffer + 2; 46 byte3 = (unsigned char *) matrix[0].buffer + 3; 47 byte4 = (unsigned char *) matrix[0].buffer + 4; 48 byte5 = (unsigned char *) matrix[0].buffer + 5; 49 byte6 = (unsigned char *) matrix[0].buffer + 6; 50 byte7 = (unsigned char *) matrix[0].buffer + 7; 51 if (perpix == 2) { 52 for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) { 53 tmp = *byte0; 54 *byte0 = *byte1; 55 *byte1 = tmp; 39 { 40 int i; 41 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 42 int perpix; 43 44 perpix = abs(matrix[0].bitpix) / 8; 45 if (perpix > 1) { 46 byte0 = (unsigned char *) matrix[0].buffer; 47 byte1 = (unsigned char *) matrix[0].buffer + 1; 48 byte2 = (unsigned char *) matrix[0].buffer + 2; 49 byte3 = (unsigned char *) matrix[0].buffer + 3; 50 byte4 = (unsigned char *) matrix[0].buffer + 4; 51 byte5 = (unsigned char *) matrix[0].buffer + 5; 52 byte6 = (unsigned char *) matrix[0].buffer + 6; 53 byte7 = (unsigned char *) matrix[0].buffer + 7; 54 if (perpix == 2) { 55 for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) { 56 tmp = *byte0; 57 *byte0 = *byte1; 58 *byte1 = tmp; 59 } 56 60 } 57 }58 if (perpix == 4) {59 for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) { 60 tmp = *byte0;61 *byte0 = *byte3;62 *byte3 = tmp;63 tmp = *byte1;64 *byte1 = *byte2;65 *byte2 = tmp;61 if (perpix == 4) { 62 for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) { 63 tmp = *byte0; 64 *byte0 = *byte3; 65 *byte3 = tmp; 66 tmp = *byte1; 67 *byte1 = *byte2; 68 *byte2 = tmp; 69 } 66 70 } 67 }68 if (perpix == 8) {69 for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) { 70 tmp = *byte0;71 *byte0 = *byte7;72 *byte7 = tmp;73 tmp = *byte1;74 *byte1 = *byte6;75 *byte6 = tmp;76 tmp = *byte1;77 *byte2 = *byte5;78 *byte5 = tmp;79 tmp = *byte1;80 *byte3 = *byte4;81 *byte4 = tmp;71 if (perpix == 8) { 72 for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) { 73 tmp = *byte0; 74 *byte0 = *byte7; 75 *byte7 = tmp; 76 tmp = *byte1; 77 *byte1 = *byte6; 78 *byte6 = tmp; 79 tmp = *byte1; 80 *byte2 = *byte5; 81 *byte5 = tmp; 82 tmp = *byte1; 83 *byte3 = *byte4; 84 *byte4 = tmp; 85 } 82 86 } 83 87 } … … 90 94 } 91 95 92 # ifdef BYTE_SWAP 93 perpix = abs(matrix[0].bitpix) / 8; 94 if (perpix > 1) { 95 byte0 = (unsigned char *) matrix[0].buffer; 96 byte1 = (unsigned char *) matrix[0].buffer + 1; 97 byte2 = (unsigned char *) matrix[0].buffer + 2; 98 byte3 = (unsigned char *) matrix[0].buffer + 3; 99 byte4 = (unsigned char *) matrix[0].buffer + 4; 100 byte5 = (unsigned char *) matrix[0].buffer + 5; 101 byte6 = (unsigned char *) matrix[0].buffer + 6; 102 byte7 = (unsigned char *) matrix[0].buffer + 7; 103 if (perpix == 2) { 104 for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) { 105 tmp = *byte0; 106 *byte0 = *byte1; 107 *byte1 = tmp; 96 # ifdef BYTE_SWAP 97 { 98 int i; 99 unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp; 100 int perpix; 101 102 perpix = abs(matrix[0].bitpix) / 8; 103 if (perpix > 1) { 104 byte0 = (unsigned char *) matrix[0].buffer; 105 byte1 = (unsigned char *) matrix[0].buffer + 1; 106 byte2 = (unsigned char *) matrix[0].buffer + 2; 107 byte3 = (unsigned char *) matrix[0].buffer + 3; 108 byte4 = (unsigned char *) matrix[0].buffer + 4; 109 byte5 = (unsigned char *) matrix[0].buffer + 5; 110 byte6 = (unsigned char *) matrix[0].buffer + 6; 111 byte7 = (unsigned char *) matrix[0].buffer + 7; 112 if (perpix == 2) { 113 for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) { 114 tmp = *byte0; 115 *byte0 = *byte1; 116 *byte1 = tmp; 117 } 108 118 } 109 }110 if (perpix == 4) {111 for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) { 112 tmp = *byte0;113 *byte0 = *byte3;114 *byte3 = tmp;115 tmp = *byte1;116 *byte1 = *byte2;117 *byte2 = tmp;119 if (perpix == 4) { 120 for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) { 121 tmp = *byte0; 122 *byte0 = *byte3; 123 *byte3 = tmp; 124 tmp = *byte1; 125 *byte1 = *byte2; 126 *byte2 = tmp; 127 } 118 128 } 119 }120 if (perpix == 8) {121 for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) { 122 tmp = *byte0;123 *byte0 = *byte7;124 *byte7 = tmp;125 tmp = *byte1;126 *byte1 = *byte6;127 *byte6 = tmp;128 tmp = *byte1;129 *byte2 = *byte5;130 *byte5 = tmp;131 tmp = *byte1;132 *byte3 = *byte4;133 *byte4 = tmp;129 if (perpix == 8) { 130 for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) { 131 tmp = *byte0; 132 *byte0 = *byte7; 133 *byte7 = tmp; 134 tmp = *byte1; 135 *byte1 = *byte6; 136 *byte6 = tmp; 137 tmp = *byte1; 138 *byte2 = *byte5; 139 *byte5 = tmp; 140 tmp = *byte1; 141 *byte3 = *byte4; 142 *byte4 = tmp; 143 } 134 144 } 135 145 } -
trunk/Ohana/src/libfits/table/F_get_column.c
r12399 r16139 1 1 # include <ohana.h> 2 2 # include <gfitsio.h> 3 # define SWAP_BYTE \ 4 tmp = Pin[0]; Pin[0] = Pin[1]; Pin[1] = tmp; 5 # define SWAP_WORD \ 3 # define SWAP_BYTE { \ 4 char tmp; \ 5 tmp = Pin[0]; Pin[0] = Pin[1]; Pin[1] = tmp; } 6 # define SWAP_WORD { \ 7 char tmp; \ 6 8 tmp = Pin[0]; Pin[0] = Pin[3]; Pin[3] = tmp; \ 7 tmp = Pin[1]; Pin[1] = Pin[2]; Pin[2] = tmp; 8 # define SWAP_DBLE \ 9 tmp = Pin[1]; Pin[1] = Pin[2]; Pin[2] = tmp; } 10 # define SWAP_DBLE { \ 11 char tmp; \ 9 12 tmp = Pin[0]; Pin[0] = Pin[7]; Pin[7] = tmp; \ 10 13 tmp = Pin[1]; Pin[1] = Pin[6]; Pin[6] = tmp; \ 11 14 tmp = Pin[2]; Pin[2] = Pin[5]; Pin[5] = tmp; \ 12 tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; 15 tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; } 13 16 14 17 /***********************/ … … 43 46 int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb; 44 47 char tlabel[80], field[80], format[80], type[16], tmpline[16]; 45 char *Pin, *Pout, *array , tmp;48 char *Pin, *Pout, *array; 46 49 double Bscale, Bzero; 47 int I;48 50 49 51 if (label == (char *) NULL) return (FALSE); … … 105 107 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 106 108 # ifdef BYTE_SWAP 107 I = i*Nbytes;108 109 SWAP_BYTE; 109 110 # endif … … 114 115 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 115 116 # ifdef BYTE_SWAP 116 I = i*Nbytes;117 117 SWAP_WORD; 118 118 # endif … … 123 123 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 124 124 # ifdef BYTE_SWAP 125 I = i*Nbytes;126 125 SWAP_WORD; 127 126 # endif … … 132 131 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 133 132 # ifdef BYTE_SWAP 134 I = i*Nbytes;135 133 SWAP_DBLE; 136 134 # endif -
trunk/Ohana/src/libfits/table/F_set_column.c
r15487 r16139 1 1 # include <ohana.h> 2 2 # include <gfitsio.h> 3 # define SWAP_BYTE \ 4 tmp = Pout[0]; Pout[0] = Pout[1]; Pout[1] = tmp; 5 # define SWAP_WORD \ 3 # define SWAP_BYTE { \ 4 char tmp; \ 5 tmp = Pout[0]; Pout[0] = Pout[1]; Pout[1] = tmp; } 6 # define SWAP_WORD { \ 7 char tmp; \ 6 8 tmp = Pout[0]; Pout[0] = Pout[3]; Pout[3] = tmp; \ 7 tmp = Pout[1]; Pout[1] = Pout[2]; Pout[2] = tmp; 8 # define SWAP_DBLE \ 9 tmp = Pout[1]; Pout[1] = Pout[2]; Pout[2] = tmp; } 10 # define SWAP_DBLE { \ 11 char tmp; \ 9 12 tmp = Pout[0]; Pout[0] = Pout[7]; Pout[7] = tmp; \ 10 13 tmp = Pout[1]; Pout[1] = Pout[6]; Pout[6] = tmp; \ 11 14 tmp = Pout[2]; Pout[2] = Pout[5]; Pout[5] = tmp; \ 12 tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; 15 tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; } 13 16 14 17 /***********************/ … … 17 20 int i, N, Nfields, Nval, Nbytes, Nx, Ny, nbytes, Nstart, Nv, Nb; 18 21 char tlabel[80], field[80], format[80], type[16], tmpline[16]; 19 char *Pin, *Pout, *array , tmp;22 char *Pin, *Pout, *array; 20 23 double Bscale, Bzero; 21 int I;22 24 23 25 if (label == (char *) NULL) return (FALSE); … … 82 84 *(short *)Pout = (*(short *)Pin - Bzero) / Bscale; 83 85 # ifdef BYTE_SWAP 84 I = i*Nbytes;85 86 SWAP_BYTE; 86 87 # endif … … 91 92 *(int *)Pout = (*(int *)Pin - Bzero) / Bscale; 92 93 # ifdef BYTE_SWAP 93 I = i*Nbytes;94 94 SWAP_WORD; 95 95 # endif … … 100 100 *(float *)Pout = (*(float *)Pin - Bzero) / Bscale; 101 101 # ifdef BYTE_SWAP 102 I = i*Nbytes;103 102 SWAP_WORD; 104 103 # endif … … 109 108 *(double *)Pout = (*(double *)Pin - Bzero) / Bscale; 110 109 # ifdef BYTE_SWAP 111 I = i*Nbytes;112 110 SWAP_DBLE; 113 111 # endif -
trunk/Ohana/src/opihi/cmd.data/book_commands.c
r15206 r16139 170 170 book = GetBook (where); 171 171 if (book == NULL) { 172 if (varName) { 173 set_str_variable (varName, "NULL"); 174 FREE (varName); 175 return TRUE; 176 } 177 172 178 gprint (GP_ERR, "book %s not found\n", argv[1]); 173 179 FREE (varName); … … 178 184 set_str_variable (varName, book[0].name); 179 185 } else { 180 gprint (GP_ ERR, "%s\n", book[0].name);186 gprint (GP_LOG, "%s\n", book[0].name); 181 187 } 182 188 FREE (varName); … … 294 300 295 301 int where, N; 296 char * pageName, *varName, *keyName, *keyValue;302 char *varName, *keyName, *keyValue; 297 303 Book *book; 298 304 Page *page; … … 326 332 book = FindBook (argv[1]); 327 333 if (book == NULL) { 334 if (varName) { 335 set_str_variable (varName, "NULL"); 336 FREE (varName); 337 FREE (keyName); 338 FREE (keyValue); 339 return TRUE; 340 } 328 341 gprint (GP_ERR, "book %s not found\n", argv[1]); 329 342 FREE (varName); … … 338 351 page = GetPageRestricted (book, where, keyName, keyValue); 339 352 } 353 340 354 if (page == NULL) { 341 pageName = strcreate ("NULL"); 355 if (varName) { 356 set_str_variable (varName, "NULL"); 357 FREE (varName); 358 FREE (keyName); 359 FREE (keyValue); 360 return TRUE; 361 } 362 gprint (GP_ERR, "page %d not found in %s\n", where, argv[1]); 363 FREE (varName); 364 FREE (keyName); 365 FREE (keyValue); 366 return FALSE; 367 } 368 369 if (varName) { 370 set_str_variable (varName, page[0].name); 342 371 } else { 343 pageName = strcreate (page[0].name); 344 } 345 346 if (varName) { 347 set_str_variable (varName, pageName); 348 } else { 349 gprint (GP_ERR, "%s\n", pageName); 350 } 351 FREE (pageName); 372 gprint (GP_LOG, "%s\n", page[0].name); 373 } 352 374 FREE (varName); 353 375 FREE (keyName); … … 404 426 book = FindBook (argv[1]); 405 427 if (book == NULL) { 428 if (varName) { 429 set_str_variable (varName, "NULL"); 430 FREE (varName); 431 return TRUE; 432 } 406 433 gprint (GP_ERR, "book %s not found\n", argv[1]); 407 434 FREE (varName); … … 411 438 page = FindPage (book, argv[2]); 412 439 if (page == NULL) { 440 if (varName) { 441 set_str_variable (varName, "NULL"); 442 FREE (varName); 443 return TRUE; 444 } 413 445 gprint (GP_ERR, "page %s in book %s not found\n", argv[2], argv[1]); 414 446 FREE (varName); … … 418 450 value = BookGetWord (page, argv[3]); 419 451 if (value == NULL) { 420 if (varName == NULL) { 421 gprint (GP_ERR, "value %s on page %s in book %s not found\n", argv[3], argv[2], argv[1]); 422 FREE (varName); 423 return FALSE; 424 } else { 452 if (varName) { 425 453 set_str_variable (varName, "NULL"); 426 454 FREE (varName); 427 455 return TRUE; 428 456 } 457 gprint (GP_ERR, "value %s on page %s in book %s not found\n", argv[3], argv[2], argv[1]); 458 FREE (varName); 459 return FALSE; 429 460 } 430 461 … … 432 463 set_str_variable (varName, value); 433 464 } else { 434 gprint (GP_ ERR, "%s\n", value);465 gprint (GP_LOG, "%s\n", value); 435 466 } 436 467
Note:
See TracChangeset
for help on using the changeset viewer.
