Changeset 39463
- Timestamp:
- Mar 14, 2016, 1:37:09 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/read_vectors.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r39360 r39463 10 10 int read_table_sizes (Header *header); 11 11 int read_table_fields (Header *header, int isCompressed, int VERBOSE); 12 void list_extnames ( void);12 void list_extnames (int VERBOSE); 13 13 14 14 int datafile (int argc, char **argv) { … … 409 409 } 410 410 411 // note the order of -v -list-fields -q below: 412 // VERBOSE = FALSE is the natural default, but if -list-fields is given, 413 // VERBOSE = TRUE becomes the default. this can be overridden by -q 414 // but to make that sequence work, we need to test for those three 415 // options in that order: -v -list-fields -q 416 // this is also true for -list (listExtnames) 417 int VERBOSE = FALSE; 418 if ((N = get_argument (argc, argv, "-v"))) { 419 remove_argument (N, &argc, argv); 420 VERBOSE = TRUE; 421 } 411 422 int listFields = FALSE; 412 423 if ((N = get_argument (argc, argv, "-list-fields"))) { 413 424 remove_argument (N, &argc, argv); 414 425 listFields = TRUE; 426 VERBOSE = TRUE; 427 } 428 int listExtnames = FALSE; 429 if (!strcmp(extname, "-list")) { 430 listExtnames = TRUE; 431 VERBOSE = TRUE; 432 } 433 if ((N = get_argument (argc, argv, "-q"))) { 434 remove_argument (N, &argc, argv); 435 VERBOSE = FALSE; 415 436 } 416 437 … … 419 440 remove_argument (N, &argc, argv); 420 441 Nextend = atoi (extname); 421 }422 423 int VERBOSE = FALSE;424 if ((N = get_argument (argc, argv, "-v"))) {425 remove_argument (N, &argc, argv);426 VERBOSE = TRUE;427 442 } 428 443 … … 454 469 // } 455 470 456 int listExtnames = FALSE;457 if (!strcmp(extname, "-list")) {458 listExtnames = TRUE;459 }460 461 471 if ((argc < 2) && !getSizes && !listFields && !listExtnames) ESCAPE ("USAGE: read -fits extension [-extnum] [-keyword key] name name ...\n"); 462 472 if ((argc != 1) && getSizes) ESCAPE ("USAGE: read -sizes -fits extension [-extnum] (does not read data values)\n"); … … 469 479 470 480 if (listExtnames) { 471 list_extnames ( );481 list_extnames (VERBOSE); 472 482 return TRUE; 473 483 } … … 764 774 if (!gfits_scan (header, field, "%s", 1, nval)) strcpy (nval, "none"); 765 775 766 if (VERBOSE) gprint (GP_LOG, "%-18s %-1 8s %-6s %-8s %-8s %-32s\n", type, unit, format, null, nval, comment);776 if (VERBOSE) gprint (GP_LOG, "%-18s %-15s %-18s %-6s %-8s %-8s %-32s\n", type, varname, unit, format, null, nval, comment); 767 777 } 768 778 … … 771 781 } 772 782 773 void list_extnames ( void) {783 void list_extnames (int VERBOSE) { 774 784 775 785 off_t Nbytes, Nelem; 776 786 int i, Naxis, Ncomp, extend, status; 777 char extname[82], exttype[82], axisname[32];787 char extname[82], varname[32], exttype[82], axisname[32]; 778 788 Header header; 779 789 780 790 fseeko (f, 0, SEEK_SET); 781 791 782 gprint (GP_LOG, "%-30s %-15s NAXIS NAXIS(i)...\n", "extname", "datatype");792 if (VERBOSE) gprint (GP_LOG, "%-30s %-15s %-15s NAXIS NAXIS(i)...\n", "extname", "varname", "datatype"); 783 793 784 794 Ncomp = 0; … … 793 803 } 794 804 } 795 gprint (GP_LOG, "%-30s ", extname); 805 if (VERBOSE) gprint (GP_LOG, "%-30s ", extname); 806 807 snprintf (varname, 32, "extname:%d", Ncomp); 808 set_str_variable (varname, extname); 809 if (VERBOSE) gprint (GP_LOG, "%-15s ", varname); 796 810 797 811 /* extract the datatype for this component (IMAGE for 0th component) */ … … 804 818 } 805 819 } 806 gprint (GP_LOG, "%-15s ", exttype);820 if (VERBOSE) gprint (GP_LOG, "%-15s ", exttype); 807 821 808 822 /* extract the rank of the component */ … … 813 827 continue; 814 828 } 815 gprint (GP_LOG, " %4d", Naxis);829 if (VERBOSE) gprint (GP_LOG, " %4d", Naxis); 816 830 817 831 /* extract the individual axes */ … … 822 836 gprint (GP_ERR, "missing %s\n", axisname); 823 837 } 824 gprint (GP_LOG, " "OFF_T_FMT, Nelem);825 } 826 gprint (GP_LOG, "\n");838 if (VERBOSE) gprint (GP_LOG, " "OFF_T_FMT, Nelem); 839 } 840 if (VERBOSE) gprint (GP_LOG, "\n"); 827 841 828 842 /* are extensions identified? (we will scan for them anyway) */ … … 840 854 Ncomp ++; 841 855 } 856 set_int_variable ("extname:n", Ncomp); 842 857 return; 843 858 }
Note:
See TracChangeset
for help on using the changeset viewer.
