~ubuntu-branches/debian/stretch/tcl-fitstcl/stretch

« back to all changes in this revision

Viewing changes to .pc/fix_compiler_warnings.patch/fitsIO.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2015-06-10 17:35:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20150610173543-37jifpt0bjuocrr0
Tags: 2.4-1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 */
26
26
 
27
27
#include "fitsTclInt.h"
28
 
#include "wcslib/wcstrig.h"
29
28
#include <limits.h>
30
29
 
31
30
/* on some systems, e.g. linux, SUNs DBL_MAX is in float.h */
81
80
{
82
81
   int i,status=0;
83
82
   int simple,extend;
84
 
   long pcount, gcount, rowlen, varidat;
85
 
   LONGLONG tbcol[FITS_COLMAX];
 
83
   long pcount, gcount, rowlen;
 
84
   LONGLONG tbcol[FITS_COLMAX], varidat;
86
85
   char tmpStr[80];
87
86
   char tmpKey[FLEN_KEYWORD];
88
87
   Tcl_HashEntry *thisEntry; 
106
105
             curFile->CHDUInfo.image.naxisn,
107
106
             &pcount, &gcount, &extend, &status);
108
107
      strcpy(curFile->extname ,"Image");
 
108
 
109
109
      break;
110
110
 
111
111
   case ASCII_TBL:
299
299
                  curFile->CHDUInfo.table.vecSize[i] = -1;
300
300
               }
301
301
            } else {
302
 
               long tmp=0;
303
 
               tmp = atol(curFile->CHDUInfo.table.colType[i]);
304
 
               if (tmp < 1) {
305
 
                  if( curFile->CHDUInfo.table.colType[i][0]=='0' )
306
 
                     curFile->CHDUInfo.table.vecSize[i] = 0;
307
 
                  else
308
 
                     curFile->CHDUInfo.table.vecSize[i] = 1;
309
 
               } else {  
310
 
                  curFile->CHDUInfo.table.vecSize[i] = tmp;
311
 
               }
 
302
               int status = 0;
 
303
               int typecode = 0;
 
304
               long repeat = 0;
 
305
               long width = 0;
 
306
 
 
307
               /* use CFITSIO to get column dimension */
 
308
               fits_get_coltype(curFile->fptr, i+1, &typecode, &repeat, &width, &status);
 
309
 
 
310
               curFile->CHDUInfo.table.vecSize[i] = 1;
 
311
               if (repeat > 1) {
 
312
                  if (typecode == TSTRING) { 
 
313
                     curFile->CHDUInfo.table.vecSize[i] = repeat / width;
 
314
                  } else {
 
315
                     curFile->CHDUInfo.table.vecSize[i] = repeat;
 
316
                  }
 
317
               }
312
318
            }
