IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4810


Ignore:
Timestamp:
Aug 17, 2005, 9:36:55 AM (21 years ago)
Author:
eugene
Message:

renamed hms_to_deg hstgsc_hms_to_deg everywhere, moved into libohana

Location:
trunk/Ohana/src
Files:
31 deleted
22 edited

Legend:

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

    r4805 r4810  
    147147Stars     *gstars                 PROTO((char *file, int *NSTARS, Image *image));
    148148void       help                   PROTO(());
    149 int        hms_to_deg             PROTO((double *h0, double *h1, double *d0, double *d1, char *string));
    150149int        in_image               PROTO((double r, double d, Image *image));
    151150int        load_pt_catalog        PROTO((Catalog *catalog, GSCRegion *region));  /*** choose new name ***/
  • trunk/Ohana/src/addstar/src/RegionOps.c

    r4299 r4810  
    6262    strncpy (temp, &table.buffer[i*48], 48);
    6363    temp[49] = 0;
    64     hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     64    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    6565    if (RA1 < RA0) RA1 += 360.0;
    6666
     
    210210
    211211*/
    212 
    213 /*
    214       if (buffer[i*48 + 19] == ' ') continue;
    215       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    216       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    217 
    218 
    219   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    220 
    221   NBigRA = ra / dBigRA;
    222 
    223   NBig = NBigRA;
    224   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    225     NBig += NBigRASections[i];
    226   }
    227   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    228     NBig += NBigRASections[i];
    229   }
    230 
    231 
    232   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    233 */
  • trunk/Ohana/src/delstar/src/RegionOps.c

    r4680 r4810  
    6262    strncpy (temp, &table.buffer[i*48], 48);
    6363    temp[49] = 0;
    64     hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     64    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    6565    if (RA1 < RA0) RA1 += 360.0;
    6666
     
    212212
    213213*/
    214 
    215 /*
    216       if (buffer[i*48 + 19] == ' ') continue;
    217       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    218       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    219 
    220 
    221   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    222 
    223   NBigRA = ra / dBigRA;
    224 
    225   NBig = NBigRA;
    226   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    227     NBig += NBigRASections[i];
    228   }
    229   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    230     NBig += NBigRASections[i];
    231   }
    232 
    233 
    234   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    235 */
  • trunk/Ohana/src/fixcat/src/aregion.c

    r2490 r4810  
    8787    strncpy (temp, &buffer[i*48], 48);
    8888    temp[49] = 0;
    89     hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     89    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    9090    if (RA1 < RA0) RA1 += 360.0;
    9191# ifdef DEBUG
     
    117117  return;
    118118}
    119 
    120 
    121 /**********/
    122 int hms_to_deg (h0, h1, d0, d1, string)
    123      char *string;
    124      double *h0, *h1, *d0, *d1;
    125 {
    126  
    127   int flag_d0, flag_d1, flag_h0, flag_h1;
    128   double tmp;
    129  
    130   *d0 = *h0 = *d1 = *h1 = 0;
    131 
    132   flag_h0 = dparse (h0, 1, string);
    133   flag_h1 = dparse (h1, 4, string);
    134   flag_d0 = dparse (d0, 7, string);
    135   flag_d1 = dparse (d1, 9, string);
    136   *h0 *= flag_h0;
    137   *h1 *= flag_h1;
    138   *d0 *= flag_d0;
    139   *d1 *= flag_d1;
    140 
    141   dparse (&tmp, 2, string);
    142   *h0 += tmp/60.0;
    143   dparse (&tmp, 3, string);
    144   *h0 += tmp/3600.0;
    145  
    146   dparse (&tmp, 5, string);
    147   *h1 += tmp/60.0;
    148   dparse (&tmp, 6, string);
    149   *h1 += tmp/3600.0;
    150  
    151   dparse (&tmp, 8, string);
    152   *d0 += tmp/60.0;
    153 
    154   dparse (&tmp, 10, string);
    155   *d1 += tmp/60.0;
    156 
    157   *h0 *= 15*flag_h0;
    158   *h1 *= 15*flag_h1;
    159   *d0 *= flag_d0;
    160   *d1 *= flag_d1;
    161 
    162   return (TRUE);
    163 }
    164 
    165 
    166 /*
    167       if (buffer[i*48 + 19] == ' ') continue;
    168       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    169       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    170 
    171 
    172   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    173 
    174   NBigRA = ra / dBigRA;
    175 
    176   NBig = NBigRA;
    177   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    178     NBig += NBigRASections[i];
    179   }
    180   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    181     NBig += NBigRASections[i];
    182   }
    183 
    184 
    185   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    186 */
  • trunk/Ohana/src/getstar/src/aregion.c

    r2490 r4810  
    8383    strncpy (temp, &buffer[i*48], 48);
    8484    temp[49] = 0;
    85     hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     85    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    8686    if (RA1 < RA0) RA1 += 360.0;
    8787    if ((dec >= 0) && (dec >= DEC0) && (dec < DEC1) && (ra >= RA0) && (ra < RA1)) {
     
    111111  return;
    112112}
    113 
    114 
    115 /**********/
    116 int hms_to_deg (h0, h1, d0, d1, string)
    117      char *string;
    118      double *h0, *h1, *d0, *d1;
    119 {
    120  
    121   int flag_d0, flag_d1, flag_h0, flag_h1;
    122   double tmp;
    123  
    124   *d0 = *h0 = *d1 = *h1 = 0;
    125 
    126   flag_h0 = dparse (h0, 1, string);
    127   flag_h1 = dparse (h1, 4, string);
    128   flag_d0 = dparse (d0, 7, string);
    129   flag_d1 = dparse (d1, 9, string);
    130   *h0 *= flag_h0;
    131   *h1 *= flag_h1;
    132   *d0 *= flag_d0;
    133   *d1 *= flag_d1;
    134 
    135   dparse (&tmp, 2, string);
    136   *h0 += tmp/60.0;
    137   dparse (&tmp, 3, string);
    138   *h0 += tmp/3600.0;
    139  
    140   dparse (&tmp, 5, string);
    141   *h1 += tmp/60.0;
    142   dparse (&tmp, 6, string);
    143   *h1 += tmp/3600.0;
    144  
    145   dparse (&tmp, 8, string);
    146   *d0 += tmp/60.0;
    147 
    148   dparse (&tmp, 10, string);
    149   *d1 += tmp/60.0;
    150 
    151   *h0 *= 15*flag_h0;
    152   *h1 *= 15*flag_h1;
    153   *d0 *= flag_d0;
    154   *d1 *= flag_d1;
    155 
    156   return (TRUE);
    157 }
    158 
    159 
    160 /*
    161       if (buffer[i*48 + 19] == ' ') continue;
    162       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    163       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    164 
    165 
    166   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    167 
    168   NBigRA = ra / dBigRA;
    169 
    170   NBig = NBigRA;
    171   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    172     NBig += NBigRASections[i];
    173   }
    174   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    175     NBig += NBigRASections[i];
    176   }
    177 
    178 
    179   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    180 */
  • trunk/Ohana/src/libohana/Makefile

    r4805 r4810  
    3232OBJ1 = \
    3333$(SRC)/ohana_allocate.$(ARCH).o  \
    34 $(SRC)/version.$(ARCH).o         \
    3534$(SRC)/string.$(ARCH).o          \
    3635$(SRC)/time.$(ARCH).o            \
     
    3837$(SRC)/glockfile.$(ARCH).o       \
    3938$(SRC)/config.$(ARCH).o          \
    40 $(SRC)/Fseek.$(ARCH).o           
     39$(SRC)/version.$(ARCH).o
    4140
    4241OBJ2 = \
  • trunk/Ohana/src/libohana/doc/libohana.html

    r2413 r4810  
    22<h2> libohana API reference </h2>
    33
    4 <h3> functions in string.c </h3>
     4<h3> ohana memory management functions </h3>
     5
     6<pre> ALLOCATE (void *ptr, type, int Nalloc); </pre>
     7<pre> REALLOCATE (void *ptr, type, int Nalloc); </pre>
     8<pre> CHECK_REALLOCATE (void *ptr, type, int Nalloc, int Nused, int Ndelta); </pre>
     9<pre> free (void *ptr); </pre>
     10
     11<pre> void  ohana_memregister (void *ptr); </pre>
     12<pre> void  ohana_memdump (int mode); </pre>
     13<pre> void  ohana_memcheck (int mode); </pre>
     14
     15<h3> string manipulation functions (string.c) </h3>
     16
     17<pre> int   get_argument (int argc, char **argv, char *arg); </pre>
     18<pre> int   remove_argument (int Narg, int *argc, char **argv); </pre>
     19<pre> char *strcreate (char *string); </pre>
     20<pre> char *strncreate (char *string, int Nbytes); </pre>
     21<pre> int   strnumcmp (char *str1, char *str2); </pre>
     22<pre> int   stripwhite (char *string); </pre>
     23<pre> int   scan_line (FILE *f, char *line); </pre>
     24<pre> int   dparse (double *value, int Nentry, char *line); </pre>
     25<pre> int   fparse (double *value, int Nentry, char *line); </pre>
     26<pre> char *_parse_nextword (char *string); </pre>
    527
    628<pre> int get_argument (int argc, char **argv, char *arg); </pre>
     
    1032<hr>
    1133
    12 <pre> int remove_argument (int Narg, int &argc, char **argv); </pre>
     34<pre> int remove_argument (int Narg, int *argc, char **argv); </pre>
    1335
    1436remove the given entry Narg from the argv list, adjusting argc
     
    2749<hr>
    2850
    29 <pre> char *strcreate (char *string); </pre>
    30 <pre> char *strncreate (char *string, int Nbytes); </pre>
    31 <pre> int scan_line (FILE *f, char *line); </pre>
    32 <pre> int dparse (double *value, int Nentry, char *line); </pre>
    33 <pre> int fparse (double *value, int Nentry, char *line); </pre>
    34 <pre> char *_parse_nextword (char *string); </pre>
    35 
    36 <h3> functions in findexec.c </h3>
     51<h3> file system functions (findexec.c) </h3>
    3752
    3853<pre> char *pathname (char *file); </pre>
     
    4156<pre> char *filebasename (char *file); </pre>
    4257<pre> char *findexec (int argc, char **argv); </pre>
    43 <pre> int mkdirhier (char *path); </pre>
     58<pre> int   mkdirhier (char *path); </pre>
    4459<pre> char *getcwd_cfht (char *path, int size); </pre>
    45 
    46 <h3> functions in glockfile.c </h3>
     60<pre> void  make_backup (char *filename); </pre>
     61<pre> int Fseek (FILE *f, long offset, int whence); </pre>
     62
     63<h3> lockfile functions (glockfile.c) </h3>
    4764
    4865<pre> FILE *fsetlockfile (char *filename, double timeout, int type, int *state); </pre>
    49 <pre> int fclearlockfile (char *filename, FILE *f, int type, int *state); </pre>
    50 <pre> int setlockfile2 (char *filename, double timeout, int type, int *state); </pre>
    51 <pre> int clearlockfile2 (char *filename, double timeout, int type, int *state); </pre>
    52 
    53 <b> deprecated functions : are they all removed?  </b>
    54 <pre> int setlockfile (char *name, double timeout, int hard); </pre>
    55 <pre> int clearlockfile (char *name, int fd, int hard); </pre>
    56 <pre> int gnfsflush (char *filename); </pre>
    57 
    58 <h3> functions in Fread.c </h3>
     66<pre> int   fclearlockfile (char *filename, FILE *f, int type, int *state); </pre>
     67
     68<h3> read/write (Fread.c) </h3>
    5969
    6070<pre> int Fread (char ptr, int size, int nitems, FILE *f, char *type); </pre>
     
    6373<pre> int ConvertStruct (char *buffer, int size, int nitems, char *type); </pre>
    6474
    65 <h3> functions in LoadPhotcodes.c </h3>
    66 
    67 <pre> int LoadPhotcodes (char *filename, PhotCodeData *photcodes); </pre>
    68 <pre> int FreePhotcodes (PhotCodeData *photcodes); </pre>
    69 <pre> int GetPhotcodebyName (PhotCodeData *photcodes, char *name); </pre>
    70 <pre> int GetPhotcodeRefs (PhotCodeData *photcodes, char *name, int *code, int *ref); </pre>
    71 <pre> int GetPhotcodeEquiv (PhotCodeData *photcodes, char *name, int *code, int *ref); </pre>
    72 <pre> char *GetPhotnamebyCode (PhotCodeData *photcodes, int code); </pre>
     75Several of these functions are used to perform byte-swapping for
     76structures in the pre-autocode days.  They should be deprecated and
     77dropped, but the autocoding must superceed the hard-wired structure
     78first.
     79
     80<h3> miscellaneous functions </h3>
     81
     82<pre> char *ohana_version (); </pre>
     83
     84<h3> photcode manipulations (LoadPhotcodes.c) </h3>
     85
     86<pre> int       LoadPhotcodes (char *filename, PhotCodeData *photcodes); </pre>
     87<pre> int       FreePhotcodes (PhotCodeData *photcodes); </pre>
     88
     89<pre> PhotCode *GetPhotcodebyName (char *name); </pre>
     90<pre> PhotCode *GetPhotcodeEquivbyName (char *name); </pre>
     91<pre> PhotCode *GetPhotcodebyCode (int code); </pre>
     92<pre> PhotCode *GetPhotcodeEquivbyCode (int code); </pre>
     93<pre> PhotCode *GetPhotcodebyNsec (int Nsec); </pre>
     94<pre> char     *GetPhotcodeNamebyCode (int code); </pre>
     95
     96<pre> int       GetPhotcodeCodebyName (char *name); </pre>
     97<pre> int       GetPhotcodeEquivCodebyName (char *name); </pre>
     98<pre> int       GetPhotcodeEquivCodebyCode (int code); </pre>
     99<pre> int       GetPhotcodeNsec (int code); </pre>
     100<pre> int       GetPhotcodeNsecfilt (); </pre>
     101<pre> int      *GetPhotcodeEquivList (int code, int *nlist); </pre>
     102
     103<pre> void      SetZeroPoint (double ZP); </pre>
     104<pre> void      ParseColorTerms (char *terms, float *X, int *N); </pre>
     105
     106<pre> int       PhotColor (Average *average, SecFilt *secfilt, Measure *measure, int c1, int c2, double *color); </pre>
     107<pre> short     iPhotColor (Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); </pre>
     108
     109<pre> double    PhotInst (Measure *measure); </pre>
     110<pre> double    PhotCat (Measure *measure); </pre>
     111<pre> double    PhotSys (Measure *measure, Average *average, SecFilt *secfilt); </pre>
     112<pre> double    PhotRel (Measure *measure, Average *average, SecFilt *secfilt); </pre>
     113<pre> double    PhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); </pre>
     114<pre> double    PhotAve (PhotCode *code, Average *average, SecFilt *secfilt); </pre>
     115<pre> double    PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure); </pre>
     116<pre> double    PhotdM (PhotCode *code, Average *average, SecFilt *secfilt); </pre>
     117<pre> double    PhotXm (PhotCode *code, Average *average, SecFilt *secfilt); </pre>
     118
     119<pre> short     iPhotInst (Measure *measure); </pre>
     120<pre> short     iPhotCat (Measure *measure); </pre>
     121<pre> short     iPhotSys (Measure *measure, Average *average, SecFilt *secfilt); </pre>
     122<pre> short     iPhotRel (Measure *measure, Average *average, SecFilt *secfilt); </pre>
     123<pre> short     iPhotCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); </pre>
     124<pre> short     iPhotAve (PhotCode *code, Average *average, SecFilt *secfilt); </pre>
     125<pre> short     iPhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure); </pre>
     126<pre> short     iPhotdM (PhotCode *code, Average *average, SecFilt *secfilt); </pre>
     127<pre> short     iPhotXm (PhotCode *code, Average *average, SecFilt *secfilt); </pre>
    73128
    74129<h3> functions in config.c </h3>
     
    113168
    114169<pre>
    115 ALLOCATE (void *ptr, type, int Nelement)
    116 REALLOCATE (void *ptr, type, int Nelement)
    117170
    118171SIGN(X) 
  • trunk/Ohana/src/libohana/include/dvo.h

    r4586 r4810  
    171171PhotCode *GetPhotcodebyNsec (int Nsec);
    172172PhotCode *GetPhotcodeEquivbyCode (int code);
    173 char *GetPhotcodeNamebyCode (int code);
     173
     174char     *GetPhotcodeNamebyCode (int code);
    174175
    175176double PhotInst (Measure *measure);
    176 double PhotAbs (Measure *measure);
    177177double PhotCat (Measure *measure);
    178178double PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
  • trunk/Ohana/src/libohana/include/ohana.h

    r4806 r4810  
    107107char   *filebasename           PROTO((char *name));
    108108char   *filerootname           PROTO((char *name));
     109char   *fileextname            PROTO((char *file));
    109110char   *findexec               PROTO((int argc, char **argv));
    110111int     mkdirhier              PROTO((char *path));
     
    138139int     str_to_dtime           PROTO((char *line, double *second));
    139140int     str_to_time            PROTO((char *line, time_t *second));
    140 int     str_to_radec           PROTO((double *ra, double *dec, char *str1, char *str2));
    141141double  sec_to_mjd             PROTO((time_t second));
    142142time_t  mjd_to_sec             PROTO((double mjd));
    143 int     hms_to_deg             PROTO((double *h0, double *h1, double *d0, double *d1, char *string));
     143
     144int     hstgsc_hms_to_deg      PROTO((double *h0, double *h1, double *d0, double *d1, char *string));
     145int     str_to_radec           PROTO((double *ra, double *dec, char *str1, char *str2));
    144146
    145147/*
  • trunk/Ohana/src/libohana/src/findexec.c

    r3517 r4810  
    270270  }
    271271}
     272
     273/* fseek with timeout - 0.5 sec */
     274int Fseek (FILE *f, long offset, int whence) {
     275
     276  int status, k;
     277
     278  status = fseek (f, offset, whence);
     279  if (status == -1) {
     280    for (k = 0; (k < 10) && ((status = fseek (f, 0, SEEK_SET)) == -1); k++) usleep (50000);
     281    if (status == -1) {
     282      return (0);
     283    }
     284  }
     285  return (1);
     286}
  • trunk/Ohana/src/markrock/src/aregion.c

    r2490 r4810  
    8787    strncpy (temp, &buffer[i*48], 48);
    8888    temp[49] = 0;
    89     hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     89    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    9090    if (RA1 < RA0) RA1 += 360.0;
    9191# ifdef DEBUG
     
    117117  return;
    118118}
    119 
    120 
    121 /**********/
    122 int hms_to_deg (h0, h1, d0, d1, string)
    123      char *string;
    124      double *h0, *h1, *d0, *d1;
    125 {
    126  
    127   int flag_d0, flag_d1, flag_h0, flag_h1;
    128   double tmp;
    129  
    130   *d0 = *h0 = *d1 = *h1 = 0;
    131 
    132   flag_h0 = dparse (h0, 1, string);
    133   flag_h1 = dparse (h1, 4, string);
    134   flag_d0 = dparse (d0, 7, string);
    135   flag_d1 = dparse (d1, 9, string);
    136   *h0 *= flag_h0;
    137   *h1 *= flag_h1;
    138   *d0 *= flag_d0;
    139   *d1 *= flag_d1;
    140 
    141   dparse (&tmp, 2, string);
    142   *h0 += tmp/60.0;
    143   dparse (&tmp, 3, string);
    144   *h0 += tmp/3600.0;
    145  
    146   dparse (&tmp, 5, string);
    147   *h1 += tmp/60.0;
    148   dparse (&tmp, 6, string);
    149   *h1 += tmp/3600.0;
    150  
    151   dparse (&tmp, 8, string);
    152   *d0 += tmp/60.0;
    153 
    154   dparse (&tmp, 10, string);
    155   *d1 += tmp/60.0;
    156 
    157   *h0 *= 15*flag_h0;
    158   *h1 *= 15*flag_h1;
    159   *d0 *= flag_d0;
    160   *d1 *= flag_d1;
    161 
    162   return (TRUE);
    163 }
    164 
    165 
    166 /*
    167       if (buffer[i*48 + 19] == ' ') continue;
    168       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    169       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    170 
    171 
    172   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    173 
    174   NBigRA = ra / dBigRA;
    175 
    176   NBig = NBigRA;
    177   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    178     NBig += NBigRASections[i];
    179   }
    180   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    181     NBig += NBigRASections[i];
    182   }
    183 
    184 
    185   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    186 */
  • trunk/Ohana/src/markstar/src/aregion.c

    r2490 r4810  
    8787    strncpy (temp, &buffer[i*48], 48);
    8888    temp[49] = 0;
    89     hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     89    hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    9090    if (RA1 < RA0) RA1 += 360.0;
    9191# ifdef DEBUG
     
    117117  return;
    118118}
    119 
    120 
    121 /**********/
    122 int hms_to_deg (h0, h1, d0, d1, string)
    123      char *string;
    124      double *h0, *h1, *d0, *d1;
    125 {
    126  
    127   int flag_d0, flag_d1, flag_h0, flag_h1;
    128   double tmp;
    129  
    130   *d0 = *h0 = *d1 = *h1 = 0;
    131 
    132   flag_h0 = dparse (h0, 1, string);
    133   flag_h1 = dparse (h1, 4, string);
    134   flag_d0 = dparse (d0, 7, string);
    135   flag_d1 = dparse (d1, 9, string);
    136   *h0 *= flag_h0;
    137   *h1 *= flag_h1;
    138   *d0 *= flag_d0;
    139   *d1 *= flag_d1;
    140 
    141   dparse (&tmp, 2, string);
    142   *h0 += tmp/60.0;
    143   dparse (&tmp, 3, string);
    144   *h0 += tmp/3600.0;
    145  
    146   dparse (&tmp, 5, string);
    147   *h1 += tmp/60.0;
    148   dparse (&tmp, 6, string);
    149   *h1 += tmp/3600.0;
    150  
    151   dparse (&tmp, 8, string);
    152   *d0 += tmp/60.0;
    153 
    154   dparse (&tmp, 10, string);
    155   *d1 += tmp/60.0;
    156 
    157   *h0 *= 15*flag_h0;
    158   *h1 *= 15*flag_h1;
    159   *d0 *= flag_d0;
    160   *d1 *= flag_d1;
    161 
    162   return (TRUE);
    163 }
    164 
    165 
    166 /*
    167       if (buffer[i*48 + 19] == ' ') continue;
    168       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    169       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    170 
    171 
    172   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    173 
    174   NBigRA = ra / dBigRA;
    175 
    176   NBig = NBigRA;
    177   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    178     NBig += NBigRASections[i];
    179   }
    180   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    181     NBig += NBigRASections[i];
    182   }
    183 
    184 
    185   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    186 */
  • trunk/Ohana/src/misc/src/mkfringetable.c

    r4772 r4810  
    11# include <ohana.h>
    2 static char *version = "mkfringetable $Revision: 1.4 $";
     2static char *version = "mkfringetable $Revision: 1.5 $";
    33
    44void get_version (int argc, char **argv, char *version);
    5 char *sec_to_date (unsigned long second);
    65
    76int main (int argc, char **argv) {
     
    176175
    177176/**** support functions ******/
    178 char *sec_to_date (unsigned long second) {
    179  
    180   struct tm *gmt;
    181   char *line;
    182  
    183   ALLOCATE (line, char, 64);
    184   gmt   = gmtime (&second);
    185   sprintf (line, "%4d/%02d/%02d,%02d:%02d:%02d", 1900+gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec);
    186   return (line);
    187 }
    188 
    189177void get_version (int argc, char **argv, char *version) {
    190178
  • trunk/Ohana/src/misc/src/radec.c

    r2417 r4810  
    22
    33int help ();
    4 int hms_to_deg (double *h, double *d, char *string, char sep, int Nin);
     4int _hms_to_deg (double *h, double *d, char *string, char sep, int Nin);
    55
    66int main (int argc, char **argv) {
     
    1515  if (get_argument (argc, argv, "-hms")) {
    1616    while (scan_line (stdin, line) != EOF) {
    17       status = hms_to_deg (&ra, &dec, line, sep, 3);
     17      status = _hms_to_deg (&ra, &dec, line, sep, 3);
    1818      if (status)
    1919        fprintf (stdout, "%10.6f %10.6f\n", ra, dec);
     
    5656
    5757/**********/
    58 int hms_to_deg (double *h, double *d, char *string, char sep, int Nin) {
     58int _hms_to_deg (double *h, double *d, char *string, char sep, int Nin) {
    5959 
    6060  char *c;
  • trunk/Ohana/src/misc/src/regions.c

    r2417 r4810  
    109109        strncpy (temp, &buffer[i*48], 48);
    110110        temp[49] = 0;
    111         hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     111        hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    112112        (DEBUG) && fprintf (stderr, "%f %f %f    %f %f %f  %s\n", dec, DEC0, DEC1, ra, RA0, RA1, temp);
    113113        if ((dec >= 0) && (dec >= DEC0) && (dec < DEC1) && (ra >= RA0) && (ra < RA1)) {
     
    134134
    135135}
    136 
    137 
    138 
    139 /**********/
    140 int hms_to_deg (h0, h1, d0, d1, string)
    141 char *string;
    142 double *h0, *h1, *d0, *d1;
    143 {
    144  
    145   char *c;
    146   int i, flag_d0, flag_d1, flag_h0, flag_h1;
    147   double tmp;
    148  
    149   *d0 = *h0 = *d1 = *h1 = 0;
    150 
    151   flag_h0 = dparse (h0, 1, string);
    152   flag_h1 = dparse (h1, 4, string);
    153   flag_d0 = dparse (d0, 7, string);
    154   flag_d1 = dparse (d1, 9, string);
    155   *h0 *= flag_h0;
    156   *h1 *= flag_h1;
    157   *d0 *= flag_d0;
    158   *d1 *= flag_d1;
    159 
    160   dparse (&tmp, 2, string);
    161   *h0 += tmp/60.0;
    162   dparse (&tmp, 3, string);
    163   *h0 += tmp/3600.0;
    164  
    165   dparse (&tmp, 5, string);
    166   *h1 += tmp/60.0;
    167   dparse (&tmp, 6, string);
    168   *h1 += tmp/3600.0;
    169  
    170   dparse (&tmp, 8, string);
    171   *d0 += tmp/60.0;
    172 
    173   dparse (&tmp, 10, string);
    174   *d1 += tmp/60.0;
    175 
    176   *h0 *= 15*flag_h0;
    177   *h1 *= 15*flag_h1;
    178   *d0 *= flag_d0;
    179   *d1 *= flag_d1;
    180 
    181   return (TRUE);
    182 }
    183 
    184 
    185 /*
    186       if (buffer[i*48 + 19] == ' ') continue;
    187       strncpy (temp, &buffer[i*48 + 19], 20);       temp[20] = 0;
    188       hms_to_deg (&RA,  &DEC, temp, ' ', 3);
    189 
    190 
    191   dBigRA = 360.0 / (int)(0.5 + 48*cos(3.1415927*0.5*(BigDecBounds[NBigDec] + BigDecBounds[NBigDec + 1])/180.0));
    192 
    193   NBigRA = ra / dBigRA;
    194 
    195   NBig = NBigRA;
    196   for (i = 0; (i < 12) && (i < NBigDec); i++) {
    197     NBig += NBigRASections[i];
    198   }
    199   for (i = 13; (i < 24) && (i < NBigDec); i++) {
    200     NBig += NBigRASections[i];
    201   }
    202 
    203 
    204   fprintf (stderr, "%d %d %d %d %f %f -> %f %f %f\n", NBigDec, NBigRA, NBigRASections[NBigDec], NBig, ra, dec, BigDecBounds[NBigDec], BigDecBounds[NBigDec + 1], dBigRA);
    205 */
  • trunk/Ohana/src/opihi/include/convert.h

    r4805 r4810  
    1919char         *meade_ra_to_str       PROTO((double deg));
    2020char         *meade_dec_to_str      PROTO((double deg));
    21 int           hstgsc_hms_to_deg     PROTO((double *h0, double *h1, double *d0, double *d1, char *string));
    2221char         *strptime              PROTO((const char *s, const char *format, struct tm *tm));
    2322
  • trunk/Ohana/src/opihi/lib.data/convert.c

    r4805 r4810  
    6969}
    7070
    71 /***** extract RA - RA, DEC - DEC from HST GSC entry *****/
    72 int hstgsc_hms_to_deg (double *h0, double *h1, double *d0, double *d1, char *string) {
    73  
    74   int flag_d0, flag_d1, flag_h0, flag_h1;
    75   double tmp;
    76  
    77   *d0 = *h0 = *d1 = *h1 = 0;
    78 
    79   flag_h0 = dparse (h0, 1, string);
    80   flag_h1 = dparse (h1, 4, string);
    81   flag_d0 = dparse (d0, 7, string);
    82   flag_d1 = dparse (d1, 9, string);
    83   *h0 *= flag_h0;
    84   *h1 *= flag_h1;
    85   *d0 *= flag_d0;
    86   *d1 *= flag_d1;
    87 
    88   dparse (&tmp, 2, string);
    89   *h0 += tmp/60.0;
    90   dparse (&tmp, 3, string);
    91   *h0 += tmp/3600.0;
    92  
    93   dparse (&tmp, 5, string);
    94   *h1 += tmp/60.0;
    95   dparse (&tmp, 6, string);
    96   *h1 += tmp/3600.0;
    97  
    98   dparse (&tmp, 8, string);
    99   *d0 += tmp/60.0;
    100 
    101   dparse (&tmp, 10, string);
    102   *d1 += tmp/60.0;
    103 
    104   *h0 *= 15*flag_h0;
    105   *h1 *= 15*flag_h1;
    106   *d0 *= flag_d0;
    107   *d1 *= flag_d1;
    108 
    109   return (TRUE);
    110 }
    111 
    11271/***** convert 00:00:00 or 00:00 to 0 - 86400 ****/
    11372int hms_to_sec (char *string, time_t *second) {
  • trunk/Ohana/src/photdbc/src/get_regions.c

    r4808 r4810  
    114114      strncpy (temp, &buffer[i*48], 48);
    115115      temp[49] = 0;
    116       hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     116      hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    117117      if (RA1 < RA0) RA1 += 360.0;
    118118      if ((DEC1 > 0) && (minDec < DEC1) && (maxDec > DEC0) && (minRa < RA1) && (maxRa > RA0)) {
     
    166166 
    167167}
    168 
    169 /**********/
    170 int hms_to_deg (double *h0, double *h1, double *d0, double *d1, char *string) {
    171  
    172   int flag_d0, flag_d1, flag_h0, flag_h1;
    173   double tmp;
    174  
    175   *d0 = *h0 = *d1 = *h1 = 0;
    176 
    177   flag_h0 = dparse (h0, 1, string);
    178   flag_h1 = dparse (h1, 4, string);
    179   flag_d0 = dparse (d0, 7, string);
    180   flag_d1 = dparse (d1, 9, string);
    181   *h0 *= flag_h0;
    182   *h1 *= flag_h1;
    183   *d0 *= flag_d0;
    184   *d1 *= flag_d1;
    185 
    186   dparse (&tmp, 2, string);
    187   *h0 += tmp/60.0;
    188   dparse (&tmp, 3, string);
    189   *h0 += tmp/3600.0;
    190  
    191   dparse (&tmp, 5, string);
    192   *h1 += tmp/60.0;
    193   dparse (&tmp, 6, string);
    194   *h1 += tmp/3600.0;
    195  
    196   dparse (&tmp, 8, string);
    197   *d0 += tmp/60.0;
    198 
    199   dparse (&tmp, 10, string);
    200   *d1 += tmp/60.0;
    201 
    202   *h0 *= 15*flag_h0;
    203   *h1 *= 15*flag_h1;
    204   *d0 *= flag_d0;
    205   *d1 *= flag_d1;
    206 
    207   return (TRUE);
    208 }
  • trunk/Ohana/src/relphot/include/relphot.h

    r4805 r4810  
    100100/*** relphot prototypes ***/
    101101void          ConfigInit          PROTO((int *argc, char **argv));
    102 int           Fseek               PROTO((FILE *f, long offset, int whence));
    103102void          GetConfig           PROTO((char *config, char *field, char *format, int N, void *ptr));
    104103char         *GetPhotnamebyCode   PROTO((PhotCodeData *photcodes, int code));
  • trunk/Ohana/src/relphot/src/get_regions.c

    r4805 r4810  
    114114      strncpy (temp, &buffer[i*48], 48);
    115115      temp[49] = 0;
    116       hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
     116      hstgsc_hms_to_deg (&RA0, &RA1, &DEC0, &DEC1, &temp[7]);
    117117      if (RA1 < RA0) RA1 += 360.0;
    118118      if ((DEC1 > 0) && (minDec < DEC1) && (maxDec > DEC0) && (minRa < RA1) && (maxRa > RA0)) {
  • trunk/Ohana/src/relphot/src/misc.c

    r4805 r4810  
    181181  }
    182182}
    183 
    184 /* fseek with timeout - 0.5 sec */
    185 int Fseek (FILE *f, long offset, int whence) {
    186 
    187   int status;
    188 
    189   status = fseek (f, offset, whence);
    190   if (status == -1) {
    191     int k;
    192     /* fprintf (stderr, "problem seeking position: %d\n", errno); */
    193     for (k = 0; (k < 10) && ((status = fseek (f, 0, SEEK_SET)) == -1); k++) usleep (50000);
    194     if (status == -1) {
    195       /* fprintf (stderr, "ERROR: serious problem seeking position: %d\n", errno); */
    196       /* clear lock at this point? */
    197       return (0);
    198     }
    199   }
    200   return (1);
    201 }
  • trunk/Ohana/src/skycalc/Makefile

    r3263 r4810  
    2727OBJ =   $(SRC)/time.$(ARCH).o           $(SRC)/geometry.$(ARCH).o \
    2828        $(SRC)/astro.$(ARCH).o          $(SRC)/sun.$(ARCH).o \
    29         $(SRC)/moon.$(ARCH).o           $(SRC)/misc.$(ARCH).o           
     29        $(SRC)/moon.$(ARCH).o
    3030
    3131$(OBJ): $(INC)/skycalc.h $(INC)/skycalc_internal.h
Note: See TracChangeset for help on using the changeset viewer.