/*
 * hztty -- version 1.1
 *
 * This program creates a pseudo terminal on top of cxterm that
 * facilitates you to read/write Chinese characters in different
 * encoding or different representation, such as the zW/HZ standard.
 * It turns the current cxterm session into the "new encoding aware"
 * cxterm and creates a new shell session for you.  
 *
 * This program must be run on top of cxterm.  (It's possible to run
 * in a terminal that supports Chinese, like kermit on CCDOS, ET, KC,
 * or Chinese Windows, etc.) 
 *
 * The conversion is implemented in a configurable I/O stream style.
 * Conversion modules are specified in command line options "-O" (for
 * output) and "-I" (for input).  In each direction, conversion modules
 * can be piped one to one using connection character ':'.  For example,
 * specifying "hz2gb:gb2big" in output stream translate the cxterm screen
 * output from zW/HZ to GB, then from GB to Big5.  
 * 
 *	Yongguang ZHANG 		(ygz@cs.purdue.edu)
 *	Purdue University		August 4, 1992
 */


WHAT IS IT
----------
	It shows zW/HZ directly on cxterm, saving your effort to read
	HZ off-line.  It provides zW/HZ input by the powerful cxterm
	input functions.

	It can also show GB or zW/HZ codes directory on Big5 cxterm,
	or on a terminal emulator in ETen DOS.  It can also show Big5
	codes on GB cxterm.  Hence, you don't need to do hcu or b2g
	just to read it.

HOW TO MAKE
-----------
	Type "make".  Follow what it tells you.

HOW TO RUN
----------
	In the cxterm, type "hztty".
	To exit it, exit the new shell that it invoked for you.

	"hztty" can also be used for these purposes:

	 -- To use GB on a Big5 cxterm:  (Big5)
		hztty -I big2gb -O gb2big

	 -- To use GB on a terminal session (e.g. kermit) on ETen DOS:
		hztty -I big2gb -O gb2big

	 -- To use zW/HZ or GB on a Big5 cxterm:
		hztty -I big2gb:gb2hz -O hz2gb:gb2big

	 -- To use zW/HZ or GB on a terminal session on ETen DOS:
		hztty -I big2gb:gb2hz -O hz2gb:gb2big

	All combination are possible, check hztty.1 for details.

NOTICES
-------
	For zW/HZ session, this is _NOT_ a coding-to-coding decoder
	or encoder.  It is your responsibility to conform the HZ
	specification.  This program does not enforce any standard.
	Put all Chinese characters and only Chinese characters
	inside ~{  ~} pairs.  Read the HZ.spec carefully.

	In zW/HZ session, since all the code in zW/HZ encoding are 7-bit,
	"celvis" or "cless" are no long meaningful.  You can simply use
	"vi" or "more".

	Since it's basically a screen viewer, it is impossible to check
	the HZ code for you.  If you put the wrong thing inside ~{  ~}
	pair, you will mess up the line when other people reads it. Go
	double-check it (by redrawing the screen) before posting or mailing.
	Also, don't make your cxterm narrower than 80 columns.

	This is a preliminary release and it is far from satisfaction.
	There are a few notable problems:

	1.  Sometimes it fails to show a HZ even it is in the HZ mode,
	    especially when you are doing editing (e.g. in "vi").
	    In this case you need to redraw the screen (e.g. by 'Ctrl-L')
	    from time to time.  This's a big bug.

	2.  If your cxterm is not 80x24 at the time your run hztty,
	    you may have to type "resize".

PORTABILITY
-----------
	I have strived to make it work for you.  However I simply
	don't have many types of computers to test it.  I expect to
	see some problems in other kind of machines.  If any of these
	comes out, please let me know.  Or, if you have fixed it,
	I appreciate that you can tell me.

CONTRIBUTORS & TERMS
--------------------
	For an incomplete list of the contributors, see the man page (hztty.1).

	Permission to use, copy, modify, and redistribute is hereby granted.
	The author(s) disclaims all warranties with regarding to this software.

TODO
----
	Lots of them.  Just don't have time.

	To fix all the problems listed above.  They requires the program
	to keep a copy of the screen and parse for every output characters.
	(That is, to implement vt102, what a pain!)

	To add escape keys -- 1) to turn the conversion on/off, 2) to stop
	and escape back to the parent shell.

	Dynamically drop and add conversion modules.

	The following BIG jobs can be done after implementing
	a vt102 in hztty:

	1)  Add conversion modules to facilitate Chinese input.
	    For example, we can write an input module that captures each
	    hanzi you just typed and prompts a list of associated words.
	    Phrase input or associative input can be implemented this way.
	    Hope someone can try this.  Good for a term project.

	2)  With the input/output stream structure, you can easily add
	    real crazy stuffs.  For example, you can add a module that
	    turns everything into upper case, or, a module that does
	    rot-13 on every characters your type.
