Index: /trunk/doc/pslib/ChangeLogSDRS.tex
===================================================================
--- /trunk/doc/pslib/ChangeLogSDRS.tex	(revision 3498)
+++ /trunk/doc/pslib/ChangeLogSDRS.tex	(revision 3499)
@@ -1,3 +1,3 @@
-%%% $Id: ChangeLogSDRS.tex,v 1.75 2005-03-18 04:04:09 jhoblitt Exp $
+%%% $Id: ChangeLogSDRS.tex,v 1.76 2005-03-24 23:20:55 jhoblitt Exp $
 
 \subsection{Changes from version 00 to version 01}
@@ -505,3 +505,5 @@
 \item Change ``Time Tables'' to have IERS Bulliten A \& B
 \end{itemize}
-\end{itemize}
+\item Remove Configuration File Grammar appendix
+\item Add Configuration File Test Inputs appendix
+\end{itemize}
Index: /trunk/doc/pslib/Makefile
===================================================================
--- /trunk/doc/pslib/Makefile	(revision 3498)
+++ /trunk/doc/pslib/Makefile	(revision 3499)
@@ -1,3 +1,3 @@
-# $Id: Makefile,v 1.12 2005-02-10 01:28:07 eugene Exp $
+# $Id: Makefile,v 1.13 2005-03-24 23:20:55 jhoblitt Exp $
 
 PDFLATEX = env TEXINPUTS=.:LaTeX:$(TEXINPUTS): pdflatex
@@ -12,5 +12,5 @@
 all : psLibSDRS.pdf psLibADD.pdf
 
-psLibSDRS.pdf: psLibSDRS_Astrom.tex ChangeLogSDRS.tex
+psLibSDRS.pdf: psLibSDRS_Astrom.tex ChangeLogSDRS.tex configFileTests.tex
 psLibADD.pdf: psLibADD.tex ChangeLogADD.tex
 
