Index: /trunk/doc/pslib/psLibSDRS.tex
===================================================================
--- /trunk/doc/pslib/psLibSDRS.tex	(revision 2313)
+++ /trunk/doc/pslib/psLibSDRS.tex	(revision 2314)
@@ -1,3 +1,3 @@
-%%% $Id: psLibSDRS.tex,v 1.146 2004-11-08 00:43:20 eugene Exp $
+%%% $Id: psLibSDRS.tex,v 1.147 2004-11-09 03:45:07 price Exp $
 \documentclass[panstarrs,spec]{panstarrs}
 
@@ -1725,4 +1725,6 @@
     psVector *index;                    ///< Index values
     psArray *values;                    ///< Corresponding values: an array of vectors
+    const char *filename;               ///< File from which table was read
+    const psF64 validFrom, validTo;     ///< Range of validity
 } psLookupTable;
 \end{verbatim}
@@ -1733,10 +1735,16 @@
 vectors (including the \code{index} and all vectors in the
 \code{values} array) may be any numerical type except complex types.
+The \code{filename} shall specify the file from which the table is to
+be read.  The \code{validFrom} and \code{validTo} shall specify the
+range of valid values for the index; in most cases, these will simply
+be the first and last indices.
 
 The constructor shall be:
 \begin{verbatim}
-psLookupTable *psLookupTableAlloc(int numValues);
-\end{verbatim}
-Here the \code{numValues} indicates the number of vectors in the
+psLookupTable *psLookupTableAlloc(const char *filename, int numValues);
+\end{verbatim}
+Here the \const{filename} indicates the file from which the table
+shall be read when \code{psLookupTableRead} is
+called. \code{numValues} indicates the number of vectors in the
 \code{values} array.
 
@@ -1744,15 +1752,21 @@
 
 \begin{verbatim}
-psLookupTable *psLookupTableRead(const char *filename, int numValues);
-\end{verbatim}
-\code{psLookupTableRead} shall read the file specified by
-\code{filename} and import the data into a \code{psLookupTable}.  The
-file shall be plain text, with index and values on separate lines,
-separated by whitespace.  Lines commencing with a comment character
-(the pound sign, \code{#}) and blank lines shall be ignored.
-\code{numValues} in addition to the index shall be read on each line.
-If the \code{index} vector is not sorted in the file, the lookup table
-shall be sorted prior to the function returning, but no sort shall be
-performed if the indices were sorted in the file.
+int psLookupTableRead(psLookupTable *table);
+\end{verbatim}
+\code{psLookupTableRead} shall read the \code{table} from the
+appropriate file and import the data into the \code{table}, and set
+the \code{validFrom} and \code{validTo} on the basis of the first and
+last values in the \code{table}.  Sufficient memory shall be allocated
+to hold all the data in the specified file.  The file shall be plain
+text, with index and values on separate lines, separated by
+whitespace.  Lines commencing with a comment character (the pound
+sign, \code{#}) and blank lines shall be ignored.
+\code{table->values->n} in addition to the index shall be read on each
+line.  If the \code{index} vector is not sorted in the file, the
+lookup table shall be sorted prior to the function returning, but no
+sort shall be performed if the indices were sorted in the file.  If
+the input \code{table} has already been read from a file, the file
+shall be re-read, and the contents replaced.  The function shall
+return the number of lines read (not including ignored lines).
 
 Interpolation on a lookup table is performed by the following
@@ -3520,49 +3534,4 @@
 pre-determined values (\S\ref{sec:timeMetadata}).
 
-We define a structure, \code{psTimeTable} to hold a single time table:
-\begin{verbatim}
-typedef struct {
-    const char *filename;               // Filename of time table
-    const psF64 validFrom, validTo;     // MJDs of validity of time table
-    psLookupTable *table;	        // Lookup table indexed on MJD, with UT1-UTC, xp and yp
-} psTimeTable;
-\end{verbatim}
-
-The tables shall be read in only when required by the user (hence the
-\code{loaded} member); once loaded, the table shall remain in memory
-until the termination of the program.  The corresponding constructor
-shall be:
-\begin{verbatim}
-psTimeTable *psTimeTableAlloc(const char *filename, psF64 validFrom, psF64 validTo);
-\end{verbatim}
-which simply constructs a \code{psTimeTable} with the appropriate
-\code{filename}, \code{validFrom} and \code{validTo}.  Upon
-construction, the \code{loaded} member shall be set to \code{false},
-and the vectors containing the data shall be set to \code{NULL}.
-
-The function \code{psTimeTableLoad} shall load a specified time
-\code{table}, returning \code{true} for success, and \code{false} if
-the table failed to load.  If the \code{table} has already been
-loaded, then it shall be re-loaded.
-\begin{verbatim}
-bool psTimeTableLoad(psTimeTable *table);
-\end{verbatim}
-
-%Given a time \code{table} and a Modified Julian Date, \code{mjd}, at
-%which to interpolate values, \code{psTimeTableInterpolate} shall
-%calculate the appropriate UT1-UTC (\code{dut}; if non-\code{NULL}),
-%and polar motion (\code{xp,yp}; if non-\code{NULL}) by interpolation
-%on the table.  If the \code{mjd} is outside the range of the table or
-%the interpolation was for some other reason unsuccessful, then the
-%function shall return \code{false}; otherwise the function shall set
-%those parameters which are non-\code{NULL} (\code{dut,xp,yp}) and
-%return \code{true}.  If the requested \code{mjd} lies in the range of
-%the \code{table}, but the \code{table} has not been \code{loaded},
-%then the function shall call \code{psTimeTableLoad}.
-%\begin{verbatim}
-%bool psTimeTableInterpolate(const psTimeTable *table, double *xp,
-%                            double *yp, double *dut, psF64 mjd);
-%\end{verbatim}
-
 \paragraph{Time Metadata}
 \label{sec:timeMetadata}
