------------------------------------------------------------------ Hz, Uuencode/uudecode, GB converting program (HUG) Copyright (C) 1995 by Yinrong Huang. All rights reserved. This file contains GB codes for clarity. If it happens that you are unable to figure out these GB codes, then you should quit reading it and try to get a Chinese word processor or operating system, or you can run this HUG program to change it to HZ format if you have HZ view system. This version HUG program tries to out-smart the old gb2hz program which is available for different operating systems by implementing the following functions: ------------------------------------------------------------------ 1. Copyright notice. No portion of this document may be sold or put to commercial use without express written consent of the author. This restriction covers publication in any form, or distribution by any method, which permits this document to be visually perceived, either directly or with the aid of any machine or device. Permission is granted to the public to use this software package or redistribute this package in its entirety for noncommercial use if this copyright notice is not removed or altered and this document is redistributed along with the software. --------------------------------------------------------------------------- 2. Warranty and suitability of this utility program. Even though the author has made tremendous effort to program this utility program, this program is provided to you without warranty of any kind, written and/or implied, for the suitability of the program. The users of the program are solely responsible to evaluate its usefulness in your environment. ---------------------------------------------------------------------- 3. Brief introduction: This program can do simply uuencode/uudecode functions, can map a GB file and then convert to HZ, GB or uuencoded file, can directly uudecode a uuencoded GB file and convert to HZ, GB or uuencoded file, can read from HZ file and change it to GB, HZ or uuencoded file. This program can also output multiple uuencoded files from one source and/or put multiple uuencoded files back to one original file. It can let you decide the normal uuencode line wide or uue78. When it read from HZ file, it will give you a chance to fix the old HZ file with long single lines produced by gb2hz without -t option. When it maps, it will give you the options to separately map ASCII letters, digitals, or punctuations into GB codes and it will refuse to change true email and IP number into GB codes ( I mean, 0x80 ). (So that others can just copy and use the addresses or IP numbers.) When it converts codes into HZ, it will give you the option to choose line wide and 7-th bit on/off. It will smartly have an intelligent switch ASCII letters/digital/punctuations to or from corresponding GB codes. For example, if there is an ASCII comma between two Chinese chars, the comma will automatically to GB code to miminize the appearance of ~ { and ~ } which you hate so much. By the way, it will case the English up or lower even though it still doesn't intelligently keep Chinese or Washington etc intact. :-) ---------------------------------------------------------------------- 4. Functions and options: a). GB map function includes the conversion of a few FanTi GB codes into their corresponding JianTi GB codes. Original GB code Mapped GB code ~{aa#(~}E1 E1) ~{:s#(~}BA F3) ~{wa#(~}F7 E1) ~{C4#(~}C3 B4) ~{l6#(~}EC B6) ~{SZ#(~}D3 DA) ~{ag#(~}E1 E7) ~{Uw#(~}D5 F7) ~{!8#(~}A1 B8) ~{!0#(~}A1 B0) ~{!9#(~}A1 B9) ~{!1#(~}A1 B1) ~{bE#(~}E2 C5) ~{S`#(~}D3 E0) b). Tab byte (09h \t) will be changed to 4 (or user-defined) (A1 A1) (GB space) if it is located in GB and HZ block, or 8 ASCII spaces if it appears in English block. option -t[number] [] should not appear in your option. So if -t5, then one Tab is mapped to 2 (A1 A1) or 5 ASCII spaces. This option will be invalid with input option -ib or output option -ob. c). ASCII spaces (20h) will be mapped to corresponding GB space. (2n + 1) spaces will be mapped to n (A1 A1) or remain unchange depending on output file mode and/or block mode(HZ or English). d). ASCII number (1-20) plus an ASCII dot '.' to ONE corresponding GB character (2 bytes). A number followed by an dot is often used as index number in HXWZ TOC. Spaces and/or Tab can exist between the number and the dot, but absolutely not others. All these spaces and Tab are skipped. For example: Original codes Mapped GB code 1. ~{"1#(~}A2 B1) 20. ~{"D#(~}A2 C4) e). Unjustified spaces and tabs are deleted. f). Check out-of-range GB characters, ASCII control bytes and other bug bytes and fix them if possible or indicate something is wrong there. g). ( 0Dh \r CR) or (0Ah \n LF) will be changed to 0Dh, 0Ah pair if either one is missing. h). ASCII letters, punctuations, numbers are mapped to corresponding GB codes (really Chinglish to my understanding :-) ). However, email addresses and Internet IP numbers will not changed even though options for them are chosen. Options What it does -md Change ASCII digits to GB ones -me Change letters to GB ones -mp Change ASCII punctuations into GB ones (The above options will be valid only with options -og (for output GB file) or -ou (for output uuencoded GB file). Normally the default output file is HZ file, therefore these -mx options are invalid. The above three options can be used together. For example: Original codes Mapped GB code << ~{!6!!:sJiR}:E#(~}A1 B6) >> ~{!7!!G0JiR}:E#(~}A1 B7) [[ ~{!>#(~}A1 BE) ]] ~{!?#(~}A1 BF) ...... ~{!-!-!!J!BT:E#(~}A1 AD A1 AD) ` ~{!"!!6Y:E#(~}A1 A2) i). You can choose the output file mode, GB, HZ, Uuencoded GB or a binary file ( a simple uudecode function). If output file option is missing, then default HZ mode is taken. Options What it does -ob Uudecode a uuencoded file to its original. Other options are useless if this one is chosen. ( You don't want a piece of junk codes in your original file, do you?) -og Output a GB file, -mx options are valid with GB output. -oh Output a HZ file, which is default. Other valid options along with this are -h[num], -hf, -hn, -ho, -us as well as -c -e -t. -ou Output a uuencoded GB file, other valid options are -ub -ul -un -us -md -me -mp as well as -c -e -t. The above options are exclusive. Only one option can be chosen at a time. If omitted, the default is -oh. j). Input file mode can be chosen to allow the file be uuencoded only. Usually this option can be omitted since the program itself tries to detect the file mode. -i Uuencode a file, binary or not. Other valid options are -ub -ul -un -us. k). HZ input or output options: Options What it does -h[num] The limit for chars per line if output mode, chosen or default, is HZ. The minimum size is 40, the default size ( maximum ) is 78. -hf Fix original HZ file( such as those produced by old gb2hz without -t option) for possible line wrap-up. -hn New HZ format(8-bit) off, default 8-bit. -ho Old style with ~ to indicate the continuation of a long line. -hw Make hard-returned line into a continuous line. The above options can be used together. But not allowed are those such as -hfn. You keep each option as one single unit. l). Uuencode/uudecode options: Options What it does -ub[num] One uuencode file size limit due to the fact some email gateways don't support emails with big size. The limit is in bytes. -ul[num] One uuencode file size limit due to the fact some email gateways don't support emails with big size. The limit is in lines. Both above options will break the original file into a few uuencoded files if the original is a big file. Filename will be ended with uu0 (with option -ib) or ug0 (with option -ou). The number will increase to 9 and further into letters (a..z). The byte limit will be changed to line limit depending on the line wide. The default uuencoded line wide is 78, the minimum line size is 400 and the maximum is 800, for norrow line size (62), minimum is 500, maximum is 1000. If neither of above options is chosen for a uuencoded file, then the uuencoded file will be a single one no matter how big the original can be. -un 62 chars per uuencoded line ( default 78 ) -us Skip comments in the original uuencoded file, default is not skip. m). Skip the comment line about the source file mode and target file mode: -d Turn the display of comment line off (default on). n). Options can start wigh - or / (For DOS option swithc), however one option MUST NOT be separated by space or tabs. Any string without - or / will be taken as a filename. Now, it takes multiple files even though each filename shouldn't contain any wildcards such as * or ?. If there are only two filenames, then the first one is taken as the input file, and the second one is considered as the output file. Otherwise, the output filename will be deduced from the original filenames with extensions reflecting output file mode. uu0 is for binary uuencoded, ug0 for uuencoded GB, hz for HZ file, and gb for GB file. If not clearly indicated, the input file will be taken as one kind of GB or HZ file even though the original files may actually be binary files. o). The further HUG program will prompt users for an answer if another file with the same filename as the output file exists. And it will take DOS system wildcard chars and check binary files (version 1.0 will not implement this procedure.) p). The shareware version only implements uuencoded GB, GB and HZ to HZ conversion, which will make others be unwilling to registrate since it is the main usage of it. :-) THANK you for your cooperation. ------------------------------------------------------------------