
icn2txt & txt2icn / icon-text converter for the HP100/200LX
ver 1.20 (August 15, 1998)
chawa (Naohiko Kawamura) <chawa.kawamura@nifty.ne.jp>



[0] Packing List
This package contains following files.
  icn2txte.txt  This file.
  icn2txtj.txt  Explanation in Japanese. (same as icn2txte.txt)
  icn2txt.exe   icon to text converter
  icn2txt.c     source code of icon to text converter
  txt2icn.exe   text to icon converter
  txt2icn.c     source code of text to icon converter
  icons.txt     icons I have made.
                they can be decoded as 'txt2icn -h icons.txt'
  sample\       This directory contains a following collection
                of sample usage of icn2txt and txt2icn:
     reverse.bat   batch file to make a reverse (negative)
                   image of an icon
     shiftu.bat    to shift up by 1 dot
     shiftd.bat    to shift down by 1 dot
     shiftr.bat    to shift right by 1 dot
     shiftl.bat    to shift left by 1 dot
     ud.bat        to mirror image upside down
     rl.bat        to mirror image right to left
     folder.bat    to paste an icon on folder
     folder.awk    awk script for folder.bat
     document.bat  to paste an icon on blank document
     folder.awk    awk script for document.bat


[1] Introduction
One of the pleasures of using the HP100/200LX is that you can
make an icon for it by yourself.  I made icn2txt and txt2icn to
support this creativity of yours.  These two software enable
bidirectional conversion between binary icon file (in *.icn
format) and text files.


[2] icn2txt

(1) Usage
  From DOS prompt, enter
      A:\>icn2txt [options] (Icon file names)
  Plural icon files can be specified. You can also use wildcard
  characters.  Output is made to the files of the same name
  with the extension changed to ".TXT".  Black and white dots of
  an icon is converted to 1 and 0 in text.

(2) Options
  Parameters beginning with '-' or '/' are options, which modifies
  how the files are converted.

  Following options are available:
  -w : overwrite even if output file exists
  -s : output to standard output (stdout).
  -o(outfile) : Specify filename for output. If you like to
       use a name other than the default, put this option.  An
       output file should be specified.
  -n[a] : set 'a' as ON character (black part of an icon).
       '-n' without character makes a blank space as ON
       character.
  -f[b] : set 'b' as OFF character (white part of an icon).
       '-f' without character makes a blank space as OFF
       character.
  -h : add Header(s)
       add header(s) to the output file. Added header is as
       'ICON=xxx.icn' (xxx is the original name)

(3) Examples

  Following are examples of conversion, using FD.ICN, an icon
  for 3.5-inch floppy disk from 3-D view point.

  Example 1: Normal usage
        A:\>icn2txt fd.icn
    FD.ICN is converted to a text file and output to FD.TXT.
    If these is already FD.TXT, you will receive a message
    such as:
        Output file fd.txt already exists. Overwrite? (y/else)
    Press 'y' or 'Y' to overwrite or any other keys to exit.

  Example 2: Use with wildcard character.
        A:\>icn2txt *.icn
    If you have two icon files FD1.ICN and FD2.ICN, the they
    are converted and output to FD1.TXT and FD2.TXT.

  Example 3: With -w option
        A:\>icn2txt -w fd.icn
    With this option, ICN2TXT unconditionally overwrites
    FD.TXT, even if it exists. (If no '-w' option is specified,
    ICN2TXT inquires whether to overwrite or not).

  Example 4: -s option
        A:\>icn2txt -s fd.icn
    Output is made immediately to screen.  This output can be
    redirected.  By combining wildcard characters and
    redirection with this option, you can make one file out of
    several icons.  For example,
        A:\>icn2txt -s *.icn > aaa
    will collect all the icon files in aaa.

  Example 5: -o option
        A:\>icn2txt -otemp.txt fd.icn
    will make output to TEMP.TXT, instead of FD.TXT.

  Example 6: -n option
        A:\>icn2txt -n* fd.icn
    This makes '*' a ON character. If only '-n' is specified,
    a blank space will be the ON character.

  Example 7: -f option
        A:\>icn2txt -f* fd.icn
    Similar to '-n', this makes '*' a OFF character. If only
    '-f' is specified,a blank space will be the OFF character.

  Example 8: -h option
        A:\>icn2txt -h fd.icn
    Add a header 'ICON=fd.icn' as the first line of the output.

  Following are examples with varied options:

