[comp.sys.handhelds] less for the '48

hernes@ndsuhp.UUCP (05/08/90)

Hi all,

The following progs form a simple string viewer for the '48.
There are two main progs.  One STR->GROB takes a long string,
breaks it at either a newline ot at 22 characters, then converts
it into a grob.  This has the benefit that you can view any of the
three different character sizes, or you can upload it and look at it
on a pc, or mix it with graphics, etc.....
The other program is probably a little more useful,  'Less' takes a string
from the stack, breaks it up as described above, then views one 'page' at
a time.  It was written to be easy to expand.  Currently, the only functions
supported are page up, page down, line up, line down, quit, go to top, and
go to end.  The default key-bindings are set for B-F and right shift B & C.
The key-bindings can be changed, or added simply by changing the key number
in the CASE statement, or by adding a "OVER (new-key-number-here) SAME OR" to
the test-clause in the CASE statement.

---
Eric L. Hernes I.
=======================

Here are the progs:

%%HP: T(3)A(D)F(.);
STR\->GROB
\<< SPLIT DEPTH \->LIST
\-> A
  \<< # 83h A SIZE 8
* R\->B BLANK A 1
SWAP SIZE
    FOR I A I GET 2
\->GROB # 0h I 1 - 8
* R\->B 2 \->LIST SWAP
GOR
    NEXT
  \>>
\>>


%%HP: T(3)A(D)F(.);
LL
\<< DUP 7 + SUB 1 7
  FOR ln DUP ln
    IFERR GET
    THEN DROP DROP
"~"
    END ln DISP
  NEXT 1 FREEZE 2
FREEZE DROP
\>>



%%HP: T(3)A(D)F(.);
SPLIT
\<<
  WHILE DUP SIZE 22
> OVER "
" POS OR
  REPEAT DUP "
"
POS DUP DUP
    IF 22 \<= AND
    THEN OVER SWAP
1 SWAP DUP 4 ROLLD
1 - SUB 3 ROLLD 1 +
OVER SIZE SUB
    ELSE DROP DUP 1
22 SUB SWAP 23 OVER
SIZE SUB
    END
  END DUP "" ==
  IF
  THEN DROP
  END
\>>




%%HP: T(3)A(D)F(.);
Less
\<< SPLIT DEPTH \->LIST
1 RCLMENU RCLF \-> A
L men FLAG
  \<< 64 SF -49 -50
CF CF
    WHILE 64 FS?
    REPEAT A L LL L
6 + A SIZE / 100 *
IP DUP 100 < SWAP
\->STR "%" + "END"
IFTE { "P\|v" "P\|^"
"\|v" "\|^" "QUIT" } +
TMENU -1 WAIT
      CASE  DUP
12.1 SAME
        THEN DROP L
DUP 7 + A SIZE < 7
* + 'L' STO
        END DUP
13.1 SAME
        THEN DROP L
7 - DUP 1 \>= SWAP 1
IFTE 'L' STO
        END DUP
14.1 SAME
        THEN DROP L
DUP 1 + A SIZE < +
'L' STO
        END DUP
15.1 SAME
        THEN DROP L
DUP 1 - 0 > - 'L'
STO
        END DUP
16.1 SAME
        THEN DROP
FLAG STOF 64 CF men
MENU
        END DUP
12.3 SAME
        THEN DROP A
SIZE 6 - 'L' STO
        END DUP
13.3 SAME
        THEN DROP 1
'L' STO
        END
      END
    END
  \>>
\>>