IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16139


Ignore:
Timestamp:
Jan 18, 2008, 2:52:14 PM (18 years ago)
Author:
eugene
Message:

return NULL if output var requested and entry not found

Location:
trunk/Ohana/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/elixir/src/ConfigInit.c

    r13322 r16139  
    5252  signal (SIGTTIN,   SIG_IGN);   
    5353  signal (SIGTTOU,   SIG_IGN);   
    54   signal (SIGPOLL,   SIG_IGN);   
    5554  signal (SIGPROF,   SIG_IGN);   
    5655  signal (SIGURG,    SIG_IGN);     
     
    5958
    6059  /* signals which are not always defined */
     60# ifdef SIGPOLL
     61  signal (SIGPOLL,   SIG_IGN);   
     62# endif
    6163# ifdef SIGPWR
    6264  signal (SIGPWR, SIG_DIE);     /* power failure (Sys V) */
  • trunk/Ohana/src/imregister/imreg/SetSignals.c

    r13322 r16139  
    4343  signal (SIGTTIN,   SIG_IGN);   
    4444  signal (SIGTTOU,   SIG_IGN);   
    45   signal (SIGPOLL,   SIG_IGN);   
    4645  signal (SIGPROF,   SIG_IGN);   
    4746  signal (SIGURG,    SIG_IGN);     
     
    5049
    5150  /* signals which are not always defined */
     51# ifdef SIGPOLL
     52  signal (SIGPOLL,   SIG_IGN);   
     53# endif
    5254# ifdef SIGPWR
    5355  signal (SIGPWR, SIG_DIE);     /* power failure (Sys V) */
  • trunk/Ohana/src/libdvo/Makefile

    r16093 r16139  
    9191
    9292$(AINC)/autocode.h: $(AINCS) $(ADEF)/autocode.h $(ADEF)/common.h
    93         echo "make $@ from $^"
     93        @echo "make $@ from $^"
    9494        cd $(AUTO) && make $@
    9595
    9696# generic rule for AINCS
    9797$(AINC)/%.h : $(ADEF)/%.d $(ADEF)/autocode.h $(ADEF)/common.h
    98         echo "make $@ from $^"
     98        @echo "make $@ from $^"
    9999        cd $(AUTO) && make $@
    100100
    101101# generic rule for ASRC
    102102$(ASRC)/%.c : $(ADEF)/%.d $(ADEF)/autocode.c $(AINC)/%.h
    103         echo "make $@ from $^"
     103        @echo "make $@ from $^"
    104104        cd $(AUTO) && make $@
    105105
    106106# generic rule for AOBJS
    107107$(ASRC)/%.$(ARCH).o : $(ASRC)/%.c
    108         echo "make $@ from $^"
     108        @echo "make $@ from $^"
    109109        cd $(AUTO) && make $@
    110110
  • trunk/Ohana/src/libfits/matrix/F_load_M.c

    r15751 r16139  
    1414
    1515  int i, nbytes, Nbytes;
    16   unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
    17   int perpix;
    1816
    1917  matrix[0].bitpix = header[0].bitpix;
     
    4038
    4139# ifdef BYTE_SWAP 
     40 {
     41  int perpix;
     42  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
     43
    4244  perpix = abs(header[0].bitpix) / 8;
    4345  if (perpix > 1) {
     
    8486    }
    8587  }
     88 }
    8689# endif
    8790
  • trunk/Ohana/src/libfits/matrix/F_read_portion.c

    r15743 r16139  
    1313  FILE *f;
    1414  Header header;
    15   int status, i, nbytes, Nbytes, Nrec;
    16   unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
    17   int perpix;
     15  int status, nbytes, Nbytes, Nrec;
    1816
    1917  status = gfits_read_header (filename, &header);
     
    5452
    5553# ifdef BYTE_SWAP 
     54 {
     55  int i, perpix;
     56  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
     57
    5658  perpix = abs(header.bitpix) / 8;
    5759  if (perpix > 1) {
     
    98100    }
    99101  }
     102 }
    100103# endif
    101104
  • trunk/Ohana/src/libfits/matrix/F_read_segment.c

    r15743 r16139  
    3838  int status, i, nbytes, Nbytes, Nskip, NbytesData;
    3939  int wantaxis[FT_MAX_NAXES][2];
    40   unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
    4140  double tmp;
    42   int perpix;
    4341
    4442  for (i = 0; i < FT_MAX_NAXES; i++) {
     
    9795
    9896# ifdef BYTE_SWAP 
     97 {
     98  unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, ctmp;
     99  int perpix;
     100
    99101  perpix = abs(header[0].bitpix) / 8;
    100102  if (perpix > 1) {
     
    141143    }
    142144  }
     145 }
    143146# endif
    144147
  • trunk/Ohana/src/libfits/matrix/F_write_M.c

    r7054 r16139  
    2121int gfits_fwrite_matrix (FILE *f, Matrix *matrix) {
    2222
    23   int i, status, nbytes, Nbytes;
    24   unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
    25   int perpix;
     23  int status, nbytes, Nbytes;
    2624
    2725  status = TRUE;
     
    3028     if the size is wrong, it probably should simply pad the fwrite statement.
    3129     better policy should be defined (ie, matrix.size always correct blocking?)
    32  */
     30  */
    3331
    3432  if (matrix[0].size % FT_RECORD_SIZE)
     
    3937  /* this is a bit cumbersome: swap all words, write out file, then swap back... */
    4038# ifdef BYTE_SWAP 
    41   perpix = abs(matrix[0].bitpix) / 8;
    42   if (perpix > 1) {
    43     byte0 = (unsigned char *) matrix[0].buffer;
    44     byte1 = (unsigned char *) matrix[0].buffer + 1;
    45     byte2 = (unsigned char *) matrix[0].buffer + 2;
    46     byte3 = (unsigned char *) matrix[0].buffer + 3;
    47     byte4 = (unsigned char *) matrix[0].buffer + 4;
    48     byte5 = (unsigned char *) matrix[0].buffer + 5;
    49     byte6 = (unsigned char *) matrix[0].buffer + 6;
    50     byte7 = (unsigned char *) matrix[0].buffer + 7;
    51     if (perpix == 2) {
    52       for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
    53         tmp = *byte0;
    54         *byte0 = *byte1;
    55         *byte1 = tmp;
     39  {
     40    int i;
     41    unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
     42    int perpix;
     43
     44    perpix = abs(matrix[0].bitpix) / 8;
     45    if (perpix > 1) {
     46      byte0 = (unsigned char *) matrix[0].buffer;
     47      byte1 = (unsigned char *) matrix[0].buffer + 1;
     48      byte2 = (unsigned char *) matrix[0].buffer + 2;
     49      byte3 = (unsigned char *) matrix[0].buffer + 3;
     50      byte4 = (unsigned char *) matrix[0].buffer + 4;
     51      byte5 = (unsigned char *) matrix[0].buffer + 5;
     52      byte6 = (unsigned char *) matrix[0].buffer + 6;
     53      byte7 = (unsigned char *) matrix[0].buffer + 7;
     54      if (perpix == 2) {
     55        for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
     56          tmp = *byte0;
     57          *byte0 = *byte1;
     58          *byte1 = tmp;
     59        }
    5660      }
    57     }
    58     if (perpix == 4) {
    59       for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
    60         tmp = *byte0;
    61         *byte0 = *byte3;
    62         *byte3 = tmp;
    63         tmp = *byte1;
    64         *byte1 = *byte2;
    65         *byte2 = tmp;
     61      if (perpix == 4) {
     62        for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
     63          tmp = *byte0;
     64          *byte0 = *byte3;
     65          *byte3 = tmp;
     66          tmp = *byte1;
     67          *byte1 = *byte2;
     68          *byte2 = tmp;
     69        }
    6670      }
    67     }
    68     if (perpix == 8) {
    69       for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
    70         tmp = *byte0;
    71         *byte0 = *byte7;
    72         *byte7 = tmp;
    73         tmp = *byte1;
    74         *byte1 = *byte6;
    75         *byte6 = tmp;
    76         tmp = *byte1;
    77         *byte2 = *byte5;
    78         *byte5 = tmp;
    79         tmp = *byte1;
    80         *byte3 = *byte4;
    81         *byte4 = tmp;
     71      if (perpix == 8) {
     72        for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
     73          tmp = *byte0;
     74          *byte0 = *byte7;
     75          *byte7 = tmp;
     76          tmp = *byte1;
     77          *byte1 = *byte6;
     78          *byte6 = tmp;
     79          tmp = *byte1;
     80          *byte2 = *byte5;
     81          *byte5 = tmp;
     82          tmp = *byte1;
     83          *byte3 = *byte4;
     84          *byte4 = tmp;
     85        }
    8286      }
    8387    }
     
    9094  }
    9195
    92 # ifdef BYTE_SWAP 
    93   perpix = abs(matrix[0].bitpix) / 8;
    94   if (perpix > 1) {
    95     byte0 = (unsigned char *) matrix[0].buffer;
    96     byte1 = (unsigned char *) matrix[0].buffer + 1;
    97     byte2 = (unsigned char *) matrix[0].buffer + 2;
    98     byte3 = (unsigned char *) matrix[0].buffer + 3;
    99     byte4 = (unsigned char *) matrix[0].buffer + 4;
    100     byte5 = (unsigned char *) matrix[0].buffer + 5;
    101     byte6 = (unsigned char *) matrix[0].buffer + 6;
    102     byte7 = (unsigned char *) matrix[0].buffer + 7;
    103     if (perpix == 2) {
    104       for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
    105         tmp = *byte0;
    106         *byte0 = *byte1;
    107         *byte1 = tmp;
     96# ifdef BYTE_SWAP
     97  {
     98    int i;
     99    unsigned char *byte0, *byte1, *byte2, *byte3, *byte4, *byte5, *byte6, *byte7, tmp;
     100    int perpix;
     101
     102    perpix = abs(matrix[0].bitpix) / 8;
     103    if (perpix > 1) {
     104      byte0 = (unsigned char *) matrix[0].buffer;
     105      byte1 = (unsigned char *) matrix[0].buffer + 1;
     106      byte2 = (unsigned char *) matrix[0].buffer + 2;
     107      byte3 = (unsigned char *) matrix[0].buffer + 3;
     108      byte4 = (unsigned char *) matrix[0].buffer + 4;
     109      byte5 = (unsigned char *) matrix[0].buffer + 5;
     110      byte6 = (unsigned char *) matrix[0].buffer + 6;
     111      byte7 = (unsigned char *) matrix[0].buffer + 7;
     112      if (perpix == 2) {
     113        for (i = 0; i < nbytes; i+=2, byte0 += 2, byte1 += 2) {
     114          tmp = *byte0;
     115          *byte0 = *byte1;
     116          *byte1 = tmp;
     117        }
    108118      }
    109     }
    110     if (perpix == 4) {
    111       for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
    112         tmp = *byte0;
    113         *byte0 = *byte3;
    114         *byte3 = tmp;
    115         tmp = *byte1;
    116         *byte1 = *byte2;
    117         *byte2 = tmp;
     119      if (perpix == 4) {
     120        for (i = 0; i < nbytes; i+=4, byte0 += 4, byte1 += 4, byte2 += 4, byte3 += 4) {
     121          tmp = *byte0;
     122          *byte0 = *byte3;
     123          *byte3 = tmp;
     124          tmp = *byte1;
     125          *byte1 = *byte2;
     126          *byte2 = tmp;
     127        }
    118128      }
    119     }
    120     if (perpix == 8) {
    121       for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
    122         tmp = *byte0;
    123         *byte0 = *byte7;
    124         *byte7 = tmp;
    125         tmp = *byte1;
    126         *byte1 = *byte6;
    127         *byte6 = tmp;
    128         tmp = *byte1;
    129         *byte2 = *byte5;
    130         *byte5 = tmp;
    131         tmp = *byte1;
    132         *byte3 = *byte4;
    133         *byte4 = tmp;
     129      if (perpix == 8) {
     130        for (i = 0; i < nbytes; i+=8, byte0 += 8, byte1 += 8, byte2 += 8, byte3 += 8, byte4 += 8, byte5 += 8, byte6 += 8, byte7 += 8) {
     131          tmp = *byte0;
     132          *byte0 = *byte7;
     133          *byte7 = tmp;
     134          tmp = *byte1;
     135          *byte1 = *byte6;
     136          *byte6 = tmp;
     137          tmp = *byte1;
     138          *byte2 = *byte5;
     139          *byte5 = tmp;
     140          tmp = *byte1;
     141          *byte3 = *byte4;
     142          *byte4 = tmp;
     143        }
    134144      }
    135145    }
  • trunk/Ohana/src/libfits/table/F_get_column.c

    r12399 r16139  
    11# include <ohana.h>
    22# include <gfitsio.h>
    3 # define SWAP_BYTE \
    4   tmp = Pin[0]; Pin[0] = Pin[1]; Pin[1] = tmp;
    5 # define SWAP_WORD \
     3# define SWAP_BYTE { \
     4  char tmp; \
     5  tmp = Pin[0]; Pin[0] = Pin[1]; Pin[1] = tmp; }
     6# define SWAP_WORD { \
     7  char tmp; \
    68  tmp = Pin[0]; Pin[0] = Pin[3]; Pin[3] = tmp; \
    7   tmp = Pin[1]; Pin[1] = Pin[2]; Pin[2] = tmp;
    8 # define SWAP_DBLE \
     9  tmp = Pin[1]; Pin[1] = Pin[2]; Pin[2] = tmp; }
     10# define SWAP_DBLE { \
     11  char tmp; \
    912  tmp = Pin[0]; Pin[0] = Pin[7]; Pin[7] = tmp; \
    1013  tmp = Pin[1]; Pin[1] = Pin[6]; Pin[6] = tmp; \
    1114  tmp = Pin[2]; Pin[2] = Pin[5]; Pin[5] = tmp; \
    12   tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp;
     15  tmp = Pin[3]; Pin[3] = Pin[4]; Pin[4] = tmp; }
    1316
    1417/***********************/
     
    4346  int i, N, Nfields, Nval, Nbytes, Nx, Ny, Nstart, Nv, Nb;
    4447  char tlabel[80], field[80], format[80], type[16], tmpline[16];
    45   char *Pin, *Pout, *array, tmp;
     48  char *Pin, *Pout, *array;
    4649  double Bscale, Bzero;
    47   int I;
    4850
    4951  if (label == (char *) NULL) return (FALSE);
     
    105107    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
    106108# ifdef BYTE_SWAP
    107       I = i*Nbytes;
    108109      SWAP_BYTE;
    109110# endif
     
    114115    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
    115116# ifdef BYTE_SWAP
    116       I = i*Nbytes;
    117117      SWAP_WORD;
    118118# endif
     
    123123    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
    124124# ifdef BYTE_SWAP
    125       I = i*Nbytes;
    126125      SWAP_WORD;
    127126# endif
     
    132131    for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) {
    133132# ifdef BYTE_SWAP
    134       I = i*Nbytes;
    135133      SWAP_DBLE;
    136134# endif
  • trunk/Ohana/src/libfits/table/F_set_column.c

    r15487 r16139  
    11# include <ohana.h>
    22# include <gfitsio.h>
    3 # define SWAP_BYTE \
    4   tmp = Pout[0]; Pout[0] = Pout[1]; Pout[1] = tmp;
    5 # define SWAP_WORD \
     3# define SWAP_BYTE { \
     4  char tmp; \
     5  tmp = Pout[0]; Pout[0] = Pout[1]; Pout[1] = tmp; }
     6# define SWAP_WORD { \
     7  char tmp; \
    68  tmp = Pout[0]; Pout[0] = Pout[3]; Pout[3] = tmp; \
    7   tmp = Pout[1]; Pout[1] = Pout[2]; Pout[2] = tmp;
    8 # define SWAP_DBLE \
     9  tmp = Pout[1]; Pout[1] = Pout[2]; Pout[2] = tmp; }
     10# define SWAP_DBLE { \
     11  char tmp; \
    912  tmp = Pout[0]; Pout[0] = Pout[7]; Pout[7] = tmp; \
    1013  tmp = Pout[1]; Pout[1] = Pout[6]; Pout[6] = tmp; \
    1114  tmp = Pout[2]; Pout[2] = Pout[5]; Pout[5] = tmp; \
    12   tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp;
     15  tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; }
    1316
    1417/***********************/
     
    1720  int i, N, Nfields, Nval, Nbytes, Nx, Ny, nbytes, Nstart, Nv, Nb;
    1821  char tlabel[80], field[80], format[80], type[16], tmpline[16];
    19   char *Pin, *Pout, *array, tmp;
     22  char *Pin, *Pout, *array;
    2023  double Bscale, Bzero;
    21   int I;
    2224
    2325  if (label == (char *) NULL) return (FALSE);
     
    8284      *(short *)Pout = (*(short *)Pin - Bzero) / Bscale;
    8385# ifdef BYTE_SWAP
    84       I = i*Nbytes;
    8586      SWAP_BYTE;
    8687# endif
     
    9192      *(int *)Pout = (*(int *)Pin - Bzero) / Bscale;
    9293# ifdef BYTE_SWAP
    93       I = i*Nbytes;
    9494      SWAP_WORD;
    9595# endif
     
    100100      *(float *)Pout = (*(float *)Pin - Bzero) / Bscale;
    101101# ifdef BYTE_SWAP
    102       I = i*Nbytes;
    103102      SWAP_WORD;
    104103# endif
     
    109108      *(double *)Pout = (*(double *)Pin - Bzero) / Bscale;
    110109# ifdef BYTE_SWAP
    111       I = i*Nbytes;
    112110      SWAP_DBLE;
    113111# endif
  • trunk/Ohana/src/opihi/cmd.data/book_commands.c

    r15206 r16139  
    170170  book = GetBook (where);
    171171  if (book == NULL) {
     172    if (varName) {
     173      set_str_variable (varName, "NULL");
     174      FREE (varName);
     175      return TRUE;
     176    }
     177
    172178    gprint (GP_ERR, "book %s not found\n", argv[1]);
    173179    FREE (varName);
     
    178184    set_str_variable (varName, book[0].name);
    179185  } else {
    180     gprint (GP_ERR, "%s\n", book[0].name);
     186    gprint (GP_LOG, "%s\n", book[0].name);
    181187  }
    182188  FREE (varName);
     
    294300
    295301  int where, N;
    296   char *pageName, *varName, *keyName, *keyValue;
     302  char *varName, *keyName, *keyValue;
    297303  Book *book;
    298304  Page *page;
     
    326332  book = FindBook (argv[1]);
    327333  if (book == NULL) {
     334    if (varName) {
     335      set_str_variable (varName, "NULL");
     336      FREE (varName);
     337      FREE (keyName);
     338      FREE (keyValue);
     339      return TRUE;
     340    }
    328341    gprint (GP_ERR, "book %s not found\n", argv[1]);
    329342    FREE (varName);
     
    338351    page = GetPageRestricted (book, where, keyName, keyValue);
    339352  }
     353
    340354  if (page == NULL) {
    341     pageName = strcreate ("NULL");
     355    if (varName) {
     356      set_str_variable (varName, "NULL");
     357      FREE (varName);
     358      FREE (keyName);
     359      FREE (keyValue);
     360      return TRUE;
     361    }
     362    gprint (GP_ERR, "page %d not found in %s\n", where, argv[1]);
     363    FREE (varName);
     364    FREE (keyName);
     365    FREE (keyValue);
     366    return FALSE;
     367  }
     368
     369  if (varName) {
     370    set_str_variable (varName, page[0].name);
    342371  } else {
    343     pageName = strcreate (page[0].name);
    344   }
    345 
    346   if (varName) {
    347     set_str_variable (varName, pageName);
    348   } else {
    349     gprint (GP_ERR, "%s\n", pageName);
    350   }
    351   FREE (pageName);
     372    gprint (GP_LOG, "%s\n", page[0].name);
     373  }
    352374  FREE (varName);
    353375  FREE (keyName);
     
    404426  book = FindBook (argv[1]);
    405427  if (book == NULL) {
     428    if (varName) {
     429      set_str_variable (varName, "NULL");
     430      FREE (varName);
     431      return TRUE;
     432    }
    406433    gprint (GP_ERR, "book %s not found\n", argv[1]);
    407434    FREE (varName);
     
    411438  page = FindPage (book, argv[2]);
    412439  if (page == NULL) {
     440    if (varName) {
     441      set_str_variable (varName, "NULL");
     442      FREE (varName);
     443      return TRUE;
     444    }
    413445    gprint (GP_ERR, "page %s in book %s not found\n", argv[2], argv[1]);
    414446    FREE (varName);
     
    418450  value = BookGetWord (page, argv[3]);
    419451  if (value == NULL) {
    420     if (varName == NULL) {
    421       gprint (GP_ERR, "value %s on page %s in book %s not found\n", argv[3], argv[2], argv[1]);
    422       FREE (varName);
    423       return FALSE;
    424     } else {
     452    if (varName) {
    425453      set_str_variable (varName, "NULL");
    426454      FREE (varName);
    427455      return TRUE;
    428456    }
     457    gprint (GP_ERR, "value %s on page %s in book %s not found\n", argv[3], argv[2], argv[1]);
     458    FREE (varName);
     459    return FALSE;
    429460  }
    430461
     
    432463    set_str_variable (varName, value);
    433464  } else {
    434     gprint (GP_ERR, "%s\n", value);
     465    gprint (GP_LOG, "%s\n", value);
    435466  }
    436467   
Note: See TracChangeset for help on using the changeset viewer.