IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36073


Ignore:
Timestamp:
Aug 30, 2013, 4:52:59 PM (13 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/eam_branches/ipp-20130711/Ohana
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130711/Ohana

  • branches/eam_branches/ipp-20130711/Ohana/src/dvomerge

  • branches/eam_branches/ipp-20130711/Ohana/src/getstar/src/dvoImagesAtCoords.c

    r33658 r36073  
    99static int makePoint(double ra, double dec, Point **pointsOut);
    1010static int ListImagesAtCoords (Image *dbImages, Point *points, int Npoints);
     11static int readPointFromFile(FILE *f, Point *pt);
    1112
    1213int main (int argc, char **argv) {
     
    2324 
    2425  Point *points;
     26  int readStdin = 0;
    2527  if (coordsFile) {
    26       Npoints = readPoints(coordsFile, &points);
     28      if (strcmp(coordsFile, "-") == 0) {
     29        readStdin = 1;
     30      } else {
     31        Npoints = readPoints(coordsFile, &points);
     32      }
    2733  } else {
    2834      Npoints = makePoint(cmd_line_ra, cmd_line_dec, &points);
    2935  }
    30   if (!Npoints) {
     36  if (!Npoints && !readStdin) {
    3137    exit(1);
    3238  }
     
    6167  }
    6268 
    63   if (MatchCoords (dbImages, NdbImages, points, Npoints)) {
    64     ListImagesAtCoords(dbImages, points, Npoints);
    65     exit(0);
     69  if (readStdin) {
     70    Point pt;
     71    memset(&pt, 0, sizeof(pt));
     72    pt.Nmatches = 0;
     73    ALLOCATE(pt.matches, Match, 20);
     74    pt.arrayLength = 20;
     75
     76    int status;
     77    while ((status = readPointFromFile(stdin, &pt))) {
     78      if (status < 0) {
     79        fprintf(stdout, "ERROR malformed input line\n");
     80        exit(1);
     81      }
     82      if (MatchCoords (dbImages, NdbImages, &pt, 1)) {
     83        ListImagesAtCoords(dbImages, &pt, 1);
     84      }
     85      fprintf(stdout, "DONE\n");
     86      fflush(stdout);
     87      pt.Nmatches = 0;
     88    }
    6689  } else {
    67     exit(PSTAMP_NO_OVERLAP);
    68   }
     90    if (MatchCoords (dbImages, NdbImages, points, Npoints)) {
     91      ListImagesAtCoords(dbImages, points, Npoints);
     92    } else {
     93      exit(PSTAMP_NO_OVERLAP);
     94    }
     95  }
     96  exit(0);
     97}
     98
     99static int readPointFromFile(FILE *f, Point *pt) {
     100    char buf[80];
     101    char *good = fgets(buf, 80, f);
     102    if (!good) {
     103        return 0;
     104    }
     105    // fprintf(stderr, "READ: %s\n", buf);
     106    int Nread = sscanf(buf, "%d %lf %lf\n", &pt->id, &pt->ra, &pt->dec);
     107    if (Nread == 3) {
     108        // got one
     109        return 1;
     110    } else if (Nread == -1) {
     111        // all done time to go
     112        return 0;
     113    } else {
     114        // fprintf(stderr, "malformed input line: %d\n", Nread);
     115        return -1;
     116    }
    69117}
    70118
  • branches/eam_branches/ipp-20130711/Ohana/src/libdvo/src/HostTable.c

    r35102 r36073  
    8686      FreeHosts (hosts, Nhosts);
    8787      free (filename);
     88      fclose (f);
    8889      return NULL;
    8990    }
     
    133134
    134135  free (filename);
     136  fclose (f);
    135137  return table;
    136138}
  • branches/eam_branches/ipp-20130711/Ohana/src/libohana/src

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130711/Ohana/src/opihi

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.astro

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130711/Ohana/src/opihi/cmd.data

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/eam_branches/ipp-20130711/Ohana/src/relastro/src

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.