A:\>icn2txt fd.icn
00000001110000000000000000000000000000000000
00000111001110000000000000000000000000000000
00000111111001110000000000000000000000000000
00000111110111001110000000000000000000000000
00000111110000111001110000000000000000000000
00000111110000100111001110000000000000000000
00000111110000100000111001110000000000000000
00000111110000100000000111001110000000000000
00000111110000100000000000111011000000000000
00000111110000100000000110011110100000000000
00000111110000100000000111011111010000000000
00000111111000100000000111011111110000000000
00000111111111100000000111011111010000000000
00000111000111111000000111011111110000000000
00000111000000111111000011011111010000000000
00000111000000000111111000011111110000000000
00000111000111000000111111011111010000000000
00000111000000111000000111111111110000000000
00000111000000000111000000111111010000000000
00000111000111000000111000000111110000000000
00000111000000111000000111000111010000000000
00000111000000000111000000000111110000000000
00000111000111000000111000000111010000000000
00000111000000111000000111000111111000000000
00000000111000000111000000000111010101000000
00000000000111000000111000000111111010100000
00000000000000111000000111000111010101000000
00000000000000000111000000000111111010000000
00000000000000000000111000000111010100000000
00000000000000000000000111000111111000000000
00000000000000000000000000111111010000000000
00000000000000000000000000000111100000000000

A:\>icn2txt -nX -f fd.icn
       XXX
     XXX  XXX
     XXXXXX  XXX
     XXXXX XXX  XXX
     XXXXX    XXX  XXX
     XXXXX    X  XXX  XXX
     XXXXX    X     XXX  XXX
     XXXXX    X        XXX  XXX
     XXXXX    X           XXX XX
     XXXXX    X        XX  XXXX X
     XXXXX    X        XXX XXXXX X
     XXXXXX   X        XXX XXXXXXX
     XXXXXXXXXX        XXX XXXXX X
     XXX   XXXXXX      XXX XXXXXXX
     XXX      XXXXXX    XX XXXXX X
     XXX         XXXXXX    XXXXXXX
     XXX   XXX      XXXXXX XXXXX X
     XXX      XXX      XXXXXXXXXXX
     XXX         XXX      XXXXXX X
     XXX   XXX      XXX      XXXXX
     XXX      XXX      XXX   XXX X
     XXX         XXX         XXXXX
     XXX   XXX      XXX      XXX X
     XXX      XXX      XXX   XXXXXX
        XXX      XXX         XXX X X X
           XXX      XXX      XXXXXX X X
              XXX      XXX   XXX X X X
                 XXX         XXXXXX X
                    XXX      XXX X X
                       XXX   XXXXXX
                          XXXXXX X
                             XXXX

a:\>icn2txt -f. -h fd.icn
ICON=fd.icn
.......111..................................
.....111..111...............................
.....111111..111............................
.....11111.111..111.........................
.....11111....111..111......................
.....11111....1..111..111...................
.....11111....1.....111..111................
.....11111....1........111..111.............
.....11111....1...........111.11............
.....11111....1........11..1111.1...........
.....11111....1........111.11111.1..........
.....111111...1........111.1111111..........
.....1111111111........111.11111.1..........
.....111...111111......111.1111111..........
.....111......111111....11.11111.1..........
.....111.........111111....1111111..........
.....111...111......111111.11111.1..........
.....111......111......11111111111..........
.....111.........111......111111.1..........
.....111...111......111......11111..........
.....111......111......111...111.1..........
.....111.........111.........11111..........
.....111...111......111......111.1..........
.....111......111......111...111111.........
........111......111.........111.1.1.1......
...........111......111......111111.1.1.....
..............111......111...111.1.1.1......
.................111.........111111.1.......
....................111......111.1.1........
.......................111...111111.........
..........................111111.1..........
.............................1111...........

(4) Notes:
  o No check is done for double byte character set.  There are
    no guarantees that -n or -f option works with double byte
    character.
  o If plural files are specified with -o option, including the
    usage of wildcard characters, output is made only for the
    last file.  If you like to combine plural files, please use
    '-s' with redirection.


[3] txt2icn

(1) Usage of txt2icn

  From DOS prompt, enter:
      A:\>txt2icn [options] (text file name)
  Plural test files can be specified.  You can also use
  wildcard characters.  Output is made to the files of the same
  name with the extension changed to ".ICN".  Character '1' is
  converted to a  black dot of icon image. Other characters are
  converted to a white dot.

  A standard icon has 44 dots (horizontal) by 32 dots
  (vertical).  Therefore you need 44 character by 32 lines in
  text file. If you set less than this, the other area is
  filled with white dots.

(2) Options

  Parameters beginning with '-' or '/' are options, in the
  same manner as in icn2txt.  Following options are available:

  -w : overwrite even if output icon file exists
  -s : input from standard input.  You should not specify input
       file name with this option. If you do, this option is
       canceled and input is read from the file.  If the
       output file is not specified, filename 't2i.icn' will be
       used.

  -o(icnfile) : Specify output file-name. If you like to use a
       name other than the default, use this option.  Put no
       space between '-o' and filename. An output file should
       be specified
  -n[a] : set 'a' as ON character (black part of an icon).
       '-n' without character makes a blank space as ON
       character.
  -h : recognize Header(s)
       recognize header(s) which were added by icn2txt with -h
       option.  With this option, headers are searched to
       the bottom line of the input text file.  When headers
       appear more than 2 times, every icon-files shall be
       decoded.
       Using this option, you do NOT have to extract the icon
       parts from the text.

  Unlike icn2txt, you cannot use '-f' option, since all
  characters other than ON character are regarded as OFF
  character.

