The PVL Object
Last modified: September 13th, 1995
This library contains a PVL object and a developer's interface routines. Through the interface routines, a program can:
uncompress pvl.tar.Z
and then type:
tar -xvf pvl.tar
pvl/ directory you will find 4 items:
lib/ directory.
make.
src/ directory.
make.
tester is in the bin/
directory along with file1 and file2.
To run this program type:
You will get a summary of what the PVL Object found while interrogating these files.
The tester simply dumps out all the results it finds to the screen.
The tester starts by printing out:
[BEGIN DOCUMENT]
The tester ends by printing out:
[END DOCUMENT]
Each line is preceeded by the statements:
[LINE LISTING]
Parameter=(the parameter string follows the equal sign)
Each element in the line looks like this:
[ELEMENT]
Class=(Simple, Aggregate, Set, or Sequence)
MyLevel=(an integer - a unique number given to each field)
MyParent=(an integer - a number of a previous field, or a 0)
Value=(a string or null)
Unit=(a string or null)
/* PvlInterfaceFunction() is called with an action and data #define Pvl_LOAD_PVLFILE in file Pvl.h #define Pvl_SUCCESS in file Pvl.h char *argv[] - passed through main() arguments */ int rtn; rtn = PvlInterfaceFunction( Pvl_LOAD_PVLFILE, argv[1] ); if (rtn != Pvl_SUCCESS) exit( 0 );
/* PvlInterfaceFunction() is called with an action and data #define Pvl_NEXT_TOKEN in file Pvl.h #define Pvl_LITERAL in file Pvl.h */ rtn = PvlInterfaceFunction( Pvl_NEXT_TOKEN, NULL ); if (rtn != Pvl_LITERAL) exit( 0 );
char *ptr; ptr = Pvlparameter();
The final type, an Aggregate, is never complex and returns either a beginning or end marker.
The tester calls PvlRetClass() like this:
/* PvlRetClass() returns the class of the current field. Fields are incremented as the program calls PvlnextSimple() and PvlnextValue(). To start from the first field, call Pvlparameter() once. */ int type; type = PvlRetClass();
The tester calls PvlRetMyId() like this:
int value; value = PvlRetMyId();
Here is how a Complex Field is defined. For
a Set like this:
SET = {1,5,9};
The fields in the set are as follows:
The tester calls PvlRetMyParentId() like this:
int value; value = PvlRetMyParentId();
SET = (1,2)
the first field has no Value but the
Unit="inches")
The tester calls PvlnextSimple() like this:
char *ptr; ptr = PvlnextSimple();
file1.
/* this is a test file consisting of comments, an aggregation,
simple, set and sequence statements */
BEGIN_OBJECT = EXAMPLE1
STRING = "this is a test string";
END_OBJECT = EXAMPLE1
Here is an output listing when tester
summarizes file1.
[BEGIN DOCUMENT]
[LINE LISTING]
Parameter=BEGIN_OBJECT
[ELEMENT]
Class=Aggregate
MyLevel=1
MyParent=0
Value=EXAMPLE1
Unit=(null)
[LINE LISTING]
Parameter=STRING
[ELEMENT]
Class=Simple
MyLevel=1
MyParent=0
Value=this is a test string
Unit=(null)
[LINE LISTING]
Parameter=END_OBJECT
[ELEMENT]
Class=Aggregate
MyLevel=1
MyParent=0
Value=EXAMPLE1
Unit=(null)
Getpvl_Parm:EOFFound:ignore line and return Failure
[END DOCUMENT]
End Program
file2.
/* this is a test file consisting of comments and a set
*/
SET = {0, 1};
Here is an output listing when tester
summarizes file1.
[BEGIN DOCUMENT]
[LINE LISTING]
Parameter=SET
[ELEMENT]
Class=Set
MyLevel=1
MyParent=0
Value=(null)
Unit=feet
[NEXT ELEMENT]
Class=Set
MyLevel=2
MyParent=1
Value=0
Unit=(null)
[NEXT ELEMENT]
Class=Simple
MyLevel=3
MyParent=1
Value=1
Unit=(null)
Getpvl_Parm:EOFFound:ignore line and return Failure
[END DOCUMENT]
End Program