IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39326


Ignore:
Timestamp:
Jan 29, 2016, 2:39:24 PM (10 years ago)
Author:
watersc1
Message:

Update to roc to allow nebulous lookups. Removed it from the list of programs to build as it makes the build dependency chain more complicated.

Location:
trunk/Ohana/src/tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/tools/Makefile

    r38986 r39326  
    1717PROGRAMS = gconfig fhead pspsconvert ftable fields list_astro glockfile \
    1818radec mktemp precess csystem fits_insert \
    19 medianfilter mefhead ckfits roc random fits_to_mysql
     19medianfilter mefhead ckfits random fits_to_mysql
     20
     21# roc
     22# CZW: 2016-01-29 Removing roc from the list of programs, as I've made
     23# changes to it that require the nebclient library.  This complicates
     24# the dependency chain, and as roc isn't generally used, pulling it
     25# out is easier than solving that chain.
    2026
    2127all tools: $(PROGRAMS)
     
    2834FULL_CPPFLAGS = $(BASE_CPPFLAGS)
    2935FULL_LDFLAGS  = -ldvo -lFITS -lohana $(BASE_LDFLAGS)
     36
     37# CZW: required library for roc to compile.
     38# -lnebclient
    3039
    3140# these are all programs which just depend on a single c file: foo : foo.c
  • trunk/Ohana/src/tools/src/roc.c

    r33661 r39326  
    33# include <sys/types.h>
    44# include <regex.h>
     5# include <nebclient.h>
    56
    67# define ROC_HEADER_SIZE  0x1000
     
    1617int usage (void);
    1718int print_block (char *header, int *header_size, int *Noff, char *format,...);
     19
     20FILE *fopen_harder(char *filename);
    1821
    1922int main (int argc, char **argv) {
     
    241244  for (i = 0; i < Ninput; i++) {
    242245    if (i == Nfile) continue;
    243     input[i] = fopen(inputName[i], "r");
     246    input[i] = fopen_harder(inputName[i]);
    244247    myAssert (input[i], "failed to open file");
    245248  }
     
    364367
    365368  ALLOCATE (input, FILE *, Ninput);
    366   for (i = 0; i < Ninput; i++) {
    367     input[i] = fopen(inputName[i], "r");
    368     myAssert (input[i], "failed to open input: %d data file: %s in %s\n",i,inputName[i],targetName);
    369   }
     369  int error = 0;
     370  for (i = 0; i < Ninput; i++) {
     371    //    input[i] = fopen(inputName[i], "r");
     372    input[i] = fopen_harder(inputName[i]);
     373    //    myAssert (input[i], "failed to open input: %d data file: %s in %s\n",i,inputName[i],targetName);
     374    if (!(input[i])) {
     375      fprintf(stderr,"failed to open input: %d data file: %s in %s\n",i,inputName[i],targetName);
     376      error += 1;
     377    }
     378  }
     379  myAssert((error == 0), "Assertation that all were fine failed.");
    370380
    371381  ALLOCATE (inputData, char *, Ninput);
     
    409419}
    410420
     421FILE *fopen_harder (char *filename) {
     422  FILE *try;
     423
     424  fprintf(stderr,"TRYING: %s\n",filename);
     425  try = fopen(filename,"r");
     426  if (try) { return(try); }
     427
     428  char *root = filerootname(filename);
     429  fprintf(stderr,"TRYING: %s\n",root);
     430  try = fopen(root,"r");
     431  if (try) { return(try); }
     432
     433 
     434  char *key = malloc(sizeof(char) * (strlen(root) + 6));
     435  char *token = strtok(root,".");
     436  sprintf(key,"neb://");
     437  token = strtok(NULL,":");
     438  while (token) {
     439    sprintf(key,"%s/%s",key,token);
     440    token = strtok(NULL,":");
     441  }
     442  sprintf(key,"%s.fits",key);
     443  fprintf(stderr,"WILL_TRY: %s\n",key);
     444 
     445  char *disk_file = NULL;
     446  nebServer *server = nebServerAlloc("http://ippc08/nebulous");
     447  disk_file = nebFind(server,key);
     448  //  nebServerFree(server);
     449  //  free(key);
     450 
     451  if (disk_file) {
     452    fprintf(stderr,"TRYING: %s\n",disk_file);
     453    try = fopen(disk_file,"r");
     454    if (try) { return(try); }
     455  }
     456
     457  return(NULL);
     458}
     459
     460   
     461 
     462
    411463int roc_insert (int argc, char **argv) {
    412464
Note: See TracChangeset for help on using the changeset viewer.