IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5900


Ignore:
Timestamp:
Jan 4, 2006, 10:00:28 PM (21 years ago)
Author:
eugene
Message:

fixes for skyregion, generate

Location:
trunk/Ohana/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/include/addstar.h

    r5585 r5900  
    130130Stars     *rd_gsc                 PROTO((char *filename, int *nstars));
    131131int        replace_match          PROTO((Average *average, Measure *measure, Stars *star));
    132 Stars     *rfits                  PROTO((FILE *f, int *nstars));
    133 Stars     *rtext                  PROTO((FILE *f, int *nstars));
     132Stars     *rfits                  PROTO((FILE *f, unsigned int *nstars));
     133Stars     *rtext                  PROTO((FILE *f, unsigned int *nstars));
    134134void       save_pt_catalog        PROTO((Catalog *catalog));  /*** choose new name ***/
    135135double     scat_subpix            PROTO((double x, double y));
  • trunk/Ohana/src/addstar/src/rfits.c

    r4864 r5900  
    11# include "addstar.h"
    22
    3 Stars *rfits (FILE *f, int *nstars) {
     3Stars *rfits (FILE *f, unsigned int *nstars) {
    44
    55  int i, Nstars;
  • trunk/Ohana/src/addstar/src/rtext.c

    r4844 r5900  
    44# define BLOCK 1000
    55
    6 Stars *rtext (FILE *f, int *nstars) {
     6Stars *rtext (FILE *f, unsigned int *nstars) {
    77
    88  int j, N, Nextra, Ninstar, Nskip, Nbytes, nbytes;
  • trunk/Ohana/src/libautocode/generate

    r5448 r5900  
    119119        if ($type eq "unsigned int")  { $pt1 = "J"; }
    120120        if ($type eq "e_time")        { $pt1 = "J"; }
    121         if ($type eq "e_void")        { $pt1 = "L"; }
    122         # e_void is a 64 bit pointer, cast to size_t
    123121        if ($type eq "float")         { $pt1 = "E"; }
    124122        if ($type eq "double")        { $pt1 = "D"; }
     123
     124        if ($type eq "e_void")        { $pt1 = "B"; $Np = 8*$Np; }
     125        # e_void is a 64 bit pointer, cast to size_t.  its value is not loaded
     126        # from the table.
     127
    125128        if (!$pt1) { die "unknown type $type"; }
    126129
     
    190193        if ($type eq "unsigned int")  { $pt1 = sprintf "I%s", $length; }
    191194        if ($type eq "e_time")        { $pt1 = sprintf "I%s", $length; }
    192         if ($type eq "e_void")        { $pt1 = sprintf "I%s", $length; }
    193195        if ($type eq "float")         { $pt1 = sprintf "F%s", $length; }
    194196        if ($type eq "double")        { $pt1 = sprintf "F%s", $length; }
     197
     198        if ($type eq "e_void")        { $pt1 = sprintf "I%s", $length; }
     199
    195200        if (!$pt1) { die "unknown type $type"; }
    196201
  • trunk/Ohana/src/libdvo/src/skyregion_io.c

    r5451 r5900  
    9090  int status;
    9191
    92   /* first option: catdir/SkyTable.fits */
     92  /* first option: CATDIR/SkyTable.fits */
     93  sprintf (filename, "%s/SkyTable.fits", catdir);
     94  if (stat (filename, &filestat)) goto SKYFILE;
     95  if (!check_file_access (filename, FALSE, verbose)) goto SKYFILE;
     96  sky = SkyTableLoad (filename, verbose);
     97  if (sky == NULL) {
     98    fprintf (stderr, "error loading sky table\n");
     99    exit (1);
     100  }
     101  return (sky);
     102
     103SKYFILE:
     104  /* second option: SKYFILE */
     105  if (skyfile == NULL) goto GSCFILE;
     106  if (skyfile[0] != 0) goto GSCFILE;
     107  if (stat (skyfile, &filestat)) goto GSCFILE;
     108  if (!check_file_access (skyfile, FALSE, verbose)) goto GSCFILE;
     109  sky = SkyTableLoad (skyfile, verbose);
     110  if (sky == NULL) {
     111    fprintf (stderr, "error loading sky table\n");
     112    exit (1);
     113  }
     114  /* set the depths to the default depth */
     115  SkyTableSetDepth (sky, depth);
     116
     117  /* create CATDIR copy */
    93118  sprintf (filename, "%s/SkyTable.fits", catdir);
    94119  check_file_access (filename, FALSE, verbose);
     120  SkyTableSave (sky, filename);
     121  fits_convert_SkyRegion (sky[0].regions, sizeof (SkyTable), sky[0].Nregions);
     122  return (sky);
    95123
    96   /* check for file existence */
    97   status = stat (filename, &filestat);
    98   if (status == 0) { /* file exists, are permissions OK? */
    99     sky = SkyTableLoad (filename, verbose);
    100     if (sky == NULL) {
    101       fprintf (stderr, "error loading sky table\n");
    102       exit (1);
    103     }
    104     return (sky);
    105   }
    106 
    107   /* first option: SKY_TABLE */
    108   if ((skyfile != NULL) && (skyfile[0] != 0)) {
    109     status = stat (skyfile, &filestat);
    110     if (status == 0) { /* file exists, are permissions OK? */
    111       sky = SkyTableLoad (skyfile, verbose);
    112       if (sky == NULL) {
    113         fprintf (stderr, "error loading sky table\n");
    114         exit (1);
    115       }
    116       SkyTableSetDepth (sky, depth);
    117 
    118       /* write CATDIR copy */
    119       sprintf (filename, "%s/SkyTable.fits", catdir);
    120       check_file_access (filename, FALSE, verbose);
    121       SkyTableSave (sky, filename);
    122       fits_convert_SkyRegion (sky[0].regions, sizeof (SkyTable), sky[0].Nregions);
    123       return (sky);
    124     }
    125   }
    126 
     124GSCFILE:
     125  /* third option: GSCFILE */
    127126  sky = SkyTableFromGSC (gscfile, depth, verbose);
    128127  if (sky == NULL) {
     
    131130  }
    132131
    133   /* write CATDIR copy */
     132  /* create CATDIR copy */
    134133  sprintf (filename, "%s/SkyTable.fits", catdir);
    135134  check_file_access (filename, FALSE, verbose);
    136135  SkyTableSave (sky, filename);
    137136  fits_convert_SkyRegion (sky[0].regions, sizeof (SkyRegion), sky[0].Nregions);
    138 
    139137  return (sky);
    140138}
  • trunk/Ohana/src/opihi/dvo/Makefile

    r5850 r5900  
    4545$(SDIR)/calextract.$(ARCH).o            \
    4646$(SDIR)/calmextract.$(ARCH).o           \
     47$(SDIR)/catdir.$(ARCH).o                \
    4748$(SDIR)/ccd.$(ARCH).o                   \
    4849$(SDIR)/cmatch.$(ARCH).o                \
  • trunk/Ohana/src/opihi/dvo/catdir.c

    r5451 r5900  
    33int catdir_define (int argc, char **argv) {
    44 
    5   int VERBOSE;
     5  int status, N, VERBOSE;
    66
    77  VERBOSE = FALSE;
  • trunk/Ohana/src/opihi/dvo/dvo.c

    r5451 r5900  
    88
    99/* program-dependent initialization */
    10 void initialize (int argc, char **argv) {
     10void program_init (int argc, char **argv) {
    1111 
    1212  auto_break = TRUE;
     
    1818  InitDVO ();
    1919
    20   if (SetCATDIR (NULL, TRUE)) {
     20  if (!SetCATDIR (NULL, TRUE)) {
    2121    fprintf (stderr, "CATDIR is not defined\n");
    2222  }
     
    2828  set_str_variable ("PROMPT", opihi_prompt);
    2929  set_str_variable ("RCFILE", opihi_rcfile);
     30
    3031# ifdef HELPDIR_DEFAULT
    3132  set_str_variable ("HELPDIR", MACRO_NAME(HELPDIR_DEFAULT));
    3233# endif
    3334
    34   { /* check history file permission */
    35     FILE *f;
    36     f = fopen (opihi_history, "a");
    37     if (f == NULL) /* no current history file here */
    38       fprintf (stderr, "can't save history.\n");
    39     else
    40       fclose (f);
    41     stifle_history (200);
    42     read_history (opihi_history);
    43   }
    44 
    45   signal (SIGINT, SIG_IGN);
    4635  return;
    4736}
  • trunk/Ohana/src/opihi/dvo/init.c

    r5451 r5900  
    66int calmextract     PROTO((int, char **));
    77int catlog          PROTO((int, char **));
     8int catdir_define   PROTO((int, char **));
    89int ccd             PROTO((int, char **));
    910int cmatch          PROTO((int, char **));
     
    6162  {"calextract",  calextract,   "extract photometry calibration"},
    6263  {"calmextract", calmextract,  "extract photometry calibration"},
     64  {"catdir",      catdir_define,"re-define CATDIR"},
    6365  {"ccd",         ccd,          "plot color-color diagram"},
    6466  {"cmatch",      cmatch,       "match two catalogs"},
  • trunk/Ohana/src/opihi/dvo/region_list.c

    r5451 r5900  
    3030  if (VarConfig ("SKYFILE",  "%s", skyfile) == NULL) skyfile[0] = 0;
    3131  if (VarConfig ("SKYDEPTH", "%d", &skydepth) == NULL) skydepth = 2;
     32
     33  if (verbose) {
     34      fprintf (stderr, "CATDIR %s\n", catdir);
     35      fprintf (stderr, "GSCFILE %s\n", gscfile);
     36      fprintf (stderr, "SKYFILE %s\n", skyfile);
     37      fprintf (stderr, "SKYDEPTH %d\n", skydepth);
     38  }
    3239
    3340  /* load the SkyTable at this point */
     
    8188  int Ngraph;
    8289  Graphdata graphsky;
    83   SkyTable *sky;
    8490  SkyList *skylist;
    8591  char filename[256];
  • trunk/Ohana/src/opihi/include/shell.h

    r4763 r5900  
    4444
    4545/*** basic opihi shell functions ***/
    46 void          initialize                PROTO((int argc, char **argv));
     46void          general_init              PROTO((int argc, char **argv));
     47void          program_init              PROTO((int argc, char **argv));
    4748void          startup                   PROTO((int argc, char **argv));
    4849int           multicommand              PROTO((char *line));
  • trunk/Ohana/src/opihi/lib.shell/opihi.c

    r4763 r5900  
    88  pid_t ppid;
    99
    10   initialize (argc, argv);
     10  general_init (argc, argv);
     11  program_init (argc, argv);
    1112  startup (argc, argv);
    1213  prompt = get_variable("PROMPT");
     
    4546  }
    4647}
     48
     49/*
     50   startup sequence:
     51
     52   - general_init
     53   - program_init
     54   - startup (exit if non-interactive)
     55   - welcome
     56
     57*/
  • trunk/Ohana/src/opihi/lib.shell/startup.c

    r4689 r5900  
    11# include "opihi.h"
    22
    3 /* program-independent initialization */
    4 void startup (int argc, char **argv) {
     3/* program-independent initialization
     4 * these steps do not depend on the opihi implementation
     5 * (ie, the supplied commands or data structures)
     6 */
    57
    6   long A, B;
    7    
    8   signal (SIGINT, SIG_IGN);
     8void general_init (int argc, char **argv) {
    99
    1010  /* init srand for rnd numbers elsewhere */
     11  long A, B;
    1112  A = time(NULL);
    1213  for (B = 0; A == time(NULL); B++);
    1314  srand48(B);
    1415 
    15   if (0) {
    16     /* fix the history list to remove the timestamp */
    17     char *c;
    18     int i;
    19     HIST_ENTRY **entry;
    20    
    21     entry = history_list ();
    22     if (entry != (HIST_ENTRY **) NULL) {
    23       for (i = 0; entry[i]; i++) {
    24         if ((strlen (entry[i][0].line) > 19) &&
    25             (entry[i][0].line[2] == '/') &&
    26             (entry[i][0].line[5] == '/') &&
    27             (entry[i][0].line[11] == ':') &&
    28             (entry[i][0].line[14] == ':') &&
    29             (entry[i][0].line[17] == ':')) {
    30           c = entry[i][0].line + 19;
    31           memmove (entry[i][0].line, c, strlen(c) + 1);
    32         }
    33       }
    34     }
     16  /* set signals */
     17  signal (SIGINT, SIG_IGN);
     18
     19  /* load config data (.ptolemyrc) */
     20  if (!ConfigInit (&argc, argv)) {
     21    fprintf (stderr, "can't find config file. some functions will be unavailable\n");
    3522  }
    36  
    37   {
     23
     24  return;
     25}
     26
     27void startup (int argc, char **argv) {
    3828   
    3929    int i, N, status, ONLY_INPUT, LOAD_RC;
     
    5747  */
    5848
    59     if (!ConfigInit (&argc, argv)) {
    60       fprintf (stderr, "can't find config file. some functions will be unavailable\n");
     49
     50
     51  /* check history file permission */
     52  {
     53    FILE *f;
     54    char *opihi_history;
     55
     56    opihi_history = get_variable ("RCFILE");
     57    f = fopen (opihi_history, "a");
     58    if (f == NULL) /* no current history file here */
     59      fprintf (stderr, "can't save history.\n");
     60    else
     61      fclose (f);
     62    stifle_history (200);
     63    read_history (opihi_history);
     64  }
     65
     66  if (0) {
     67    /* fix the history list to remove the timestamp */
     68    char *c;
     69    int i;
     70    HIST_ENTRY **entry;
     71   
     72    entry = history_list ();
     73    if (entry != (HIST_ENTRY **) NULL) {
     74      for (i = 0; entry[i]; i++) {
     75        if ((strlen (entry[i][0].line) > 19) &&
     76            (entry[i][0].line[2] == '/') &&
     77            (entry[i][0].line[5] == '/') &&
     78            (entry[i][0].line[11] == ':') &&
     79            (entry[i][0].line[14] == ':') &&
     80            (entry[i][0].line[17] == ':')) {
     81          c = entry[i][0].line + 19;
     82          memmove (entry[i][0].line, c, strlen(c) + 1);
     83        }
     84      }
    6185    }
    6286
Note: See TracChangeset for help on using the changeset viewer.