aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /lib
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'lib')
-rw-r--r--lib/chars.h56
-rw-r--r--lib/clio.h11
-rw-r--r--lib/clpackage.hd6
-rw-r--r--lib/clset.h16
-rw-r--r--lib/ctotok.h11
-rw-r--r--lib/ctype.h15
-rw-r--r--lib/diropen.h6
-rw-r--r--lib/error.h11
-rw-r--r--lib/evexpr.h13
-rw-r--r--lib/evvexpr.h24
-rw-r--r--lib/finfo.h39
-rw-r--r--lib/fio.com18
-rw-r--r--lib/fio.h149
-rw-r--r--lib/fmlfstat.h10
-rw-r--r--lib/fmset.h24
-rw-r--r--lib/fset.h59
-rw-r--r--lib/gescape.h205
-rw-r--r--lib/gim.h40
-rw-r--r--lib/gio.h162
-rw-r--r--lib/gki.h188
-rw-r--r--lib/gset.h196
-rw-r--r--lib/helpdb.mipbin0 -> 92578 bytes
-rw-r--r--lib/imhdr.h79
-rw-r--r--lib/imio.h93
-rw-r--r--lib/imset.h29
-rw-r--r--lib/lexnum.h7
l---------lib/libbev.a1
l---------lib/libc.a1
l---------lib/libcur.a1
l---------lib/libcurfit.a1
l---------lib/libdeboor.a1
l---------lib/libds.a1
l---------lib/libex.a1
l---------lib/libgks.a1
l---------lib/libgsurfit.a1
l---------lib/libimc.a1
l---------lib/libimd.a1
l---------lib/libimfort.a1
l---------lib/libiminterp.a1
l---------lib/libinterp.a1
l---------lib/libllsq.a1
l---------lib/libmemdbg.a1
l---------lib/libncar.a1
l---------lib/libnlfit.a1
l---------lib/libreadline.a1
l---------lib/libsgi.a1
l---------lib/libslalib.a1
l---------lib/libstg.a1
l---------lib/libsurfit.a1
l---------lib/libsys.a1
l---------lib/libtbtables.a1
l---------lib/libvops.a1
l---------lib/libxtools.a1
-rw-r--r--lib/math/curfit.h34
-rw-r--r--lib/math/gsurfit.h48
-rw-r--r--lib/math/iminterp.h44
-rw-r--r--lib/math/interp.h20
-rw-r--r--lib/math/nlfit.h28
-rw-r--r--lib/math/surfit.h21
-rw-r--r--lib/mii.h16
-rw-r--r--lib/mwset.h9
-rw-r--r--lib/names1932
-rw-r--r--lib/nmi.h16
-rw-r--r--lib/nspp.h8
-rw-r--r--lib/pattern.h14
-rw-r--r--lib/pkg/center1d.h6
-rw-r--r--lib/pkg/cq.h100
-rw-r--r--lib/pkg/dttext.h19
-rw-r--r--lib/pkg/gtools.h48
-rw-r--r--lib/pkg/icfit.h14
-rw-r--r--lib/pkg/igsfit.h17
-rw-r--r--lib/pkg/inlfit.h89
-rw-r--r--lib/pkg/mef.h52
-rw-r--r--lib/pkg/rg.h8
-rw-r--r--lib/pkg/rmsorted.h15
-rw-r--r--lib/pkg/skywcs.h132
-rw-r--r--lib/pkg/xtanswer.h5
-rw-r--r--lib/plio.h186
-rw-r--r--lib/plset.h57
-rw-r--r--lib/pmset.h43
-rw-r--r--lib/poll.h26
-rw-r--r--lib/prc.com19
-rw-r--r--lib/printf.h52
-rw-r--r--lib/protect.h5
-rw-r--r--lib/prstat.h18
-rw-r--r--lib/psset.h20
-rw-r--r--lib/qpexset.h13
-rw-r--r--lib/qpioset.h39
-rw-r--r--lib/qpset.h39
-rw-r--r--lib/root.hd61
-rw-r--r--lib/scr/cursor.key56
-rw-r--r--lib/scr/geomap.key23
-rw-r--r--lib/scr/gkimosaic.key15
-rw-r--r--lib/scr/gtools.key85
-rw-r--r--lib/scr/gtwindow.key21
-rw-r--r--lib/scr/help.gui3040
-rw-r--r--lib/scr/help.html586
-rw-r--r--lib/scr/imedit.key82
-rw-r--r--lib/scr/imexamine.key165
-rw-r--r--lib/scr/implot.key32
-rw-r--r--lib/scr/inlgfit.key77
-rw-r--r--lib/scr/tvmark.key54
-rw-r--r--lib/scr/wcsedit.key24
-rw-r--r--lib/scr/xgterm.gui14
-rw-r--r--lib/scr/xxgterm.gui1523
-rw-r--r--lib/soseq.x8
-rw-r--r--lib/syserr.h333
-rw-r--r--lib/syserrmsg344
-rw-r--r--lib/syshelpdir85
-rw-r--r--lib/sysruk.x97
-rw-r--r--lib/szdtype.inc5
-rw-r--r--lib/szpixtype.inc5
-rw-r--r--lib/tbset.h91
-rw-r--r--lib/time.h17
-rw-r--r--lib/ttset.h27
-rw-r--r--lib/ttyset.h10
-rw-r--r--lib/votParse_spp.h112
-rw-r--r--lib/xalloc.h6
-rw-r--r--lib/xwhen.h7
-rw-r--r--lib/yaccpar.x238
120 files changed, 11949 insertions, 0 deletions
diff --git a/lib/chars.h b/lib/chars.h
new file mode 100644
index 00000000..18b83e4f
--- /dev/null
+++ b/lib/chars.h
@@ -0,0 +1,56 @@
+# CHARS.H -- Special Characters.
+
+define ESCAPE '\\' # for escape sequences
+define FNLDIR_CHAR '$' # logical directories
+define FNEXTN_CHAR '.' # file name extension
+define FNNODE_CHAR '!' # node name delimiter
+define NEWLINE LF
+define EOFCHAR '\032' # ctrl/z
+define INTCHAR '\003' # ctrl/c
+define BLANK ' '
+define SQUOTE '\''
+define DQUOTE '"'
+define TAB HT
+define RETURN CR
+define SO_ON SO # enter standout mode
+define SO_OFF SI # leave standout mode
+define FC_BREAKPAGE '\1' # Forms Control codes (help)
+define FC_TESTPAGE '\2'
+define FC_STARTKEEP '\3'
+define FC_ENDKEEP '\4'
+
+# ASCII Control Characters.
+
+define NUL '\0'
+define SOH '\1'
+define STX '\2'
+define ETX '\3'
+define EOT '\4'
+define ENQ '\5'
+define ACK '\6'
+define BEL '\7'
+define BS '\10'
+define HT '\11'
+define LF '\12'
+define VT '\13'
+define FF '\14'
+define CR '\15'
+define SO '\16'
+define SI '\17'
+define DLE '\20'
+define DC1 '\21'
+define DC2 '\22'
+define DC3 '\23'
+define DC4 '\24'
+define NAK '\25'
+define SYN '\26'
+define ETB '\27'
+define CAN '\30'
+define EM '\31'
+define SUB '\32'
+define ESC '\33'
+define FS '\34'
+define GS '\35'
+define RS '\36'
+define US '\37'
+define DEL '\177'
diff --git a/lib/clio.h b/lib/clio.h
new file mode 100644
index 00000000..85f65274
--- /dev/null
+++ b/lib/clio.h
@@ -0,0 +1,11 @@
+# CLIO.H -- CLIO definitions (private to the CLIO interface).
+
+define MAX_PSEUDOFILES 10 # is this still used?
+define MAX_POSARGS 20 # max positional arguments
+define MAX_PSETS 20 # max psets used by a task
+define SZ_PSETNAMEBUF 200 # storage for pset names
+define SZ_PNAME 64 # storage for "pset.param"
+
+# The following must agree with the definitions in cl$task.h.
+define IPCOUT "IPC$IPCIO-OUT"
+define IPCDONEMSG "# IPC$IPCIO-FINISHED\n"
diff --git a/lib/clpackage.hd b/lib/clpackage.hd
new file mode 100644
index 00000000..00a969c1
--- /dev/null
+++ b/lib/clpackage.hd
@@ -0,0 +1,6 @@
+# Root help directory for the CLPACKAGE branch of the help database.
+
+clpackage men = clpackage$clpackage.men,
+ hlp = ..,
+ pkg = clpackage$clpackage.hd,
+ src = clpackage$clpackage.cl
diff --git a/lib/clset.h b/lib/clset.h
new file mode 100644
index 00000000..cff47881
--- /dev/null
+++ b/lib/clset.h
@@ -0,0 +1,16 @@
+# CLSET.H -- CLIO parameters. Here "CL" refers to the parent process, which
+# is not necessarily the IRAF Command Language.
+
+define CL_PRTYPE 1 # parent process type (see below)
+define CL_PCACHE 2 # symtab descriptor of param cache
+
+# Process type codes.
+
+define PR_CONNECTED 1 # connected subprocess
+define PR_DETACHED 2 # detached subprocess
+define PR_HOST 3 # subprocess spawned by host
+
+# Process interpreter mode codes (used by ONENTRY and the Iraf Main).
+
+define PR_NOEXIT 0 # run interpreter in Iraf Main
+define PR_EXIT 1 # skip interpreter, shutdown process
diff --git a/lib/ctotok.h b/lib/ctotok.h
new file mode 100644
index 00000000..af1c4fa3
--- /dev/null
+++ b/lib/ctotok.h
@@ -0,0 +1,11 @@
+# CTOTOK.H -- Tokens recognized by CTOTOK.
+
+define TOK_IDENTIFIER 1 # [A-Za-z][A-Za-z0-9_.$]*
+define TOK_NUMBER 2 # [0-9][-+0-9.:xXa-fA-F]*
+define TOK_OPERATOR 3 # all other printable sequences
+define TOK_PUNCTUATION 4 # [:,;] or any control character
+define TOK_STRING 5 # "..."
+define TOK_CHARCON 6 # '\n', etc.
+define TOK_EOS 7 # end of string
+define TOK_NEWLINE 8 # end of line
+define TOK_UNKNOWN 9 # control characters
diff --git a/lib/ctype.h b/lib/ctype.h
new file mode 100644
index 00000000..24e45a62
--- /dev/null
+++ b/lib/ctype.h
@@ -0,0 +1,15 @@
+# CTYPE.H -- Character type definitions.
+
+define IS_UPPER ($1>='A'&&$1<='Z')
+define IS_LOWER ($1>='a'&&$1<='z')
+define IS_DIGIT ($1>='0'&&$1<='9')
+define IS_PRINT ($1>=' '&&$1<177B)
+define IS_CNTRL ($1>0&&$1<' ')
+define IS_ASCII ($1>0&&$1<=177B)
+define IS_ALPHA (IS_UPPER($1)||IS_LOWER($1))
+define IS_ALNUM (IS_ALPHA($1)||IS_DIGIT($1))
+define IS_WHITE ($1==' '||$1=='\t')
+define TO_UPPER ($1+'A'-'a')
+define TO_LOWER ($1+'a'-'A')
+define TO_INTEG ($1-'0')
+define TO_DIGIT ($1+'0')
diff --git a/lib/diropen.h b/lib/diropen.h
new file mode 100644
index 00000000..cb89e2cf
--- /dev/null
+++ b/lib/diropen.h
@@ -0,0 +1,6 @@
+# DIROPEN.H -- Defined parameters for fio.diropen. Two directory access modes
+# are permitted, pass all files and skip hidden files (files generated and
+# used internally by the system).
+
+define SKIP_HIDDEN_FILES 0
+define PASS_HIDDEN_FILES 1
diff --git a/lib/error.h b/lib/error.h
new file mode 100644
index 00000000..e5d56d92
--- /dev/null
+++ b/lib/error.h
@@ -0,0 +1,11 @@
+# ERROR.H -- Error handling definitions.
+
+define SZ_XERMSG SZ_LINE # max length error message string
+define EA_FATAL 1 # take "fatal" error action
+define EA_ERROR 2 # take "error" error action
+define EA_WARN 3 # print warning message
+define EA_RESTART -99 # used by the system
+
+define SYS_XACV 501 # Exceptions
+define SYS_XARITH 502 # ALSO DEFINED in syserr.h
+define SYS_XINT 503
diff --git a/lib/evexpr.h b/lib/evexpr.h
new file mode 100644
index 00000000..88eec2e3
--- /dev/null
+++ b/lib/evexpr.h
@@ -0,0 +1,13 @@
+# EVEXPR.H -- Expression evaluation definitions; operand structure.
+
+define LEN_OPERAND 3 # size of operand structure
+define YYOPLEN LEN_OPERAND # for the parser
+define NTYPES 4 # number of operand datatypes
+
+define O_TYPE Memi[($1)] # operand type
+define O_LEN Memi[($1)+1] # operand length, if array
+define O_VALB Memb[($1)+2] # bool value (stored as int)
+define O_VALC Memc[Memi[($1)+2]] # string val (in string buffer)
+define O_VALI Memi[($1)+2] # int value
+define O_VALP Memi[($1)+2] # pointer value (same as int)
+define O_VALR Memr[P2R(($1)+2)] # real value
diff --git a/lib/evvexpr.h b/lib/evvexpr.h
new file mode 100644
index 00000000..c37ded5f
--- /dev/null
+++ b/lib/evvexpr.h
@@ -0,0 +1,24 @@
+# EVVEXPR.H -- Expression evaluation definitions; operand structure.
+
+define LEN_OPERAND 6 # size of operand structure
+define NTYPES 7 # bcsilrd, bool stored as int
+define YYOPLEN LEN_OPERAND # for the parser
+
+define O_TYPE Memi[($1)] # operand type
+define O_LEN Memi[($1)+1] # operand length, if array
+define O_FLAGS Memi[($1)+2] # flag bits
+ # align
+define O_VALC Memc[Memi[($1)+4]] # string val (in string buffer)
+define O_VALS Mems[P2S(($1)+4)] # short int value
+define O_VALI Memi[($1)+4] # bool or int value
+define O_VALL Meml[P2L(($1)+4)] # long int value
+define O_VALR Memr[P2R(($1)+4)] # real value
+define O_VALD Memd[P2D(($1)+4)] # double value
+define O_VALP Memi[($1)+4] # pointer
+
+# Operand flags.
+define O_FREEVAL 000001 # free data vector
+define O_FREEOP 000002 # free operand struct
+
+# evvexpr flags.
+define EV_RNGCHK 000001 # divzero etc.
diff --git a/lib/finfo.h b/lib/finfo.h
new file mode 100644
index 00000000..e8fee286
--- /dev/null
+++ b/lib/finfo.h
@@ -0,0 +1,39 @@
+# FINFO.H -- FINFO definitions (info on directory entries).
+
+define LEN_FINFO (6+16) # long finfo[LEN_FINFO]
+define FI_NINTFIELDS 6 # number of integer fields in struct
+define FI_SZOWNER 15 # char ownerid[FI_SZOWNER]
+
+define FI_TYPE $1[1] # file type (see below)
+define FI_SIZE $1[2] # file size, chars
+define FI_ATIME $1[3] # time of last access
+define FI_MTIME $1[4] # time of last modify
+define FI_CTIME $1[5] # time of file creation
+define FI_PERM $1[6] # permissions (owner,group,world)
+define FI_OWNER $1[7] # login name of file owner
+
+# File types.
+define FI_REGULAR 1 # regular text file
+define FI_DIRECTORY 2 # directory file
+define FI_EXEC 3 # executable image
+define FI_SPECIAL 4 # terminals etc.
+
+# FI_PERM bit assignments.
+define FI_ROWNER 1 # read perm for owner
+define FI_WOWNER 2 # write perm for owner
+define FI_RGROUP 3 # read perm for group
+define FI_WGROUP 4 # write perm for group
+define FI_RWORLD 5 # read perm for world
+define FI_WWORLD 6 # write perm for world
+define FI_RDLOCK 13 # temporary read lock in place
+define FI_WRLOCK 14 # temporary write lock in place
+
+# FI_PERM bit masks.
+define FF_ROWNER 000001B # same as above
+define FF_WOWNER 000002B
+define FF_RGROUP 000004B
+define FF_WGROUP 000010B
+define FF_RWORLD 000020B
+define FF_WWORLD 000040B
+define FF_RDLOCK 010000B
+define FF_WRLOCK 020000B
diff --git a/lib/fio.com b/lib/fio.com
new file mode 100644
index 00000000..e047ad5c
--- /dev/null
+++ b/lib/fio.com
@@ -0,0 +1,18 @@
+# FIO Common (prototype version with single local buffer)
+
+long boffset[LAST_FD] # char file offset of buffer
+pointer bufptr[LAST_FD] # pointer to file buffer, if any
+pointer buftop[LAST_FD] # pointer to top of file buffer
+pointer iop[LAST_FD] # or i/o pointer
+pointer itop[LAST_FD] # top of buffer for input
+pointer otop[LAST_FD] # top of buffer for output
+pointer fiodes[LAST_FD] # pointer to file descriptor
+int fflags[LAST_FD] # bit flags
+int redir_fd[LAST_FD] # fd of redir file if i/o redirected locally
+int zdev[LEN_DEVTBL] # device table
+int next_dev # next slot in device table
+pointer fp # file pointer of file most recently accessed
+char pathname[SZ_PATHNAME] # buffer for mapping file names
+
+common /fiocom/ boffset, bufptr, buftop, iop, itop, otop, fiodes, fflags,
+ redir_fd, zdev, next_dev, fp, pathname
diff --git a/lib/fio.h b/lib/fio.h
new file mode 100644
index 00000000..024cf1d4
--- /dev/null
+++ b/lib/fio.h
@@ -0,0 +1,149 @@
+# FIO.H -- FIO definitions.
+
+# Logical seek: adjust i/o pointer to the seek offset. If the buffer was
+# being written into when the seek occurs, adjust ITOP and OTOP to mark
+# the end of the good data in the buffer, then set IOP to new offset.
+
+define (UPDATE_IOP, if (bufptr[$1] != NULL && otop[$1] == buftop[$1]) {
+ itop[$1] = min(buftop[$1], max(itop[$1], iop[$1]))
+ otop[$1] = itop[$1]
+ })
+define (LSEEK, {UPDATE_IOP($1);iop[$1]=($2-boffset[$1]+bufptr[$1])})
+define LNOTE (boffset[$1]+iop[$1]-bufptr[$1])
+define BUF_MODIFIED (otop[$1] > bufptr[$1])
+
+define INACTIVE 0
+define READ_IN_PROGRESS 1
+define WRITE_IN_PROGRESS 2
+
+
+# File descriptor structure (dynamically allocated part)
+
+define SZ_FFNAME 255
+define LEN_FIODES (20+LEN_CHANDES+256)
+
+define FCHAN Memi[$1] # os channnel
+define FMODE Memi[$1+1] # mode of access
+define FTYPE Memi[$1+2] # binary or text
+define FDEV Memi[$1+3] # device index
+define FBUFSIZE Memi[$1+4] # buffer size
+define FIRSTBUFOFF Memi[$1+5] # offset of first file buffer
+define FNBUFS Memi[$1+6] # number of buffers
+define FLOCBUF Memi[$1+7] # zlocva of aread buffer
+define FPBBUFSIZE Memi[$1+8] # size pushback buffer
+define FPBBUF Memi[$1+9] # ptr to pushback buffer
+define FPBTOP Memi[$1+10] # ptr to top of pbbuf
+define FPBIOP Memi[$1+11] # iop into pbbuf
+define FPBSP Memi[$1+12] # pbbuf stack pointer
+define FILSTAT Memi[$1+13] # channel status
+define FNCHARS Memi[$1+14] # nchars last i/o
+define FNBYTES Memi[$1+15] # nbytes last rec read
+define FBUFMODE Memi[$1+16] # i/o mode for buffer
+define FFIOMODE Memi[$1+17] # i/o mode for file
+define FCD Memi[$1+18] # ptr to chan descr.
+ # (open)
+define FLCD ($1+20) # local storage for cd
+define FNAME Memc[P2C($1+20+LEN_CHANDES)] # filename
+
+# Channel descriptor (stored in fd if file not multiply open). The DEVPAR
+# (device parameter) fields are reserved for use with special devices and
+# are not used by FIO.
+
+define LEN_CHANDES (10+256)
+define FREFCNT Memi[FCD($1)] # chan reference count
+define FCIOMODE Memi[FCD($1)+1] # chan i/o mode
+define FCLOSEFD Memi[FCD($1)+2] # close chan when inactive
+define FAFD Memi[FCD($1)+3] # active fd
+define FBLKSIZE Memi[FCD($1)+4] # device block size
+define FOPTBUFSIZE Memi[FCD($1)+5] # "optimum" buffer size
+define FMAXBUFSIZE Memi[FCD($1)+6] # maximum buffer size
+define FDEVOPEN Memi[FCD($1)+7] # device zopen proc
+define FILSZ_PTR FCD($1)+8
+define FILSIZE Meml[FILSZ_PTR($1)] # file size, chars
+define FPKOSFN Memc[P2C(FCD($1)+10)] # packed osfn of file
+
+
+# Flags
+
+define FF_FLUSHNL 1B # flush each line to output device
+define FF_READ 2B # read perm on file
+define FF_WRITE 4B # write perm on file
+define FF_EOF 10B # at EOF
+define FF_ERR 20B # i/o error
+define FF_KEEP 40B # keep file open after task quits?
+define FF_FLUSH 100B # write each line to z buffer
+define FF_RAW 200B # raw i/o when reading a text device
+define FF_NDELAY 400B # nonblocking i/o
+define FF_PUSHBACK 1000B # data is pushed back into input
+
+
+# Device table entry points
+
+define LEN_DTE 7 # length of device table entry
+define TX_DRIVER 1 # index into devtbl of textfile driver
+define BF_DRIVER 8 # index of binary file driver
+define TY_DRIVER 15 # index of terminal driver
+define PR_DRIVER 22 # index of IPC driver
+define SF_DRIVER 29 # index of static file driver
+define STD_DRIVER ($1 <= 29) # is device code that of a std driver?
+
+define ZGETTX zdev[FDEV($1)] # text files
+define ZPUTTX zdev[FDEV($1)+1]
+define ZFLSTX zdev[FDEV($1)+2]
+define ZSTTTX zdev[FDEV($1)+3]
+define ZCLSTX zdev[FDEV($1)+4]
+define ZSEKTX zdev[FDEV($1)+5]
+define ZNOTTX zdev[FDEV($1)+6]
+
+define ZARDBF zdev[FDEV($1)] # binary files
+define ZAWRBF zdev[FDEV($1)+1]
+define ZAWTBF zdev[FDEV($1)+2]
+define ZSTTBF zdev[FDEV($1)+3]
+define ZCLSBF zdev[FDEV($1)+4]
+
+
+# File status codes (ZFSTTX, ZFSTTB). FIO makes a distinction between the
+# device block size, which establishes the alignment restrictions for
+# asynchronous reads and writes, and the "optimal" buffer size, the default
+# buffer size supplied by the device z-routines, which defines the minimum
+# buffer size for efficient sequential access to the device.
+
+define FSTT_BLKSIZE 1 # block size, bytes
+define FSTT_FILSIZE 2 # file size, bytes
+define FSTT_OPTBUFSIZE 3 # optimum buffer size, bytes
+define FSTT_MAXBUFSIZE 4 # optimum buffer size, bytes
+
+define REMOVE_PROTECTION 0 # for ZFPROT
+define SET_PROTECTION 1
+define QUERY_PROTECTION 2
+
+define STRING_FILE (-1) # open a string as a file
+define SZ_SPOOLBUF 4096 # def. initial size of a spool buffer
+
+
+# Filename Mapping definitions.
+
+define SZ_VFNFN 127 # max size ROOT or EXTN in VFN
+define SZ_OSDIR 255 # max chars in V_OSDIR field
+
+define VFN_READ 1 # VFN access modes for VFNOPEN
+define VFN_WRITE 2
+define VFN_UNMAP 3
+
+define VFN_NOUPDATE 0 # update flag for VFNCLOSE
+define VFN_UPDATE 1
+
+
+# Terminal driver escape sequences.
+
+define LEN_RAWCMD 5 # +1 for iomode character (N|B)
+define RAWOFF "\033-rAw" # raw mode off
+define RAWON "\033+rAw" # raw mode on
+
+define LEN_SETREDRAW 6 # 5 char escape sequence + code
+define SETREDRAW "\033=rDw" # set/enable screen redraw code
+
+
+# Magtape driver global definitions.
+
+define LEN_MTDEVPOS 5
diff --git a/lib/fmlfstat.h b/lib/fmlfstat.h
new file mode 100644
index 00000000..14df119b
--- /dev/null
+++ b/lib/fmlfstat.h
@@ -0,0 +1,10 @@
+# FMLFSTAT.H -- Lfile status structure definitions.
+
+# Lfstat structure.
+define LEN_LFSTAT 2 # struct size
+define LFU_SIZE $1[1] # lfile size, bytes
+define LFU_FLAGS $1[2] # lfile flag bits
+
+# Flag bits.
+define LFB_DELETED 1B # delete bit
+define LFB_TEXTFILE 2B # file contains packed text
diff --git a/lib/fmset.h b/lib/fmset.h
new file mode 100644
index 00000000..a271cc27
--- /dev/null
+++ b/lib/fmset.h
@@ -0,0 +1,24 @@
+# FMSET.H -- User definitions for FMIO.
+
+# SET/STAT codes.
+define FM_ACMODE 1 #RO datafile access mode
+define FM_FCACHESIZE 2 #RW number of files in open file cache
+define FM_MAXFBSIZE 3 #RW maximum lfile-FIO buffer size
+define FM_MAXLFILES 4 #RW number of lfiles in datafile
+define FM_MAXPTPAGES 5 #RW max page table pages (max filesize)
+define FM_OPTFBSIZE 6 #RW default lfile-FIO buffer size
+define FM_OSCHAN 7 #RO os channel of datafile
+define FM_PAGESIZE 8 #RW datafile page size, bytes
+define FM_VERSION 9 #RO FMIO version number of datafile
+
+# FM_DEBUG flags.
+define FMD_HEADER 001B # general header parameters
+define FMD_FTABLE 002B # summarize file table contents
+define FMD_PTINDEX 004B # print page table index
+define FMD_PTABLE 010B # print page table
+define FMD_ALL 017B # print everything
+
+# FM_FCDEBUG flags.
+define FCD_CACHE 001B # print current cache status
+define FCD_LFSTATISTICS 002B # print statistics on lfile getfd's
+define FCD_ALL 003B # print everything
diff --git a/lib/fset.h b/lib/fset.h
new file mode 100644
index 00000000..45bd385a
--- /dev/null
+++ b/lib/fset.h
@@ -0,0 +1,59 @@
+# FSET.H -- FSET/FSTATUS parameters (r = read_only, * = internal to FIO).
+# Some of these parameters provide access to the guts of the i/o system and
+# should not be used by packages outside FIO, to avoid a dependence on the
+# inner workings of FIO. Parameters affecting the file buffer number, types,
+# or sizes are read-only after the first i/o to the file.
+
+define F_ADVICE 1 # advice on type of access (rand,seq,def)
+define F_ASYNC 2 # enable asynchronous i/o [y/n]
+define F_BLKSIZE 3 #r device block size, chars
+define F_BUFPTR 4 #* install externally created file buffer
+define F_BUFSIZE 5 # file buffer size, chars
+define F_BUFTOP 6 #* set pointer to top of buffer
+define F_BUFTYPE 7 # file buffer type (F_LOCAL or F_GLOBAL)
+define F_CANCEL 8 # cancel buffered data
+define F_CHANNEL 9 #r channel number
+define F_CLOBBER 10 # is file clobber enabled [y/n]
+define F_CLOSEFD 11 # close host channel when inactive
+define F_DEVCODE 12 #* device driver code (index in device table)
+define F_DEVICE 13 #* entry point address device read/get routine
+define F_EOF 14 #r is file positioned at EOF [y/n]
+define F_FFIOMODE 15 #r is i/o in progress on channel
+define F_FILENAME 16 #r get file name (fstats)
+define F_FILESIZE 17 #r get file size (fstatl)
+define F_FILEWAIT 18 # is file wait on open enabled [y/n]
+define F_FIODES 19 #* struct pointer to file descriptor structure
+define F_FIRSTBUFOFF 20 # file offset of first FIO buffer (default=1)
+define F_FLUSHNL 21 # is flush on newline enabled [y/n]
+define F_IOMODE 22 # raw (vs "cooked") mode for terminal i/o
+define F_KEEP 23 # keep file after task completion?
+define F_LASTREFFILE 24 #r get FD of last referenced (active) file
+define F_MAXBUFSIZE 25 #r maximum file buffer size
+define F_MODE 26 #r file access mode (ro,wo,rw)
+define F_NBUFS 27 # number of file buffers
+define F_NCHARS 28 #r nchars last transfer
+define F_ONEVERSION 29 # keep only one version of a file
+define F_OPEN 30 #r is file open
+define F_OPTBUFSIZE 31 #r optimal buffer size for device (chars)
+define F_PBBSIZE 32 # push back buffer size, chars
+define F_RAW 33 #r set/stat raw mode (see F_IOMODE)
+define F_READ 34 #r does file have read access [y/n]
+define F_REDIR 35 #r i/o is redirected
+define F_SETREDRAW 36 #w set/enable screen redraw code (suspend proc)
+define F_SZBBLK 37 #r size in bytes of last dev block read|written
+define F_TYPE 38 #r file type (text, binary)
+define F_UNREAD 39 #r number of unread chars in FIO buffer
+define F_VALIDATE 40 # validate FIO buffer contents (fseti)
+define F_WRITE 41 #r does file have write access [y/n]
+
+define F_LOCAL 1 # allocate local file buffers
+define F_GLOBAL 2 # take file buffers from global pool
+define F_GETPROT 2 # is file protected?
+define F_FFIOINACT 0 # no i/o in progress
+define F_FFIOREAD 1 # read in progress
+define F_FFIOWRITE 2 # write in progress
+
+# Terminal mode stuff. I/O mode flags maybe combined, e.g., IO_RAW+IO_NDELAY.
+define IO_NORMAL 0 # "normal" terminal i/o
+define IO_RAW 001B # enables raw mode i/o
+define IO_NDELAY 100B # enables nonblocking i/o
diff --git a/lib/gescape.h b/lib/gescape.h
new file mode 100644
index 00000000..fa309102
--- /dev/null
+++ b/lib/gescape.h
@@ -0,0 +1,205 @@
+# GESCAPE.H -- Escape codes for the GIO gescape routine. These are GKI
+# functions not part of the standard GIO/GKI drawing function set. Usually
+# only specific graphics kernels will respond to these escape codes.
+# Other kernels ignore these escapes.
+
+# Plotter escapes.
+# --------------------------------
+
+define GSC_X_GKITODEV 1 # x scale; devunits/GKI_MAXNDC
+define GSC_Y_GKITODEV 2 # y scale; devunits/GKI_MAXNDC
+
+
+# Gterm widget imaging functions.
+# --------------------------------
+
+define GIM_RASTERINIT 10 # initialize imaging subsystem
+define GIM_RASTERINIT_LEN 0
+
+define GIM_CREATERASTER 11 # create or resize a raster
+define GIM_CREATERASTER_LEN 5
+define GIM_CREATERASTER_RN 1
+define GIM_CREATERASTER_RT 2
+define GIM_CREATERASTER_NX 3
+define GIM_CREATERASTER_NY 4
+define GIM_CREATERASTER_BP 5
+
+define GIM_DESTROYRASTER 12 # destroy a raster
+define GIM_DESTROYRASTER_LEN 1
+define GIM_DESTROYRASTER_RN 1
+
+define GIM_QUERYRASTER 13 # get raster type and size
+define GIM_QUERYRASTER_LEN 1
+define GIM_QUERYRASTER_RN 1
+
+define GIM_RET_QRAS_LEN 5 # return value for above
+define GIM_RET_QRAS_EX 1
+define GIM_RET_QRAS_RT 2
+define GIM_RET_QRAS_NX 3
+define GIM_RET_QRAS_NY 4
+define GIM_RET_QRAS_BP 5
+
+define GIM_SETRASTER 14 # set raster used for drawing context
+define GIM_SETRASTER_LEN 1
+define GIM_SETRASTER_RN 1
+
+define GIM_WRITEPIXELS 15 # write to a raster
+define GIM_WRITEPIXELS_LEN 7
+define GIM_WRITEPIXELS_RN 1
+define GIM_WRITEPIXELS_EC 2
+define GIM_WRITEPIXELS_X1 3
+define GIM_WRITEPIXELS_Y1 4
+define GIM_WRITEPIXELS_NX 5
+define GIM_WRITEPIXELS_NY 6
+define GIM_WRITEPIXELS_BP 7
+define GIM_WRITEPIXELS_DATA 8
+
+define GIM_READPIXELS 16 # read from a raster
+define GIM_READPIXELS_LEN 7
+define GIM_READPIXELS_RN 1
+define GIM_READPIXELS_EC 2
+define GIM_READPIXELS_X1 3
+define GIM_READPIXELS_Y1 4
+define GIM_READPIXELS_NX 5
+define GIM_READPIXELS_NY 6
+define GIM_READPIXELS_BP 7
+
+define GIM_RET_RPIX_LEN 1 # return value for above
+define GIM_RET_RPIX_NP 1
+
+define GIM_REFRESHPIXELS 17 # refresh a screen region
+define GIM_REFRESHPIXELS_LEN 6
+define GIM_REFRESHPIXELS_RN 1
+define GIM_REFRESHPIXELS_CT 2
+define GIM_REFRESHPIXELS_X1 3
+define GIM_REFRESHPIXELS_Y1 4
+define GIM_REFRESHPIXELS_NX 5
+define GIM_REFRESHPIXELS_NY 6
+
+define GIM_SETPIXELS 18 # set a region to a solid color
+define GIM_SETPIXELS_LEN 8
+define GIM_SETPIXELS_RN 1
+define GIM_SETPIXELS_CT 2
+define GIM_SETPIXELS_X1 3
+define GIM_SETPIXELS_Y1 4
+define GIM_SETPIXELS_NX 5
+define GIM_SETPIXELS_NY 6
+define GIM_SETPIXELS_CO 7
+define GIM_SETPIXELS_OP 8
+
+define GIM_WRITECMAP 19 # write to a colormap
+define GIM_WRITECMAP_LEN 3
+define GIM_WRITECMAP_MP 1
+define GIM_WRITECMAP_FC 2
+define GIM_WRITECMAP_NC 3
+define GIM_WRITECMAP_DATA 4
+
+define GIM_READCMAP 20 # read from a colormap
+define GIM_READCMAP_LEN 3
+define GIM_READCMAP_MP 1
+define GIM_READCMAP_FC 2
+define GIM_READCMAP_NC 3
+
+define GIM_RET_RCMAP_LEN 1 # return value for above
+define GIM_RET_RCMAP_NC 1
+
+define GIM_LOADCMAP 21 # load (and scale) colormap
+define GIM_LOADCMAP_LEN 4
+define GIM_LOADCMAP_MP 1
+define GIM_LOADCMAP_OF 2
+define GIM_LOADCMAP_DX 3
+define GIM_LOADCMAP_DY 4
+
+define GIM_LOADCMAP_SCALE 4
+
+define GIM_FREECMAP 22 # free a colormap
+define GIM_FREECMAP_LEN 1
+define GIM_FREECMAP_MP 1
+
+define GIM_WRITEIOMAP 23 # write to the iomap
+define GIM_WRITEIOMAP_LEN 2
+define GIM_WRITEIOMAP_FC 1
+define GIM_WRITEIOMAP_NC 2
+define GIM_WRITEIOMAP_DATA 3
+
+define GIM_READIOMAP 24 # read from the iomap
+define GIM_READIOMAP_LEN 2
+define GIM_READIOMAP_FC 1
+define GIM_READIOMAP_NC 2
+
+define GIM_RET_RIOMAP_LEN 1 # return value for above
+define GIM_RET_RIOMAP_NC 1
+
+define GIM_INITMAPPINGS 25 # destroy all mappings
+define GIM_INITMAPPINGS_LEN 0
+
+define GIM_FREEMAPPING 26 # free a mapping
+define GIM_FREEMAPPING_LEN 1
+define GIM_FREEMAPPING_MP 1
+
+define GIM_COPYRASTER 27 # copy part of a raster
+define GIM_COPYRASTER_LEN 13
+define GIM_COPYRASTER_OP 1
+define GIM_COPYRASTER_SR 2
+define GIM_COPYRASTER_ST 3
+define GIM_COPYRASTER_SX 4
+define GIM_COPYRASTER_SY 5
+define GIM_COPYRASTER_SW 6
+define GIM_COPYRASTER_SH 7
+define GIM_COPYRASTER_DR 8
+define GIM_COPYRASTER_DT 9
+define GIM_COPYRASTER_DX 10
+define GIM_COPYRASTER_DY 11
+define GIM_COPYRASTER_DW 12
+define GIM_COPYRASTER_DH 13
+
+define GIM_SETMAPPING 28 # set or modify a mapping
+define GIM_SETMAPPING_LEN 14
+define GIM_SETMAPPING_MP 1
+define GIM_SETMAPPING_OP 2
+define GIM_SETMAPPING_SR 3
+define GIM_SETMAPPING_ST 4
+define GIM_SETMAPPING_SX 5
+define GIM_SETMAPPING_SY 6
+define GIM_SETMAPPING_SW 7
+define GIM_SETMAPPING_SH 8
+define GIM_SETMAPPING_DR 9
+define GIM_SETMAPPING_DT 10
+define GIM_SETMAPPING_DX 11
+define GIM_SETMAPPING_DY 12
+define GIM_SETMAPPING_DW 13
+define GIM_SETMAPPING_DH 14
+
+define GIM_GETMAPPING 29 # get a mapping
+define GIM_GETMAPPING_LEN 1
+define GIM_GETMAPPING_MP 1
+
+define GIM_RET_GMAP_LEN 14 # return value for above
+define GIM_RET_GMAP_EN 1
+define GIM_RET_GMAP_OP 2
+define GIM_RET_GMAP_SR 3
+define GIM_RET_GMAP_ST 4
+define GIM_RET_GMAP_SX 5
+define GIM_RET_GMAP_SY 6
+define GIM_RET_GMAP_SW 7
+define GIM_RET_GMAP_SH 8
+define GIM_RET_GMAP_DR 9
+define GIM_RET_GMAP_DT 10
+define GIM_RET_GMAP_DX 11
+define GIM_RET_GMAP_DY 12
+define GIM_RET_GMAP_DW 13
+define GIM_RET_GMAP_DH 14
+
+define GIM_ENABLEMAPPING 30 # enable a mapping
+define GIM_ENABLEMAPPING_LEN 2
+define GIM_ENABLEMAPPING_MP 1
+define GIM_ENABLEMAPPING_FL 2
+
+define GIM_DISABLEMAPPING 31 # disable a mapping
+define GIM_DISABLEMAPPING_LEN 2
+define GIM_DISABLEMAPPING_MP 1
+define GIM_DISABLEMAPPING_FL 2
+
+define GIM_REFRESHMAPPING 32 # refresh a mapped region
+define GIM_REFRESHMAPPING_LEN 1
+define GIM_REFRESHMAPPING_MP 1
diff --git a/lib/gim.h b/lib/gim.h
new file mode 100644
index 00000000..def43cef
--- /dev/null
+++ b/lib/gim.h
@@ -0,0 +1,40 @@
+# GIM.H -- Public definitions for GIM graphics-imaging package.
+
+# Default static color assignments. Although explicit color names are used
+# here, the actual colors may be reassigned in the server. NOTE - do not
+# use LAST_COLOR to determine the index of the first dynamically allocatable
+# color cell; this value is device dependent and is set in graphcap.
+# FIRST_COLOR, LAST_COLOR are intended for use to programmatically cycle
+# through the static colors.
+
+define BACKGROUND 0
+define FOREGROUND 1
+define BLACK 0
+define WHITE 1
+define RED 2
+define GREEN 3
+define BLUE 4
+define CYAN 5
+define YELLOW 6
+define MAGENTA 7
+define AUX_COLOR_1 8
+define AUX_COLOR_2 9
+define FIRST_COLOR 2
+define LAST_COLOR 9
+
+# Max amount of pixel data passed in a single WritePixels or ReadPixels call.
+define GIM_MAXCHARS 32736
+
+# Raster type options (set to zero if don't care).
+define RT_NORMAL 1 # normal (client) raster
+define RT_CACHED 2 # cached in server memory
+
+# Coordinate type options.
+define CT_PIXEL 0 # raster pixel coordinates
+define CT_NDC 1 # normalized device coordinates
+
+# Rasterop fields.
+define R_OPCODEMASK 00017B # opcode bits
+define R_TRANSIENT 00020B # map only to screen
+define R_REFRESH_ALL 00040B # force refresh in setmapping
+define R_REFRESH_NONE 00100B # disable refresh in setmapping
diff --git a/lib/gio.h b/lib/gio.h
new file mode 100644
index 00000000..5400afc4
--- /dev/null
+++ b/lib/gio.h
@@ -0,0 +1,162 @@
+# GIO.H -- GIO package definitions.
+
+define MAX_WCS 16 # max user defined WCS
+define LEN_PLBUF 2048 # max points in a polyline
+define MAX_SZMARKER 4 # max standard marker sizes
+define POLYLINE 1 # G_PLTYPE values
+define POLYMARKER 2
+define FILLAREA 3
+define POINTMODE 4 # pointmode polymarker
+define LINEAR 0 # axis scaling functions
+define LOG 1
+define ELOG 2
+define DEF_CHARHEIGHT 0.0286 # default char height
+define DEF_CHARWIDTH 0.0125 # default char width
+
+# PSIO/CURSOR definitions.
+
+define KSHIFT 10000
+define DATA 0
+define XMIT 1
+define XFER 2
+define PSIO 3
+define OSCMD 4
+
+# WCS and attribute packet states. A modified packet must be "fixed" to
+# the device (by output of a GKI_SET instruction) before the associated
+# output instruction is issued.
+
+define UNSET 0 # initial state
+define MODIFIED 1 # modified internally
+define FIXED 2 # output in GKI stream
+
+# GP_FLAGS bit flag definitions. Lots of spare flag bits available.
+
+define GF_CLOSEFD 1 # close output file at gclose time
+define GF_WSOPEN 2 # workstation has been opened
+define GF_WSACTIVE 4 # workstation is activated
+
+# Graphics descriptor. The polyline, polymarker, text, and fill area
+# attributes and the GLABAX parameters for the X and Y axes are stored
+# in the descriptor as substructures.
+
+#define LEN_GDES 552
+define LEN_GDES 600
+define LEN_WCS 12
+define LEN_WCSARRAY (LEN_WCS*MAX_WCS)
+define SZ_DEVNAME 29
+define SZ_UIFNAME 199
+define SZ_TICKFORMAT 9
+
+define GP_FD Memi[$1] # graphics stream
+define GP_TTY Memi[$1+1] # graphcap descriptor
+define GP_GFLAGS Memi[$1+2] # GIO flag bits
+define GP_ACMODE Memi[$1+3] # gopen access mode
+define GP_WCS Memi[$1+4] # current WCS
+define GP_WCSSTATE Memi[$1+5] # unset, modifed, or fixed
+define GP_WCSORD Memi[$1+6] # unique WCS ordinal
+define GP_CURSOR Memi[$1+7] # current cursor number
+define GP_DEVASPECT Memr[P2R($1+8)] # device aspect ratio
+define GP_SZMARKER Memr[P2R($1+9+$2-1)] # standard marker sizes
+ # (extra space)
+define GP_PLAP ($1+20) # polyline attributes
+define GP_PMAP ($1+24) # polymarker attributes
+define GP_FAAP ($1+28) # fill area attributes
+define GP_TXAP ($1+31) # default text attributes
+define GP_TXAPCUR ($1+41) # text drawing attributes
+define GP_DRAWTITLE Memi[$1+55] # draw title on graph
+define GP_TITLESIZE Memr[P2R($1+56)] # character size of title
+define GP_TITLECOLOR Memi[$1+57] # color of title
+define GP_TITLEJUST Memi[$1+58] # title justification
+define GP_NTITLELINES Memi[$1+59] # number of lines in title
+define GP_FRAMECOLOR Memi[$1+60] # color of viewport frame
+define GP_FRAMEDRAWN Memi[$1+61] # set when frame first drawn
+define GP_ASPECT Memr[P2R($1+62)] # aspect ratio of viewport
+define GP_XAP ($1+65) # glabax parameters for X axis
+define GP_YAP ($1+100) # glabax parameters for Y axis
+define GP_DEVNAME Memc[P2C($1+135)] # gopen device name
+define GP_UIFNAME Memc[P2C($1+165)] # UI file name
+define GP_WCSPTR (($2)*LEN_WCS+($1)+367) # pointer to WCS substructure
+ # (367:571 aligned wcs storage, 17*12=204 units)
+ # (next=572)
+
+# Substructure definitions.
+
+define LEN_PL 4
+define PL_STATE Memi[$1] # polyline attributes
+define PL_LTYPE Memi[$1+1]
+define PL_WIDTH Memr[P2R($1+2)]
+define PL_COLOR Memi[$1+3]
+
+define LEN_PM 4
+define PM_STATE Memi[$1] # polymarker attributes
+define PM_LTYPE Memi[$1+1]
+define PM_WIDTH Memr[P2R($1+2)]
+define PM_COLOR Memi[$1+3]
+
+define LEN_FA 3
+define FA_STATE Memi[$1] # fill area attributes
+define FA_STYLE Memi[$1+1]
+define FA_COLOR Memi[$1+2]
+
+define LEN_TX 10
+define TX_STATE Memi[$1] # text attributes
+define TX_UP Memi[$1+1]
+define TX_SIZE Memr[P2R($1+2)]
+define TX_PATH Memi[$1+3]
+define TX_SPACING Memr[P2R($1+4)]
+define TX_HJUSTIFY Memi[$1+5]
+define TX_VJUSTIFY Memi[$1+6]
+define TX_FONT Memi[$1+7]
+define TX_QUALITY Memi[$1+8]
+define TX_COLOR Memi[$1+9]
+
+# GLABAX parameters for either axis.
+
+define LEN_GL 33
+define GL_DRAWAXES Memi[$1] # 0=none,1=first,2=second,3=both
+define GL_SETAXISPOS Memi[$1+1] # X axes to be drawn
+define GL_AXISPOS1 Memr[P2R($1+2)] # WCS coord of axis 1
+define GL_AXISPOS2 Memr[P2R($1+3)] # WCS coord of axis 2
+define GL_DRAWGRID Memi[$1+4] # draw grid between ticks
+define GL_GRIDCOLOR Memi[$1+5] # grid color
+define GL_ROUND Memi[$1+6] # extend WCS to next tick
+define GL_LABELAXIS Memi[$1+7] # draw the axis label
+define GL_AXISLABELSIZE Memr[P2R($1+8)] # char size of axis labels
+define GL_AXISLABELCOLOR Memi[$1+9] # char size of axis labels
+define GL_DRAWTICKS Memi[$1+10] # draw ticks
+define GL_LABELTICKS Memi[$1+11] # draw tick labels
+define GL_NMAJOR Memi[$1+12] # number of major ticks
+define GL_NMINOR Memi[$1+13] # number of minor ticks (if!log)
+define GL_MAJORLENGTH Memr[P2R($1+14)] # NDC length of major ticks
+define GL_MINORLENGTH Memr[P2R($1+15)] # NDC length of minor ticks
+define GL_MAJORWIDTH Memr[P2R($1+16)] # linewidth of major ticks
+define GL_MINORWIDTH Memr[P2R($1+17)] # linewidth of minor ticks
+define GL_AXISWIDTH Memr[P2R($1+18)] # linewidth of axis
+define GL_AXISCOLOR Memi[$1+19] # axis color
+define GL_TICKLABELSIZE Memr[P2R($1+20)] # char size of tick labels
+define GL_TICKLABELCOLOR Memi[$1+21] # char size of tick labels
+define GL_TICKCOLOR Memi[$1+22] # axis color
+define GL_TICKFORMAT Memc[P2C($1+23)] # printf format of ticks
+
+# WCS substructure.
+define WCS_WX1 Memr[P2R($1)] # window coordinates
+define WCS_WX2 Memr[P2R($1+1)]
+define WCS_WY1 Memr[P2R($1+2)]
+define WCS_WY2 Memr[P2R($1+3)]
+define WCS_SX1 Memr[P2R($1+4)] # viewport coordinates
+define WCS_SX2 Memr[P2R($1+5)]
+define WCS_SY1 Memr[P2R($1+6)]
+define WCS_SY2 Memr[P2R($1+7)]
+define WCS_XTRAN Memi[$1+8] # type of scaling (linear,log)
+define WCS_YTRAN Memi[$1+9]
+define WCS_FLAGS Memi[$1+10] # assorted flags
+define WCS_CLIP WCS_FLAGS # for backwards compatibility
+
+# WCS_FLAGS bitfields.
+define WF_DEFINED 00001B # WCS has been defined
+define WF_CLIP 00002B # clip at viewport boundary
+define WF_NEWFORMAT 00004B # new format WCS
+ # (reserved) # remaining bits reserved
+define WF_RASTER (and(($1)/512,0777B)) # get raster number
+define WF_SETRASTER (or(($1),($2)*512)) # set raster number
diff --git a/lib/gki.h b/lib/gki.h
new file mode 100644
index 00000000..9ecc62a6
--- /dev/null
+++ b/lib/gki.h
@@ -0,0 +1,188 @@
+# GKI.H -- Graphics Kernel Interface (GIO metacode instructions).
+
+define BOI -1 # do not parenthesize!
+define GKI_MAXNDC 32767 # maximum GKI coordinate
+define GKI_PACKREAL (($1)*1E2) # pack real in an int
+define GKI_UNPACKREAL (($1)/1E2) # unpack real from int
+define LEN_GKIDD 29 # device table size
+
+define TY_INLINE (-1) # flag inline kernel
+define TY_FILE 0 # flag normal file
+define KERNEL_PID (gk_type($1)) # get kernel pid
+define IS_FILE (gk_type($1)==0) # kernel is a file
+define IS_INLINE (gk_type($1)<0) # kernel is inline
+define IS_SUBKERNEL (gk_type($1)>0) # kernel is a subprocess
+
+define LEN_GKIHDR 3
+define GKI_HDR_BOI 1
+define GKI_HDR_OPCODE 2
+define GKI_HDR_LENGTH 3
+define GKI_DATAFIELDS 4
+
+define GKI_EOF 0
+define GKI_EOF_LEN 3
+define GKI_EOF_L 3
+
+define GKI_OPENWS 1
+define GKI_OPENWS_LEN 5
+define GKI_OPENWS_L 3
+define GKI_OPENWS_M 4
+define GKI_OPENWS_N 5
+define GKI_OPENWS_D 6
+
+define GKI_CLOSEWS 2
+define GKI_CLOSEWS_LEN 4
+define GKI_CLOSEWS_L 3
+define GKI_CLOSEWS_N 4
+define GKI_CLOSEWS_D 5
+
+define GKI_REACTIVATEWS 3
+define GKI_REACTIVATEWS_LEN 4
+define GKI_REACTIVATEWS_L 3
+define GKI_REACTIVATEWS_F 4
+
+define GKI_DEACTIVATEWS 4
+define GKI_DEACTIVATEWS_LEN 4
+define GKI_DEACTIVATEWS_L 3
+define GKI_DEACTIVATEWS_F 4
+
+define GKI_MFTITLE 5
+define GKI_MFTITLE_LEN 4
+define GKI_MFTITLE_L 3
+define GKI_MFTITLE_N 4
+define GKI_MFTITLE_T 5
+
+define GKI_CLEAR 6
+define GKI_CLEAR_LEN 3
+define GKI_CLEAR_L 3
+
+define GKI_CANCEL 7
+define GKI_CANCEL_LEN 3
+define GKI_CANCEL_L 3
+
+define GKI_FLUSH 8
+define GKI_FLUSH_LEN 3
+define GKI_FLUSH_L 3
+
+define GKI_POLYLINE 9
+define GKI_POLYLINE_LEN 4
+define GKI_POLYLINE_L 3
+define GKI_POLYLINE_N 4
+define GKI_POLYLINE_P 5
+
+define GKI_POLYMARKER 10
+define GKI_POLYMARKER_LEN 4
+define GKI_POLYMARKER_L 3
+define GKI_POLYMARKER_N 4
+define GKI_POLYMARKER_P 5
+
+define GKI_TEXT 11
+define GKI_TEXT_LEN 6
+define GKI_TEXT_L 3
+define GKI_TEXT_P 4
+define GKI_TEXT_N 6
+define GKI_TEXT_T 7
+
+define GKI_FILLAREA 12
+define GKI_FILLAREA_LEN 4
+define GKI_FILLAREA_L 3
+define GKI_FILLAREA_N 4
+define GKI_FILLAREA_P 5
+
+define GKI_PUTCELLARRAY 13
+define GKI_PUTCELLARRAY_LEN 9
+define GKI_PUTCELLARRAY_L 3
+define GKI_PUTCELLARRAY_LL 4
+define GKI_PUTCELLARRAY_UR 6
+define GKI_PUTCELLARRAY_NC 8
+define GKI_PUTCELLARRAY_NL 9
+define GKI_PUTCELLARRAY_P 10
+
+define GKI_SETCURSOR 14
+define GKI_SETCURSOR_LEN 6
+define GKI_SETCURSOR_L 3
+define GKI_SETCURSOR_CN 4
+define GKI_SETCURSOR_POS 5
+
+define GKI_PLSET 15
+define GKI_PLSET_LEN 6
+define GKI_PLSET_L 3
+define GKI_PLSET_LT 4
+define GKI_PLSET_LW 5
+define GKI_PLSET_CI 6
+
+define GKI_PMSET 16
+define GKI_PMSET_LEN 6
+define GKI_PMSET_L 3
+define GKI_PMSET_MT 4
+define GKI_PMSET_MW 5
+define GKI_PMSET_CI 6
+
+define GKI_TXSET 17
+define GKI_TXSET_LEN 12
+define GKI_TXSET_L 3
+define GKI_TXSET_UP 4
+define GKI_TXSET_SZ 5
+define GKI_TXSET_SP 6
+define GKI_TXSET_P 7
+define GKI_TXSET_HJ 8
+define GKI_TXSET_VJ 9
+define GKI_TXSET_F 10
+define GKI_TXSET_Q 11
+define GKI_TXSET_CI 12
+
+define GKI_FASET 18
+define GKI_FASET_LEN 5
+define GKI_FASET_L 3
+define GKI_FASET_FS 4
+define GKI_FASET_CI 5
+
+define GKI_GETCURSOR 19
+define GKI_GETCURSOR_LEN 4
+define GKI_GETCURSOR_L 3
+define GKI_GETCURSOR_CN 4
+
+define GKI_CURSORVALUE 19
+define GKI_CURSORVALUE_LEN 10
+define GKI_CURSORVALUE_L 3
+define GKI_CURSORVALUE_CN 4
+define GKI_CURSORVALUE_KEY 5
+define GKI_CURSORVALUE_SX 6
+define GKI_CURSORVALUE_SY 7
+define GKI_CURSORVALUE_RN 8
+define GKI_CURSORVALUE_RX 9
+define GKI_CURSORVALUE_RY 10
+
+define GKI_GETCELLARRAY 20
+define GKI_GETCELLARRAY_LEN 9
+define GKI_GETCELLARRAY_L 3
+define GKI_GETCELLARRAY_LL 4
+define GKI_GETCELLARRAY_UR 6
+define GKI_GETCELLARRAY_NC 8
+define GKI_GETCELLARRAY_NL 9
+
+define GKI_CELLARRAY 20
+define GKI_CELLARRAY_LEN 4
+define GKI_CELLARRAY_L 3
+define GKI_CELLARRAY_NP 4
+define GKI_CELLARRAY_P 5
+
+define GKI_UNKNOWN 24
+
+define GKI_ESCAPE 25
+define GKI_ESCAPE_LEN 5
+define GKI_ESCAPE_L 3
+define GKI_ESCAPE_FN 4
+define GKI_ESCAPE_N 5
+define GKI_ESCAPE_DC 6
+
+define GKI_SETWCS 26
+define GKI_SETWCS_LEN 4
+define GKI_SETWCS_L 3
+define GKI_SETWCS_N 4
+define GKI_SETWCS_WCS 5
+
+define GKI_GETWCS 27
+define GKI_GETWCS_LEN 4
+define GKI_GETWCS_L 3
+define GKI_GETWCS_N 4
diff --git a/lib/gset.h b/lib/gset.h
new file mode 100644
index 00000000..9a1784a1
--- /dev/null
+++ b/lib/gset.h
@@ -0,0 +1,196 @@
+# GSET.H -- GIO internal parameters and magic constants defining possible
+# parameter values.
+
+define G_FD 1 # general graphics parameters
+define G_TTY 2
+define G_WCS 3
+define G_XTRAN 4
+define G_YTRAN 5
+define G_CLIP 6
+define G_CURSOR 7
+define G_SZMARKER1 8
+define G_SZMARKER2 9
+define G_SZMARKER3 10
+define G_SZMARKER4 11
+define G_DEVNAME 12
+
+define G_PLSTATE 13 # polyline attributes
+define G_PLTYPE 14
+define G_PLWIDTH 15
+define G_PLCOLOR 16
+
+define G_PMSTATE 17 # polymarker attributes
+define G_PMLTYPE 18
+define G_PMWIDTH 19
+define G_PMCOLOR 20
+
+define G_TXSTATE 21 # text drawing attributes
+define G_TXUP 22
+define G_TXSIZE 23
+define G_TXPATH 24
+define G_TXSPACING 25
+define G_TXHJUSTIFY 26
+define G_TXVJUSTIFY 27
+define G_TXFONT 28
+define G_TXQUALITY 29
+define G_TXCOLOR 30
+
+define G_FASTATE 31 # fill area attributes
+define G_FASTYLE 32
+define G_FACOLOR 33
+
+define G_DRAWTITLE 34 # GLABAX, general parameters
+define G_TITLESIZE 35
+define G_TITLEJUST 36
+define G_NTITLELINES 37
+define G_ASPECT 38
+define G_CHARSIZE 39 # char height in NDC units
+define G_TITLECOLOR 40
+define G_FRAMECOLOR 41
+define G_DRIDCOLOR 42
+
+define G_RASTER 43 # recent additions
+
+
+# GLABAX parameters.
+# ------------------
+
+define FIRST_GLABAX_PARAM 101
+define LAST_GLABAX_PARAM 324
+
+define G_XDRAWAXES 101 # GLABAX, x axis parameters
+define G_XSETAXISPOS 102
+define G_XAXISPOS1 103
+define G_XAXISPOS2 104
+define G_XDRAWGRID 105
+define G_XROUND 106
+define G_XLABELAXIS 107
+define G_XAXISLABELSIZE 108
+define G_XDRAWTICKS 109
+define G_XLABELTICKS 110
+define G_XNMAJOR 111
+define G_XNMINOR 112
+define G_XMAJORLENGTH 113
+define G_XMINORLENGTH 114
+define G_XMAJORWIDTH 115
+define G_XMINORWIDTH 116
+define G_XAXISWIDTH 117
+define G_XTICKLABELSIZE 118
+define G_XTICKFORMAT 119
+define G_XGRIDCOLOR 120
+define G_XAXISLABELCOLOR 121
+define G_XAXISCOLOR 122
+define G_XTICKLABELCOLOR 123
+define G_XTICKCOLOR 124
+
+define G_YDRAWAXES 201 # GLABAX, y axis parameters
+define G_YSETAXISPOS 202
+define G_YAXISPOS1 203
+define G_YAXISPOS2 204
+define G_YDRAWGRID 205
+define G_YROUND 206
+define G_YLABELAXIS 207
+define G_YAXISLABELSIZE 208
+define G_YDRAWTICKS 209
+define G_YLABELTICKS 210
+define G_YNMAJOR 211
+define G_YNMINOR 212
+define G_YMAJORLENGTH 213
+define G_YMINORLENGTH 214
+define G_YMAJORWIDTH 215
+define G_YMINORWIDTH 216
+define G_YAXISWIDTH 217
+define G_YTICKLABELSIZE 218
+define G_YTICKFORMAT 219
+define G_YGRIDCOLOR 220
+define G_YAXISLABELCOLOR 221
+define G_YAXISCOLOR 222
+define G_YTICKLABELCOLOR 223
+define G_YTICKCOLOR 224
+
+define G_DRAWAXES 301 # GLABAX, simultaneous x and y
+define G_SETAXISPOS 302
+define G_AXISPOS1 303
+define G_AXISPOS2 304
+define G_DRAWGRID 305
+define G_ROUND 306
+define G_LABELAXIS 307
+define G_AXISLABELSIZE 308
+define G_DRAWTICKS 309
+define G_LABELTICKS 310
+define G_NMAJOR 311
+define G_NMINOR 312
+define G_MAJORLENGTH 313
+define G_MINORLENGTH 314
+define G_MAJORWIDTH 315
+define G_MINORWIDTH 316
+define G_AXISWIDTH 317
+define G_TICKLABELSIZE 318
+define G_TICKFORMAT 319
+define G_GRIDCOLOR 320
+define G_AXISLABELCOLOR 321
+define G_AXISCOLOR 322
+define G_TICKLABELCOLOR 323
+define G_TICKCOLOR 324
+
+
+# Graphics operand types.
+# -------------------------
+
+define GW_LINEAR 0 # WCS transformation types
+define GW_LOG 1
+define GW_ELOG 2
+
+define AW_DEFER 100 # Defer OPENWS (gopen mode)
+define AW_PAUSE 1 # De/Reactive ws flags
+define AW_CLEAR 2
+
+define GL_CLEAR 0 # polyline attribute values
+define GL_SOLID 1
+define GL_DASHED 2
+define GL_DOTTED 3
+define GL_DOTDASH 4
+
+define GM_FIRSTMARK 1
+define GM_LASTMARK 9
+
+define GM_POINT 0 # polymarker attribute values
+define GM_FILL 1
+define GM_BOX 2
+define GM_PLUS 4
+define GM_CROSS 8
+define GM_DIAMOND 16
+define GM_HLINE 32
+define GM_VLINE 64
+define GM_HEBAR 128
+define GM_VEBAR 256
+define GM_CIRCLE 512
+
+define GT_NORMAL 0 # text attribute values
+define GT_CENTER 1
+define GT_LEFT 2
+define GT_RIGHT 3
+define GT_UP 4
+define GT_DOWN 5
+define GT_TOP 6
+define GT_BOTTOM 7
+define GT_ROMAN 8
+define GT_GREEK 9
+define GT_ITALIC 10
+define GT_BOLD 11
+define GT_LOW 12
+define GT_MEDIUM 13
+define GT_HIGH 14
+
+define GF_CLEAR 0 # fill area attribute values
+define GF_HOLLOW 1
+define GF_SOLID 2
+define GF_HATCH1 3
+define GF_HATCH2 4
+define GF_HATCH3 5
+define GF_HATCH4 6
+
+define GR_RESETALL 777B # GRESET flag bits
+define GR_RESETGIO 1
+define GR_RESETWCS 2
+define GR_RESETGLABAX 4
diff --git a/lib/helpdb.mip b/lib/helpdb.mip
new file mode 100644
index 00000000..b6c4c28c
--- /dev/null
+++ b/lib/helpdb.mip
Binary files differ
diff --git a/lib/imhdr.h b/lib/imhdr.h
new file mode 100644
index 00000000..dcd04d59
--- /dev/null
+++ b/lib/imhdr.h
@@ -0,0 +1,79 @@
+# IMHDR.H -- Image Header Definitions. The structure definitions in this file
+# assume two or less chars per struct unit (e.g., a one or two byte char).
+
+define IM_MAXDIM 7 # maximum dimension of image
+define SZ_IMMAGIC 5 # used to verify structure
+define SZ_IMPIXFILE 255 # name of pixel storage file
+define SZ_IMHDRFILE 255 # name of header storage file
+define SZ_IMTITLE 383 # image title string
+define SZ_IMHIST 1023 # image history record
+define SZ_BUNIT 9 # brightness units string
+define SZ_CTYPE 9 # coord axes units string
+
+define IMH_MAGICSTR "imhdr" # file identification string
+define PIX_MAGICSTR "impix" # file identification string
+
+# The IMIO image header structure.
+
+# Parameters.
+define LEN_IMDES 200 # length of image descriptor
+define LEN_IMHDR 1024 # length of std header
+define IMD LEN_IMDES # offset to std header fields
+define IMU (LEN_IMDES+LEN_IMHDR) # offset to user fields
+define IM_USERAREA (P2C($1+IMU)) # user area (database)
+
+# Disk resident header.
+define IM_MAGIC Memi[$1+IMD] # contains the string "imhdr"
+define IM_HDRLEN Memi[$1+IMD+3] # length of image header
+define IM_HDRVER Memi[$1+IMD+4] # image format version
+define IM_PIXTYPE Memi[$1+IMD+5] # datatype of the pixels
+define IM_SWAPPED Memi[$1+IMD+6] # pixels are byte swapped
+define IM_NDIM Memi[$1+IMD+7] # number of dimensions
+define IM_LEN Meml[$1+IMD+$2+8-1] # length of the dimensions
+define IM_PHYSLEN Meml[$1+IMD+$2+15-1] # physical length (as stored)
+define IM_SSMTYPE Meml[$1+IMD+22] # type of subscript mapping
+define IM_LUTOFF Meml[$1+IMD+23] # offset to subscript map luts
+define IM_PIXOFF Meml[$1+IMD+24] # offset of the pixels
+define IM_HGMOFF Meml[$1+IMD+25] # offset of hgm pixels
+define IM_BLIST Meml[$1+IMD+26] # offset of bad pixel list
+define IM_SZBLIST Meml[$1+IMD+27] # size of bad pixel list
+define IM_NBPIX Meml[$1+IMD+28] # number of bad pixels
+define IM_CTIME Meml[$1+IMD+29] # time of image creation
+define IM_MTIME Meml[$1+IMD+30] # time of last modify
+define IM_LIMTIME Meml[$1+IMD+31] # time min,max computed
+define IM_MAX Memr[P2R($1+IMD+32)] # max pixel value
+define IM_MIN Memr[P2R($1+IMD+33)] # min pixel value
+define IM_PIXFILE Memc[P2C($1+IMD+37)] # name of pixel storage file
+define IM_HDRFILE Memc[P2C($1+IMD+165)] # name of header storage file
+define IM_TITLE Memc[P2C($1+IMD+293)] # image name string
+define IM_HISTORY Memc[P2C($1+IMD+485)] # history comment string
+
+# The Histogram structure (field IM_HGM)
+define LEN_HGMSTRUCT 20
+define HGM_TIME Meml[$1] # time when hgm was computed
+define HGM_LEN Meml[$1+1] # number of bins in hgm
+define HGM_NPIX Meml[$1+2] # npix used to compute hgm
+define HGM_MIN Memr[P2R($1+3)] # min hgm value
+define HGM_MAX Memr[P2R($1+4)] # max hgm value
+define HGM_INTEGRAL Memr[P2R($1+5)] # integral of hgm
+define HGM_MEAN Memr[P2R($1+6)] # mean value
+define HGM_VARIANCE Memr[P2R($1+7)] # variance about mean
+define HGM_SKEWNESS Memr[P2R($1+8)] # skewness of hgm
+define HGM_MODE Memr[P2R($1+9)] # modal value of hgm
+define HGM_LCUT Memr[P2R($1+10)] # low cutoff value
+define HGM_HCUT Memr[P2R($1+11)] # high cutoff value
+# next available field: ($1+12)
+
+
+# The Coordinate Transformation Structure (IM_CTRAN)
+define LEN_CTSTRUCT 50
+define CT_VALID Memi[$1] # (y/n) is structure valid?
+define CT_BSCALE Memr[P2R($1+1)] # pixval scale factor
+define CT_BZERO Memr[P2R($1+2)] # pixval offset
+define CT_CRVAL Memr[P2R($1+$2+3-1)] # value at pixel
+define CT_CRPIX Memr[P2R($1+$2+10-1)] # index of pixel
+define CT_CDELT Memr[P2R($1+$2+17-1)] # increment along axis
+define CT_CROTA Memr[P2R($1+$2+24-1)] # rotation angle
+define CT_BUNIT Memc[P2C($1+31)] # pixval ("brightness") units
+define CT_CTYPE Memc[P2C($1+36)] # coord units string
+# next available field: ($1+41)
diff --git a/lib/imio.h b/lib/imio.h
new file mode 100644
index 00000000..f4698ee2
--- /dev/null
+++ b/lib/imio.h
@@ -0,0 +1,93 @@
+# IMIO.H -- IMIO internal definitions.
+
+define DEF_PIXTYPE TY_REAL # pixel type on disk
+define DEF_HGMLEN 512 # length of histogram
+define DEF_COMPRESS NO # align lines on blk boundaries
+define DEF_ADVICE SEQUENTIAL # type of access to optimize for
+define DEF_FIOBUFFRAC 10 # FIO buf as percent of image
+define DEF_FIOBUFSIZE 262144 # default FIO buffer size
+define DEF_MAXFIOBUFSIZE 16777216 # "soft" max FIO buffer size
+define MAX_HGMLEN 2048 # maximum size histogram
+define IM_MAXSTEP 64 # step size breakpoint
+define MIN_LENUSERAREA 64000 # user area size (chars)
+define SZ_UAPAD 5120 # padding at end of UA if copy
+define SZ_IMNAME 128 # IM_NAME field (prev 79)
+
+define ENV_BUFSIZE "IMIO_BUFSIZE" # envvar for bufsize
+define ENV_BUFFRAC "IMIO_BUFFRAC" # envvar for buffrac
+define ENV_BUFMAX "IMIO_BUFMAX" # envvar for bufmax
+
+define LOOP_DONE 1 # used by IMLOOP
+define LOOP_AGAIN 0
+define IM_READ 0 # used by IMCSSZ
+define IM_WRITE 1
+
+# The IMIO runtime Image Descriptor Structure.
+
+define LEN_IMDES 200
+
+define IM_FILESIZE Meml[$1] # size of pixfile
+define IM_NGET Meml[$1+1] # number getpix calls
+define IM_ACMODE Memi[$1+2] # access mode (ro, rw, etc.)
+define IM_VNBUFS Memi[$1+3] # number of in buffers
+define IM_VCOMPRESS Memi[$1+4] # if YES, len[i] == physlen[i]
+define IM_VADVICE Memi[$1+5] # expected type of access
+define IM_VBUFSIZE Memi[$1+6] # recommended FIO buffer size
+define IM_VBUFFRAC Memi[$1+7] # FIO buffer as image fraction
+define IM_VBUFMAX Memi[$1+8] # max FIO buffer size
+define IM_VCLOSEFD Memi[$1+9] # set F_CLOSEFD on pixfile
+define IM_VNBNDRYPIX Memi[$1+10] # npixels of boundary extension
+define IM_VTYBNDRY Memi[$1+11] # type of boundary extension
+define IM_VFLAGBADPIX Memi[$1+12] # flag bad pixels upon input
+define IM_FLUSH Memi[$1+13] # flush outbuf?
+define IM_UPDATE Memi[$1+14] # update header?
+define IM_FLUSHEPA Memi[$1+15] # epa of imfls? routine
+define IM_IBDES Memi[$1+16] # input bufdes
+define IM_OBDES Memi[$1+17] # output bufdes
+define IM_LASTBDES Memi[$1+18] # last buffer accessed
+define IM_OHDR Memi[$1+19] # if newcopy, ptr to old header
+define IM_NPHYSDIM Memi[$1+20] # number of physical dims
+define IM_SECTUSED Memi[$1+21] # image section in use
+define IM_FAST Memi[$1+22] # fast i/o permitted
+define IM_SWAP Memi[$1+23] # byte swapping required
+define IM_SVMTIME Meml[$1+24] # new time of last modify
+define IM_OOBPIX Memr[P2R($1+25)] # value for out of bounds pixels
+define IM_KERNEL Memi[$1+26] # IKI kernel assigned (runtime)
+define IM_KDES Memi[$1+27] # IKI kernel descriptor
+define IM_HFD Memi[$1+28] # header file descriptor
+define IM_PFD Memi[$1+29] # pixel file descriptor
+define IM_LENHDRMEM Memi[$1+30] # descr. length, IM_MAGIC to end
+define IM_UABLOCKED Memi[$1+31] # user area blocked, 80 chars
+define IM_CLINDEX Memi[$1+32] # index of image in cluster
+define IM_CLSIZE Memi[$1+33] # no. images in cluster
+define IM_PL Memi[$1+34] # PL descriptor if mask image
+define IM_PLREFIM Memi[$1+35] # PL reference image if any
+define IM_PLFLAGS Memi[$1+36] # PL mask i/o flags
+ # (extra space)
+define IM_SVLEN Meml[$1+$2+40-1] # save true axis lengths
+define IM_VMAP Memi[$1+$2+47-1] # map section dimensions
+define IM_VOFF Meml[$1+$2+54-1] # section offsets
+define IM_VSTEP Memi[$1+$2+61-1] # section sample step size
+define IM_NAME Memc[P2C($1+68)] # imagefile name
+ # (extra space)
+
+# IM_PLFLAGS bit flags.
+define PL_ACMODE mod($1,100B) # extract access mode
+define PL_FLAGS (($1)/100B*100B) # extract flags bits
+
+define PL_RLIO 1 # range list i/o desired
+define PL_FAST 2 # no pixel conversions needed
+define PL_CLOSEPL 4 # close descriptor at imunmap
+define PL_BOOL 8 # boolean mask
+
+# Buffer Descriptor Structure
+
+define LEN_BDES 19
+
+define BD_BUFPTR Memi[$1] # buffer pointer
+define BD_DTYPE Memi[$1+1] # datatype of pixels
+define BD_NPIX Memi[$1+2] # number of pixels in buf
+define BD_NDIM Memi[$1+3] # dimensionality of section
+define BD_BUFSIZE Memi[$1+4] # buffer size, chars
+define BD_VS Meml[$1+$2+5-1] # section start vector
+define BD_VE Meml[$1+$2+12-1] # section end vector
diff --git a/lib/imset.h b/lib/imset.h
new file mode 100644
index 00000000..c6e86db7
--- /dev/null
+++ b/lib/imset.h
@@ -0,0 +1,29 @@
+# IMSET.H -- Definitions for IMIO user settable options.
+
+define IM_ADVICE 1 # RANDOM or SEQUENTIAL
+define IM_NBUFS 2 # number of input buffers
+define IM_COMPRESS 3 # align lines on device blocks?
+define IM_NBNDRYPIX 4 # width of boundary region
+define IM_TYBNDRY 5 # type of boundary extension
+define IM_FLAGBADPIX 6 # set bad pix to INDEF
+define IM_PIXFD 7 # pixfile fd (special devices)
+define IM_WHEADER 8 # update image header at unmap time
+define IM_BNDRYPIXVAL 9 # for option IM_CONSTANT
+define IM_CANCEL 10 # free any pixel data buffers
+define IM_CLOSEFD 11 # set F_CLOSEFD on pixfile
+define IM_BUFSIZE 12 # recommended FIO buffer size, chars
+define IM_BUFFRAC 13 # FIO buffer as a fraction of full image
+define IM_BUFMAX 14 # max size FIO buffer, chars
+define IM_IMAGENAME 15 # name of open image section
+define IM_PLDES 16 # pixel mask descriptor
+define IM_RLIO 17 # enable range list i/o (image masks)
+
+define IM_PMDES IM_PLDES
+
+# Types of Boundary Extension
+
+define BT_CONSTANT 1 # return constant if out of bounds
+define BT_NEAREST 2 # return nearest boundary pixel
+define BT_REFLECT 3 # reflect back into image
+define BT_WRAP 4 # wrap around to other side
+define BT_PROJECT 5 # project about boundary
diff --git a/lib/lexnum.h b/lib/lexnum.h
new file mode 100644
index 00000000..a2742a2a
--- /dev/null
+++ b/lib/lexnum.h
@@ -0,0 +1,7 @@
+# LEXNUM.H -- Token codes returned by lexnum.
+
+define LEX_OCTAL -4 # reduce octal
+define LEX_DECIMAL -3 # reduce decimal
+define LEX_HEX -2 # reduce hex
+define LEX_REAL -1 # reduce real
+define LEX_NONNUM 0 # reduce non-numeric
diff --git a/lib/libbev.a b/lib/libbev.a
new file mode 120000
index 00000000..cea268b7
--- /dev/null
+++ b/lib/libbev.a
@@ -0,0 +1 @@
+../bin/libbev.a \ No newline at end of file
diff --git a/lib/libc.a b/lib/libc.a
new file mode 120000
index 00000000..22e15809
--- /dev/null
+++ b/lib/libc.a
@@ -0,0 +1 @@
+../bin/libc.a \ No newline at end of file
diff --git a/lib/libcur.a b/lib/libcur.a
new file mode 120000
index 00000000..86c18725
--- /dev/null
+++ b/lib/libcur.a
@@ -0,0 +1 @@
+../bin/libcur.a \ No newline at end of file
diff --git a/lib/libcurfit.a b/lib/libcurfit.a
new file mode 120000
index 00000000..c43bfa5e
--- /dev/null
+++ b/lib/libcurfit.a
@@ -0,0 +1 @@
+../bin/libcurfit.a \ No newline at end of file
diff --git a/lib/libdeboor.a b/lib/libdeboor.a
new file mode 120000
index 00000000..26126a03
--- /dev/null
+++ b/lib/libdeboor.a
@@ -0,0 +1 @@
+../bin/libdeboor.a \ No newline at end of file
diff --git a/lib/libds.a b/lib/libds.a
new file mode 120000
index 00000000..80c1fb40
--- /dev/null
+++ b/lib/libds.a
@@ -0,0 +1 @@
+../bin/libds.a \ No newline at end of file
diff --git a/lib/libex.a b/lib/libex.a
new file mode 120000
index 00000000..9acab26a
--- /dev/null
+++ b/lib/libex.a
@@ -0,0 +1 @@
+../bin/libex.a \ No newline at end of file
diff --git a/lib/libgks.a b/lib/libgks.a
new file mode 120000
index 00000000..6cf580b1
--- /dev/null
+++ b/lib/libgks.a
@@ -0,0 +1 @@
+../bin/libgks.a \ No newline at end of file
diff --git a/lib/libgsurfit.a b/lib/libgsurfit.a
new file mode 120000
index 00000000..a01d338a
--- /dev/null
+++ b/lib/libgsurfit.a
@@ -0,0 +1 @@
+../bin/libgsurfit.a \ No newline at end of file
diff --git a/lib/libimc.a b/lib/libimc.a
new file mode 120000
index 00000000..166112e0
--- /dev/null
+++ b/lib/libimc.a
@@ -0,0 +1 @@
+../bin/libimc.a \ No newline at end of file
diff --git a/lib/libimd.a b/lib/libimd.a
new file mode 120000
index 00000000..ff0076f4
--- /dev/null
+++ b/lib/libimd.a
@@ -0,0 +1 @@
+../bin/libimd.a \ No newline at end of file
diff --git a/lib/libimfort.a b/lib/libimfort.a
new file mode 120000
index 00000000..c9097634
--- /dev/null
+++ b/lib/libimfort.a
@@ -0,0 +1 @@
+../bin/libimfort.a \ No newline at end of file
diff --git a/lib/libiminterp.a b/lib/libiminterp.a
new file mode 120000
index 00000000..d6f1bfb0
--- /dev/null
+++ b/lib/libiminterp.a
@@ -0,0 +1 @@
+../bin/libiminterp.a \ No newline at end of file
diff --git a/lib/libinterp.a b/lib/libinterp.a
new file mode 120000
index 00000000..9a87e190
--- /dev/null
+++ b/lib/libinterp.a
@@ -0,0 +1 @@
+../bin/libinterp.a \ No newline at end of file
diff --git a/lib/libllsq.a b/lib/libllsq.a
new file mode 120000
index 00000000..0d7fcba5
--- /dev/null
+++ b/lib/libllsq.a
@@ -0,0 +1 @@
+../bin/libllsq.a \ No newline at end of file
diff --git a/lib/libmemdbg.a b/lib/libmemdbg.a
new file mode 120000
index 00000000..24e81f88
--- /dev/null
+++ b/lib/libmemdbg.a
@@ -0,0 +1 @@
+../bin/libmemdbg.a \ No newline at end of file
diff --git a/lib/libncar.a b/lib/libncar.a
new file mode 120000
index 00000000..34a914d1
--- /dev/null
+++ b/lib/libncar.a
@@ -0,0 +1 @@
+../bin/libncar.a \ No newline at end of file
diff --git a/lib/libnlfit.a b/lib/libnlfit.a
new file mode 120000
index 00000000..24ae3e00
--- /dev/null
+++ b/lib/libnlfit.a
@@ -0,0 +1 @@
+../bin/libnlfit.a \ No newline at end of file
diff --git a/lib/libreadline.a b/lib/libreadline.a
new file mode 120000
index 00000000..9ae1a27c
--- /dev/null
+++ b/lib/libreadline.a
@@ -0,0 +1 @@
+../bin/libreadline.a \ No newline at end of file
diff --git a/lib/libsgi.a b/lib/libsgi.a
new file mode 120000
index 00000000..e45a0bb7
--- /dev/null
+++ b/lib/libsgi.a
@@ -0,0 +1 @@
+../bin/libsgi.a \ No newline at end of file
diff --git a/lib/libslalib.a b/lib/libslalib.a
new file mode 120000
index 00000000..b5971067
--- /dev/null
+++ b/lib/libslalib.a
@@ -0,0 +1 @@
+../bin/libslalib.a \ No newline at end of file
diff --git a/lib/libstg.a b/lib/libstg.a
new file mode 120000
index 00000000..3f13c5d1
--- /dev/null
+++ b/lib/libstg.a
@@ -0,0 +1 @@
+../bin/libstg.a \ No newline at end of file
diff --git a/lib/libsurfit.a b/lib/libsurfit.a
new file mode 120000
index 00000000..83b20351
--- /dev/null
+++ b/lib/libsurfit.a
@@ -0,0 +1 @@
+../bin/libsurfit.a \ No newline at end of file
diff --git a/lib/libsys.a b/lib/libsys.a
new file mode 120000
index 00000000..f79ddb93
--- /dev/null
+++ b/lib/libsys.a
@@ -0,0 +1 @@
+../bin/libsys.a \ No newline at end of file
diff --git a/lib/libtbtables.a b/lib/libtbtables.a
new file mode 120000
index 00000000..d12b1012
--- /dev/null
+++ b/lib/libtbtables.a
@@ -0,0 +1 @@
+../bin/libtbtables.a \ No newline at end of file
diff --git a/lib/libvops.a b/lib/libvops.a
new file mode 120000
index 00000000..d98a54e2
--- /dev/null
+++ b/lib/libvops.a
@@ -0,0 +1 @@
+../bin/libvops.a \ No newline at end of file
diff --git a/lib/libxtools.a b/lib/libxtools.a
new file mode 120000
index 00000000..5d0fd292
--- /dev/null
+++ b/lib/libxtools.a
@@ -0,0 +1 @@
+../bin/libxtools.a \ No newline at end of file
diff --git a/lib/math/curfit.h b/lib/math/curfit.h
new file mode 100644
index 00000000..7c9d9eab
--- /dev/null
+++ b/lib/math/curfit.h
@@ -0,0 +1,34 @@
+# definitions for the curfit package
+
+# define the permitted types of curves
+
+define CV_FUNCTIONS "|chebyshev|legendre|spline3|spline1|"
+define CHEBYSHEV 1
+define LEGENDRE 2
+define SPLINE3 3
+define SPLINE1 4
+define USERFNC 5
+define NTYPES 5
+
+# define the weighting flags
+
+define CV_WEIGHTS "|user|uniform|spacing|chisq|"
+define WTS_USER 1 # user enters weights
+define WTS_UNIFORM 2 # equal weights
+define WTS_SPACING 3 # weight proportional to spacing of data points
+define WTS_CHISQ 4 # chi-squared weights (input data in photons)
+
+# error conditions
+
+define SINGULAR 1
+define NO_DEG_FREEDOM 2
+
+# definitions for cvstat
+
+define CVTYPE 1 # curve type
+define CVORDER 2 # order
+define CVNCOEFF 3 # Number of coefficients
+define CVNSAVE 4 # Length of save buffer
+define CVXMIN 5 # minimum ordinate
+define CVXMAX 6 # maximum ordinate
+
diff --git a/lib/math/gsurfit.h b/lib/math/gsurfit.h
new file mode 100644
index 00000000..5d46762b
--- /dev/null
+++ b/lib/math/gsurfit.h
@@ -0,0 +1,48 @@
+# definitions for the gsurfit package
+
+# define the permitted types of curves
+
+define GS_FUNCTIONS "|chebyshev|legendre|polynomial|"
+define GS_CHEBYSHEV 1 # chebyshev polynomials
+define GS_LEGENDRE 2 # legendre polynomials
+define GS_POLYNOMIAL 3 # power series polynomials
+define NTYPES 3
+
+# define the xterms flags
+
+define GS_XTYPES "|none|full|half|"
+define GS_XNONE 0 # no x-terms (old NO)
+define GS_XFULL 1 # full x-terms (new YES)
+define GS_XHALF 2 # half x-terms (new)
+
+# define the weighting flags
+
+define GS_WEIGHTS "|user|uniform|spacing|"
+define WTS_USER 1 # user enters weights
+define WTS_UNIFORM 2 # equal weights
+define WTS_SPACING 3 # weight proportional to spacing of data points
+
+# error conditions
+
+define SINGULAR 1
+define NO_DEG_FREEDOM 2
+
+# gsstat/gsset definitions
+
+define GSTYPE 1
+define GSXORDER 2
+define GSYORDER 3
+define GSXTERMS 4
+define GSNXCOEFF 5
+define GSNYCOEFF 6
+define GSNCOEFF 7
+define GSNSAVE 8
+define GSXMIN 9
+define GSXMAX 10
+define GSYMIN 11
+define GSYMAX 12
+define GSXREF 13
+define GSYREF 14
+define GSZREF 15
+
+define GS_SAVECOEFF 8
diff --git a/lib/math/iminterp.h b/lib/math/iminterp.h
new file mode 100644
index 00000000..c42f49ec
--- /dev/null
+++ b/lib/math/iminterp.h
@@ -0,0 +1,44 @@
+# IMINTERP.H -- User definitions for the image interpolation package.
+
+define II_FUNCTIONS "|nearest|linear|poly3|poly5|spline3|sinc|lsinc|drizzle|"
+define II_NEAREST 1 # nearest neighbour
+define II_LINEAR 2 # linear
+define II_POLY3 3 # 3rd order polynomial
+define II_POLY5 4 # 5th order polynomial
+define II_SPLINE3 5 # cubic spline
+define II_SINC 6 # sinc
+define II_LSINC 7 # look-up table sinc
+define II_DRIZZLE 8 # drizzle
+define II_NTYPES 8
+
+# 2D interpolation definitions.
+
+define II_BFUNCTIONS "|nearest|linear|poly3|poly5|spline3|sinc|lsinc|drizzle|"
+define II_BINEAREST 1 # nearest neighbour
+define II_BILINEAR 2 # bilinear
+define II_BIPOLY3 3 # bicubic polynomial
+define II_BIPOLY5 4 # biquintic polynomial
+define II_BISPLINE3 5 # bicubic spline
+define II_BISINC 6 # bisinc
+define II_BILSINC 7 # look-up table bisinc
+define II_BIDRIZZLE 8 # drizzle
+define II_NTYPES2D 8
+
+# Define types for asigeti
+
+define II_ASITYPE 1 # interpolant type
+define II_ASINSAVE 2 # size of array to be saved
+define II_ASINSINC 3 # size of the sinc convolution
+define II_ASIBADVAL 4 # bad pixel value for drizzle
+
+# Define types for msigeti
+
+define II_MSITYPE 1 # interpolant type
+define II_MSINSAVE 2 # size of array to be saved
+define II_MSINSINC 3 # size of array to be saved
+define II_MSIBADVAL 4 # bad pixel value for drizzle
+
+# Boundary types for arbpix
+
+define II_BOUNDARYEXT 1 # boundary extension
+define II_NBOUND 1 # number of boundary types
diff --git a/lib/math/interp.h b/lib/math/interp.h
new file mode 100644
index 00000000..ee08cf06
--- /dev/null
+++ b/lib/math/interp.h
@@ -0,0 +1,20 @@
+# File of definitions for interpolator package.
+
+# Interpolator Types:
+
+define IT_FUNCTIONS "|nearest|linear|poly3|poly5|spline3|"
+define IT_NEAREST 1
+define IT_LINEAR 2
+define IT_POLY3 3
+define IT_POLY5 4
+define IT_SPLINE3 5
+define ITNIT 5 # number of types
+
+# Size of header etc. used for part of coeff dimension
+
+define SZ_ASI 20
+
+# Total number of points used in spline interpolation of of bad pixels by
+# subroutine arbpix.
+
+define SPLPTS 16
diff --git a/lib/math/nlfit.h b/lib/math/nlfit.h
new file mode 100644
index 00000000..17570ed9
--- /dev/null
+++ b/lib/math/nlfit.h
@@ -0,0 +1,28 @@
+# Definitions for the non-linear least-squares fitting package NLFIT
+
+# define parameters for nlstat[ird]
+
+define NLNPARAMS 1
+define NLNFPARAMS 2
+define NLITMAX 3
+define NLITER 4
+define NLSUMSQ 5
+define NLOLDSQ 6
+define NLLAMBDA 7
+define NLTOL 8
+define NLNPTS 9
+define NLSCATTER 10
+
+# define the weighting flags
+
+define WTS_USER 1 # User enters weights
+define WTS_UNIFORM 2 # Equal weights
+define WTS_CHISQ 3 # Chi-squared weights (input data in photons)
+define WTS_SCATTER 4 # Weights include an adjustable scatter term
+
+# define the error conditions
+
+define DONE 0 # Solution converged
+define SINGULAR 1 # Singular matrix
+define NO_DEG_FREEDOM 2 # Too few points
+define NOT_DONE 3 # Solution did not converge
diff --git a/lib/math/surfit.h b/lib/math/surfit.h
new file mode 100644
index 00000000..7b6de492
--- /dev/null
+++ b/lib/math/surfit.h
@@ -0,0 +1,21 @@
+# SURFIT.H -- Global defines for the surface fitting package.
+
+# Permitted types of curves.
+
+define SF_FUNCTIONS "|legendre|chebyshev|spline3|spline1|"
+define SF_LEGENDRE 1
+define SF_CHEBYSHEV 2
+define SF_SPLINE3 3
+define SF_SPLINE1 4
+define SF_NTYPES 4
+
+# Weighting flags
+
+define SF_WEIGHTS "|user|uniform|"
+define SF_USER 1 # user enters weights
+define SF_UNIFORM 2 # equal weights, weight 1.0
+
+# Error conditions
+
+define SINGULAR 1 # matrix is singular
+define NO_DEG_FREEDOM 2 # insufficient number of data points
diff --git a/lib/mii.h b/lib/mii.h
new file mode 100644
index 00000000..5a950fdb
--- /dev/null
+++ b/lib/mii.h
@@ -0,0 +1,16 @@
+# MII.H -- Definitions for the MII Machine Independent Integer package.
+
+define MII_BYTE 8
+define MII_SHORT 16
+define MII_LONG 32
+define MII_REAL -32
+define MII_DOUBLE -64
+define MII_INT MII_LONG
+
+# Name aliases for generic code.
+define miipaks miipak16
+define miipaki miipak32
+define miipakl miipak32
+define miiupks miiupk16
+define miiupki miiupk32
+define miiupkl miiupk32
diff --git a/lib/mwset.h b/lib/mwset.h
new file mode 100644
index 00000000..937eb2c0
--- /dev/null
+++ b/lib/mwset.h
@@ -0,0 +1,9 @@
+# MWCSSET.H -- Global (public) definitions for the MWCS interface.
+# Most of these are read-only status parameters.
+
+define MW_NDIM 1 # system logical dimension
+define MW_NWCS 2 # number of world systems
+define MW_REFIM 3 # reference image, if any
+define MW_USEAXMAP 4 # use axis mapping (RW)
+define MW_NPHYSDIM 5 # physical system dimension
+define MW_SAVELEN 6 # nchars reqd for mw_save buffer
diff --git a/lib/names b/lib/names
new file mode 100644
index 00000000..5916df61
--- /dev/null
+++ b/lib/names
@@ -0,0 +1,1932 @@
+aabsd
+aabsi
+aabsl
+aabsr
+aabss
+aabsx
+aaddd
+aaddi
+aaddkd
+aaddki
+aaddkl
+aaddkr
+aaddks
+aaddkx
+aaddl
+aaddr
+aadds
+aaddx
+aandi
+aandki
+aandkl
+aandks
+aandl
+aands
+aavgd
+aavgi
+aavgl
+aavgr
+aavgs
+aavgx
+abavd
+abavi
+abavl
+abavr
+abavs
+abavx
+abeqc
+abeqd
+abeqi
+abeqkc
+abeqkd
+abeqki
+abeqkl
+abeqkr
+abeqks
+abeqkx
+abeql
+abeqr
+abeqs
+abeqx
+abgec
+abged
+abgei
+abgekc
+abgekd
+abgeki
+abgekl
+abgekr
+abgeks
+abgekx
+abgel
+abger
+abges
+abgex
+abgtc
+abgtd
+abgti
+abgtkc
+abgtkd
+abgtki
+abgtkl
+abgtkr
+abgtks
+abgtkx
+abgtl
+abgtr
+abgts
+abgtx
+ablec
+abled
+ablei
+ablekc
+ablekd
+ableki
+ablekl
+ablekr
+ableks
+ablekx
+ablel
+abler
+ables
+ablex
+abltc
+abltd
+ablti
+abltkc
+abltkd
+abltki
+abltkl
+abltkr
+abltks
+abltkx
+abltl
+abltr
+ablts
+abltx
+abnec
+abned
+abnei
+abnekc
+abnekd
+abneki
+abnekl
+abnekr
+abneks
+abnekx
+abnel
+abner
+abnes
+abnex
+abori
+aborki
+aborkl
+aborks
+aborl
+abors
+absud
+absui
+absul
+absur
+absus
+acht
+achtb
+achtbb
+achtbc
+achtbd
+achtbi
+achtbl
+achtbr
+achtbs
+achtbu
+achtbx
+achtc
+achtcb
+achtcc
+achtcd
+achtci
+achtcl
+achtcr
+achtcs
+achtcu
+achtcx
+achtd
+achtdb
+achtdc
+achtdd
+achtdi
+achtdl
+achtdr
+achtds
+achtdu
+achtdx
+achti
+achtib
+achtic
+achtid
+achtii
+achtil
+achtir
+achtis
+achtiu
+achtix
+achtl
+achtlb
+achtlc
+achtld
+achtli
+achtll
+achtlr
+achtls
+achtlu
+achtlx
+achtr
+achtrb
+achtrc
+achtrd
+achtri
+achtrl
+achtrr
+achtrs
+achtru
+achtrx
+achts
+achtsb
+achtsc
+achtsd
+achtsi
+achtsl
+achtsr
+achtss
+achtsu
+achtsx
+achtu
+achtub
+achtuc
+achtud
+achtui
+achtul
+achtur
+achtus
+achtuu
+achtux
+achtx
+achtxb
+achtxc
+achtxd
+achtxi
+achtxl
+achtxr
+achtxs
+achtxu
+achtxx
+acjgx
+aclrb
+aclrc
+aclrd
+aclri
+aclrl
+aclrr
+aclrs
+aclrx
+acnvd
+acnvi
+acnvl
+acnvr
+acnvrd
+acnvri
+acnvrl
+acnvrr
+acnvrs
+acnvs
+adivd
+adivi
+adivkd
+adivki
+adivkl
+adivkr
+adivks
+adivkx
+adivl
+adivr
+adivs
+adivx
+adotd
+adoti
+adotl
+adotr
+adots
+adotx
+advzd
+advzi
+advzl
+advzr
+advzs
+advzx
+aelogd
+aelogr
+aexpd
+aexpi
+aexpkd
+aexpki
+aexpkl
+aexpkr
+aexpks
+aexpkx
+aexpl
+aexpr
+aexps
+aexpx
+afftrr
+afftrx
+afftxr
+afftxx
+agltc
+agltd
+aglti
+agltl
+agltr
+aglts
+agltx
+ahgmc
+ahgmd
+ahgmi
+ahgml
+ahgmr
+ahgms
+ahivc
+ahivd
+ahivi
+ahivl
+ahivr
+ahivs
+ahivx
+aiftrr
+aiftrx
+aiftxr
+aiftxx
+aimgd
+aimgi
+aimgl
+aimgr
+aimgs
+alimc
+alimd
+alimi
+aliml
+alimr
+alims
+alimx
+allnd
+allni
+allnl
+allnr
+allns
+allnx
+alogd
+alogi
+alogl
+alogr
+alogs
+alogx
+alovc
+alovd
+alovi
+alovl
+alovr
+alovs
+alovx
+altad
+altai
+altal
+altar
+altas
+altax
+altmd
+altmi
+altml
+altmr
+altms
+altmx
+altrd
+altri
+altrl
+altrr
+altrs
+altrx
+aluid
+aluii
+aluil
+aluir
+aluis
+alutc
+aluti
+alutl
+aluts
+amagd
+amagi
+amagl
+amagr
+amags
+amagx
+amapd
+amapi
+amapl
+amapr
+amaps
+amaxc
+amaxd
+amaxi
+amaxkc
+amaxkd
+amaxki
+amaxkl
+amaxkr
+amaxks
+amaxkx
+amaxl
+amaxr
+amaxs
+amaxx
+amed3c
+amed3d
+amed3i
+amed3l
+amed3r
+amed3s
+amed4c
+amed4d
+amed4i
+amed4l
+amed4r
+amed4s
+amed5c
+amed5d
+amed5i
+amed5l
+amed5r
+amed5s
+amedc
+amedd
+amedi
+amedl
+amedr
+ameds
+amedx
+amgsd
+amgsi
+amgsl
+amgsr
+amgss
+amgsx
+aminc
+amind
+amini
+aminkc
+aminkd
+aminki
+aminkl
+aminkr
+aminks
+aminkx
+aminl
+aminr
+amins
+aminx
+amodd
+amodi
+amodkd
+amodki
+amodkl
+amodkr
+amodks
+amodl
+amodr
+amods
+amovc
+amovd
+amovi
+amovkc
+amovkd
+amovki
+amovkl
+amovkr
+amovks
+amovkx
+amovl
+amovr
+amovs
+amovx
+amuld
+amuli
+amulkd
+amulki
+amulkl
+amulkr
+amulks
+amulkx
+amull
+amulr
+amuls
+amulx
+andi
+andl
+ands
+anegd
+anegi
+anegl
+anegr
+anegs
+anegx
+anoti
+anotl
+anots
+apkxd
+apkxi
+apkxl
+apkxr
+apkxs
+apkxx
+apold
+apolr
+apowd
+apowi
+apowkd
+apowki
+apowkl
+apowkr
+apowks
+apowkx
+apowl
+apowr
+apows
+apowx
+aravd
+aravi
+aravl
+aravr
+aravs
+aravx
+arcpd
+arcpi
+arcpl
+arcpr
+arcps
+arcpx
+arczd
+arczi
+arczl
+arczr
+arczs
+arczx
+aread
+areadb
+argtd
+argti
+argtl
+argtr
+argts
+argtx
+arltd
+arlti
+arltl
+arltr
+arlts
+arltx
+aselc
+aseld
+aseli
+asell
+aselr
+asels
+aselx
+asokc
+asokd
+asoki
+asokl
+asokr
+asoks
+asokx
+asqrd
+asqri
+asqrl
+asqrr
+asqrs
+asqrx
+asrtc
+asrtd
+asrti
+asrtl
+asrtr
+asrts
+asrtx
+assqd
+assqi
+assql
+assqr
+assqs
+assqx
+asubd
+asubi
+asubkd
+asubki
+asubkl
+asubkr
+asubks
+asubkx
+asubl
+asubr
+asubs
+asubx
+asumd
+asumi
+asuml
+asumr
+asums
+asumx
+aupxd
+aupxi
+aupxl
+aupxr
+aupxs
+aupxx
+await
+awaitb
+awritb
+awrite
+awsud
+awsui
+awsul
+awsur
+awsus
+awsux
+awvgd
+awvgi
+awvgl
+awvgr
+awvgs
+awvgx
+axori
+axorki
+axorkl
+axorks
+axorl
+axors
+begmem
+bfalcx
+bfaloc
+bfbsiz
+bfchan
+bfclos
+bffill
+bfflsh
+bffsiz
+bfmode
+bfopen
+bfopnx
+bfread
+bfwrit
+bitmov
+bitpak
+bitupk
+brktie
+bswap2
+bswap4
+btoi
+bytmov
+cctoc
+chdept
+chfeth
+chrlwr
+chrpak
+chrupk
+chrupr
+clargc
+clargd
+clargi
+clargr
+clcenr
+clcfeh
+clcfre
+clcint
+clcmak
+clcmd
+clcmdw
+clgcur
+clgetb
+clgetc
+clgetd
+clgeti
+clgetl
+clgetr
+clgets
+clgetx
+clgfil
+clgkey
+clglpb
+clglpc
+clglpd
+clglpi
+clglpl
+clglpr
+clglps
+clglpx
+clglsr
+clgstr
+clgwrd
+clinis
+clktie
+clnarg
+clopen
+clpcls
+clplen
+clpopi
+clpops
+clpopu
+clprew
+clprif
+clpsit
+clpstr
+clputb
+clputc
+clputd
+clputi
+clputl
+clputr
+clputs
+clputx
+clrawc
+clreqr
+clscan
+clseti
+clstai
+cnvdae
+cnvtie
+coerce
+cputie
+ctocc
+ctod
+ctoi
+ctol
+ctor
+ctotok
+ctowrd
+ctox
+d1mach
+deletg
+diropn
+dtcscl
+dtoc
+dtoc3
+elogd
+elogr
+envfid
+envfit
+envfre
+envgeb
+envgei
+envges
+envinr
+envint
+envlit
+envmak
+envnet
+envpus
+envscn
+eprinf
+erract
+errcoe
+errget
+evexpr
+f77pak
+f77upk
+falloc
+fatal
+fcanpb
+fchdir
+fcldir
+fclobr
+fcopy
+fcopyo
+fdebug
+fdevbf
+fdevbk
+fdevtx
+fdirne
+fexbuf
+ffa
+ffault
+ffilbf
+ffilsz
+ffldir
+fflsbf
+ffs
+fft842
+fgdev0
+fgdevm
+fgetfd
+fgtdir
+filbuf
+filerr
+filopn
+finfo
+finit
+fioclp
+fioqfh
+fixmem
+flsbuf
+fmapfn
+fmkbfs
+fmkcoy
+fmkdir
+fmkpbf
+fmterr
+fmtint
+fmtred
+fmtsel
+fmtstr
+fnextn
+fnldir
+fnroot
+fntclb
+fntcls
+fntdir
+fntedt
+fntget
+fntgfb
+fntgfn
+fntleb
+fntmkt
+fntopb
+fntopn
+fntopt
+fntreb
+fntree
+fntrfb
+fnulle
+fopdir
+fopnbf
+fopntx
+fowner
+fpathe
+fpequd
+fpequr
+fpfixd
+fpfixr
+fpnonr
+fpnord
+fpnorr
+fpradv
+fprfmt
+fprinf
+fprntf
+fptdir
+fputtx
+freadp
+fredio
+fredir
+frenae
+frmbfs
+frmtmp
+frtnfd
+fscan
+fsetev
+fsetfd
+fseti
+fsfdee
+fsfgee
+fsfopn
+fskdir
+fstati
+fstatl
+fstats
+fstdfe
+fstdir
+fstrfp
+fsvtfn
+fswapd
+fwatio
+fwritp
+fwtacc
+gadraw
+gamove
+gargb
+gargc
+gargd
+gargi
+gargl
+gargr
+gargrd
+gargs
+gargsr
+gargtk
+gargwd
+gargx
+gascae
+gcancl
+gclear
+gclose
+gctod
+gctol
+gctox
+gctran
+gcurps
+gescae
+getci
+gethot
+getlie
+getloe
+getpid
+getuid
+gexflr
+gexfls
+gexflt
+gfill
+gflush
+ggcell
+ggcur
+ggetb
+ggeti
+ggetr
+ggets
+ggscae
+ggview
+ggwind
+ginit
+gkical
+gkiclr
+gkicls
+gkides
+gkieof
+gkiese
+gkiexe
+gkifat
+gkifen
+gkifia
+gkiflh
+gkiger
+gkiges
+gkigey
+gkiinl
+gkiint
+gkimfe
+gkiops
+gkiplt
+gkipmt
+gkipoe
+gkipor
+gkipuy
+gkiree
+gkirer
+gkires
+gkirey
+gkiser
+gkises
+gkisul
+gkitet
+gkitxt
+gkiwre
+gkpcal
+gkpcle
+gkpclr
+gkpcls
+gkpdes
+gkpdup
+gkpese
+gkpfat
+gkpfia
+gkpflh
+gkpger
+gkpges
+gkpgey
+gkpgrm
+gkpinl
+gkpmfe
+gkpops
+gkpplt
+gkppmt
+gkppoe
+gkppor
+gkppst
+gkppuy
+gkpres
+gkpser
+gkpses
+gkptet
+gkptxg
+gkptxt
+gkpunn
+glabax
+glbdrd
+glbene
+glbeq
+glbfis
+glbgek
+glblas
+glblob
+glbple
+glbsep
+glbses
+glbset
+glbtin
+glbveg
+gline
+gltoc
+gmark
+gmftie
+gopen
+gpatme
+gpatmh
+gpcell
+gplcae
+gplcal
+gplclb
+gplcll
+gplclr
+gplclt
+gplflh
+gpline
+gploto
+gplotv
+gplret
+gplsee
+gplwci
+gpmark
+grdraw
+grdwcs
+grmove
+grscae
+gscan
+gscur
+gseti
+gsetr
+gsets
+gstati
+gstatr
+gstats
+gstrct
+gstrcy
+gstrmh
+gstsei
+gstser
+gsview
+gswind
+gtdise
+gtext
+gtickr
+gtliny
+gtndis
+gttyld
+gtxset
+gumark
+gvline
+gvmark
+gwcsme
+gwrwcs
+i1mach
+idbfid
+idbgeg
+idbkwp
+idbnas
+idbpug
+ikiacs
+ikicle
+ikicoy
+ikidee
+ikiint
+ikildr
+ikimke
+ikiopn
+ikiopx
+ikipae
+ikiree
+ikiupr
+imaccf
+imacck
+imaccs
+imaddb
+imaddd
+imaddf
+imaddi
+imaddk
+imaddl
+imaddr
+imadds
+imaflp
+imakwb
+imakwc
+imakwd
+imakwi
+imakwr
+imalin
+imaplv
+imastr
+imbln1
+imbln2
+imbln3
+imbtrn
+imcfnl
+imckwl
+imclos
+imcopy
+imcrea
+imcrex
+imcssz
+imctrt
+imdect
+imdele
+imdelf
+imdelk
+imdmap
+imemsg
+imerr
+imfgpe
+imflpl
+imflps
+imflsd
+imflsh
+imflsi
+imflsl
+imflsr
+imflss
+imflsx
+imfluh
+imfnpy
+imfnss
+imfpae
+imfupr
+imgatr
+imgclr
+imgetb
+imgetc
+imgetd
+imgeti
+imgetl
+imgetr
+imgets
+imgfte
+imggsc
+imggsd
+imggsi
+imggsl
+imggsr
+imggss
+imggsx
+imgibf
+imgime
+imgkwb
+imgkwc
+imgkwd
+imgkwi
+imgkwr
+imgl1d
+imgl1i
+imgl1l
+imgl1r
+imgl1s
+imgl1x
+imgl2d
+imgl2i
+imgl2l
+imgl2r
+imgl2s
+imgl2x
+imgl3d
+imgl3i
+imgl3l
+imgl3r
+imgl3s
+imgl3x
+imgnfn
+imgnkw
+imgnld
+imgnli
+imgnll
+imgnln
+imgnlr
+imgnls
+imgnlx
+imgobf
+imgs1d
+imgs1i
+imgs1l
+imgs1r
+imgs1s
+imgs1x
+imgs2d
+imgs2i
+imgs2l
+imgs2r
+imgs2s
+imgs2x
+imgs3d
+imgs3i
+imgs3l
+imgs3r
+imgs3s
+imgs3x
+imgsen
+imgsiz
+imgstr
+imhcpy
+iminie
+imioff
+imisec
+imloop
+immaky
+immap
+imnote
+imofnl
+imofns
+imofnu
+imokwl
+imopen
+imopnc
+imopnx
+imopsf
+impakd
+impaki
+impakl
+impakr
+impaks
+impakx
+impare
+impgsd
+impgsi
+impgsl
+impgsr
+impgss
+impgsx
+impixf
+impkwb
+impkwc
+impkwd
+impkwi
+impkwr
+impl1d
+impl1i
+impl1l
+impl1r
+impl1s
+impl1x
+impl2d
+impl2i
+impl2l
+impl2r
+impl2s
+impl2x
+impl3d
+impl3i
+impl3l
+impl3r
+impl3s
+impl3x
+impnld
+impnli
+impnll
+impnln
+impnlr
+impnls
+impnlx
+imps1d
+imps1i
+imps1l
+imps1r
+imps1s
+imps1x
+imps2d
+imps2i
+imps2l
+imps2r
+imps2s
+imps2x
+imps3d
+imps3i
+imps3l
+imps3r
+imps3s
+imps3x
+impstr
+imputb
+imputd
+imputi
+imputl
+imputr
+imputs
+imrbpx
+imrdpx
+imrene
+imrnam
+imsamp
+imsetf
+imseti
+imsetm
+imsetp
+imsetr
+imsinb
+imsmpl
+imsmps
+imsslv
+imstai
+imtcle
+imtgem
+imtlen
+imtmae
+imtopn
+imtopp
+imtrew
+imtrgm
+imtypk
+imunmp
+imupkd
+imupki
+imupkl
+imupkr
+imupks
+imupkx
+imwbpx
+imwphr
+imwrie
+imwrpx
+intrde
+intree
+intrrt
+irafmn
+itob
+itoc
+kardbf
+kardgd
+kardlp
+kardpl
+kardpr
+kardsf
+kawrbf
+kawrgd
+kawrlp
+kawrpl
+kawrpr
+kawrsf
+kawtbf
+kawtgd
+kawtlp
+kawtpl
+kawtpr
+kawtsf
+kbzard
+kbzawr
+kbzawt
+kbzcls
+kbzopn
+kbzstt
+kclcpr
+kcldir
+kcldpr
+kclsbf
+kclsgd
+kclslp
+kclspl
+kclssf
+kclstx
+kclsty
+kdvall
+kdvown
+kfacss
+kfaloc
+kfchdr
+kfdele
+kfgcwd
+kfinfo
+kflstx
+kflsty
+kfmkcp
+kfmkdr
+kfpath
+kfprot
+kfrnam
+kfsubd
+kfxdir
+kgettx
+kgetty
+kgfdir
+kicont
+kidece
+kience
+kierrr
+kiexte
+kifine
+kiflux
+kifren
+kigetn
+kigets
+kignoe
+kiinit
+kimapn
+kintpr
+kiopes
+kirece
+kisend
+kisenv
+kishot
+knottx
+knotty
+kopcpr
+kopdir
+kopdpr
+kopnbf
+kopngd
+kopnlp
+kopnpl
+kopnsf
+kopntx
+kopnty
+kputtx
+kputty
+ksared
+ksawat
+ksawre
+ksektx
+ksekty
+ksttbf
+ksttgd
+ksttlp
+ksttpl
+ksttpr
+ksttsf
+kstttx
+ksttty
+ktzcls
+ktzfls
+ktzget
+ktznot
+ktzopn
+ktzput
+ktzsek
+ktzstt
+kzclmt
+kzopmt
+kzrdmt
+kzrwmt
+kzwrmt
+kzwtmt
+lexnum
+locpr
+locva
+lpopen
+lpzard
+lpzawe
+lpzawt
+ltoc
+maideh
+mallo1
+mgdptr
+mgtfwa
+miilen
+miinem
+miipa2
+miipa6
+miipa8
+miipak
+miipke
+miirec
+miirei
+miires
+miiup2
+miiup6
+miiup8
+miiupk
+miiwrc
+miiwri
+miiwrs
+msvfwa
+mtalle
+mtclre
+mtdeae
+mtdevd
+mtfile
+mtgets
+mtloce
+mtopen
+mtosdv
+mtpare
+mtposn
+mtpute
+mtreae
+mtrewd
+mtsavd
+mtsavs
+mtskid
+mtstas
+mtsync
+mtupde
+noti
+notl
+nots
+nscan
+oifacs
+oifcle
+oifcoy
+oifdee
+oifgpe
+oifmke
+oifopn
+oifopx
+oifree
+oifupr
+oifwpr
+onenty
+onerrr
+onexit
+ord1
+ord2
+ori
+orl
+ors
+oscmd
+osfnik
+osfnlk
+osfnms
+osfnpe
+osfnrk
+osfntt
+osfnuk
+pargb
+pargc
+pargd
+pargg
+pargi
+pargl
+pargr
+pargs
+pargsr
+pargx
+patamh
+patfit
+patgel
+patgse
+patinx
+patloe
+patmae
+patmah
+patomh
+patsts
+prchdr
+prclcr
+prcldr
+prcloe
+prdone
+prdumn
+prenvt
+prfilf
+prfinc
+prgete
+prgetr
+prkill
+pronic
+propcr
+propdr
+propen
+protet
+prredr
+prsigl
+prstai
+prupde
+przclr
+putcc
+putci
+putlie
+r1mach
+r2tr
+r2tx
+r4syn
+r4tr
+r4tx
+r8syn
+r8tr
+r8tx
+rename
+reopen
+resetn
+salloc
+scan
+scanc
+sfree
+smark
+sprinf
+sscan
+stallc
+stcloe
+stentr
+stfacs
+stfadr
+stfcle
+stfcos
+stfcoy
+stfdee
+stffrs
+stfgeb
+stfgei
+stfgen
+stfges
+stfind
+stfinl
+stflos
+stfmeb
+stfmke
+stfnee
+stfopn
+stfopx
+stfpis
+stfrdr
+stfreb
+stfree
+stfrek
+stfrfr
+stfrgb
+stfrne
+stfsas
+stfupr
+stfwfr
+stfwgb
+sthash
+sthead
+stinfo
+stkmkg
+stmark
+stname
+stnext
+stnsys
+stopen
+stpstr
+strcle
+strdic
+strefb
+streff
+streq
+strese
+strge
+strgt
+strids
+stridx
+strlds
+strldx
+strle
+strlt
+strlwr
+strmac
+strmah
+strncp
+strne
+stropn
+strpak
+strse1
+strseh
+strsrp
+strsrt
+strtbl
+strupk
+strupr
+stsave
+stsque
+syserr
+sysers
+sysged
+sysgsg
+sysid
+sysmte
+syspac
+syspat
+syspte
+sysret
+syssct
+tsleep
+ttopen
+ttseti
+ttstai
+ttybih
+ttybre
+ttycas
+ttycds
+ttycle
+ttycln
+ttyclr
+ttyctl
+ttydee
+ttydey
+ttyeny
+ttyexs
+ttyfey
+ttyfiy
+ttygds
+ttygeb
+ttygei
+ttyger
+ttyges
+ttygoo
+ttygpe
+ttyins
+ttyint
+ttylod
+ttyods
+ttyopn
+ttypue
+ttypus
+ttysce
+ttysei
+ttyso
+ttysti
+ttysui
+ttywre
+ungete
+unread
+urand
+vfnadd
+vfncle
+vfndee
+vfndel
+vfnene
+vfnenr
+vfnexr
+vfngen
+vfnise
+vfnman
+vfnmap
+vfnmau
+vfnopn
+vfnsqe
+vfntre
+vfnunn
+vfnunp
+vmallc
+vvfncm
+vvfnee
+vvfnip
+vvfnis
+vvfnre
+xalloe
+xcallc
+xdeale
+xdevor
+xdevss
+xeract
+xerfmg
+xerpop
+xerpsh
+xerpsr
+xerpuc
+xerpue
+xerret
+xerror
+xersel
+xervey
+xevadg
+xevbip
+xevbop
+xevcan
+xever1
+xever2
+xeverr
+xevfrp
+xevgek
+xevinp
+xevmap
+xevnee
+xevpae
+xevpah
+xevqut
+xevstt
+xevunp
+xfaccs
+xfcloe
+xfdele
+xffluh
+xfgetc
+xfgetr
+xfnote
+xfopen
+xfputc
+xfputr
+xfread
+xfseek
+xfungc
+xfwrie
+xgdevt
+xmallc
+xmfree
+xmktep
+xonerr
+xonext
+xori
+xorl
+xors
+xprinf
+xqsort
+xrealc
+xsizef
+xstdeh
+xstrct
+xstrcy
+xstrln
+xtoc
+xwhen
+zardbf
+zardgd
+zardks
+zardlp
+zardmt
+zardnu
+zardpl
+zardpr
+zardps
+zardsf
+zawrbf
+zawrgd
+zawrks
+zawrlp
+zawrmt
+zawrnu
+zawrpl
+zawrpr
+zawrps
+zawrsf
+zawset
+zawtbf
+zawtgd
+zawtks
+zawtlp
+zawtmt
+zawtnu
+zawtpl
+zawtpr
+zawtps
+zawtsf
+zcall0
+zcall1
+zcall2
+zcall3
+zcall4
+zcall5
+zcall6
+zcall7
+zcall8
+zcall9
+zclcpr
+zcldir
+zcldpr
+zclm70
+zclsbf
+zclsgd
+zclsks
+zclslp
+zclsmt
+zclsnu
+zclspl
+zclsps
+zclssf
+zclstt
+zclstx
+zclsty
+zdojmp
+zdvall
+zdvown
+zfacss
+zfaloc
+zfchdr
+zfdele
+zfgcwd
+zfinfo
+zflsnu
+zflstt
+zflstx
+zflsty
+zfmkcp
+zfmkdr
+zfnbrk
+zfpath
+zfprot
+zfrnam
+zfsubd
+zfxdir
+zgcmdl
+zgetnu
+zgettt
+zgettx
+zgetty
+zgfdir
+zghost
+zgtenv
+zgtime
+zgtpid
+zintpr
+zlocpr
+zlocva
+zmaloc
+zmemck
+zmfree
+znotnu
+znottt
+znottx
+znotty
+zopcpr
+zopdir
+zopdpr
+zopm70
+zopnbf
+zopngd
+zopnks
+zopnlp
+zopnmt
+zopnnu
+zopnpl
+zopnsf
+zopntt
+zopntx
+zopnty
+zoscmd
+zpanic
+zputnu
+zputtt
+zputtx
+zputty
+zraloc
+zrdm70
+zseknu
+zsektt
+zsektx
+zsekty
+zsettt
+zstm70
+zsttbf
+zsttgd
+zsttks
+zsttlp
+zsttmt
+zsttnu
+zsttpl
+zsttpr
+zsttps
+zsttsf
+zstttt
+zstttx
+zsttty
+zsvjmp
+zttloe
+zttloo
+zttpug
+zttupe
+zwmsec
+zwrm70
+zwtm70
+zxgmes
+zxwhen
+zzclmt
+zzfbmt
+zzffmt
+zzopmt
+zzrbmt
+zzrdmt
+zzrfmt
+zzrwmt
+zzstop
+zzstrt
+zzwrmt
+zzwtmt
diff --git a/lib/nmi.h b/lib/nmi.h
new file mode 100644
index 00000000..727fbd9f
--- /dev/null
+++ b/lib/nmi.h
@@ -0,0 +1,16 @@
+# NMI.H -- Definitions for the NMI Natice Machine Integer package.
+
+define NMI_BYTE 8
+define NMI_SHORT 16
+define NMI_INT 32
+define NMI_LONG 32
+define NMI_REAL -32
+define NMI_DOUBLE -64
+
+# Name aliases for generic code.
+define nmipaks nmipak16
+define nmipaki nmipak32
+define nmipakl nmipak32
+define nmiupks nmiupk16
+define nmiupki nmiupk32
+define nmiupkl nmiupk32
diff --git a/lib/nspp.h b/lib/nspp.h
new file mode 100644
index 00000000..ace4e5d4
--- /dev/null
+++ b/lib/nspp.h
@@ -0,0 +1,8 @@
+# NSPP.H -- Definitions for the NCAR system plot package and metacode
+# translators.
+
+define MAX_MCCOORD 32767 # largest mc coord
+define NBITS_MCWORD 16 # nbits metacode word
+define SZ_MFRECORD (1440/SZB_CHAR) # nchars metafile record.
+define MF_MAGIC 2 # 2nd word of metafile record header
+define INTT_TESTVAL 4096 # anything larger is a real
diff --git a/lib/pattern.h b/lib/pattern.h
new file mode 100644
index 00000000..83c1c9f2
--- /dev/null
+++ b/lib/pattern.h
@@ -0,0 +1,14 @@
+# PATTERN.H -- Pattern Matching Metacharacters (STRMATCH, PATMATCH).
+
+define CH_BOL '^' # beginning of line symbol
+define CH_NOT '^' # not, in character classes
+define CH_EOL '$' # end of line symbol
+define CH_ANY '?' # match any single character
+define CH_CLOSURE '*' # zero or more occurrences
+define CH_CCL '[' # begin character class
+define CH_CCLEND ']' # end character class
+define CH_RANGE '-' # as in [a-z]
+define CH_ESCAPE '\\' # escape character
+define CH_WHITESPACE '#' # match optional whitespace
+define CH_IGNORECASE '{' # begin ignoring case
+define CH_MATCHCASE '}' # begin checking case
diff --git a/lib/pkg/center1d.h b/lib/pkg/center1d.h
new file mode 100644
index 00000000..c2d4972d
--- /dev/null
+++ b/lib/pkg/center1d.h
@@ -0,0 +1,6 @@
+# Type of features for one dimensional centering.
+
+define EMISSION 1 # Emission feature
+define ABSORPTION 2 # Absorption feature
+
+define FTYPES "|emission|absorption|" # Types for strdic and clgwrd.
diff --git a/lib/pkg/cq.h b/lib/pkg/cq.h
new file mode 100644
index 00000000..9d9f801f
--- /dev/null
+++ b/lib/pkg/cq.h
@@ -0,0 +1,100 @@
+# Public definitions file for the catalog query interface.
+
+# The catalog access interface parameter definitions
+
+define CQNRECS 1 # the number of records in the catalog database
+define CQSZRECLIST 2 # the length of the record name list in chars
+define CQRECLIST 3 # the record name @list
+define CQCATDB 4 # the catalog database file name
+define CQCATNO 5 # the current catalog record number
+define CQCATNAME 6 # the current catalog name
+
+# The max size of a query parameter name, value, units, and formats string.
+
+define CQ_SZ_QPNAME 19
+define CQ_SZ_QPVALUE 79
+define CQ_SZ_QPUNITS 19
+define CQ_SZ_QPFMTS 11
+
+# The maximum number of fields or columns in the result.
+
+define CQ_MAX_NFIELDS 100
+
+# The catalog access results parameter definitions
+
+define CQRCATDB 1 # the catalog database file
+define CQRCATNAME 2 # the catalog name
+define CQRADDRESS 3 # the address
+define CQRQUERY 4 # the query
+define CQRNQPARS 5 # the number of query parameters
+define CQRQPNAMES 6 # the query parameter names
+define CQRQPVALUES 7 # the query parameter values
+define CQRQPUNITS 8 # the query parameter units
+
+define CQRTYPE 9 # the results format (currently stext or btext)
+define CQRECSIZE 10 # the record length in characters (default = 0)
+define CQRHSKIP 11 # the number of header lines to skip (default = 0)
+define CQRTSKIP 12 # the number of trailing lines to skip (default = 0)
+define CQRTRIML 13 # the number of leading characters to trim
+define CQRTRIMR 14 # the number of trailing characters to trim
+
+define CQRNRECS 15 # The number of records in the results
+define CQNHEADER 16 # The number of header keywords in the results
+define CQNFIELDS 17 # The number of record fields in the results
+define CQRECPTR 18 # the current record pointer
+
+# The surveys access results parameter definitions
+
+define CQIMCATDB 1
+define CQIMCATNAME 2
+define CQIMADDRESS 3
+define CQIMQUERY 4
+define CQINQPARS 5
+define CQIQPNAMES 6
+define CQIQPVALUES 7
+define CQIQPUNITS 8
+define CQIMNAME 9
+define CQIMTYPE 10
+define CQWCS 11
+define CQNWCS 12
+define CQNIMPARS 13
+
+
+# The max size of a field name, value, units, and formats string.
+
+define CQ_SZ_FNAME 19
+define CQ_SZ_FVALUE 79
+define CQ_SZ_FUNITS 19
+define CQ_SZ_FFMTS 11
+
+
+# Define the default input catalog file types
+
+define CQ_RTYPESTR "|stext|btext|"
+
+define CQ_STEXT 1 # Simple text (free format fields)
+ # Newline delimited records
+ # Whitespace delimited fields
+ # No embedded whitespace unless in ""
+ # Skip nlines header
+ # Skip nchars at beginning / end of record
+ # Skip nlines trailer
+
+
+define CQ_BTEXT 2 # Blocked text (fixed format fields)
+ # Fixed size newline delimited records
+ # Offset and size delimited fields
+ # Embedded whitespace permitted
+ # Skip nlines header
+ # Skip nchars at beginning / end of record
+ # Skip nlines trailer
+
+
+define CQ_ITYPESTR "|fits|"
+define CQ_FITS 1
+
+
+define CQ_WTYPESTR "|fits|dss|none|"
+define CQ_WFITS 1
+define CQ_WDSS 2
+define CQ_WNONE 3
diff --git a/lib/pkg/dttext.h b/lib/pkg/dttext.h
new file mode 100644
index 00000000..887e5c32
--- /dev/null
+++ b/lib/pkg/dttext.h
@@ -0,0 +1,19 @@
+# Defintion for dbtext structure.
+
+define DT_LEN 106
+define DT_SZFNAME 99
+
+define DT Memi[$1] # FIO channel
+define DT_NRECS Memi[$1+1] # Number of records
+define DT_OFFSETS Memi[$1+2] # Pointer to record offsets
+define DT_NAMES Memi[$1+3] # Pointer to name indices
+define DT_MAP Memi[$1+4] # Pointer to record names
+define DT_MODE Memi[$1+5] # Access mode
+define DT_DNAME Memc[P2C($1+6)] # Directory name
+define DT_FNAME Memc[P2C($1+56)] # File name
+
+define DT_OFFSET Meml[DT_OFFSETS($1)+$2-1]
+define DT_NAMEI Memi[DT_NAMES($1)+$2-1]
+define DT_NAME Memc[DT_MAP($1)+DT_NAMEI($1,$2)]
+
+define DT_ALLOC 20 # Allocation block size
diff --git a/lib/pkg/gtools.h b/lib/pkg/gtools.h
new file mode 100644
index 00000000..d42b2898
--- /dev/null
+++ b/lib/pkg/gtools.h
@@ -0,0 +1,48 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# Public Definitions
+
+define GTVXMIN 0 # Viewport X minimum
+define GTVXMAX 1 # Viewport X maximum
+define GTVYMIN 2 # Viewport Y minimum
+define GTVYMAX 3 # Viewport Y maximum
+define GTXMIN 4 # WCS X minimum
+define GTXMAX 5 # WCS X maximum
+define GTYMIN 6 # WCS Y minimum
+define GTYMAX 7 # WCS Y maximum
+
+define GTSYSID 8 # Add SYSID?
+define GTPARAMS 9 # Graph parameters
+define GTTITLE 10 # Graph title
+define GTSUBTITLE 11 # Graph subtitle
+define GTCOMMENTS 12 # Comments
+define GTXLABEL 13 # X label
+define GTYLABEL 14 # Y label
+define GTXUNITS 15 # X units
+define GTYUNITS 16 # Y units
+
+define GTDRAWTITLE 17 # Draw title block?
+define GTDRAWXLABELS 18 # Draw x axis label block?
+define GTDRAWYLABELS 19 # Draw y axis label block?
+
+define GTTYPE 20 # Graph type
+define GTMARK 21 # Mark type
+define GTLINE 22 # Line type
+define GTXSIZE 23 # X Mark size
+define GTYSIZE 24 # Y Mark size
+define GTCOLOR 25 # Color
+
+define GTXTRAN 26 # WCS X transform
+define GTYTRAN 27 # WCS Y transform
+define GTXFLIP 28 # Flip X axis
+define GTYFLIP 29 # Flip Y axis
+define GTTRANSPOSE 30 # Transpose X and Y axes?
+
+define GTXFORMAT 31 # X format
+define GTYFORMAT 32 # Y format
+
+define GTXBUF 33 # Autoscaling buffer factor
+define GTYBUF 34 # Autoscaling buffer factor
+define GTLCLIP 35 # Low clipping factor
+define GTHCLIP 36 # High clipping factor
+
diff --git a/lib/pkg/icfit.h b/lib/pkg/icfit.h
new file mode 100644
index 00000000..4d8a0f18
--- /dev/null
+++ b/lib/pkg/icfit.h
@@ -0,0 +1,14 @@
+# Definitions for the interactive curve fitting package.
+
+define IC_XMIN 1
+define IC_XMAX 2
+define IC_SAMPLE 3
+define IC_NAVERAGE 4
+define IC_FUNCTION 5
+define IC_ORDER 6
+define IC_LOWREJECT 7
+define IC_HIGHREJECT 8
+define IC_NITERATE 9
+define IC_GROW 10
+define IC_REJPTS 11
+define IC_NREJECT 12
diff --git a/lib/pkg/igsfit.h b/lib/pkg/igsfit.h
new file mode 100644
index 00000000..d8bc58a1
--- /dev/null
+++ b/lib/pkg/igsfit.h
@@ -0,0 +1,17 @@
+define IGSPARAMS 7
+
+define FEATURE 1
+define X 2
+define Y 3
+define Z 4
+define W 5
+define S 6
+define R 7
+
+define IGS_FUNCTION 1
+define IGS_XORDER 2
+define IGS_YORDER 3
+define IGS_XMIN 4
+define IGS_XMAX 5
+define IGS_YMIN 6
+define IGS_YMAX 7
diff --git a/lib/pkg/inlfit.h b/lib/pkg/inlfit.h
new file mode 100644
index 00000000..7a85d10a
--- /dev/null
+++ b/lib/pkg/inlfit.h
@@ -0,0 +1,89 @@
+# The user callable header file for the INLFIT pacakge
+
+# -------------------------------------------------------------------------
+# Definitions to retrieve INLFIT parameters (attributes) with the in_get(),
+# and in_put() procedures.
+
+# Integer valued parameters (in_geti, in_puti)
+
+define INLFUNCTION 1 # Fitting function
+define INLDERIVATIVE 2 # Fitting function derivatives
+define INLNPARAMS 3 # Total number of parameters
+define INLNFPARAMS 4 # Number of fitting parameters
+define INLNVARS 5 # Number of variables
+define INLNPTS 6 # Number of variables
+define INLMAXITER 7 # Max. number of iterations
+define INLNREJECT 8 # Number of rejection iterations
+define INLNREJPTS 9 # Number of rejected points
+define INLUAXES 10 # User plot function
+define INLUCOLON 11 # User colon function
+define INLUFIT 12 # User fit function
+define INLOVERPLOT 13 # Overplot next plot ?
+define INLPLOTFIT 14 # Overplot fit ?
+define INLFITERROR 15 # Error fit code
+define INLGKEY 16 # Graph key
+
+
+# Real/double valued parameters (in_get[rd], in_put[rd])
+
+define INLTOLERANCE 20 # Tolerance of convergence
+define INLLOW 21 # Low rejection value
+define INLHIGH 22 # High rejection value
+define INLGROW 23 # Rejection growing radius
+
+
+# Pointer valued parameters (in_getp, in_getp)
+
+define INLNL 30 # NLFIT descriptor
+define INLPARAM 31 # Parameter vector
+define INLDPARAM 32 # Parameter change vector
+define INLPLIST 33 # Parameter list
+define INLREJPTS 34 # Rejected points
+define INLXMIN 35 # Minimum value for curve
+define INLXMAX 36 # Maximum value for curve
+define INLSFLOAT 37 # Floating point substructure
+define INLSGAXES 38 # Graphics substructure
+
+
+# String valued parameters (in_gstr, in_pstr)
+
+define INLLABELS 40 # standard axis labels
+define INLUNITS 41 # standard axis units
+define INLFLABELS 42 # Function labels
+define INLFUNITS 43 # Function units
+define INLPLABELS 44 # Parameter labels
+define INLPUNITS 45 # Parameter units
+define INLVLABELS 46 # Variable labels
+define INLVUNITS 47 # Variable units
+define INLUSERLABELS 48 # User plot labels
+define INLUSERUNITS 49 # User plot units
+define INLHELP 50 # Help file name
+define INLPROMPT 51 # Help prompt
+
+
+# -------------------------------------------------------------------------
+# Graphic key and axis definitions. These are used to retrieve key/axis
+# attributes using the in_gkey() and in_pkey() procedures.
+
+# Max number of graph keys
+
+define INLNGKEYS 5
+
+
+# Axis codes.
+
+define INLXAXIS 1 # X axis
+define INLYAXIS 2 # Y axis
+
+
+# Graph key/axis codes.
+
+define KEY_FUNCTION 1 # Function
+define KEY_FIT 2 # Fit
+define KEY_RESIDUALS 3 # Residuals
+define KEY_RATIO 4 # Ratio
+define KEY_NONLINEAR 5 # Non-linear part
+define KEY_VARIABLE 6 # Variable (user or default)
+define KEY_UAXIS 7 # User plot function
+define KEY_MIN KEY_FUNCTION # Min. key type
+define KEY_MAX KEY_UAXIS # Max. key type
diff --git a/lib/pkg/mef.h b/lib/pkg/mef.h
new file mode 100644
index 00000000..635a6e0a
--- /dev/null
+++ b/lib/pkg/mef.h
@@ -0,0 +1,52 @@
+define LEN_CARD 80
+define SZ_EXTTYPE 20
+define LEN_CARDNL 81
+define SZ_KEYWORD 8
+define FITS_STARTVALUE 10
+define FITS_ENDVALUE 30
+define FITS_BLKSZ_CHAR 1440 # Number of chars per FITS block
+define FITS_BLKSZ_NL 2916 # 36*81
+define FITS_BLOCK_BYTES 2880
+define MEF_SZVALSTR 68
+define FITS_ORIGIN "NOAO-IRAF FITS MEF utility Sep99"
+
+define LEN_MEF 271
+
+define MEF_FD Memi[$1] # File descriptor
+define MEF_HOFF Memi[$1+2] # Header offset in chars
+define MEF_ACMODE Memi[$1+3] # Access mode
+define MEF_ENUMBER Memi[$1+4] # Absolute extension number
+define MEF_EXTVER Memi[$1+5] # Extension version
+define MEF_CGROUP Memi[$1+6] # Current group read
+define MEF_HFLAG Memi[$1+7] # Header update flag
+define MEF_HSIZE Memi[$1+8] # Header size
+define MEF_HDRP Memi[$1+9] # Header area pointer
+define MEF_POFF Memi[$1+10] # Offset to pixel area (chars)
+define MEF_NDIM Memi[$1+11] # Unit dimensionality
+define MEF_NAXIS Memi[$1+$2+12-1] # Upto 7 axis
+define MEF_BITPIX Memi[$1+18] # Unit datatype
+define MEF_DATATYPE Memi[$1+19] # Unit datatype
+define MEF_SKDATA Memi[$1+20] # Has data been skipped?
+define MEF_PCOUNT Memi[$1+21] # Has data been skipped?
+define MEF_KEEPXT Memi[$1+22] # Has data been skipped?
+define MEF_EXTTYPE Memc[P2C($1+23)] # Extension type
+define MEF_FNAME Memc[P2C($1+63)] # Filename
+define MEF_OBJECT Memc[P2C($1+191)] # Object
+define MEF_EXTNAME Memc[P2C($1+231)] # Extension name
+
+define NEW_UNIT NEW_FILE
+
+define SIMPLE 1
+define NAXIS 2
+define NAXISN 3
+define EXTNAME 4
+define EXTVER 5
+define END 6
+define BITPIX 7
+define EXTEND 8
+define OBJECT 9
+define PCOUNT 10
+define GCOUNT 11
+define INHERIT 12
+define FILENAME 13
+define XTENSION 14
diff --git a/lib/pkg/rg.h b/lib/pkg/rg.h
new file mode 100644
index 00000000..0d068132
--- /dev/null
+++ b/lib/pkg/rg.h
@@ -0,0 +1,8 @@
+# Definitions for the RANGES structure.
+
+define LEN_RG 2
+
+define RG_NPTS Memi[$1] # Number of points in ranges
+define RG_NRGS Memi[$1+1] # Number of range intervals
+define RG_X1 Memi[$1+2*($2)] # Start of interval $2
+define RG_X2 Memi[$1+2*($2)+1] # End of interval $2
diff --git a/lib/pkg/rmsorted.h b/lib/pkg/rmsorted.h
new file mode 100644
index 00000000..f0b2bcc2
--- /dev/null
+++ b/lib/pkg/rmsorted.h
@@ -0,0 +1,15 @@
+define RMS_OFFSET 5 # Offset to data
+define RMS_LEN (RMS_OFFSET+2*$1+2) # Structure length
+define RMS_BOX Memi[$1] # Running box size
+define RMS_TYPE Memi[$1+1] # Output type
+define RMS_DATA Memi[$1+2] # Sorted data (ptr)
+define RMS_IN Memi[$1+3] # Mapping to input (ptr)
+define RMS_OUT Memi[$1+4] # Mapping to output (ptr)
+
+define DATA Memr[RMS_DATA($1)+$2]
+define IN Mems[RMS_IN($1)+$2]
+define OUT Mems[RMS_OUT($1)+$2]
+
+define RMS_TYMED 1 # Median
+define RMS_TYMAX 2 # Maximum
+define RMS_TYMIN 3 # Minimum
diff --git a/lib/pkg/skywcs.h b/lib/pkg/skywcs.h
new file mode 100644
index 00000000..c0c6a3b7
--- /dev/null
+++ b/lib/pkg/skywcs.h
@@ -0,0 +1,132 @@
+# Public definitions file for the SKYWCS library.
+
+# Define the SKYWCS library parameters.
+
+define S_VXOFF 1
+define S_VYOFF 2
+define S_VXSTEP 3
+define S_VYSTEP 4
+define S_EQUINOX 5
+define S_EPOCH 6
+define S_CTYPE 7
+define S_RADECSYS 8
+define S_WTYPE 9
+define S_PLNGAX 10
+define S_PLATAX 11
+define S_XLAX 12
+define S_YLAX 13
+define S_PIXTYPE 14
+define S_NLNGAX 15
+define S_NLATAX 16
+define S_NLNGUNITS 17
+define S_NLATUNITS 18
+define S_COOSYSTEM 19
+define S_STATUS 20
+
+# Define the list of supported fundamental coordinate systems.
+
+define FTYPE_LIST "|fk4|noefk4|fk5|icrs|apparent|ecliptic|galactic|\
+supergalactic|"
+
+define FTYPE_FK4 1
+define FTYPE_FK4NOE 2
+define FTYPE_FK5 3
+define FTYPE_ICRS 4
+define FTYPE_GAPPT 5
+define FTYPE_ECLIPTIC 6
+define FTYPE_GALACTIC 7
+define FTYPE_SUPERGALACTIC 8
+
+# Define the list of supported coordinate systems.
+
+define CTYPE_LIST "|equatorial|ecliptic|galactic|supergalactic|"
+
+define CTYPE_EQUATORIAL 1
+define CTYPE_ECLIPTIC 2
+define CTYPE_GALACTIC 3
+define CTYPE_SUPERGALACTIC 4
+
+# Define the supported equatoral reference systems.
+
+define EQTYPE_LIST "|fk4|fk4-no-e|fk5|icrs|gappt|"
+
+define EQTYPE_FK4 1
+define EQTYPE_FK4NOE 2
+define EQTYPE_FK5 3
+define EQTYPE_ICRS 4
+define EQTYPE_GAPPT 5
+
+# Define the input coordinate file longitude latitude units.
+
+define SKY_LNG_UNITLIST "|degrees|radians|hours|"
+define SKY_LAT_UNITLIST "|degrees|radians|"
+
+define SKY_DEGREES 1
+define SKY_RADIANS 2
+define SKY_HOURS 3
+
+# Define the list of supported image sky projection types.
+
+define WTYPE_LIST "|lin|azp|tan|sin|stg|arc|zpn|zea|air|cyp|car|\
+mer|cea|cop|cod|coe|coo|bon|pco|gls|par|ait|mol|csc|qsc|tsc|tnx|zpx|"
+
+define PTYPE_LIST "|z|z|z|z|z|z|z|z|z|c|c|c|c|n|n|n|n|c|c|c|c|c|c|c|c|c|\
+x|x|"
+
+define WTYPE_LIN 1
+define WTYPE_AZP 2
+define WTYPE_TAN 3
+define WTYPE_SIN 4
+define WTYPE_STG 5
+define WTYPE_ARC 6
+define WTYPE_ZPN 7
+define WTYPE_ZEA 8
+define WTYPE_AIR 9
+define WTYPE_CYP 10
+define WTYPE_CAR 11
+define WTYPE_MER 12
+define WTYPE_CEA 13
+define WTYPE_COP 14
+define WTYPE_COD 15
+define WTYPE_COE 16
+define WTYPE_COO 17
+define WTYPE_BON 18
+define WTYPE_PCO 19
+define WTYPE_GLS 20
+define WTYPE_PAR 21
+define WTYPE_AIT 22
+define WTYPE_MOL 23
+define WTYPE_CSC 24
+define WTYPE_QSC 25
+define WTYPE_TSC 26
+define WTYPE_TNX 27
+define WTYPE_ZPX 28
+
+define PTYPE_NAMES "|z|c|n|x|"
+
+define PTYPE_ZEN 1
+define PTYPE_CYL 2
+define PTYPE_CON 3
+define PTYPE_EXP 4
+
+# Define the supported image axis types.
+
+define AXTYPE_LIST "|ra|dec|glon|glat|elon|elat|slon|slat|"
+
+define AXTYPE_RA 1
+define AXTYPE_DEC 2
+define AXTYPE_GLON 3
+define AXTYPE_GLAT 4
+define AXTYPE_ELON 5
+define AXTYPE_ELAT 6
+define AXTYPE_SLON 7
+define AXTYPE_SLAT 8
+
+# Define the supported image pixel coordinate systems.
+
+define PIXTYPE_LIST "|logical|tv|physical|world|"
+
+define PIXTYPE_LOGICAL 1
+define PIXTYPE_TV 2
+define PIXTYPE_PHYSICAL 3
+define PIXTYPE_WORLD 4
diff --git a/lib/pkg/xtanswer.h b/lib/pkg/xtanswer.h
new file mode 100644
index 00000000..46c382bf
--- /dev/null
+++ b/lib/pkg/xtanswer.h
@@ -0,0 +1,5 @@
+# Answers for emphatic yes and no.
+
+define XT_ANSWERS "|no|yes|NO|YES|"
+define ALWAYSNO 2
+define ALWAYSYES 3
diff --git a/lib/plio.h b/lib/plio.h
new file mode 100644
index 00000000..1cd37ed3
--- /dev/null
+++ b/lib/plio.h
@@ -0,0 +1,186 @@
+# PLIO.H -- Package internal global defines for the Pixel List package.
+
+# Size limiting definitons
+define PL_MAXDIM 7 # maximum mask dimensionality
+define PL_MAGICVAL 2014 # identifies mask and version no.
+define PL_LLBUFLEN 512 # initial llbuf size
+define PL_STARTINC 512 # starting llbuf increment on overflow
+define PL_MAXINC 4096 # maximum increment per resize
+define PL_MAXFREE 40 # max percent free (wasted) space
+define PL_MAXDEPTH 27 # max mask depth, bits
+define PL_DEFMAXLINE 1024 # default max elements per [lr]list
+
+# Main PL descriptor.
+define LEN_PLDES 28
+define MLO 3 # must update PLSET.H too if changed
+
+define PL_MAGIC Memi[$1] # magic / version no.
+define PL_PRIVATE1 Memi[$1+1] # private data for client
+define PL_PRIVATE2 Memi[$1+2] # more private data for client
+define PL_MAXLINE Memi[$1+MLO] # max elements per [lr]list [PLSET.H]
+define PL_MAXVAL Memi[$1+4] # max pixel value (2**N - 1)
+define PL_NAXES Memi[$1+5] # dimensionality
+define PL_AXLEN Memi[$1+6+$2-1] # length of each axis
+define PL_PLANE Memi[$1+13+$2-1] # active plane (pl_setplane)
+define PL_LLBP Memi[$1+20] # line list bufptr
+define PL_LLOP Memi[$1+21] # next location in llbuf
+define PL_LLLEN Memi[$1+22] # current llbuf length
+define PL_LLFREE Memi[$1+23] # amount of free space in list
+define PL_LLNUPDATES Memi[$1+24] # number of list modifications
+define PL_LLINC Memi[$1+25] # current llbuf increment on overflow
+define PL_NLP Memi[$1+26] # number of line pointers
+define PL_LPP Memi[$1+27] # ptr to array of LL offsets
+
+define PM_REFIM PL_PRIVATE1($1) # reference image
+define PM_MAPXY PL_PRIVATE2($1) # need to transform coords
+
+# Handy macros.
+define Ref (PL_LLBP($1)+$2)# llbuf offset -> pointer
+define LL Mems[Ref($1,$2)]# pointer -> array reference
+define PL_LP Memi[PL_LPP($1)+$2-1]
+define PL_EMPTYLINE 0 # llbuf offset of the empty line
+define PL_NEEDCOMPRESS ((PL_LLFREE($1)*100/PL_LLOP($1))>PL_MAXFREE)
+define LL_MAXLEN PL_MAXLINE($1)
+define RL_MAXLEN (PL_MAXLINE($1)*3)
+define MV ((2**min($1,27))-1)
+
+# Handy rasterop decoding macros.
+define R_OPCODE and($1,17B)
+define R_DATA ($1/100B)
+define R_NEED_DST (and(xor(($1)/2,($1)),5)!=0)
+define R_NEED_SRC (and(xor(($1)/4,($1)),3)!=0)
+define R_NOTDST (and($1,6)==4)
+define R_NOTSRC (and($1,6)==2)
+
+# Internal rasterop definitions (PIX_SRC=14B, PIX_DST=12B, CLR=0B, SET=17B).
+define PIX_NOTSRC 03B
+define PIX_NOTDST 05B
+define PIX_SRC_AND_DST 10B
+define PIX_SRC_OR_DST 16B
+define PIX_SRC_XOR_DST 06B
+define PIX_SRC_AND_NOTDST 04B
+define PIX_SRC_OR_NOTDST 15B
+define PIX_NOTSRC_AND_DST 02B
+define PIX_NOTSRC_OR_DST 13B
+define PIX_NOT_SRC_AND_DST 07B
+define PIX_NOT_SRC_OR_DST 01B
+define PIX_NOT_SRC_XOR_DST 11B
+
+
+# Macro defines for the line list data format.
+
+# ----- Old/original line list header definitions. This version uses a
+# ----- three element header, but the maximum values are limited to 32K by
+# ----- the use of type short.
+
+# Line list definitions (accessed as a short integer array).
+define OLL_NREF $1[1] # number of references
+define OLL_BLEN $1[2] # length of buffer containing LL
+define OLL_LEN $1[3] # length of encoded line list
+define OLL_FIRST 4 # first data range entry in list
+
+# Line list definitions (accessed via a short integer pointer).
+define OLP_NREF Mems[$1] # number of references
+define OLP_BLEN Mems[$1+1] # length of buffer containing LL
+define OLP_LEN Mems[$1+2] # length of encoded line list
+define OLP_FIRST 3 # first data range entry in list
+
+
+# ----- New format line list header definitions. This version uses a
+# ----- variable length header and a version number to allow new encodings
+# ----- while retaining backwards compatibility.
+
+define LL_CURVERSION (-100) # LL version code (must be negative)
+define LL_OLDFORMAT (LL_VERSION($1) > 0)
+define LL_CURHDRLEN 7
+
+# Line list definitions (accessed as a short integer array).
+define LL_NREFS $1[1] # number of references
+define LL_HDRLEN $1[2] # length of encoded line list
+define LL_VERSION $1[3] # version number (negative)
+define LL_LENLO $1[4] # length of encoded line list
+define LL_LENHI $1[5] # length of encoded line list
+define LL_BLENLO $1[6] # length of LL buffer
+define LL_BLENHI $1[7] # length of LL buffer
+
+# Handy line list macros.
+define LL_NREF (int(LL_NREFS($1)))
+define LL_BLEN ((int(LL_BLENHI($1)))*32768+(int(LL_BLENLO($1))))
+define LL_SETBLEN LL_BLENLO($1)=mod($2,32768); LL_BLENHI($1)=($2)/32768
+define LL_LEN ((int(LL_LENHI($1)))*32768+(int(LL_LENLO($1))))
+define LL_SETLEN LL_LENLO($1)=mod($2,32768); LL_LENHI($1)=($2)/32768
+define LL_FIRST (LL_HDRLEN($1)+1)
+
+# Line list definitions (accessed as a short integer pointer).
+define LP_NREFS Mems[$1] # number of references
+define LP_HDRLEN Mems[$1+1] # length of encoded line list
+define LP_VERSION Mems[$1+2] # version number (negative)
+define LP_LENLO Mems[$1+3] # length of encoded line list
+define LP_LENHI Mems[$1+4] # length of encoded line list
+define LP_BLENLO Mems[$1+5] # length of LL buffer
+define LP_BLENHI Mems[$1+6] # length of LL buffer
+
+# Handy line list pointer macros.
+define LP_NREF (int(LP_NREFS($1)))
+define LP_BLEN (int(LP_BLENHI($1))*32768+int(LP_BLENLO($1)))
+define LP_SETBLEN LP_BLENLO($1)=mod($2,32768); LP_BLENHI($1)=($2)/32768
+define LP_LEN (int(LP_LENHI($1))*32768+int(LP_LENLO($1)))
+define LP_SETLEN LP_LENLO($1)=mod($2,32768); LP_LENHI($1)=($2)/32768
+define LP_FIRST (($1)+LP_HDRLEN($1))
+
+
+# Packed instruction decoding.
+define I_SHIFT 10000B # shift to encode/decode data bits
+define I_DATA and(int($1),7777B) # extract data
+define I_OPCODE (($1)/10000B) # extract opcode value
+define I_OPCODEMASK and(int($1),70000B) # extract opcode mask
+define I_DATAMAX 7777B # max data field value
+define I_PVMAX 777777777B # max mask pixel value (27 bits)
+
+# LL instruction opcodes.
+define I_ZN 0 # N zeros
+define I_HN 4 # N high values
+define I_PN 5 # N-1 zeros and 1 high value
+define I_SH 1 # set high value (2 words)
+define I_IH 2 # increment high value
+define I_DH 3 # decrement high value
+define I_IS 6 # increment and output 1 high value
+define I_DS 7 # decrement and output 1 high value
+
+# The LL instruction opcodes again, but as bitmasks this time.
+define M_ZN 00000B
+define M_HN 40000B
+define M_PN 50000B
+define M_SH 10000B
+define M_IH 20000B
+define M_DH 30000B
+define M_IS 60000B
+define M_DS 70000B
+
+# The following bit is set if the instruction changes the current position.
+define M_MOVE 40000B
+
+# PL external format descriptor (with some extra space).
+define LEN_PLEXTERN 20
+define PLE_MAGIC Memi[$1] # usual magic value
+define PLE_NAXES Memi[$1+1] # number of axes
+define PLE_AXLEN Memi[$1+2+$2-1] # length of each axis
+define PLE_LLOP Memi[$1+9] # next location in llbuf
+define PLE_LLLEN Memi[$1+10] # length of llbuf
+define PLE_NLP Memi[$1+11] # number of line pointers
+define PLE_NLPX Memi[$1+12] # length of compressed LP array
+define PLE_EXLEN Memi[$1+13] # length of full PLEXTERN structure
+define PLE_FLAGS Memi[$1+14] # flags for type of encoding
+define PLE_MAXLINE Memi[$1+15] # max elements per [lr]list
+define PLE_MAXVAL Memi[$1+16] # max pixel value
+
+# PLIO mask savefile descriptor.
+define PLIO_SVMAGIC 123126B # "SV"
+define LEN_SVDES 3
+define SV_MAGIC Memi[$1] # identifies file type
+define SV_TITLELEN Memi[$1+1] # title string length, including EOS
+define SV_MASKLEN Memi[$1+2] # encoded mask length, shorts
+
+# Internal symbols.
+define LOOP_DONE 1
+define LOOP_AGAIN 0
diff --git a/lib/plset.h b/lib/plset.h
new file mode 100644
index 00000000..5603a5b6
--- /dev/null
+++ b/lib/plset.h
@@ -0,0 +1,57 @@
+# PLSET.H -- User global defines for the Pixel List (image mask) package.
+
+define PL_MAXDIM 7 # maximum mask dimensionality
+define PL_MAXDEPTH 27 # max mask depth, pixels
+define PL_NOTEQUAL 0 # two masks are not equivalent
+define PL_EQUAL 1 # two masks are equivalent
+define PL_UPDATE 1 # enable overwrite of existing savefile
+
+# PLSETI/PLSTATI parameter codes.
+define P_PRIVATE1 1 # used by client, e.g., PMIO
+define P_PRIVATE2 2 # used by client, e.g., PMIO
+define P_MAXLINE 3 # used to size dynamic line buffers
+define P_DEPTH 4 # mask pixel depth, bits (1=boolean)
+
+# Range list definitions. For applications which access mask lines as range
+# lists (ranges of constant nonzero value) rather than as pixel arrays.
+# Here, $1 = rl (the range-list array).
+
+define RL_FIRST 2 # first data range entry in list
+define RL_LENELEM 3 # size of each element of list
+define RL_MAXLEN (Memi[$1+3]*3) # maximum range list length (arg=pl)
+
+define RL_LEN $1[1,1] # physical length of range list
+define RL_AXLEN $1[2,1] # length of mask image line
+define RLS_LEN Mems[$1] # RL_LEN for rl = ptr to int
+define RLS_AXLEN Mems[$1+1] # RL_AXLEN " " "
+define RLI_LEN Memi[$1] # RL_LEN for rl = ptr to int
+define RLI_AXLEN Memi[$1+1] # RL_AXLEN " " "
+define RLL_LEN Meml[$1] # RL_LEN for rl = ptr to int
+define RLL_AXLEN Meml[$1+1] # RL_AXLEN " " "
+
+define RL_X $1[1,$2] # fields of a range list entry ($2=rn)
+define RL_N $1[2,$2] # direct array references
+define RL_V $1[3,$2]
+
+define RL_XOFF 0 # offsets
+define RL_NOFF 1
+define RL_VOFF 2
+
+# Public rasterop definitions. Rasterops are constructed using these macros
+# and the bitwise intrinsic functions 'and', 'or', and 'xor' (but not 'not';
+# use the PIX_NOT macro instead).
+
+define PIX_NOT (and(17B,not($1)))
+define PIX_VALUE (($1)*100B)
+
+define PIX_CLR 00B # clear destination subregion
+define PIX_SET 17B # set destination to a constant value
+define PIX_SRC 14B # denotes source in rasterops
+define PIX_DST 12B # denotes destination in rasterops
+
+# Options for PL_DEBUG output.
+define PD_SUMMARY 1 # print mask summary information
+define PD_INDEX 2 # print index
+define PD_LLOUT 4 # print line lists as line lists
+define PD_RLOUT 8 # print line lists as range lists
+define PD_LHDR 16 # print line headers
diff --git a/lib/pmset.h b/lib/pmset.h
new file mode 100644
index 00000000..7b001514
--- /dev/null
+++ b/lib/pmset.h
@@ -0,0 +1,43 @@
+# PMSET.H -- Pixel mask definitions (PMIO is layered upon IMIO and PLIO).
+
+define PM_MAXDIM PL_MAXDIM
+define PM_MAXDEPTH PL_MAXDEPTH
+define PM_UPDATE PL_UPDATE
+
+# PMIO parameter codes.
+define P_REFIM P_PRIVATE1
+define P_MAPXY P_PRIVATE2
+
+# MIO parameter codes.
+define P_PMDES 1 # PMIO descriptor
+define P_IMDES 2 # IMIO descriptor
+define P_REGCOORDS 3 # mio_setrange region relative coords
+define P_PMCLOSE 4 # close mask at image close time
+
+# IMPLMAP flags.
+define BOOLEAN_MASK 100B # convert mask to boolean
+define INVERT_MASK 200B # invert a mask (PIX_NOT)
+
+# The following routines are identical in both the PMIO and PLIO packages.
+define pm_close pl_close
+define pm_compare pl_compare
+define pm_compress pl_compress
+define pm_create pl_create
+define pm_debug pl_debug
+define pm_emptyline pl_emptyline
+define pm_gsize pl_gsize
+define pm_load pl_load
+define pm_loadf pl_loadf
+define pm_loadim pl_loadim
+define pm_newcopy pl_newcopy
+define pm_open pl_open
+define pm_save pl_save
+define pm_savef pl_savef
+define pm_saveim pl_saveim
+define pm_ssize pl_ssize
+
+# The following nested include is safe because the PLIO mkpkg will update the
+# modify date of <pmset.h> if <plset.h> is modified. Hence, only <pmset.h>
+# need be referenced in dependency files lists in applications code.
+
+include <plset.h>
diff --git a/lib/poll.h b/lib/poll.h
new file mode 100644
index 00000000..f519411f
--- /dev/null
+++ b/lib/poll.h
@@ -0,0 +1,26 @@
+# POLL.H -- FPOLL definitions (poll a set of file descriptors).
+
+define MAX_POLL_FD 32 # max number of polling fds
+define MPFD MAX_POLL_FD # utility shorthand
+define LEN_FPOLL (4+(3*MPFD)) # length of polling structure
+
+define INFTIM -1 # poll will block until event
+
+
+# Structure of file descriptor/event pairs supplied in the poll arrays. The
+# array elements are zero-indexed.
+define POLL_NFD Memi[$1] # no. of file descriptors to poll
+define POLL_FD Memi[$1+1+(0*MPFD)+$2] # file descriptor array
+define POLL_EVENTS Memi[$1+1+(1*MPFD)+$2] # events of interest on fd
+define POLL_REVENTS Memi[$1+1+(2*MPFD)+$2] # (return) events on fd
+
+# Testable select events.
+define POLLIN 001B # fd is readable
+define POLLPRI 002B # priority info at fd
+define POLLOUT 004B # fd is writeable (won't block)
+
+# Non-testable poll events (may not be specified in events field,
+# but may be returned in revents field).
+define POLLERR 010B # fd has error condition
+define POLLHUP 020B # fd has been hung up on
+define POLLNVAL 040B # invalid pollfd entry
diff --git a/lib/prc.com b/lib/prc.com
new file mode 100644
index 00000000..719859f1
--- /dev/null
+++ b/lib/prc.com
@@ -0,0 +1,19 @@
+define MAX_PS 10 # maximum pseudofiles
+
+# Process table common.
+
+int pr_pid[MAX_CHILDPROCS] # process id
+int pr_status[MAX_CHILDPROCS] # process status
+int pr_inchan[MAX_CHILDPROCS] # input IPC channel from child
+int pr_infd[MAX_CHILDPROCS] # fd of input IPC
+int pr_outchan[MAX_CHILDPROCS] # output IPC channel to child
+int pr_outfd[MAX_CHILDPROCS] # fd of output IPC
+int pr_nopen[MAX_CHILDPROCS] # number of open channels
+int pr_pstofd[MAX_CHILDPROCS,MAX_PS] # pseudofile -> FD
+int pr_last_exit_code # exit code of last process closed
+int pr_lastio # index of last active process
+int pr_index # index of current process
+int pr_oldipc # old X_IPC handler
+
+common /prccom/ pr_pid, pr_status, pr_inchan, pr_infd, pr_outchan, pr_outfd,
+ pr_nopen, pr_pstofd, pr_lastio, pr_last_exit_code, pr_index, pr_oldipc
diff --git a/lib/printf.h b/lib/printf.h
new file mode 100644
index 00000000..9577b267
--- /dev/null
+++ b/lib/printf.h
@@ -0,0 +1,52 @@
+# PRINTF.H -- Printf definitions.
+
+define SZ_OBUF 1024 # fmtio output buffer
+define USE_DEFAULT (-999) # flag to use default value
+define DECIMAL 10 # default radix
+define OCTAL 8
+define HEX 16
+define TABSTOP 8
+define START_OF_FORMAT '%' # begin a format specification
+define GET_FIELD '*' # get W,D,or C field from parg call
+define OVFL_CHAR '*' # output "***" if not enough room
+
+# Format specification characters. ("%w.dc")
+
+define FMT_BOOL 'b' # print a boolean ("yes" or "no")
+define FMT_CHAR 'c' # print a character constant
+define FMT_DECIMAL 'd' # print a decimal integer
+define FMT_EXPON 'e' # print in Fortran 'E' format
+define FMT_FIXED 'f' # print in Fortran 'F' (fixed) format
+define FMT_GENERAL 'g' # print the smaller of E or F formats
+define FMT_HMS 'h' # print as "nn:nn:nn.nnn"
+define FMT_MINSEC 'm' # print as "nn:nn.nnn"
+define FMT_OCTAL 'o' # print octal integer
+define FMT_RADIX 'r' # "%w.drN": print integer, radix N
+define FMT_STRING 's' # print a string
+define FMT_TOCOLUMN 't' # "%Nt": advance to column N
+define FMT_UNSIGNED 'u' # print an unsigned integer
+define FMT_WHITESPACE 'w' # "%Nw": output N blanks
+define FMT_HEX 'x' # print a hex integer
+define FMT_COMPLEX 'z' # print a complex number "(r,r)"
+
+
+# for fmt_init()
+
+define FMT_INITIALIZE 0
+define REGULAR_FILE 1
+define STRING_FILE 2
+define CL_PARAM 3
+
+
+# FPRFMT states (while interpreting a "%w.dC" format spec)
+
+define FMT_START 1
+define GET_WIDTH_1 2
+define GET_WIDTH_2 3
+define GET_DECPL 4
+define GET_FMTCHAR 5
+define GET_RADIX 6
+define GET_OPERAND 7
+
+define NOT_DONE_YET 0 # return values
+define ALL_DONE 1
diff --git a/lib/protect.h b/lib/protect.h
new file mode 100644
index 00000000..0a89be50
--- /dev/null
+++ b/lib/protect.h
@@ -0,0 +1,5 @@
+# PROTECT.H -- Action codes for the fio.protect function.
+
+define REMOVE_PROTECTION 0
+define SET_PROTECTION 1
+define QUERY_PROTECTION 2
diff --git a/lib/prstat.h b/lib/prstat.h
new file mode 100644
index 00000000..0e2e90e1
--- /dev/null
+++ b/lib/prstat.h
@@ -0,0 +1,18 @@
+# PRSTAT.H -- Process status parameters.
+
+define PR_STATUS 1 # process status (OK, P_DEAD)
+define PR_INCHAN 2 # input channel
+define PR_INFD 3 # FD of input stream
+define PR_OUTCHAN 4 # output channel
+define PR_OUTFD 5 # FD of output stream
+define PR_STDIN 7 # FD's assigned to pseudofile streams
+define PR_STDERR 8
+define PR_STDOUT 9
+define PR_STDGRAPH 10
+define PR_STDIMAGE 11
+define PR_STDPLOT 12
+
+define P_RUNNING 0 # process is ready
+define P_BUSY 1 # process is busy with subprotocol
+define P_DONE 2 # process terminated normally
+define P_DEAD 3 # process died and sent us X_IPC
diff --git a/lib/psset.h b/lib/psset.h
new file mode 100644
index 00000000..5caaba81
--- /dev/null
+++ b/lib/psset.h
@@ -0,0 +1,20 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# PSSET.H -- Public definitions for the PSIO interface.
+
+# Page size definitions.
+define PAGE_LETTER 1 # page sizes
+define PAGE_LEGAL 2
+define PAGE_A4 3
+define PAGE_B5 4
+
+# Font definitions.
+define F_ROMAN 1 # times-roman font
+define F_ITALIC 3 # times-roman italic font
+define F_BOLD 2 # times-roman bold font
+define F_TELETYPE 4 # fixed-width font
+define F_PREVIOUS 5 # previous font
+
+# Flags.
+define DEFAULT_FOOTER 1 # use footer (default)
+define FNUM_ONLY 2 # use footer page numbers only
diff --git a/lib/qpexset.h b/lib/qpexset.h
new file mode 100644
index 00000000..89dfed85
--- /dev/null
+++ b/lib/qpexset.h
@@ -0,0 +1,13 @@
+# QPEXSET -- Public definitions for the QPEX package.
+
+# Set/Stat parameters.
+# (none at present)
+
+# QPEX_DEBUG options flags.
+define QPEXD_SUMMARY 0001B # print summary information
+define QPEXD_SHOWEXPR 0002B # regenerate compiled expression
+define QPEXD_PROGRAM 0004B # decode compiled program
+define QPEXD_SHOWLUTS 0010B # print lookup tables
+define QPEXD_ETLIST 0020B # dump expr terms list
+define QPEXD_LTLIST 0040B # dump lookup table list
+define QPEXD_SHOWALL 0077B # show/dump everything
diff --git a/lib/qpioset.h b/lib/qpioset.h
new file mode 100644
index 00000000..b4cbc99d
--- /dev/null
+++ b/lib/qpioset.h
@@ -0,0 +1,39 @@
+# QPIOSET.H -- QPIO User accessible interface parameters.
+
+define qpio_stati qpiost # (name collision)
+define qpio_statr qpiovr # (name collision)
+define qpio_setr qpiour # (name collision)
+
+# Read-Write Parameters.
+define QPIO_BLOCKFACTOR 1 # blocking factor for image matrices
+define QPIO_XBLOCKFACTOR 2 # X blocking factor for image matrices
+define QPIO_YBLOCKFACTOR 3 # Y blocking factor for image matrices
+define QPIO_BUCKETLEN 4 # event list bucket size, nevents
+define QPIO_DEBUG 5 # debug level, debug=0 for no messages
+define QPIO_EVXOFF 6 # short offset of X field of event
+define QPIO_EVXTYPE 7 # datatype of X field of event
+define QPIO_EVYOFF 8 # short offset of Y field of event
+define QPIO_EVYTYPE 9 # datatype of Y field of event
+define QPIO_EX 10 # QPEX descriptor (event attr. filter)
+define QPIO_NODEFFILT 11 # disable use of default filter
+define QPIO_NODEFMASK 12 # disable use of default mask
+define QPIO_NOINDEX 13 # flag to disable use of index
+define QPIO_OPTBUFSIZE 14 # optimum buffer size for IMIO/QPF/FIO
+define QPIO_PL 15 # PLIO descriptor (pixel mask)
+
+# Read-Only Parameters.
+define QPIO_EVENTLEN 16 # length of event struct, shorts
+define QPIO_FD 17 # file descriptor of event list lfile
+define QPIO_INDEXLEN 18 # event list index length (0=noindex)
+define QPIO_IXXOFF 19 # short offset of X field used in index
+define QPIO_IXXTYPE 20 # datatype of X field used in index
+define QPIO_IXYOFF 21 # short offset of Y field used in index
+define QPIO_IXYTYPE 22 # datatype of Y field used in index
+define QPIO_LF 23 # lfile in which event list is stored
+define QPIO_MASKP 24 # char pointer to mask-name buffer
+define QPIO_MAXEVP 25 # pointer to MAX-event fields struct
+define QPIO_MINEVP 26 # pointer to MIN-event fields struct
+define QPIO_NCOLS 27 # number of columns in image
+define QPIO_NLINES 28 # number of lines in image
+define QPIO_PARAMP 29 # char pointer to param-name buffer
+define QPIO_QP 30 # backpointer to QPOE descriptor
diff --git a/lib/qpset.h b/lib/qpset.h
new file mode 100644
index 00000000..9f607ebe
--- /dev/null
+++ b/lib/qpset.h
@@ -0,0 +1,39 @@
+# QPSET.H -- User accessible definitions for the QPOE package.
+
+define SZ_COMMENT 256 # max size comment string
+define SZ_DATATYPE 256 # max size datatype name string
+
+# QPOE Read-Write Parameters.
+define QPOE_BLOCKFACTOR 1 # blocking factor for pixel arrays
+define QPOE_XBLOCKFACTOR 2 # X blocking factor for pixel arrays
+define QPOE_YBLOCKFACTOR 3 # Y blocking factor for pixel arrays
+define QPOE_BUCKETLEN 4 # event list bucket length, nevents
+define QPOE_CACHESIZE 5 # lfile (buffer) cache size, nlfiles
+define QPOE_DATABUFLEN 6 # QPEX data buffer length, chars
+define QPOE_DEBUGLEVEL 7 # debug level (0 = no messages)
+define QPOE_DEFLUTLEN 8 # default lookup table length (bins)
+define QPOE_INDEXLEN 9 # symbol table hash index length
+define QPOE_LUTMINRANGES 10 # min ranges before using LUT
+define QPOE_LUTSCALE 11 # scale nranges to LUT bins
+define QPOE_MAXFRLUTLEN 12 # max full-res LUT length
+define QPOE_MAXLFILES 13 # max lfiles in datafile
+define QPOE_MAXPTPAGES 14 # max lfiles in datafile
+define QPOE_MAXPUSHBACK 15 # max amount of pushed back macro data
+define QPOE_MAXRRLUTLEN 16 # max reduced-res LUT length
+define QPOE_OPTBUFSIZE 17 # optimum buffer size for IMIO/QPF/FIO
+define QPOE_PAGESIZE 18 # page size of datafile, bytes
+define QPOE_PROGBUFLEN 19 # QPEX program buffer length, ints
+define QPOE_SBUFSIZE 20 # symtab string buf size, chars (init)
+define QPOE_STABLEN 21 # symtab data area size, su (init)
+define QPOE_NODEFFILT 22 # disable use of default filter
+define QPOE_NODEFMASK 23 # disable use of default mask
+
+# QPOE Read-Only Parameters.
+define QPOE_FM 24 # FMIO descriptor
+define QPOE_MODE 25 # poefile access mode
+define QPOE_ST 26 # SYMTAB symbol table descriptor
+define QPOE_VERSION 27 # QPOE version number
+
+# Parameter flags (for qp_addf).
+define QPF_NONE (-1) # no flags (0 gives default flags)
+define QPF_INHERIT 0002B # copy parameter in a NEW_COPY open
diff --git a/lib/root.hd b/lib/root.hd
new file mode 100644
index 00000000..cdbe2eea
--- /dev/null
+++ b/lib/root.hd
@@ -0,0 +1,61 @@
+# IRAF root help directory. Help packages are structured hierarchically and
+# (ideally) closely follow the actual package structure. Each package in
+# the help database must appear as a subdirectory of this, the root help
+# directory. Due to the way the datbase is indexed, package names must be
+# unique within the database despite the fact that the logical structure is
+# hierarchical.
+#
+# The declarations for the main branches of the help tree follow. The help
+# tree will be searched by conducting a depth first search of the branches
+# shown, in the order shown (since sorting is disabled). The root help
+# directory itself is not searched when looking for a help module as this
+# would negate the advantages of the depth first search. The purpose of the
+# underscore prefixed packages is to make the real packages appear as modules
+# in a non-root package. The package "_sys", for example, does nothing but
+# define the package "sys", all to make "sys" appear as a help module in
+# package "_sys". Making both packages and programs appear as modules gives
+# maximum scope for resolving ambiguous help keyword templates.
+
+.nosort
+_clpackage pkg = lib$clpackage.hd, hlp = clpackage$clpackage.men
+_sys pkg = sys$_sys.hd, hlp = sys$sys.men
+_math pkg = math$_math.hd, hlp = math$math.men
+_doc pkg = doc$_doc.hd, hlp = doc$doc.men
+
+
+# SETTING UP HELP DIRECTORIES
+#
+# The format of a help directory is logical directory definitions followed
+# by decarations for the help modules within the package (clpackage, sys,
+# etc.). The format of a module declaration is the module name followed by
+# a list of filenames. Five types of help files may be associated with each
+# package:
+#
+# men.men file (CL packages only)
+# hlp user help text for module
+# sys system (technical) help text for module
+# src source file (only one source file permitted at present)
+# pkg if the module is a subpackage, the name of the .hd file
+# for the subpackage.
+#
+# The format of a file name is [ldir$]filename. Logical directories may be
+# defined within the help directory file, but unlike CL environment declarations
+# recursion is not permitted. The syntax is as follows:
+#
+# $ldir = "irafdir$subdir/[subdir/...]"
+# or
+# $ldir = "./subdir/[subdir/...]"
+#
+# where a leading "." refers to the directory in which the help directory file
+# is resident, and where "irafdir" refers to an IRAF logical directory defined
+# in the CL at LOGIN TIME, i.e., lib, pkg, sys, math, and so on. Note that the
+# CL package directories are defined only when a package is loaded and hence
+# may not be used in a help directory. If no ldir is given in a filename, the
+# default directory is the directory in which the help directory file is found.
+#
+# References to subpackages may not be recursive. Recursion is however useful
+# as an alternative to the "_package" technique for making all packages appear
+# as modules too. A package may contain itself as a module provided the "pkg"
+# file is ommitted. This enters the package into the database as a module,
+# causing it to be found in ambiguous searches and making the associated help
+# files accessible.
diff --git a/lib/scr/cursor.key b/lib/scr/cursor.key
new file mode 100644
index 00000000..c1ea5ef6
--- /dev/null
+++ b/lib/scr/cursor.key
@@ -0,0 +1,56 @@
+Cursor Mode Keystrokes
+
+ A draw and label the axes of current viewport
+ B backup over last instruction in frame buffer
+ C print the cursor position
+ D draw a line by marking the endpoints
+ E expand plot by setting window corners
+ F set fast cursor (for HJKL)
+ H step cursor left
+ J step cursor down
+ K step cursor up
+ L step cursor right
+ M move point under cursor to center of screen
+ P zoom out (restore previous expansion)
+ R redraw the screen
+ T draw a text string
+ U undo last frame buffer edit
+ V set slow cursor (for HJKL)
+ W select WCS at current position of cursor
+ X zoom in, X only
+ Y zoom in, Y only
+ Z zoom in, both X and Y
+ < set lower limit of plot to the cursor y value
+ > set upper limit of plot to the cursor y value
+ \ escape next character
+ : set cursor mode options
+ :! send a command to the host system
+ = shorthand for :.snap (make graphics hardcopy)
+ 0 reset and redraw
+ 1-9 roam
+
+
+Cursor Mode Commands:
+
+ :.axes[+-] draw axes of viewport whenever screen is redrawn
+ :.case[+-] enable case sensitivity for keystrokes
+ :.clear clear alpha memory (e.g, this text)
+ :.cursor n select cursor
+ :.gflush flush plotter output
+ :.help print help text for cursor mode
+ :.init initialize the graphics system
+ :.markcur[+-] mark cursor position after each cursor read
+ :.off [keys] disable selected cursor mode keys
+ :.on [keys] enable selected cursor mode keys
+ :.page[+-] enable screen clear before printing help text
+ :.read file fill frame buffer from a file
+ :.show print cursor mode and graphics kernel status
+ :.snap [device] make hardcopy of graphics display
+ :.txqual qual set character generator quality (normal,l,m,h)
+ :.txset format set text drawing parameters (size,up,hj,vj,etc)
+ :.xres=value set X resolution (stdgraph only)
+ :.yres=value set Y resolution (stdgraph only)
+ :.viewport x1 x2 y1 y2 set workstation viewport in world coordinates
+ :.write[!][+] file save frame buffer in a spool file
+ :.zero reset viewport and redraw frame
+
diff --git a/lib/scr/geomap.key b/lib/scr/geomap.key
new file mode 100644
index 00000000..abced624
--- /dev/null
+++ b/lib/scr/geomap.key
@@ -0,0 +1,23 @@
+ Interactive Geometric Distortion Correction
+
+? Print options
+f Fit the data and graph with the current graph type (g, x, r, y, s)
+g Graph the data and the current fit
+x,r Graph the x(in) fit residuals versus x(ref) and y(ref) respectively
+y,s Graph the y(in) fit residuals versus x(ref) and y(ref) respectively
+d,u Delete or undelete the data point nearest the cursor
+o Overplot the next graph
+c Toggle the constant x(ref), y(ref) plotting option
+t Plot a line of constant x(ref), y(ref) through nearest data point
+l Print xshift, yshift, xscale, yscale, xrotate, yrotate
+q Exit the interactive curve fitting
+
+The parameters are listed or set with the following commands which may be
+abbreviated. To list the value of a parameter type the command alone.
+
+:show List parameters
+:function [value] Fitting function (chebyshev, legendre)
+:xxorder :xyorder [value] X fitting function xorder, yorder
+:yxorder :yyorder [value] Y fitting function xorder, yorder
+:xxterms :yxterms [y/n] Include cross-terms in X, Y fit
+:reject [value] Rejection threshold
diff --git a/lib/scr/gkimosaic.key b/lib/scr/gkimosaic.key
new file mode 100644
index 00000000..cca3e010
--- /dev/null
+++ b/lib/scr/gkimosaic.key
@@ -0,0 +1,15 @@
+Gkimosaic Command Summary:
+
+ return quit
+ q quit
+ r redraw screen with new parameters
+ spacebar continue
+ ? print help information
+
+ :nx N change value of nx to N
+ :ny N change value of ny to N
+ :fill yes, :fill+, :fill sets fill = yes
+ :fill no, :fill- sets fill = no
+ :rotate yes, :rotate+, :rotate sets rotate = yes
+ :rotate no, :rotate- sets rotate = no
+ :skip +/-N skip forward/backward N plots
diff --git a/lib/scr/gtools.key b/lib/scr/gtools.key
new file mode 100644
index 00000000..9193c260
--- /dev/null
+++ b/lib/scr/gtools.key
@@ -0,0 +1,85 @@
+ GRAPH FORMAT OPTIONS - Not all options work in all programs
+
+COLON COMMANDS:
+
+:/help Print help menu
+:/redraw Redraw the graph
+
+:/drawtitle [yes|no] Draw title block?
+:/sysid [yes|no] Include the standard IRAF user/date banner?
+:/parameters string Parameter string (usual set by application)
+:/title string Title
+:/subtitle string Subtitle
+:/comments string Comments
+
+:/type string Type of graph (line, hist, or mark)
+:/mark string Mark type (point, box, plus, cross, diamond,
+ hline, vline, hebar, vebar, circle)
+:/line [0-9] Line style
+:/color [0-9] Line or mark color
+
+:/drawxlabels [yes|no] Draw X axis label?
+:/xlabel string Label for X axis
+:/xunits string Units for X axis
+:/xsize size Size of marks along the X axis
+:/xtransform type X coordinate transform type (linear or logrithmic)
+:/xwindow x1 x2 X graph window (INDEF defaults to min or max)
+:/xflip [yes|no] Flip X axis
+
+:/drawylabels [yes|no] Draw Y axis label?
+:/ylabel string Label for Y axis
+:/yunits string Units for Y axis
+:/ysize size Size of marks along the Y axis
+:/ytransform type Y coordinate transform type (linear or logrithmic)
+:/ywindow y1 y2 Y graph window (INDEF defaults to min or max)
+:/yflip [yes|no] Flip Y axis
+
+:/transpose Transpose the graph axes
+
+Format changes do not take effect until the graph is redrawn.
+
+CURSOR KEYS:
+
+a Autoscale x and y axes
+b Set bottom edge of window
+c Center window at cursor position
+d Shift window down
+e Expand window (mark lower left and upper right of new window)
+f Flip x axis
+g Flip y axis
+j Set left edge of window
+k Set right edge of window
+l Shift window left
+m Autoscale x axis
+n Autoscale y axis
+p Pan x and y axes about cursor
+r Shift window right
+t Set top edge of window
+u Shift window up
+x Zoom x axis about cursor
+y Zoom y axis about cursor
+z Zoom x and y axes about cursor
+
+
+DESCRIPTION
+
+A number of application tasks use the graphics tools in the "gtools"
+package. The graphics tools control labeling and titling of graphs and
+interactive formatting. The user changes the defaults via colon commands
+and with the window cursor keys. The windowing options are usually
+entered with the 'w' key from an application program but other keys
+may be used instead. Not all of the formating options may be available
+in a particular application; for example the graph type and mark type
+options. Check the documentation for the application program.
+Some applications set the values every time the graph is redraw so any
+user changes will be overridden.
+
+The title block consists of a system identification banner, a parameter
+string, a title string, a subtitle string, and a comment string in
+that order. The "notitle" parameter can be used to turn off all
+the title block. There are parameters to control each of the
+parts of the title block. The "subtitle" and "comments"
+parameters are rarely used by applications and so may be used to
+annotate graphs. The x and y labels consist of label and units strings.
+The "drawxlabels" and "drawylabels" parameters can be used to
+turn off both parts of the axis labels.
diff --git a/lib/scr/gtwindow.key b/lib/scr/gtwindow.key
new file mode 100644
index 00000000..2ddf02c7
--- /dev/null
+++ b/lib/scr/gtwindow.key
@@ -0,0 +1,21 @@
+ SET GRAPH WINDOW
+
+a Autoscale x and y axes
+b Set bottom edge of window
+c Center window at cursor position
+d Shift window down
+e Expand window (mark lower left and upper right of new window)
+f Flip x axis
+g Flip y axis
+j Set left edge of window
+k Set right edge of window
+l Shift window left
+m Autoscale x axis
+n Autoscale y axis
+p Pan x and y axes about cursor
+r Shift window right
+t Set top edge of window
+u Shift window up
+x Zoom x axis about cursor
+y Zoom y axis about cursor
+z Zoom x and y axes about cursor
diff --git a/lib/scr/help.gui b/lib/scr/help.gui
new file mode 100644
index 00000000..a22c2a78
--- /dev/null
+++ b/lib/scr/help.gui
@@ -0,0 +1,3040 @@
+# XHELP.GUI -- Graphics user interface for the IRAF help browser.
+
+reset-server
+appInitialize xhelp XHelp {
+
+XHelp*objects:\
+ toplevel Layout helpLayout\
+ helpLayout Group menubarGroup\
+ helpLayout Paned helpPanes\
+ menubarGroup Layout menubarLayout\
+ menubarLayout MenuButton fileButton\
+ menubarLayout MenuButton optionsButton\
+ menubarLayout Command printButton\
+ menubarLayout Command findButton\
+ menubarLayout Command searchButton\
+ menubarLayout MenuButton historyButton\
+ menubarLayout Command helpButton\
+ menubarLayout Command quitButton\
+\
+ helpPanes Group topicGroup\
+ topicGroup Layout topicLayout\
+ topicLayout Label topicLabel\
+ topicLayout Command reloadButton\
+ topicLayout Frame topicFrame\
+ topicFrame AsciiText topicEntry\
+ topicLayout Command topicClear\
+ topicLayout Frame listFrame\
+ listFrame Viewport listView\
+ listView List topicList\
+\
+ helpPanes Group outputGroup\
+ outputGroup Layout outputLayout\
+ outputLayout Command htbButton\
+ outputLayout Command htfButton\
+ outputLayout Command htuButton\
+ outputLayout Command hthButton\
+ outputLayout MenuButton secButton\
+ outputLayout MenuButton parButton\
+ outputLayout TextToggle hlpOpt\
+ outputLayout TextToggle srcOpt\
+ outputLayout TextToggle sysOpt\
+ outputLayout TextToggle filOpt\
+ outputLayout Frame helpFrame\
+ helpFrame HTML helpText\
+\
+\
+ toplevel TopLevelShell printShell\
+ printShell Layout prntLayout\
+ prntLayout Group printGroup\
+ prntLayout Group printCmdGroup\
+\
+ printGroup Layout printLayout\
+ printLayout Label toLabel\
+ printLayout TextToggle toPrinter\
+ printLayout TextToggle toFile\
+ printLayout Label printLabel\
+ printLayout Frame printFrame\
+ printFrame AsciiText printEntry\
+ printLayout Label pageLabel\
+ printLayout TextToggle pageLetter\
+ printLayout TextToggle pageLegal\
+ printLayout TextToggle pageA4\
+ printLayout TextToggle pageB5\
+\
+ printCmdGroup Layout printCmdLayout\
+ printCmdLayout Command printOkay\
+ printCmdLayout Command printDismiss\
+\
+\
+ toplevel TopLevelShell searchShell\
+ searchShell Group searchGroup\
+ searchGroup Layout searchLayout\
+ searchLayout Label resLabel\
+ searchLayout Frame resFrame\
+ resFrame HTML resList\
+ searchLayout Label searchLabel\
+ searchLayout Frame searchFrame\
+ searchFrame AsciiText searchEntry\
+ searchLayout Command searchClear\
+ searchLayout Command searchOkay\
+ searchLayout Label searchStatus\
+ searchLayout TextToggle exactMatch\
+ searchLayout Command searchHelp\
+ searchLayout Command searchDismiss\
+\
+\
+ toplevel TransientShell findShell\
+ findShell Layout fsLayout\
+ fsLayout Group findGroup\
+ fsLayout Group findCmdGroup\
+\
+ findGroup Layout findLayout\
+ findLayout Label findLabel\
+ findLayout Frame findFrame\
+ findFrame AsciiText findEntry\
+ findLayout TextToggle findDir\
+ findLayout TextToggle findCase\
+\
+ findCmdGroup Layout findCmdLayout\
+ findCmdLayout Command findOkay\
+ findCmdLayout Command findClear\
+ findCmdLayout Command findDismiss\
+\
+\
+ toplevel TopLevelShell fileShell\
+ fileShell Layout flist\
+ flist Group flGroup\
+ flGroup Layout flFrame\
+ flFrame Label flistLabel\
+ flFrame Frame flistFrame\
+ flistFrame AsciiText flistText\
+ flFrame Label flpkgLabel\
+ flFrame Label flpkgVal\
+ flFrame Command flDismiss\
+\
+\
+ toplevel TopLevelShell fileBrowser\
+ fileBrowser Layout fbLayout\
+ fbLayout Group fnavGroup\
+ fbLayout Group fbCmdGroup\
+ fbLayout Parameter directory\
+\
+ fnavGroup Layout fnavLayout\
+ fnavLayout Command fnavHome\
+ fnavLayout Command fnavUp\
+ fnavLayout Command fnavRoot\
+ fnavLayout Command fnavRescan\
+ fnavLayout Label filterLabel\
+ fnavLayout Frame filterFrame\
+ filterFrame AsciiText filterEntry\
+ fnavLayout Command filterClear\
+ fnavLayout Group dirGroup\
+ dirGroup Frame dirFrame\
+ dirFrame Viewport dirView\
+ dirView List dirList\
+ fnavLayout Group fileGroup\
+ fileGroup Frame fgFrame\
+ fgFrame Viewport fileView\
+ fileView List fileList\
+ fnavLayout Label curdirLabel\
+ fnavLayout Label curdirVal\
+ fnavLayout Label fnameLabel\
+ fnavLayout Frame fnameFrame\
+ fnameFrame AsciiText fnameEntry\
+ fnavLayout Command fnameClear\
+\
+ fnavLayout Group fmtGroup\
+ fmtGroup Layout fmtLayout\
+ fmtLayout Label fmtLabel\
+ fmtLayout TextToggle fmtSrc\
+ fmtLayout TextToggle fmtText\
+ fmtLayout TextToggle fmtHTML\
+ fmtLayout TextToggle fmtPS\
+ fmtLayout Label owLabel\
+ fmtLayout TextToggle overwrite\
+\
+ fbCmdGroup Layout fbCmdLayout\
+ fbCmdLayout Command fbcOkay\
+ fbCmdLayout Command fbcHelp\
+ fbCmdLayout Command fbcDismiss\
+\
+\
+ toplevel TopLevelShell doc_source\
+ doc_source Layout srcLayout\
+ srcLayout Frame srcMenuFrame\
+ srcMenuFrame Layout srcMenuBar\
+ srcMenuBar Command srcDismiss\
+ srcLayout Frame srcFrame\
+ srcFrame AsciiText srcText\
+\
+\
+ toplevel TopLevelShell hlpShell\
+ hlpShell Layout hlpLayout\
+ hlpLayout Group hlpMenuGroup\
+ hlpMenuGroup Layout hlpMenu\
+ hlpMenu Command hlpBack\
+ hlpMenu Command hlpForward\
+ hlpMenu Command hlpHome\
+ hlpMenu Command hlpTutorial\
+ hlpMenu Command hlpDismiss\
+ hlpLayout Frame hlpTextFrame\
+ hlpTextFrame HTML hlpText\
+ hlpLayout Label hfLabel\
+ hlpLayout Frame hfFrame\
+ hfFrame AsciiText hfEntry\
+ hlpLayout Command hfFind\
+ hlpLayout Command hfClear\
+ hlpLayout TextToggle hfDir\
+ hlpLayout TextToggle hfCase\
+ hlpShell Parameter help\
+\
+\
+ toplevel TransientShell warning\
+ warning Layout warn\
+ warn Frame warnFrame\
+ warnFrame Layout WFlayout\
+ WFlayout Icon warnIcon\
+ WFlayout TextBox warnText\
+ warn Frame warnBtnFrame\
+ warnBtnFrame Command warnDismiss\
+\
+\
+ toplevel TopLevelShell tclShell\
+ tclShell Layout tclLayout\
+ tclLayout Group tclCmdGroup\
+ tclCmdGroup Layout tclCmd\
+ tclCmd Command tclClear\
+ tclCmd Command tclExecute\
+ tclCmd Toggle tclLogging\
+ tclCmd Command tclDismiss\
+ tclLayout Frame tclFrame\
+ tclFrame AsciiText tclEntry\
+\
+\
+ toplevel Parameter xhelp\
+ xhelp Parameter textout\
+ xhelp Parameter alert\
+ xhelp Parameter apropos\
+ xhelp Parameter pkglist\
+ xhelp Parameter helpres\
+ xhelp Parameter helpfiles\
+ xhelp Parameter printer\
+ xhelp Parameter curpack\
+ xhelp Parameter curtask\
+ xhelp Parameter history\
+ xhelp Parameter showtype\
+ xhelp Parameter type
+
+
+
+ !-------------------------------------------------------
+ ! Define some global resources for the main menu panels.
+ !-------------------------------------------------------
+ *shadowWidth: 1
+ *background: gray75
+ *Arrow.width: 16
+ *Arrow.height: 25
+ *Text*height: 21
+ *Command.height: 21
+ *Command.highlightThickness: 1
+ *Command.internalHeight: 4
+ *MenuButton.height: 21
+ *MenuButton.highlightThickness: 1
+ *Label.borderWidth: 0
+ *Label.shadowWidth: 0
+ *TextButton.shadowWidth: 0
+ *TextButton.highlightThickness: 1
+ *TextToggle*borderWidth: 0
+ *TextToggle.highlightThickness: 0
+ *Toggle.highlightThickness: 1
+ *Group.shrinkToFit: True
+
+ *Arrow.foreground: gray72
+ *Arrow.background: gray72
+ *Text*background: gray72
+ *AsciiText*background: gray72
+ *TextBox.background: gray72
+ *MultiList*background: gray72
+ *List*background: gray72
+ *Slider2d*thumbColor: gray75
+
+
+ !-------------------------------------------------------------
+ ! Define resources to take advantage of the 3D scrollbar look.
+ !-------------------------------------------------------------
+ *Scrollbar*background: gray75
+ *Scrollbar*width: 15
+ *Scrollbar*height: 15
+ *Scrollbar*shadowWidth: 1
+ *Scrollbar*cursorName: top_left_arrow
+ *Scrollbar*pushThumb: true
+
+
+ !----------------------------------------
+ ! Menu resources giving a shadow effect.
+ !----------------------------------------
+ *SmeBSB.leftMargin: 10
+ *SmeBSB.rightMargin: 5
+ *SmeBSB.shadowWidth: 2
+ *SmeBSB*background: SteelBlue
+ *SimpleMenu*background: gray77
+ *SimpleMenu.borderWidth: 2
+ *SimpleMenu.borderColor: Black
+ *SimpleMenu.shadowWidth: 2
+ *SimpleMenu.line1.foreground: gray51
+ *SimpleMenu.line2.foreground: gray91
+ *SimpleMenu.line3.foreground: gray51
+ *SimpleMenu.line4.foreground: gray91
+ *SimpleMenu.line5.foreground: gray51
+ *SimpleMenu.line6.foreground: gray91
+ *SimpleMenu.line7.foreground: gray51
+ *SimpleMenu.line8.foreground: gray91
+ *SimpleMenu.line9.foreground: gray51
+ *SimpleMenu.line10.foreground: gray91
+ *SimpleMenu.line11.foreground: gray51
+ *SimpleMenu.line12.foreground: gray91
+ *SimpleMenu.line13.foreground: gray51
+ *SimpleMenu.line14.foreground: gray91
+ *SimpleMenu.line15.foreground: gray51
+ *SimpleMenu.line16.foreground: gray91
+ *SimpleMenu.line17.foreground: gray51
+ *SimpleMenu.line18.foreground: gray91
+ *SimpleMenu.line19.foreground: gray51
+ *SimpleMenu.line20.foreground: gray91
+ *SimpleMenu.line21.foreground: gray51
+ *SimpleMenu.line22.foreground: gray91
+ *SimpleMenu.line23.foreground: gray51
+ *SimpleMenu.line24.foreground: gray91
+ *SimpleMenu.line25.foreground: gray51
+ *SimpleMenu.line26.foreground: gray91
+ *SimpleMenu.line27.foreground: gray51
+ *SimpleMenu.line28.foreground: gray91
+ *SimpleMenu.line29.foreground: gray51
+ *SimpleMenu.line30.foreground: gray91
+
+
+ !----------------------------------------
+ ! Define the default fonts to be used.
+ !----------------------------------------
+ *font: -adobe-times-medium-r-normal-*-14-*-*-*
+ *Command.font: -adobe-times-bold-i-normal-*-12-*-*-*
+ *MenuButton.font: -adobe-times-bold-i-normal-*-12-*-*-*
+ *Toggle.font: -adobe-times-bold-i-normal-*-12-*-*-*
+ *Label.font: -adobe-times-bold-i-normal-*-12-*-*-*
+ *TextToggle.font: -adobe-times-bold-i-normal-*-12-*-*-*
+ *Group*SimpleMenu*font: 7x13
+ *HTML*SimpleMenu*font: 7x13
+
+ *HTML.plainFont: -*-fixed-medium-r-*-*-13-*-*-*
+ *HTML.listingFont: -*-fixed-medium-r-*-*-13-*-*-*
+ *HTML.font: -adobe-times-medium-r-normal-*-14-*-*-*
+ *HTML.boldFont: -adobe-times-bold-r-normal-*-14-*-*-*
+ *HTML.plainboldFont: -adobe-times-bold-r-normal-*-14-*-*-*
+ *HTML.fixedboldFont: -adobe-times-bold-r-normal-*-14-*-*-*
+ *HTML.header1Font: -adobe-times-bold-r-normal-*-18-*-*-*
+ *HTML.header2Font: -adobe-times-bold-r-normal-*-14-*-*-*
+ *HTML.header3Font: -adobe-times-bold-r-normal-*-14-*-*-*
+ *HTML.header4Font: -adobe-times-bold-r-normal-*-14-*-*-*
+ *HTML.header5Font: -adobe-times-medium-i-normal-*-12-*-*-*
+ *HTML.header6Font: -adobe-times-bold-r-normal-*-10-*-*-*
+ *HTML.anchorUnderlines: 0
+ *HTML.visitedAnchorUnderlines: 0
+ *HTML.anchorColor: blue
+ *HTML.visitedAnchorColor: red3
+ *HTML*background: gray72
+ *HTML*Scrollbar.background: gray75
+ *HTML*Scrollbar*width: 15
+ *HTML*Scrollbar*height: 15
+
+
+ !---------------------------
+ ! Set the default resources.
+ !---------------------------
+ *xhelp.title: IRAF Help Browser V1.0 - DEV
+ *xhelp.geometry: +0+0
+ *xhelp.width: 625
+ *xhelp.minWidth: 580
+ *xhelp.minheight: 450
+ *xhelp.height: 850
+
+ *helpLayout.geometry: 600x700+0+0
+ *helpLayout*borderWidth: 0
+ *helpLayout*Group.shrinkToFit: True
+ *helpLayout*Frame.frameType: sunken
+ *helpLayout*Frame.frameWidth: 1
+ *helpLayout*Command.internalHeight: 2
+ *helpLayout*MenuButton.internalHeight: 2
+ *helpLayout*Label*highlightThickness: 0
+ *helpLayout*List*shadeSurplus: False
+ *helpLayout*List.internalWidth: 10
+ *helpLayout*Viewport.allowVert: True
+ *helpLayout*Viewport.forceBars: True
+ *helpLayout.width: 600
+ *helpLayout.layout: vertical { \
+ menubarGroup < +inf -inf * > \
+ -1 \
+ horizontal { \
+ -1 \
+ helpPanes < +inf -inf * +inf -inf > \
+ -1 \
+ } \
+ -1 \
+ }
+ *helpLayout*SimpleMenu.shadowWidth: 2
+ *helpLayout*SimpleMenu.borderColor: Black
+ *helpLayout*SimpleMenu.borderWidth: 2
+
+ *menubarGroup.label:
+ *menubarGroup.outerOffset: 0
+ *menubarGroup.innerOffset: 5
+ *menubarGroup.frameType: raised
+ *menubarGroup.frameWidth: 2
+ *menubarGroup*Command.shadowWidth: 0
+ *menubarGroup*MenuButton.shadowWidth: 0
+ *menubarLayout.layout: horizontal { \
+ fileButton 5 \
+ optionsButton 5 \
+ printButton 5 \
+ findButton 5 \
+ searchButton 5 \
+ historyButton 5 \
+ 10 < +inf -inf > \
+ helpButton 5 \
+ quitButton \
+ }
+ *fileButton.label: File
+ *fileButton.menuName: fileMenu
+ *optionsButton.label: Options
+ *optionsButton.menuName: optsMenu
+ *printButton.label: Print
+ *findButton.label: Find
+ *searchButton.label: Search
+ *historyButton.label: History
+ *historyButton.menuName: historyMenu
+ *helpButton.label: Help
+ *quitButton.label: Quit
+
+ *topicGroup.label:
+ *topicGroup.outerOffset: 2
+ *topicGroup.innerOffset: 2
+ *topicGroup*frameType: chiseled
+ *topicGroup.frameWidth: 2
+ *topicGroup*Label.shadowWidth: 0
+ *topicGroup*Label.borderWidth: 1
+ *topicGroup*Label.highlightThickness: 1
+ *topicGroup*Viewport.useRight: True
+ *topicGroup*Viewport.useBottom: True
+ *topicLayout.layout: vertical { \
+ 2 < +2 -2 > \
+ horizontal { \
+ 3 < +3 -3 > \
+ topicLabel 2 topicFrame < +inf * > \
+ 2 \
+ topicClear 5 reloadButton \
+ 1 \
+ } \
+ 4 \
+ horizontal { \
+ vertical { \
+ -1 \
+ listFrame < +inf -inf * +inf -inf > \
+ -1 \
+ } \
+ } \
+ 2 < +2 -2 > \
+ }
+ *reloadButton.label: Reload
+ *topicLabel.label: Topic:
+ *topicLabel.justify: right
+ *topicEntry*width: 100
+ *topicEntry*editType: edit
+ *topicEntry*font: 7x13
+ *topicEntry*displayCaret: True
+ *topicClear.label: Clear
+
+ *topicList.font: 7x13
+ *topicList.width: 500
+ *topicList.height: 100
+ *topicList.columnSpacing: 20
+ *topicList.verticalList: True
+ !*topicList.defaultColumns: 6
+ !*topicList.forceColumns: True
+
+ *outputGroup.label:
+ *outputGroup.outerOffset: 2
+ *outputGroup.innerOffset: 2
+ *outputGroup*frameType: chiseled
+ *outputGroup.frameWidth: 2
+ *outputGrout*TextToggle*on: 0
+ *outputGroup*TextToggle.frameWidth: 2
+ *outputGroup*TextToggle.frameType: chiseled
+ *outputGroup*TextToggle.location: 0 0 65 25
+ *outputGroup*TextToggle.leftMargin: 4
+ *outputLayout.layout: vertical { \
+ 2 \
+ horizontal { \
+ 5 \
+ htbButton 2 htfButton 2 htuButton 2 hthButton 2 \
+ 10 < +inf -10 > \
+ secButton 2 parButton \
+ 10 < +inf -10 > \
+ hlpOpt -2 srcOpt -2 sysOpt 4 filOpt \
+ 5 \
+ } \
+ 2 \
+ horizontal { \
+ 2 \
+ helpFrame < +inf -inf * +inf -inf > \
+ 2 \
+ } \
+ }
+ *htbButton.label: Back
+ *htbButton.sensitive: False
+ *htfButton.label: Forward
+ *htfButton.sensitive: False
+ *htuButton.label: Up
+ *htuButton.sensitive: False
+ *hthButton.label: Home
+ *printButton.label: Print
+ *secButton.label: Sections
+ *secButton.menuName: secMenu
+ *parButton.label: Parameters
+ *parButton.menuName: parMenu
+ *hlpOpt*label: Help
+ *hlpOpt*on: 1
+ *hlpOpt*onIcon: diamond1s
+ *hlpOpt*offIcon: diamond0s
+ *hlpOpt*highlightColor: green
+ *srcOpt*label: Source
+ *srcOpt*on: 0
+ *srcOpt*onIcon: diamond1s
+ *srcOpt*offIcon: diamond0s
+ *srcOpt*highlightColor: green
+ *sysOpt*label: Sysdoc
+ *sysOpt*on: 0
+ *sysOpt*onIcon: diamond1s
+ *sysOpt*offIcon: diamond0s
+ *sysOpt*highlightColor: green
+ *filOpt*label: Files
+ *filOpt*on: 0
+ *filOpt*onIcon: square1s
+ *filOpt*offIcon: square0s
+ *filOpt*highlightColor: yellow
+
+ *helpText.width: 650
+ *helpText.height: 620
+ *helpText.anchorUnderlines: 1
+ *helpText.visitedAnchorUnderlines: 1
+ *helpText.verticalScrollOnRight: true
+ *helpText.translations: \
+ <Btn2Down>: popup(secMenu) \n\
+ <Btn2Up>: popdown(secMenu) \n\
+ <Btn3Down>: popup(navMenu) \n\
+ <Btn3Up>: popdown(navMenu) \n
+
+ *helpText*navMenu.foreground: Black
+ *helpText*navMenu.background: gray75
+ *helpText*secMenu.foreground: Black
+ *helpText*secMenu.background: gray75
+
+
+ !--------------------------+
+ ! Printer Shell resources. |
+ !--------------------------+
+ *printShell.title: Printer Selection
+ *printShell.width: 300
+ *printShell.height: 177
+ *printShell.minHeight: 177
+ *printShell.maxHeight: 177
+ *printShell*borderWidth: 0
+ *printShell*Group.frameType: chiseled
+ *printShell*Group.frameWidth: 2
+ *printShell*Group.innerOffset: 5
+ *printShell*Group.outerOffset: 2
+ *printShell*Command.internalheight: 4
+ *printShell*Text*editType: edit
+ *printShell*Text*height: 25
+ *printShell*TextToggle.frameWidth: 0
+ *printShell*Group.label:
+ *prntLayout.layout: vertical { \
+ printGroup < +inf -inf * > \
+ printCmdGroup < +inf -inf * > \
+ }
+
+ *printLayout*location: 0 0 70 25
+ *printLayout*offIcon: diamond0s
+ *printLayout*onIcon: diamond1s
+ *printLayout*highlightColor: yellow
+ *printLayout*Label.height: 35
+ *printLayout*Label.justify: right
+ *printLayout*TextToggle.frameWidth: 0
+ *printLayout*TextToggle.leftMargin: 8
+ *printLayout*TextToggle*highlightColor: yellow
+ *printLayout*TextToggle*onIcon: square1s
+ *printLayout*TextToggle*offIcon: square0s
+ *printLayout*TextToggle*alignment: left
+ *printLayout.layout: vertical { \
+ 0 < +0 >\
+ horizontal { toLabel 10 toPrinter 10 toFile 10 } \
+ 5 < +inf -5 > \
+ horizontal { \
+ printLabel 5 printFrame < +inf -inf * > -1 \
+ } \
+ 5 < +inf -5 > \
+ horizontal { \
+ vertical { pageLabel 10 } \
+ 12 \
+ horizontal { \
+ vertical { pageLetter -3 pageLegal } \
+ 10 \
+ vertical { pageA4 -3 pageB5 } \
+ } \
+ } \
+ 0 < +0 >\
+ }
+ *toLabel.label: Print to:
+ *toPrinter.label: Printer
+ *toPrinter.on: True
+ *toFile.label: File
+ *printLabel.label: Printer:
+ *printFrame.frameType: sunken
+ *printFrame.frameWidth: 1
+ *printEntry*string: printer
+ *pageLabel.label: Page Size:
+ *pageLetter.label: Letter
+ *pageLetter.on: 1
+ *pageLegal.label: Legal
+ *pageA4.label: A4
+ *pageB5.label: B5
+
+ *printCmdLayout.layout: horizontal { \
+ 3 \
+ printOkay 20 < +inf -20 > printDismiss \
+ 3 \
+ }
+ *printOkay.label: Print
+ *printDismiss.label: Dismiss
+
+
+ !-------------------------+
+ ! File Browser resources. |
+ !-------------------------+
+ *fileBrowser.width: 450
+ *fileBrowser.height: 375
+ *fileBrowser.title: Open a New File...
+ *fileBrowser*borderWidth: 0
+ *fileBrowser*Group.frameType: chiseled
+ *fileBrowser*Group.frameWidth: 2
+ *fileBrowser*Group.innerOffset: 3
+ *fileBrowser*Group.outerOffset: 3
+ *fileBrowser*Group.label:
+
+ *fbLayout.layout: vertical { \
+ 2 \
+ fnavGroup < +inf -inf * +inf -inf > \
+ -2 \
+ horizontal { \
+ -5 \
+ fbCmdGroup < +inf -inf * > \
+ -5 } \
+ -3 \
+ }
+
+ *fnavGroup*Frame.frameType: sunken
+ *fnavGroup*Frame.frameWidth: 1
+ *fnavGroup*Text*editType: edit
+ *fnavGroup*Text*height: 25
+ *fnavGroup*Text*font: 7x13
+ *fnavGroup*List.verticalList: True
+ *fnavGroup*List.defaultColumns: 1
+ *fnavGroup*List.forceColumns: True
+ *fnavGroup*List.font: 7x13
+ *fnavGroup*Label.justify: left
+ *fnavGroup*Viewport.allowVert: True
+ *fnavGroup*Viewport.allowHoriz: False
+ *fnavGroup*Viewport.forceBars: True
+ *fnavGroup*Viewport.useRight: True
+ *fnavGroup*Group.outerOffset: 7
+ *fnavGroup*Group.innerOffset: 3
+ *fnavLayout.layout: vertical { \
+ 5 \
+ vertical { \
+ -1 \
+ horizontal { \
+ 5 \
+ fnavHome < +inf -inf * > 2 \
+ fnavUp < +inf -inf * > 2 \
+ fnavRoot < +inf -inf * > 2 \
+ fnavRescan < +inf -inf * > \
+ 10 \
+ filterLabel 2 filterFrame < +inf -inf * > \
+ 2 \
+ filterClear \
+ 5 \
+ } \
+ 3 \
+ } \
+ 5 \
+ horizontal { \
+ -5 \
+ dirGroup < +inf -inf * +inf - inf > \
+ -8 \
+ fileGroup < +inf -inf * +inf - inf > \
+ -5 \
+ } \
+ -3 \
+ horizontal { \
+ curdirLabel 5 curdirVal < +inf -inf * > 5 } \
+ 5 \
+ horizontal { \
+ fnameLabel 2 fnameFrame < +inf -inf * > 2 fnameClear 5\
+ } \
+ 7 \
+ fmtGroup < +inf -inf * > \
+ -3 \
+ }
+ *fileBrowser*fnavGroup*dirGroup.label: Directories
+ *fileBrowser*fnavGroup*fileGroup.label: Files
+ *fileBrowser*fnavGroup*dirGroup.innerOffset: 3
+ *fileBrowser*fnavGroup*fileGroup.innerOffset: 3
+ *fileBrowser*fnavGroup*dirGroup.outerOffset: 7
+ *fileBrowser*fnavGroup*fileGroup.outerOffset: 7
+ *fileBrowser*fnavGroup*dirGroup.font: 7x13bold
+ *fileBrowser*fnavGroup*fileGroup.font: 7x13bold
+
+ *filterLabel.label: Filter
+ *filterClear.label: Clear
+ *curdirLabel.label: Directory:
+ *curdirVal.label:
+ *curdirVal.font: 7x13
+ *fnameLabel.label: Selection\ \
+ *fnameClear.label: Clear
+ *fnavHome.label: Home
+ *fnavUp.label: Up
+ *fnavRoot.label: Root
+ *fnavRescan.label: Rescan
+
+ *fmtGroup*Group.outerOffset: 3
+ *fmtGroup*Group.innerOffset: 3
+ *fmtLayout*TextToggle.frameWidth: 0
+ *fmtLayout*TextToggle.leftMargin: 4
+ *fmtLayout*TextToggle.alignment: left
+ *fmtLayout*TextToggle*highlightColor: yellow
+ *fmtLayout*TextToggle*onIcon: square1s
+ *fmtLayout*TextToggle*offIcon: square0s
+ *fmtLayout.layout: vertical { \
+ horizontal { 5 fmtLabel 10 fmtSrc 3 fmtText 3 fmtHTML 3 fmtPS 5 } \
+ horizontal { 50 owLabel 10 overwrite 5 < +inf > } \
+ }
+ *fmtLabel.label: Save As Format:
+ *fmtSrc.label: Source
+ *fmtSrc.on: 1
+ *fmtSrc.location: 0 0 65 22
+ *fmtText.label: Text
+ *fmtText.location: 0 0 65 22
+ *fmtHTML.label: HTML
+ *fmtHTML.location: 0 0 65 22
+ *fmtPS.label: PostScript
+ *fmtPS.location: 0 0 100 22
+ *owLabel.label: Options:
+ *overwrite.label: Allow overwrite of existing files?
+ *overwrite.location: 0 0 200 22
+
+ *fbCmdLayout.outerOffset: 0
+ *fbCmdLayout.layout: horizontal { \
+ 5 \
+ vertical { 2 fbcOkay 2 } \
+ 20 < +inf -20 > \
+ vertical { 2 fbcHelp 2 } \
+ 2 \
+ vertical { 2 fbcDismiss 2 } \
+ 5 \
+ }
+ *fbcOkay.label: Okay
+ *fbcHelp.label: Help
+ *fbcDismiss.label: Dismiss
+
+
+ !-----------------------+
+ ! Find Shell resources. |
+ !-----------------------+
+ *findShell.title: Find within a document...
+ *findShell.width: 365
+ *findShell.height: 130
+ *findShell*borderWidth: 0
+ *findShell*Group.frameType: chiseled
+ *findShell*Group.frameWidth: 2
+ *findShell*Group.innerOffset: 5
+ *findShell*Group.outerOffset: 2
+ *findShell*Command.internalheight: 4
+ *findShell*Text*editType: edit
+ *findShell*Text*height: 25
+ *findShell*TextToggle.frameWidth: 0
+ *findShell*Group.label:
+ *fsLayout.layout: vertical { \
+ findGroup < +inf -inf * > \
+ findCmdGroup < +inf -inf * > \
+ }
+
+ *findLayout*location: 0 0 120 25
+ *findLayout*offIcon: diamond0s
+ *findLayout*onIcon: diamond1s
+ *findLayout*highlightColor: yellow
+ *findLayout*Label.height: 35
+ *findLayout*Label.justify: right
+ *findLayout*TextToggle.frameWidth: 0
+ *findLayout*TextToggle.leftMargin: 4
+ *findLayout*TextToggle*highlightColor: yellow
+ *findLayout*TextToggle*onIcon: square1s
+ *findLayout*TextToggle*offIcon: square0s
+ *findLayout.layout: vertical { \
+ 5 \
+ horizontal { \
+ findLabel 7 findFrame < +inf -inf * > -1 \
+ } \
+ 5 \
+ horizontal { \
+ 20 < +inf -20 > \
+ findDir 10 findCase \
+ 20 < +inf -20 > \
+ } \
+ }
+ *findLabel.label: Find:
+ *findFrame.frameType: sunken
+ *findFrame.frameWidth: 1
+ *findEntry*string:
+ *findDir.label: Find Backwards
+ *findCase.label: Case Sensitive
+
+ *findCmdLayout.layout: horizontal { \
+ 3 \
+ findOkay \
+ 20 < +inf -20 > \
+ findClear \
+ 20 < +inf -20 > \
+ findDismiss \
+ 3 \
+ }
+ *findOkay.label: Find
+ *findClear.label: Clear
+ *findDismiss.label: Dismiss
+
+
+ !-------------------------------------------+
+ ! Set the document source viewer resources. |
+ !-------------------------------------------+
+ *doc_source.title: Page source
+ *doc_source.width: 575
+ *doc_source.height: 450
+ *srcLayout*borderWidth: 0
+ *srcLayout.layout: vertical { \
+ srcMenuFrame < +inf -inf * > \
+ -2 \
+ srcFrame < +inf -inf * +inf -inf > \
+ -2 \
+ }
+
+ *srcMenuBar.layout: horizontal { 50 < +inf -inf > srcDismiss 5 }
+ *srcMenuFrame.height: 40
+ *srcMenuFrame.outerOffset: 0
+ *srcMenuFrame.innerOffset: 5
+ *srcMenuFrame.frameType: chiseled
+ *srcMenuFrame.frameWidth: 2
+ *srcFrame.frameType: sunken
+ *srcFrame.frameWidth: 1
+ *srcFrame.outerOffset: 5
+ *srcText*scrollVertical: always
+ *srcText*scrollHorizontal: always
+ *srcText*Scrollbar.width: 15
+ *srcText*Scrollbar.height: 15
+ *srcText*background: gray75
+ *srcText*font: 7x13
+ *srcText*editType: read
+ *srcText*displayCaret: False
+ *srcDismiss.label: Dismiss
+ *srcDismiss.width: 150
+
+
+ !-------------------------+
+ ! Search Shell resources. |
+ !-------------------------+
+ *searchShell.title: Search for a topic...
+ *searchShell.width: 600
+ *searchShell.height: 250
+ *searchShell*borderWidth: 0
+ *searchShell*Viewport.allowVert: True
+ *searchShell*Viewport.allowHoriz: True
+ *searchShell*Viewport.useBottom: True
+ *searchShell*Viewport.useRight: False
+ *searchShell*Viewport.forceBars: True
+ *searchGroup.frameType: chiseled
+ *searchGroup.frameWidth: 2
+ *searchGroup.innerOffset: 7
+ *searchGroup.outerOffset: 7
+ *searchGroup.highlightThickness: 0
+ *searchGroup.label:
+ *searchLayout.layout: vertical { \
+ horizontal { \
+ 45 < +45 -45 > \
+ resLabel < +inf -inf * > \
+ 5 < +inf -inf > \
+ exactMatch \
+ } \
+ 2 < +2 - 2 > \
+ resFrame < +inf -inf * +inf -inf > \
+ 5 < +5 - 5 > \
+ horizontal { \
+ searchLabel 5 searchFrame \
+ 5 \
+ searchClear 2 searchOkay \
+ 5 < +inf -inf > \
+ searchStatus \
+ 5 < +inf -inf > \
+ searchHelp 2 searchDismiss \
+ } \
+ }
+ *resLabel.label: Task Package Description
+ *resLabel.justify: left
+ *resFrame.frameType: sunken
+ *resFrame.frameWidth: 1
+ *resList.font: 7x13
+ *resList.width: 100
+ *resList.height: 100
+ *resList.marginWidth: 5
+ *resList.marginHeight: 5
+
+ *searchLabel.label: Topic:
+ *searchFrame.frameType: sunken
+ *searchFrame.frameWidth: 1
+ *searchEntry*font: 7x13
+ *searchEntry*displayCaret: True
+ *searchEntry*editType: edit
+ *searchEntry*height: 25
+ *searchEntry*width: 150
+ *searchClear.label: Clear
+ *searchOkay.label: Search
+ *searchStatus.label:
+ *exactMatch.label: Require Exact Match
+ *exactMatch*on: 1
+ *exactMatch*onIcon: diamond1s
+ *exactMatch*offIcon: diamond0s
+ *exactMatch*highlightColor: green
+ *exactMatch.frameWidth: 2
+ *exactMatch.frameType: chiseled
+ *exactMatch.location: 0 0 150 25
+ *exactMatch.leftMargin: 4
+ *searchHelp.label: Help
+ *searchDismiss.label: Dismiss
+
+
+ !----------------
+ ! Help Window.
+ !----------------
+ *hlpShell.title: Help
+ *hlpShell.width: 500
+ *hlpShell.height: 620
+ *hlpLayout*borderWidth: 0
+ *hlpLayout*Frame*frameType: sunken
+ *hlpLayout*Frame*frameWidth: 1
+
+ *hlpMenuGroup.label:
+ *hlpMenuGroup.outerOffset: 0
+ *hlpMenuGroup.innerOffset: 0
+ *hlpLayout.layout: vertical { \
+ hlpMenuGroup < +inf -inf * > \
+ -3 \
+ hlpTextFrame < +inf -inf * +inf -inf > \
+ horizontal { \
+ 5 \
+ hfLabel 5 hfFrame < +inf -inf *> \
+ 2 \
+ hfFind 2 hfClear 5 hfDir 5 hfCase \
+ 5 \
+ } \
+ 2 \
+ }
+ *hlpLayout*TextToggle*location: 0 0 90 25
+ *hlpLayout*TextToggle*offIcon: diamond0s
+ *hlpLayout*TextToggle*onIcon: diamond1s
+ *hlpLayout*TextToggle*highlightColor: yellow
+ *hlpLayout*TextToggle*frameType: chiseled
+ *hlpLayout*TextToggle*frameWidth: 2
+ *hfEntry*editType: edit
+ *hfEntry*font: 7x13
+ *hfEntry*displayCaret: True
+ *hfLabel.label: Find:
+ *hfFind.label: Find
+ *hfClear.label: Clear
+ *hfDir.label: Backwards
+ *hfCase.label: Caseless
+ *hfCase.on: true
+
+ *hlpMenu*Command.internalHeight: 4
+ *hlpMenu*Command.highlightThickness: 1
+ *hlpMenu*Command.height: 20
+ *hlpMenu.layout: vertical { \
+ 5 \
+ horizontal { \
+ 5 \
+ hlpBack 2 hlpForward 2 hlpHome 2 hlpTutorial \
+ 20 < +inf -20 > \
+ hlpDismiss \
+ 5 \
+ } \
+ 5 \
+ }
+ *hlpBack.label: Back
+ *hlpBack.sensitive: False
+ *hlpForward.label: Forward
+ *hlpHome.label: Home
+ *hlpTutorial.label: Tutorial
+ *hlpTutorial.sensitive: false
+ *hlpDismiss.label: Dismiss
+
+ *hlpTextFrame.outerOffset: 2
+ *hlpText.width: 500
+ *hlpText.height: 500
+ *hlpText.anchorUnderlines: 1
+ *hlpText.visitedAnchorUnderlines: 1
+ *hlpText.verticalScrollOnRight: true
+
+
+ !------------------+
+ ! File List dialog.
+ !------------------+
+ *fileShell.title: Help Files
+ *fileShell.geometry: 500x165
+ *fileShell*borderWidth: 0
+ *fileShell*Command.width: 90
+ *fileShell*Command.height: 30
+ *fileShell*Frame.frameType: sunken
+ *fileShell*Frame.frameWidth: 1
+ *fileShell*Frame.innerOffset: 1
+ *fileShell*Text*font: 7x13
+ *flist.layout: vertical { \
+ 1 \
+ horizontal { 1 flGroup < +inf -inf * +inf -inf> 1 } \
+ 1 \
+ }
+
+ *flGroup.frameType: chiseled
+ *flGroup.frameWidth: 2
+ *flGroup.innerOffset: 5
+ *flGroup.outerOffset: 5
+ *flGroup.label:
+ *flFrame.layout: vertical { \
+ 5 \
+ horizontal { \
+ 13 \
+ flistLabel < +inf -inf * > \
+ 5 < +inf -5 > \
+ } \
+ 2 \
+ horizontal { 1 flistFrame < +inf -inf * +inf -inf > 1 } \
+ 7 \
+ horizontal { \
+ 5 \
+ flpkgLabel 2 flpkgVal < +inf -inf * > \
+ 5 < +inf -5 > \
+ flDismiss \
+ 5 \
+ } \
+ }
+ *flDismiss.label: Dismiss
+ *flistLabel.label: Option Status Filename
+ *flistLabel.justify: left
+ *flpkgLabel.label: Task:
+ *flpkgLabel.justify: left
+ *flpkgVal.label: (Undefined)
+ *flpkgVal.justify: left
+ *flpkgVal*font: 7x13
+ *flistText.label:
+ *flistText.scrollVertical: Never
+ *flistText.scrollHorizontal: whenNeeded
+ *flistText*displayCaret: False
+ *flistText*editType: edit
+
+
+ !----------------+
+ ! WARNING dialog.
+ !----------------+
+ *warning.geometry: +400+300
+ *warning*borderWidth: 0
+ *warning*TextBox.frameWidth: 0
+ *warning*Command.width: 90
+ *warning*Command.height: 30
+ *warning*Frame.frameType: sunken
+ *warning*Frame.frameWidth: 1
+ *warning*Frame.innerOffset: 3
+ *warn.layout: vertical { \
+ 5 \
+ horizontal { \
+ 5 \
+ warnFrame < +inf * +inf > \
+ 5 \
+ } \
+ 5 \
+ horizontal { \
+ 5 < +inf -5 > \
+ warnBtnFrame \
+ 5 < +inf -5 > \
+ } \
+ 5 \
+ }
+
+ *WFlayout.layout: horizontal { \
+ 5 \
+ vertical { \
+ 5 < +inf -5 > \
+ warnIcon \
+ 5 < +inf -5 > \
+ } \
+ 5 \
+ warnText < +inf -inf * +inf -inf > \
+ 5 \
+ }
+ *warnIcon.location: 0 0 40 40
+ *warnIcon.image: WARNING
+ *warnText.label: generic warning text
+ *warnText.width: 270
+ *warnText.height: 60
+ *warnText*background: gray75
+ *warnDismiss.label: Dismiss
+
+ !--------------------------
+ ! Define a Debug Tcl shell.
+ !--------------------------
+ *tclShell.width: 550
+ *tclShell.height: 180
+ *tclShell.title: TCL Command Entry Shell
+ *tclLayout*borderWidth: 0
+ *tclLayout*Frame.frameType: sunken
+ *tclLayout*Frame.frameWidth: 1
+ *tclLayout.layout: vertical { \
+ tclCmdGroup < +inf -inf * > \
+ tclFrame < +inf -inf * +inf -inf> \
+ }
+ *tclEntry*editType: edit
+ *tclEntry*type: string
+ *tclEntry*scrollVertical: Always
+ *tclEntry*scrollHorizontal: whenNeeded
+
+ *tclCmdGroup.label:
+ *tclCmdGroup.outerOffset: 0
+ *tclCmdGroup.innerOffset: 0
+ *tclCmd.layout: vertical { \
+ 5 \
+ horizontal { \
+ 5 \
+ tclClear 3 tclExecute \
+ 10 < +inf -10> \
+ tclLogging 3 tclDismiss \
+ 5 \
+ } \
+ 5 \
+ }
+ *tclClear.label: Clear
+ *tclExecute.label: Execute
+ *tclLogging.label: Enable Logging
+ *tclDismiss.label: Dismiss
+}
+
+
+
+################################################################################
+
+createObjects
+
+# Define Bitmaps and Pixmaps to be used.
+createBitmap null 16 16 {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+createBitmap check 16 16 {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x60,
+ 0x00, 0x30, 0x00, 0x18, 0x00, 0x0c, 0x08, 0x06, 0x18, 0x03, 0xb0, 0x01,
+ 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+createBitmap arrow 16 16 {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x14, 0xf8, 0x27,
+ 0x08, 0x40, 0xf8, 0x27, 0x00, 0x14, 0x00, 0x0c, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+
+activate
+
+################################################################################
+
+
+################################################################################
+# Global variables. |
+################################################################################
+set version "IRAF Help GUI V1.0" ;# version string
+set curpack "" ;# current values
+set curtask ""
+set helpType "package" ;# type of help to get
+set helpOption "help" ;# help option param
+set fileManaged 0 ;# is fileShell mapped?
+set pkgList { }
+set visited(0) empty
+
+set listOrient 1 ;# options
+set showType 0
+set showFiles 1
+set exactMatch 1
+
+set MAX_MENU_SIZE 40 ;# what it says it is
+
+# History array initialization.
+set HPkg(0) {Home} ;# package
+set HOpt(0) {help} ;# option
+set HTask(0) {Home} ;# task
+set HUrl(0) {} ;# url
+set HType(0) {task} ;# type (task|package|file)
+set HFile(0) {} ;# filename
+set htop 0 ;# top of array
+set hcurrent 0 ;# current page
+
+# Panel mapping flags.
+set search_mapped 0 ;# searchShell mapped?
+
+
+################################################################################
+# Utility Callbacks
+################################################################################
+
+# Procedures for sending client cursor commands.
+proc GKey { key args } { send client gkey $key }
+proc GCmd { args } { send client gcmd $args }
+
+# Procedures to test True/False strings in resources.
+proc true { v } \
+ { expr { $v=="true" || $v=="True" || $v=="TRUE" || $v==1 || $v=="yes" } }
+proc false { v } \
+ { expr { $v=="false" || $v=="False" || $v=="FALSE" || $v==0 || $v=="no" } }
+
+# No-op procedure for text widgets with no callbacks to swallow newline.
+proc noop { args } { }
+
+# Common functions.
+proc min { a b } { expr {($a < $b) ? $a : $b} }
+proc max { a b } { expr {($a > $b) ? $a : $b} }
+
+
+#--------------------+
+# Debugging options. |
+#--------------------+
+set debug 0 ;# debug flag
+send tclLogging set state [min 1 $debug]
+
+
+################################################################################
+# Initialize. |
+################################################################################
+proc Init args {
+ global history curpack curtask debug
+ global secMenuDescription parMenuDescription
+ global HPkg HTask HUrl HOpt HFile HType
+
+ if {$debug == 1} { send tclShell map }
+
+ # Reinitialize global vars in case of a restart.
+ set curpack ""
+ set curtask ""
+ set helpType "package"
+ set helpOption "help"
+
+ # Initialize the entry strings.
+ send printEntry set string ""
+ send topicEntry set string ""
+
+ # Initialize the various lists.
+ send topicList setList "{ }" resize
+
+ send secButton set sensitive False
+ send parButton set sensitive False
+ editMenu secMenu secButton $secMenuDescription
+ editMenu parMenu parButton $parMenuDescription
+
+} ; #send server postActivateCallback Init
+
+
+
+# Create the Navigation Menu.
+set navMenuDescription {
+ { "Back " f.exec { Back }
+ sensitive {([send htbButton isSensitive]==1) ? "true" : "false" }
+ }
+ { "Forward " f.exec { Forward }
+ sensitive {([send htfButton isSensitive]==1) ? "true" : "false" }
+ }
+ { "Up " f.exec { Up }
+ sensitive {([send htuButton isSensitive]==1) ? "true" : "false" }
+ }
+ { "Home " f.exec { Home } }
+ { f.dblline }
+ { "Reload " f.exec { Reload } }
+ { "Open File... " f.exec { Open } }
+ { "Save As... " f.exec { SaveAs } }
+ { "View Page Source " f.exec { srcOpen } }
+ { f.dblline }
+ { "Find... " f.exec { Find } }
+ { "Search... " f.exec { Search } }
+ { "Print... " f.exec { Print } }
+} ; createMenu navMenu helpText $navMenuDescription
+
+# Create the default Section Menu.
+set secMenuDescription {
+ { " Top of Page " f.exec { send helpText gotoId 0 } }
+ { f.dblline }
+ { " " f.exec { noop } }
+ { " No Sections Found " f.exec { noop } }
+ { " " f.exec { noop } }
+} ; createMenu secMenu secButton $secMenuDescription
+
+# Create the default Parameter Menu.
+set parMenuDescription {
+ { " No Parameters Found" f.exec { noop } }
+} ; createMenu parMenu parButton $parMenuDescription
+
+
+# Initialize.
+Init
+
+
+################################################################################
+# Menubar command callbacks.
+################################################################################
+
+# File Menu
+set fileMenuDescription {
+ { " Open File... " f.exec { Open } }
+ { " Save As... " f.exec { SaveAs } }
+ { " Print... " f.exec { Print } }
+ { f.dblline }
+ { " Reload... " f.exec { Reload } }
+ { " View Page Source " f.exec { srcOpen } }
+ { " Search... " f.exec { Search } }
+ { " Find... " f.exec { Find } }
+ { f.dblline }
+ { " Help " f.exec { Help } }
+ { " Quit " f.exec { Quit } }
+} ; createMenu fileMenu fileButton $fileMenuDescription
+
+
+# History Menu
+set historyMenuDescription {
+ { " Back " f.exec { Back }
+ sensitive {([send htbButton isSensitive]==1) ? "true" : "false" }
+ }
+ { " Forward " f.exec { Forward }
+ sensitive {([send htfButton isSensitive]==1) ? "true" : "false" }
+ }
+ { " Up " f.exec { Up }
+ sensitive {([send htuButton isSensitive]==1) ? "true" : "false" }
+ }
+ { " Home " f.exec { Home } }
+ { f.dblline }
+ { " Clear History" f.exec { histClear } }
+ { f.dblline }
+} ; createMenu historyMenu historyButton $historyMenuDescription
+
+
+# Options Menu
+set optsMenuDescription {
+ { " Show task type " f.exec { setOpts showType }
+ bitmap {($showType==1)? "check" : "null"} }
+ { " Show missing files " f.exec { setOpts showFiles }
+ bitmap {($showFiles==1)? "check" : "null"} }
+ { f.dblline }
+ { " Vertical task listing " f.exec { setOpts verticalList True }
+ bitmap {($listOrient==1)? "check" : "null"}
+ }
+ { " Horizontal task listing " f.exec { setOpts verticalList False }
+ bitmap {($listOrient==0)? "check" : "null"}
+ }
+ { f.dblline }
+ { " Tcl Command Shell " f.exec { tclOpen } }
+} ; createMenu optsMenu optionsButton $optsMenuDescription
+
+
+proc setOpts { opt args } {
+ global optsMenuDescription
+ global listOrient showType showFiles
+ global HTask HPkg HOpt hcurrent
+
+ switch $opt {
+ showType { set showType [expr { ($showType == 1) ? 0 : 1 } ]
+ GCmd type $showType
+ set h $hcurrent
+ GCmd help $HTask($h) $HPkg($h) $HOpt($h)
+ }
+ showFiles { set showFiles [expr { ($showFiles == 1) ? 0 : 1 } ]
+ }
+ verticalList { set listOrient [expr { ($args == "False") ? 0 : 1 } ]
+ send topicList set verticalList $args
+ }
+ }
+ editMenu optsMenu optionsButton $optsMenuDescription
+}
+
+proc Print args {
+ send printShell map
+} ; send printButton addCallback Print
+
+proc Find { args } {
+ send findShell popup
+} ; send findButton addCallback Find
+
+proc Search { args } {
+ global search_mapped
+
+ send searchShell map
+ set search_mapped 1
+} ; send searchButton addCallback Search
+
+proc Reload args {
+ global HPkg HType HUrl HOpt HTask HFile hcurrent
+
+ if { $HType($hcurrent) == "file"} {
+ if {[info exists HFile($hcurrent)] == 1} {
+ GCmd directory open $HFile($hcurrent)
+ } else {
+ setAlert param old [format "HFile param at %d not found" $hcurrent]
+ }
+ } else {
+ loadHistItem $hcurrent $HPkg($hcurrent) $HTask($hcurrent) \
+ $HOpt($hcurrent) $HType($hcurrent) $HUrl($hcurrent)
+ }
+} ; send reloadButton addCallback Reload
+
+proc Help args {
+ send hlpShell map
+} ; send helpButton addCallback Help
+
+proc Open args {
+ send fmtGroup unmap
+ send fmtGroup set height 0
+ send fbcOkay set label Load
+ send fileBrowser map
+}
+
+proc SaveAs args {
+ global format
+
+ # Reset the default format every time we open.
+ send $format set on 0
+ set format fmtSrc
+ send $format set on 1
+
+ # If there's no filename specified set one as a default.
+ setDefaultFname
+
+ send fmtGroup map
+ send fmtGroup set height 65
+ send fbcOkay set label Save
+ send fileBrowser map
+}
+
+proc Quit args {
+ GCmd quit
+ deactivate unmap
+}; send quitButton addCallback Quit
+
+
+
+################################################################################
+# Callbacks for client state variables (UI parameter objects). When the
+# client's state changes it updates a UI parameter to reflect the change.
+# This produces a callback to one or more of the callbacks defined below,
+# used to update the GUI to reflect the changing state of the client.
+################################################################################
+
+proc setShowType { param old new } {
+ global showType listOrient showFiles optsMenuDescription
+ set showType $new
+ editMenu optsMenu optionsButton $optsMenuDescription
+}; send showtype addCallback setShowType
+
+proc setTopics { param old new } {
+ global pkgList
+ set pkgList $new
+ send topicList setList $new resize
+}; send pkglist addCallback setTopics
+
+proc appendHist { param old new } {
+ global helpType helpOption curtask curpack
+
+ if {$new == "package"} {
+ #addHistRecord $curpack $curpack "" $helpOption "" $helpType
+ addHistRecord $curpack $curpack "" $helpOption "" "package"
+ } elseif {$new == "append"} {
+ # We've got a result of some kind and all of the values have been
+ # set, so create a history record.
+ if {$curpack != "" && $curtask != ""} {
+ addHistRecord $curpack $curtask "" $helpOption "" $helpType
+ }
+ }
+}; send history addCallback appendHist
+
+proc setCurpack { param old new } {
+ global curpack
+
+ if { $new != [getPkgName $curpack] } {
+ if { $curpack != "" && \
+ $curpack != "clpackage" && \
+ [string match "root*" $new] != 1} {
+ set curpack [ format "%s.%s" $curpack $new]
+ send htuButton set sensitive true
+ } else {
+ set curpack $new
+ }
+ }
+}; send curpack addCallback setCurpack
+
+
+proc setCurtask { param old new } {
+ global curtask curpack helpType
+
+ if {$helpType == "package"} {
+ send topicEntry set string $curpack
+ } else {
+ send topicEntry set string [ format "%s.%s" $curpack $new ]
+ }
+
+ # Update the printer dialog so the filename defaults to the curtask.
+ if { [send toFile get on] } {
+ if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} {
+ send printEntry set string [format "%s" [fileSource] ]
+ } else {
+ if { $new == "" } {
+ send printEntry set string "help.ps"
+ } else {
+ send printEntry set string [format "%s.ps" $new]
+ }
+ }
+ } else {
+ send printEntry set string "printer"
+ }
+ set curtask $new
+}; send curtask addCallback setCurtask
+
+
+proc getPkgName { pkg } {
+ set last [ string last "." $pkg ]
+ if { $last > -1 } {
+ return [ string range $pkg [incr last] end ]
+ } else {
+ return $pkg
+ }
+}
+
+proc getParentName { pkg } {
+ set last [ string last "." $pkg ]
+ if { $last > -1 } {
+ set root [ string range $pkg 0 [incr last -1] ]
+ } else {
+ set root $pkg
+ }
+ return [getPkgName $root]
+}
+
+
+# Topic list selection callback.
+proc topicSelect { widget event args } {
+ global htop hcurrent curpack curtask helpOption helpType
+ global visited
+
+ # If we're currently positioned somewhere in the middle of the
+ # history menu, push the current page to the history list before
+ # getting the next result.
+ if {$htop != $hcurrent} {
+ addHistRecord $curpack $curtask "" $helpOption "" $helpType
+ send htbButton set sensitive True
+ send htuButton set sensitive True
+ }
+
+ set item [string trimright [send topicList getItem itemno] "."]
+ send topicList getItem itemno
+ if { $itemno != "none" } {
+ GCmd help $item $curpack $helpOption
+ set visited($item) 1
+ }
+} ; send topicList addEventHandler topicSelect buttonReleaseMask
+
+proc listViewResize { args } {
+ global pkglist
+ send topicList setList $pkglist resize
+} ; send listView addEventHandler listViewResize ResizeRedirectMask
+
+
+# Get help for a specific topic from the topic entry widget.
+proc getTopicHelp { widget mode topic args } {
+ global curpack helpOption
+
+ if { [string match "*\.*" $topic] == 1} {
+ set pkglist [ split $topic "." ]
+ set pack [lindex $pkglist [expr {[llength $pkglist] - 2}] ]
+ set task [lindex $pkglist [expr {[llength $pkglist] - 1}] ]
+ set curpack $pack
+ GCmd help $task $curpack $helpOption
+ } else {
+ set curtask ""
+ set curpack ""
+ GCmd help $topic $curpack $helpOption
+ }
+} ; send topicEntry addCallback getTopicHelp
+
+proc topicClear { args } {
+ send topicEntry set string ""
+} ; send topicClear addCallback topicClear
+
+
+
+################################################################################
+# Help text and HTML processing procedures.
+################################################################################
+
+proc setHelpResult { param old new } {
+ global helpType helpOption curtask curpack
+ global secMenuDescription parMenuDescription
+ global pkgList debug
+
+ # Debug status
+ if {$debug == 1} {
+ send tclEntry append \
+ [format "helpres: type=%1.1s opt=%4.4s curtask=%s curpack=%s\n" \
+ $helpType $helpOption $curtask $curpack ]
+ print [format "helpres: type=%1.1s opt=%4.4s curtask=%s curpack=%s\n" \
+ $helpType $helpOption $curtask $curpack ]
+ }
+
+ if { [string match "*<HTML>*" $new] == 1} {
+ # Strip the header table.
+ if {[ string match "*TABLE*" $new] == 1 } {
+ set new_start [expr [string first "</TABLE>" $new] + 12]
+ set text [ filterBraces [string range $new $new_start end] ]
+ } else {
+ set text [ filterBraces $new ]
+ }
+
+ # Got HTML directly from the client.
+ send helpText setText [format "<HTML><BODY>\n%s" $text ]
+
+ # Save the source for the viewer
+ set docSrc \
+ [ format "<HTML><BODY>\n%s\n</BODY></HTML>\n" $text]
+
+ # Parse the file for menu items.
+ setSectionMenu $new
+ setParameterMenu $new
+
+ } else {
+ # Disable help page content buttons for plain text.
+ send parButton set sensitive False
+ send secButton set sensitive False
+ editMenu secMenu secButton $secMenuDescription
+ editMenu parMenu parButton $parMenuDescription
+
+ # Filter plaintext .men files into something with links, otherwise
+ # unescape the curly braces used to pass the text through Tcl.
+ if {$helpType == "package"} {
+ set str [ filterLinks [ filterTcl $new ] ]
+ } else {
+ set str [ filterTcl $new ]
+ }
+
+ # Load the results
+ send helpText setText "<HTML><BODY><PRE>\n$str\n</PRE></BODY></HTML>"
+
+ # Save the source for the viewer
+ set docSrc \
+ [ format "<HTML><BODY><PRE>\n%s\n</PRE></BODY></HTML>\n" $str]
+ }
+ send helpText retestAnchors
+ send srcText set string $docSrc
+
+ # See which files associated with this topic are available. We turn off
+ # the option toggles first so they can be reset as needed by the client.
+ if {$helpOption != "sysdoc"} {send sysOpt "set sensitive False ; set on 0" }
+ if {$helpOption != "source"} {send srcOpt "set sensitive False ; set on 0" }
+
+ if {$helpType == "package"} {
+ set parent [getParentName $curpack]
+ if {$parent == "clpackage" || [string match "root*" $parent] == 1} {
+ GCmd files $curtask "clpackage"
+ } else {
+ GCmd files $curtask $parent
+ }
+ } else {
+ GCmd files $curtask [string range $curpack \
+ [expr {[string last "." $curpack ] + 1}] end]
+ }
+
+ # Highlight the package list item.
+ for {set i 0} {$i < [llength $pkgList]} {incr i} {
+ if {[lindex $pkgList $i] == $curtask } {
+ send topicList highlight $i
+ break
+ }
+ }
+ printHistStack "helpres "
+
+}; send helpres addCallback setHelpResult
+
+
+# Set an arbitrary TextToggle widget highlight color.
+proc setOptColor { widget color args } {
+ send $widget "set on 1 ; \
+ set offIcon diamond0s ; \
+ set highlightColor $color ; \
+ set background gray75 ; \
+ set onIcon diamond1s ; \
+ set highlightColor $color ; \
+ set background gray75"
+}
+
+
+# Set the file options for the files that were found to be valid (i.e.
+# they're listed in the files output and actually exist).
+proc setHelpFileOpts { param old new } {
+ global helpType helpOption curtask curpack
+ global showFiles
+
+ set opt [lindex $new 0]
+ set val [lindex $new 1]
+ if {$opt != "file"} { set stat [lindex $new 2] }
+
+ # Set the option toggles according to valid files.
+ if {$opt == "sys" && $stat == 0} {
+ send sysOpt set sensitive True
+ } elseif {$opt == "sys" && $stat == 1 && $showFiles == 1} {
+ setOptColor sysOpt yellow
+ }
+ if {$opt == "src" && $stat == 0} {
+ send srcOpt set sensitive True
+ } elseif {$opt == "src" && $stat == 1 && $showFiles == 1} {
+ setOptColor srcOpt yellow
+ }
+
+ # Update the help files panel text.
+ if {$opt == "file"} {
+ set pkg [ string trimright $val ":"]
+ send flpkgVal set label [ format "%s" $pkg ]
+ send toplevel set title [format "XHelp: %s" $pkg ]
+ send flistText set string ""
+ } else {
+ send flistText append [ format " %5.5s %-7.7s %s\n" \
+ $opt \
+ [ expr { ($stat == 0) ? "Okay" : "Error" }] \
+ $val]
+ }
+
+} ; send helpfiles addCallback setHelpFileOpts
+
+
+# Process an HREF link selection. URLs are assumed to be of the form
+#
+# <pkgname>.<task>
+# <task>
+# '#'<hname>
+#
+# If an internal link is found as in the last case we ignore any defined
+# package/task given, otherwise load the selected page.
+
+proc textAnchorSelected {widget cbtype event text href args} {
+ global HPkg HType HUrl HOpt HTask HFile hcurrent htop
+ global curpack helpOption visited
+
+ set visited($href) 1
+ send helpText retestAnchors
+
+ if {[string match "*#*" $href] == 1} {
+ set link [string range $href [expr [string first "#" $href] + 1] end ]
+ set HUrl($hcurrent) $link
+ send helpText gotoId [ send helpText anchorToId $link ]
+ } else {
+ if { [string match "*\.*" $href] == 1} {
+ set pack [lindex [split $href "."] 0]
+ set task [lindex [split $href "."] 1]
+ set curpack $pack
+ GCmd help $task $curpack $helpOption
+
+ } else {
+ GCmd help $href $curpack $helpOption
+ }
+ }
+
+ if {$hcurrent <= $htop} {
+ set h $hcurrent
+ addHistRecord $HPkg($h) $HTask($h) $HUrl($h) $HOpt($h) \
+ HFile($h) $HType($h)
+ }
+
+}; send helpText addCallback textAnchorSelected anchor
+
+
+# Remove only the escaped curly braces. Used to filter HTML text passed to
+# the GUI with escapes in it.
+
+proc filterBraces { istr args } {
+ if {$istr != ""} {
+ regsub -all {(\\\{)} $istr "\{" v1
+ regsub -all {(\\\})} $v1 "\}" results
+ return $results
+ }
+}
+
+# Remove the backslash escapes from source files, escape special chars for
+# presentation on an HTML widget.
+
+proc filterTcl { istr args } {
+ if {$istr != ""} {
+ regsub -all {(\\\{)} $istr "\{" v1
+ regsub -all {(\\\})} $v1 "\}" v2
+ regsub -all {(\<)} $v2 "\\&lt;" v3
+ regsub -all {(\>)} $v3 "\\&gt;" results
+ return $results
+ }
+}
+
+
+# Scan a plaintext doc to see if maybe this is a package help menu. We use
+# some assumption that most of the lines will be of the form "task '-' desc"
+# then parse the file resetting all of the 'task' names as HREFs for other
+# tasks.
+
+proc filterLinks { istr args } {
+
+ set lines [split $istr "\n"]
+ set blank " "
+ set results { }
+ lappend results ""
+ foreach i $lines {
+ set line [string trimleft [detab $i] ]
+ if {[regexp {(^[a-zA-Z0-9\ \_\(\)]+[\+|\-]*)} $line arg] == 1 &&
+ ([string match "*\-*" $arg] == 1 ||
+ [string first "\*" $line] > 0 ||
+ [string match "*\+*" $arg] == 1) } {
+
+ set task [string trim [string trimright $arg "-+"] ]
+ set l [string first "-" $line]
+ if {$l == -1} {
+ set l [string first "+" $line]
+ if {$l == -1} {
+ set l [string first "\*" $line]
+ }
+ }
+ set desc [ string range $line $l end ]
+
+ # We now have the task name and the description string, format
+ # on output with the HREF defined.
+ set nblanks [expr 13 - [string length $task] ]
+ set fmtstr [format "%%%ds<A HREF=\"%%s\">%%s</A> %%s\n" $nblanks ]
+ set ostr [format $fmtstr $blank $task $task $desc]
+
+ lappend results $ostr
+
+ } elseif {[regexp {(^[a-zA-Z0-9\_]+\.[a-zA-Z0-9\_]+\:$)} $i val] == 1} {
+
+ # Break out the task and package names.
+ regsub -all {[\.:]} $i " " val
+ scan $val "%s %s" parent child
+
+ # Format a URL and append the results.
+ if { [ string match "*root*" $parent] == 0} {
+ set ref [format "<A HREF=\"%s\">%s</A>.<A HREF=\"%s\">%s</A>:\n"\
+ $parent $parent $child $child ]
+ } else {
+ set ref [format "%s.<A HREF=\"%s\">%s</A>:\n"\
+ $parent $child $child ]
+ }
+ lappend results $ref
+
+ } else {
+ set nblanks [expr [string length $i] - [string length $line] ]
+ set fmtstr [format "%%%ds%%s\n" $nblanks ]
+ lappend results [format $fmtstr $blank $line ]
+ }
+ }
+ return [ join $results ]
+}
+
+
+# Generated a list of the lines and create the section menu.
+
+proc setSectionMenu { text args } {
+ global secMenuDescription
+
+ # Break out the table of contents from the string. Note we're hard-
+ # wired here into the form of the comment string used to contain the
+ # section name.
+ set l [expr [string first "<! Contents: " $text] + 12]
+ if {$l == 0} { return }
+ set s [string range $text $l end]
+ set r [expr [string first ">" $s] - 4]
+ set t [string range $s 0 $r]
+ set lst [split $t '\'']
+
+ # Now take the list generated and create the menu.
+ set items { }
+ lappend items " \"Top of Page\" f.exec \{ send helpText gotoId 0 \}"
+ lappend items " f.dblline "
+ foreach i $lst {
+ if {$i != " "} {
+ set i [ string trimright $i ]
+ regsub -all {[ ,.():;]} [string tolower $i] _ url
+ lappend items " \" $i \" f.exec \{ jumpToName #s_$url \}"
+ }
+ }
+
+ if { [llength $items] == 3 } {
+ send secButton set sensitive False
+ editMenu secMenu secButton $secMenuDescription
+ } else {
+ editMenu secMenu secButton $items
+ send secButton set sensitive True
+ }
+}
+
+
+# Generated a list of the lines and create the parameter menu.
+proc setParameterMenu { text args } {
+ global parMenuDescription
+ set items { }
+ foreach i [split $text "\n"] {
+ if {[string match "\<\! Sec*PARAMETERS*Level=0*" $i] == 1} {
+ set l [expr [string first "Line='" $i] + 6]
+ set s [string range $i $l end]
+ set r [expr [string first "\'" $s] - 1]
+ set t [string range $s 0 $r]
+ regsub -all {[\ ]} $t " " d ;# remove tabs
+ regsub -all {[\"]} $d "\\\"" entry
+
+ set l [expr [string first "Label='" $i] + 7]
+ set s [string range $i $l end]
+ set r [expr [string first "\'" $s] - 1]
+ set t [string range $s 0 $r]
+
+ lappend items " \"$entry\" f.exec \{ jumpToName #l_$t \}"
+ }
+ }
+
+ if { [llength $items] == 0 } {
+ send parButton set sensitive False
+ editMenu parMenu parButton $parMenuDescription
+ } else {
+ editMenu parMenu parButton $items
+ send parButton set sensitive True
+ }
+}
+
+
+# Position the page to the requested href name.
+proc jumpToName { name } {
+ global curtask curpack helpType helpOption
+
+ send helpText gotoId [send helpText anchorToId $name]
+ send helpText retestAnchors
+
+ # Now add a history record for the jump
+ addHistRecord $curpack $curtask $name $helpOption "" $helpType
+}
+
+
+# Utility routine to 'detab' a line and preserve format.
+proc detab {str {tablen 8}} {
+ set a 0
+ set i [string first "\t" $str]
+ while {$i != -1} {
+ set m { }
+ set j $i
+ while {[incr j] % $tablen} { append m { } }
+ set str [string range $str $a \
+ [expr {$i-1}]]$m[string range $str [incr i] end]
+ set i [string first "\t" $str]
+ }
+ return $str
+}
+
+
+################################################################################
+# Navigation and History Callbacks
+################################################################################
+
+# Go back one page.
+proc Back args {
+ global curtask curpack helpType helpOption
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+
+ incr hcurrent -1
+ if {$hcurrent >= 0} {
+ set item $HTask($hcurrent)
+ set pkg $HPkg($hcurrent)
+ set type $HType($hcurrent)
+ set h $hcurrent
+
+ if { $item == "Home" } {
+ loadHomePage
+ } else {
+ if { $HType($h) == "file"} {
+ if {[info exists HFile($h)] == 1} {
+ loadHistItem $h pkg $HFile($h) help file
+ } else {
+ setAlert param old \
+ [format "HFile param at %d not found" $hcurrent]
+ }
+ } else {
+ loadHistItem $h $HPkg($h) $HTask($h) $HOpt($h) \
+ $HType($h) $HUrl($h)
+ }
+ }
+
+ if {$hcurrent == 0} {
+ send htbButton set sensitive False
+ send htuButton set sensitive False
+ }
+ if {$hcurrent >= 0} {
+ send htfButton set sensitive True
+ send htuButton set sensitive True
+ }
+ } else {
+ set hcurrent 0
+ }
+ editHistoryMenu
+ printHistStack "Back "
+} ; send htbButton addCallback Back
+
+
+# Go forward one page.
+proc Forward args {
+ global curtask curpack helpType helpOption
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+
+ incr hcurrent
+ if {$hcurrent <= $htop} {
+ set item $HTask($hcurrent)
+ set pkg $HPkg($hcurrent)
+ set type $HType($hcurrent)
+ set h $hcurrent
+
+ if { $item == "Home" } {
+ loadHomePage
+ } else {
+ if { $HType($h) == "file"} {
+ if {[info exists HFile($h)] == 1} {
+ loadHistItem $h pkg $HFile($h) help file
+ } else {
+ setAlert param old \
+ [format "HFile param at %d not found" $hcurrent]
+ }
+ } else {
+ loadHistItem $h $HPkg($h) $HTask($h) $HOpt($h) \
+ $HType($h) $HUrl($h)
+ }
+ }
+
+ if {$hcurrent == $htop } {
+ send htfButton set sensitive False
+ send htbButton set sensitive True
+ } else {
+ send htbButton set sensitive True
+ }
+ } else {
+ incr hcurrent -1
+ }
+ editHistoryMenu
+ printHistStack "Forward "
+} ; send htfButton addCallback Forward
+
+
+# Go up to previous package, skipping over pages inbetween.
+proc Up args {
+ global curtask curpack helpType helpOption
+ global HPkg HType HUrl HOpt HTask htop hcurrent
+
+ # From the current page go back until we find a package
+ if {$HType($hcurrent) == "package"} {
+ set i [expr {$hcurrent-1} ]
+ } else {
+ set i $hcurrent
+ }
+ while {$HType($i) != "package" && $i >= 0} {
+ incr i -1
+ }
+
+ # Found package, go get it.
+ set hcurrent $i
+ if {$i == 0} {
+ loadHomePage ;# push a history record??
+ } else {
+ GCmd load $HTask($i) [getPkgName $HPkg($i)] $HOpt($i)
+ }
+
+ set curtask $HTask($hcurrent) ;# update the state of things
+ set curpack $HPkg($hcurrent)
+ set helpOption $HOpt($hcurrent)
+ set helpType $HType($hcurrent)
+
+ send topicEntry set string $curpack ;# update topic entry string
+
+ if {$hcurrent == 0} { ;# adjust navigation buttons
+ send htbButton set sensitive False
+ send htuButton set sensitive False
+ }
+ if {$hcurrent >= 0} {
+ send htfButton set sensitive True
+ send htuButton set sensitive True
+ }
+ editHistoryMenu
+ printHistStack "Forward "
+} ; send htuButton addCallback Up
+
+
+# Go straight to the homepage.
+proc Home args {
+ global curtask curpack helpType helpOption
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+
+ # Load the homepage.
+ loadHomePage
+
+ # A Home command jumps over everything in the history list but we
+ # need to push a history record for it anyway.
+ addHistRecord $HPkg(0) $HTask(0) $HUrl(0) $HOpt(0) $HFile(0) $HType(0)
+
+ send topicEntry set string ""
+ set curtask ""
+ set curpack ""
+ set helpType "package"
+ set helpType "help"
+} ; send hthButton addCallback Home
+
+
+# Load the homepage.
+proc loadHomePage { args } {
+ global curtask curpack version showType
+
+ GCmd help Home
+
+ # Clean up.
+ set curtask ""
+ set curpack ""
+ send topicEntry set string ""
+ send toplevel set title $version
+}
+
+# Clear all the history information.
+proc histClear args {
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+ global visited
+
+ # Clear the visited anchors list.
+ foreach i [array names visited] {
+ unset visited($i)
+ }
+
+ # Clear the history stack.
+ for { set i [expr {$htop -1}] } { $i >= 0 } { incr i -1 } {
+ catch {
+ unset HType($i)
+ unset HOpt($i)
+ unset HTask($i)
+ unset HPkg($i)
+ unset HUrl($i)
+ unset HFile($i)
+ }
+ }
+
+ # Reinitialize, but save the current page as the new history stack.
+ catch {
+ set HPkg(0) $HPkg($htop) ;# package
+ set HOpt(0) $HOpt($htop) ;# option
+ set HTask(0) $HTask($htop) ;# task
+ set HUrl(0) $HUrl($htop) ;# url
+ set HType(0) $HType($htop) ;# type
+ set HFile(0) $HFile($htop) ;# filename
+ }
+ set htop 0
+ set hcurrent 0
+
+ # Update navigation options and history menu.
+ send htbButton set sensitive False
+ send htfButton set sensitive False
+ send htuButton set sensitive False
+ editHistoryMenu
+}
+
+
+# Push an item on the history stack.
+proc addHistRecord { pkg task url opt file type } {
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+ global helpType helpOption
+ global historyMenuDescription
+
+ # Push a new history record to the top of the stack and make that the
+ # current record.
+ incr htop
+ set HPkg($htop) $pkg
+ set HTask($htop) $task
+ set HUrl($htop) $url
+ set HOpt($htop) $opt
+ set HFile($htop) [ expr {($file == "") ? "none" : $file } ]
+ set HType($htop) $type
+ set hcurrent $htop
+
+ # Activate the Back button.
+ if {$hcurrent == 1} {
+ send htbButton set sensitive True
+ if {$type == "package"} {
+ send htuButton set sensitive True
+ }
+ }
+
+ # Edit the history menu.
+ editHistoryMenu
+ printHistStack "addHistRecord"
+}
+
+
+# Edit the history menu to reflect the current state.
+proc editHistoryMenu { args } {
+ global HPkg HType HUrl HOpt HTask htop hcurrent
+ global helpType helpOption
+ global historyMenuDescription
+ global navMenuDescription
+ global MAX_MENU_SIZE
+
+ set items $historyMenuDescription
+ set nitems 0
+ if {$htop > $MAX_MENU_SIZE} {
+ set nstart [ min $htop [expr {$hcurrent + 3}] ]
+ } else {
+ set nstart $htop
+ }
+ for { set i $nstart } { $i >= 0 } { incr i -1 } {
+ set pkg $HPkg($i)
+ set task $HTask($i)
+ set type $HType($i)
+ set opt $HOpt($i)
+ set url $HUrl($i)
+ if {$pkg != "" || $type == "file"} {
+ if {$type == "task"} {
+ if {$url == ""} {
+ set entry [format "%-22.22s %4s" $task \
+ [menuItemType $type $url $opt ] ]
+ } else {
+ set entry [format "%-22.22s %4s" \
+ [ format "%s (%s)" $task [string trimleft $url "#"] ] \
+ [menuItemType $type $url $opt ] ]
+ }
+ } elseif {$type == "package"} {
+ set entry [format "%-22.22s %4s" [getPkgName $pkg] \
+ [menuItemType $type $url $opt ] ]
+ } elseif {$type == "file"} {
+ upvar #0 HFile file
+ set entry [format "%s" $file($i) ]
+ } else {
+ setAlert param old [format "Unknown help type: %s" $type]
+ }
+
+ if {$type == "file"} {
+ lappend items " \" $entry \" f.exec \{ \
+ loadHistItem $i pkg $entry help file \} \
+ bitmap \{\($i==$hcurrent\) ? \"arrow\" : \"null\" \} "
+ } else {
+ lappend items " \" $entry \" f.exec \{ \
+ loadHistItem $i [getPkgName $pkg] $task $opt $type $url \} \
+ bitmap \{\($i==$hcurrent\) ? \"arrow\" : \"null\" \} "
+ }
+ }
+
+ incr nitems 1
+ if {$nitems > $MAX_MENU_SIZE} {
+ lappend items "f.dblline"
+ lappend items " \" History truncated... \" f.exec \{ \} "
+ break
+ }
+ }
+ editMenu historyMenu historyButton $items
+
+ # Edit the navigation menu to get the sensitivities right for
+ # the current state.
+ editMenu navMenu helpText $navMenuDescription
+}
+
+
+# Utility routine to set the history item entry type.
+proc menuItemType { type url opt } {
+ if {$url != ""} {
+ return [format "Link"]
+ }
+
+ switch $opt {
+ "help" { return [format "%s" [expr {($type=="task")?"Task":"Pkg"} ]] }
+ "source" { return [format "(src)"] }
+ "sysdoc" { return [format "(sys)"] }
+ }
+}
+
+
+# Load a particular page/link from the history list.
+proc loadHistItem { itemno pkg task opt type args } {
+ global HPkg HType HUrl HOpt HTask htop hcurrent
+ global curtask curpack helpType helpOption hcurrent
+ global version
+
+ # Load the requested page. Check whether we just need to jump to
+ # the current page.
+ if {$task == "Home"} {
+ loadHomePage
+
+ } elseif {$type == "file"} {
+ GCmd directory open $task
+
+ } elseif {$itemno == $hcurrent || \
+ ($pkg != $curpack || \
+ $task != $curtask || \
+ $type != $helpType || \
+ $opt != $helpOption) } {
+ GCmd load $task $pkg $opt
+ }
+
+ # If the history item included an internal link, jump to it. The
+ # 'args' value will either be the URL or an empty string.
+ if {$args != ""} {
+ send helpText gotoId [send helpText anchorToId $args]
+ send helpText retestAnchors
+ }
+
+ # Update the topic entry string.
+ if { $type == "task" } {
+ send topicEntry set string [ format "%s.%s" $pkg $task ]
+ } elseif { $type == "file" } {
+ send topicEntry set string $task
+ } else {
+ send topicEntry set string $pkg
+ }
+
+ # Change the options button if needed.
+ if {$HOpt($itemno) != $helpOption} {
+ send [ getOptWidget $helpOption ] set on 0
+ setOptColor [ getOptWidget $HOpt($itemno) ] green
+ }
+
+ # Update the current entry.
+ set hcurrent $itemno
+
+ if { $type != "file" } {
+ set curtask $HTask($hcurrent)
+ set curpack $HPkg($hcurrent)
+ set helpOption $HOpt($hcurrent)
+ set helpType $HType($hcurrent)
+ } else {
+ set helpOption "help"
+ set helpType "file"
+ }
+
+ # Tweak the navigation buttons.
+ if {$hcurrent == 0} {
+ send htbButton set sensitive False
+ send htuButton set sensitive False
+ }
+ if {$hcurrent >= 0} {
+ send htfButton set sensitive True
+ send htuButton set sensitive True
+ }
+ if {$hcurrent == $htop } {
+ send htfButton set sensitive False
+ send htbButton set sensitive True
+ }
+
+ # Edit the history menu.
+ editHistoryMenu
+}
+
+# Initialize the history menu.
+editHistoryMenu
+
+# Given the option type return the widget name.
+proc getOptWidget { opt } {
+ switch $opt {
+ "help" { return "hlpOpt" }
+ "source" { return "srcOpt" }
+ "sysdoc" { return "sysOpt" }
+ }
+}
+
+# Debug utility to print the history stack.
+proc printHistStack { where args } {
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+ global debug
+
+ # Print the stack...
+ if {$debug > 0} {
+ print "_______________________________________________________________"
+ print $where
+ for { set i $htop } { $i >= 0 } { incr i -1 } {
+ if {$HType($i) == "file"} {
+ upvar #0 HFile file
+ print [format "%3s%d: type=%1.1s file=%s\n"\
+ [ expr {($i==$hcurrent) ? ">>>" : "---"} ] \
+ $i $HType($i) $file($i) ]
+ } else {
+ print [format "%3s%d: type=%1.1s opt=%4.4s task=%s pack=%s\n"\
+ [ expr {($i==$hcurrent) ? ">>>" : "---"} ] \
+ $i $HType($i) $HOpt($i) $HTask($i) $HPkg($i) $HUrl($i) ]
+ }
+ }
+ }
+}
+
+# Test whether an anchor has been visited.
+proc testAnchor {widget cbtype href} {
+ global visited
+ return [info exists visited($href)]
+}
+send hlpText addCallback testAnchor testAnchor
+send helpText addCallback testAnchor testAnchor
+send resList addCallback testAnchor testAnchor
+
+
+################################################################################
+# Options Menu
+################################################################################
+
+proc setType { param old new } {
+ global helpType
+ set helpType [string tolower $new ]
+} ; send type addCallback setType
+
+proc selectOption { widget type value args } {
+ global curtask curpack helpOption
+
+ if { $curtask != "" } {
+ foreach i { hlpOpt srcOpt sysOpt } { send $i set on 0 }
+ setOptColor $widget green
+ send $widget set on 1
+ switch $widget {
+ hlpOpt { set helpOption help
+ send fmtText setSensitive true
+ send fmtPS setSensitive true
+ }
+ srcOpt { set helpOption source
+ send fmtText setSensitive false
+ send fmtPS setSensitive false
+ }
+ sysOpt { set helpOption sysdoc
+ send fmtText setSensitive true
+ send fmtPS setSensitive true
+ }
+ }
+ GCmd help $curtask [getParentName $curpack] $helpOption
+ }
+}; foreach i {hlpOpt srcOpt sysOpt } { send $i addCallback selectOption }
+
+proc toggleFileOption { args } {
+ if { [ send filOpt get on] == 1 } {
+ send fileShell map
+ } else {
+ send fileShell unmap
+ }
+} ; send filOpt addCallback toggleFileOption
+
+send flDismiss addCallback "send fileShell unmap ; send filOpt set on 0"
+
+
+################################################################################
+# Procedure used by the printer prompt box.
+################################################################################
+
+proc setPrinterName { param old new } {
+ send printEntry set string $new
+}; send printer addCallback setPrinterName
+
+set page_size pageLetter
+
+proc pageRadio { widget type state args } {
+ global page_size
+
+ if {$state == 0} {
+ # Don't allow a button to be turned off.
+ send $widget set on 1
+ } else {
+ send $page_size set on 0
+ set page_size $widget
+ }
+}
+foreach w {pageLetter pageLegal pageA4 pageB5} { send $w addCallback pageRadio }
+
+proc toPrinterToggle args {
+ global curtask HType hcurrent
+ if { [send toPrinter get on] } {
+ send toFile set on False
+ send printLabel set label "Printer: "
+ send printEntry set string "printer"
+ } else {
+ send toFile set on True
+ send printLabel set label "File Name: "
+ if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} {
+ send printEntry set string [format "%s" [fileSource] ]
+ } else {
+ if { $curtask == "" } {
+ send printEntry set string "help.ps"
+ } else {
+ send printEntry set string [format "%s.ps" $curtask]
+ }
+ }
+ }
+} ; send toPrinter addCallback toPrinterToggle
+
+proc toFileToggle args {
+ global curtask HType hcurrent
+ if { [send toFile get on] } {
+ send toPrinter set on False
+ send printLabel set label "File Name: "
+ if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} {
+ send printEntry set string [format "%s" [fileSource] ]
+ } else {
+ if { $curtask == "" } {
+ send printEntry set string "help.ps"
+ } else {
+ send printEntry set string [format "%s.ps" $curtask]
+ }
+ }
+ } else {
+ send toPrinter set on True
+ send printLabel set label "Printer: "
+ send printEntry set string "printer"
+ }
+} ; send toFile addCallback toFileToggle
+
+proc doPrintOkay { args } {
+ global curtask curpack HType hcurrent
+
+ set device [ send printEntry get string ]
+ if { [send toPrinter get on] } {
+ GCmd print $curtask $curpack $device
+ } else {
+ set fname [send printEntry get string]
+ if {$HType($hcurrent) == "file" || [send srcOpt get on] == 1} {
+ GCmd directory save [fileSource] $fname 1 source
+ } else {
+ GCmd directory save [fileSource] $fname 1 postscript
+ }
+ }
+ send printShell unmap
+}
+send printOkay addCallback doPrintOkay
+send printEntry addCallback doPrintOkay
+
+send printDismiss addCallback "send printShell unmap "
+
+
+################################################################################
+# Procedures used by the fileBrowser.
+################################################################################
+
+# File browsing globals
+set curdir "" ;# current directory
+set pattern "*" ;# filename template
+set format "fmtSrc" ;# SaveAs format
+
+
+# Browser selection callback.
+proc browserSelect { widget event args } {
+ global curdir helpOption
+
+ set opt [expr {$widget == "dirList" ? "dirlist" : "loadfile"}]
+ set item [send $widget getItem itemno]
+ send $widget getItem itemno
+ set mode [send fbcOkay get label]
+
+ if { $itemno != "none" } {
+ if { $mode == "Load"} {
+ if {$opt != "dirlist"} {
+ addHistRecord "" "" "" help [format "%s%s" $curdir $item] "file"
+ }
+ GCmd directory $opt $item
+ send flistText set string [format " file Okay %s%s\n" \
+ $curdir $item]
+ } else {
+ if {$opt == "dirlist"} {
+ GCmd directory $opt $item
+ } else {
+ send fnameEntry set string [format "%s%s" $curdir $item]
+ }
+ }
+ }
+}
+send dirList addEventHandler browserSelect buttonReleaseMask
+send fileList addEventHandler browserSelect buttonReleaseMask
+
+
+# Client callback.
+proc browserListing { param old new } {
+ global curdir pattern
+
+ set option [ lindex $new 0 ]
+ switch $option {
+ dirlist { set list [lindex $new 1]
+ send dirList setList $list resize
+ }
+ filelist { set list [lindex $new 1]
+ send fileList setList $list resize
+ }
+ template { set pattern [lindex $new 1]
+ send filterEntry set string $pattern
+ }
+ curdir { set curdir [lindex $new 1]
+ send curdirVal set label $curdir
+ }
+ selection { send fnameEntry set string [lindex $new 1] }
+ }
+} ; send directory addCallback browserListing
+
+
+# Set the filename matching template.
+proc setTemplate { widget mode pattern args } {
+ GCmd directory template $pattern
+} ; send filterEntry addCallback setTemplate
+
+
+# get the filename of the currently displayed page.
+proc fileSource { args } {
+ global helpOption
+
+ set str [ send flistText get string ]
+
+ set fname ""
+ for {set i 0} {$i < [llength $str]} {incr i 3} {
+ set j [expr {$i + 2} ]
+ if {($helpOption == "source" && [lindex $str $i] == "src") ||
+ ($helpOption == "sysdoc" && [lindex $str $i] == "sys") ||
+ ($helpOption == "help" && [lindex $str $i] == "hlp") ||
+ ($helpOption == "file" && [lindex $str $i] == "file")} {
+ set fname [lindex $str $j]
+ break
+ }
+ }
+ return $fname
+}
+
+# Open a specific file, either to load a new page or save the current page.
+proc openFile { widget args } {
+ global curdir helpOption
+
+ set fname [send fnameEntry get string]
+
+ if {$fname == ""} {
+ setAlert param old "No filename specified"
+ } else {
+ if { [send fbcOkay get label] == "Load"} {
+ addHistRecord "" "" "" "" [format "%s%s" $curdir $fname] "file"
+ GCmd directory open $fname
+ send flistText set string [format " file Okay %s\n" $fname]
+ } else {
+ set page [fileSource]
+ set ow [send overwrite get on]
+ if {[send fmtSrc get on] == 1} {
+ GCmd directory save $page $fname $ow source
+ } elseif {[send fmtText get on] == 1} {
+ GCmd directory save $page $fname $ow text
+ } elseif {[send fmtHTML get on] == 1} {
+ GCmd directory save $page $fname $ow html
+ } elseif {[send fmtPS get on] == 1} {
+ GCmd directory save $page $fname $ow postscript
+ }
+ }
+ }
+} ; send fbcOkay addCallback openFile
+
+
+# Make the SaveAs formats a radio box.
+proc fmtRadio { widget type state args } {
+ global format
+
+ if {$state == 0} {
+ # Don't allow a button to be turned off.
+ send $widget set on 1
+ } else {
+ send $format set on 0
+ set format $widget
+ }
+
+ # If there's no filename specified set one as a default.
+ setDefaultFname
+
+} ; foreach w {fmtSrc fmtText fmtHTML fmtPS} { send $w addCallback fmtRadio }
+
+
+# Set a default filename based on the selected format and task name
+proc setDefaultFname args {
+ global format curtask curdir
+
+ set fname [send fnameEntry get string]
+ if {$curtask != ""} {
+ switch $format {
+ fmtSrc { send fnameEntry \
+ set string [format "%s%s" $curdir $curtask] }
+ fmtText { send fnameEntry \
+ set string [format "%s%s.txt" $curdir $curtask] }
+ fmtHTML { send fnameEntry \
+ set string [format "%s%s.html" $curdir $curtask] }
+ fmtPS { send fnameEntry \
+ set string [format "%s%s.ps" $curdir $curtask] }
+ }
+ }
+}
+
+proc browserHelp args {
+ if { [send fbcOkay get label] == "Load"} {
+ showHelp lfiles
+ } else {
+ showHelp sfiles
+ }
+} ; send fbcHelp addCallback browserHelp
+
+send fnavHome addCallback "GCmd directory home"
+send fnavUp addCallback "GCmd directory up"
+send fnavRoot addCallback "GCmd directory root"
+send fnavRescan addCallback "GCmd directory rescan"
+send fnameClear addCallback "send fnameEntry set string \"\""
+send filterClear addCallback "send filterEntry set string \"\""
+send fbcDismiss addCallback "send fileBrowser unmap"
+
+
+
+################################################################################
+# Procedures used by the find box.
+################################################################################
+
+proc doFindOkay args {
+ set dir forward
+ set case caseless
+ set phrase [send findEntry get string]
+
+ if { $phrase != "" } {
+ if { [send findDir get on] } { set dir backward }
+ if { [send findCase get on] } { set case caseSensitive }
+
+ if { [send helpText searchText $phrase start end $dir $case] > 0 } {
+ set elid [lindex [lindex $start 0] 0]
+ set id [max 1 [expr $elid - 10] ]
+
+ send helpText gotoId $id
+ send helpText setSelection $start $end
+ } else {
+ send warnText set label "Search string not found."
+ send warning map
+ }
+ } else {
+ send warnText set label "Warning: No search phrase entered."
+ send warning map
+ }
+} ; foreach w { findOkay findEntry } { send $w addCallback doFindOkay }
+
+send findClear addCallback { send findEntry set string "" }
+send findDismiss addCallback { send findShell popdown }
+
+
+################################################################################
+# Procedures used by the apropos prompt box.
+################################################################################
+
+proc doSearchOkay args {
+ set phrase [send searchEntry get string]
+ if { $phrase != "" } {
+ send searchStatus set label "Searching..."
+ GCmd search [send exactMatch get on] $phrase
+ } else {
+ send warnText set label "Warning: No search phrase entered."
+ send warning map
+ }
+} ; foreach w { searchOkay searchEntry } { send $w addCallback doSearchOkay }
+
+proc searchResults { param old new } {
+ global search_mapped
+
+ if {$search_mapped == 0} {
+ Search
+ }
+ send resList setText $new
+ send resList retestAnchors
+ send searchStatus set label ""
+} ; send apropos addCallback searchResults
+
+# Selection callback.
+proc searchAnchorSelected {widget cbtype event text href args} {
+ global helpOption helpType curpack curtask
+ global visited
+
+ # Break out the task and package names.
+ set pack [lindex [split $href "."] 0]
+ set task [lindex [split $href "."] 1]
+
+ # Set the state and load the page.
+ if {$helpOption != "help"} {
+ send [getOptWidget $helpOption] set on 0
+ setOptColor hlpOpt green
+ }
+ set curtask $task
+ set curpack $pack
+ set helpOption "help"
+ set helpType [expr {($pack == $task) ? "package" : "task"}]
+ GCmd load $curtask $curpack $helpOption
+
+ # Add the history record, one for the package and one for the task.
+ addHistRecord $curpack $curpack "" $helpOption "" "package"
+ if {$pack != $task} {
+ addHistRecord $curpack $curtask "" $helpOption "" "task"
+ }
+ send htbButton set sensitive True
+ send htuButton set sensitive True
+ editHistoryMenu
+ printHistStack "searchAnchorSelected"
+
+ # Update the topic entry string.
+ if { $task == $pack } {
+ send topicEntry set string $pack
+ } else {
+ send topicEntry set string [ format "%s.%s" $pack $task ]
+ }
+
+ set visited($href) 1
+ send resList retestAnchors
+
+} ; send resList addCallback searchAnchorSelected anchor
+
+proc doSearchClear args {
+ send searchEntry set string ""
+} ; send searchClear addCallback doSearchClear
+
+proc doSearchDismiss args {
+ global search_mapped
+
+ set search_mapped 0
+ send searchShell unmap
+} ; send searchDismiss addCallback doSearchDismiss
+
+send searchHelp addCallback { showHelp search }
+
+
+################################################################################
+# Define procedures for the help panel
+################################################################################
+
+# Stuff for keeping track of visited anchors.
+set h_links { 0 }
+set h_linkIndex 0
+
+proc getHelpText { param old new } {
+ send hlpText setText $new
+}; send help addCallback getHelpText
+
+proc anchorSelected {widget cbtype event text href args} {
+ global visited h_links h_linkIndex
+ set anchID [send hlpText anchorToId $href]
+ set visited($href) 1
+ if {$h_linkIndex == 0} {
+ send hlpBack set sensitive True
+ if {[lindex $h_links 1] != $anchID} {
+ set h_links { 0 }
+ send hlpForward set sensitive False
+ }
+ }
+ if {$h_linkIndex > 0 && \
+ [lindex $h_links [expr $h_linkIndex + 1]] != $anchID} {
+ #set h_links [lrange $h_links 0 $h_linkIndex]
+ set pos [send hlpText positionToId 0 0]
+ set h_links [lreplace $h_links $h_linkIndex end $pos]
+ }
+ if {[lindex $h_links [expr $h_linkIndex + 1]] != $anchID} {
+ lappend h_links $anchID
+ incr h_linkIndex
+ } else {
+ send hlpForward set sensitive False
+ incr h_linkIndex
+ }
+ if {$h_linkIndex == [expr [llength $h_links] - 1]} {
+ send hlpForward set sensitive False
+ }
+ send hlpText gotoId $anchID
+ send hlpText retestAnchors
+}; send hlpText addCallback anchorSelected anchor
+
+
+# Callbacks to position forwards and backwards in link list.
+proc hlpForward args {
+ global h_links h_linkIndex
+ incr h_linkIndex
+ if {$h_linkIndex <= [llength $h_links]} {
+ set anchID [lindex $h_links $h_linkIndex]
+ send hlpText gotoId $anchID
+ send hlpText retestAnchors
+ if {$h_linkIndex == [expr [llength $h_links] - 1]} {
+ send hlpForward set sensitive False
+ send hlpBack set sensitive True
+ } else {
+ send hlpBack set sensitive True
+ }
+ } else {
+ incr h_linkIndex -1
+ }
+}; send hlpForward addCallback hlpForward
+
+proc hlpBack args {
+ global h_links h_linkIndex
+ incr h_linkIndex -1
+ if {$h_linkIndex >= 0} {
+ set anchID [lindex $h_links $h_linkIndex]
+ send hlpText gotoId $anchID
+ send hlpText retestAnchors
+ if {$h_linkIndex == 0} { send hlpBack set sensitive False }
+ if {$h_linkIndex >= 0} { send hlpForward set sensitive True }
+ } else {
+ incr h_linkIndex 1
+ }
+}; send hlpBack addCallback hlpBack
+
+proc hlpHome args {
+ global h_links h_linkIndex
+ set h_links { 0 }
+ set h_linkIndex 0
+ send hlpText gotoId 0
+ send hlpForward set sensitive False
+ send hlpBack set sensitive False
+}; send hlpHome addCallback hlpHome
+
+proc hlpTutorial args {
+ showHelp tutorial
+}; send hlpTutorial addCallback hlpTutorial
+send hlpTutorial unmap ;# NO TUTORIAL AT THE MOMENT
+
+proc showHelp {name args} {
+ anchorSelected widget cbtype event text #$name
+ send hlpShell map
+}
+
+proc hlpFind args {
+ set phrase [send hfEntry get string]
+ set dir forward
+ set case caseless
+
+ if { $phrase != "" } {
+ if { [send hfDir get on] } { set dir backward }
+ if { [send hfCase get on] } { set case caseSensitive }
+ if {[send hlpText searchText $phrase start end $dir $case ] > 0} {
+ set elid [lindex [lindex $start 0] 0]
+ set id [max 1 [expr $elid - 10] ]
+ send hlpText gotoId $id
+ send hlpText setSelection $start $end
+ } else {
+ send warnText set label "Search string not found."
+ send warning map
+ }
+ } else {
+ send warnText set label "Warning: No search phrase entered."
+ send warning map
+ }
+} ; foreach w { hfEntry hfFind } { send $w addCallback hlpFind }
+
+send hfClear addCallback { send hfEntry set string "" }
+
+send hlpDismiss addCallback "send hlpShell unmap"
+
+
+################################################################################
+# Document source viewer procedures.
+################################################################################
+
+proc srcOpen { args } { send doc_source map }
+send srcDismiss addCallback "send doc_source unmap"
+
+
+################################################################################
+# Define some TCL debug procedures
+################################################################################
+
+proc tclOpen {} { send tclShell map }
+
+proc tclCommandClear { widget args } {
+ send tclEntry set string ""
+} ; send tclClear addCallback tclCommandClear
+
+proc tclCommandExecute { widget args } { \
+ send server [send tclEntry {get string}]
+} ; send tclExecute addCallback tclCommandExecute
+
+proc tclCommand { widget mode command args } {
+ send server $command
+} ; send tclEntry addCallback tclCommand
+
+proc tclToggleLogging args {
+ global debug
+ if { [ send tclLogging get state] } {
+ set debug 1
+ send tclLogging set label "Disable Logging"
+ } else {
+ set debug 0
+ send tclLogging set label "Enable Logging"
+ }
+} ; tclToggleLogging
+send tclLogging addCallback tclToggleLogging
+
+send tclDismiss addCallback "send tclShell unmap"
+
+# Connect the 'textout' parameter so it appends messages from
+# the client to the Tcl text window.
+proc tclLogMessages { param old new } {
+ global debug
+ if {$debug == 1} { send tclEntry append [format "%s\n" $new ] }
+} ; send textout addCallback tclLogMessages
+
+
+################################################################################
+# Warning dialog. This pops up a dialog box with the given warning message.
+################################################################################
+
+proc warnOkay {widget args} {
+ global curpack curtask
+
+ set label [send warnText get label]
+ if {[string match "No*" $label ] == 1} {
+ set topic [send topicEntry get string]
+ set last [string last "." $topic ]
+ send topicEntry set string [ string range $topic 0 [ incr last -1 ] ]
+ }
+ send warning unmap
+}; send warnDismiss addCallback warnOkay
+
+
+# The parameter "alert" is used to forward alerts from the client. The
+# special 'dismiss' value can be used to shut down the alert from the
+# client, the special "pop" value pops the last history elements from the
+# stack (used in case of an error loading a file).
+
+proc setAlert {param old new} {
+ global HPkg HType HUrl HOpt HTask HFile htop hcurrent
+
+ if {$new == "dismiss"} {
+ send warning unmap
+ } elseif {$new == "pop"} {
+ catch {
+ unset HType($hcurrent)
+ unset HOpt($hcurrent)
+ unset HTask($hcurrent)
+ unset HPkg($hcurrent)
+ unset HUrl($hcurrent)
+ unset HFile($hcurrent)
+ }
+ incr hcurrent -1
+ } else {
+ send searchStatus set label ""
+ send warnText set label $new
+ send warning map
+ }
+}; send alert addCallback setAlert
+
+
diff --git a/lib/scr/help.html b/lib/scr/help.html
new file mode 100644
index 00000000..46f584d7
--- /dev/null
+++ b/lib/scr/help.html
@@ -0,0 +1,586 @@
+<HTML>
+<BODY>
+<TITLE>IRAF Help GUI</TITLE>
+<H1>Welcome to IRAF Help GUI V1.0</H1>
+<P>
+<B>Help</B> is a prototype GUI browser providing a familiar and
+easy-to-use interface for the IRAF help system. Other features include
+on-the-fly conversion of help documents to HTML for display and
+fully formatted PostScript for hardcopy.
+<P>
+To begin, select a help topic from the top panel, enter a task or package
+name in the <B>Topic</B> field, or hit the <B>Search</B> button to bring up
+a panel allowing you to search the help system by keyword.
+<P>
+<HR>
+
+<H1>Table of Contents</H1>
+
+<UL>
+<LI> <A HREF="#intro">Introduction</A>
+<LI> <A HREF="#params">Task Parameters</A>
+<LI> <A HREF="#nav">Navigating the IRAF Help System</A>
+<LI> <A HREF="#browse">Browsing a Help Document</A>
+<LI> <A HREF="#search">Searching</A> <UL>
+ <LI> <A HREF="#dbsearch">Searching the Help Database</A> </UL> <UL>
+ <LI> <A HREF="#find">Searching Within a Document</A> </UL>
+<LI> <A HREF="#help">The On-Line Help Panel</A>
+<LI> <A HREF="#homepage">User-Defined Homepages</A>
+<LI> <A HREF="#lfiles">Loading Files</A>
+<LI> <A HREF="#sfiles">Saving Files</A>
+<LI> <A HREF="#out">Hardcopy Output</A>
+<LI> <A HREF="#lroff">LROFF Directive Extensions for HTML</A>
+</UL>
+
+
+<A NAME=intro><HR><h1>Introduction</h1></A>
+The <B>Help GUI</B> task is a front-end to the IRAF
+<A HREF="system.help"><B>help</B></A>
+task which provides on-the-fly conversion of help documents to HTML for
+presentation in the GUI or formatted PostScript for hardcopy.
+Help pages may be loaded on the command line, through use of a
+file browser, or by navigating the help databases using a familiar CL
+package menu scheme. It also features a search capability similar to the
+<A HREF="system.references"><B>references</B></A>
+task and a complete <A HREF=#hist>history mechanism</A>.
+<P>
+When invoked with no command line arguments (and the appropriate
+<A HREF="#l_device">device</A> parameter setting of "gui") the task starts
+as a browser and the user is presented with a GUI that has the toplevel CL
+package menu in the upper navigation window. The main display window below
+will contain any LROFF source file specified in the
+<A HREF="#l_template">template</A>
+parameter or loaded on
+the command line by specifying the
+<A HREF="#l_template">template</A>
+and enabling the
+<A HREF="#l_file_template">file_template</A>
+parameters. If the
+<A HREF="#l_search">search</A>
+parameter is enabled the
+<A HREF="#l_template">template</A>
+is taken to be a search phrase and the database is searched for tasks
+matching the keyword and the GUI will appear with the search panel mapped
+so the user can select the task help to view. When no
+<A HREF="#l_template">template</A>
+is given the main display window will start with the page specified by the
+<A HREF="#l_home">home</A>
+parameter, this can be a user-defined HTML file giving links to specific tasks
+(see below for details) or if
+<A HREF="#l_home">home</A>
+is empty the display will contain the online help for the task.
+<P>
+The first time the task is run, or whenever the help database is updated,
+a quick reference file (specified by the task
+<A HREF="#l_quickref">quickref </A>
+parameter) and package menu file will be created in the user's <I>uparm</I>
+directory to speed up help searching and subsequent startups of the task.
+
+
+<A NAME=params><HR><h1>Task Parameters</h1></A>
+<UL>
+<DL>
+<DT><B><A NAME="l_template">template</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='template' Line='template'>
+<DD>A string listing the modules or packages for which help is desired.
+Each list element may be a simple name or a pattern matching template.
+Abbreviations are permitted. If <I>template</I> is omitted a long format
+menu will be printed for the current package, listing each task (or
+subpackage) and describing briefly what it is.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_file_template">file_template = no</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='file_template' Line='file_template = no'>
+<DD>If this switch is set the template is interpreted as a filename matching
+template, and all help blocks found in the named files are output. The help
+database is not searched, hence manual pages can be printed or documents
+may be formatted without entering the files into a help database.
+In other words, "<TT>help file.hlp fi+</TT>" makes it possible to use <I>help</I> as
+a conventional text formatter.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_all">all = no</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='all' Line='all = no'>
+<DD>Print help for all help modules matching <I>template</I>, rather than only the
+first one found.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_parameter">parameter = "<TT>all</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='parameter' Line='parameter = "all"'>
+<DD>If the value of this parameter is not "<TT>all</TT>", only the help text
+for the given parameter will be printed.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_section">section = "<TT>all</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='section' Line='section = "all"'>
+<DD>If the value of this parameter is not "<TT>all</TT>", only the help text for the
+given section (e.g. "<TT>usage</TT>", "<TT>description</TT>", "<TT>examples</TT>") will be printed.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_option">option = help</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='option' Line='option = help'>
+<DD>The option parameter specifies the type of help desired, chosen from
+the following:
+<DL>
+<DT><B><A NAME="l_help">help</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='help' Line='help'>
+<DD>Print the full help block for the named module.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_source">source</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='source' Line='source'>
+<DD>Print the source code for the module (which often contains additional
+detailed comments).
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_sysdoc">sysdoc</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='sysdoc' Line='sysdoc'>
+<DD>Print the technical system documentation for the named module.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_directory">directory</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='directory' Line='directory'>
+<DD>Print a directory of all help blocks available for the named package.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_alldoc">alldoc</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='alldoc' Line='alldoc'>
+<DD>Print all help blocks in the file containing the help block for
+the named procedure (i.e., both the user and system documentation).
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_files">files</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='files' Line='files'>
+<DD>Print the names of all help files associated with the named modules or
+packages.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_summary">summary</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='summary' Line='summary'>
+<DD>Print only the titles and sizes of help blocks in referenced help files.
+The contents of the blocks are skipped. Titles are printed for <I>all</I>
+help blocks found in the file containing the help block for the named module.
+</DD>
+</DL>
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_page">page = yes</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='page' Line='page = yes'>
+<DD>Pause after every page of output text. Turning this off for large documents
+speeds up output considerably.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_nlpp">nlpp = 59</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='nlpp' Line='nlpp = 59'>
+<DD>The number of lines per page if output is redirected, e.g., to <I>lprint</I>.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_lmargin">lmargin = 1</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='lmargin' Line='lmargin = 1'>
+<DD>Left margin on output.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_rmargin">rmargin = 72</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='rmargin' Line='rmargin = 72'>
+<DD>Right margin on output.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_search">search = no</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='search' Line='search = no'>
+<DD>If enabled the
+<A HREF="#l_template">template</A>
+is interpreted as a search string and the task
+is started with the search panel open with the results of the search. The
+<A HREF="#l_file_template">file_template</A>
+parameter is ignored with search turned on.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_home">home = "<TT></TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='home' Line='home = ""'>
+<DD>The home page for the task. If not set and no
+<A HREF="#l_template">template</A>
+is specified
+the task will start with the online help in the main window, otherwise it
+may be set to a filename to be displayed when the task starts. This file
+may contain a text help block which will be formatted before display, or
+it may be a valid HTML file. See below for a description of the format of
+a homepage file which provides links to tasks.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_printer">printer = "<TT>printer</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='printer' Line='printer = "printer"'>
+<DD>Default hardcopy printer name. If the <I>value</I> of the parameter is the
+reserved string "<TT>printer</TT>", the actual device is the value of the CL
+environment variable <I>printer</I>.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_showtype">showtype = no</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='showtype' Line='showtype = no'>
+<DD>Add task-type suffix in package menus?
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_quickref">quickref = "<TT>uparm$quick.ref</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='quickref' Line='quickref = "uparm$quick.ref"'>
+<DD>Name of the quick-reference file used for searching. This file is created
+the first time the task is run in GUI mode or whenever it doesn't exist,
+or when any help database file has been updated.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_uifname">uifname = "<TT>lib$scr/help.gui</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='uifname' Line='uifname = "lib$scr/help.gui"'>
+<DD>The user interface file. This file is what defines the look and behavior
+of all the graphical user interface elements. Experts may create variants
+of this file.
+</DD>
+</DL>
+<P>
+<DL>
+<DT><B><A NAME="l_helpdb">helpdb = "<TT>helpdb</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='helpdb' Line='helpdb = "helpdb"'>
+<DD>The filename of the help database to be searched. If the <I>value</I> of the
+parameter is the reserved string "<TT>helpdb</TT>", the actual filename is the value
+of the CL environment variable <I>helpdb</I>.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_device">device = "<TT>terminal</TT>"</A></B></DT>
+<! Sec='PARAMETERS' Level=0 Label='device' Line='device = "terminal"'>
+<DD>Output device if the standard output is not redirected. Allowable values
+include:
+<DL>
+<DT><B><A NAME="l_terminal">terminal</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='terminal' Line='terminal'>
+<DD>If the <I>value</I> of
+the parameter is the reserved string "<TT>terminal</TT>", the actual device name is
+the value of the CL environment variable <I>terminal</I>.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_text">text</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='text' Line='text'>
+<DD>Output the formatted help page as plain text.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_gui">gui</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='gui' Line='gui'>
+<DD>Invoke the GUI for browsing the help system. This option will only work if
+the <I>stdgraph</I> environment variable is set the <I>xgterm</I>, and the
+user is running IRAF from an <I>XGterm</I> window.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_html">html</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='html' Line='html'>
+<DD>Output the formatted help page as HTML text.
+</DD>
+</DL>
+<DL>
+<DT><B><A NAME="l_ps">ps (or postscript)</A></B></DT>
+<! Sec='PARAMETERS' Level=1 Label='ps' Line='ps (or postscript)'>
+<DD>Output the formatted help page as postscript.
+</DD>
+</DL>
+</DD>
+</DL>
+</UL>
+
+<A NAME=nav><HR><h1>Navigating the IRAF Help System</h1></A>
+
+ When run as a browser, <I>Help</I> works very much like any WWW browser.
+The top panel is a list widget that will always contain a CL package listing,
+at startup this will be the toplevel <I>"Home"</I> package menu one would see
+when first logging into the CL containing the core system packages, NOAO
+package, and any site-specific external package, or in the case of starting
+with a specific task it will be the parent package for the task.
+Additionally, system documents for the <A HREF="os"><B>os</B></A>
+HSI routines and the <A HREF="sys.imfort"><B>imfort</B></A> and
+<A HREF="math"><B>math</B></A>
+interfaces will be available in the <I>Home</I> package although
+these are programmatic interfaces and not tasks which can be executed.
+<P>
+New packages or task help pages are loaded by selecting an item from the
+package menu list using the left mouse button. If the requested item is a
+package, the menu listing will change as though the package were loaded in
+the CL, and the help display panel will contain a listing of the package
+tasks with a one-line description for each task such as would be seen with
+a <I>"help &lt;package&gt;"</I> command using the standard task. New items
+may then be selected using either the menu list or links in the display
+panel. If the item is a task, the help page for the task will appear in the
+display panel. In either case new pages may be selected from the menu listing.
+<P>
+Specific help documents may also be requested by entering the task/package
+name in the <B>Topic</B> text widget above the menu list. As when selecting
+from the package menu list, items selected this way will cause the menu
+list to change to the package menu for the parent package if the item is a
+task (displaying the help page in the display panel) or the package menu
+if the item is a package (displaying the one-liner package listing in the
+display panel).
+<P>
+Using the <B>Back</B> button will revert to the previous page in the history
+list which will either be the previously loaded package or help page.
+Similarly, selecting the <B>Forward</B> button will move the next page further
+down in the history list, either button will become insensitive when the
+end of the list on either end is reached. Selecting the <B>Up</B> button will
+cause the browser to immediately jump up the previous package, skipping
+over any help pages that were loaded in between. The <B>Home</B> button will
+cause the default homepage (either the user-defined page if specified by the
+task <I>home</I> parameter or the online help) to be displayed. Browsing
+in this way can also be done using the navigation menu created by hitting
+the right mouse button while in the main display panel.
+<P>
+Users can also jump to specific pages in the history list using the
+<B>History</B> button on the main menubar. The right column of the menu
+will indicate whether the item is a task, package, internal link or a text
+file. The history list is truncated at about 40 entries in the menu but
+the user may work back incrementally by selecting the last item of the
+menu, after which the History button will display the previous 40 entries.
+The history list may be cleared except for the current page by selecting
+the <I>Clear History</I> menu item.
+
+
+<A NAME=browse><HR><h1>Browsing a Help Document</h1></A>
+Once a help page is loaded the middle menubar above the display panel
+will change to activate widgets based on the position within the history
+list and options available for a particular page. The left-most group
+of buttons are the standard navigation buttons described above.
+The middle group of buttons contains the <B>Sections</B> and
+<B>Parameters</B> buttons which are used to browse within a help document.
+The <I>Sections</I> button is a menu listing all of the sections found
+within a help page, allowing the user to jump to a specific section
+rather than scrolling through the entire document. The <I>Sections</I>
+menu is also available using the middle mouse button from the
+main display area. The <I>Parameters</I> button is similarly a menu
+listing of all task parameter help sections found within the document.
+Both or either of these buttons will become insensitive when no section
+or parameter information is found in the document.
+<P>
+The right-most group of buttons represent the various help options available
+for each page. The default is to get the task help, however help pages
+may have an associated <B>source</B> file or <B>sysdoc</B> (e.g. if the task
+is a CL script there may be a pointer to the script source itself, or a package
+may have a general overview document listed as the system document). Once
+a help page is loaded these buttons will change become sensitive if that option
+is available, simply select the button to view the option. Selecting the
+<B>Files</B> button will bring up a panel listing all the files associated
+with a particular help topic. When a help topic is selected and an option is
+defined but the file does not exist, the options button will display a yellow
+diamond icon even if the button is insensitive, a green icon indicates the
+currently selected option. This feature may be disabled by selecting the
+"<TT>Show missing files</TT>" item from the main menubar <B>Options</B> menu.
+
+
+<A NAME=search><HR><h1>Searching</h1></A>
+<A NAME=dbsearch><h1>Searching the Help Database</h1></A>
+Searching the help database is done by selecting the <B>Search</B> button
+from the main menubar to bring up the search panel. Users may then enter
+one or more keywords into the <B>Topic</B> field at the bottom of the panel
+and initiate the search with either a carriage return or hitting the
+<I>Search</I> button just beside it. The panel will then show a list of all
+tasks and packages which match the search phrase along with a one-line
+description of the task. Help pages may be displayed by selecting either the
+task or package link with the left mouse button, in both case the package
+menu list on the main help window will be updated to list the package
+contents allowing other tasks from that package to be selected in the normal
+way.
+<P>
+By default the exact phrase entered in the topic window will be used for the
+search. This can be relaxed by toggling the "<TT>Require exact match</TT>"
+button
+at the top of the panel. For example, to search for all tasks matching
+<I>either</I> the keyword "<TT>flat</TT>" or "<TT>field</TT>" turn off the
+exact match
+toggle and the search will return not only tasks matching "<TT>flat
+field</TT>"
+but also any task description containing only one of the words such as the
+VELVECT task which plots velocity <I>field</I>s.
+<P>
+<A NAME=find><h1>Searching Within a Document</h1></A>
+Within a help document itself one can search for a string by selecting
+the <B>Find</B> button from the main menubar to bring up a panel used to
+enter the search string. When the text is entered the main display
+window will reposition itself and highlight the text found within the
+document. Searches can be repeated and will wrap around the document
+automatically, searches can be done either forward or backward through
+the text and may be case insensitive.
+
+
+<A NAME=help><HR><h1>The On-Line Help Panel</h1></A>
+The help panel permits the user to view the on-line help document while
+XHELP is running. The help panel can be activated by pressing the
+help command button in any panel or by selecting the "Help ..." item from
+the main <B>File</B> menu. The help panel consists of the the help command
+button bar and the help display window which are described below.
+<p>
+<dl>
+<dt><b>The Help Command Button Bar</b>
+<dd>The command button bar contains the following command buttons.
+<p>
+
+<dl>
+<dt><b>The Back Command Button</b>
+<dd>Pressing the Back command button moves backwards through the
+previously visited links.
+<p>
+<dt><b>The Forward Button</b>
+<dd>Pressing the Forward command button moves forward through the
+list of visited links.
+<p>
+<dt><b>The Home Button</b>
+<dd>Pressing the Home command button sets the help display window to
+the top of the help document.
+<p>
+<dt><b>The Dismiss Button</b>
+<dd>Pressing the Dismiss command button deactivates the help panel.
+<p>
+</dl>
+</dl>
+
+The bottom of the help panel contains a text search entry widget allowing
+for text searches of the documentation along with options for searching
+in a forward or backward direction, and case sensitivity. When a search
+phrase is entered the help document will be repositioned to the next
+occcurrance of the search string if found, otherwise a dialog box will
+appear to say the string was not found. Searches will wrap around the
+document automatically.
+
+
+<A NAME=homepage><HR><h1>User-Defined Homepages</h1></A>
+By default <I>Xhelp</I> will start with the online help page displayed in the
+main help window. The user can change this by setting the task <B>home</B>
+parameter to be a path to any valid file. This file may be plain text, a
+help document in LROFF format which will be converted to HTML for display,
+or a native HTML document.
+<P>
+HTML files may contain URLs of the form
+<UL>
+<PRE>
+<B>&lt;a href=</B><I>[package.]task</I><B>&gt;</B><I>url_text</I><B>&lt;/a&gt;
+</PRE>
+</UL>
+<P>
+where </B><I>url_text</I> is the text to appear in the window and the URL
+itself
+consists of an optional package and task name delimited by a period. For
+example, to create a link to the
+<A HREF="onedspec.splot"><B>splot</B></A>
+task in a document one would use the URL
+<UL>
+<PRE>
+<TT>&lt;a href=onedspec.splot&gt;splot&lt;/a&gt;</TT>
+</PRE>
+</UL>
+<P>
+In this way users can create a homepage which serves as a <I>"bookmark"</I>
+file or index of shortcuts to the most commonly accessed help pages.
+
+
+<A NAME=lfiles><HR><h1>Loading Files</h1></A>
+Text files may be loaded on the command line when starting the task by
+specifying the filename and setting the
+<A HREF=#l_file_template>file_template</A> task parameter. The named file
+will be searched for a <I>.help</I> LROFF directing indicating it contains
+a help block that will be converted to HTML for display. If no help
+block is found the file will be displayed as-is, meaning existing
+HTML documents can be loaded and will be formatted correctly.
+
+Once the task is running users may load a file by selecting the <B>Open
+File...</B> menu item from the main menubar <B>File</B> menu or the
+right-mouse-button menu from within the main display area. This will
+open a file browser allowing users to change directories by using the
+navigation buttons at the top of the panel, or selecting items from the
+leftmost directory listing. Selecting a file on the rightmost list will
+cause it to be loaded and automatically formatted if it contains a help
+block. The file list may be filtered to select only those files matching
+a particular template by changing the <B>Filter</B> box at the top of
+the panel. Filenames or directories may be entered directly using the
+<B>Selection</B> box at the bottom of the panel.
+
+
+<A NAME=sfiles><HR><h1>Saving Files</h1></A>
+Once a file has been loaded in the browser it may be saved to disk as
+either <I>source</I> (i.e. the original LROFF file if that was converted
+for the display, or whatever file is currently displayed regardless of
+format), <I>text</I> to save formatted plain text such as that produced
+by the standard <B>help</B> task, <I>HTML</I> to save the converted HTML
+used in the display, or <I>PostScript</I> to save formatted PostScript of
+the document such as that sent to the printer using the <B>Print</B>
+button. Not all options will be available depending on the format of the
+input text, unavailable options will be insensitive in the GUI.
+
+The <B>Save</B> panel is opened by selecting the <B>Save As...</B> menu
+item from the main menubar <B>File</B> menu or the right-mouse-button
+menu from within the main display area. The file browser operates the
+same as when loading images, the only difference is that file selection
+simply defines the filename to be used and does not cause the save to
+occur automatically. Users can overwrite existing files by selecting the
+<I>Options</I> toggle at the bottom of the panel.
+
+
+<A NAME=out><HR><h1>Hardcopy Output</h1></A>
+Help pages may be output to any configured iraf printer by selecting the
+main menubar <B>Print</B> button to bring up the print panel. Task help
+pages will be converted to formatted PostScript and may be sent to either a
+printer or saved to disk depending on the selection made in the printer
+panel. If the printer name is set to the special value <I>"printer"</I> then
+the device named by the CL <I>printer</I> environment variable will be used.
+When saving to disk files the default action is to save to a filename whose
+name is the task name plus a "<TT>.ps</TT>" extension. Either of these are
+changeable within the GUI as is the default page size to be used when
+generating the PostScript.
+<P>
+The main menubar <B>File</B> button can also be used to bring up the file
+browser in order to save the current document to disk. Help pages may be
+saved as either the origin LROFF source for the file, formatted text as you
+would get from the standard help task, HTML as is displayed in the GUI, or
+formatted PostScript. The choice of formats is dictated by the type of file
+being displayed (e.g. you cannot save PostScript of a program source).
+
+<HR>
+<A NAME=lroff><h1>LROFF Extensions for HTML</h1></A>
+To better support HTML links within documents and to other help pages two
+new directives have been added to the LROFF text formatter. These are
+<B>.hr</B> to specify a link (an HTML <I>HREF</I> directive) and <B>.hn</B>
+to specify a name (an HTML <I>NAME</I> directive). The syntax for these are
+as follows:
+<PRE>
+ <B>.hn</B><I> &lt;name&gt;</I>
+ <B>.hr</B><I> &lt;link&gt; &lt;text&gt; </I>
+</PRE>
+<P>
+where <I>&lt;name&gt;</I> is the destination name of an internal link,
+<I>&lt;link&gt;</I>
+is the URL of the link to be created, and <I>&lt;text&gt;</I> is the text to
+be displayed in the HTML. The URL syntax is either a <TT>'#'</TT> character
+followed
+by a destination name, a simple <I>task</I> name or <I>package</I> name,
+or a <I>package.task</I> pair giving a more precise task. For internal links
+the current document is repositioned so the name is at the top of the display,
+for task help links new help pages will be loaded in the browser.
+<P>
+These directives are ignored when converting the LROFF to either formatted
+plain text or PostScript.
+
+</BODY>
+</HTML>
diff --git a/lib/scr/imedit.key b/lib/scr/imedit.key
new file mode 100644
index 00000000..1c1b7fa5
--- /dev/null
+++ b/lib/scr/imedit.key
@@ -0,0 +1,82 @@
+ IMEDIT CURSOR KEYSTROKE COMMANDS
+
+ ? Print help
+ : Colon commands (see below)
+ <space> Statistics
+ g Surface graph
+ i Initialize (start over without saving changes)
+ q Quit and save changes
+ p Print box of pixel values and statistics
+ r Redraw image display
+ s Surface plot at cursor
+ t Toggle between minimum and maximum search
+ + Increase radius by one
+ - Decrease radius by one
+ I Interrupt task immediately
+ Q Quit without saving changes
+
+The following editing options are available. Rectangular and line regions
+are specified with two positions and aperture regions are specified by
+one position. The current aperture type (circular or square) is used
+in the latter case. The move option takes two positions, the position
+to move from and the position to move to.
+
+ a Background replacement (rectangle)
+ b Background replacement (aperture)
+ c Column interpolation (rectangle)
+ d Constant value substitution (rectangle)
+ e Constant value substitution (aperture)
+ f Interpolation across line (line)
+ j Replace with input data (rectangle)
+ k Replace with input data (aperture)
+ l Line interpolation (rectangle)
+ m Copy by replacement (aperture)
+ n Copy by addition (aperture)
+ u Undo last change (see also 'i', 'j', and 'k')
+ v Constant value substitution (vector)
+ = Constant value substitution of pixels equal
+ to pixel at the cursor position
+ < Constant value substitution of pixels less than or equal
+ to pixel at the cursor position
+ > Constant value substitution of pixels greater than or equal
+ to pixel at the cursor position
+
+When the image display provides a fill option then the effect of zoom
+and roam is provided by loading image sections. This is a temporary
+mechanism which will eventually be replaced by a more sophisticated
+image display interface.
+
+ E Exapnd image display
+ P Pan image display
+ R Redraw image display
+ Z Zoom image display
+ 0 Redraw image display with no zoom
+ 1-9 Shift display
+
+
+ IMEDIT COLON COMMANDS
+
+The colon either print the current value of a parameter when there is
+no value or set the parameter to the specified value.
+
+angh [value] Horizontal viewing angle (degrees) for surface plots
+angv [value] Vertical viewing angle (degrees) for surface plots
+aperture [type] Aperture type (circular|square)
+autodisplay [yes|no] Automatic image display?
+autosurface [yes|no] Automatic surface plots?
+buffer [value] Background buffer width
+command [string] Display command
+display [yes|no] Display image?
+eparam Edit parameters
+graphics [device] Graphics device
+input [image] New input image to edit (output is same as input)
+output [image] New output image name
+radius [value] Aperture radius
+search [value] Search radius
+sigma [value] Noise sigma (INDEF for histrogram replacement)
+value [value] Constant substitution value
+width [value] Background annulus width
+write [name] Write changes to name (default current output name)
+xorder [value] X order for background fitting
+yorder [value] Y order for background fitting
+
diff --git a/lib/scr/imexamine.key b/lib/scr/imexamine.key
new file mode 100644
index 00000000..03ad7643
--- /dev/null
+++ b/lib/scr/imexamine.key
@@ -0,0 +1,165 @@
+ -- IMEXAMINE COMMANDS --
+
+ CURSOR KEY COMMAND SUMMARY
+
+? Help h Histogram p Previous frame x Coordinates
+a Aperture Sum i Image cursor q Quit y Set origin
+b Box coords j Line gauss fit r Radial plot z Print grid
+c Column plot k Col gauss fit s Surface plot , Quick phot
+d Load display l Line plot t Output image . Quick prof fit
+e Contour plot m Statistics u Vector plot
+f Redraw n Next frame v Vector plot
+g Graphics cursor o Overplot w Toggle logfile
+
+
+ COLON COMMAND SUMMARY
+
+allframes ceiling iterations naverage pointmode width
+angh center label nbins radius x
+angv constant logfile ncolumns round xformat
+autoredraw dashpat logx ncontours rplot xlabel
+autoscale defkey logy ncoutput select xorder
+background eparam magzero ncstat szmarker y
+banner fill majrx nhi ticklabel yformat
+beta fitplot majry nlines title ylabel
+boundary fittype marker nloutput top_closed yorder
+box floor minrx nlstat unlearn z1,z2
+buffer interval minry output wcs zero
+
+
+ OUTPUT OF 'a' AND 'r' KEYS
+
+The 'a' key and logfile output has column labels and each object has one
+line of measurements in the logfile and two lines on the terminal. The 'r'
+key shows only the second line on the status line and the information from
+the first line is in the graph title. The first line contains the x and y
+center coordinates and optional world coordinates. The second line
+contains the aperture magnitude and flux, the estimated background sky, the
+profile fit peak, the ellipticity and position angle from the moment
+analysis, and four estimates of the profile width. The four estimates are
+from the moment analysis, the full-width enclosing half the flux, the
+profile fit, and a direct estimate of the full width at half-maximum.
+
+
+ CURSOR KEY COMMANDS
+
+? Print help
+a Aperture radial photometry measurement (see above for output)
+b Box coordinates for two cursor positions - c1 c2 l1 l2
+c Column plot
+d Load the image display
+e Contour plot
+f Redraw the last graph
+g Graphics cursor
+h Histogram plot
+i Image cursor
+j Fit 1D gaussian to image lines
+k Fit 1D gaussian to image columns
+l Line plot
+m Statistics
+ image[section] npixels mean median stddev min max
+n Next frame or image
+o Overplot
+p Previous frame or image
+q Quit
+r Radial profile plot (see above for output)
+s Surface plot
+t Output image centered on cursor (parameters output, ncoutput, nloutput)
+u Centered vector plot from two cursor positions
+v Vector plot between two cursor positions
+w Toggle write to logfile
+x Print coordinates
+ col line pixval [xorign yorigin dx dy r theta]
+y Set origin for relative positions
+z Print grid of pixel values - 10 x 10 grid
+, Quick profile photometry measurement (Gaussian or Moffat)
+. Quick radial profile plot and fit (Gaussian or Moffat)
+
+ COLON COMMANDS
+
+Explicit image coordinates may be entered using the colon command syntax:
+
+ :column line key
+
+where column and line are the image coordinates and the key is one
+of the cursor keys. A special syntax for line or column plots is also
+available as :c# or :l# where # is a column or line and no space is
+allowed.
+
+Other colon commands set or show parameters governing the plots and other
+features of the task. Each graph type has it's own set of parameters.
+When a parameter applies to more than one graph the current graph is assumed.
+If the current graph is not applicable then a warning is given. The
+"eparam" and "unlearn" commands may be used to change many parameters and
+without an argument the current graph parameters are modified while with
+the graph key as an argument the appropriate parameter set is modified.
+In the list below the graph key(s) to which a parameter applies are shown.
+
+allframes Cycle through all display frames to display images
+angh s Horizontal angle for surface plot
+angv s Vertical angle for surface plot
+autoredraw cehlrsuv. Automatically redraw graph after colon command?
+autoscale h Adjust number of histogram bins to avoid aliasing
+axes s Draw axes in surface plot?
+background jkr. Subtract background for radial plot and photometry?
+banner cehjklrsuv. Include standard banner on plots?
+beta ar Moffat beta parameter (INDEF to fit or value to fix)
+boundary uv Boundary extension type for vector plots
+box cehjklruv. Draw box around graph?
+buffer r. Buffer distance for background subtraction
+ceiling es Data ceiling for contour and surface plots
+center jkr. Find center for radial plot and photometry?
+constant uv Constant value for boundry extension in vector plots
+dashpat e Dash pattern for contour plot
+eparam cehjklrsuv. Edit parameters
+fill e Fill viewport vs enforce unity aspect ratio?
+fitplot r Overplot profile fit on data?
+fittype ar Profile fitting type (gaussian|moffat)
+floor es Data floor for contour and surface plots
+interval e Contour interval (0 for default)
+iterations ar Iterations on fitting radius
+label e Draw axis labels for contour plot?
+logfile Log file name
+logx chjklruv. Plot x axis logrithmically?
+logy chjklruv. Plot y axis logrithmically?
+magzero r. Magnitude zero for photometry
+majrx cehjklruv. Number of major tick marks on x axis
+majry cehjklruv. Number of major tick marks on y axis
+marker chjklruv. Marker type for graph
+minrx cehjklruv. Number of minor tick marks on x axis
+minry cehjklruv. Number of minor tick marks on y axis
+naverage cjkluv Number of columns, lines, vectors to average
+nbins h Number of histogram bins
+ncolumns ehs Number of columns in contour, histogram, or surface plot
+ncontours e Number of contours (0 for default)
+ncoutput Number of columns in output image
+ncstat Number of columns in statistics box
+nhi e hi/low marking option for contours
+nlines ehs Number of lines in contour, histogram, or surface plot
+nloutput Number of lines in output image
+nlstat Number of lines in statistics box
+output Output image root name
+pointmode chjkluv Plot points instead of lines?
+radius r. Radius of object aperture for radial plot and photmetry
+round cehjklruv. Round axes to nice values?
+rplot jkr. Radius to plot in 1D and radial profile plots
+select Select image or display frame
+sigma jk Initial sigma for 1D gaussian fits
+szmarker chjklruv. Size of marks for point mode
+ticklabels cehjklruv. Label ticks?
+title cehjklrsuv. Optional title for graph
+top_closed h Close last bin of histogram
+unlearn cehjklrsuv. Unlearn parameters to default values
+wcs World coordinate system for axis labels and readback
+width jkr. Width of background region
+x [min max] chjklruv. Range of x to be plotted (no values for autoscaling)
+xformat Coordinate format for column world coordinates
+xlabel cehjklrsuv. Optional label for x axis
+xorder jkr. X order of surface for background subtraction
+y [min max] chjklruv. Range of y to be plotted (no values for autoscaling)
+yformat Coordinate format for line world coordinates
+ylabel cehjklrsuv. Optional label for y axis
+yorder r. Y order of surface for background subtraction
+z1 h Lower intensity value limit of histogram
+z2 h Upper intensity value limit of histogram
+zero e Zero level for contour plot
diff --git a/lib/scr/implot.key b/lib/scr/implot.key
new file mode 100644
index 00000000..68ce6d5e
--- /dev/null
+++ b/lib/scr/implot.key
@@ -0,0 +1,32 @@
+Implot Command Summary:
+
+ a mark a range of lines or columns to be averaged
+ c plot a column
+ e expand plot by marking corners of viewport
+ j move down without clearing and rescaling
+ k move up without clearing and rescaling
+ l plot a line
+ m go to the previous image in the input list
+ n go to the next image in the input list
+ o overplot next vector
+ p measure profile (mark region and background with 2 pos)
+ q quit
+ r redraw
+ s print statistics on a region
+ / scroll status line
+ <space> print coordinates and data value
+
+ :a N set number of lines or columns to be averaged
+ :c M [N] plot column[s] M [to N]
+ :f format label format (%f %h %m %H %M)
+ :i image open a different image
+ :o overplot next vector
+ :l M [N] plot line[s] M [to N]
+ :log+, log- enable, disable log scaling in Y
+ :nxticks number of tick marks on X axis
+ :nyticks number of tick marks on Y axis
+ :solid use only solid linetypes when overplotting
+ :step N set step size for j,k
+ :w wcstype set wcs type (logical|physical|world)
+ :x x1 x2 fix plotting range in X (call with no args to unfix)
+ :y y1 y2 fix plotting range in Y (call with no args to unfix)
diff --git a/lib/scr/inlgfit.key b/lib/scr/inlgfit.key
new file mode 100644
index 00000000..c01f9a9d
--- /dev/null
+++ b/lib/scr/inlgfit.key
@@ -0,0 +1,77 @@
+1. INTERACTIVE NONLINEAR LEAST SQUARES FITTING CURSOR OPTIONS
+
+? Print options
+c Print coordinates and fit of point nearest the cursor
+d Delete point nearest the cursor
+f Do the fit and redraw or overplot the graph
+g Redefine graph keys. The following data types may be along
+ either axis.
+ function Dependent variable, or function
+ fit Fitted value
+ residuals Residuals (function - fit)
+ ratio Ratio (function / fit)
+ nonlinear Nonlinear component of function
+ var n Independent variable number "n"
+ identifier Independent variable "identifier" (if defined)
+ user n User defined plot function (if defined)
+h-l Graph keys. The defaults are the following.
+ h=(function, fit)
+ i=(function, residual)
+ j=(function, ratio)
+ k=(var 1, residual)
+ l=(user 1, user 2)
+o Overplot the next graph
+q Exit interactive curve fitting
+r Redraw graph
+t Overplot fit
+u Undelete the deleted point nearest the cursor
+w Set graph window.
+ For help type 'w' followed by '?' after the prompt.
+I Interrupt task immediately
+
+
+2. INTERACTIVE NONLINEAR LEAST SQUARES FITTING COLON COMMANDS
+
+The parameters are listed or set with the following commands which may be
+abbreviated. To list the value of a parameter type the command alone.
+
+:show [file] Print the values of the task fitting parameters
+:variables [file] Print the variable names, min and max values
+:data [file] Print the values of all the variables
+:errors [file] Print an error analysis of the fit
+:results [file] Print the results of the fit
+:vshow [file] Print an error analysis and results of the fit
+:page file Page through a file
+:const [param] [value] Change parameter to constant parameter
+:fit [param] [value] Change parameter to fitting parameter
+:tolerance [value] Show/set the convergence criteria
+:maxiter [value] Show/set the maximum number of fitting iterations
+:nreject [value] Show/set the maximum number of rejection iterations
+:low_reject [value] Show/set the low rejection threshold
+:high_reject [value] Show/set the high rejection threshold
+:grow [value] Show/set the rejection growing radius
+
+Additional commands are available for setting graph formats and manipulating
+the graphics. Use the following commands for help.
+
+:/help Print help for graph formatting option
+:.help Print help for general graphics options
+
+
+3. INTERACTIVE NONLINEAR LEAST SQUARES FITTING GRAPH KEYS
+
+The graph keys are h, i, j, k, and l. The graph keys may be redefined to
+put any combination of axes types along either graph axis with the 'g' key.
+To define a graph key select the desired key to redefine and then specify
+the axes types for the horizontal and vertical axes by a pair of comma
+separated types from the following (they may be abreviated up to three
+characters, except for 'identifier'):
+
+function Dependent variable
+fit Fitted value
+ratio Ratio (function / fit)
+residuuals Residuals of fit (function - fit)
+nonlinear Nonlinear part of data (linear component of fit subtracted)
+var [n] Indepedent variable number "n"
+user [n] User defined plot equation "n" (if defined)
+identifier Independent variable named "identifier" (if defined)
diff --git a/lib/scr/tvmark.key b/lib/scr/tvmark.key
new file mode 100644
index 00000000..9fc94e62
--- /dev/null
+++ b/lib/scr/tvmark.key
@@ -0,0 +1,54 @@
+ Interactive TVMARK Keystroke/Colon Commands
+
+The following keystroke commands are available.
+
+ + Mark the cursor position with +
+ x Mark the cursor position with x
+ . Mark the cursor position with a dot
+ c Draw defined concentric circles around the cursor position
+ r Draw defined concentric rectangles around the cursor position
+ s Draw line segments, 2 keystrokes
+ v Draw a circle, 2 keystrokes
+ b Draw a rectangle, 2 keystrokes
+ f Draw a filled rectangle, 2 keystrokes
+ e Mark region to be erased and restored, 2 keystrokes
+
+ - Move to previous object in the coordinate list
+ m Move to next object in the coordinate list
+ p Mark the previous object in the coordinate list
+ n Mark next object in the coordinate list
+ l Mark all the objects in the coordinate list
+ o Rewind the coordinate list
+ a Append object at cursor position to coordinate list and mark
+ d Delete object nearest cursor position from coordinate list and
+ mark
+
+ k Keep last cursor command
+ q Exit cursor loop
+
+The following colon commands are available.
+
+ :show List the tvmark parameters
+ :move N Move to Nth object in coordinate list
+ :next N M Mark objects N to M in coordinate list
+ :text [string] Write text at the cursor position
+ :save Save the current contents of frame buffer
+ :restore Restore last saved frame buffer
+ :write [imagename] Write the contents of frame buffer to an image
+
+The following parameters can be shown or set with colon commands.
+
+ :frame [number]
+ :outimage [imagename]
+ :coords [filename]
+ :logfile [filename]
+ :autolog [yes/no]
+ :mark [point|line|circle|rectangle|cross|plus]
+ :radii [r1,...,rN]
+ :lengths [l1,...,lN] [width/length ratio]
+ :font [raster]
+ :color [number]
+ :label [yes/no]
+ :number [yes/no]
+ :txsize [1,2,..]
+ :pointsize [1,3,5...]
diff --git a/lib/scr/wcsedit.key b/lib/scr/wcsedit.key
new file mode 100644
index 00000000..61d98ceb
--- /dev/null
+++ b/lib/scr/wcsedit.key
@@ -0,0 +1,24 @@
+ WCSEDIT COMMANDS
+
+ BASIC COMMANDS
+
+
+? Print the WCSEDIT commands
+show Print out the current WCS
+update Quit WCSEDIT and update the image WCS
+quit Quit WCSEDIT without updating the image wcs
+
+
+ PARAMETER DISPLAY AND EDITING COMMANDS
+
+crval [value axes1] Show/set the FITS crval parameter(s)
+crpix [value axes1] Show/set the FITS crpix parameter(s)
+cd [value axes1 [axes2]] Show/set the FITS cd parameter(s)
+ltv [value axes1] Show/set the IRAF ltv parameter(s)
+ltm [value axes1 [axes2]] Show/set the IRAF ltm parameter(s)
+wtype [value axes1] Show/set the FITS/IRAF axes transform(s)
+axtype [value axes1] Show/set the FITS/IRAF axis type(s)
+units [value axes1] Show/set the IRAF axes units(s)
+label [value axes1] Show/set the IRAF axes label(s)
+format [value axes1] Show/set the IRAF axes coordinate format(s)
+
diff --git a/lib/scr/xgterm.gui b/lib/scr/xgterm.gui
new file mode 100644
index 00000000..1aae673c
--- /dev/null
+++ b/lib/scr/xgterm.gui
@@ -0,0 +1,14 @@
+# XGTERM.GUI -- Default GUI for Xgterm, providing a standard graphics terminal
+# emulation.
+
+reset-server
+appInitialize irafterm IRAFterm {
+ IRAFterm.objects: toplevel Gterm gterm
+ *allowShellResize: true
+ *gterm.warpCursor: true
+ *gterm.raiseWindow: true
+ *gterm.deiconifyWindow: true
+}
+createObjects
+send gterm setGterm
+activate
diff --git a/lib/scr/xxgterm.gui b/lib/scr/xxgterm.gui
new file mode 100644
index 00000000..585a834a
--- /dev/null
+++ b/lib/scr/xxgterm.gui
@@ -0,0 +1,1523 @@
+# XGTERM.GUI -- Default XGterm GUI with message panel for trapping debug
+# output, or executing Tcl commands.
+
+# Reset the Widget Server. Must be the first command so we restart correctly.
+reset-server
+
+# Set the widgets and resources to be used in the base GUI.
+set UIObjects(Xgterm) { \
+ toplevel Layout xgLayout\
+ xgLayout Frame xgUBFrame\
+ xgUBFrame Layout ugUserbar\
+ xgLayout Group gtermGroup\
+ xgLayout Layout xgConfigBar\
+ gtermGroup Gterm gterm\
+\
+ xgConfigBar TextToggle xgAltGraph\
+ xgConfigBar Toggle cfgGcur\
+ xgConfigBar Toggle cfgTask0\
+ xgConfigBar Toggle cfgTask1\
+ xgConfigBar Toggle cfgTask2\
+ xgConfigBar Toggle cfgTask3\
+ xgConfigBar Toggle cfgTask4\
+ xgConfigBar Toggle cfgTask5\
+ xgConfigBar Toggle cfgTask6\
+ xgConfigBar Toggle cfgTask7\
+ xgConfigBar Toggle cfgTask8\
+ xgConfigBar Toggle cfgTask9\
+ xgConfigBar Command cfgClose\
+\
+ toplevel TopLevelShell altGraph\
+ altGraph Layout agLayout\
+ agLayout Layout agUserbar\
+ agLayout Group agGraphGroup\
+ agGraphGroup Gterm agGterm\
+\
+ toplevel Parameter xgterm\
+ xgterm Parameter configure\
+ xgterm Parameter textout\
+}
+
+
+set UIResources(Xgterm) { \
+
+ !#######################################################
+ ! Define some global resources for the main menu panels.
+ !#######################################################
+ *beNiceToColormap: false
+ *allowShellResize: true
+
+ *background: gray80
+ *Text*background: gray75
+ *Command.background: gray80
+ *Label.background: gray80
+ *MenuButton.background: gray80
+ *Toggle.background: gray80
+
+ *Command.foreground: black
+ *Label.foreground: black
+ *MenuButton.foreground: black
+ *Toggle.foreground: black
+ *SimpleMenu*foreground: black
+
+ *Gterm.width: 640
+ *Gterm.height: 480
+
+ *Command.highlightThickness: 2
+ *Label.highlightThickness: 0
+ *MenuButton.highlightThickness: 2
+ *Toggle.highlightThickness: 2
+
+ *Label.borderWidth: 0
+ *Label.shadowWidth: 0
+ *Command.shadowWidth: 1
+ *Toggle.shadowWidth: 1
+ *MenuButton.shadowWidth: 1
+
+ *Arrow.width: 16
+ *Arrow.height: 25
+ *Arrow.foreground: gray70
+ *Arrow.background: gray80
+
+ *TextToggle.frameType: chiseled
+ *TextToggle.frameWidth: 2
+ *TextToggle.onIcon: square1s
+ *TextToggle.offIcon: square0s
+
+ *SmeBSB.leftMargin: 10
+
+ *Group.shrinkToFit: True
+
+ !------------------------------------------------------------
+ ! Define resources to take advantage of the 3D scrollbar look
+ !------------------------------------------------------------
+ *Scrollbar*background: gray80
+ *Scrollbar*width: 15
+ *Scrollbar*height: 15
+ *Scrollbar*shadowWidth: 2
+ *Scrollbar*cursorName: top_left_arrow
+ *Scrollbar*pushThumb: true
+
+ !-------------------------------------
+ ! Define new fonts to use for the GUI.
+ !-------------------------------------
+ *font: 7x13bold
+ *Command.font: 7x13bold
+ *MenuButton.font: 7x13bold
+ *Toggle.font: 7x13bold
+ *Label.font: 7x13bold
+ *TextToggle.font: 7x13bold
+ *SimpleMenu*font: 7x13bold
+
+
+ !###############################
+ ! Define the main Xgterm window.
+ !###############################
+ *Xgterm.title: XGterm UberGUI
+ *Xgterm.geometry: +0+0
+ *Xgterm.width: 640
+ *Xgterm.height: 525
+
+ *xgUBFrame.height: 35
+ *xgUBFrame.outerOffset: 0
+ *xgUBFrame.innerOffset: 3
+ *xgUBFrame.frameType: raised
+ *xgUBFrame.frameWidth: 2
+ *xgLayout*borderWidth: 0
+ *xgLayout.layout: vertical { \
+ -1 \
+ vertical { \
+ horizontal { \
+ -1 \
+ xgUBFrame < +inf -inf * > \
+ -1 \
+ } \
+ gtermGroup < +inf -inf * +inf -inf > \
+ horizontal { \
+ 5 \
+ xgConfigBar < +inf -inf * > \
+ 5 \
+ } \
+ 4 \
+ } \
+ -1 \
+ }
+
+ *gtermGroup.outerOffset: 2
+ *gtermGroup.innerOffset: 0
+ *gtermGroup.frameType: sunken
+ *gtermGroup.frameWidth: 2
+ *gtermGroup.label:
+ *gtermGroup.layout: horizontal { \
+ 2 < +0 -2 > \
+ vertical { \
+ 2 < +0 -2 > \
+ gterm < +inf -inf * +inf -inf > \
+ 2 < +0 -2 > \
+ } \
+ 2 < +0 -2 > \
+ }
+ *gterm.width: 640
+ *gterm.height: 480
+ *gterm.borderColor: black
+ *gterm.resizable: True
+ *gterm.copyOnResize: False
+ *gterm.dialogBgColor: cyan
+ *gterm.dialogFgColor: black
+ *gterm.crosshairCursorColor: cyan
+ *gterm.translations: \
+ !Ctrl <Key>c: call(openDialog,command) \n\
+ !Ctrl <Key>l: call(openDialog,load) \n\
+ !Ctrl <Key>n: call(altGraphToggle) \n\
+ !Ctrl <Key>p: call(openDialog,print) \n\
+ !Ctrl <Key>s: call(logOpen) \n\
+ !Ctrl <Key>t: call(tclToggle) \n\
+ !Ctrl <Key>w: call(openDialog,save) \n\
+ <EnterWindow>: enter-window() \n\
+ <LeaveWindow>: leave-window() \n\
+ <KeyPress>: graphics-input() \n\
+ !Ctrl<Btn2Down>: call(trackEnable) \n\
+ !Ctrl<Btn2Motion>: track-cursor() call(wcsUpdate,$x,$y) \n\
+ !Ctrl<Btn2Up>: call(trackDisable) \n\
+ !Shift<Btn1Down>: popup(fileMenu) \n\
+ !Shift<Btn1Up>: popdown(fileMenu) \n\
+ !Shift<Btn2Down>: popup(cmMenu) \n\
+ !Shift<Btn2Up>: popdown(cmMenu) call(trackDisable) \n\
+ !Shift<Btn3Down>: popup(configMenu) \n\
+ !Shift<Btn3Up>: popdown(configMenu) \n\
+ <Motion>: track-cursor()
+
+ !-----------------------------------------------------
+ ! Menu resources giving a shadow effect on dividers.
+ !-----------------------------------------------------
+ *gterm*SimpleMenu*background: gray75
+ *gterm*SimpleMenu*foreground: black
+ *gterm*SimpleMenu.borderWidth: 1
+ *gterm*SimpleMenu.menuLabel.foreground: black
+ *gterm*SimpleMenu.line1.foreground: gray61
+ *gterm*SimpleMenu.line2.foreground: gray91
+ *gterm*SimpleMenu.line3.foreground: gray61
+ *gterm*SimpleMenu.line4.foreground: gray91
+ *gterm*SimpleMenu.line5.foreground: gray61
+ *gterm*SimpleMenu.line6.foreground: gray91
+ *gterm*SimpleMenu.line7.foreground: gray61
+ *gterm*SimpleMenu.line8.foreground: gray91
+ *gterm*SimpleMenu.line9.foreground: gray61
+ *gterm*SimpleMenu.line10.foreground: gray91
+ *gterm*SimpleMenu.line11.foreground: gray61
+ *gterm*SimpleMenu.line12.foreground: gray91
+ *gterm*SimpleMenu.line13.foreground: gray61
+ *gterm*SimpleMenu.line14.foreground: gray91
+ *gterm*SimpleMenu.line15.foreground: gray61
+
+ *xgConfigBar*Toggle.font: -*-times-bold-r-normal-*-10-*
+ *xgConfigBar*Toggle.font: 6x10
+ *xgConfigBar.layout: horizontal { \
+ xgAltGraph \
+ 10 < +inf -inf > \
+ cfgGcur \
+ cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4 \
+ cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9 \
+ cfgClose \
+ }
+ *xgAltGraph.label: Alt Graph
+ *xgAltGraph.location: 0 0 90 21
+ *xgAltGraph.frameType: chiseled
+ *xgAltGraph.frameWidth: 2
+ *xgAltGraph.innerOffset: 0
+ *xgAltGraph.outerOffset: 0
+ *xgAltGraph*font: 6x10
+ *xgAltGraph.highlightColor: green
+ *xgAltGraph.onIcon: diamond1s
+ *xgAltGraph.offIcon: diamond0s
+ *cfgClose.label:
+ *cfgClose.shadowWidth: 0
+ *cfgGcur.label: GCursor
+
+
+ !#################################
+ ! Define a alternate graph window.
+ !#################################
+ *altGraph.title:
+ *altGraph.width: 640
+
+ *agLayout*borderWidth: 0
+ *agLayout.layout: vertical { \
+ -1 \
+ vertical { \
+ horizontal { \
+ 5 \
+ agUserbar < +inf -inf * > \
+ 5 \
+ } \
+ 2 \
+ agGraphGroup < +inf -inf * +inf -inf > \
+ 2 \
+ } \
+ -1 \
+ }
+
+ *agGraphGroup.outerOffset: 2
+ *agGraphGroup.innerOffset: 0
+ *agGraphGroup.frameType: sunken
+ *agGraphGroup.frameWidth: 2
+ *agGraphGroup.label:
+ *agGraphLayout.layout: horizontal { \
+ 2 < +0 -2 > \
+ vertical { \
+ 2 < +0 -2 > \
+ agGterm < +inf -inf * +inf -inf > \
+ 2 < +0 -2 > \
+ } \
+ 2 < +0 -2 > \
+ }
+ *agGterm.translations: \
+ !<Key>q: call(altGraphClose) \n\
+ !Ctrl <Key>c: call(openDialog,command) \n\
+ !Ctrl <Key>l: call(openDialog,load) \n\
+ !Ctrl <Key>n: call(altGraphToggle) \n\
+ !Ctrl <Key>p: call(openDialog,print) \n\
+ !Ctrl <Key>s: call(logOpen) \n\
+ !Ctrl <Key>t: call(tclToggle) \n\
+ !Ctrl <Key>w: call(openDialog,save) \n\
+ <EnterWindow>: enter-window() \n\
+ <LeaveWindow>: leave-window() \n\
+ <KeyPress>: graphics-input() \n\
+ !Ctrl<Btn2Down>: call(trackEnable) \n\
+ !Ctrl<Btn2Motion>: track-cursor() call(wcsUpdate,$x,$y) \n\
+ !Ctrl<Btn2Up>: call(trackDisable) \n\
+ !Shift<Btn1Down>: popup(fileMenu) \n\
+ !Shift<Btn1Up>: popdown(fileMenu) \n\
+ !Shift<Btn2Down>: popup(cmMenu) \n\
+ !Shift<Btn2Up>: popdown(cmMenu) call(trackDisable) \n\
+ !Shift<Btn3Down>: popup(configMenu) \n\
+ !Shift<Btn3Up>: popdown(configMenu) \n\
+ <Motion>: track-cursor()
+}
+
+set UIActCallbacks(Xgterm) { }
+set UIDeactCallbacks(Xgterm) { }
+
+
+################################################################################
+# Global Variables.
+################################################################################
+
+set track_coords 0 ;# track cursor coords in marker
+set agMapped 0 ;# alt graph window is mapped
+set ubMapped 1 ;# user config menubar is mapped
+set curConfig none ;# current user config
+
+set xgtermrc "~/.xgtermrc" ;# startup config file
+set winClose False ;# close window on shutdown
+set configPath "./" ;# config file path
+set defaultConfig none ;# startup default configuration
+set cfgGcur GCursor
+set cfgTask0 none
+set cfgTask1 none
+set cfgTask2 none
+set cfgTask3 none
+set cfgTask4 none
+set cfgTask5 none
+set cfgTask6 none
+set cfgTask7 none
+set cfgTask8 none
+set cfgTask9 none
+
+set Module(arg) {} ;# user configuration files
+set config(task) {} ;# task configuration array
+set config(task,widget) {} ;# widget configuration array
+set config(task,Realized) {} ;# module has been realized
+set config(task,Activated) {} ;# module has been activated
+
+set gvar(var) {} ;# user-procedure global variables
+set Arrow(task,N,dir) {} ;# Arrow widget configurations
+set MenuButton(task,N,opt) {} ;# Menu widget configurations
+set MenuItem(task,M,N,opt) {} ;# Menu widget configurations
+set ToggleAction(task,M,N,opt) {} ;# Toggle widget configurations
+set Toggle(task,N,opt) {} ;# Toggle widget configurations
+set TextToggle(task,N,opt) {} ;# TextToggle widget configurations
+set Command(task,N,opt) {} ;# Command widget configurations
+set Label(task,N) {} ;# Label widget configurations
+set ULayout(task) {} ;# userbar layout
+set Hght(task) {} ;# userbar height
+
+set debug 0 ;# it ain't the same w/out a debug flag
+set err_msgs ""
+
+
+#------------
+# Constants
+#------------
+
+set UbarHeight 30 ;# user menubar height
+
+set NWidgets(Arrow) 0 ;# num of available Arrow widgets
+set NWidgets(AsciiText) 1 ;# num of available Arrow widgets
+set NWidgets(Label) 4 ;# num of available Label widgets
+set NWidgets(MenuButton) 5 ;# num of available Menu widgets
+set NWidgets(Toggle) 5 ;# num of available Toggle widgets
+set NWidgets(TextToggle) 1 ;# num of available TextToggle widgets
+set NWidgets(Command) 10 ;# num of available Command widgets
+
+
+################################################################################
+# Bootstrap procedures used during the startup process.
+################################################################################
+
+# Given the max number of widgets we'll be using create the object definition
+# for the GUI we can append to the UIObjects string before startup.
+
+proc BuildObjects args {
+ global NWidgets UIObjects UIResources
+
+ set widgets ""
+ set u_layout ""
+ set a_layout ""
+ foreach B { u a } {
+ foreach W [ array names NWidgets ] {
+ for {set i 1} {$i <= $NWidgets($W) } {incr i} {
+ append widgets \
+ [format "%sgUserbar\t%s\t%s%s%d\t" $B $W $B $W $i]
+ append ${B}_layout [format "%s%s%d " $B $W $i]
+ }
+ }
+ }
+
+ # Append the objects to the xgterm object list.
+ append UIObjects(Xgterm) $widgets
+
+ # Now add a dummy Layout for each userbar
+ append UIResources(Xgterm) \
+ [format "*ugUserbar.layout: horizontal { %s }\n" $u_layout]
+ append UIResources(Xgterm) \
+ [format "*agUserbar.layout: horizontal { %s }\n" $a_layout]
+
+ # Add dummy menuName resources for each of the MenuButton widgets.
+ for {set i 1} {$i <= $NWidgets(MenuButton) } {incr i} {
+ append UIResources(Xgterm) \
+ [format "*uMenuButton%d.menuName: menu%d\n" $i $i]
+ append UIResources(Xgterm) \
+ [format "*aMenuButton%d.menuName: menu%d\n" $i $i]
+ }
+}
+
+
+# Load the .xgtermrc config file.
+proc LoadXgtermrcFile args {
+ global xgtermrc defaultConfig configPath err_msgs
+ global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4
+ global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9
+
+ # If we have a .xgtermrc file use it for the startup.
+ # the GUI resource values
+ set file $xgtermrc
+ if { [file exists $file] } {
+ if { [ catch {source $file} err] } {
+ print ".xgtermrc file read error\n$err"
+ append err_msgs ".xgtermrc file read error\n$err"
+ }
+ }
+}
+
+# Read the named UI configuration file.
+proc ReadConfigFile { fname args } {
+
+ set fd [ open $fname r ]
+
+ # Read the config file a line at a time so we can strip comments and
+ # blank lines to make the parsing easier.
+ set uidef ""
+ while { ! [ eof $fd ] } {
+ gets $fd line
+
+ # Strip any comments and blank lines.
+ if { [ string first "#" $line ] >= 0 } {
+ set line [ string range $line 0 [ expr [string first "#" $line]-1] ]
+ set line [ string trimright $line ]
+ }
+ if { $line == "" } { continue }
+
+ # Append the line to the output description.
+ set uidef [ format "%s\n%s" $uidef $line ]
+ }
+
+ close $fd
+ return $uidef
+}
+
+# Scan the config directories getting a list of User-UI files.
+proc ScanConfigDirs args {
+ global Module configPath UIObjects UIResources UIActCallbacks
+ global gvar err_msgs
+
+ set path [ format "./:%s" $configPath ]
+ foreach dir [ split $path : ] {
+ set ui_files [ glob -nocomplain [ format "%s/*.ui" $dir ] ]
+ foreach fil $ui_files {
+ set task [ file tail [ file rootname $fil ] ]
+ if { ! [info exists Module($task) ] } {
+ set Module($task) [ format "%s" $fil ]
+
+ # Open the UI file to set any objects/resources defined.
+ # This will also pick up any callback procedures declared.
+ set text [ ReadConfigFile $fil ]
+
+ if {[catch { eval $text } err] } {
+ print "'${task}.ui' file bootstrap error\n'$err'"
+ append err_msgs ".xgtermrc file read error\n$err"
+ } else {
+ if {[info exists Objects]} {
+ set UIObjects($task) $Objects
+ unset Objects
+ }
+ if {[info exists Resources]} {
+ set UIResources($task) $Resources
+ unset Resources
+ }
+ if {[info exists ActivateCallbacks]} {
+ set UIActCallbacks($task) $ActivateCallbacks
+ unset ActivateCallbacks
+ }
+ if {[info exists DeactivateCallbacks]} {
+ set UIDeactCallbacks($task) $DeactivateCallbacks
+ unset DeactivateCallbacks
+ }
+ }
+ }
+ }
+ set ui_files ""
+ }
+}
+
+# Initialize the widget tree.
+proc InitWidgetTree args {
+ global UIObjects UIResources
+
+ # Initialize the string with the base GUI objects/resources.
+ set guiResources \
+ [format "Xgterm*objects:%s\n%s" $UIObjects(Xgterm) $UIResources(Xgterm)]
+
+ # Add a new objects description for each of the plugins found so we can
+ # create them by name later rather that with the defaults.
+ foreach task [array names UIObjects] {
+ if {$task != "Xgterm"} {
+ set guiResources \
+ [ format "%s\n\n*%s_objects:%s\n%s" \
+ $guiResources $task \
+ $UIObjects($task) $UIResources($task) ]
+ }
+ }
+
+ # Define all of the UI objects and resources.
+ appInitialize xgterm Xgterm $guiResources
+}
+
+# Realize a plugin module, i.e. create it's objects and attach callbacks.
+# We only do this once and set a flag to indicate the objects have been
+# created so we don't do it on subsequent realizations.
+proc Realize { module args } {
+ global config UIActCallbacks UIObjects
+
+ if { [info exists config($module,Realized)] } {
+ return
+ }
+
+ # Create any widgets for the module. We only do this once and set a
+ # flag to indicate the objects have been created so we don't do it on
+ # subsequent realizations.
+ if { [info exists UIObjects($module)] } {
+ createObjects [format "%s_objects" $module]
+ reset-server
+ }
+
+ # Add any callback that are defined for procedures in the module.
+ if { [info exists UIActCallbacks($module)] } {
+ foreach cb $UIActCallbacks($module) {
+ eval $cb
+ }
+ }
+
+ set config($module,Realized) 1
+}
+
+
+# Increase the maximum number of userbar widgets to create. This procedure
+# is essentially called from a UI file during the scanning and is a no-op if
+# the value set is below the current max.
+
+proc SetMaxWidgets { type num args } {
+ global NWidgets
+
+ if { [info exists NWidgets($type)]} {
+ if { $NWidgets($type) < $num } {
+ set NWidgets($type) $num
+ }
+ } else {
+ set NWidgets($type) $num
+ }
+}
+
+
+
+################################################################################
+# Bootstrap the GUI.
+################################################################################
+
+# Load the .xgtermrc config file.
+LoadXgtermrcFile
+
+# Scan the config directories getting a list of User-UI files.
+ScanConfigDirs
+
+# Create the userbar widgets based on the number of widgets defined.
+BuildObjects
+
+# Initialize the widget tree.
+InitWidgetTree
+
+# Realize the plugins with widgets needed for the base GUI. All other
+# modules have already loaded their procedures so we can automatically
+# access e.g. debug print routines at this point.
+Realize tclShell
+Realize warning
+Realize filename
+Realize log
+
+
+################################################################################
+# Crank it up...
+################################################################################
+
+# Create the objects and initialize the Gterm widgets in the main XGterm GUI.
+# We will create the objects for plugin modules when they are realized to
+# speed startup times.
+
+createObjects
+send agGterm setGterm ; send agGterm activate
+send gterm setGterm ; send gterm activate
+
+
+# Setup the close-window button
+createBitmap CloseBM 16 16 {
+ 0x00,0x00,0xfc,0x3f,0x02,0x60,0x02,0x50,0xf2,0x6f,0xf2,0x5f,0xf2,0x6f,0xf2,
+ 0x5f,0xf2,0x6f,0xf2,0x5f,0xf2,0x6f,0xf2,0x5f,0xaa,0x6a,0x54,0x55,0xfc,0x3f,
+ 0x00,0x00}
+
+send cfgClose "set bitmap CloseBM ; set foreground red4"
+send cfgClose addCallback { GKey q ; deactivate unmap }
+
+
+################################################################################
+# Menu Definitions
+################################################################################
+
+set fileMenuDescription {
+ {"File Options" f.title }
+ { f.dblline }
+ {"New Gterm window" f.exec { altGraphOpen }
+ sensitive {($agMapped==1) ? "false" : "true"} }
+ { f.dblline }
+ {"Print..." f.exec { Print } }
+ {"Print to device..." f.exec { openDialog print } }
+ { f.dblline }
+ {"Show message log" f.exec { send log map } }
+ {"Exec host command..." f.exec { openDialog command } }
+ {"Debug Tcl Shell" f.exec { tclOpen } }
+ { f.dblline }
+ {"Redraw" f.exec { GKey r } }
+ {"Help" f.exec { GKey ? } }
+ {"Quit" f.exec { Quit } }
+}
+
+set cmMenuDescription {
+ {"Cursor Mode Commands" f.title }
+ { f.dblline }
+ {"Flush graphics output" f.exec { GCmd .gflush } }
+ {"Reset and Redraw" f.exec { GKey 0 } }
+ {"Draw/Label axes of viewport" f.exec { GKey A } }
+ { f.dblline }
+ {"Load metacode file" f.exec { openDialog load} }
+ {"Save to metacode file" f.exec { openDialog save} }
+ { f.dblline }
+ {"Backup over last instr in buffer" f.exec { GKey B } }
+ {"Undo last buffer edit" f.exec { GKey U } }
+ { f.dblline }
+ {"Mark cursor after read" f.exec { GCmd .markcur+ } }
+ {"Don't mark cursor after read" f.exec { GCmd .markcur- } }
+ { f.dblline }
+ {"Draw axes at redraw" f.exec { GCmd .axes+ } }
+ {"Don't draw axes at redraw" f.exec { GCmd .axes- } }
+ { f.dblline }
+ {"Show cursor mode help" f.exec { GCmd .? } }
+}
+
+set configMenuDescription {
+ {"GUI Configuration Options" f.title }
+ { f.dblline }
+ {"Add current config to menubar" f.exec { } }
+ {"Rescan .xgtermrc file" f.exec { } }
+ {"Save to .xgtermrc file" f.exec { } }
+ {"Load UI config file" f.exec { } }
+}
+
+createMenu fileMenu gterm $fileMenuDescription
+createMenu fileMenu agGterm $fileMenuDescription
+createMenu cmMenu gterm $cmMenuDescription
+createMenu cmMenu agGterm $cmMenuDescription
+createMenu configMenu gterm $configMenuDescription
+createMenu configMenu agGterm $configMenuDescription
+
+
+
+################################################################################
+# Utility Callbacks
+################################################################################
+
+# Procedures for sending client cursor commands.
+proc GKey { key args } { send client gkey $key }
+proc GCmd args { send client gcmd $args }
+
+# Wrapper routine to execute a callback command while ignoring the extra
+# arguments from the widget such as widget name, mode, etc.
+proc Exec { cmd args } { eval $cmd }
+
+# Procedures to test True/False strings in resources.
+proc true { v } \
+ { expr { $v=="true" || $v=="True" || $v=="TRUE" || $v==1 || $v=="yes" }
+}
+proc false { v } \
+ { expr { $v=="false" || $v=="False" || $v=="FALSE" || $v==0 || $v=="no" }
+}
+
+# No-op procedure for text widgets with no callbacks to swallow newline.
+proc noop args { }
+
+# Common functions.
+proc min { a b } { expr {($a < $b) ? $a : $b} }
+proc max { a b } { expr {($a > $b) ? $a : $b} }
+
+# Dereference a variable. E.g. in we define vars x[1-5] and want to use them
+# in a loop later we can't simply access "$x$i" to get the value of '$x1',
+# instead we use "[GetVal x$i]" to return the value of '$x1'. 'GV' is the
+# shorthand version.
+
+proc GetVal { in } { upvar $in out ; return $out }
+proc GV { in } { upvar #0 $in out ; return $out }
+
+
+
+################################################################################
+# Generic Menubar Widget Callbacks
+################################################################################
+
+proc CommandCB { widget args } {
+ global Command curConfig
+
+ scan $widget "%1sCommand%d" bar num
+ set task [GV $curConfig]
+ eval $Command($task,$num,cmd)
+}
+
+proc ToggleCB { widget type state args } {
+ global ToggleAction curConfig
+
+ scan $widget "%1sToggle%d" bar num
+ set task [GV $curConfig]
+ if {$state == 1} {
+ eval $ToggleAction($task,Toggle$num,on,cmd)
+ } else {
+ eval $ToggleAction($task,Toggle$num,off,cmd)
+ }
+}
+
+proc ArrowCB { widget args } {
+ global Arrow curConfig
+
+ scan $widget "%1sArrow%d" bar num
+ set task [GV $curConfig]
+ eval $Arrow($task,$num,cmd)
+}
+
+proc AsciiTextCB { widget mode text args } {
+print $args
+}
+
+proc TextToggleCB { widget type state args } {
+ global ToggleAction curConfig
+
+ scan $widget "%1sToggle%d" bar num
+ set task [GV $curConfig]
+ if {$state == 1} {
+ eval $ToggleAction($task,Toggle$num,on,cmd)
+ } else {
+ eval $ToggleAction($task,Toggle$num,off,cmd)
+ }
+}
+
+
+# Now attach all the callbacks.
+foreach w [ array names NWidgets ] {
+ for {set i 1} {$i <= $NWidgets($w)} {incr i} {
+ if {$w != "MenuButton"} {
+ send u$w$i addCallback ${w}CB ; send a$w$i addCallback ${w}CB
+ }
+ }
+}
+
+
+
+################################################################################
+# Standard Keystroke Procedures
+################################################################################
+
+proc Print args { GKey = ; GCmd .gflush }
+proc Redraw args { GKey r }
+proc Help args { GKey ? }
+proc Quit args {
+ global winClose
+ GKey q
+ if {$winClose == 1} { deactivate unmap }
+}
+
+
+
+################################################################################
+# Initialize the XGterm GUI.
+################################################################################
+
+proc Initialize args {
+ global ubMapped UbarHeight
+ global xgtermrc defaultConfig configPath
+ global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4
+ global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9
+
+
+ # Edit the configuration menu.
+ editConfigMenu
+
+ # If we're not starting up with a configuration unmap the userbar. The
+ # alt graph userbar is always unmapped at the start.
+ if { $defaultConfig == "none" } {
+ set h [ send toplevel get height ]
+ send toplevel set height [ expr {$h - $UbarHeight} ]
+ send xgUBFrame "unmap ; set height 0"
+ set ubMapped 0
+ }
+ set h [ send altGraph get height ]
+ send altGraph set height [ expr {$h - $UbarHeight} ]
+ send agUserbar "unmap ; set height 0"
+
+ # Initialize the rest of the GUI.
+ initConfigBar
+}
+
+
+# Save the .xgtermrc config file.
+proc saveXgtermrcFile { cfname args } {
+ global defaultConfig configPath
+ global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4
+ global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9
+
+ set fd [open $cfname w]
+
+ puts fd "# .xgtermrc -- XGterm Uber-GUI configuration file."
+ puts fd ""
+ puts fd "# Set the config directory paths. This will always include the"
+ puts fd "# current directory by default, other directories are specified"
+ puts fd "# as a colon-delimited list of directories to be searched. "
+ puts fd "# Environment variables may be used in the specification of each"
+ puts fd "# path (e.g. $HOME/.xgterm)"
+ puts fd ""
+ puts fd "set configPath\t\t"$configPath
+ puts fd "set defaultConfig\t"$defaultConfig
+ puts fd ""
+ puts fd "# Define the tasks to be installed on the configuration bar. "
+ puts fd "# Up to 10 tasks may be specified in variables "cfgTask[0-9]","
+ puts fd "# a value of "none" means that no task is configured on that"
+ puts fd "# widget and it will not be shown."
+ puts fd ""
+ for {set i 0} {$i < 10} {incr i} {
+ puts fd "set cfgTask$i\t" [send cfgTask$i get label]
+ }
+ close fd
+}
+
+
+################################################################################
+# Configure bar procedures.
+################################################################################
+
+# Initialize the config bar widgets.
+proc initConfigBar args {
+ global cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4
+ global cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9
+
+ for {set i 0} {$i < 10} {incr i} {
+ cfgButtonMap cfgTask$i [GetVal cfgTask$i]
+ }
+}
+
+proc cfgButtonMap { w v args } {
+ global Module
+
+ if { $v == "none" } {
+ send $w "unmap ; set width 0"
+ } else {
+ if { [info exists Module($v)] } {
+ send $w set label $v
+ } else {
+ send $w { set label " " ; setSensitive false }
+ }
+ }
+}
+
+# Edit the user-GUI configuration menu.
+proc editConfigMenu args {
+ global Module configMenuDescription
+
+ set desc $configMenuDescription
+
+ if { [ llength [ array names Module ] ] > 1 } {
+ lappend desc " f.dblline "
+ lappend desc " f.dblline "
+ lappend desc " \"Task UI File\" f.exec \{ \}"
+ lappend desc " f.dblline "
+ lappend desc " \"GCursor <builtin>\" f.exec \{ loadModule Gcur \}"
+ }
+
+ foreach n [ lsort [ array names Module ] ] {
+ if { $n != "arg" } {
+ set lab [ format "%-10s %s" $n $Module($n) ]
+ lappend desc " \"$lab\" f.exec \{ loadModule $Module($n) \}"
+ }
+ }
+ editMenu configMenu gterm $desc
+ editMenu configMenu agGterm $desc
+}
+
+
+#-----------------------
+# User-GUI command bar.
+#-----------------------
+
+set configWidgets {
+ cfgGcur
+ cfgTask0 cfgTask1 cfgTask2 cfgTask3 cfgTask4
+ cfgTask5 cfgTask6 cfgTask7 cfgTask8 cfgTask9
+}
+
+proc userbarCB { widget type state args } {
+ userbarToggle $widget $state
+} ; foreach w $configWidgets { send $w addCallback userbarCB }
+
+proc userbarToggle { widget state args } {
+ global Module ubMapped curConfig UbarHeight
+
+ set st $state
+ set task [GV $widget]
+
+ # If state is 2 we're being called to toggle a specific widget and not
+ # as a callback for the toggle itself.
+ if { $state == 2 } {
+ if { ! [send $widget get sensitive] } {
+ return
+ }
+ if { $ubMapped == 1 } {
+ set st 0
+ send $curConfig set state 0
+ send $curConfig set background gray80
+ send $curConfig set foreground black
+ set config($curConfig,Activated) 0
+ } else {
+ set st 1
+ send $widget set state on
+ }
+ }
+
+ # We're switching toggles, so first turn off the existing button.
+ if { $curConfig != "none" && $curConfig != $widget} {
+ send $curConfig set state 0
+ send $curConfig set background gray80
+ send $curConfig set foreground black
+ set config($curConfig,Activated) 0
+ }
+
+ # If we're turning on a toggle configure the userbar and display it,
+ # otherwise close the userbar.
+ if { $st == 1 } {
+ if { $ubMapped == 0 } {
+ set h [ send toplevel get height ]
+ send toplevel set height [ expr {$h + $UbarHeight} ]
+ send xgUBFrame "map ; set height $UbarHeight"
+ }
+
+ # Load the configuration file.
+ set task [ send $widget get label ]
+ if { [info exists Module($task)] } {
+ # Configure the uBFrame with the GUI.
+ Config $task ugUserbar
+ } else {
+ send $widget set state 0
+ Wexec warning [ format "'%s' not defined" $task ]
+ }
+
+ send $widget set background black
+ send $widget set foreground gray90
+ set ubMapped 1
+
+ } elseif { $st == 0 } {
+ send xgUBFrame "unmap ; set height 0"
+ set h [ send toplevel get height ]
+ send toplevel set height [ expr {$h - $UbarHeight} ]
+ send $widget set background gray80
+ send $widget set foreground black
+ set ubMapped 0
+ }
+ set curConfig $widget
+}
+
+
+
+################################################################################
+# Userbar Button Procedures.
+################################################################################
+
+# Callback for a GUI Parameter to automatically set the configuration from
+# the client when available.
+
+proc setConfiguration { param old new } {
+ Config $new xgUserbar
+} ; send configure addCallback setConfiguration
+
+
+# Configure the user menubar for a particular UI definition.
+
+proc Config { task menubar args } {
+ global debug config curConfig
+ global Hght ULayout
+
+ # If we haven't already loaded this configuration read it now and store
+ # it in the config struct.
+ if { ! [ info exists config($task) ] } {
+ ParseTaskConfig $task
+ }
+
+ # Now map all of the widgets We will be using for this configuration,
+ # unmap the rest.
+ MapUserbarWidgets $task $menubar
+
+ # Edit the Layout with the widget names
+ set layout [ EditLayout $task $menubar ]
+ send $menubar set layout $layout
+
+ # Set all the callbacks associated with this menubar, and Realize
+ # any objects defined for the module.
+ BuildConfigMenus $task ugUserbar
+ Realize $task
+
+ # Set the userbar Height.
+ send $menubar set height $Hght($task)
+
+ # Finally, map the userbar to see what we get.
+ send $menubar map
+
+ # Keep track that we're active.
+ set config($task,Activated) 1
+}
+
+
+# Map all of the widgets for the given menubar. We also set any resources
+# that were specified such as bg/fg colors, frame type/width, etc.
+
+proc MapUserbarWidgets { task bar args } {
+ global NWidgets config
+
+ if {[catch {
+ if { $bar == "ugUserbar" } { set b u } else { set b a }
+
+ foreach widget [ array names NWidgets ] {
+ global $widget
+
+ for {set i 1} {$i <= $NWidgets($widget)} {incr i} {
+ if { [info exists config($task,${widget}${i})] } {
+ send ${b}${widget}${i} map
+ if { $widget != "Arrow" } {
+ send ${b}${widget}${i} \
+ set label [GV ${widget}($task,$i,label)]
+ }
+ if { $widget == "TextToggle" } {
+ if {[info exists TextToggle($task,$i,ftype)]} {
+ send ${b}${widget}${i} \
+ set frameType [GV ${widget}($task,$i,ftype)]
+ }
+ if {[info exists TextToggle($task,$i,fwidth)]} {
+ send ${b}${widget}${i} \
+ set frameWidth [GV ${widget}($task,$i,fwidth)]
+ }
+ if {[info exists TextToggle($task,$i,icon)]} {
+ send ${b}${widget}${i} \
+ set onIcon \
+ [format "%s1s" [GV ${widget}($task,$i,icon)] ]
+ send ${b}${widget}${i} \
+ set offIcon \
+ [format "%s0s" [GV ${widget}($task,$i,icon)] ]
+ }
+ if {[info exists TextToggle($task,$i,width)]} {
+ send ${b}${widget}${i} \
+ set width [GV ${widget}($task,$i,width)]
+ } else {
+ set width \
+ [string length [GV ${widget}($task,$i,label)]]
+ set width [expr { 7 * $width + 35} ]
+ send ${b}${widget}${i} set width $width
+ }
+ }
+ if {[info exists ${widget}($task,$i,bg)]} {
+ send ${b}${widget}${i} \
+ set background [GV ${widget}($task,$i,bg)]
+ }
+ if {[info exists ${widget}($task,$i,fg)]} {
+ send ${b}${widget}${i} \
+ set foreground [GV ${widget}($task,$i,fg)]
+ }
+ if {[info exists ${widget}($task,$i,width)]} {
+ send ${b}${widget}${i} \
+ set width [GV ${widget}($task,$i,width)]
+ }
+ if {[info exists ${widget}($task,$i,height)]} {
+ send ${b}${widget}${i} \
+ set height [GV ${widget}($task,$i,height)]
+ }
+ } else {
+ send ${b}${widget}${i} unmap
+ }
+ }
+ }
+ } err]} {
+ print "MapUserbarWidgets: '$err'"
+ }
+}
+
+
+# Activate all callbacks associated with a particular userbar configuration.
+proc BuildConfigMenus { task bar args } {
+ global NWidgets config debug
+
+ if {[catch {
+ if { $bar == "ugUserbar" } { set b u } else { set b a }
+
+ global MenuButton
+
+ for {set i 1} {$i <= $NWidgets(MenuButton)} {incr i} {
+ if {[info exists MenuButton($task,$i,label)]} {
+ BuildUIMenu $b $i $task
+ }
+ }
+ } err]} {
+ print "BuildConfigmenus($task): '$err'"
+ }
+}
+
+
+# Build the menu for a particular widget from the UI configuration.
+proc BuildUIMenu { bar N task args } {
+ global MenuButton MenuItem
+
+ # Set the parent menu widget
+ set w MenuButton$N
+
+ if {[info exists $MenuButton($task,$N,label)]} {
+ set label [GV $MenuButton($task,$N,label)]
+ send $bar$w set label $label
+ }
+
+ set menu_items {}
+ for {set i 1} {[info exists MenuItem($task,$w,$i,label)]} {incr i} {
+ set line ""
+ set label $MenuItem($task,$w,$i,label)
+ set cmd $MenuItem($task,$w,$i,cmd)
+ if {[info exists MenuItem($task,$w,$i,sensitive)]} {
+ set sensitive $MenuItem($task,$w,$i,sensitive)
+ }
+ if {[info exists MenuItem($task,$w,$i,bitmap)]} {
+ set bitmap $MenuItem($task,$w,$i,bitmap)
+ }
+
+ switch $cmd {
+ f.line { lappend menu_items " f.line " }
+ f.dblline { lappend menu_items " f.dblline " }
+ f.title { set title [ format " \"%s\" f.title " $label ]
+ lappend menu_items " f.dblline " }
+ default { lappend menu_items " \"$label\" f.exec \{ $cmd \}"
+ }
+ }
+
+ # Reset so we don't keep a sensitive/bitmap on the next item.
+ catch { unset $label $cmd $sentive $bitmap }
+ }
+
+ # Finally, attach the menu to the widget.
+ editMenu menu$N $bar$w $menu_items
+}
+
+
+# Edit the Layout for the configuration with the actual widget names to be used.
+proc EditLayout { task bar args } {
+ global ULayout NWidgets
+
+ if {[catch {
+ if { $bar == "ugUserbar" } { set b u } else { set b a }
+
+ set layout $ULayout($task)
+ foreach widget [ array names NWidgets ] {
+ regsub -all $widget $layout ${b}${widget} layout
+ }
+
+ # Kludge around the TextToggle which may have been changed because
+ # of editing Toggle.
+ regsub -all Text${b} $layout ${b}Text layout
+
+ } err]} {
+ print "EditLayout: '$err'"
+ }
+
+ return $layout
+}
+
+
+# Given the task name, read in the UI configuration and store it in the
+# global structures. The 'config' struct defines which task/widgets are
+# available but because of the need to access a global array by a known
+# name the config values are stored according to widget type, indexed by
+# the task.
+
+proc ParseTaskConfig { task args } {
+ global debug Module config UbarHeight NWidgets
+ global Hght ULayout gvar
+
+ # Read in the UI configuration file and eval-uate it to define local
+ # variables for the widgets. We'll look through the list of variables
+ # defined and send those off to be parsed for the given configuration.
+ # The UI file may also contain user-defined procedures that will
+ # persist for the rest of the GUI and may be called as callbacks for
+ # the widgets.
+
+ set err ""
+ if {[catch { eval [ ReadConfigFile $Module($task) ] } err] } {
+ Wexec warning "file '$Module($task)':\n$err'"
+ }
+
+
+ # We now have defined as local variables the Menu/Toggle/etc widgets.
+ # For each of these convert to an element in the config structs, trap
+ # any errors.
+
+ if {[catch {
+
+ foreach widget [ array names NWidgets ] {
+ for { set i 1 } { $i <= $NWidgets($widget) } { incr i } {
+ if { [ info exists $widget$i ] } {
+ setWidgetSpec $task $widget $i [GetVal $widget$i]
+ }
+ }
+ }
+
+ # Lastly, get the userbar Layout and Height if specified. It is an
+ # error to not specify the Layout, Height will default to a one-row
+ # widget height.
+
+ if { [ info exists Layout ] } {
+ set ULayout($task) $Layout
+ } else {
+ Wexec warning "Config Error:\n'$task': No Layout specified"
+ }
+
+ if { [ info exists Height ] } {
+ set Hght($task) $Height
+ } else {
+ set Hght($task) $UbarHeight
+ }
+
+ if { $debug == 1 } { ;# debug print
+ puts "${task}.Layout"
+ puts " $ULayout($task)"
+ puts "${task}.Height"
+ puts " $Hght($task)"
+ }
+
+ } err] } {
+ Wexec warning "file '$Module($task)':\n$err'"
+ }
+
+ set config($task) 1
+}
+
+
+# Parse a widget definition.
+proc setWidgetSpec { task widget indx args } {
+ global config
+
+ # Let us know which button was defined.
+ set config($task,$widget$indx) 1
+
+ # Assume the command is the first string.
+ regsub -all "=" $args " " new
+ set entry [lindex $new 0]
+
+ set w $widget ;# shorthad variables
+ set t $task
+ set nitems 0 ;# number of menu items
+ global $w
+
+ # Loop through each of the items in the list which will be ordered as
+ # either a keyword or a value. The outer loop should reach only known
+ # keywords, within the case we pick up the optional value, otherwise
+ # we ignore it. For now we don't check that the keyword is correct for
+ # the widget, the space used should be negligible and won't be referenced
+ # anyway.
+
+ for { set i 0 } { $i < [llength $entry] } { incr i } {
+ switch [lindex $entry $i] {
+ lab -
+ label { set ${w}($t,$indx,label) [lindex $entry [incr i] ]
+ }
+ cmd -
+ command { set ${w}($t,$indx,cmd) [lindex $entry [incr i] ]
+ }
+ alt -
+ altgraph { set ${w}($t,$indx,altgraph) 1
+ }
+ close -
+ closeKeys { set ${w}($t,$indx,closeKeys) [lindex $entry $i ]
+ }
+ config { set ${w}($t,$indx,config) [lindex $entry [incr i] ]
+ }
+ prompt { set ${w}($t,$indx,prompt) [lindex $entry [incr i] ]
+ }
+ dir -
+ direction { set ${w}($t,$indx,dir) [lindex $entry [incr i] ]
+ }
+ item { set wn ${w}${indx}
+ setActionSpec $t $wn \
+ [incr nitems] [lindex $entry [incr i] ]
+ }
+ onAct -
+ onAction { set wn ${w}${indx}
+ setActionSpec $t $wn on [lindex $entry [incr i] ]
+ }
+ offAct -
+ offAction { set wn ${w}${indx}
+ setActionSpec $t $wn off [lindex $entry [incr i] ]
+ }
+ ftype -
+ frameType { set ${w}($t,$indx,ftype) [lindex $entry [incr i] ]
+ }
+ fwidth -
+ frameWidth { set ${w}($t,$indx,fwidth) [lindex $entry [incr i] ]
+ }
+ bg -
+ background { set ${w}($t,$indx,bg) [lindex $entry [incr i] ]
+ }
+ fg -
+ foreground { set ${w}($t,$indx,fg) [lindex $entry [incr i] ]
+ }
+ width { set ${w}($t,$indx,width) [lindex $entry [incr i] ]
+ }
+ height { set ${w}($t,$indx,height) [lindex $entry [incr i] ]
+ }
+ icon { set ${w}($t,$indx,icon) [lindex $entry [incr i] ]
+ }
+ default { print "unknown entry: " [lindex $entry $i ]
+ }
+ }
+ }
+ printWidgetSpec $task $widget $indx ;# Debug print (temporary).
+}
+
+# Parse a MenuItem or ToggleAction definition.
+proc setActionSpec { task widget item args } {
+ global config
+
+ # Let us know which button was defined.
+ set config($task,$widget$item) 1
+
+ # Assume the command is the first string.
+ regsub -all "=" $args " " new
+ set entry [lindex $new 0]
+
+ set w $widget ;# shorthand variables
+ set t $task
+ if { [ string match Menu* $widget ] } {
+ set W MenuItem
+ } else {
+ set W ToggleAction
+ }
+ global $W
+
+ for { set i 0 } { $i < [llength $entry] } { incr i } {
+ switch [lindex $entry $i] {
+ alt -
+ altgraph { set ${W}($t,$w,$item,altgraph) 1
+ }
+ close -
+ closeKeys { set ${W}($t,$w,$item,closeKeys) [lindex $entry $i]
+ }
+ cmd -
+ command { set ${W}($t,$w,$item,cmd) [lindex $entry [incr i] ]
+ }
+ config { set ${W}($t,$w,$item,config) [lindex $entry [incr i] ]
+ }
+ lab -
+ label { set ${W}($t,$w,$item,label) [lindex $entry [incr i] ]
+ }
+ prompt { set ${W}($t,$w,$item,prompt) [lindex $entry [incr i] ]
+ }
+ sens -
+ sensitive { set ${W}($t,$w,$item,sensitive) [lindex $entry [incr i]]
+ }
+ bitmap { set ${W}($t,$w,$item,bitmap) [lindex $entry [incr i] ]
+ }
+ f.line -
+ f.dblline { set ${W}($t,$w,$item,label) ""
+ set ${W}($t,$w,$item,cmd) [lindex $entry $i]
+ }
+ f.title { set ${W}($t,$w,$item,cmd) [lindex $entry $i]
+ }
+ default { print "unknown item entry: " [lindex $entry $i]
+ }
+ }
+ }
+ printItemSpec $task $W $w $item ;# Debug print (temporary).
+}
+
+
+
+################################################################################
+# Define a WCS box to track coords
+################################################################################
+
+proc trackEnable args {
+ global track_coords agMapped
+ set track_coords 1
+ set parentGterm [ expr { ($agMapped == 1) ? "agGterm" : "gterm" } ]
+
+ send $parentGterm set dialogBgColor black
+ send $parentGterm set dialogFgColor black
+ makeWCSMarker $parentGterm
+}
+
+proc trackDisable args {
+ global track_coords agMapped
+ set track_coords 0
+ set parentGterm [ expr { ($agMapped == 1) ? "agGterm" : "gterm" } ]
+
+ send wcsbox destroy
+ send tclCoords set label ""
+
+ send $parentGterm set dialogBgColor yellow
+ send $parentGterm set dialogFgColor black
+}
+
+proc trackCoords { param old new } {
+ global track_coords
+
+ if {$track_coords == 1} {
+ scan $new "%f %f" nx ny
+ set text [ format "x = %-7.2f y = %-7.2f " $nx $ny ]
+ send wcsbox "set text \{$text\}; redraw noerase"
+ }
+} ; send textout addCallback trackCoords
+
+proc makeWCSMarker { parent args } {
+ send $parent createMarker wcsbox {
+ type text
+ createMode noninteractive
+ width 25ch
+ height 1ch
+ lineWidth 0
+ imageText true
+ textBgColor black
+ textColor yellow
+ visible false
+ }
+
+ set box_width [send wcsbox get width]
+ set box_height [send wcsbox get height]
+ set defGeom [format "%sx%s-5-5" $box_width $box_height]
+ send $parent parseGeometry "-5-5" $defGeom x y width height
+
+ send wcsbox setAttributes \
+ x $x \
+ y $y \
+ activated true \
+ visible true \
+ sensitive true
+}
+
+# Update the wcsbox marker with the current window position.
+proc wcsUpdate {x y} \
+{
+ global track_coords
+
+ # Update Tcl coords box.
+ send tclCoords set label \
+ [ format "Screen Cursor: x = %-7.2f y = %-7.2f " $x $y ]
+
+ if {$track_coords == 1} { GKey C }
+}
+
+
+################################################################################
+# Procedures used by the alternate graph window.
+################################################################################
+
+proc altGraphOpen args {
+ global agMapped fileMenuDescription
+
+ send gterm setSensitive false
+ send gterm setCursorType idle
+ send agGterm setCursorType ginMode
+ send agGterm setGterm
+ GKey 0
+ send altGraph map
+ set agMapped 1
+
+ editMenu fileMenu gterm $fileMenuDescription
+ editMenu agFileMenu agGterm $fileMenuDescription
+}
+
+proc altGraphClose args {
+ global agMapped fileMenuDescription
+
+ send altGraph unmap
+ send gterm setSensitive true
+ send gterm setCursorType ginMode
+ send gterm setGterm
+ GKey 0
+ set agMapped 0
+
+ editMenu fileMenu gterm $fileMenuDescription
+ editMenu agFileMenu agGterm $fileMenuDescription
+}
+
+proc altGraphToggle args {
+ global agMapped
+
+ if { $agMapped == 1 } { altGraphClose
+ } else { altGraphOpen }
+}
+
+proc altGraphCB { widget type state args } {
+ global agMapped
+
+ if { $state == 1 } { altGraphOpen
+ } else { altGraphClose }
+} ; send xgAltGraph addCallback altGraphCB
+
+
+################################################################################
+# Now that we've done it all, Initialize and start up the GUI.
+################################################################################
+activate
+Initialize
diff --git a/lib/soseq.x b/lib/soseq.x
new file mode 100644
index 00000000..0dcb6de3
--- /dev/null
+++ b/lib/soseq.x
@@ -0,0 +1,8 @@
+# The following strings are not device dependent; if found, and map_cc is
+# enabled, they are converted into the standout mode sequences for the
+# destination terminal or printer.
+# N.B.: The ^ in these strings is a strmatch BOL, not an escape sequence.
+# Used in PAGE and LPOPEN.
+
+string so_on "^\016" # SO
+string so_off "^\017" # SI
diff --git a/lib/syserr.h b/lib/syserr.h
new file mode 100644
index 00000000..0922d511
--- /dev/null
+++ b/lib/syserr.h
@@ -0,0 +1,333 @@
+# SYSERR.H -- System Error Codes. Each code has a corresponding error message,
+# given in <syserrmsg>. System errors are numbered starting at 500.
+
+define SYS_XACV 501 # Exceptions
+define SYS_XARITH 502 # ALSO DEFINED in error.h
+define SYS_XINT 503
+define SYS_XIPC 504
+
+define SYS_SONERROVFL 550 # ETC, TTY, MEMIO
+define SYS_SONEXITOVFL 551
+define SYS_ENVNNUM 552
+define SYS_ENVNF 553
+define SYS_TTYMOVOOR 554
+define SYS_TTYOVFL 555
+define SYS_TTYDEVNF 556
+define SYS_TTYSET 557
+define SYS_TTYSTAT 558
+define SYS_TTYTC 559
+define SYS_TTYBINSRCH 560
+define SYS_GMULOPN 561
+define SYS_TTYINVDES 562
+define SYS_MCORRUPTED 570
+define SYS_MEMFILALIGN 571
+define SYS_MFULL 572
+define SYS_MUNDERFLOW 573
+define SYS_MOVERFLOW 574
+define SYS_MDBLFREE 575
+define SYS_MNULLFREE 576
+define SYS_MSSTKUNFL 577
+define SYS_PROVFL 578
+define SYS_PROPEN 579
+define SYS_PRNOTFOUND 580
+define SYS_PRSIGNAL 581
+define SYS_PRIPCSYNTAX 582
+define SYS_PRBKGNF 583
+define SYS_PRBKGNOKILL 584
+define SYS_PRBKGOVFL 585
+define SYS_PRBKGOPEN 586
+define SYS_PRSTAT 587
+define SYS_PRPSIOUCI 588
+define SYS_STTYNUMARG 589
+define SYS_STTYNOGDEV 590
+define SYS_PSOPEN 591
+define SYS_PSFONT 592
+define SYS_PSSPFONT 593
+
+define SYS_URLNOTFOUND 594
+define SYS_URLFORBIDDEN 595
+define SYS_URLINTERROR 596
+define SYS_URLBADREQUEST 597
+define SYS_URLREDIRECT 598
+
+define SYS_CLNPSETS 600 # CLIO
+define SYS_CLPSETOOS 601
+define SYS_CLEOFNLP 602
+define SYS_CLNOTBOOL 603
+define SYS_CLNOTCC 604
+define SYS_CLNOTNUM 605
+define SYS_CLSTATUS 606
+define SYS_CLSETUKNPAR 607
+define SYS_CLGWRD 608
+define SYS_CLCMDNC 609
+
+define SYS_FNTMAGIC 620 # FNT
+define SYS_FNTBADPAT 621
+define SYS_FNTMAXPAT 622
+define SYS_FNTMAXEDIT 623
+define SYS_FNTEDIT 624
+
+define SYS_FALLOC 720 # FIO
+define SYS_FARDALIGN 721
+define SYS_FARDOOB 722
+define SYS_FAWRALIGN 723
+define SYS_FAWROOB 724
+define SYS_FCANTCLOB 725
+define SYS_FCLOBBER 726
+define SYS_FCLOBOPNFIL 727
+define SYS_FDELETE 728
+define SYS_FDELPROTFIL 729
+define SYS_FDEVNOTFOUND 730
+define SYS_FDEVSTAT 731
+define SYS_FDEVTBLOVFL 732
+define SYS_FILENOTOPEN 733
+define SYS_FILLEGMODE 734
+define SYS_FILLEGTYPE 735
+define SYS_FIOINPROGRESS 736
+define SYS_FINITREP 737
+define SYS_FMKTEMP 738
+define SYS_FNOREADPERM 739
+define SYS_FNOWRITEPERM 740
+define SYS_FOPEN 741
+define SYS_FOPENDEV 742
+define SYS_FOPNNEXFIL 743
+define SYS_FPROTECT 744
+define SYS_FPROTNEXFIL 745
+define SYS_FREAD 746
+define SYS_FDELNXF 747
+define SYS_FRENAME 748
+define SYS_FRENAMECLOB 749
+define SYS_FREOPNMODE 750
+define SYS_FREOPNTYPE 751
+define SYS_FSEEK 752
+define SYS_FSETUKNPAR 753
+define SYS_FSTAT 754
+define SYS_FSTATUNKPAR 755
+define SYS_FSTRFILOVFL 756
+define SYS_FTOOMANYFILES 757
+define SYS_FUNPROTECT 758
+define SYS_FWRITE 759
+define SYS_FWTNOACC 760
+define SYS_FWTOPNFIL 761
+define SYS_FZMAPOVFL 762
+define SYS_FZMAPRECUR 763
+define SYS_FPATHNAME 764
+define SYS_FGCWD 765
+define SYS_FSEEKNTXF 766
+define SYS_FSTATTYPE 767
+define SYS_FOWNER 768
+define SYS_FINITLOCK 769
+define SYS_FVFNMODE 770
+define SYS_FVFNCHKSUM 771
+define SYS_FDEGEN 772
+define SYS_FTMLONGFN 773
+define SYS_FNOLOCK 774
+define SYS_FCLOSE 775
+define SYS_FREDIRFNO 776
+define SYS_FMULTREDIR 777
+define SYS_FCHDIR 778
+define SYS_FOPENDIR 779
+define SYS_FNOSUCHFILE 780
+define SYS_FPBOVFL 781
+define SYS_FREADP 782
+define SYS_FWRITEP 783
+define SYS_FMKDIR 784
+define SYS_FRMDIR 785
+define SYS_FMKDIRFNTL 786
+define SYS_FACCDIR 787
+define SYS_FMKCOPY 788
+define SYS_FSFOPNF 789
+define SYS_FNOFNAME 790
+define SYS_FCLFDTX 791
+define SYS_FCLFDNF 792
+define SYS_FUTIME 793
+define SYS_FSYMLINK 794
+define SYS_FUNLINK 795
+
+define SYS_IMRDPIXFILE 800 # IMIO
+define SYS_IMUPIMHDR 801
+define SYS_IMACMODE 802
+define SYS_IMNDIM 803
+define SYS_IMDIMLEN 804
+define SYS_IMMAGNCPY 805
+define SYS_IMMAGOPSF 806
+define SYS_IMNOPIX 807
+define SYS_IMREFOOB 808
+define SYS_IMHDRRDERR 809
+define SYS_IMSECTNEWIM 810
+define SYS_IMSYNSEC 811
+define SYS_IMDIMSEC 812
+define SYS_IMSTEPSEC 813
+define SYS_IMSETUNKPAR 814
+define SYS_IMSTATUNKPAR 815
+define SYS_IMDEVOPN 816
+define SYS_IMFNOVFL 817
+define SYS_IMGSZNEQ 818
+
+define SYS_IKICLOB 820
+define SYS_IKICLOSE 821
+define SYS_IKICOPY 822
+define SYS_IKIDEL 823
+define SYS_IKIEXTN 824
+define SYS_IKIIMNF 825
+define SYS_IKIKTBLOVFL 826
+define SYS_IKIOPEN 827
+define SYS_IKIOPIX 828
+define SYS_IKIRENAME 829
+define SYS_IKIUPDHDR 830
+define SYS_IKIKSECTNS 831
+define SYS_IKIAMBIG 832
+
+define SYS_IDBKEYNF 835
+define SYS_IDBOVFL 836
+define SYS_IDBREDEF 837
+define SYS_IDBTYPE 838
+define SYS_IDBNODEL 839
+define SYS_IDBDELNXKW 840
+
+define SYS_GGCUR 850 # GIO
+define SYS_GGETWCS 851
+define SYS_GINDEF 852
+define SYS_GSCALE 853
+define SYS_GSET 854
+define SYS_GSTAT 855
+define SYS_GXNORANGE 856
+define SYS_GYNORANGE 857
+define SYS_GGCELL 858
+define SYS_GWRITEP 859
+define SYS_GKERNPARAM 860
+define SYS_GGNONE 861
+define SYS_GINONE 862
+define SYS_GPNONE 863
+define SYS_GNOKF 864
+
+define SYS_MTFILSPEC 900 # MTIO
+define SYS_MTACMODE 901
+define SYS_MTALLOC 902
+define SYS_MTMULTOPEN 903
+define SYS_MTNOTALLOC 904
+define SYS_MTNOTOWN 905
+define SYS_MTPOSINDEF 906
+define SYS_MTSKIPREC 907
+define SYS_MTREW 908
+define SYS_MTDEVNF 909
+define SYS_MTTAPECAP 910
+
+define SYS_PLBADMASK 919 # PLIO, more IMIO
+define SYS_IMRLOVFL 920
+define SYS_PLBADSAVEF 921
+define SYS_PLINACTDES 922
+define SYS_PLINVDES 923
+define SYS_PLNULLSRC 924
+define SYS_PLREFOOB 925
+define SYS_IMPLNORI 926
+define SYS_IMPLSIZE 927
+define SYS_PLSTKOVFL 928
+define SYS_PLINVPAR 929
+
+define SYS_FMBADMAGIC 930 # FMIO
+define SYS_FMCLOSE 931
+define SYS_FMCOPYO 932
+define SYS_FMLFCOPY 933
+define SYS_FMLFNOOB 934
+define SYS_FMOOF 935
+define SYS_FMOPEN 936
+define SYS_FMPTIOVFL 937
+define SYS_FMRERR 938
+define SYS_FMTRUNC 939
+define SYS_FMWRERR 940
+define SYS_FMBLKCHSZ 941
+define SYS_FMFSINUSE 942
+define SYS_FMLFLOCKED 943
+define SYS_FMFCFULL 944
+define SYS_FMLOKACTLF 945
+
+define SYS_QPBLOCKOOR 948 # QPOE
+define SYS_QPINVEVT 949
+define SYS_QMNFILES 950
+define SYS_QPBADCONV 951
+define SYS_QPBADFILE 952
+define SYS_QPBADIX 953
+define SYS_QPBADKEY 954
+define SYS_QPBADVAL 955
+define SYS_QPCLOBBER 956
+define SYS_QPEVNSORT 957
+define SYS_QPEXBADRNG 958
+define SYS_QPEXDBOVFL 959
+define SYS_QPEXLEVEL 960
+define SYS_QPEXMLP 961
+define SYS_QPEXPBOVFL 962
+define SYS_QPEXRPAREN 963
+define SYS_QPINDXOOR 964
+define SYS_QPINVDD 965
+define SYS_QPMRECUR 966
+define SYS_QPNEVPAR 967
+define SYS_QPNOEH 968
+define SYS_QPNOVAL 969
+define SYS_QPNOXYF 970
+define SYS_QPPLSIZE 971
+define SYS_QPPOPEN 972
+define SYS_QPPVALOVF 973
+define SYS_QPREDEF 974
+define SYS_QPUKNPAR 975
+define SYS_QPXYFNS 976
+define SYS_QPNOWCS 977
+define SYS_QPIOSYN 978
+define SYS_QPEXSYN 979
+
+define SYS_MWATOVFL 980 # MWCS
+define SYS_MWFCOVFL 981
+define SYS_MWFUNCOVFL 982
+define SYS_MWINVAXMAP 983
+define SYS_MWMAGIC 984
+define SYS_MWMAXWCS 985
+define SYS_MWMISSAX 986
+define SYS_MWNDIM 987
+define SYS_MWNOWCS 988
+define SYS_MWNOWSAMP 989
+define SYS_MWROTDEP 990
+define SYS_MWSET 991
+define SYS_MWSTAT 992
+define SYS_MWUNKFN 993
+define SYS_MWWATTRNF 994
+define SYS_MWWCSNF 995
+define SYS_MWWCSREDEF 996
+define SYS_MWFNOVFL 997
+define SYS_MWCTOVFL 998
+define SYS_MWROT2AX 999
+define SYS_MWFITSOVFL 1000
+
+define SYS_FXFDELMEF 1100 # IMIO - FITS image kernel
+define SYS_FXFKSNV 1101
+define SYS_FXFKSNDEC 1102
+define SYS_FXFKSSYN 1103
+define SYS_FXFKSSVAL 1104
+define SYS_FXFKSEXT 1105
+define SYS_FXFKSINVAL 1106
+define SYS_FXFKSPVAL 1107
+define SYS_FXFKSOVR 1108
+define SYS_FXFKSBOP 1109
+define SYS_FXFKSNEXT 1110
+define SYS_FXFKSNOVR 1111
+define SYS_FXFOPEXTNV 1112
+define SYS_FXFOPNOEXTNV 1113
+define SYS_FXFOVRBEXTN 1114
+define SYS_FXFOVRTOPN 1115
+define SYS_FXFBSDTY 1116
+define SYS_FXFPKDTYP 1117
+define SYS_FXFRDHSC 1118
+define SYS_FXFBADINH 1119
+define SYS_FXFRFNEXTNV 1120
+define SYS_FXFRFEOF 1121
+define SYS_FXFRFBNAXIS 1122
+define SYS_FXFRFSIMPLE 1123
+define SYS_FXFUPHBEXTN 1124
+define SYS_FXFUPHBTYP 1125
+define SYS_FXFUPHEXP 1126
+define SYS_FXFUPKDTY 1127
+define SYS_FXFFKNULL 1128
+define SYS_FXFKSBADGR 1129
+define SYS_FXFKSBADFKIG 1130
+define SYS_FXFKSBADEXN 1131
+define SYS_FXFEXTNF 1132
+define SYS_FXFRMASK 1133
diff --git a/lib/syserrmsg b/lib/syserrmsg
new file mode 100644
index 00000000..06b8f464
--- /dev/null
+++ b/lib/syserrmsg
@@ -0,0 +1,344 @@
+# System error message file. Messages may appear in any order; error
+# codes must be left justified and must agree with those defined in
+# <syserr.h>. System error codes start at 500; 1-499 are reserved for
+# applications and user programs. It is wise to reserve a lot of extra
+# error codes for each package.
+
+# Exceptions (501-503)
+501 Access violation
+502 Arithmetic exception
+503 Interrupt
+504 Write to IPC (to a subprocess) with no reader
+
+# SYSTEM, TTY, MEMIO (550-599)
+550 ONERROR: Too many procedures to remember
+551 ONEXIT: Too many procedures to remember
+552 Environment variable not found or not integer
+553 Environment variable not found
+554 Illegal cursor coordinates passed to 'ttymov'
+555 Too many capabilities in termcap entry
+556 No entry in device capabilities file for device
+557 Attempt to set unknown parameter in ttyset
+558 Attempt to read unknown parameter in ttystat
+559 Excessive nesting in termcap; recursive tc reference?
+560 Internal error: termcap caplist index is faulty, search fails
+561 Attempt to open too many graphics devices at once
+562 Invalid or null tty descriptor
+570 Memory has been corrupted
+571 STROPEN: String not aligned with Mem
+572 Out of memory
+573 Pointer underflow
+574 Pointer overflow
+575 Attempt to free already freed pointer
+576 Attempt to free NULL pointer
+577 System stack underflow (invalid SFREE)
+578 Too many child processes
+579 Cannot open connected subprocess
+580 Process PID not found in process table
+581 Cannot send signal to child process
+582 Invalid IPC syntax or protocol
+583 Background job not found in job table
+584 Cannot kill background job
+585 Too many background jobs
+586 Cannot open detached process
+587 Prstat: unrecognized parameter code
+588 Unsolicited command input from a subprocess
+589 This stty parameter requires a numeric argument
+590 Stdgraph device not recorded in stty playback file
+591 PS_OPEN: cannot allocate descriptor
+592 Unrecognized postscript font
+593 Unrecognized postscript special font
+
+594 URL Not Found
+595 URL Permission Denied
+596 URL Internal Error
+597 URL Bad Request
+598 URL Redirection
+
+# CLIO (600-649)
+600 Task has too many psets
+601 Out of space for pset name storage
+602 EOF while reading non list structured parameter
+603 Parameter not a legal boolean (try 'yes' or 'no')
+604 Parameter not a legal character constant
+605 Parameter not a legal number
+606 Illegal argument to CLSTATUS
+607 CLSET: Attempt to set unknown option
+608 CLGWRD: No match, or ambiguous abbreviation
+609 Commands can only be sent to the CL from a connected subprocess
+
+620 Bad file name template descriptor
+621 Illegal file name template
+622 Too many concatenatable sublists in filename template
+623 Too many string replacements in filename template
+624 Cannot edit a string constant filename template
+
+# FIO (700-799)
+720 Cannot preallocate space for file
+721 AREAD transfer not aligned on a device block boundary
+722 Attempt to read out of bounds on file
+723 AWRITE transfer not aligned on a device block boundary
+724 Attempt to write out of bounds on file
+725 Cannot clobber file
+726 Operation would overwrite existing file
+727 Attempt to clobber a file which is already open
+728 Cannot delete file
+729 Attempt to delete a protected file
+730 Attempt to open file on a device not known to FIO
+731 Cannot read status of device
+732 FIO device table has overflowed
+733 Illegal file descriptor (bad fd or file not open)
+734 Illegal file access mode parameter to OPEN
+735 Illegal file type parameter to OPEN
+736 Missing AWAIT after an AREAD or AWRITE
+737 FINIT may only be called during process startup
+738 Cannot make unique temporary file name
+739 No read permission on file
+740 No write permission on file
+741 Cannot open file
+742 Cannot open device
+743 OPEN: File does not exist
+744 Cannot protect file
+745 Attempt to alter or query protection of a nonexistent file
+746 File read error
+747 Attempt to delete a nonexistent file
+748 Cannot rename file
+749 Rename would clobber existing file
+750 Illegal file access mode parameter to REOPEN
+751 Illegal file type parameter to REOPEN
+752 Seek error on file
+753 Attempt to set an unknown file parameter
+754 SYS_FSTAT
+755 Attempt to get file status for unknown parameter
+756 SYS_FSTRFILOVFL
+757 Too many open files
+758 Cannot remove file protection
+759 File write error
+760 Cannot access file
+761 Cannot open file
+762 Buffer overflow in ZMAPFN
+763 Overflow in ZMAPFN (recursion in logical name defn?)
+764 Cannot determine pathname of file
+765 Cannot determine pathname of the current working directory
+766 Can only seek to EOF on a text file opened for writing
+767 Attempt to get file status for non-integer value
+768 Cannot get info on file
+769 No write perm on directory; cannot lock file
+770 Illegal VFN database access mode
+771 Invalid checksum reading VFN mapping file
+772 Maximum filename degeneracy exceeded
+773 Long filename storage exceeded
+774 Broken directory protection lock
+775 Cannot close file
+776 Attempt to redirect an stream which is not open
+777 Attempt to redirect a stream which is already redirected
+778 Cannot change directory
+779 Cannot open directory
+780 Cannot access file
+781 Pushback buffer overflow (recursive macro?)
+782 Out of bounds or misaligned FREADP call
+783 Out of bounds or misaligned FWRITEP call
+784 Cannot make directory
+785 Cannot remove directory
+786 Directory name is too long
+787 Cannot access directory
+788 Cannot access template file or cannot make copy file
+789 Static files cannot be opened NEW_FILE - use falloc
+790 Illegal filename operand (null string)
+791 FSETI: The F_CLOSEFD option is not supported for text files
+792 FSETI: The F_CLOSEFD option cannot be used with files opened NEW_FILE
+793 FUTIME: Cannot reset file access/modify time
+794 Cannot create symlink
+795 Cannot remove symlink
+
+# IMIO (800-899)
+800 Cannot read pixel storage file
+801 Cannot update image header
+802 Illegal image access mode
+803 Image is illegally dimensioned
+804 Negative or zero length dimension
+805 New copy of a non-image
+806 Not a legal imagefile
+807 Pixel storage file is truncated
+808 Pixel subscript out of bounds
+809 Cannot read image header
+810 Cannot specify section for a new image
+811 Invalid image section
+812 Wrong number of subscripts in image section
+813 Wrong sign on step size in image section
+814 IMSET: Attempt to set unknown option
+815 IMSTAT: Attempt to read unknown option
+816 Cannot create a new image on a special image device
+817 Too many field names in image header field name template
+818 Group format images must all be the same size
+819 Range list too large to fit in image buffer
+
+820 Operation would overwrite existing image
+821 Cannot close image
+822 Cannot copy image
+823 Cannot delete image
+824 Illegal image type (extension)
+825 Cannot access image
+826 IKI image kernel table overflow
+827 Cannot open image
+828 Cannot open pixel file
+829 Cannot rename image
+830 Cannot update image header
+831 Kernel section syntax not supported for this image
+832 Ambiguous image name
+
+835 Image header parameter not found
+836 Out of space in image header
+837 Attempt to redefine an image header parameter
+838 Impossible type conversion when accessing image header parameter
+839 Cannot delete image header parameter
+840 Attempt to delete a nonexistent image parameter
+
+# GIO (850-899)
+850 Cannot read graphics cursor
+851 Cannot restore graphics world coordinate systems
+852 Entire graphics vector is indefinite
+853 Illegal axis number passed to gscale (must be x=1 or y=2)
+854 Unknown GIO parameter referenced in gset call
+855 Unknown GIO parameter referenced in gstat call
+856 Invalid graphics window: no range in X
+857 Invalid graphics window: no range in Y
+858 Cannot read cell array from graphics device
+859 I/O on uninitialized graphics stream
+860 Unknown parameter request from graphics kernel subprocess
+861 Terminal does not support vector graphics
+862 No stdimage device has been specified
+863 No stdplot device has been specified
+864 No GIO kernel specified for graphics device
+
+# MTIO (900-949)
+900 Illegal magtape unit specification
+901 Illegal magtape access mode
+902 Magtape unit already allocated to
+903 Attempt to multiply open magtape unit
+904 Magtape unit not allocated
+905 Magtape unit allocated to someone else
+906 Current position of magtape unit is undefined
+907 Attempt to position magtape to record beyond EOF
+908 Cannot rewind device
+909 Magtape device not found
+910 Bad tapecap entry for magtape device
+
+919 PLIO: mask has been corrupted
+920 PLIO: range list overflow
+921 PLIO: bad mask save file
+922 PLIO: i/o to inactive descriptor
+923 PLIO: invalid descriptor
+924 PLIO: source raster required but not specified
+925 PLIO: reference out of bounds on mask
+926 PMIO: null reference image
+927 PMIO: mask must be the same size as reference image
+928 PLIO: stack overflow
+929 PLIO: invalid mask parameter referenced
+
+930 File does not appear to be a FMIO datafile
+931 Error closing FMIO datafile
+932 Error rebuilding FMIO datafile
+933 Error copying FMIO datafile
+934 FMIO: bad lfile number
+935 FMIO: out of lfiles
+936 FMIO: cannot open datafile
+937 FMIO: datafile too large - increase page size or MAXPTPAGES
+938 Read error on FMIO datafile
+939 FMIO: datafile appears to be truncated
+940 Write error on FMIO datafile
+941 FMIO: datafile page size not a multiple of device block size
+942 FMIO: attempt to reopen for writing an lfile already open for reading
+943 FMIO: attempt to open an lfile already open for exclusive access
+944 FMIO: lfile cache overflow
+945 FMIO: attempt to obtain a lock on an already active lfile
+
+948 QPIO: blocking factor is out of range
+949 QPIO: illegal event coordinate type
+950 QPOE: too many macro definition files in list
+951 QPOE: header parameter has bad datatype code
+952 Error reading QPOE file header
+953 QPOE: cannot read event list index
+954 QPOE: cannot parse coordinate pair key specification for index
+955 QPOE: cannot read parameter value
+956 QPIO: new event list would clobber existing header parameter
+957 QPOE: cannot build index for unordered event list
+958 QPEX: bad range specifier in event attribute filter
+959 QPEX: data buffer overflow (expanded expression too large)
+960 Maximum nesting exceeded in QPEX expression
+961 QPEX syntax error: missing left parenthesis
+962 QPEX: program buffer overflow (expression too large)
+963 QPEX syntax error: unmatched right parenthesis
+964 QPOE: array parameter index out of range
+965 QPOE: cannot parse event structure field list
+966 QPOE: probable macro recursion detected
+967 QPIO: attempt to open an nonevent parameter for event i/o
+968 QPIO: cannot read event list header
+969 QPOE: cannot access parameter value field
+970 QPIO: default index key not flagged in event struct field list
+971 QPIO: pixel mask not same size as image
+972 QPOE: attempt to open existing nonarray parameter for array i/o
+973 QPOE: attempt to use getparam to fetch value of struct type parameter
+974 QPOE: attempt to redefine an existing header parameter
+975 QPOE: unknown parameter
+976 QPIO: coordinate fields used for index must be a numeric type
+977 QPOE file does not have a default WCS
+978 QPIO expression syntax
+979 QPEX: errors encountered while compiling expression
+
+980 MWCS: too many WCS attributes
+981 MWCS: too many function calls in compiled transformation
+982 MWCS: too many function calls in WCS
+983 MWCS: cannot invert axis map
+984 MWCS: bad MWCS save buffer
+985 MWCS: too many WCS
+986 MWCS: cannot compile transformation, dependent axis has been excluded
+987 MWCS: dimension mismatch
+988 MWCS: no current default WCS
+989 MWCS: no sampled WCS has been entered
+990 MWCS: cannot compile transformation, rotated axis has been excluded
+991 MWCS: mw_seti called with bad interface parameter type code
+992 MWCS: mw_stati called with bad interface parameter type code
+993 MWCS: unknown WCS function type
+994 MWCS: attribute not found
+995 MWCS: coordinate system not defined
+996 MWCS: attempt to redefine an existing coordinate system
+997 MWCS: function driver table overflow
+998 MWCS: too many coordinate transformation (ctran) descriptors
+999 MWCS: mw_rotate can only deal with rotations between two axes
+1000 MWCS: out of storage for FITS-WCS cards
+
+1100 FXF: cannot delete multiple FITS extension file
+1101 FXF: numeric value only allowed as second term in ksection
+1102 FXF: number is not a decimal
+1103 FXF: syntax error in kernel section
+1104 FXF: string value only allowed as first term in ksection
+1105 FXF: 'ext' is ambiguous in ksection
+1106 FXF: invalid value for kernel section parameter
+1107 FXF: value for ksection parameter must be positive
+1108 FXF: to overwrite you need to specify [ext#] or [extname,extver]
+1109 FXF: to do this operation you need to specify overwrite mode
+1110 FXF: extension number not allowed with mode
+1111 FXF: overwrite not allowed with mode
+1112 FXF: extname and/or extver value already exists in extension
+1113 FXF: must specify which FITS extension
+1114 FXF: attempt to overwrite non-image extension
+1115 FXF: overwrite: cannot open temporary image
+1116 FXF: byte_short: illegal datatype
+1117 FXF: pak_data: image datatype not supported
+1118 FXF: BSCALE, BZERO not supported for floating data
+1119 FXF: inherit not permitted when PHU has NAXIS != 0
+1120 FXF: extname and/or extver value not found
+1121 FXF: EOF encountered while reading FITS file
+1122 FXF: bad FITS file NAXIS value
+1123 FXF: SIMPLE keyword value is not standard
+1124 FXF: trying to modify the FITS header of a non-IMAGE extension
+1125 FXF: setbitpix: unrecognized IRAF datatype
+1126 FXF: expanding extension is disabled, header will be truncated
+1127 FXF: upk_data: image datatype not supported
+1128 FXF: FITS image kernel abort - null driver entry point
+1129 FXF: Bad extension number combination
+1130 FXF: Fkinit extension number not equal to kernel section's
+1131 FXF: Bad extension name and extension number combination
+1132 FXF: IMAGE extension not found
+1133 FXF: Error reading mask extension
diff --git a/lib/syshelpdir b/lib/syshelpdir
new file mode 100644
index 00000000..75857460
--- /dev/null
+++ b/lib/syshelpdir
@@ -0,0 +1,85 @@
+# IRAF System help directory. Each package installed in the system must
+# have an entry here for HELP to be able to print help for the package.
+# Library packages should be entered in the Help database as well as CL
+# packages. The help database is linear -- packages do not nest.
+
+# Define Package Directories (these defs are not recursive!).
+
+$artdata = "pkg$artdata/"
+$astrometry = "pkg$astrometry/"
+$dbms = "pkg$dbms/"
+$dataio = "pkg$dataio/"
+$digiphot = "pkg$digiphot/"
+$dtoi = "pkg$dtoi/"
+$filterphot = "pkg$filterphot/"
+$focas = "pkg$focas/"
+$images = "pkg$images/"
+$imred = "pkg$imred/"
+$language = "pkg$language/"
+$lists = "pkg$lists/"
+$local = "pkg$local/"
+$surfphot = "pkg$surfphot/"
+$onedspec = "pkg$onedspec/"
+$plot = "pkg$plot/"
+$softools = "pkg$softools/"
+$system = "pkg$system/"
+$twodspec = "pkg$twodspec/"
+$utilities = "pkg$utilities/"
+
+$tv = "pkg$images/tv/"
+$xtools = "pkg$xtools/"
+$os = "sys$os/"
+
+
+# Define help files for the packages.
+
+clpackage men=lib$clpackage.menu, hlp=..,
+ pkg=lib$syshelpdir
+dataio men=dataio$dataio.menu, hlp=..,
+ pkg=dataio$dataio.hd
+images men=images$images.menu, hlp=..,
+ pkg=images$images.hd
+language men=language$language.menu, hlp=..,
+ pkg=language$language.hd
+lists men=lists$lists.menu, hlp=..,
+ pkg=lists$lists.hd
+local men=local$local.menu, hlp=..,
+ pkg=local$local.hd
+plot men=plot$plot.menu, hlp=..,
+ pkg=plot$plot.hd
+softools men=softools$softools.menu, hlp=..,
+ pkg=softools$softools.hd
+system men=system$system.menu, hlp=..,
+ pkg=system$system.hd
+utilities men=utilities$utilities.menu, hlp=..,
+ pkg=utilities$utilities.hd
+
+os pkg=os$os.hd
+tv men=tv$tv.menu, hlp=..,
+ pkg=tv$tv.hd
+
+# artdata men=artdata$artdata.menu,
+# pkg=artdata$artdata.hd
+# astrometry men=astrometry$astrometry.menu,
+# pkg=astrometry$astrometry.hd
+# dbms men=dbms$dbms.menu,
+# pkg=dbms$dbms.hd
+# digiphot men=digiphot$digiphot.menu,
+# pkg=digiphot$digiphot.hd
+# dtoi men=dtoi$dtoi.menu,
+# pkg=dtoi$dtoi.hd
+# filterphot men=filterphot$filterphot.menu,
+# pkg=filterphot$filterphot.hd
+# focas men=focas$focas.menu,
+# pkg=focas$focas.hd
+# imred men=imred$imred.menu,
+# pkg=imred$imred.hd
+# surfphot men=surfphot$surfphot.menu,
+# pkg=surfphot$surfphot.hd
+# onedspec men=onedspec$onedspec.menu,
+# pkg=onedspec$onedspec.hd
+# twodspec men=twodspec$twodspec.menu,
+# pkg=twodspec$twodspec.hd
+
+# pi
+# xtools
diff --git a/lib/sysruk.x b/lib/sysruk.x
new file mode 100644
index 00000000..cf155c0e
--- /dev/null
+++ b/lib/sysruk.x
@@ -0,0 +1,97 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# SYS_RUNTASK -- Called by the IRAF Main to run one of the tasks in a
+# process. This file is the template for the actual procedure, which
+# is generated by the compiler in processing the TASK statement.
+# The special statements TN$DECL and TN$DICT are replaced, respectively, by
+# the code to declare the task name strings, and the code to search the
+# dictionary and execute a task. The dictionary consists of the string buffer
+# DICT, containing the EOS delimited task name strings, and a array DP
+# containing the indices of the individual strings.
+
+int procedure sys_runtask (task, cmd, ruk_argoff, ruk_interact)
+
+char task[ARB] #I task name
+char cmd[ARB] #I command line
+int ruk_argoff #I offset of argument list in CMD
+int ruk_interact #I we were called interactively
+
+int i, ntasks
+int lmarg, rmarg, maxch, ncol, ruk_eawarn
+int envgeti(), envscan()
+bool streq()
+
+TN$DECL # task name declarations (DP, DICT)
+data lmarg /5/, maxch /0/, ncol /0/, ruk_eawarn /3/
+data ntasks /0/
+
+begin
+ # Upon the first entry, count the number of tasks (the DP array
+ # containing the indices of the strings is NULL delimited).
+
+ if (ntasks == 0) {
+ for (i=1; dp[i] != NULL; i=i+1)
+ ;
+ ntasks = i - 1
+ }
+
+ # Search the dictionary for the named task and execute it. The
+ # special builtin task "?" prints the contents of the dictionary.
+ # CHDIR changes the working directory; SET adds set declarations
+ # to the environment list. If a SET or CHDIR cannot be processed
+ # for some reason when we are run as a connected subprocess (i.e.,
+ # noninteractively), it is a fatal error. This is done because
+ # STDERR is redirected into the nullfile during process startup,
+ # hence any warning messages would not be seen by the parent.
+
+ if (task[1] == '?') { # ?
+ # Print a menu listing all available tasks.
+ iferr (rmarg = envgeti ("ttyncols"))
+ rmarg = 80
+ call strtbl (STDOUT, dict, dp, ntasks, lmarg, rmarg, maxch, ncol)
+ return (OK)
+
+ } else if (streq(task,"chdir") || streq(task,"cd")) { # CHDIR
+ # Change the current working directory.
+ iferr {
+ if (cmd[ruk_argoff] == EOS) {
+ iferr (call fchdir ("home$"))
+ call fchdir ("HOME$")
+ } else
+ call fchdir (cmd[ruk_argoff])
+ } then if (ruk_interact == YES) {
+ call erract (ruk_eawarn)
+ } else
+ ; # call sys_panic (0, "invalid CHDIR in IRAF Main")
+ return (OK)
+
+ } else if (streq(task,"set") || streq(task,"reset")) { # SET
+ # Set the value of an environment variable. If called
+ # with no args print the current environment list.
+
+ iferr {
+ if (cmd[ruk_argoff] == EOS) {
+ call envlist (STDOUT, "\t", YES)
+ call flush (STDOUT)
+ } else if (envscan (cmd) <= 0) {
+ if (ruk_interact == YES) {
+ call eprintf ("invalid set statement: '%s'\n")
+ call pargstr (cmd)
+ } else
+ goto 91
+ }
+ } then if (ruk_interact == YES) {
+ call erract (ruk_eawarn)
+ } else
+ 91 call sys_panic (0, "invalid SET in IRAF Main")
+ return (OK)
+ }
+
+ # The following symbol is expanded into the interpreter code for
+ # the dictionary of user tasks.
+
+ TN$INTERP
+
+ # If we get here the named task could not be found.
+ return (ERR)
+end
diff --git a/lib/szdtype.inc b/lib/szdtype.inc
new file mode 100644
index 00000000..08d07016
--- /dev/null
+++ b/lib/szdtype.inc
@@ -0,0 +1,5 @@
+define MAX_DTYPE 11
+
+short ty_size[MAX_DTYPE]
+data ty_size /SZ_BOOL, SZ_CHAR, SZ_SHORT, SZ_INT, SZ_LONG, SZ_REAL,
+ SZ_DOUBLE, SZ_COMPLEX, SZ_POINTER, SZ_STRUCT, SZ_USHORT/
diff --git a/lib/szpixtype.inc b/lib/szpixtype.inc
new file mode 100644
index 00000000..3339453a
--- /dev/null
+++ b/lib/szpixtype.inc
@@ -0,0 +1,5 @@
+define MAX_DTYPE 11
+
+short pix_size[MAX_DTYPE]
+data pix_size /SZ_BOOL, SZ_CHAR, SZ_SHORT, SZ_INT32, SZ_INT32, SZ_REAL,
+ SZ_DOUBLE, SZ_COMPLEX, SZ_POINTER, SZ_STRUCT, SZ_USHORT/
diff --git a/lib/tbset.h b/lib/tbset.h
new file mode 100644
index 00000000..d1ffdcab
--- /dev/null
+++ b/lib/tbset.h
@@ -0,0 +1,91 @@
+# tbset -- This header file defines the lengths of character strings
+# and defines parameters that can be set by tbpset and/or read by tbpsta.
+#
+# Phil Hodge, 2-Oct-1987 Add FIO options and parameters for column info.
+# Phil Hodge, 2-Apr-1993 Add TBL_ROWLEN_CHAR and TBL_ROWLEN_CHAR_USED.
+# Phil Hodge, 8-Apr-1993 Add TBL_VERSION for getting software version number.
+# Phil Hodge, 4-Nov-1993 Add TBL_LAST_ROW for access to number of rows. DEL
+# Phil Hodge, 15-Sep-1994 Add TBL_TYPE_MI and TBL_COL_DIMENSION.
+# Phil Hodge, 1-Jul 1995 Add TBL_TYPE_FITS and TBL_TYPE_CDF.
+# Phil Hodge, 14-Apr-1998 Increase the sizes of SZ_COLNAME, SZ_COLUNITS,
+# and SZ_COLFMT to 79 (from 19, 19, and 9 respectively).
+# Phil Hodge, 2-Jun-1999 Add table subtype definitions.
+
+# Lengths of character strings for column information in memory.
+define SZ_COLNAME 79 # Size of a column name
+define SZ_COLUNITS SZ_COLNAME # Size of string for units
+define SZ_COLFMT SZ_COLNAME # Size for print format
+
+# This section defines the sizes and locations (unit = SZ_CHAR) of records
+# for user parameters in the table "header". The keyword takes the first
+# eight characters of a parameter record. The next character is the data
+# type, and the tenth through 80th contain the parameter value.
+# If SZB_CHAR is something strange like 3 or 6 then SZ_PARREC should be
+# increased to 84.
+
+define SZ_PARREC 80 # size of a parameter record (SZ_CHAR)
+define SZ_KEYWORD 8 # size of a keyword
+define LOCN_DTYPE 9 # location of datatype character
+define START_OF_VALUE 10 # location of start of value
+
+# This section defines parameters that can be set or read.
+# Those parameters with (R) beginning the comment are relevant only
+# to row-ordered tables, and those with (C) are relevant only to
+# column-ordered tables. TBL_MAXPAR and TBL_MAXCOLS are not hard limits;
+# they are for setting or determining the amount of space allocated for
+# user parameters and column descriptors respectively.
+
+# These can be set by tbpset and/or read by tbpsta:
+define TBL_ROWLEN 1 # (R) row length to allocate (SZ_REAL)
+define TBL_INCR_ROWLEN 2 # (R) increase row length (SZ_REAL)
+define TBL_ALLROWS 3 # (C) number of rows to allocate
+define TBL_INCR_ALLROWS 4 # (C) increase alloc num of rows
+define TBL_WHTYPE 5 # which type of table?
+define TBL_MAXPAR 6 # maximum number of user param
+define TBL_MAXCOLS 7 # maximum number of columns
+define TBL_ROWLEN_CHAR 8 # (R) row length to allocate (SZ_CHAR)
+
+# The table subtype can be read by tbpsta. The subtype can be set for
+# a text table but not for a FITS table.
+define TBL_SUBTYPE 9 # subtype of text or FITS table
+
+# Table types.
+# Note: TBL_TYPE_MI and TBL_TYPE_CDF are not implemented.
+define TBL_TYPE_MI 10 # machine independent table format
+define TBL_TYPE_S_ROW 11 # row-ordered table format
+define TBL_TYPE_S_COL 12 # column-ordered table format
+define TBL_TYPE_TEXT 13 # text table
+define TBL_TYPE_FITS 14 # FITS table
+define TBL_TYPE_CDF 15 # table in a CDF file
+
+# Table subtypes.
+define TBL_SUBTYPE_UNKNOWN 1000 # subtype not known, or irrelevant
+define TBL_SUBTYPE_SIMPLE 1301 # ordinary text table
+define TBL_SUBTYPE_EXPLICIT 1302 # text table with explicit column def
+define TBL_SUBTYPE_ASCII 1401 # FITS ASCII table extension
+define TBL_SUBTYPE_BINTABLE 1402 # FITS binary table extension
+define TBL_SUBTYPE_IMAGE 1403 # FITS primary header
+
+# These can be read by tbpsta but may not be set:
+define TBL_NROWS 21 # number of rows written to
+define TBL_NCOLS 22 # number of columns defined
+define TBL_ROWLEN_USED 23 # (R) amount of row len used (SZ_REAL)
+define TBL_NPAR 24 # number of user parameters
+define TBL_ROWLEN_CHAR_USED 25 # (R) amount of row len used (SZ_CHAR)
+define TBL_VERSION 26 # version that created the table
+
+# These have to do with the file size and file I/O buffer size.
+define TBL_ADVICE 31 # set RANDOM or SEQUENTIAL
+define TBL_BUFSIZE 32 # get buffer size in char
+
+define TBL_DATA_SIZE 34 # get size of table data in char
+
+# These are for information about a column.
+define TBL_COL_NAME 41 # column name
+define TBL_COL_UNITS 42 # units for column
+define TBL_COL_FMT 43 # print format for displaying values
+define TBL_COL_DATATYPE 44 # data type (-n for char string)
+define TBL_COL_NUMBER 45 # column number
+define TBL_COL_FMTLEN 46 # length for printing using print fmt
+define TBL_COL_LENDATA 47 # number of elements if it's an array
+define TBL_COL_DIMENSION 48 # dimension of array
diff --git a/lib/time.h b/lib/time.h
new file mode 100644
index 00000000..6c3dbf17
--- /dev/null
+++ b/lib/time.h
@@ -0,0 +1,17 @@
+# TIME.H -- Define the time value structure for brktime, cnvtime.
+
+define SZ_TIME 24 # size of "Dow 00:00:00 dd-Mmm-yyyy"
+define SZ_DATE 12 # size of "Mmm dd hh:mm"
+define LEN_TMSTRUCT 8 # length of time struct
+
+define TM_SEC $1[1] # seconds (0-59)
+define TM_MIN $1[2] # minutes (0-59)
+define TM_HOUR $1[3] # hour (0-23)
+define TM_MDAY $1[4] # day of month (1-31)
+define TM_MONTH $1[5] # month (1-12)
+define TM_YEAR $1[6] # year, e.g. "1982"
+define TM_WDAY $1[7] # day of week (Sun == 1)
+define TM_YDAY $1[8] # day of year (1-365/6)
+
+# Conversion flags for the etc$dtm date/time conversion routines.
+define TF_OLDFITS 1 # old FITS format DATE-OBS string
diff --git a/lib/ttset.h b/lib/ttset.h
new file mode 100644
index 00000000..d385b9b8
--- /dev/null
+++ b/lib/ttset.h
@@ -0,0 +1,27 @@
+# TTSET.H -- Set/stat terminal driver options (VOS logical terminal driver).
+
+define TT_INITIALIZE 0 # initialize TT driver status
+define TT_KINCHAN 101 # kernel tty input channel
+define TT_KOUTCHAN 102 # kernel tty output channel
+define TT_LOGINCHAN 103 # login spoolfile channel
+define TT_LOGOUTCHAN 104 # logout spoolfile channel
+define TT_PBINCHAN 105 # playback spoolfile channel
+define TT_UCASEIN 106 # map input to lower case
+define TT_UCASEOUT 107 # map output to upper case
+define TT_SHIFTLOCK 108 # software shiftlock
+define TT_RAWMODE 109 # raw mode in effect
+define TT_LOGIO 110 # log terminal i/o
+define TT_LOGIN 111 # log terminal input
+define TT_LOGOUT 112 # log terminal output
+define TT_PLAYBACK 113 # take input from a spool file
+define TT_PBVERIFY 114 # pause at \n during playback
+define TT_PBDELAY 115 # msec delay/per record during playback
+define TT_PASSTHRU 116 # passthru mode (direct i/o to device)
+define TT_IOFILE 117 # logio file name
+define TT_INFILE 118 # login file name
+define TT_OUTFILE 119 # logout file name
+define TT_PBFILE 120 # playback file name
+define TT_TDEVICE 121 # terminal device at record time
+define TT_GDEVICE 122 # stdgraph device at record time
+define TT_FILTER 123 # input filter (e.g. for escapes)
+define TT_FILTERKEY 124 # input filter key character
diff --git a/lib/ttyset.h b/lib/ttyset.h
new file mode 100644
index 00000000..b26394d9
--- /dev/null
+++ b/lib/ttyset.h
@@ -0,0 +1,10 @@
+# TTYSET.H -- TTY parameters that can be set with TTYSETI or read with TTYSTATI.
+# The values are set from the termcap entry and from the environment at
+# TTYODES time.
+
+define TTY_PADCHAR 1
+define TTY_TABS 2
+define TTY_SOTYPE 3
+define TTY_BAUD 4
+define TTY_NLINES 5
+define TTY_NCOLS 6
diff --git a/lib/votParse_spp.h b/lib/votParse_spp.h
new file mode 100644
index 00000000..3541a747
--- /dev/null
+++ b/lib/votParse_spp.h
@@ -0,0 +1,112 @@
+##
+# VOTPARSE_SPP.H -- Include file for the SPP libvotable interface.
+#
+# @file votParse_spp.h
+# @author M. Fitzpatrick,
+# @date 4/16/2011
+#
+# @brief Include file for the SPP libvotable interface.
+#
+##
+
+
+# Define UCD defaults for well-known VOTable columns.
+
+define DEF_ACREF_UCD "VOX:Image_AccessReference"
+define DEF_FORMAT_UCD "VOX:Image_Format"
+
+
+# VOTable Summary structure. Our purpose here is to save some of the
+# commonly referenced elements from the parsing to simplify the applications
+# code. Many times we'll just want to skip straight to the table data,
+# this gives us handles to the key nodes in case we need to get at more
+# detailed parts of the document. For nodes such as <FIELD>, we store the
+# handle to the first element in the list and use the interface iterators
+# to loop.
+
+define SZ_VOT_STRUCT 11
+
+define VOT_ROOT Memi[$1 ] # root VOTable handle
+define VOT_RES Memi[$1+1] # RESOURCE handle
+define VOT_TAB Memi[$1+2] # TABLE handle
+define VOT_DATA Memi[$1+3] # DATA handle
+define VOT_TDATA Memi[$1+4] # TABLEDATA handle
+
+define VOT_INFO Memi[$1+5] # INFO handle
+define VOT_PARAM Memi[$1+6] # PARAM handle
+define VOT_FIELD Memi[$1+7] # FIELD handle
+
+define VOT_NRES Memi[$1+8] # No. of RESOURCES
+define VOT_NROWS Memi[$1+9] # No. of TABLEDATA rows
+define VOT_NCOLS Memi[$1+10] # No. of TABLEDATA cols
+
+
+
+# Procedure declarations. In the SPP code we wish to allow readable names,
+# but must map these to the 6 chars produced in the compiled code.
+
+define vx_openVOTABLE vopene
+define vx_closeVOTABLE vclose
+
+define vx_getRESOURCE vgetre
+define vx_getTABLE vgette
+define vx_getFIELD vgetfd
+define vx_getDATA vgetda
+define vx_getTABLEDATA vgetta
+define vx_getTR vgettr
+define vx_getTD vgettd
+define vx_getBINARY vgetby
+define vx_getFITS vgetfs
+define vx_getGROUP vgetgp
+define vx_getFIELDREF vgetff
+define vx_getPARAMREF vgetpf
+define vx_getDESCRIPTION vgetdn
+define vx_getPARAM vgetpm
+define vx_getINFO vgetio
+define vx_getSTREAM vgetsm
+define vx_getVALUES vgetvs
+define vx_getMIN vgetmn
+define vx_getMAX vgetmx
+define vx_getOPTION vgeton
+define vx_getLINK vgetlk
+define vx_getCOOSYS vgetcs
+
+define vx_getDATAType vgetde
+define vx_getDATATypeStr vgetdr
+
+define vx_newNode vnewne
+define vx_freeNode vfreee
+define vx_attachNode vattae
+define vx_deleteNode vdelee
+define vx_copyElement vcopyt
+define vx_getNCols vgncol
+define vx_getNRows vgnrow
+define vx_getTableCell vgstab
+define vx_getTableInt vgitab
+define vx_getTableReal vgrtab
+define vx_getLength vgetlh
+define vx_getNumberOF vgetnf
+
+define vx_colByAttr vcbatr
+define vx_colByName vcbnam
+define vx_colByUCD vcbucd
+define vx_colByID vcbyid
+
+define vx_findByAttr vfindr
+define vx_findInGroup vfindp
+define vx_nextInGroup vnextp
+
+define vx_getNext vgetnt
+define vx_getSibling vgetsg
+define vx_getChild vgetcd
+define vx_getParent vgetpt
+define vx_ChildOfType vchile
+define vx_valueOf vvaluf
+define vx_typeOf vtypef
+define vx_setValue vsetve
+define vx_getValue vgsval
+define vx_getIntValue vgival
+define vx_getRealValue vgrval
+define vx_setAttr vsetar
+define vx_getAttr vgetar
+define vx_writeXML vwritl
diff --git a/lib/xalloc.h b/lib/xalloc.h
new file mode 100644
index 00000000..3dee2c04
--- /dev/null
+++ b/lib/xalloc.h
@@ -0,0 +1,6 @@
+# XALLOC.H -- Defines for xalloc.x (the device allocation package).
+
+define DV_DEVFREE 1 # device is free and can be allocated
+define DV_DEVALLOC 2 # device is already allocated
+define DV_DEVINUSE 3 # device is in use by someone else
+define DV_DEVNOTFOUND 4 # device not in device table
diff --git a/lib/xwhen.h b/lib/xwhen.h
new file mode 100644
index 00000000..4f87626e
--- /dev/null
+++ b/lib/xwhen.h
@@ -0,0 +1,7 @@
+# XWHEN.H -- Exception handling definitions.
+
+define X_ACV 501 # access violation
+define X_ARITH 502 # arithmetic error
+define X_INT 503 # keyboard interrupt
+define X_IPC 504 # write to IPC with no reader
+define X_IGNORE NULL # ignore exception
diff --git a/lib/yaccpar.x b/lib/yaccpar.x
new file mode 100644
index 00000000..71a323b4
--- /dev/null
+++ b/lib/yaccpar.x
@@ -0,0 +1,238 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# Parser for yacc output, translated to the IRAF SPP language. The contents
+# of this file form the bulk of the source of the parser produced by Yacc.
+# Yacc recognizes several macros in the yaccpar input source and replaces
+# them as follows:
+# A user suppled "global" definitions and declarations
+# B parser tables
+# C user supplied actions (reductions)
+# The remainder of the yaccpar code is not changed.
+
+define yystack_ 10 # statement labels for gotos
+define yynewstate_ 20
+define yydefault_ 30
+define yyerrlab_ 40
+define yyabort_ 50
+
+define YYFLAG (-1000) # defs used in user actions
+define YYERROR goto yyerrlab_
+define YYACCEPT return (OK)
+define YYABORT return (ERR)
+
+
+# YYPARSE -- Parse the input stream, returning OK if the source is
+# syntactically acceptable (i.e., if compilation is successful),
+# otherwise ERR. The parameters YYMAXDEPTH and YYOPLEN must be
+# supplied by the caller in the %{ ... %} section of the Yacc source.
+# The token value stack is a dynamically allocated array of operand
+# structures, with the length and makeup of the operand structure being
+# application dependent.
+
+int procedure yyparse (fd, yydebug, yylex)
+
+int fd # stream to be parsed
+bool yydebug # print debugging information?
+int yylex() # user-supplied lexical input function
+extern yylex()
+
+short yys[YYMAXDEPTH] # parser stack -- stacks tokens
+pointer yyv # pointer to token value stack
+pointer yyval # value returned by action
+pointer yylval # value of token
+int yyps # token stack pointer
+pointer yypv # value stack pointer
+int yychar # current input token number
+int yyerrflag # error recovery flag
+int yynerrs # number of errors
+
+short yyj, yym # internal variables
+pointer yysp, yypvt
+short yystate, yyn
+int yyxi, i
+errchk salloc, yylex
+
+$A # User declarations go here.
+$B # YACC parser tables defining the finite automaton go here.
+
+begin
+ call smark (yysp)
+ call salloc (yyv, (YYMAXDEPTH+2) * YYOPLEN, TY_STRUCT)
+
+ # Initialization. The first element of the dynamically allocated
+ # token value stack (yyv) is used for yyval, the second for yylval,
+ # and the actual stack starts with the third element.
+
+ yystate = 0
+ yychar = -1
+ yynerrs = 0
+ yyerrflag = 0
+ yyps = 0
+ yyval = yyv
+ yylval = yyv + YYOPLEN
+ yypv = yylval
+
+yystack_
+ # SHIFT -- Put a state and value onto the stack. The token and
+ # value stacks are logically the same stack, implemented as two
+ # separate arrays.
+
+ if (yydebug) {
+ call printf ("state %d, char 0%o\n")
+ call pargs (yystate)
+ call pargi (yychar)
+ }
+ yyps = yyps + 1
+ yypv = yypv + YYOPLEN
+ if (yyps > YYMAXDEPTH) {
+ call sfree (yysp)
+ call eprintf ("yacc stack overflow\n")
+ return (ERR)
+ }
+ yys[yyps] = yystate
+ YYMOVE (yyval, yypv)
+
+yynewstate_
+ # Process the new state.
+ yyn = yypact[yystate+1]
+
+ if (yyn <= YYFLAG)
+ goto yydefault_ # simple state
+
+ # The variable "yychar" is the lookahead token.
+ if (yychar < 0) {
+ yychar = yylex (fd, yylval)
+ if (yychar < 0)
+ yychar = 0
+ }
+ yyn = yyn + yychar
+ if (yyn < 0 || yyn >= YYLAST)
+ goto yydefault_
+
+ yyn = yyact[yyn+1]
+ if (yychk[yyn+1] == yychar) { # valid shift
+ yychar = -1
+ YYMOVE (yylval, yyval)
+ yystate = yyn
+ if (yyerrflag > 0)
+ yyerrflag = yyerrflag - 1
+ goto yystack_
+ }
+
+yydefault_
+ # Default state action.
+
+ yyn = yydef[yystate+1]
+ if (yyn == -2) {
+ if (yychar < 0) {
+ yychar = yylex (fd, yylval)
+ if (yychar < 0)
+ yychar = 0
+ }
+
+ # Look through exception table.
+ yyxi = 1
+ while ((yyexca[yyxi] != (-1)) || (yyexca[yyxi+1] != yystate))
+ yyxi = yyxi + 2
+ for (yyxi=yyxi+2; yyexca[yyxi] >= 0; yyxi=yyxi+2) {
+ if (yyexca[yyxi] == yychar)
+ break
+ }
+
+ yyn = yyexca[yyxi+1]
+ if (yyn < 0) {
+ call sfree (yysp)
+ return (OK) # ACCEPT -- all done
+ }
+ }
+
+
+ # SYNTAX ERROR -- resume parsing if possible.
+
+ if (yyn == 0) {
+ switch (yyerrflag) {
+ case 0, 1, 2:
+ if (yyerrflag == 0) { # brand new error
+ call eprintf ("syntax error\n")
+yyerrlab_
+ yynerrs = yynerrs + 1
+ # fall through...
+ }
+
+ # case 1:
+ # case 2: incompletely recovered error ... try again
+ yyerrflag = 3
+
+ # Find a state where "error" is a legal shift action.
+ while (yyps >= 1) {
+ yyn = yypact[yys[yyps]+1] + YYERRCODE
+ if ((yyn >= 0) && (yyn < YYLAST) &&
+ (yychk[yyact[yyn+1]+1] == YYERRCODE)) {
+ # Simulate a shift of "error".
+ yystate = yyact[yyn+1]
+ goto yystack_
+ }
+ yyn = yypact[yys[yyps]+1]
+
+ # The current yyps has no shift on "error", pop stack.
+ if (yydebug) {
+ call printf ("error recovery pops state %d, ")
+ call pargs (yys[yyps])
+ call printf ("uncovers %d\n")
+ call pargs (yys[yyps-1])
+ }
+ yyps = yyps - 1
+ yypv = yypv - YYOPLEN
+ }
+
+ # ABORT -- There is no state on the stack with an error shift.
+yyabort_
+ call sfree (yysp)
+ return (ERR)
+
+
+ case 3: # No shift yet; clobber input char.
+
+ if (yydebug) {
+ call printf ("error recovery discards char %d\n")
+ call pargi (yychar)
+ }
+
+ if (yychar == 0)
+ goto yyabort_ # don't discard EOF, quit
+ yychar = -1
+ goto yynewstate_ # try again in the same state
+ }
+ }
+
+
+ # REDUCE -- Reduction by production yyn.
+
+ if (yydebug) {
+ call printf ("reduce %d\n")
+ call pargs (yyn)
+ }
+ yyps = yyps - yyr2[yyn+1]
+ yypvt = yypv
+ yypv = yypv - yyr2[yyn+1] * YYOPLEN
+ YYMOVE (yypv + YYOPLEN, yyval)
+ yym = yyn
+
+ # Consult goto table to find next state.
+ yyn = yyr1[yyn+1]
+ yyj = yypgo[yyn+1] + yys[yyps] + 1
+ if (yyj >= YYLAST)
+ yystate = yyact[yypgo[yyn+1]+1]
+ else {
+ yystate = yyact[yyj+1]
+ if (yychk[yystate+1] != -yyn)
+ yystate = yyact[yypgo[yyn+1]+1]
+ }
+
+ # Perform action associated with the grammar rule, if any.
+ switch (yym) {
+ $C # YACC replaces this line by the user supplied actions.
+ }
+
+ goto yystack_ # stack new state and value
+end