[ Page #2.2 ] [] [ colin ][ download ][ shieldwolf ] [][][][][][] [ ..|.|\).|).(=.)(.. ] [][][][][][]
Ascii-Art Picture Rotation Tools.
 Here's a short collection of Dos utilities for manipulating ASCII pictures.


	LR.BAT    - flip ascii-art picture left-right
	TB.BAT    - flip ascii-art picture top-bottom
	CW90.BAT  - rotate ascii-art picture 90 degrees
	CCW90.BAT - rotate ascii-art picture 270 degrees


 The four Dos scripts are rather simple. They use ASC-TOOL.EXE then
 use TR-386.EXE to process the output through a mapping of characters.


Contents

ASC-TOOL.ZIP :

  LR.BAT         1.125 Kb  flip ascii picture left-right
  TB.BAT         0.760 Kb  flip ascii picture top-bottom
  CW90.BAT       0.853 Kb  rotate clockwise 90 degrees
  CCW90.BAT      0.860 Kb  rotate counter-clockwise 90 degrees
  ASC-TOOL.EXE  11.402 Kb  ascii-art picture raw rotation tool (no DPMI required)
  ASC-TOOL.TXT   1.203 Kb  brief help page for ASC-TOOL.EXE
* ASC-T386.EXE  36.864 Kb  ascii-art picture raw rotation tool (i386 version)
* TR-386.EXE    51.200 Kb  unix character translation tool (i386 version)
* SED-386.EXE   73.216 Kb  unix stream editor (i386 version)
+ CWSDPMI.EXE   20.217 Kb  DPMI support for i386 executables
  CWSDPMI.DOC    7.060 Kb  documentation sheet for CWSDPMI.EXE
  CWSPARAM.EXE  13.134 Kb  CWSDPMI.EXE setup/support file
  CWSPARAM.DOC   4.425 Kb  documentation sheet for CWSPARAM.EXE

* requires 386 or higher and CWSDPMI.EXE
+ requires 386 or higher

Techno :

-:- ABSOLUTELY NO WARRANTY -:-

 ASC-TOOL.EXE was compiled from ASC-TOOL.C using Turbo-C v2.01
 ASC-T386.EXE was compiled from ASC-TOOL.C using DJGPP v2.07
 TR-386.EXE   was compiled from Linux TR.C using DJGPP v2.07
 SED-386.EXE  pre-compiled GNU copyright SED v1.18
 CWSDPMI.EXE  pre-compiled 32bit v0.90+r1 © 1995 CW Sandmann

Description

In article <902466759.276187@mnementh.southern.co.nz>, Colin Douthwaite
 writes

Way back in 1994 I tried several times to tempt somebody to produce
executables for MS-DOS from the following material which contains
source code for Ascii Art Tools allowing rotation of existing Ascii
art pictures.

Does the project appeal to you?

I have never been successful in using compilers to compile
executables from source code. I always end up with too many errors I
cannot fix.


Here is the old posting containing the material:

========================================================================

From: jsbell@acs.ucalgary.ca (Joshua Bell)
Newsgroups: rec.arts.ascii,alt.binaries.pictures.ascii,alt.ascii-art,alt.binaries.pictures.utilities
Subject: [TECHNICAL] ASCII Tools (was Re: Flipping ASCII Pictures)
Date: 31 Jul 1994 08:58:59 -0500
Organization: University Computing Services (The University of Calgary)
Lines: 297
Sender: boba@gagme.wwa.com
Approved: boba@wwa.com
Message-ID: <31gan3$1l0@gagme.wwa.com>
NNTP-Posting-Host: gagme.wwa.com


Here's a short collection of Unix utilities for manipulating ASCII pictures.

Contents:

asciitool.c - Source posted in parent article, somewhat debugged.
              Does "raw" flips (no remapping)
lr          - /bin/sh script that flips ASCII left to right
              and maps character shapes (eg, [ --> ] )
              Here's a legal blurb from lr:

# Copyright (C) 1994 by Jef Poskanzer.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.  This software is provided "as is" without express or
# implied warranty.

tb          - Similar utility that does top-bottom flipping
              Requires asciitool
cw90        - Does clockwise 90 rotations. Requires asciitool
ccw90       - Does counterclockwise 90 rotations. Requires asciitool

The four shell scripts are rather simple. They simply use
asciitool (lr uses "rev", actually) then use tr to process the
output through a mapping of characters.

Syntaxes:

asciitool -{mh|mv|r90|r180|r270} [Infile [Outfile]]
   -mh          Mirror horizontally
   -mv          Mirror vertically
   -r90         Rotate 90 degrees counterclockwise
   -r180        Rotate 90 degrees counterclockwise
   -r270        Rotate 90 degrees counterclockwise

lr [Infile]
tb [Infile]
cw90 [Infile]
ccw90 [Infile]

(Infile defaults to standard input, Outfile defaults to standard output)

For example:

lr picture | tb > picture_rotated_180_degrees
cal | asciitool -r90

Note: None of these utilities rescale images or attempt to do
anything beyond the scope of a single character cell. So rotated
images are almost always going to be extremely distorted.

Examples: ($ is my prompt)

$ cat genie
                _.---.__
              .'        `-.
             /      .--.   |
             \/  / /    |_/
              `\/|/    _(_)
           ___  /|_.--'    `.   .
           \  `--' .---.     \ /|
            )   `       \     //|
            | __    __   |   '/||
            |/  \  /  \      / ||
            ||  |  |   \     \  |
            \|  |  |   /        |
           __\\@/  |@ | ___ \--'
          (     /' `--'  __)|
         __>   (  .  .--' &"\
        /   `--|_/--'     &  |
        |                 #. |
        |                 q# |
         \              ,ad#'
          `.________.ad####'
            `#####""""""''
             `&#"
              &# "&
              "#ba"
$ lr genie
                                                        __.---._
                                                     .-'        `.
                                                    |   .--.      \
                                                     \_|    \ \  \/
                                                     (_)_    \|\/'
                                               .   .'    `--._|\  ___
                                               |\ /     .---. `--'  /
                                               |\\     /       '   (
                                               ||\`   |   __    __ |
                                               || \      /  \  /  \|
                                               |  /     /   |  |  ||
                                               |        \   |  |  |/
                                                `--/ ___ | @|  \@//__
                                                   |(__  `--' `\     )
                                                   /"& `--.  .  )   <__
                                                  |  &     `--\_|--'   \
                                                  | .#                 |
                                                  | #p                 |
                                                   `#ba.              /
                                                    `####ba.________.'
                                                      ``""""""#####'
                                                               "#&'
                                                             &" #&
                                                             "ad#"
$ tb genie
              .#Pa.
              &# .&
             ,&#.
            ,#####........
          ,'~~~~~~~~'ad####.
         /              `ad#.
        |                 d# |
        |                 #' |
        \   ,--|~\--.     &  |
         ~~>   (  '  '--. &./
          (     \. ,--.  ~~)|
           ~~//@\  |@ | ~~~ /--.
            /|  |  |   \        |
            ||  |  |   /     /  |
            |\  /  \  /      \ ||
            | ~~    ~~   |   .\||
            )   ,       /     \\|
           /  ,--. '---'     / \|
           ~~~  \|~'--.    ,'   '
              ,/\|\    ~(~)
             /\  \ \    |~\
             \      '--'   |
              '.        ,-'
                ~'---'~~
$ tb genie | lr
                                                             .aP#.
                                                             &. #&
                                                               .#&.
                                                      ........#####.
                                                    .####ba`~~~~~~~~`.
                                                   .#ba'              \
                                                  | #b                 |
                                                  | `#                 |
                                                  |  &     .--/~|--.   /
                                                   \.& .--`  `  )   <~~
                                                   |(~~  .--. ./     )
                                                .--\ ~~~ | @|  /@\\~~
                                               |        /   |  |  |\
                                               |  \     \   |  |  ||
                                               || /      \  /  \  /|
                                               ||/.   |   ~~    ~~ |
                                               |//     \       .   (
                                               |/ \     `---` .--.  \
                                               `   `.    .--`~|/  ~~~
                                                     (~)~    /|/\.
                                                     /~|    / /  /\
                                                    |   `--`      /
                                                     `-.        .`
                                                        ~~`---`~
$ cw90 genie
      --\
     /   |
    /    |n
    .    v |     /|
   /|   /  |/---u |
  /#|   |  /--\   | /\
:&&#|   |  /   | / /\ .
####|   -n @   | | /  \
b :#|   | \\--/ /|\\   |
a: #|   \ \      \--\  .
:& :|   |.        |\   |
   :|   | /---\  .. \  |
   :.   \ |@   | ||  . |
   :a    .|    | ||  | .
   :d    |\-  /  |\  | |
   :#    |  \/   . | . |
   \#\   \ |    /  n- /
   \#a    ||   -   || |
    #dq#&&||       u\ .
    \##. :u       /  -
     \   /-/      .
      ---  | /\\ /
           |   \\
           \  --\\
            ------.
$ ccw90 genie
     .------
      \\--  \
       \\   |
      / \\/ |  ---
     .      /-/   \
  -  /       n: .##\
 . \n       ||&&#qd#
 | ||   -   ||    a#\
 / -u  /    | \   \#\
| . | .   /\  |    #:
| |  \|  /  -\|    d:
. |  || |    |.    a:
| .  || |   @| \   .:
|  \ ..  \---/ |   |:
|   \|        .|   |: &:
.  \--\      \ \   |# :a
|   \\|/ /--\\ |   |#: b
 \  / | |   @ u-   |####
 . \/ / |   /  |   |#&&:
  \/ |   \--/  |   |#/
     | n---/|  /   |/
     |/     | ^    .
             u|    /
              |   /
               \--



Joshua
========================================================================

Installation

 -=O[  Instructions to install Ascii-Tools  ]O=-
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1. unzip ASC-TOOL.ZIP to a directory (eg. C:\AT)
  2. add the directory (eg. C:\AT) to your PATH environment variable
    if you wish to run the batch-files from any location.
  3. run the batch-files from the Dos prompt.
    eg. lr <infile> <outfile>

Information

 -=O[  Brief Description of how these tools work  ]O=-
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The batch-files first call  ASC-TOOL.EXE  to perform raw flips and
  rotations of ascii-art pictures,

  like this :-

  type test1.asc

          }}---}

  asc-tool -mh test1.asc

          }---}}

  The output from ASC-TOOL.EXE is then piped to  TR-386.EXE  which re-maps
  (translates) the characters according to two sets of characters supplied
  as parameters.

  The first set are characters to be re-mapped and the second set are the
  characters that the first set will be re-mapped to, in positional order,

  like this :-

  type test2.asc

          }---}}

  tr-386 "}" "{" test2.asc

          {---{{

  tr-386 "-}" "={" test2.asc

          {==={{

  The resulting output from TR-386.EXE may then be piped to SED-386.EXE
  which simply strips any trailing space characters, using the command

  sed-386 "s/ $*//"

  Note: Trailing space characters in a document could be removed using
        the command :-

  sed-386 "s/ $*//" document.txt >doc-stripped.txt


  SUMMARY
  ~~~~~~~
  Thus the process is :-

  type %1;  asc-tool -mh %1 | tr-386 "-}" "={" | sed-386 's/ $*//'

  }}---}        }---}}           {==={{



  [][ ensure all files are in your search-path incl. cwsdpmi.exe ][]


  type test.asc

      _\|      __     |/_
    _-  \_   _/"->   _/  -_
    -_    `-'7   F`-'    _-
     `=.__.=-(   )-=.__.='
             |/-\|
  cjr        Y   Y
  2aug98

  tb test.asc

  San698
  cjt        A   A
             |\-/|
     ,='~~'=-(   )-='~~'=.
    -~    ,-.J   L,-.    ~-
    ~-  /~   ~\"->   ~\  -~
      ~/|      ~~     |\~
TOP

Copyright © CJRandall_1998
Last Revised: August 29th, 1998
www.shieldwolf.demon.co.uk