313
319
         } else {
314
320
            curFile->CHDUInfo.table.vecSize[i] = 1;
404
410
 
405
411
                  /* find the number after xPA(nnnnnnn) */
406
412
                  n = strpbrk(testChar, "0123456789");
407
 
                  len = strspn(n, "0123456789");
408
413
                  if ( n != (char *)NULL ) {
 
414
                     len = strspn(n, "0123456789");
409
415
                     memset (numChar, '\0', 1024);
410
416
                     strncpy(numChar, n, len);
411
417
                     sscanf (numChar, "%d", &(curFile->CHDUInfo.table.strSize[i]));
1021
1027
         return TCL_ERROR;
1022
1028
      }
1023
1029
 
 
1030
      curFile->CHDUInfo.table.vecDim = 
 
1031
         (long *) makeContigArray(FITS_COLMAX,1,'l');
 
1032
      if( NULL == curFile->CHDUInfo.table.vecDim) {
 
1033
         Tcl_SetResult(curFile->interp,
 
1034
                       "Error malloc'ing space for vecDim", TCL_STATIC);
 
1035
         return TCL_ERROR;
 
1036
      }
 
1037
 
1024
1038
      curFile->CHDUInfo.table.colTscale = 
1025
1039
         (double *) makeContigArray(FITS_COLMAX,1,'d');
1026
1040
      if( NULL == curFile->CHDUInfo.table.colTscale ) {
1088
1102
      }
1089
1103
      
1090
1104
      curFile->CHDUInfo.image.naxisn = 
1091
 
         (long *) makeContigArray(FITS_MAXDIMS,1,'l');
 
1105
         (long long *) makeContigArray(FITS_MAXDIMS,1,'l');
1092
1106
      if( NULL == curFile->CHDUInfo.image.naxisn ) {
1093
1107
         Tcl_SetResult(curFile->interp,
1094
1108
                       "Error malloc'ing space for naxisn", TCL_STATIC);
1157
1171
      ckfree((char *) curFile->CHDUInfo.table.colDisp);
1158
1172
      ckfree((char *) curFile->CHDUInfo.table.colNull);
1159
1173
      ckfree((char *) curFile->CHDUInfo.table.vecSize);
 
1174
      ckfree((char *) curFile->CHDUInfo.table.vecDim);
1160
1175
      ckfree((char *) curFile->CHDUInfo.table.colFormat);
1161
1176
      ckfree((char *) curFile->CHDUInfo.table.colMin);
1162
1177
      ckfree((char *) curFile->CHDUInfo.table.colMax);
1626
1641
   return TCL_OK;
1627
1642
}
1628
1643
 
1629
 
 
1630
1644
/*
1631
1645
 * imageBlockLoad
1632
1646
 *    assign a block of the image data to varName variable or return a pointer
1648
1662
   double *dblData;
1649
1663
   LONGLONG *longlongData;
1650
1664
   char *nullArray;
1651
 
   double defaultDouble = 0.0;
1652
1665
   
1653
1666
   int ptrFlag, status;
1654
 
   LONGLONG tmpIndex, i,j;
 
1667
   LONGLONG tmpIndex;
 
1668
   int i,j;
1655
1669
   char tmpStr[80];
1656
1670
   char varIndex[80];
1657
1671
   int anyNul;        
1661
1675
   int naxes, flip=0;
1662
1676
   LONGLONG xDim, yDim;
1663
1677
   char result[80];
1664
 
   char colFormat[80];
1665
1678
   Tcl_Obj *valObj;
 
1679
   long naxisn[9];
1666
1680
 
1667
1681
   naxes = curFile->CHDUInfo.image.naxes;
1668
 
   
 
1682
   for (i=0; i< curFile->CHDUInfo.image.naxes; i++) {
 
1683
       naxisn[i] = (long) curFile->CHDUInfo.image.naxisn[i];
 
1684
   }
 
1685
 
1669
1686
/*
1670
1687
   if( naxes > 3 ) {
1671
1688
      for (i = 3; i < naxes; i++) {
1685
1702
      return TCL_ERROR;
1686
1703
   }
1687
1704
 
1688
 
   xDim = curFile->CHDUInfo.image.naxisn[0];
 
1705
   xDim = naxisn[0];
1689
1706
   if( naxes>1 ) {
1690
 
      yDim = curFile->CHDUInfo.image.naxisn[1];
 
1707
      yDim = naxisn[1];
1691
1708
   } else {
1692
1709
      yDim = 1;
1693
1710
      if( (fCol>1 && fRow>1) || (nRow>1 && nCol>1) ) {
1774
1791
 
1775
1792
   status    = 0;
1776
1793
   nullArray = (char *) ckalloc(nCol*nRow*sizeof(char));
1777
 
/*
1778
 
fprintf(stdout, "case: <%d>\n", curFile->CHDUInfo.image.dataType);
1779
 
fflush(stdout);
1780
 
*/
 
1794
 
1781
1795
   switch ( curFile->CHDUInfo.image.dataType ) {
1782
1796
 
1783
1797
   case TDOUBLE:
1784
1798
      dblData = (double *) ckalloc(nCol*nRow*sizeof(double));
1785
 
      memset (dblData, NULL, nCol*nRow*sizeof(double));
 
1799
      memset (dblData, 0, nCol*nRow*sizeof(double));
1786
1800
 
1787
1801
      ffgsfd(curFile->fptr, 
1788
1802
             1,
1789
1803
             curFile->CHDUInfo.image.naxes,
1790
 
             curFile->CHDUInfo.image.naxisn,
 
1804
             naxisn,
1791
1805
             blc_l,
1792
1806
             trc_l,
1793
1807
             incrc,
1805
1819
      }      
1806
1820
      
1807
1821
      if( ptrFlag ) {
 
1822
#ifdef __WIN32__
 
1823
         sprintf(result, PTRFORMAT " %d %I64d", dblData, 4, nCol*nRow);
 
1824
#else
1808
1825
         sprintf(result, PTRFORMAT " %d %lld", dblData, 4, nCol*nRow);
 
1826
#endif
1809
1827
         Tcl_SetResult(curFile->interp,result,TCL_VOLATILE);
1810
1828
      } else {
1811
1829
         for ( i=0; i< nCol; i++ ) {
1812
1830
            for ( j=0; j< nRow; j++ ) {
1813
1831
               tmpIndex = j*nCol + i;
 
1832
#ifdef __WIN32__
 
1833
               sprintf(varIndex,"%I64d,%I64d", fCol+i-1, fRow+j-1);
 
1834
#else
1814
1835
               sprintf(varIndex,"%lld,%lld", fCol+i-1, fRow+j-1);
 
1836
#endif
1815
1837
               if ( nullArray[tmpIndex] ) {
1816
1838
                  valObj = Tcl_NewStringObj("NULL",-1);
1817
1839
               } else {
1826
1848
 
1827
1849
   case TLONGLONG:
1828
1850
      longlongData = (LONGLONG *) ckalloc(nCol*nRow*sizeof(LONGLONG));
1829
 
      memset (longlongData, NULL, nCol*nRow*sizeof(LONGLONG));
 
1851
      memset (longlongData, 0, nCol*nRow*sizeof(LONGLONG));
1830
1852
 
1831
1853
      ffgsfjj(curFile->fptr, 
1832
1854
              1,
1833
1855
              curFile->CHDUInfo.image.naxes,
1834
 
              curFile->CHDUInfo.image.naxisn,
 
1856
              naxisn,
1835
1857
              blc_l,
1836
1858
              trc_l,
1837
1859
              incrc,
1849
1871
      }      
1850
1872
      
1851
1873
      if( ptrFlag ) {
 
1874
#ifdef __WIN32__
 
1875
         sprintf(result, PTRFORMAT " %d %I64d", longlongData, 4, nCol*nRow);
 
1876
#else
1852
1877
         sprintf(result, PTRFORMAT " %d %lld", longlongData, 4, nCol*nRow);
 
1878
#endif
1853
1879
         Tcl_SetResult(curFile->interp,result,TCL_VOLATILE);
1854
1880
      } else {
1855
1881
         for ( i=0; i< nCol; i++ ) {
1856
1882
            for ( j=0; j< nRow; j++ ) {
1857
1883
               tmpIndex = j*nCol + i;
 
1884
#ifdef __WIN32__
 
1885
               sprintf(varIndex,"%I64d,%I64d", fCol+i-1, fRow+j-1);
 
1886
#else
1858
1887
               sprintf(varIndex,"%lld,%lld", fCol+i-1, fRow+j-1);
 
1888
#endif
1859
1889
               if ( nullArray[tmpIndex] ) {
1860
1890
                  valObj = Tcl_NewStringObj("NULL",-1);
1861
1891
               } else {
1875
1905
 
1876
1906
   case TFLOAT:
1877
1907
      floatData = (float *) ckalloc(nCol*nRow*sizeof(float));
1878
 
      memset (floatData, NULL, nCol*nRow*sizeof(float));
 
1908
      memset (floatData, 0, nCol*nRow*sizeof(float));
1879
1909
 
1880
1910
      ffgsfe(curFile->fptr, 
1881
1911
             1,
1882
1912
             curFile->CHDUInfo.image.naxes,
1883
 
             curFile->CHDUInfo.image.naxisn,
 
1913
             naxisn,
1884
1914
             blc_l,
1885
1915
             trc_l,
1886
1916
             incrc,
1897
1927
      } 
1898
1928
      
1899
1929
      if( ptrFlag ) {
 
1930
#ifdef __WIN32__
 
1931
         sprintf(result, PTRFORMAT " %d %I64d", floatData, 3, nCol*nRow);
 
1932
#else
1900
1933
         sprintf(result, PTRFORMAT " %d %lld", floatData, 3, nCol*nRow);
 
1934
#endif
1901
1935
         Tcl_SetResult(curFile->interp,result,TCL_VOLATILE);
1902
1936
      } else {
1903
1937
         for ( i=0; i< nCol; i++ ) {
1904
1938
            for ( j=0; j< nRow; j++ ) {
1905
1939
               tmpIndex = j*nCol + i;
 
1940
#ifdef __WIN32__
 
1941
               sprintf(varIndex,"%I64d,%I64d", fCol+i-1, fRow+j-1);
 
1942
#else
1906
1943
               sprintf(varIndex,"%lld,%lld", fCol+i-1, fRow+j-1);
 
1944
#endif
1907
1945
               if ( nullArray[tmpIndex] ) {
1908
1946
                  valObj = Tcl_NewStringObj("NULL",-1);
1909
1947
               } else {
1920
1958
   case TLONG:
1921
1959
   case TINT:
1922
1960
      intData = (int *) ckalloc(nRow*nCol*sizeof(int));
1923
 
      memset (intData, NULL, nCol*nRow*sizeof(int));
 
1961
      memset (intData, 0, nCol*nRow*sizeof(int));
1924
1962
      ffgsfk(curFile->fptr, 
1925
1963
             1,
1926
1964
             curFile->CHDUInfo.image.naxes,
1927
 
             curFile->CHDUInfo.image.naxisn,
 
1965
             naxisn,
1928
1966
             blc_l,
1929
1967
             trc_l,
1930
1968
             incrc,
1941
1979
      } 
1942
1980
 
1943
1981
      if( ptrFlag ) {
 
1982
#ifdef __WIN32__
 
1983
         sprintf(result, PTRFORMAT " %d %I64d", intData, 2, nCol*nRow);
 
1984
#else
1944
1985
         sprintf(result, PTRFORMAT " %d %lld", intData, 2, nCol*nRow);
 
1986
#endif
1945
1987
         Tcl_SetResult(curFile->interp,result,TCL_VOLATILE);
1946
1988
      } else {
1947
1989
         for ( i=0; i< nCol; i++ ) {
1948
1990
            for ( j=0; j< nRow; j++ ) {
1949
1991
               tmpIndex = j*nCol + i;
 
1992
#ifdef __WIN32__
 
1993
               sprintf(varIndex,"%I64d,%I64d", fCol+i-1, fRow+j-1);
 
1994
#else
1950
1995
               sprintf(varIndex,"%lld,%lld", fCol+i-1, fRow+j-1);
 
1996
#endif
1951
1997
               if ( nullArray[tmpIndex] ) {
1952
1998
                  valObj = Tcl_NewStringObj("NULL",-1);
1953
1999
               } else {
1963
2009
 
1964
2010
   case TSHORT:
1965
2011
      shortData = (short *) ckalloc(nCol*nRow*sizeof(short));
1966
 
      memset (shortData, NULL, nCol*nRow*sizeof(short));
 
2012
      memset (shortData, 0, nCol*nRow*sizeof(short));
1967
2013
 
1968
2014
      ffgsfi(curFile->fptr, 
1969
2015
             1,
1970
2016
             curFile->CHDUInfo.image.naxes,
1971
 
             curFile->CHDUInfo.image.naxisn,
 
2017
             naxisn,
1972
2018
             blc_l,
1973
2019
             trc_l,
1974
2020
             incrc,
1985
2031
      } 
1986
2032
      
1987
2033
      if( ptrFlag ) {
 
2034
#ifdef __WIN32__
 
2035
         sprintf(result, PTRFORMAT " %d %I64d", shortData, 1, nCol*nRow);
 
2036
#else
1988
2037
         sprintf(result, PTRFORMAT " %d %lld", shortData, 1, nCol*nRow);
 
2038
#endif
1989
2039
         Tcl_SetResult(curFile->interp,result,TCL_VOLATILE);
1990
2040
      } else {
1991
2041
         for ( i=0; i< nCol; i++ ) {
1992
2042
            for ( j=0; j< nRow; j++ ) {
1993
2043
               tmpIndex = j*nCol + i;
 
2044
#ifdef __WIN32__
 
2045
               sprintf(varIndex,"%I64d,%I64d", fCol+i-1, fRow+j-1);
 
2046
#else
1994
2047
               sprintf(varIndex,"%lld,%lld", fCol+i-1, fRow+j-1);
 
2048
#endif
1995
2049
               if ( nullArray[tmpIndex] ) {
1996
2050
                  valObj = Tcl_NewStringObj("NULL",-1);
1997
2051
               } else {
2007
2061
 
2008
2062
   case TBYTE:
2009
2063
      byteData = (unsigned char *) ckalloc(nCol*nRow*sizeof(unsigned char));
2010
 
      memset (byteData, NULL, nCol*nRow*sizeof(unsigned char));
 
2064
      memset (byteData, 0, nCol*nRow*sizeof(unsigned char));
2011
2065
 
2012
2066
      ffgsfb(curFile->fptr, 
2013
2067
             1,
2014
2068
             curFile->CHDUInfo.image.naxes,
2015
 
             curFile->CHDUInfo.image.naxisn,
 
2069
             naxisn,
2016
2070
             blc_l,
2017
2071
             trc_l,
2018
2072
             incrc,
2029
2083
      } 
2030
2084
 
2031
2085
      if( ptrFlag ) {
 
2086
#ifdef __WIN32__
 
2087
         sprintf(result, PTRFORMAT " %d %I64d", byteData, 0, nCol*nRow);
 
2088
#else
2032
2089
         sprintf(result, PTRFORMAT " %d %lld", byteData, 0, nCol*nRow);
 
2090
#endif
2033
2091
         Tcl_SetResult(curFile->interp,result,TCL_VOLATILE);
2034
2092
      } else {
2035
2093
         for ( i=0; i< nCol; i++ ) {
2036
2094
            for ( j=0; j< nRow; j++ ) {
2037
2095
               tmpIndex = j*nCol + i;
 
2096
#ifdef __WIN32__
 
2097
               sprintf(varIndex,"%I64d,%I64d", fCol+i-1, fRow+j-1);
 
2098
#else
2038
2099
               sprintf(varIndex,"%lld,%lld", fCol+i-1, fRow+j-1);
 
2100
#endif
2039
2101
               if ( nullArray[tmpIndex] ) {
2040
2102
                  valObj = Tcl_NewStringObj("NULL",-1);
2041
2103
               } else {
2537
2599
   LONGLONG       *longlongArray;
2538
2600
   double         *dblArray;
2539
2601
   float          *fltArray;
2540
 
   long           *lngArray;
2541
2602
   short          *shtArray;
2542
2603
   int            *intArray;
2543
2604
   unsigned char  *bytArray;
2550
2611
   unsigned char bytNul;
2551
2612
   char result[80];
2552
2613
   
2553
 
   long numRows, vecSize, i;
 
2614
   long numRows, vecSize;
2554
2615
   int anynul, dataType, colDataType;
2555
2616
   int status=0;
2556
2617
   
2766
2827
   LONGLONG       *longlongArray;
2767
2828
   double         *dblArray;
2768
2829
   float          *fltArray;
2769
 
   long           *lngArray;
2770
2830
   short          *shtArray;
2771
2831
   int            *intArray;
2772
2832
   unsigned char  *bytArray;
2779
2839
   unsigned char bytNul;
2780
2840
   char result[80];
2781
2841
   
2782
 
   long numRows, i;
 
2842
   long numRows;
2783
2843
   int anynul, dataType, colDataType;
2784
2844
   int status=0;
2785
2845
   
3000
3060
   int k,m;
3001
3061
   int anyf;
3002
3062
   char **cValue;
3003
 
   short  shtValue[1];
3004
 
   int    intValue[1];
3005
3063
   long   longValue[1];
3006
3064
   double dblValue[2];
3007
 
   float  fValue[1];
3008
3065
   char   xValue[1];
3009
3066
   double dblComplex[2];
3010
 
   float  fltComplex[2];
3011
3067
   char nullArray[1];
3012
3068
   char strNullVal[]="NULL";
3013
 
   unsigned char binValue[1];
3014
3069
   char lValue[1];
3015
3070
   char colFormat[80];
3016
3071
   char cplxFormat[80];
3017
3072
   char tmpStr[80];
3018
 
   char checkStr1[80];
3019
 
   char checkStr2[80];
3020
3073
   int  tmpInt;
3021
3074
   char varIndex[80];
3022
3075
   int dataType;
3025
3078
   int listFlag=0;
3026
3079
   Tcl_Obj *valObj, **colData, *valObj2[2];
3027
3080
   Tcl_Obj *cnstObj[5];
3028
 
   int naxis;
3029
 
   long naxes[3];
3030
 
   char result1[80];
3031
 
   char result2[80];
3032
3081
 
3033
3082
   LONGLONG longlongValue[1];
3034
3083
 
3125
3174
            } else {
3126
3175
               if (lValue[0] == 1) {
3127
3176
                  valObj = cnstObj[ cnstTrueObj ];
3128
 
               } else {
 
3177
               } else if (lValue[0] == 0) {
3129
3178
                  valObj = cnstObj[ cnstFalseObj ];
 
3179
               } else {
 
3180
                  valObj = cnstObj[ cnstUndefObj ];
3130
3181
               }
3131
3182
            }
3132
3183
 
3451
3502
                          "colUnit list doesn't match nCols", TCL_STATIC);
3452
3503
            return TCL_ERROR; 
3453
3504
         }
 
3505
         /* Pan Chai (02/10/2015)
 
3506
            add to check to see if input is empty.
 
3507
            if so, set cUnit to NULL
 
3508
          */
 
3509
         if (nElement <= 0) {
 
3510
            cUnit = NULL;
 
3511
         }
3454
3512
      } else {
3455
3513
         cUnit = NULL;
3456
3514
      }
3920
3978
 
3921
3979
{
3922
3980
  FILE *fPtr;
3923
 
  char outFStr[80];
3924
 
  LONGLONG k,m;
3925
 
  int anyf;
3926
 
  char **cValue;
3927
 
  short  shtValue[1];
3928
 
  int    intValue[1];
3929
 
  long   longValue[1];
3930
 
  LONGLONG longlongValue[1];
3931
 
  double dblValue[1];
3932
 
  float  fValue[1];
3933
 
  char   xValue[1];
3934
 
  double dblComplex[2];
3935
 
  float  fltComplex[2];
3936
 
  char nullArray[1];
3937
 
  char strNullVal[]="NULL";
3938
 
  unsigned char binValue[1];
3939
 
  char lValue[1];
 
3981
  LONGLONG m;
3940
3982
  char colFormat[80];
3941
 
  char cplxFormat[80];
3942
3983
  char outputStr[80];
3943
 
  int  tmpInt;
3944
 
  char varIndex[80];
3945
3984
  int dataType;
3946
 
  int status=0;
3947
 
  char errMsg[160];
3948
 
  int naxis;
3949
 
  long naxes[3];
3950
3985
  
3951
3986
  if ( ifCSV == 1) {
3952
3987
    sepString = (char *) ckalloc(4);
3976
4011
    if ( ifCSV == 1 )
3977
4012
      fprintf(fPtr, "\"");
3978
4013
    if ( ifPrintRow == 1 ) {
3979
 
      sprintf(outputStr, "%d", m);
3980
 
      fprintf(fPtr, outputStr);
3981
 
      fprintf(fPtr, sepString);
 
4014
      sprintf(outputStr, "%lld", m);
 
4015
      fprintf(fPtr,"%s", outputStr);
 
4016
      fprintf(fPtr,"%s", sepString);
3982
4017
    }
3983
4018
 
3984
4019
    saveVectorTableRowToAscii(curFile, filename, fileStatus, m, 1, fCol, nCols, baseColNum, ifCSV,
4010
4045
                               int ifFixedFormat)
4011
4046
 
4012
4047
{
4013
 
  char outFStr[80];
4014
 
  LONGLONG k,m;
 
4048
  LONGLONG k;
4015
4049
  int anyf;
4016
4050
  char **cValue;
4017
 
  short  shtValue[1];
4018
 
  int    intValue[1];
4019
4051
  long   longValue[1];
4020
4052
  LONGLONG longlongValue[1];
4021
4053
  double dblValue[1];
4022
 
  float  fValue[1];
4023
4054
  char   xValue[1];
4024
 
  double dblComplex[2];
4025
 
  float  fltComplex[2];
4026
4055
  char nullArray[1];
4027
4056
  char strNullVal[]="NULL";
4028
 
  unsigned char binValue[1];
4029
4057
  char lValue[1];
4030
 
  char cplxFormat[80];
4031
4058
  char outputStr[80];
4032
4059
  int  tmpInt;
4033
 
  char varIndex[80];
4034
4060
  int status=0;
4035
4061
  char errMsg[160];
4036
 
  int naxis;
4037
 
  long naxes[3];
4038
 
 
 
4062
 
4039
4063
  for ( k = fCol; k <= (fCol+nCols-1); k++ ) {
4040
4064
    
4041
4065
    switch ( dataType ) {
4059
4083
          strcpy(outputStr," ");
4060
4084
          status = 0;
4061
4085
          ffcmsg();
 
4086
        } else if ( anyf ) {
 
4087
          strcpy(outputStr,"NULL");
4062
4088
        } else {
4063
4089
          sprintf(outputStr, colFormat, cValue[0]);
4064
4090
        }
4082
4108
          status = 0;
4083
4109
          ffcmsg();
4084
4110
        } else if( anyf ) {
 
4111
          strcpy(outputStr,"NULL");
4085
4112
          /*    valObj = cnstObj[ cnstUndefObj ]; */
4086
4113
        } else {
4087
4114
          if (lValue[0] == 1) {
4149
4176
          ffcmsg();
4150
4177
        } else if( anyf ) {
4151
4178
          /* */
 
4179
          strcpy(outputStr,"NULL");
4152
4180
        } else {
4153
4181
          if( strchr(colFormat,'d') ) {
4154
4182
            sprintf(outputStr, "%.0f", dblValue[0]);
4178
4206
          status = 0;
4179
4207
          ffcmsg();
4180
4208
        } else if( anyf ) {
4181
 
          /* */
 
4209
          strcpy(outputStr,"NULL");
4182
4210
        } else {
4183
4211
          strcpy(outputStr,longlongValue[0]);
4184
4212
        } 
4191
4219
        return TCL_ERROR;
4192
4220
    }
4193
4221
 
4194
 
    fprintf(fPtr, outputStr);
 
4222
    fprintf(fPtr, "%s", outputStr);
4195
4223
    if ( k != (fCol+nCols-1) )
4196
 
       fprintf(fPtr, sepString);
 
4224
       fprintf(fPtr, "%s", sepString);
4197
4225
  }
4198
4226
 
4199
4227
  return TCL_OK;
4250
4278
   char lValue[1];
4251
4279
   char *outputStr;
4252
4280
   char errMsg[80];
4253
 
   long tmplong[1];
4254
4281
   int  tmpInt;
4255
4282
   int  anyf;  
4256
 
   int cnt;
4257
4283
   int status=0;
4258
4284
   /* create a minimum large enough to encompass the row string */
4259
 
   int maxWidth = 8;
4260
 
   char colFormat[80];
 
4285
   int maxWidth = 99999;
4261
4286
   int dataType;
4262
4287
   int ifVariableVec;
4263
4288
 
4282
4307
     strcpy(colFStr[k], curFile->CHDUInfo.table.colFormat[colNums[k]-1]);
4283
4308
     if( strSize[k] > maxWidth ) maxWidth = strSize[k];
4284
4309
   }
4285
 
   cValue = (char **) makeContigArray(1, maxWidth+1, 'c');
4286
4310
   outputStr = (char *) ckalloc( (maxWidth+1) * sizeof(char) );
4287
4311
   
4288
4312
   if( !strcmp(fileStatus,"0") ) {  /*  Create new file  */
4406
4430
          fprintf(fPtr, rowFormatStr, outputStr);
4407
4431
        } else {
4408
4432
          /* don't pad */
4409
 
          fprintf(fPtr, outputStr);
 
4433
          fprintf(fPtr, "%s", outputStr);
4410
4434
        }
4411
 
        fprintf(fPtr, sepString);
 
4435
        fprintf(fPtr, "%s", sepString);
4412
4436
      }
4413
4437
      for (j=0; j< nCols; j++) {
4414
4438
 
4415
 
        tmpInt = curFile->CHDUInfo.table.vecSize[ colNums[j]-1 ];
 
4439
        tmpInt = (int) curFile->CHDUInfo.table.vecSize[ colNums[j]-1 ];
4416
4440
        if ( tmpInt != 1 ) {
4417
4441
           dataType = curFile->CHDUInfo.table.colDataType[colNums[j]-1];
4418
4442
           ifVariableVec = 0;
4419
4443
           if ( ifFixedFormat == 1 ) {
4420
4444
              fprintf(fPtr,"%3s"," ");
4421
4445
           }
4422
 
           saveVectorTableRowToAscii(curFile, filename, fileStatus, m+1, 1, 1, tmpInt, colNums[j], ifCSV,
 
4446
           saveVectorTableRowToAscii(curFile, filename, fileStatus, fRow+m, 1, 1, tmpInt, colNums[j], ifCSV,
4423
4447
                                     0, sepString, ifVariableVec, colFStr[j], dataType, fPtr, ifFixedFormat);
4424
4448
           if ( ifFixedFormat == 0 ) {
4425
4449
              if ( j < nCols-1 ) {
4426
 
                 fprintf(fPtr,sepString);
 
4450
                 fprintf(fPtr,"%s",sepString);
4427
4451
              }
4428
4452
           }
4429
4453
          
4431
4455
          switch (curFile->CHDUInfo.table.colDataType[colNums[j]-1]) {
4432
4456
   
4433
4457
          case TSTRING:
 
4458
            cValue = (char **) makeContigArray(1, maxWidth+1, 'c');
4434
4459
            ffgcls(curFile->fptr,
4435
4460
                   colNums[j],
4436
4461
                   m+fRow,
4449
4474
            } else {
4450
4475
              sprintf(outputStr,colFStr[j],cValue[0]);
4451
4476
            } 
 
4477
            ckfree( (char *) cValue[0]);
 
4478
            ckfree( (char *) cValue);
4452
4479
            break;
4453
4480
   
4454
4481
         case TLOGICAL:
4706
4733
            ckfree( (char *) colFStr[0]);
4707
4734
            ckfree( (char *) outFStr);
4708
4735
            ckfree( (char *) colFStr);
4709
 
            ckfree( (char *) cValue[0]);
4710
 
            ckfree( (char *) cValue);
4711
4736
            ckfree( (char *) outputStr );
4712
4737
            fclose(fPtr);
4713
4738
            return TCL_ERROR;
4716
4741
         if ( ifFixedFormat == 0 ) {
4717
4742
           if ( j != nCols-1 )
4718
4743
             /* print sepString if we're not on last column */
4719
 
             fprintf(fPtr, sepString);
 
4744
             fprintf(fPtr, "%s", sepString);
4720
4745
         }
4721
4746
        }
4722
4747
      }
4731
4756
   ckfree( (char *) outFStr);
4732
4757
   ckfree( (char *) colFStr[0]);
4733
4758
   ckfree( (char *) colFStr);
4734
 
   ckfree( (char *) cValue[0]);
4735
 
   ckfree( (char *) cValue);
4736
4759
   ckfree( (char *) outputStr );
4737
4760
   return TCL_OK;
4738
4761
}
4770
4793
   int xDim, yDim;
4771
4794
   char result[80];
4772
4795
   int status=0;
 
4796
   long naxisn[9];
4773
4797
   
4774
4798
   naxes = curFile->CHDUInfo.image.naxes;
4775
4799
   
4790
4814
      return TCL_ERROR;
4791
4815
   }
4792
4816
 
4793
 
   xDim = curFile->CHDUInfo.image.naxisn[0];
 
4817
   for (i=0; i< curFile->CHDUInfo.image.naxes; i++) {
 
4818
       naxisn[i] = (long) curFile->CHDUInfo.image.naxisn[i];
 
4819
   }
 
4820
 
 
4821
   xDim = naxisn[0];
4794
4822
   if( naxes>1 ) {
4795
 
      yDim = curFile->CHDUInfo.image.naxisn[1];
 
4823
      yDim = naxisn[1];
4796
4824
   } else {
4797
4825
      yDim = 1;
4798
4826
      if( (fCol>1 && fRow>1) || (nRows>1 && nCols>1) ) {
4875
4903
 
4876
4904
   case TDOUBLE:
4877
4905
      dblData = (double *) ckalloc(nCols*nRows*sizeof(double));
4878
 
      memset (dblData, NULL, nCols*nRows*sizeof(double));
 
4906
      memset (dblData, 0, nCols*nRows*sizeof(double));
4879
4907
 
4880
4908
      ffgsfd(curFile->fptr, 
4881
4909
             0,
4882
4910
             curFile->CHDUInfo.image.naxes,
4883
 
             curFile->CHDUInfo.image.naxisn,
 
4911
             naxisn,
4884
4912
             blc,
4885
4913
             trc,
4886
4914
             incrc,
4905
4933
        if ( ifPrintRow == 1 ) {
4906
4934
          int rowNum = fRow + j;
4907
4935
          sprintf(outputStr, "%d", rowNum);
4908
 
          fprintf(fPtr, outputStr);
4909
 
          fprintf(fPtr, sepString);
 
4936
          fprintf(fPtr, "%s", outputStr);
 
4937
          fprintf(fPtr, "%s", sepString);
4910
4938
        }
4911
4939
        for (i=0; i<nCols ; i++ ) {
4912
4940
          tmpIndex = j*nCols + i;
4913
4941
          if ( nullArray[tmpIndex] ) {
4914
4942
            strcpy(outputStr, "NULL");
4915
4943
          } else {
4916
 
            sprintf(outputStr,"%#.10E", dblData[tmpIndex]);
 
4944
            /* sprintf(outputStr,"%#.10E", dblData[tmpIndex]); */
 
4945
            sprintf(outputStr,"%g", dblData[tmpIndex]);
4917
4946
            /* sprintf(outputStr,"%s", dblData[tmpIndex]); */
4918
4947
          }
4919
 
          fprintf(fPtr, outputStr);
 
4948
          fprintf(fPtr, "%s", outputStr);
4920
4949
          if ( i != nCols-1 )
4921
 
            fprintf(fPtr, sepString);
 
4950
            fprintf(fPtr, "%s", sepString);
4922
4951
        }
4923
4952
        if ( ifCSV == 1)
4924
4953
          fprintf(fPtr, "\"");
4929
4958
 
4930
4959
   case TLONGLONG:
4931
4960
      longlongData = (LONGLONG *) ckalloc(nCols*nRows*sizeof(LONGLONG));
4932
 
      memset (longlongData, NULL, nCols*nRows*sizeof(LONGLONG));
 
4961
      memset (longlongData, 0, nCols*nRows*sizeof(LONGLONG));
4933
4962
 
4934
4963
      ffgsfjj(curFile->fptr, 
4935
4964
             0,
4936
4965
             curFile->CHDUInfo.image.naxes,
4937
 
             curFile->CHDUInfo.image.naxisn,
 
4966
             naxisn,
4938
4967
             blc,
4939
4968
             trc,
4940
4969
             incrc,
4959
4988
        if ( ifPrintRow == 1 ) {
4960
4989
          int rowNum = fRow + j;
4961
4990
          sprintf(outputStr, "%d", rowNum);
4962
 
          fprintf(fPtr, outputStr);
4963
 
          fprintf(fPtr, sepString);
 
4991
          fprintf(fPtr, "%s", outputStr);
 
4992
          fprintf(fPtr, "%s", sepString);
4964
4993
        }
4965
4994
        for (i=0; i<nCols ; i++ ) {
4966
4995
          tmpIndex = j*nCols + i;
4973
5002
            sprintf(outputStr,"%lld", longlongData[tmpIndex]);
4974
5003
#endif
4975
5004
          }
4976
 
          fprintf(fPtr, outputStr);
 
5005
          fprintf(fPtr, "%s", outputStr);
4977
5006
          if ( i != nCols-1 )
4978
 
            fprintf(fPtr, sepString);
 
5007
            fprintf(fPtr, "%s", sepString);
4979
5008
        }
4980
5009
        if ( ifCSV == 1)
4981
5010
          fprintf(fPtr, "\"");
4986
5015
 
4987
5016
   case TFLOAT:
4988
5017
      floatData = (float *) ckalloc(nCols*nRows*sizeof(float));
4989
 
      memset (floatData, NULL, nCols*nRows*sizeof(float));
 
5018
      memset (floatData, 0, nCols*nRows*sizeof(float));
4990
5019
      ffgsfe(curFile->fptr, 
4991
5020
             0,
4992
5021
             curFile->CHDUInfo.image.naxes,
4993
 
             curFile->CHDUInfo.image.naxisn,
 
5022
             naxisn,
4994
5023
             blc,
4995
5024
             trc,
4996
5025
             incrc,
5015
5044
        if ( ifPrintRow == 1) {
5016
5045
          int rowNum = fRow + j;
5017
5046
          sprintf(outputStr, "%d", rowNum);
5018
 
          fprintf(fPtr, outputStr);
5019
 
          fprintf(fPtr, sepString);
 
5047
          fprintf(fPtr, "%s", outputStr);
 
5048
          fprintf(fPtr, "%s", sepString);
5020
5049
        }
5021
5050
        for (i=0; i<nCols ; i++ ) {
5022
5051
          tmpIndex = j*nCols + i;
5023
5052
          if ( nullArray[tmpIndex] ) {
5024
5053
            strcpy(outputStr, "NULL");
5025
5054
          } else {
5026
 
            sprintf(outputStr,"%#.5f", floatData[tmpIndex]); 
 
5055
            /* sprintf(outputStr,"%#.5f", floatData[tmpIndex]);  */
 
5056
            sprintf(outputStr,"%g", floatData[tmpIndex]);
5027
5057
          }
5028
 
          fprintf(fPtr, outputStr);
 
5058
          fprintf(fPtr, "%s", outputStr);
5029
5059
          if ( i != nCols-1 )
5030
 
            fprintf(fPtr, sepString);
 
5060
            fprintf(fPtr, "%s", sepString);
5031
5061
        }
5032
5062
        if ( ifCSV == 1)
5033
5063
          fprintf(fPtr, "\"");
5039
5069
 
5040
5070
   case TINT:
5041
5071
      intData = (int *) ckalloc(nRows*nCols*sizeof(int));
5042
 
      memset (intData, NULL, nCols*nRows*sizeof(int));
 
5072
      memset (intData, 0, nCols*nRows*sizeof(int));
5043
5073
      ffgsfk(curFile->fptr, 
5044
5074
             0,
5045
5075
             curFile->CHDUInfo.image.naxes,
5046
 
             curFile->CHDUInfo.image.naxisn,
 
5076
             naxisn,
5047
5077
             blc,
5048
5078
             trc,
5049
5079
             incrc,
5068
5098
        if ( ifPrintRow == 1) {
5069
5099
          int rowNum = fRow + j;
5070
5100
          sprintf(outputStr, "%d", rowNum);
5071
 
          fprintf(fPtr, outputStr);
5072
 
          fprintf(fPtr, sepString);
 
5101
          fprintf(fPtr, "%s", outputStr);
 
5102
          fprintf(fPtr, "%s", sepString);
5073
5103
        }
5074
5104
        for (i=0; i<nCols ; i++ ) {
5075
5105
          tmpIndex = j*nCols + i;
5078
5108
          } else {
5079
5109
            sprintf(outputStr,"%d", intData[tmpIndex]); 
5080
5110
          }
5081
 
          fprintf(fPtr, outputStr);
 
5111
          fprintf(fPtr, "%s", outputStr);
5082
5112
          if ( i != nCols-1 )
5083
 
            fprintf(fPtr, sepString);
 
5113
            fprintf(fPtr, "%s", sepString);
5084
5114
        }
5085
5115
        if ( ifCSV == 1)
5086
5116
          fprintf(fPtr, "\"");
5092
5122
 
5093
5123
   case TSHORT:
5094
5124
      shortData = (short *) ckalloc(nCols*nRows*sizeof(short));
5095
 
      memset (shortData, NULL, nCols*nRows*sizeof(short));
 
5125
      memset (shortData, 0, nCols*nRows*sizeof(short));
5096
5126
      ffgsfi(curFile->fptr, 
5097
5127
             0,
5098
5128
             curFile->CHDUInfo.image.naxes,
5099
 
             curFile->CHDUInfo.image.naxisn,
 
5129
             naxisn,
5100
5130
             blc,
5101
5131
             trc,
5102
5132
             incrc,
5121
5151
        if ( ifPrintRow == 1) {
5122
5152
          int rowNum = fRow + j;
5123
5153
          sprintf(outputStr, "%d", rowNum);
5124
 
          fprintf(fPtr, outputStr);
5125
 
          fprintf(fPtr, sepString);
 
5154
          fprintf(fPtr, "%s", outputStr);
 
5155
          fprintf(fPtr, "%s", sepString);
5126
5156
        }
5127
5157
        for (i=0; i<nCols ; i++ ) {
5128
5158
          tmpIndex = j*nCols + i;
5131
5161
          } else {
5132
5162
            sprintf(outputStr,"%d", shortData[tmpIndex]); 
5133
5163
          }
5134
 
          fprintf(fPtr, outputStr);
 
5164
          fprintf(fPtr, "%s", outputStr);
5135
5165
          if ( i != nCols-1 )
5136
 
            fprintf(fPtr, sepString);
 
5166
            fprintf(fPtr, "%s", sepString);
5137
5167
        }
5138
5168
        if ( ifCSV == 1)
5139
5169
          fprintf(fPtr, "\"");
5145
5175
 
5146
5176
   case TBYTE:
5147
5177
      byteData = (unsigned char *) ckalloc(nCols*nRows*sizeof(unsigned char));
5148
 
      memset (byteData, NULL, nCols*nRows*sizeof(unsigned char));
 
5178
      memset (byteData, 0, nCols*nRows*sizeof(unsigned char));
5149
5179
      ffgsfb(curFile->fptr, 
5150
5180
             0,
5151
5181
             curFile->CHDUInfo.image.naxes,
5152
 
             curFile->CHDUInfo.image.naxisn,
 
5182
             naxisn,
5153
5183
             blc,
5154
5184
             trc,
5155
5185
             incrc,
5174
5204
        if ( ifPrintRow == 1) {
5175
5205
          int rowNum = fRow + j;
5176
5206
          sprintf(outputStr, "%d", rowNum);
5177
 
          fprintf(fPtr, outputStr);
5178
 
          fprintf(fPtr, sepString);
 
5207
          fprintf(fPtr, "%s", outputStr);
 
5208
          fprintf(fPtr, "%s", sepString);
5179
5209
        }
5180
5210
        for (i=0; i<nCols ; i++ ) {
5181
5211
          tmpIndex = j*nCols + i;
5184
5214
          } else {
5185
5215
            sprintf(outputStr,"%u", byteData[tmpIndex]); 
5186
5216
          }
5187
 
          fprintf(fPtr, outputStr);
 
5217
          fprintf(fPtr, "%s", outputStr);
5188
5218
          if ( i != nCols-1 )
5189
 
            fprintf(fPtr, sepString);
 
5219
            fprintf(fPtr, "%s", sepString);
5190
5220
        }
5191
5221
        if ( ifCSV == 1)
5192
5222
          fprintf(fPtr, "\"");
5226
5256
   long      *lngArray;
5227
5257
   double    *dblArray;
5228
5258
   LONGLONG  *longlongArray;
5229
 
   char *tokenPtr;
5230
5259
   char *strPtr;
5231
5260
   char *nulFlag;
5232
5261
   int    iVal;
5541
5570
   float         *fltArray;
5542
5571
   double        *dblArray;
5543
5572
   LONGLONG      *longlongArray;
5544
 
   char *strPtr;
5545
5573
   char *nulFlag;
5546
5574
   char *objStr;
5547
5575
   long longVal;
5818
5846
   int i = 0;
5819
5847
 
5820
5848
   double refVal[FITS_MAXDIMS], refPix[FITS_MAXDIMS];
5821
 
   double delt[FITS_MAXDIMS], rot, tmp;
 
5849
   double delt[FITS_MAXDIMS], rot;
5822
5850
   double matrix[FITS_MAXDIMS][FITS_MAXDIMS];
5823
5851
   int row, col, axisNum[FITS_MAXDIMS];
5824
5852
   char keyword[FLEN_VALUE];
5915
5943
               if( row<2 ) {
5916
5944
                  /*  Do 2-D rotation  */
5917
5945
                  if( row==col ) {
5918
 
                     matrix[row][col] = delt[col] * cosd( rot );
 
5946
                     matrix[row][col] = delt[col] * cos( rot );
5919
5947
                  } else {
5920
 
                     matrix[row][col] = delt[col] * sind( rot );
 
5948
                     matrix[row][col] = delt[col] * sin( rot );
5921
5949
                     if( row==0 )
5922
5950
                        matrix[row][col] = - matrix[row][col];
5923
5951
                  }
5994
6022
   int endBK= 0;
5995
6023
   int i = 0;
5996
6024
   double refVal[FITS_MAXDIMS], refPix[FITS_MAXDIMS];
5997
 
   double delt[FITS_MAXDIMS], rot, tmp;
 
6025
   double delt[FITS_MAXDIMS], rot;
5998
6026
   double matrix[FITS_MAXDIMS][FITS_MAXDIMS];
5999
6027
   int row, col, axisNum[FITS_MAXDIMS];
6000
6028
   char keyword[FLEN_VALUE];
6096
6124
               if( row<2 ) {
6097
6125
                  /*  Do 2-D rotation  */
6098
6126
                  if( row==col ) {
6099
 
                     matrix[row][col] = delt[col] * cosd( rot );
 
6127
                     matrix[row][col] = delt[col] * cos( rot );
6100
6128
                  } else {
6101
 
                     matrix[row][col] = delt[col] * sind( rot );
 
6129
                     matrix[row][col] = delt[col] * sin( rot );
6102
6130
                     if( row==0 )
6103
6131
                        matrix[row][col] = - matrix[row][col];
6104
6132
                  }
6176
6204
   int endBK= 0;
6177
6205
   int i = 0;
6178
6206
   double refVal[FITS_MAXDIMS], refPix[FITS_MAXDIMS];
6179
 
   double delt[FITS_MAXDIMS], rot, tmp;
 
6207
   double delt[FITS_MAXDIMS], rot;
6180
6208
   double matrix[FITS_MAXDIMS][FITS_MAXDIMS];
6181
6209
   int row, col, axisNum[FITS_MAXDIMS];
6182
6210
   char keyword[FLEN_VALUE];
6278
6306
               if( row<2 ) {
6279
6307
                  /*  Do 2-D rotation  */
6280
6308
                  if( row==col ) {
6281
 
                     matrix[row][col] = delt[col] * cosd( rot );
 
6309
                     matrix[row][col] = delt[col] * cos( rot );
6282
6310
                  } else {
6283
 
                     matrix[row][col] = delt[col] * sind( rot );
 
6311
                     matrix[row][col] = delt[col] * sin( rot );
6284
6312
                     if( row==0 )
6285
6313
                        matrix[row][col] = - matrix[row][col];
6286
6314
                  }
6457
6485
         double pi = 3.1415926535897932;
6458
6486
 
6459
6487
         /* there are 2 ways to compute the angle: */
6460
 
         phia = atan2d( matrix[1][0], matrix[0][0]);
6461
 
         phib = atan2d(-matrix[0][1], matrix[1][1]);
 
6488
         phia = atan2( matrix[1][0], matrix[0][0]);
 
6489
         phib = atan2(-matrix[0][1], matrix[1][1]);
6462
6490
         
6463
6491
         /* ensure that phia <= phib */
6464
6492
         temp = minvalue(phia, phib);
6482
6510
         }
6483
6511
         
6484
6512
         phia = (phia + phib) * 0.5;  /* use the average of the 2 values */
6485
 
         temp = cosd(phia);
 
6513
         temp = cos(phia);
6486
6514
         if( fabs(temp)<0.1 ) {
6487
 
            temp = sind(phia);
 
6515
            temp = sin(phia);
6488
6516
            xinc = matrix[1][0] / temp;
6489
6517
            yinc =-matrix[0][1] / temp;
6490
6518
         } else {
6535
6563
   data[6] = Tcl_NewDoubleObj(rot);
6536
6564
   data[7] = Tcl_NewStringObj(ctype,-1);
6537
6565
 
6538
 
/*
6539
 
fprintf(stdout, "xrval: %20.15f, yrval: %20.15f, xrpix: %20.15f, yrpix: %20.15f, xinc: %20.15f, yinc: %20.15f, rot: %20.15f: %20.15f\n", xrval, yrval, xrpix, yrpix, xinc, yinc, rot);
6540
 
fflush(stdout); 
6541
 
*/
6542
6566
   if( userOptions.wcsSwap ) {
6543
6567
      data[8] = Tcl_NewBooleanObj( swap );
6544
6568
      Tcl_ListObjAppendElement(curFile->interp, listObj, Tcl_NewListObj(9,data) );
6665
6689
         double pi = 3.1415926535897932;
6666
6690
 
6667
6691
         /* there are 2 ways to compute the angle: */
6668
 
         phia = atan2d( matrix[1][0], matrix[0][0]);
6669
 
         phib = atan2d(-matrix[0][1], matrix[1][1]);
 
6692
         phia = atan2( matrix[1][0], matrix[0][0]);
 
6693
         phib = atan2(-matrix[0][1], matrix[1][1]);
6670
6694
         
6671
6695
         /* ensure that phia <= phib */
6672
6696
         temp = minvalue(phia, phib);
6690
6714
         }
6691
6715
         
6692
6716
         phia = (phia + phib) * 0.5;  /* use the average of the 2 values */
6693
 
         temp = cosd(phia);
 
6717
         temp = cos(phia);
6694
6718
         if( fabs(temp)<0.1 ) {
6695
 
            temp = sind(phia);
 
6719
            temp = sin(phia);
6696
6720
            xinc = matrix[1][0] / temp;
6697
6721
            yinc =-matrix[0][1] / temp;
6698
6722
         } else {
7120
7144
   uniqueNum = 0;
7121
7145
   if (isMerge == 0  ) {
7122
7146
      for (i=0; i<numRows; i++) {
7123
 
         sprintf(rowlist[i],"%d",columndata[i].rowindex);
 
7147
         sprintf(rowlist[i],"%ld",columndata[i].rowindex);
7124
7148
      }
7125
7149
      
7126
7150
   } else {
7127
7151
      for (i=0; i<numRows; i++) {
7128
7152
         if ( columndata[i].flag == 0 ) {
7129
 
         sprintf(rowlist[uniqueNum],"%d",columndata[i].rowindex);
 
7153
         sprintf(rowlist[uniqueNum],"%ld",columndata[i].rowindex);
7130
7154
         uniqueNum++;
7131
7155
         }
7132
7156
      }
7679
7703
 
7680
7704
{   
7681
7705
   int status=0;
7682
 
   int i;
7683
7706
   fffrow( curFile->fptr, expr, firstrow, nrows,
7684
7707
           n_good_rows, row_status,&status );
7685
7708