(3) Examples

  Following are examples of conversion from text to icon.

  Example 1: Normal usage
        A:\>txt2icn fd.txt
    FD.TXT is converted to an icon file and output to FD.ICN.
    If these is already FD.ICN, you will receive a message
    such as:
        Output file fd.icn already exists. Overwrite? (y/else)
    Press 'y' or 'Y' to overwrite or any other keys to exit.

  Example 2: Use with wildcard character.
        A:\>txt2icn *.txt
    If you have two files FD1.TXT and FD2.TXT, then they
    are converted and output to FD1.ICN and FD2.ICN.

  Example 3: With -w option
        A:\>txt2icn -w fd.txt
    With this option, TXT2ICN unconditionally overwrites
    FD.ICN, even if it exists. (If no '-w' option is specified,
    TXT2ICN inquires whether to overwrite or not).

  Example 4: -s option
        A:\>txt2icn -s <fd.txt
    This has a same effect as 'txt2icn -ot2i.icn fd.txt'.This
    option is for redirection or pipe.  Please refer to the
    sample batch files or awk scripts for its utilization.

  Example 5: -n option
        A:\>txt2icn -n* fd.icn
    This makes '*' a ON character. If only '-n' is specified,
    a blank space will be the ON character.

  Example 6: -h option
    For example, let this text execute with -h option.
        A:\>txt2icn -h icn2txte.txt
    In this text, 'ICON=fd.icn'  exists at the 194th
    line.  The following 44 lines are decoded to the icon file.
    Furthermore, plural icon can be described in a text file
    because all headers shall be searched.


(4) Note

  o No check is done for double byte character set.  There are
    no guarantees that -n or -f option works with double byte
    characters.  If the text file has double byte characters,
    second byte may be ON character by coincidence.  No check
    is done for such a case.


[4] Source code

  I have attached the source codes.  You can modify it, if it
  is for your personal pleasure.

  The programs were compiled by LSI-C trial version.  No
  compiler options are necessary.  No other compilers were
  tested.

  You are not permitted to criticize that my source code is
  ugly.  You are however very welcome to point out bugs in
  it.


[5] Sample programs

  Simple batch files which uses icn2txt and txt2icn are
  included in this release.  You need GAWK to run them.
   (Please edit batch files and replace JGAWK to GAWK.)
  The original icon file is overwritten.  Please make
  a backup as needed before running them.

  o reverse.bat   makes a reverse (negative) image of an icon
  o shiftu.bat    shifts up by 1 dot
  o shiftd.bat    shifts down by 1 dot
  o shiftr.bat    shifts right by 1 dot
  o shiftl.bat    shifts left by 1 dot
  o ud.bat        makes mirror image, upside down
  o rl.bat        makes mirror image, right to left
  o folder.bat    pastes an icon on folder (FOLDER.AWK should
                  be in the current directory)


[6] Copyright and others
  The copyright of the software in this package, including this
  document,  is owned by its author, chawa
  (chawa.kawamura@nifty.ne.jp).

  Redistribution is free, only if the following conditions are
  met.
  o No change should be made in the contents and structure
    of the archive.
  o The update should be made if new version of this software
    appears on the original site.
  o No modified version of this software should be distributed.
    The source code in the package should be used only as a
    reference.



[7] Special thanks
  Mr. Sasabe has translated this document to English and uploaded
  to CompuServe.
  Mr. NORI introduced to the HP Palmtop Paper Jan/Feb 1997.
  And many persons have given me many encouragements.
  I am very thankful to all of them.



[8] Last words
  One of the advantage of this program is that you can post
  your icons in forums or newsgroup directly in text mode for
  easy viewing and discussion.  (Formerly you had to use binary
  to text encoder such as Uuencode or Ish, which produce
  unreadable garbage of characters).

  You can also use your favorite editor to make an icon, using
  the abundance of editing features not available on normal
  icon editors.

  I hope this program will bring you more joy in using your
  palmtop.

                                     chawa (Naohiko Kawamura)
                                     chawa.kawamura@nifty.ne.jp

[Revision History]

1995/ 9/30 ver.0.50:
    - first release
1995/10/18 ver.1.00:
    - Official release (Can't stay with beta forever)
    - Added option '-w'
    - Checks existence of files
1995/10/20 ver.1.01 (not released):
    - Bug removal (fopen and fclose pairs didn't match)
1996/ 2/ 2 ver.1.02 (not released):
    - Introduced function _dos_getfileattr() for checking of
      existence of a file.
1996/ 5/ 1 ver.1.10:
    - Added option '-s' to txt2icn.
    - Introduced int 16h for keyboard input to remove side
      effect of newly added option '-s' in redirection,
    - Added sample batch files.
1998/ 8/15 ver.1.20:
    - Added option '-h'
    - Bug removal (terminate program execution when illegal option)
    - 'fd.icn' in this document is modified.
    - Among the samples, folder.awk is modified, document.bat
      and document.awk are added.
