home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
DIVERSEN
/
TIPI2A
/
TIPIGUI.TPI
< prev
next >
Wrap
Text File
|
1994-11-27
|
5KB
|
226 lines
# TIPIGUI.TPI by Kent Peterson 11/7/94
defstr p$ # The name of the program
# If this isn't an HP hundred series palmtop, gracefully abort
machine? 2 <
if
| Sorry, this program only runs on an HP hundred series palmtop.
| Run CHARTIPI to switch to the charater version of the workbench.
bye
endif
define timebar
date$ " " +$ time$ +$
0 59 locate print$
enddef
define getkey
begin
key dup if dup endif
timebar
until
enddef
define cline$ ( -- )
( -- command$ )
"R" "command.lin" 1 open
1 isinput
get$ console isinput
1 close
enddef
deftable rows
25 85
endtable
deftable cols
60 200 380 540
endtable
deftable icons
"doc.icn"
"t.icn"
"command.icn"
"run.icn"
"factory.icn"
"lookup.icn"
"dos.icn"
endtable
deftable text$
"Edit"
"Change Program"
"Set Command Line"
"Run Program"
"Make EXE"
"Lookup"
"DOS Command"
endtable
define iconcoords ( n -- row col )
# returns the row and column at which to draw an icon
1 - dup 4 / 1 + rows swap
4 mod 1 + cols
enddef
define textcoords ( n -- row col )
( t$ -- t$ )
# returns the row and column at which to draw text
1 - dup 4 / 1 + rows 35 + swap
4 mod 1 + cols 15 + len 4 * -
enddef
define drawcursor ( n -- )
# draws a box cursor at location n
1 setpencolor
3 setreprule
iconcoords over over
6 - swap 3 - swap
over over
movepen 54 + swap 36 + swap 0 rot rot
drawrect
5 - swap 2 - swap
over over
movepen 52 + swap 34 + swap 0 rot rot
drawrect
enddef
define restartline
"t " print$ p$ fetch print$ " " print$ print cr lf
enddef
define makecmd
0 screen
"O" "runfile.bat" 2 open
2 isoutput dup
case 0 of # Quit
endof
1 of # Edit
"e " print$
p$ fetch print$ cr lf
restartline
endof
2 of # Change Program
| t
endof
3 of # Set Command Line
"O" "command.lin" 1 open
console isoutput
"Command Line: " print$ get$
1 isoutput print$ cr lf
1 close
2 isoutput
restartline
endof
4 of # Run Program
"tipi " print$
p$ fetch print$ " " print$
cline$ print$ cr lf
restartline
endof
5 of # Make EXE
console isoutput
"Making EXE..." print$
2 isoutput
"copy /b tipicore.bin+register.dat+" print$
p$ fetch dup$ print$ " " print$
ucase$ ".TPI" ".EXE" replace$ print$
" /b /v > nul" print$ cr lf
restartline
endof
6 of # Lookup
| call helptipi.bat
restartline
endof
7 of # DOS Command
console isoutput
"DOS Command: " print$ get$
2 isoutput
print$ cr lf
"pause" print$ cr lf
restartline
endof
endcase
console isoutput
bye
enddef
command$
parse$ drop$
parse$
# if there is no p$, ask for one
dup$ "" =$
if
drop$ drop$ "2" "Name of TIPI program: " print$ get$
endif
"." instr drop$
not if ".tpi" +$ endif
ucase$ p$ store
# get the cursor parameter if it exists
val 1 max
6 setvmode
0 8 setfont
15 6 movepen
0 172 634 drawrect
140 6 movepen
0 172 634 drawrect
0 4 40
"TIPI Programmer's Workbench"
plottext
0 145 40
"Program Name: " p$ fetch +$
plottext
0 160 40
"Command Line: " cline$ +$
plottext
0 175 40
"Select with the arrow keys and Enter, or press the"
plottext
0 185 40
"underlined letter. Press Esc to quit."
plottext
7 do
0 7 index - 1 + dup text$ textcoords plottext
0 7 index - 1 + dup text$ textcoords swap 1 + swap drop$ "_" plottext
0 7 index - 1 + dup icons iconcoords ploticon
loop
begin
dup drawcursor
getkey
case 101 of drawcursor 1 makecmd endof # e
45 of drawcursor 1 makecmd endof # E
99 of drawcursor 2 makecmd endof # c
67 of drawcursor 2 makecmd endof # C
115 of drawcursor 3 makecmd endof # s
83 of drawcursor 3 makecmd endof # S
114 of drawcursor 4 makecmd endof # r
82 of drawcursor 4 makecmd endof # R
109 of drawcursor 5 makecmd endof # m
77 of drawcursor 5 makecmd endof # M
108 of drawcursor 6 makecmd endof # l
76 of drawcursor 6 makecmd endof # L
100 of drawcursor 7 makecmd endof # d
68 of drawcursor 7 makecmd endof # D
333 of dup drawcursor 1 + 7 min endof # right
331 of dup drawcursor 1 - 1 max endof # left
336 of dup drawcursor 4 + dup 7 > # down
if 4 - endif endof
328 of dup drawcursor dup 4 > if 4 - endif endof # up
327 of drawcursor 1 endof # home
335 of drawcursor 7 endof # end
13 of makecmd endof # enter
27 of drop 0 makecmd endof # esc
default dup drawcursor
endcase
0 until