STScI Logo

datarep xray.xdataio


NAME · USAGE · DESCRIPTION · PARAMETERS · EXAMPLES · TIME_REQUIREMENTS
BUGS · SEE_ALSO

NAME

datarep -- data representation conversion program

USAGE

datarep input output template iformat

DESCRIPTION

Datarep converts data files from one machine representation to another. The conversion is directed by a data structure template given in the template file. Templates have the following syntax:


	file	: deflist
	deflist	:
		| struct deflist
		| data	 deflist
	struct	: "struct" IDENTIFIER  '{' datlist '}'
	datlist	: # empty
		| data datlist
	data	: PRIMARY
		| array
	array	: PRIMARY '[' index ']'
	index	: INTEGER
		| INTEGER ',' index

	PRIMARY : "bool" | "short" | "int" | "long" | "real" | "double"
		| IDENTIFIER

PARAMETERS

input = "" prompt = input data file

The input data file.

ofile = "" prompt = output data file

The output data file.

template = "" prompt = datarep template

The template file. This file contains a data structure definition to drive the data conversion.

(iformat = "") [string]

The data representations of the input file. Currently the following formats are supported:


	IEEE 	to 	Host
	Vax	to	Host
	DG	to	Host

	(Sun is provided as a synonym of IEEE)
(oformat = "host") [string]

The data representation of the output file. Currently only the value "host" is allowed since datarep converts an input format to host format.

(clobber = no) [boolean]

Hidden boolean flag specifying whether or not the output file can be overwritten, if it already exists.

EXAMPLES

Here is an example of the template used to convert a raymond data file used in the PROS spectral package:


	# Raymond Table datarep template.

	struct	Header {
		real		# revision number of table
		char[16]	# creation time
		char[80]	# name of table
		char[16]	# space left from a bug in raymond
		real		# percent
		real[13]	# abundance
		real		# number of abundances
		real		# minimum energy
		real		# energy step increment
		real		# number of bins	
		real		# temperature of first row
		real		# temperature step increment
		real		# number of temparature rows
	}

	struct	Line {
		real		# temperature of Line
		real[180]	# each bin at this temperature
	}

	Header
	Line

Notice that comments are allowed and blank lines are skipped. Datarep continues to convert the last item in the definitions list until EOF. In the above example the structure Line will continue to be used until the end on the input file is reached. Also note that you can declare an array of structures or use a structure identifier in another structure definition, e.g.:

	# Show off example

	# Foo's definition must occur before
	# it is referenced in Goo.

	struct Foo {
		int
		real[5]
	}

	struct Goo {
		char[32]
		Foo[4]		# Structure Foo used as an array.
	}

	Goo

	# Wow!

TIME REQUIREMENTS

BUGS

The number of characters given in a definition list or in an array must be even. This bug arises from the current implimentation of SPP.

SEE ALSO


Source Code · Search Form · STSDAS