Index: /trunk/doc/pslib/configFileTests.tex
===================================================================
--- /trunk/doc/pslib/configFileTests.tex	(revision 3499)
+++ /trunk/doc/pslib/configFileTests.tex	(revision 3499)
@@ -0,0 +1,507 @@
+\subsection{Complete Examples}
+
+\subsubsection{SDRS example}
+
+Pass.  Test with and without overwrite.
+
+\begin{verbatim}
+Double     F64     1.23456789      # This is a comment
+Float    F32 0.98765#This is a comment too
+String  STR This is the string that forms the value #comment
+
+ # This is a comment line and is to be ignored
+boolean     BOOL    T # The value of `boolean' is `true'
+ 
+@primes U8  2,3 5 7,11,13 17 #   These are prime numbers
+
+comment MULTI # The rest of this line is ignored, but `comment' is set to be non-unique
+comment STR This
+comment STR     is
+comment STR       a
+comment STR        non-unique
+comment STR                  key
+Float F64 1.23456 # This generates a warning, and, if `overwrite' is `false', is ignored
+\end{verbatim}
+
+\subsubsection{Gene's example}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+# these are examples of camera definition variables:
+# skyprobe
+NCELL       S32    1
+NCHIP       S32    1
+#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
+CELL.00     STR    %f00.%x     PHU      [0,0:0,0]   CHIP.00   [0,0:0,0] 
+                   
+# megacam-raw      
+NCELL       S32    72
+NCHIP       S32    36
+#                  FILENAME    EXTNAME  DATASEC     CHIP      BIASSEC     
+CELL.00     STR    %f.%x       AMP00    [0,0:0,0]   CHIP.00   BIASSEC
+CELL.01     STR    %f.%x       AMP01    [0,0:0,0]   CHIP.00   [2100,2110:0,4096]   
+CELL.02     STR    %f.%x       AMP02    [0,0:0,0]   CHIP.01   [0,0:0,0]   
+CELL.03     STR    %f.%x       AMP03    [0,0:0,0]   CHIP.01   [0,0:0,0]   
+
+# megacam-splice
+NCELL       S32    72
+NCHIP       S32    36
+#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC   TRIMSEC
+CELL.00     STR    %f.%x       CCD00    ASEC-00     CHIP.00   BSEC-00   DSEC-00
+CELL.01     STR    %f.%x       CCD00    ASEC-01     CHIP.00   BSEC-01   DSEC-01
+CELL.02     STR    %f.%x       CCD01    ASEC-00     CHIP.01   BSEC-00   DSEC-00
+CELL.03     STR    %f.%x       CCD01    ASEC-01     CHIP.01   BSEC-01   DSEC-01
+
+# cfh12k-split
+NCELL       S32    12
+NCHIP       S32    12
+#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
+CELL.00     STR    %f/%f00.%x  PHU      [0,0:0,0]   CHIP.00   [0,0:0,0]   
+CELL.01     STR    %f/%f01.%x  PHU      [0,0:0,0]   CHIP.01   [0,0:0,0]   
+CELL.02     STR    %f/%f02.%x  PHU      [0,0:0,0]   CHIP.02   [0,0:0,0]   
+
+# cfh12k-mef
+NCELL       S32    12
+NCHIP       S32    12
+#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
+CELL.00     STR    %f.%x       CHIP00   [0,0:0,0]   CHIP.00   [0,0:0,0]   
+CELL.01     STR    %f.%x       CHIP01   [0,0:0,0]   CHIP.01   [0,0:0,0]   
+CELL.02     STR    %f.%x       CHIP02   [0,0:0,0]   CHIP.02   [0,0:0,0]   
+
+#- REGION can be defined by a header keyword in IRAF format or by a explicit IRAF format 
+#- what is default for NAXIS1,2 for IRAF format?
+#- Nreadout is always NAXIS3?
+
+# recipe file:
+# this makes the assumption that, for a given camera, all chips &
+# cells have the same recipe.  this is probably a good start, but may
+# not cut it in general. eg, it is already clear that for 
+
+# recipe file must be a function of time and camera.
+# 
+
+# BIAS:
+BIAS.IMAGE                 STR    NONE
+BIAS.IMAGE  		   STR    FILE:bias.fits
+BIAS.IMAGE  		   STR    DB:BEST
+BIAS.IMAGE  		   STR    DB:CLOSE
+
+BIAS.OVERSCAN 		   STR    HEADER:BIASSEC
+BIAS.OVERSCAN 		   STR    RECIPE:[0,0:0,0]
+BIAS.OVERSCAN 		   STR    NONE
+
+BIAS.OVERSCAN.STATS 	   STR    MEDIAN
+BIAS.OVERSCAN.STATS 	   STR    MEAN
+
+BIAS.OVERSCAN.FIT          STR    SPLINE
+BIAS.OVERSCAN.FIT.NPTS     S32    5
+
+BIAS.OVERSCAN.FIT          STR    POLYNOMIAL
+BIAS.OVERSCAN.FIT.ORDER    S32    3
+BIAS.OVERSCAN.FIT.NBIN     S32    5
+\end{verbatim}
+
+\subsection{METADATA}
+
+\subsubsection{SDRS example}
+
+Pass.
+
+\begin{verbatim}
+CELL      METADATA
+ EXTNAME   STR   CCD00
+ BIASSEC   STR   BSEC-00
+ CHIP      STR   CHIP.00
+ NCELL     S32   24
+END
+\end{verbatim}
+
+\subsubsection{nested metadata}
+
+Pass.
+
+\begin{verbatim}
+CELL      METADATA
+    FOO METADATA
+        BAR     STR BAZ
+        PING    STR PONG
+    END
+    
+    EXTNAME   STR   CCD00
+    BIASSEC   STR   BSEC-00
+    CHIP      STR   CHIP.00
+    NCELL     S32   24
+END
+\end{verbatim}
+
+\subsubsection{deeply nested metadata}
+
+Pass.
+
+\begin{verbatim}
+FOO1 METADATA
+    FOO2 METADATA
+        FOO3 METADATA
+            FOO4 METADATA
+                FOO5 METADATA
+                    FOO6 METADATA
+                        BAR     STR BAZ
+                        PING    STR PONG
+                    END
+                    BAR     STR BAZ
+                    PING    STR PONG
+                END
+                BAR     STR BAZ
+                PING    STR PONG
+            END
+            BAR     STR BAZ
+            PING    STR PONG
+        END
+        BAR     STR BAZ
+        PING    STR PONG
+    END
+    BAR     STR BAZ
+    PING    STR PONG
+END
+\end{verbatim}
+
+\subsubsection{deeply nested metadata}
+
+Pass.
+
+\begin{verbatim}
+FOO1 METADATA
+    BAR     STR BAZ
+    PING    STR PONG
+    FOO2 METADATA
+        BAR     STR BAZ
+        PING    STR PONG
+        FOO3 METADATA
+            BAR     STR BAZ
+            PING    STR PONG
+            FOO4 METADATA
+                BAR     STR BAZ
+                PING    STR PONG
+                FOO5 METADATA
+                    BAR     STR BAZ
+                    PING    STR PONG
+                    FOO6 METADATA
+                        BAR     STR BAZ
+                        PING    STR PONG
+                    END
+                END
+            END
+        END
+    END
+END
+\end{verbatim}
+
+\subsubsection{deeply nested metadata}
+
+Pass.
+
+\begin{verbatim}
+FOO1 METADATA
+    BAR     STR BAZ
+    FOO2 METADATA
+        BAR     STR BAZ
+        FOO3 METADATA
+            BAR     STR BAZ
+            FOO4 METADATA
+                BAR     STR BAZ
+                FOO5 METADATA
+                    BAR     STR BAZ
+                    FOO6 METADATA
+                        BAR     STR BAZ
+                        PING    STR PONG
+                    END
+                    PING    STR PONG
+                END
+                PING    STR PONG
+            END
+            PING    STR PONG
+        END
+        PING    STR PONG
+    END
+    PING    STR PONG
+END
+\end{verbatim}
+
+\subsubsection{two metadata at the same depth}
+
+Pass.
+
+\begin{verbatim}
+FOO1 METADATA
+    FOO2 METADATA
+        BAR     STR BAZ
+        PING    STR PONG
+    END
+    FOO3 METADATA
+        BAR     STR BAZ
+        PING    STR PONG
+    END
+END
+\end{verbatim}
+
+\subsection{TYPE}
+
+\subsubsection{basic TYPE}
+
+Pass.
+
+\begin{verbatim}
+TYPE      CELL   EXTNAME   BIASSEC  CHIP
+CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+CELL.01   CELL   CCD01     BSEC-01  CHIP.00
+\end{verbatim}
+
+\subsubsection{TYPE with comments}
+
+Pass.
+
+\begin{verbatim}
+TYPE      CELL   EXTNAME   BIASSEC  CHIP    # comment
+CELL.00   CELL   CCD00     BSEC-00  CHIP.00 # foo
+CELL.01   CELL   CCD01     BSEC-01  CHIP.00 #
+\end{verbatim}
+
+\subsubsection{TYPE not visible in lower scopes}
+
+Pass.
+
+\begin{verbatim}
+TYPE      CELL   EXTNAME   BIASSEC  CHIP
+CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+CELL.01   CELL   CCD01     BSEC-01  CHIP.00
+FOO METADATA
+    TYPE      CELL   EXTNAME   BIASSEC
+    CELL.00   CELL   CCD00     BSEC-00
+    CELL.01   CELL   CCD01     BSEC-01
+    FOO METADATA
+        TYPE      CELL   EXTNAME
+        CELL.00   CELL   CCD00
+        CELL.01   CELL   CCD01
+    END
+END
+\end{verbatim}
+
+\subsubsection{TYPE not in scope}
+
+Fail.
+
+\begin{verbatim}
+TYPE      CELL   EXTNAME   BIASSEC  CHIP
+FOO METADATA
+    CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+END
+\end{verbatim}
+
+\subsubsection{TYPE not in scope}
+
+Fail.
+
+\begin{verbatim}
+FOO METADATA
+    TYPE      CELL   EXTNAME   BIASSEC  CHIP
+END
+CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+\end{verbatim}
+
+\subsubsection{TYPE not in scope}
+
+Fail.
+
+\begin{verbatim}
+FOO METADATA
+    TYPE      CELL   EXTNAME   BIASSEC  CHIP
+END
+BAR METADATA
+    CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+END
+\end{verbatim}
+
+\subsubsection{TYPE with missing parameters}
+
+Fail.
+
+\begin{verbatim}
+TYPE      CELL   EXTNAME   BIASSEC  CHIP
+CELL.00   CELL   CCD00     BSEC-00
+CELL.01   CELL   CCD01     BSEC-01  CHIP.00
+\end{verbatim}
+
+\subsubsection{TYPE redefinition}
+
+Fail.
+
+\begin{verbatim}
+TYPE      CELL   EXTNAME   BIASSEC  CHIP
+TYPE      CELL   EXTNAME   BIASSEC  CHIP
+CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+CELL.01   CELL   CCD01     BSEC-01  CHIP.00
+\end{verbatim}
+
+\subsubsection{missing TYPE declaration}
+
+Fail.
+
+\begin{verbatim}
+CELL.00   CELL   CCD00     BSEC-00  CHIP.00
+CELL.01   CELL   CCD01     BSEC-01  CHIP.00
+\end{verbatim}
+
+\subsection{MULTI}
+
+\subsubsection{basic MULTI}
+
+\begin{verbatim}
+foo MULTI
+foo S8      -1
+foo STR     bar baz
+foo BOOL    T
+\end{verbatim}
+
+\subsubsection{MULTI with comments}
+
+Pass.
+
+\begin{verbatim}
+foo MULTI               # foo
+foo S8      -1          # bar
+foo STR     bar baz     # baz
+foo BOOL    T           #
+\end{verbatim}
+
+\subsubsection{MULTI not visible in lower scopes}
+
+Pass.
+
+\begin{verbatim}
+foo MULTI
+foo S8      -1
+foo STR     bar baz
+foo BOOL    T
+bar METADATA
+    foo MULTI
+    foo S8      -1
+    foo STR     bar baz
+    foo BOOL    T
+END
+\end{verbatim}
+
+\subsubsection{MULTI METADATA}
+
+Pass.
+
+\begin{verbatim}
+foo MULTI
+foo METADATA
+    bar BOOL    T
+END
+foo METADATA
+    bar BOOL    T
+END
+\end{verbatim}
+
+\subsubsection{MULTI METADATA structure, not declared}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+foo METADATA
+    bar BOOL    T
+END
+foo METADATA
+    bar BOOL    T
+END
+\end{verbatim}
+
+\subsubsection{MULTI TYPE}
+
+Pass.
+
+\begin{verbatim}
+foo MULTI
+TYPE bar a b c
+foo  bar x y z
+foo  bar x y z
+\end{verbatim}
+
+\subsubsection{MULTI TYPE}
+
+Pass.
+
+\begin{verbatim}
+TYPE bar a b c
+foo MULTI
+foo  bar x y z
+foo  bar x y z
+\end{verbatim}
+
+\subsubsection{MULTI TYPE, not declared}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+TYPE bar a b c
+foo  bar x y z
+foo  bar x y z
+\end{verbatim}
+
+\subsubsection{MULTI not in scope}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+foo MULTI
+bar METADATA
+    foo S8      -1
+    foo STR     bar baz
+END
+\end{verbatim}
+
+\subsubsection{MULTI not in scope}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+bar METADATA
+    foo MULTI
+END
+foo S8      -1
+foo STR     bar baz
+\end{verbatim}
+
+\subsubsection{MULTI not in scope}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+bar METADATA
+    foo MULTI
+END
+baz METADATA
+    foo S8      -1
+END
+\end{verbatim}
+
+\subsubsection{MULTI redeclaration}
+
+Fail.
+
+\begin{verbatim}
+foo MULTI
+foo MULTI
+foo S8      -1
+\end{verbatim}
+
+\subsubsection{missing MULTI declaration}
+
+Pass.  Overwrite warning.
+
+\begin{verbatim}
+foo S8      -1
+foo STR     bar baz
+\end{verbatim}
Index: /trunk/doc/pslib/psLibSDRS.tex
===================================================================
--- /trunk/doc/pslib/psLibSDRS.tex	(revision 3498)
+++ /trunk/doc/pslib/psLibSDRS.tex	(revision 3499)
@@ -1,3 +1,3 @@
-%%% $Id: psLibSDRS.tex,v 1.189 2005-03-18 20:44:45 jhoblitt Exp $
+%%% $Id: psLibSDRS.tex,v 1.190 2005-03-24 23:20:55 jhoblitt Exp $
 \documentclass[panstarrs,spec]{panstarrs}
 
@@ -4254,5 +4254,5 @@
 @primes U8  2,3 5 7,11,13 17 #   These are prime numbers
 
-comment * # This is a comment in the ITEM_SET item
+comment MULTI # The rest of this line is ignored, but `comment' is set to be non-unique
 comment STR This
 comment STR     is
@@ -4309,6 +4309,6 @@
 \end{verbatim}
 
-A BNF-like grammar of the configuration file is contained in
-\S\ref{sec:configgrammar}.
+A series of test inputs is contained in
+\S\ref{sec:configtest}.
 
 \subsection{XML Functions}
@@ -5327,157 +5327,11 @@
 \appendix
 
-\section{Configuration File Grammar}
-\label{sec:configgrammar}
-
-Here follows a BNF-like grammar for the configuration files specified
-in \S\ref{sec:configspec}, suitable for use with
-\code{Parse::RecDescent}\footnote{\code{http://search.cpan.org/}$\sim$\code{dconway/Parse-RecDescent-1.94/lib/Parse/RecDescent.pod}}.
-
-\begin{verbatim}
-startrule: statement(s) /\z/
-
-statement: scalar | vector | multi_declare | comment
-
-comment: '#' end_of_line
-
-scalar: name type value comment | name type value
-
-vector: vname vtype vvalue comment | vname vtype vvalue
-
-multi_declare: name '*' end_of_line
-
-name: /[a-z][.\w]*/i
-
-vname: /\@[a-z][.\w]*/i
-
-type:
-    vtype | 'STR' | 'STRING'
-
-vtype:
-    'S8'  |
-    'S16' |
-    'S32' |
-    'S64' |
-    'U8'  |
-    'U16' |
-    'U32' |
-    'U64' |
-    'F32' |
-    'F64' |
-    'C32' |
-    'C64' |
-    'BOOL'
-
-value: vector_value | string
-
-vvalue: vector_value vector_sep vvalue | vector_value vector_sep(?)
-
-vector_sep: ','
-
-vector_value: float | int | bool
-
-int: integer_constant
-
-float: floating_constant
-
-bool: /[tf]\s+?/i
-
-string:
-    /\S[^#\n]*/
-
-end_of_line: /[^\n]*/
-
-### based on syntax found in "C A Reference Manual"
-
-# integer constants
-
-integer_constant:
-    decimal_constant integer_suffix(?) |
-    octal_constant integer_suffix(?) |
-    hexadecimal_constant integer_suffix(?)
-
-decimal_constant:
-    digit(2..) |
-    nonzero_digit
-
-octal_constant:
-    '0' octal_digit(s) |
-    '0'
-
-hexadecimal_constant:
-    hex_prefix hex_digit_sequence
-
-digit:
-    /[0-9]/
-
-nonzero_digit:
-    /[1-9]/
-
-octal_digit:
-    /[0-7]/
-
-hex_digit:
-    /0_9a-f/i
-
-integer_suffix:
-    long_suffix unsigned_suffix(?) |
-    long_long_suffix unsigned_suffix(?) |
-    unsigned_suffix long_suffix(?) |
-    unsigned_suffix long_long_suffix(?)
-
-long_suffix:
-    /l/i
-
-long_long_suffix:
-    /ll/i
-
-unsigned_suffix:
-    /u/i
-
-# floating-point constants
-
-floating_constant:
-    decimal_floating_constant |
-    hexadecimal_floating_constant
-
-decimal_floating_constant:
-    digit_sequence exponent floating_suffix(?) |
-    dotted_digits exponent(?) floating_suffix(?)
-
-digit_sequence:
-    digit(s)
-
-dotted_digits:
-    digit_sequence '.' digit_sequence  |
-    '.' digit_sequence |
-    digit_sequence '.'
-
-exponent:
-    /e/i sign_part digit_sequence
-
-sign_part:
-    /[+-]/
-
-floating_suffix:
-    /[fl]/i
-
-hexadecimal_floating_constant:
-    hex_prefix dotted_hex_digits binary_exponent floating_suffix(?) |
-    hex_prefix hex_digit_sequence binary_exponent floating_suffix(?)
-
-hex_prefix:
-    /0x/i
-
-dotted_hex_digits:
-    hex_digit_sequence '.' hex_digit_sequence |
-    '.' hex_digit_sequence |
-    hex_digit_sequence '.'
-
-hex_digit_sequence:
-    hex_digit(s)
-
-binary_exponent:
-    /p/i sign_part(?) digit_sequence
-\end{verbatim}
+\section{Configuration File Test Inputs}
+\label{sec:configtest}
+
+Here are a series of test inputs for the Configuration File syntax defined in
+\S\ref{sec:configspec}.
+
+\input{configFileTests.tex}
 
 \section{Revision Change Log}
