Sam Trenholme's webpage
This article was posted to the Usenet group alt.hackers in 1995; any technical information is probably outdated.

Re: OBHack...


Article: 7694 of alt.hackers
From: crosby@cs.colorado.edu
Newsgroups: alt.hackers
Subject: Re: OBHack...
Date: 20 Apr 1995 22:53:27 GMT
Organization: University of Colorado, Boulder
Lines: 40
Approved: me
Message-ID: 3n6ol7$87k@csnews.cs.colorado.edu
NNTP-Posting-Host: nag.cs.colorado.edu
Status: RO

In article <3mvu3r$1k7@usenet.rpi.edu>,
Diversion <jeff@diversion.stu.rpi.edu> wrote:
>crosby@cs.colorado.edu wrote:
>: ObHack:
>
>: A vi-macro plot program to go with my vi calculator.  Basically,
>: you just give it a list of numbers and it puts an '*' in the approriate
>: position.  Really easy to do actually.
>
>Ok, the plotter shouldn't be too hard (given something like a
>screen of all blanks), but I can't figure out how a calculator would
>be done.  Any pointers/source?
>

Actually, it runs under nvi, and some vi's (but not most.)  The trick
is the # command, present in nvi and a few real vi's, which increments or
decrements a number.  Given, eg, 4#+ will add 4 to a number, the rest is
trivial.

Heres mine, which handles +,- and *.  I never bothered doing /

map + "cPA#^[$"bp
map - "cPA#^[$"bp
map * "aPA#+^["zddo@z^[^"bP
map g
1G"ayww"byww"cywGo^[o^[k"aPj@b"dYk@dddj"ey$dd1G3dw"eP

A simpler version, that handles + and - is

map g
1G"ayww"byww"cywGk"aPj"cPA#^[$"bp"dYk@dddj"ey$dd1G3dw"eP


ObHack:

Hmm...can't think of one.  Use that above for the moment.

ObFutureHack:

Implementing above to run under all vi's.  Lessee...probably lookup
tables would be the best way to do it.




Parent Parent Parent

Back to index