Changeset 1691
- Timestamp:
- Sep 3, 2004, 6:23:50 PM (22 years ago)
- Location:
- trunk/doc/pslib
- Files:
-
- 2 edited
-
ChangeLogSDRS.tex (modified) (3 diffs)
-
psLibSDRS.tex (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/pslib/ChangeLogSDRS.tex
r1690 r1691 1 1 \ 2 2 \subsection{Changes from version 00 to version 01} 3 3 … … 256 256 dimension. 257 257 \item Added \code{psLibVersion} (bug 156). 258 \item Added specification of iterator (\code{which}) to 259 \code{psMetadataSetIterator}. 258 \item Added specification of iterator to \code{psMetadataSetIterator}. 260 259 \item Replaced \code{which} and \code{where} in \code{psMetadata} and 261 260 \code{psList} functions with \code{iterator} and \code{location}, … … 292 291 specify a protocol for \code{stderr,stdout,none}). 293 292 \item Leading dot in facility name for \code{psTrace} is optional. 293 \item Specification of configuration file format and parse function, 294 \code{psMetadataParseConfig}. 294 295 \end{itemize} -
trunk/doc/pslib/psLibSDRS.tex
r1690 r1691 1 %%% $Id: psLibSDRS.tex,v 1.10 6 2004-09-03 21:22:20price Exp $1 %%% $Id: psLibSDRS.tex,v 1.107 2004-09-04 04:23:21 price Exp $ 2 2 \documentclass[panstarrs,spec]{panstarrs} 3 3 … … 3518 3518 Read header data from a FITS image file descriptor into a 3519 3519 \code{psMetadata} structure. 3520 3521 3522 \subsubsection{Configuration files} 3523 3524 It will be necessary for the \PS{} system, in order to load 3525 pre-defined settings, to parse a configuration file into a 3526 \code{psMetadata} structure. This shall be performed by the 3527 function \code{psMetadataParseConfig}, as described below. 3528 3529 \begin{verbatim} 3530 int psMetadataParseConfig(psMetadata *md, const char *filename, bool overwrite); 3531 \end{verbatim} 3532 3533 Given a previously allocated metadata container, \code{md}, and the 3534 name of a configuration file, \code{filename}, 3535 \code{psMetadataParseConfig} shall parse the configuration file, 3536 placing the contained key/type/value/comment quads into the metadata, 3537 and returning the number of lines that failed to parse. Multiple 3538 specifications of a key that haven't been declared (see below) are 3539 overwritten if and only if \code{overwrite} is \code{true}. 3540 3541 The configuration file shall consist of plain text with 3542 key/type/value/comment quads on separate lines. Blank lines, 3543 including those consisting solely of whitespace (both spaces and 3544 tabs), shall be ignored, as shall lines that commence with the comment 3545 character (a hash mark, \code{#}), either immediately at the start of 3546 the line, or preceded by whitespace. The key/type/value/comment quads 3547 shall all lie on a single line, separated by whitespace. 3548 3549 The key shall be first, possibly preceded on the line by whitespace 3550 which should not form part of the key. 3551 3552 Next, to assist the casting of the value, shall be a string 3553 identifying the type of the value, which shall correspond to one of 3554 the simple types supported in \code{psMetadata}: 3555 \code{STRING,BOOL,S32,F32,F64}; \code{STR} may be used to abbreviate 3556 \code{STRING}. 3557 3558 \tbd{May, in the future, require more types, including 3559 \code{U8,S16,C64}, which will necessitate updating the definition of 3560 \code{psMetadata}.} 3561 3562 The value shall follow the type: strings may consist of multiple 3563 words, and shall have all leading and trailing whitespace removed; 3564 booleans shall simply be either \code{T} or \code{F}. 3565 3566 Following the value may be an optional comment, preceded by a comment 3567 character (a hash mark, \code{#}), which in the case of a string 3568 value, serves to mark the end of the value, and for other types serves 3569 to identify the comment to the reader. Only one comment character may 3570 be present on any single line (i.e., neither strings nor comments are 3571 permitted to contain the comment character). The comment may consist 3572 of multiple words, and shall have leading and trailing whitespace 3573 removed. 3574 3575 One wrinkle is the specification of vectors. Keys for which the value 3576 is to be parsed as a vector shall be preceded immediately by a 3577 ``vector symbol'', which we choose to be the ``at'' sign, \code{@}. 3578 In this case, the type shall be interpreted as the type for the 3579 vector, which may be any of the signed or unsigned integer or floating 3580 point types (\code{U8,U16,U32,U64,S8,S16,S32,S32,S64,F32,F64}) but not 3581 the complex floating point types; and the value shall consist of 3582 multiple numbers, separated either by a comma or whitespace. These 3583 values shall populate a \code{psVector} of the appropriate type in the 3584 order in which they appear in the configuration file. 3585 3586 \tbd{May add complex types, likely to be specified with values such as 3587 \code{1.23+4.56i} in the future.} 3588 3589 An additional hurdle is the specification of keys that may be 3590 non-unique (such as the \code{COMMENT} keyword in a FITS header). 3591 These keys shall be specified in the configuration file as non-unique 3592 by specifying the key at the start of the line (possibly preceded by 3593 whitespace) and specifying the type as a ``multiple symbol'', which we 3594 choose to be an asterisk, \code{*}. Everything else on the line shall 3595 be ignored. A warning shall be produced when a key which has not been 3596 specified to be non-unique is repeated; in this case, the former value 3597 shall be overwritten if \code{overwrite} is \code{true}, otherwise the 3598 line shall be ignored and counted as one that could not be parsed. 3599 3600 If a line does not conform to the rules laid out here, a warning shall 3601 be generated, it shall be ignored and counted as a line that could not 3602 be parsed. The total number of lines that were not able to be parsed 3603 (including those that were ignored because \code{overwrite} is 3604 \code{false}, and any other parsing problems, but not including blank 3605 lines and comment lines) shall be returned by the function. 3606 3607 Here are some examples of lines of a valid configuration file: 3608 \begin{verbatim} 3609 Double F64 1.23456789 # This is a comment 3610 Float F32 0.98765#This is a comment too 3611 String STR This is the string that forms the value #comment 3612 #This is a comment line and is to be ignored 3613 boolean BOOL T # The value of `boolean' is `true' 3614 3615 @primes U8 2,3 5 7,11,13 17 # These are prime numbers 3616 comment * The rest of this line is ignored, but `comment' is set to be non-unique 3617 comment STR This 3618 comment STR is 3619 comment STR a 3620 comment STR non-unique 3621 comment STR key 3622 Float F64 1.23456 # This generates a warning, and, if `overwrite' is `false', is ignored 3623 \end{verbatim} 3624 3625 Of course, a real configuration file should look much nicer to humans 3626 than the above example, but PSLib must be able to parse such ugly 3627 files. 3628 3520 3629 3521 3630 \subsection{Detector and sky positions}
Note:
See TracChangeset
for help on using the changeset viewer.
