To define new formats for reading a file create a file called read_????.tcl 
where you supply a name of your choice for '????'. Likewise, to support
a new output format, create a  write_????.tcl file.

Note that formats are listed alphabetically on the menu. Follow one of 
the other read_*.tcl or write_*.tcl files as an example. Place the file 
in the same directory as the cmpr.tcl file (and the other .tcl files).

Notes on coding a read_????.tcl file
------------------------------------
1. Define a commandline option to read a file (optional) using 
	command(cmdopt) and defining a routine associated with the 
	command option
  for example:
		lappend command(cmdopt) -xxx
		set command(-xxx) readxxxdata
  defines that command 
	cmpr.tcl -xxx yyy.xxx
  can be used to read file yyy.xxx using read routine readxxxdata (see below)

  You can define as many options as you want or none, but be sure to define 
  them in pairs, as above.

2. Define the dialog access

	define the text to be shown
		lappend command(readtypes) "LHPM/RIET7"
	define a command to read the data
		lappend command(readproc) ReadLHPM
	define a list of allowed datatype suffixes
	        lappend command(filterlist) {dat}

	If you will have upper and lower case versions for unix, you might 
        want to do the following:
		if {$tcl_platform(platform) == "windows"} {
		    lappend command(filterlist) {dat}		} else {
		    lappend command(filterlist) {dat DAT}
		}

	Define a datatype listing (not used in Tix) to describe the suffix:
		set command(ReadLHPM_dat_type) "LHPM/RIET7 data"
		set command(ReadLHPM_DAT_type) "LHPM/RIET7 data"
			
	Note that the info in parentheses corresponds to the name used 
	for command(readproc) followed by each value used for 
	command(filterlist) 

3. Define a dialog box read routine

	This almost always looks the same, except for the readXXXXdata line 
	which refers to the real proc used to read the data.

		proc ReadLHPM {file} {
		    global command
		    if {$file == ""} return
		    pleasewait "reading file $file"
		    set ret [readLHPMdata $file]
		    donewait
		    if {$ret != ""} {return $ret}
		    showlastentry $command(read_filelist)
		}

4. Define a routine to actually read the data. 

	Try to imagine how the routine will crash and burn when a user
	specifies a data file with the wrong format.

	look at the other routines to see examples

The CMPR program will automatically include the new format the next time it
is started. Likewise, to remove a format all that need be done is to change
the file name so that it starts with something other than read_ or end with
something other than .tcl

Notes on coding a write_????.tcl file
-------------------------------------
1. add the format name to command(writetypes) and the procedure name 
	to command(writeproc)

		lappend command(writetypes) ".csv (Spreadsheet)"
		lappend command(writeproc) writelistcsv

2. Write a proc to write the data/peaks

	Note that you can use the statement 

		if {[set ${data}(type)] == "peaks"} {

	to take different action depending on if a peak file
	is being written

	Likewise, you can use the statement 

		if {$command(writeunits) == 0} {

	to take different action if scaled values or original
	values should be written.
