debian/ 0000775 0000000 0000000 00000000000 12031062722 007163 5 ustar debian/tcl-fitstcl.manpages 0000664 0000000 0000000 00000000021 12016477577 013146 0 ustar debian/fits.3tcl
debian/watch 0000664 0000000 0000000 00000000174 12016477577 010243 0 ustar # watch control file for uscan
version=3
http://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/fv/fitsTcl/fitsTcl(.+)\.tar\.gz
debian/rules 0000775 0000000 0000000 00000000452 12031052743 010246 0 ustar #!/usr/bin/make -f
# -*- makefile -*-
%:
dh $@ --with autoreconf
override_dh_auto_configure:
dh_auto_configure -- --with-tcl-includes=/usr/include/tcl
override_dh_auto_test:
( cd debian/tests; TCLLIBPATH=../.. tclsh all.tcl)
override_dh_installchangelogs:
dh_installchangelogs ReleaseNotes
debian/compat 0000664 0000000 0000000 00000000002 12016477577 010406 0 ustar 9
debian/clean 0000664 0000000 0000000 00000000015 12016477577 010211 0 ustar pkgIndex.tcl
debian/control 0000664 0000000 0000000 00000002046 12030322350 010563 0 ustar Source: tcl-fitstcl
Section: science
Priority: optional
Maintainer: Debian Science Maintainers
Uploaders: Ole Streicher
DM-Upload-Allowed: yes
Build-Depends: debhelper (>= 9),
dh-autoreconf,
libcfitsio3-dev,
tcl-dev,
wcslib-dev
Standards-Version: 3.9.3
Homepage: http://heasarc.gsfc.nasa.gov/docs/software/lheasoft/ftools/fv/fitsTcl_home.html
Vcs-Git: git://git.debian.org/git/debian-science/packages/tcl-fitstcl.git
Vcs-Browser: http://git.debian.org/?p=debian-science/packages/tcl-fitstcl.git
Package: tcl-fitstcl
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Tcl interface to FITS files
fitsTcl is an extension to the Tcl language, providing simple access to
astronomical data stored in FITS file format. fitsTcl implements a Tcl
interface to the cfitsio library, developed by the HEASARC (High Energy
Astrophysics Science Archive Research Center) at the NASA Goddard Space
Flight Center.
debian/tcl-fitstcl.docs 0000664 0000000 0000000 00000000015 12016477577 012306 0 ustar fitsTcl.html
debian/fits.3tcl 0000664 0000000 0000000 00000052474 12016477577 010760 0 ustar .\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Created for Debian using the original file "sig.announce.1.4"
.TH fits "3tcl" "2.3 Tcl" "Tcl interface to FITS Files"
.SH NAME
fits \- Tcl interface to FITS Files
.SH SYNOPSIS
\fBfits\fI (open|info|close)
.SH "Handling FitsFile objects"
.SS fits open fileName mode ?objName?
Create a FitsFile object, open the file and read the header of the current
HDU. (Read the CFITSIO web pages or documentation to learn about its "Extended
File Name Syntax".) mode can be 0 (read only) or 1 (read and write). If no
objName is given, a name will be automatically assigned. A new empty FITS file
can be created by setting mode to 2. In this case, if the named file exists,
then it will be overwritten. Returns objName which will be used in most of the
methods as the handle to the object.
.SS fits info ?objName ...?
Return a list of all the existing objects, or the named objects (supports
regular expressions), with the following information:
{objName fileName mode CHDU hduType}
where CHDU is the current HDU (1-primary array, 2-the first extension ...) and
hduType is the type of the HDU (0-image, 1-ASCII table, 2-Binary table).
.SS objName move ?+/-?n
If n has ``+/-'' sign, then move n units relative to the CHDU, otherwise move
to the nth HDU. Return the extension type of the new HDU: 0-image, 1-ASCII
table, 2-Binary Table.
.SS objName close
Delete object objName.
.SS fits close
Delete all the existing objects.
.SH "Getting information about the CHDU"
.SS objName info chdu
Return the CHDU. 1=primary, 2=first extension, etc.
.SS objName info filesize
Return the size of the file (in units of 2880 bytes).
.SS objName info hdutype
Return ``Primary array'', ``Image extension'', ``Binary Table'', or ``ASCII
Table''.
.SS objName info imgdim
Return the dimensions of the image if the CHDU is an image extension.
.SS objName info ncols
Return the number of columns in the table if the CHDU is a table extension.
.SS objName info nrows
Return the number of rows in the table if the CHDU is a table extension.
.SS objName info nkwds
Return the number of keywords in the header of the CHDU.
.SS objName info column ?\-exact? ?colList?
Without any arguments, return a list of all the column names in the table if
the CHDU is a table extension. If colList is present, detailed information
about the listed columns, using regular expression name comparisons, is
returned in the form of:
{Name Type Unit DisplayFormat DefaultFormat ColumnWidth isOffset isScaled defaultNull}
where
Name name of the column (TTYPE keyword)
Type type of the column (TFORM keyword)
Unit unit of the column (TUNIT keyword)
DisplayFormat format for display (TDISP keyword)
DefaultFormat default format for display (if TDISP keyword is absent)
ColumnWidth the width of the column (in units of characters).
isOffset 0 = no offset (no TZERO keyword), 1 = offset.
isScaled 0 = not scaled (no TSCALE keyword), 1 = scaled.
defaultNull default NULL value (TNULL keyword)
The \-exact option turns off the regular expression matching.
.SH "Reading data from a FITS file"
.SS objName dump ?\-s/\-e/\-l?
Return all the keyword records in the current header. The following options
control how the information is formatted:
none return list of all ards in header
\-s return three lists: {keywords} {values} {comments}
\-e return a single string containing a newline-separated list of all header records
\-l return all the keyword names
.SS objName get keyword ?keyList?
Return a list of {keyword value comment} for all the keywords in keyList
(supports regular expressions). If no keyList is given, return a list of
entries for all the keywords in the CHDU. The order in which keywords are
listed is undefined. (HISTORY and COMMENT keywords are never returned.)
.SS objName get keyword \-num n
Return a list of {keyword value comment} of the nth keyword.
.SS objName get wcs ?RAcol DecCol?
Return a list of the WCS parameters -- {xrval yrval xrpix yrpix xinc yinc rot
ctype} -- for the CHDU. If the current HDU is a table, supply the RAcol and
DecCol parameters specifying the two columns (as names or column numbers)
containing WCS data. Use defaults for any missing WCS keywords: 1.0 for
xinc/yinc; ``none'' for ctype; and 0.0 or all others. If the RA/Dec identity
of the columns (or image axes) are not known, an extra WCS parameter --
wcsSwap -- can be obtained which, when on, indicates that the X parameters are
for Dec instead of RA. Turn this option on with fits option wcsSwap 1.
.SS objName get wcs \-m ?Col1 ...?
Similar to above, but information is returned in new-style format, allowing
arbitrary matrix transforms. Return value is {refVals refPix matrix types
projections} where each item (except matrix) contains a list of the given
information for each image dimension or table column; matrix is the rotation,
scale, skew, NxN transformation matrix given as {cd11 .. cd1N
cd21 .. cd2N .. cdNN}. The wcsSwap option has no effect on this command; one
must check the types values to see if the RA and Dec transforms are backwards.
.SS objName get image ?firstElem? ?numElem?
Read data elements from the current IMAGE extension and return them in a
list. Without any parameters, the entire image will be returned. If only
firstElem is given, return just one element.
.SS objName get table ?\-c? ?\-noformat? ?colList? ?rows?
Read a block of a table and return list(s) of data. The block range is set in
colList a list of all the columns one wants to read. Read all columns if missing or is ``*''.
rows a comma-separated list of row ranges of the form start-end (eg, ``3-5,7,9-'')
\-c return data from each column as a separate list
\-noformat do not format results according to a TDISPn, or default, format
.SS objName get vtable ?\-noformat? colName n ?rows?
Return a list of data in the nth vector element in column colName of the given rows. The \-noformat option turns off any TDISPn formatting.
.SH "Loading data into memory or to a TCL array"
When loading data into memory, fitsTcl will normally return address dataType numElements where these are:
address Memory address of the data. Can be recovered in C by
sscanf(address, "%p", &databuff);
with void *databuff
dataType
0 - BYTE_DATA 1 byte data
1 - SHORTINT_DATA 2 byte integer
2 - INT_DATA 4 byte integer
3 - FLOAT_DATA 4 byte floating point
4 - DOUBLE_DATA 8 byte floating point
numElement Number of data elements in the array
.SS objName load image ?slice? ?rotate?
Load a full 2D image in the CHDU into memory and return the address address
(see above). slice indicates which frame to use if image is 3D. rotate
indicates how many 90-degree counter-clockwise rotations to perform on the
image (0-3).
.SS objName load iblock arrayName firstRow numRows firstCol numCols ?slice?
Load a block (start from firstCol, firstRow with size numCols x numRows) of
image data to a 2-D TCL array arrayName or to memory if arrayName is
``--''. The indices of the array variable are
(firstCol-1 ... firstCol+numCols-1, firstRow-1 ... firstRow+numRows-1). A 1D
image will be treated as either a single row or column, depending on the
row/column parameters supplied. For a 3D image, slice indicates which frame to
use. If arrayName is ``--'', read the data block into memory and return the
pointer information: address dataType numElements.
.SS objName load irows firstRow lastRow ?slice?
.SS objName load icols firstCol lastCol ?slice?
Read and average together a range of rows or columns of an image. Returns
address dataType numElements. dataType will be 3 for all image data types
except for double for which dataType is 4.
.SS objName load column colName ?defaultNull? ?firstElement?
Load a column of a table into memory and return address dataType
numElements. Use the value of defaultNull for NULL values, or internal
defaults (normally the data type's maximum value) if ``NULL'' or absent. If
colName is a vector column, read the firstElement-th element. One can only
load numerical columns.
.SS objName load vtable colName
Load all elements of the vector column colName and return address dataType
numElements.
.SS objName load tblock ?\-noformat? arrayName colList firstRow numRows colIndex ?firstElem?
Load a block of table data to a 2-D TCL array arrayName. colIndex is (almost)
the column index of the array to use for the first column read. The first data
index is actually (as for images) (colIndex-1,firstRow-1). For scaler columns,
firstElem = 1. Without the \-noformat flag, values will be returned as strings
formatted according to a TDISP keyword or default format based on data type.
.SS objName load expr ?\-rows rows? expression ?defaultNull?
Evaluate the arithmetic expression on each row (or a subset of rows given by
rows) of the CHDU's table and return address dataType numElements, using
defaultNull as the null value of any NULL results.
.SS objName load keyword
Load keywords into fitsTcl's internal hash table. One usually will not need to
call this routine.
.SS objName load chdu
Reload the information about the current HDU. One usually will not need to
call this routine.
.SH "Writing to a FITS file"
.SS objName insert image bitpix naxis naxesList
.SS objName insert image \-p ?bitpix naxis naxesList?
Insert an empty image HDU (primary header with \-p) after the current HDU (or,
at start of file for primary array). The image parameters -- bitpix naxis
naxesList -- can be left off if creating a zero-length primary array.
.SS objName insert table numRows {colNames} {colFormats} ?{colUnits} extensionName?
.SS objName insert table \-ascii numRows {colNames} {colFormats} ?{colUnits} {colPosition} extensionName rowWidth?
Insert an empty BINARY (default) or ASCII (with \-ascii flag) table HDU after
the current HDU. The colNames and colFormats lists must be of equal length
(possibly both empty). The optional parameters can each be empty if one wants
to use default/empty values.
.SS objName insert keyword index record ?formatFlag?
Insert a new record at the index-th keyword. If formatFlag is 0, write the
record exactly as passed, otherwise parse it as a free form keyname value
comment and reformat it into a standardized KEYNAME = VALUE / COMMENT
(default).
.SS objName put keyword ?\-num index? record ?formatFlag?
Write a keyword record either at position index; the position of a
pre-existing keyword with the same name; or append it if no such keyword
exists. See above for format/meaning of record and formatFlag.
.SS objName put history historyStr
Write a HISTORY keyword with content historyStr
.SS objName insert column index colName colFormat
Insert an empty column with format colFormat before the index-th
column. colFormat specifies the column format as, for example:
ASCII Table: A15, I10, E12.5, D20.10, F14.6 ...
BINARY Table: 15A, 1I, 1J, 1E, 1D, 1L, 1X, 1B, 1C, 1M
.SS objName add column colName colFormat ?expression?
Without an expression, append an empty column to the CHDU table; return
nothing. Given an arithmetic expression, though, the indicated column
(new or old) will be filled in with the results of the expression
evaluated for each row of the table. If colName does not exist in the
current table extension, a new one will be created with format
colFormat (see above). If colFormat is ``default'', the column will be
created based on the data type of the result. Return 1 or 0 to
indicate whether a new column was created (1) or not (0). expression
can be in either C or Fortran format with table columns and keywords
referenced by their names. Here are some expression samples:
Expression Result
17.2 17.2 for every row
17 + 4*(PHI > 32) 17 or 21, depending on whether that row of the PHI column is greater than 32
sqrt( (X\-X0)^2 + (Y\-Y0)^2 ) Distance of the (X,Y) column coordinates from the (X0,Y0) keyword values
See the CFITSIO web pages and documentation for more details.
.SS objName insert row index numRows
Insert number of numRows rows after the index-th row.
.SS objName add row numRows
Add numRows rows at the end of the CHDU table.
.SS objName put image firstElem listOfData
Write a block of data to the CHDU image. The first pixel of an image has
firstElem = 1, not zero.
.SS objName put table colName firstElem rowSpan listOfData
Write a list of data to the firstElem-th element of column colName in the CHDU
table. (For scalar columns firstElem is 1.) rowSpan is a single row range of
form start-end with ``\-'' indicating all rows.
.SH "Deleting data from a FITS file"
.SS objName delete keyword keyList
Delete listed keywords, where the keyList can be the mix of keyword names and
index numbers. Keywords are deleted individually in sequence, causing keyword
positions to change after each deletion, so be careful when deleting multiple
keywords by index.
.SS objName delete cols colList
Delete listed columns in a table extension.
.SS objName delete rows firstRow numRows
Delete a block of rows.
.SS objName delete rows \-expr expression
Delete rows using expression which must evaluate to a boolean value. Rows for
which expression evaluates to TRUE get deleted.
.SS objName delete chdu
Delete the current HDU. The HDU immediately following the one deleted (or the
preceding one if the current HDU is the last one of the file) will become the
new current HDU. Returns extension type of new HDU: 0-image, 1-ASCII table,
2-Binary Table.
.SH "Analyzing FITS data"
.SS objName sort ?\-merge? colList ?ascendFlags?
Sort table rows using columns in colList. When \-merge is present, if multiple
rows have identical sort keys all but one of the rows will be deleted. If
present, ascendFlags contains a list of 1s and 0s indicating whether that
column will be sorted in ascending (1, the default) or descending (0) order.
.SS objName column \-stat colName ?firstElem? ?rows?
Return statistics on the firstElem-th element (1 for scalar columns) of column
colName in the order min firstMinRow max firstMaxRow mean stdDev numData.
.SS objName column \-minmax colName ?firstElem? ?rows?
Returns minimum and maximum values of the firstElem-th element (1 for scalar
columns) of column colName.
.SS objName histogram ?\-weight colName|value? ?\-inverse? ?\-rows rows? filename {binAxis1} ?{binAxis2} ...?
Create a 1D - 4D histogram from columns in the current table. The binning
parameters are given by the binAxisN parameters which are lists of the form
colName min max binSize where the last 3 elements can each be ``\-'',
indicating default values. If TLMINn, TLMAXn, and/or TDBINn exist, those
values will be used for defaults. Otherwise, for min and max the defaults are
the actual min/max values of the data; for binSize the smaller of one-tenth
the data span or 1.0 will be selected. A weighting value can be indicated with
the \-weight option. This can be either another column or a numerical
constant. The \-inverse option indicates the weight should be 1.0/weight
instead of the weighting value itself. The histogram can be restricted to
certain row ranges using the \-rows option.
.SS objName smooth {width height} outfile ?inPrimary?
Smooth the current image extension with a boxcar function of dimensions width
by height pixels. The dimensions must be odd integers. The resulting image
will be placed in a new extension appended to the file outfile. If outfile
does not exist, the image will be placed either in the primary or in the first
extension, depending on the value of the inPrimary flag; the default is to
place it in an extension.
.SH "List/Pointer Manipulation"
.SS lst2ptr dataList ?dataType? ?naxesList?
Convert a TCL list into a memory-resident array. Returns address dataType
naxesList (see the load commands above). The TCL list will be cast as double
values in the absence of the dataType parameter. The parameter naxesList gives
the vector dimensions of the list. It can be a single number indicating the
length of the list (the default value when absent) or a list of numbers which
must multiply together to be the list length. If a list entry contains the
string "NULL", the maximum value of the given dataType will be inserted.
.SS ptr2lst address dataType naxesList
Convert a memory pointer into a TCL list. Returns dataList dataType naxesList
(see lst2ptr). If an array element contains the maximum value for the given
dataType, the string "NULL" will be inserted into the list.
.SS vexpr ?\-ptr? ?\-use getDataCallback? expression
Perform a vector calculation using lists or arrays where expression is a
C-style arithmetic expression. (Ie, do not use $var notation unless you
explicitly want variable substitution before passing expression to vexpr.)
Without any of the options, variable references within expression will be
interpretted as local TCL lists (or scalars) containing double data and the
result will itself be a simple TCL list. With the \-ptr option set, the answer
instead will be returned as a pointer to a memory-resident array. With either
option set, two additional parameters will be returned in a list of the form
dataList dataType naxesList or address dataType naxesList. The \-use option
provides a "callback" routine which is to be used for supplying the variable
data. It gets called when a variable is encountered in the expression and will
be passed a single argument containing the name of the variable. The callback
routine should return either "dataList dataType naxesList" or "\-ptr address
dataType naxesList". If the callback routine doesn't recognize the variable,
it should return an empty string. The parser will then try to find the
variable in the local namespace, as when no callback is supplied. If this
fallback behavior is not desired, raise an error instead. The callback
function can itself check for local variables using the TCL command upvar 1
$varName localName. The following code snippet provides a sample callback
function which assumes the expression contains variables storing the results
of a load or lst2ptr command (ie, address dataType naxesList):
proc getPtrData { varName } { upvar $varName myName if [info exists myName] { return [eval list \-ptr $myName] } else { error "Variable doesn't exist" } }
then the following code would calculate the average value of a table column:
set myCol [objName load column X] vexpr \-use getPtrData "sum( (double)myCol ) / nelem( myCol )"
By default, a vector with a single-valued naxesList is interpretted as a
single vector containing n elements such that the above "sum" function sums
all of the elements. In the context of loading a column, though, one actually
has an array of n rows with each row containing 1 (or perhaps more)
elements. To handle this case, one must use the callback function to provide
an naxisList of "1 n" (or "2 m", etc) instead of merely "n". In that case each
row will be calculated separately and have its own result. When naxesList has
multiple elements, the final element specifies the number of rows.
See the CFITSIO web pages and documentation for details on expression
syntax. One can also read the fv online help file on expression syntax, noting
that vexpr can only handle numerical input and output.
.SS fits free addressList
Free the memory occupied by the data generated by one of the load, lst2ptr,
and vexpr commands.
.SH "Other commands"
.SS objName copy filename
Copy the CHDU to a new FITS file. If the CHDU is not an image array, then an
empty primary array is inserted.
.SS objName sascii table filename fileMode firstRow numRows colList widthList
Write the listed columns into an ASCII file. In the output file, each column
has the width listed in widthList. fileMode indicates how to write the data to
filename: 0-create new file and write column headings; 1-append to old file
and write column headings; 2-append to old file, but don't write any headings.
.SS objName sascii image filename fileMode firstRow numRows firstCol numCols cellSize ?slice?
Write a block of the image data to an ASCII file. In the output file, the data
has width of cellSize. Use frame slice for 3D image data.
.SS objName flush ?clear?
Flush any dirty buffers to the disk. With clear, free the buffers, too.
.SS objName append filename
Append current HDU to another FITS file.
.SS objName checksum update|verify
Update or Verify the checksum keywords in the current HDU. If none exist,
update will create them. For verify, the return values are 1 for valid values,
0 if either keyword (CHECKSUM or DATASUM) is missing, and \-1 for invalid
values.
.SS objName info expr expression
Get information on the result of the supplied arithmetic expression. Return
value is cDataType numElements {naxesList} where cDataType is the CFITSIO
datatype (not fitsTcl's): TDOUBLE, TSTRING, etc; numElements is the number of
elements in the result; and naxesList contains the vector dimensions of the
result ({1} for scalar result). An expression which evaluates to a constant
(no dependency on the contents of the table) will be indicated by a negative
number of elements.
.SS range count rangeStr maxElem
Count the number of elements (esp. rows) contained within the comma-separated
list of ranges in rangeStr (eg, 1-4,5,7-). To support ranges of the form "7-"
which specifies a range from element 7 through the final element, maxElem is
passed with the maximum element number.
.SS fits option ?option? ?value?
Modify fitsTcl's default behavior. With no options, this returns a list of all
the current fitsTcl options and their values. With the option parameter,
return the value of that parameter. When both option and value are supplied,
set the parameter to the given value. Current options: wcsSwap (0).
.SS fits version
Get version numbers for fitsTcl and underlying cfitsio.
.SH AUTHOR
Bryan Irby
debian/tests/ 0000775 0000000 0000000 00000000000 12031052777 010336 5 ustar debian/tests/other.test 0000664 0000000 0000000 00000001135 12016477577 012374 0 ustar #!/usr/bin/tclsh
# This file is a -*- tcl -*- file
#
package require tcltest 2.0
namespace import ::tcltest::*
package require fitsTcl
test other-option {
Return a list of all the current fitsTcl options and their values.
} {
fits option
} "{wcsSwap 0}"
test other-version {
Get version numbers for fitsTcl and underlying cfitsio.
} {
set version [fits version]
return [string range $version 0 2]
} 2.3
test other-range-count {
Count the number of elements contained within the comma-separated list of
ranges in rangeStr
} {
range count 1-4,7- 11
} 9
cleanupTests
debian/tests/all.tcl 0000664 0000000 0000000 00000000577 12016477577 011637 0 ustar #!/usr/bin/tclsh
# This file is a -*- tcl -*- file
package require tcltest
tcltest::verbose {pass body error}
proc tcltest::cleanupTestsHook {} {
variable numTests
upvar 2 testFileFailures crashed
set ::code [expr {$numTests(Failed) > 0}]
if {[info exists crashed]} {
set ::code [expr {$::code || [llength $crashed]}]
}
}
tcltest::runAllTests
exit $code
debian/tests/image.test 0000664 0000000 0000000 00000003357 12016477577 012345 0 ustar #!/usr/bin/tclsh
# This file is a -*- tcl -*- file
package require tcltest 2.0
namespace import ::tcltest::*
package require fitsTcl
# Set up an empty image with 3x4 pixel size, save it and re-open the
# image extension.
set img [fits open image.fits 2]
$img insert image -p
$img insert image 8 2 {4 3}
$img close
set img [fits open image.fits\[1\] 0]
test fits-info {
Return a list of all the existing objects, or the named objects
} {
fits info $img
} "{fitsObj1 {image.fits\[1\]} 0 2 0}"
test info-chdu {
Return the CHDU. 1=primary, 2=first extension, etc
} {
return [$img info chdu]
} 2
test info-filesize {
Return the size of the file (in units of 2880 bytes)
} {
return [$img info filesize]
} 3
test info-hdutype {
Return "Primary array", "Image extension", "Binary Table", or "ASCII Table"
} {
return [$img info hdutype]
} "Image extension"
test info-imgdim {
Return the dimensions of the image
} {
return [$img info imgdim]
} {4 3}
test info-nkwds {
Return the number of keywords in the header of the CHDU
} {
return [$img info nkwds]
} 8
test dump {
Return the CHDU. 1=primary, 2=first extension, etc
} {
return [$img dump -l]
} {XTENSION BITPIX NAXIS NAXIS1 NAXIS2 PCOUNT GCOUNT}
test get-header2str {
get header and construct it into a string
} {
return [ string length [$img get header2str]]
} 644
test get-keyword {
Return a list of {keyword value comment} for all the keywords in keyList
} {
return [$img get keyword XTENSION]
} {{XTENSION {'IMAGE '} {IMAGE extension}}}
test get-image {
Read data elements from the current IMAGE extension and return them in
a list
} {
return [$img get image 1 3]
} {0 0 0}
fits close
file delete image.fits
cleanupTests
debian/tests/table.test 0000664 0000000 0000000 00000003405 12016477577 012344 0 ustar #!/usr/bin/tclsh
# This file is a -*- tcl -*- file
package require tcltest 2.0
namespace import ::tcltest::*
package require fitsTcl
# Set up a table
set tbl [fits open table.fits 2]
$tbl insert table 3 {target V_mag} {20A E12.5}
$tbl put table target 1 - { NGC1001 NGC1002 NGC1003 }
$tbl put table V_mag 1 - { 11.1 12.3 15.2 }
$tbl close
set tbl [fits open table.fits\[1\] 0]
test fits-info {
Return a list of all the existing objects, or the named objects
} {
fits info $tbl
} "{fitsObj1 {table.fits\[1\]} 0 2 2}"
test info-chdu {
Return the CHDU. 1=primary, 2=first extension, etc
} {
return [$tbl info chdu]
} 2
test info-filesize {
Return the size of the file (in units of 2880 bytes)
} {
return [$tbl info filesize]
} 3
test info-hdutype-tbl {
Return "Primary array", "Image extension", "Binary Table", or "ASCII Table"
} {
return [$tbl info hdutype]
} "Binary Table"
test info-ncols {
Return the number of columns in the table
} {
return [$tbl info ncols]
} 2
test info-nrows {
Return the number of rows in the table
} {
return [$tbl info nrows]
} 3
test info-nkwds {
Return the number of keywords in the header of the CHDU
} {
return [$tbl info nkwds]
} 13
test dump {
Return the CHDU. 1=primary, 2=first extension, etc
} {
return [$tbl dump -l]
} {XTENSION BITPIX NAXIS NAXIS1 NAXIS2 PCOUNT GCOUNT TFIELDS TTYPE1 TFORM1 TTYPE2 TFORM2}
test get-keyword {
Return a list of {keyword value comment} for all the keywords in keyList
} {
return [$tbl get keyword XTENSION]
} {{XTENSION 'BINTABLE' {binary table extension}}}
test get-table {
Read a block of a table and return list(s) of data
} {
return [$tbl get table * 1]
} {{NGC1001 1.110000E+01}}
fits close
file delete table.fits
cleanupTests
debian/tcl-fitstcl.doc-base 0000664 0000000 0000000 00000001411 12016477577 013034 0 ustar Document: fitstcl
Title: fitsTcl User's Guide
Author: Bryan Irby
Abstract: fitsTcl is an extension to the Tcl language, providing simple access
to astronomical data stored in FITS file format. fitsTcl implements a Tcl
interface to the CFITSIO library, developed by the HEASARC (High Energy
Astrophysics Science Archive Research Center) at the NASA Goddard Space
Flight Center. fitsTcl is primarily distributed as part of the fv FITS file
editor. It is also available by itself below. The latest version is 2.3,
released July, 2009. This is identical to the version in the most recent
release of fv (version 5.3, released July, 2009).
Section: Science/Astronomy
Format: HTML
Index: /usr/share/doc/tcl-fitstcl/fitsTcl.html
Files: /usr/share/doc/tcl-fitstcl/fitsTcl.html
debian/source/ 0000775 0000000 0000000 00000000000 12016477577 010510 5 ustar debian/source/format 0000664 0000000 0000000 00000000014 12016477577 011716 0 ustar 3.0 (quilt)
debian/patches/ 0000775 0000000 0000000 00000000000 12031011632 010604 5 ustar debian/patches/nonlinux.patch 0000664 0000000 0000000 00000001441 12030324526 013507 0 ustar Author: Ole Streicher
Description: Extend the known operating systems by Gnu HURD and kfreeBSD.
--- a/configure.in
+++ b/configure.in
@@ -97,7 +97,7 @@
AC_MSG_ERROR(HEAsoft: Unable to guess system type. Please set it using --with-bindir option)
fi
changequote(,)
- BINDIR=`$UNAME -s 2> /dev/null`_`$UNAME -r 2> /dev/null | sed 's:[^0-9]*\([0-9][0-9]*\.[0-9]*\).*:\1:'`
+ BINDIR=`$UNAME -s 2> /dev/null | sed 's:.*/::'`_`$UNAME -r 2> /dev/null | sed 's:[^0-9]*\([0-9][0-9]*\.[0-9]*\).*:\1:'`
changequote([,])
lhea_machine=`$UNAME -m 2> /dev/null`
BIN_EXT=
@@ -117,7 +117,7 @@
EXT=hpu
lhea_machine=`$UNAME -m 2> /dev/null | tr '/' ' ' | awk '{ print $2 }'`
;;
- Linux*)
+ Linux*|kFreeBSD*|GNU*)
EXT=lnx
;;
OSF1*)
debian/patches/fix_spelling.patch 0000664 0000000 0000000 00000001665 12016477577 014353 0 ustar Author: Ole Streicher
Description: Spellfixes
--- a/fitsCmds.c
+++ b/fitsCmds.c
@@ -212,7 +212,7 @@
mSilent = 1;
} else {
Tcl_SetResult(curFile->interp, "fitsTcl Error: "
- "unkown option: -s for load without read header", TCL_STATIC);
+ "unknown option: -s for load without read header", TCL_STATIC);
return TCL_ERROR;
}
}
@@ -708,7 +708,7 @@
" - if no rowList is provided, give all rows\n"
" - if no colList is provided, give all columns\n"
" - use colList = * for all columns\n"
- " - -c means return each column as a seperate list.\n"
+ " - -c means return each column as a separate list.\n"
"get vtable ?-noformat? colname firstelement ?rowList?\n"
" - get the firstelement-th vector element\n"
"\n";
debian/patches/series 0000664 0000000 0000000 00000000224 12030322424 012022 0 ustar fix_fitsCmds.patch
use_shared_cfitsio.patch
cfitsio_header.patch
set_installdir.patch
fix_compiler_warnings.patch
fix_spelling.patch
nonlinux.patch
debian/patches/use_shared_cfitsio.patch 0000664 0000000 0000000 00000006055 12016477577 015530 0 ustar Author: Ole Streicher
Description: Remove the need of a private cfitsio source copy
However, this patch still needs the files eval_defs.h and
eval_tab.h copied from the cfitsion source.
--- a/Makefile.in
+++ b/Makefile.in
@@ -12,12 +12,12 @@
OBJECTS = ${CFILES:.c=.o}
LOCAL_OBJ = ${OBJECTS} ${SHARED_CFILE:.c=.o}
-SHARED_OBJ = ${LOCAL_OBJ} ${CFITSIO_DIR}/*.o
+SHARED_OBJ = ${LOCAL_OBJ}
STATIC_LIB = lib${LIBRARY}.a
SHARED_LIB = lib${LIBRARY}${SHLIB_SUFFIX}
-IFLAGS = -I${CFITSIO_DIR} -I${TCL_INC_PATH}
+IFLAGS = -I${TCL_INC_PATH}
#----------------------------------------------------------------------------
# Configurable macros:
@@ -35,7 +35,6 @@
TCL_INC_PATH = @TCL_INC_PATH@
TCL_LIB_PATH = @TCL_PATH@
TCL_LIB = @TCL_LIB@
-CFITSIO_DIR = @CFITSIODIR@
SHLIB_LD_LIBS = @LIBS@ @SHLIB_LD_LIBS@
#----------------------------------------------------------------------------
@@ -52,34 +51,17 @@
ar cr ${STATIC_LIB} ${OBJECTS}
${RANLIB} ${STATIC_LIB}
-${SHARED_LIB}: build-cfitsio ${LOCAL_OBJ}
+${SHARED_LIB}: ${LOCAL_OBJ}
@if [ "x${TCL_LIB_PATH}" = x -o "x${TCL_LIB}" = x ]; then \
echo "${SHLIB_LD} ${LD_FLAGS} ${SHARED_OBJ} ${SHLIB_LD_LIBS} -o ${SHARED_LIB}"; \
${SHLIB_LD} ${LD_FLAGS} ${SHARED_OBJ} ${SHLIB_LD_LIBS} \
- -o ${SHARED_LIB}; \
+ -ltcl -lwcs -lcfitsio -o ${SHARED_LIB}; \
else \
echo "${SHLIB_LD} ${LD_FLAGS} ${SHARED_OBJ} ${SHLIB_LD_LIBS} -L${TCL_LIB_PATH} -l${TCL_LIB} -o ${SHARED_LIB}"; \
${SHLIB_LD} ${LD_FLAGS} ${SHARED_OBJ} ${SHLIB_LD_LIBS} \
-L${TCL_LIB_PATH} -l${TCL_LIB} -o ${SHARED_LIB}; \
fi
-build-cfitsio:
- @if [ "x${CFITSIO_DIR}" != x ]; then \
- if [ -d "${CFITSIO_DIR}" ]; then \
- if [ ! -f ${CFITSIO_DIR}/f77_wrap4.o ]; then \
- echo "Configuring and building in ${CFITSIO_DIR}"; \
- cd ${CFITSIO_DIR}; ./configure; \
- ${MAKE} stand_alone "CC=${CC}" "CFLAGS=${CFLAGS}" \
- "FITSIO_OBJ=" "FITSIO_SRC="; \
- fi; \
- else \
- echo "CFITSIO_DIR='${CFITSIO_DIR}' does not exist!"; \
- exit 1; \
- fi; \
- else \
- echo "CFITSIO_DIR was not set!"; \
- exit 1; \
- fi
install: all
@if [ "x${C_LIB_OPTION}" = xstatic ]; then \
--- a/configure.in
+++ b/configure.in
@@ -56,26 +56,8 @@
[ --with-itcl Path to itcl source ],
ITCL_PATH=$withval
)
-AC_ARG_WITH(
- cfitsio,
- [ --with-cfitsio Path to cfitsio source ],
- CFITSIO=$withval
-)
# Make sure we have cfitsio before proceeding:
#-------------------------------------------
-AC_MSG_CHECKING([for cfitsio source directory])
-CFITSIODIR=
-for dir in $CFITSIO ./cfitsio ; do
- if test -r $dir/eval_defs.h; then
- CFITSIODIR=$dir
- AC_MSG_RESULT($dir)
- break
- fi
-done
-if test -z "$CFITSIODIR"; then
- AC_MSG_RESULT([no])
- AC_MSG_ERROR(Can't find cfitsio. Use --with-cfitsio to specify the location of the cfitsio source code.)
-fi
#-------------------------------------------
AC_ARG_ENABLE(
shared,
@@ -95,7 +77,6 @@
changequote([,])
AC_SUBST(TCL_LIB)
AC_SUBST(TK_LIB)
-AC_SUBST(CFITSIODIR)
if test $lhea_shared = yes; then
C_LIB_OPTION=shared
debian/patches/set_installdir.patch 0000664 0000000 0000000 00000004110 12016477577 014674 0 ustar Author: Ole Streicher
Description: Correct the installation directory
--- a/Makefile.in
+++ b/Makefile.in
@@ -22,7 +22,7 @@
#----------------------------------------------------------------------------
# Configurable macros:
#----------------------------------------------------------------------------
-INSTALLDIR = @prefix@
+INSTALLDIR = $(DESTDIR)@prefix@
CC = @CC@
RANLIB = @RANLIB@
CFLAGS = @CFLAGS@
@@ -61,6 +61,7 @@
${SHLIB_LD} ${LD_FLAGS} ${SHARED_OBJ} ${SHLIB_LD_LIBS} \
-L${TCL_LIB_PATH} -l${TCL_LIB} -o ${SHARED_LIB}; \
fi
+ echo "pkg_mkIndex . ${SHARED_LIB}" | tclsh
install: all
@@ -68,12 +69,13 @@
echo "cp ${STATIC_LIB} ${INSTALLDIR}/lib/"; \
cp ${STATIC_LIB} ${INSTALLDIR}/lib/; \
else \
+ mkdir -p ${INSTALLDIR}/lib/tcltk/fitsTcl; \
echo "cp ${SHARED_LIB} ${INSTALLDIR}/lib/"; \
- cp ${SHARED_LIB} ${INSTALLDIR}/lib/; \
+ cp ${SHARED_LIB} pkgIndex.tcl ${INSTALLDIR}/lib/tcltk/fitsTcl; \
fi
clean:
- -rm -rf *.o *~ ${STATIC_LIB} ${SHARED_LIB}
+ -rm -rf *.o *~ ${STATIC_LIB} ${SHARED_LIB} pkgIndex.tcl
distclean: clean
-rm -f config.cache config.status config.log Makefile so_locations
--- a/fitsInit.c
+++ b/fitsInit.c
@@ -24,6 +24,8 @@
int i;
+ Tcl_PkgProvide(interp, "fitsTcl", FITSTCL_VERSION);
+
for ( i = 0; i < FITS_MAX_OPEN_FILES; i++) {
FitsOpenFiles[i].fptr = NULL;
FitsOpenFiles[i].kwds = FitsOpenKwds + i;
--- a/fitsTcl.html
+++ b/fitsTcl.html
@@ -39,19 +39,13 @@
-fitsTcl is compiled as a dynamic library which can be loaded as a TCL
-extension. To load fitsTcl, type the following command in a Tcl shell
-(running on UNIX)
+fitsTcl is compiled as a TCL packge. To load fitsTcl, type the following
+command in a Tcl shell
-% load libfitstcl.so
+% package require fitsTcl
-(Under Mac OS and Windows, the library is instead named
-fitstcl.dll.) If the library is not found you may need to
-set the environment variable LD_LIBRARY_PATH (Unix only) to the
-directory containing libfitstcl.so or include an explicit path to the
-file.
debian/patches/fix_fitsCmds.patch 0000664 0000000 0000000 00000007252 12031011632 014255 0 ustar Author: Ole Streicher
Description: Fix some bugs in fitsCmds.c:
* In fitsTcl_get(), the header is allocated by ffhdr2str(), but is freed by
ckfree(). This causes crashes if ckfree() is not just a free() alias.
* Fix some variable declarations and type casts to match prototypes.
* Check the number of arguments in "get translatedKeywords".
* Fix status parameter in exxor handling of fits_copy_cell2image() of
"get translatedKeywords".
--- a/fitsCmds.c
+++ b/fitsCmds.c
@@ -360,7 +360,7 @@
} else if( !strcmp("filesize",argv[2]) ) {
- sprintf(result,"%ld",curFile->fptr->Fptr->filesize/2880);
+ sprintf(result,"%lld",curFile->fptr->Fptr->filesize/2880);
Tcl_SetResult(curFile->interp, result, TCL_VOLATILE);
} else if( !strcmp("hdutype",argv[2]) ) {
@@ -976,8 +976,8 @@
int naxis = 2;
long naxes[2];
int columns[FITS_MAXDIMS];
- int *nkeys;
- char **header;
+ int nkeys;
+ char *header;
int i,j;
/* Pan Chai: there is only 2 columns */
@@ -1032,7 +1032,7 @@
}
status = 0;
- if ( ffhdr2str(dummyptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
+ if ( ffhdr2str(dummyptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
return TCL_ERROR;
}
@@ -1049,7 +1049,7 @@
Tcl_ListObjAppendElement( curFile->interp, listObj, Tcl_NewListObj(5,data) );
Tcl_SetObjResult(curFile->interp, listObj);
- ckfree( (char*) header);
+ free( header);
return TCL_OK;
} else if( !strcmp("translatedKeywords", argv[2]) ) {
@@ -1058,6 +1058,13 @@
long rownum;
fitsfile *newptr;
+ if ( argc != 5 ) {
+ Tcl_SetResult(curFile->interp,
+ "Usage: get translatedKeywords rownum colname",
+ TCL_STATIC);
+ return TCL_ERROR;
+ }
+
strcpy(outfile, "mem://_1");
/* Copy the image into new primary array and open it as the current */
@@ -1075,13 +1082,14 @@
status = 0;
if (fits_copy_cell2image(curFile->fptr, newptr, argv[3], rownum, &status) > 0)
{
+ int status2 = 0;
ffpmsg("Failed to copy table cell to new primary array:");
- ffclos(curFile->fptr, status);
+ ffclos(curFile->fptr, &status2);
curFile->fptr = 0; /* return null file pointer */
return(status);
}
- if ( ffhdr2str(newptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
+ if ( ffhdr2str(newptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
return TCL_ERROR;
}
@@ -1102,7 +1110,7 @@
Tcl_SetObjResult(curFile->interp, listObj);
*/
- ckfree( (char*) header);
+ free( header);
return TCL_OK;
} else if( !strcmp("header2str", argv[2]) ) {
@@ -1114,7 +1122,7 @@
/* int *nkeys, O - returned number of 80-char keywords */
/* int *status) IO - error status */
- if ( ffhdr2str(curFile->fptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
+ if ( ffhdr2str(curFile->fptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
return TCL_ERROR;
}
@@ -1123,7 +1131,7 @@
Tcl_ListObjAppendElement( curFile->interp, listObj, Tcl_NewIntObj( nkeys ) );
Tcl_SetObjResult(curFile->interp, listObj);
- ckfree( (char*) header);
+ free( header);
return TCL_OK;
} else if( !strcmp("imgwcs", argv[2]) ) {
debian/patches/cfitsio_header.patch 0000664 0000000 0000000 00000012506 12016477577 014634 0 ustar Author: William Pence (author of cfitsio)
Description: Install cfitsio header files that were not in the cfitsio
distribution but needed for compilation here.
--- /dev/null
+++ b/eval_tab.h
@@ -0,0 +1,41 @@
+typedef union {
+ int Node; /* Index of Node */
+ double dbl; /* real value */
+ long lng; /* integer value */
+ char log; /* logical value */
+ char str[256]; /* string value */
+} FFSTYPE;
+#define BOOLEAN 258
+#define LONG 259
+#define DOUBLE 260
+#define STRING 261
+#define BITSTR 262
+#define FUNCTION 263
+#define BFUNCTION 264
+#define GTIFILTER 265
+#define REGFILTER 266
+#define COLUMN 267
+#define BCOLUMN 268
+#define SCOLUMN 269
+#define BITCOL 270
+#define ROWREF 271
+#define NULLREF 272
+#define SNULLREF 273
+#define OR 274
+#define AND 275
+#define EQ 276
+#define NE 277
+#define GT 278
+#define LT 279
+#define LTE 280
+#define GTE 281
+#define POWER 282
+#define NOT 283
+#define INTCAST 284
+#define FLTCAST 285
+#define UMINUS 286
+#define ACCUM 287
+#define DIFF 288
+
+
+extern FFSTYPE fflval;
--- /dev/null
+++ b/eval_defs.h
@@ -0,0 +1,159 @@
+#include
+#include
+#include
+#include
+#if defined(__sgi) || defined(__hpux)
+#include
+#endif
+#ifdef sparc
+#include
+#endif
+#include "fitsio2.h"
+
+#ifndef FFBISON
+#include "eval_tab.h"
+#endif
+
+#define MAXDIMS 5
+#define MAXSUBS 10
+#define MAXVARNAME 80
+#define CONST_OP -1000
+#define pERROR -1
+
+
+typedef struct {
+ char name[MAXVARNAME+1];
+ int type;
+ long nelem;
+ int naxis;
+ long naxes[MAXDIMS];
+ char *undef;
+ void *data;
+ } DataInfo;
+
+typedef struct {
+ long nelem;
+ int naxis;
+ long naxes[MAXDIMS];
+ char *undef;
+ union {
+ double dbl;
+ long lng;
+ char log;
+ char str[256];
+ double *dblptr;
+ long *lngptr;
+ char *logptr;
+ char **strptr;
+ void *ptr;
+ } data;
+ } lval;
+
+typedef struct Node {
+ int operation;
+ void (*DoOp)(struct Node *this);
+ int nSubNodes;
+ int SubNodes[MAXSUBS];
+ int type;
+ lval value;
+ } Node;
+
+typedef struct {
+ fitsfile *def_fptr;
+ int (*getData)( char *dataName, void *dataValue );
+ int (*loadData)( int varNum, long fRow, long nRows,
+ void *data, char *undef );
+
+ int compressed;
+ int timeCol;
+ int parCol;
+ int valCol;
+
+ char *expr;
+ int index;
+ int is_eobuf;
+
+ Node *Nodes;
+ int nNodes;
+ int nNodesAlloc;
+ int resultNode;
+
+ long firstRow;
+ long nRows;
+
+ int nCols;
+ iteratorCol *colData;
+ DataInfo *varData;
+ PixelFilter *pixFilter;
+
+ long firstDataRow;
+ long nDataRows;
+ long totalRows;
+
+ int datatype;
+ int hdutype;
+
+ int status;
+ } ParseData;
+
+typedef enum {
+ rnd_fct = 1001,
+ sum_fct,
+ nelem_fct,
+ sin_fct,
+ cos_fct,
+ tan_fct,
+ asin_fct,
+ acos_fct,
+ atan_fct,
+ sinh_fct,
+ cosh_fct,
+ tanh_fct,
+ exp_fct,
+ log_fct,
+ log10_fct,
+ sqrt_fct,
+ abs_fct,
+ atan2_fct,
+ ceil_fct,
+ floor_fct,
+ round_fct,
+ min1_fct,
+ min2_fct,
+ max1_fct,
+ max2_fct,
+ near_fct,
+ circle_fct,
+ box_fct,
+ elps_fct,
+ isnull_fct,
+ defnull_fct,
+ gtifilt_fct,
+ regfilt_fct,
+ ifthenelse_fct,
+ row_fct,
+ null_fct,
+ median_fct,
+ average_fct,
+ stddev_fct,
+ nonnull_fct,
+ angsep_fct,
+ gasrnd_fct,
+ poirnd_fct
+ } funcOp;
+
+extern ParseData gParse;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ int ffparse(void);
+ int fflex(void);
+ void ffrestart(FILE*);
+
+ void Evaluate_Parser( long firstRow, long nRows );
+
+#ifdef __cplusplus
+ }
+#endif
debian/patches/fix_compiler_warnings.patch 0000664 0000000 0000000 00000023017 12031010506 016217 0 ustar Author: Ole Streicher
Description: Correct warnings with -Werror=format-security and conversion
from pointer to int.
--- a/fitsIO.c
+++ b/fitsIO.c
@@ -81,8 +81,9 @@
{
int i,status=0;
int simple,extend;
- long pcount, gcount, rowlen, varidat;
+ long pcount, gcount, rowlen;
LONGLONG tbcol[FITS_COLMAX];
+ LONGLONG varidat;
char tmpStr[80];
char tmpKey[FLEN_KEYWORD];
Tcl_HashEntry *thisEntry;
@@ -1782,7 +1783,7 @@
case TDOUBLE:
dblData = (double *) ckalloc(nCol*nRow*sizeof(double));
- memset (dblData, NULL, nCol*nRow*sizeof(double));
+ memset (dblData, 0, nCol*nRow*sizeof(double));
ffgsfd(curFile->fptr,
1,
@@ -1826,7 +1827,7 @@
case TLONGLONG:
longlongData = (LONGLONG *) ckalloc(nCol*nRow*sizeof(LONGLONG));
- memset (longlongData, NULL, nCol*nRow*sizeof(LONGLONG));
+ memset (longlongData, 0, nCol*nRow*sizeof(LONGLONG));
ffgsfjj(curFile->fptr,
1,
@@ -1875,7 +1876,7 @@
case TFLOAT:
floatData = (float *) ckalloc(nCol*nRow*sizeof(float));
- memset (floatData, NULL, nCol*nRow*sizeof(float));
+ memset (floatData, 0, nCol*nRow*sizeof(float));
ffgsfe(curFile->fptr,
1,
@@ -1920,7 +1921,7 @@
case TLONG:
case TINT:
intData = (int *) ckalloc(nRow*nCol*sizeof(int));
- memset (intData, NULL, nCol*nRow*sizeof(int));
+ memset (intData, 0, nCol*nRow*sizeof(int));
ffgsfk(curFile->fptr,
1,
curFile->CHDUInfo.image.naxes,
@@ -1963,7 +1964,7 @@
case TSHORT:
shortData = (short *) ckalloc(nCol*nRow*sizeof(short));
- memset (shortData, NULL, nCol*nRow*sizeof(short));
+ memset (shortData, 0, nCol*nRow*sizeof(short));
ffgsfi(curFile->fptr,
1,
@@ -2007,7 +2008,7 @@
case TBYTE:
byteData = (unsigned char *) ckalloc(nCol*nRow*sizeof(unsigned char));
- memset (byteData, NULL, nCol*nRow*sizeof(unsigned char));
+ memset (byteData, 0, nCol*nRow*sizeof(unsigned char));
ffgsfb(curFile->fptr,
1,
@@ -3976,9 +3977,9 @@
if ( ifCSV == 1 )
fprintf(fPtr, "\"");
if ( ifPrintRow == 1 ) {
- sprintf(outputStr, "%d", m);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ sprintf(outputStr, "%lld", m);
+ fprintf(fPtr, "%s", outputStr);
+ fprintf(fPtr, "%s", sepString);
}
saveVectorTableRowToAscii(curFile, filename, fileStatus, m, 1, fCol, nCols, baseColNum, ifCSV,
@@ -4180,7 +4181,7 @@
} else if( anyf ) {
/* */
} else {
- strcpy(outputStr,longlongValue[0]);
+ sprintf(outputStr,colFormat,longlongValue[0]);
}
break;
@@ -4191,9 +4192,9 @@
return TCL_ERROR;
}
- fprintf(fPtr, outputStr);
+ fprintf(fPtr, "%s", outputStr);
if ( k != (fCol+nCols-1) )
- fprintf(fPtr, sepString);
+ fprintf(fPtr, "%s", sepString);
}
return TCL_OK;
@@ -4406,9 +4407,9 @@
fprintf(fPtr, rowFormatStr, outputStr);
} else {
/* don't pad */
- fprintf(fPtr, outputStr);
+ fprintf(fPtr,"%s", outputStr);
}
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", sepString);
}
for (j=0; j< nCols; j++) {
@@ -4423,7 +4424,7 @@
0, sepString, ifVariableVec, colFStr[j], dataType, fPtr, ifFixedFormat);
if ( ifFixedFormat == 0 ) {
if ( j < nCols-1 ) {
- fprintf(fPtr,sepString);
+ fprintf(fPtr,"%s",sepString);
}
}
@@ -4716,7 +4717,7 @@
if ( ifFixedFormat == 0 ) {
if ( j != nCols-1 )
/* print sepString if we're not on last column */
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", sepString);
}
}
}
@@ -4875,7 +4876,7 @@
case TDOUBLE:
dblData = (double *) ckalloc(nCols*nRows*sizeof(double));
- memset (dblData, NULL, nCols*nRows*sizeof(double));
+ memset (dblData, 0, nCols*nRows*sizeof(double));
ffgsfd(curFile->fptr,
0,
@@ -4905,8 +4906,8 @@
if ( ifPrintRow == 1 ) {
int rowNum = fRow + j;
sprintf(outputStr, "%d", rowNum);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", outputStr);
+ fprintf(fPtr,"%s", sepString);
}
for (i=0; ifptr,
0,
@@ -4959,8 +4960,8 @@
if ( ifPrintRow == 1 ) {
int rowNum = fRow + j;
sprintf(outputStr, "%d", rowNum);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", outputStr);
+ fprintf(fPtr,"%s", sepString);
}
for (i=0; ifptr,
0,
curFile->CHDUInfo.image.naxes,
@@ -5015,8 +5016,8 @@
if ( ifPrintRow == 1) {
int rowNum = fRow + j;
sprintf(outputStr, "%d", rowNum);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", outputStr);
+ fprintf(fPtr,"%s", sepString);
}
for (i=0; ifptr,
0,
curFile->CHDUInfo.image.naxes,
@@ -5068,8 +5069,8 @@
if ( ifPrintRow == 1) {
int rowNum = fRow + j;
sprintf(outputStr, "%d", rowNum);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", outputStr);
+ fprintf(fPtr,"%s", sepString);
}
for (i=0; ifptr,
0,
curFile->CHDUInfo.image.naxes,
@@ -5121,8 +5122,8 @@
if ( ifPrintRow == 1) {
int rowNum = fRow + j;
sprintf(outputStr, "%d", rowNum);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", outputStr);
+ fprintf(fPtr,"%s", sepString);
}
for (i=0; ifptr,
0,
curFile->CHDUInfo.image.naxes,
@@ -5174,8 +5175,8 @@
if ( ifPrintRow == 1) {
int rowNum = fRow + j;
sprintf(outputStr, "%d", rowNum);
- fprintf(fPtr, outputStr);
- fprintf(fPtr, sepString);
+ fprintf(fPtr,"%s", outputStr);
+ fprintf(fPtr,"%s", sepString);
}
for (i=0; i