diff -ur saods9/saotk/frame/fitsimage.C saods9.new/saotk/frame/fitsimage.C --- saods9/saotk/frame/fitsimage.C 2009-10-01 20:05:23.000000000 +0200 +++ saods9.new/saotk/frame/fitsimage.C 2010-03-30 13:35:16.000000000 +0200 @@ -27,6 +27,99 @@ extern "C" { FitsHead* wcshead = NULL; char* ksearchh(char*, char*); + char* ksearchh(char* hstring, char* keyword) + /* Find entry for keyword keyword in FITS header string hstring. + (the keyword may have a maximum of eight letters) + NULL is returned if the keyword is not found */ + + /*const char *hstring; character string containing fits-style header + information in the format <keyword>= <value> {/ <comment>} + the default is that each entry is 80 characters long; + however, lines may be of arbitrary length terminated by + nulls, carriage returns or linefeeds, if packed is true. */ + /*const char *keyword; character string containing the name of the variable + to be returned. ksearch searches for a line beginning + with this string. The string may be a character + literal or a character variable terminated by a null + or '$'. it is truncated to 8 characters. */ + { + const char *headlast; + char *loc, *headnext, *pval, *lc, *line; + int icol, nextchar, lkey, nleft, lhead, lmax; + +#ifdef USE_SAOLIB + int iel=1, ip=1, nel, np, ier; + char *get_fits_head_str(); + + if( !use_saolib ){ +#endif + + pval = 0; + static int lhead0 = 0; + /* Find current length of header string */ + if (lhead0) + lmax = lhead0; + else + lmax = 256000; + for (lhead = 0; lhead < lmax; lhead++) { + if (hstring[lhead] == (char) 0) + break; + } + + /* Search header string for variable name */ + headlast = hstring + lhead; + headnext = (char *) hstring; + pval = NULL; + while (headnext < headlast) { + nleft = headlast - headnext; + loc = strncsrch (headnext, keyword, nleft); + + /* Exit if keyword is not found */ + if (loc == NULL) { + break; + } + + icol = (loc - hstring) % 80; + lkey = strlen (keyword); + nextchar = (int) *(loc + lkey); + + /* If this is not in the first 8 characters of a line, keep searching */ + if (icol > 7) + headnext = loc + 1; + + /* If parameter name in header is longer, keep searching */ + else if (nextchar != 61 && nextchar > 32 && nextchar < 127) + headnext = loc + 1; + + /* If preceeding characters in line are not blanks, keep searching */ + else { + line = loc - icol; + for (lc = line; lc < loc; lc++) { + if (*lc != ' ') + headnext = loc + 1; + } + + /* Return pointer to start of line if match */ + if (loc >= headnext) { + pval = line; + break; + } + } + } + + /* Return pointer to calling program */ + return (pval); + +#ifdef USE_SAOLIB + } + else { + if (get_fits_head_str(keyword,iel,ip,&nel,&np,&ier,hstring) != NULL) + return(hstring); + else + return(NULL); + } +#endif + } char* findit(char* cards, char* key) { @@ -35,7 +128,7 @@ else return ksearchh(cards, key); } -}; +} FitsImage::FitsImage(Base* p) { diff -ur saods9/saotk/frame/Makefile saods9.new/saotk/frame/Makefile --- saods9/saotk/frame/Makefile 2010-03-30 13:25:51.000000000 +0200 +++ saods9.new/saotk/frame/Makefile 2010-03-30 13:26:43.000000000 +0200 @@ -4,7 +4,7 @@ CXXFLAGS = $(CXXOPT) -w \ -I. -I.. -I../widget -I../vector -I../list -I../fitsy++ -I../util \ -I../../include -I$(X11INCLUDE) \ - -I../../$(FUNTOOLSDIR)/util \ + -I/usr/include/funtools/util -I/usr/include/blt -I/usr/include/wcs\ -I/usr/include/libxml2 \ -I../../$(ASTDIR)