home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 2
/
CDPD_II_2352.bin
/
applications
/
uedit
/
config!h
< prev
next >
Wrap
Text File
|
1992-01-01
|
16KB
|
611 lines
-----------------------------------------------------------------------------
| Config!H |
| Copyright (C) 1986-92 Rick Stiles. All rights reserved. |
-----------------------------------------------------------------------------
*************************************
N-variables used:
n0-n4 scratch num variables
n24 split window size
n25 hyper word index value
Buffers used:
buf50-buf54 scratch buffers
buf49 search/grep string
buf60 bookmark names
buf63 hyper text filename
buf64 hyper text tablename
*************************************
HYPER TEXT COMMANDS ((This rewrite of the hyper text cmds was inspired by
cmds sent in by Piotr Obminski. RS 27-Jan-92))
<defines:
define(MAX_WORD_LENGTH ,17)
define(HT_DIRECTORY ,"S:Hyper")
define(HT_Split_Size ,n24)
define(Word_Index ,n25)
define(Hyper_Word ,buf54)
define(HT_FileName ,buf63)
define(HT_TableName ,buf64)
define(Eat_MouseUp_Input,624)
define(Hyper_Lookup ,1054)
define(Capture_Word ,1068)
define(Open_Hyper_Text ,1083)
define(Close_Hyper_Text ,1084)
define(Type_In_Hyper_Word,rAmiga-gadget1)
define(N_1 ,n1)
define(N_2 ,n2)
define(N_3 ,n3)
define(N_4 ,n4)
define(B_0 ,buf50)
define(B_1 ,buf51)
>
Open hyper text facility for HyperHelp
<Open_Hyper_Text:
freeBuf(B_1)
freeBuf(B_0)
insertRgn(B_0,eFile,HT_DIRECTORY,all)
insertRgn(B_1,eFile,B_0,all)
insertRgn(B_1,eFile,"/FILES",all)
if (!fileRequest(B_1,"Select HyperText File",0)) {
label(0)
putMsg("No selection - Hyper Text is inactive.")
returnFalse
}
moveCursor(B_1,sFile)
moveCursor(B_1,downLine)
freeBuf(HT_FileName)
insertRgn(HT_FileName,sFile,B_1,line)
if (isEmpty(HT_FileName)) goto label(0)
freeBuf(HT_TableName)
insertRgn(HT_TableName,eFile,HT_FileName,all)
insertRgn(HT_TableName,eFile,".tbl",all)
freeBuf(B_1)
insertRgn(B_1,eFile,B_0,all)
insertRgn(B_0,eFile,"/Files/",all)
insertRgn(B_1,eFile,"/Tables/",all)
insertRgn(B_0,eFile,HT_FileName,all)
insertRgn(B_1,eFile,HT_TableName,all)
hyperClose
if (HyperOpen(B_0,B_1,0)) {
if (thisKey) putmsg("Hyper text loaded")
equateNum(Word_Index,0)
insertRgn(HT_FileName,sFile,"<FILE: ",all)
insertRgn(HT_FileName,eFile,">",all)
returnTrue
}
>
Close hyper text facility
<Close_Hyper_Text: HyperClose >
Get word input and lookup hyper word, going into hyper text mode
<Type_In_Hyper_Word:
if (!hyperUp & !runKey(Open_Hyper_Text))
{ putMsg("Must open hyper text") returnFalse }
putmsg("Input hyper word/phrase to look up:")
clearBuf(Hyper_Word)
inputString(Hyper_Word)
updateDisplay
runKey(Hyper_Lookup)
>
Get hyper word that was clicked, go into hyper text mode & find it
<rAmiga-buttondown:
putMsg(" ") putMsg("")
updateDisplay
if (!hyperUp & !runKey(Open_Hyper_Text)) returnFalse
runKey(Capture_Word)
runKey(Hyper_Lookup)
>
Capture hyper word or phrase
<Capture_Word:
define(Word_Length,n2)
define(Word_Byte,n3)
movecursor(curfile,mouseloc)
.. if (is(curFile,whiteSpace) | is(curFile,eFile)) return
clearBuf(Hyper_Word)
if (!is(curfile,sword)) movecursor(curfile,sword)
while (!is(curfile,"<")
& !is(curfile,eline)
& !is(curfile,">")
& movecursor(curfile,schar)) nothing
if (is(curfile,"<")) { .. copy the hyper phrase
movecursor(curfile,echar)
equateNum(Word_Length,0)
while (nothing) {
copychar(curfile,Word_Byte)
movecursor(curfile,echar)
if (eqnum(Word_Byte,">")) GOTO label(0)
insertchar(Hyper_Word,Word_Byte)
incNum(Word_Length)
if (geNum(Word_Length,MAX_WORD_LENGTH)) GOTO label(0)
}
label(0)
} else { .. copy just the word
movecursor(curfile,mouseloc)
if (!is(curfile,sword)) movecursor(curfile,sword)
insertrgn(Hyper_Word,efile,curfile,word)
}
>
Hyper lookup mode
<Hyper_Lookup:
define(Old_CurFile ,n0)
define(Hyper_Text_Buf ,buf53)
define(Hyper_Text_Buf2 ,buf52)
define(Forbid_Tiny_Window ,label(40))
define(Paint_Options ,label(50))
define(Lookup_Hyper_Word ,label(96))
define(Lookup_From_Top ,label(97))
define(Get_Next_Input ,label(98))
define(Eat_MouseUp_Input ,624)
runKey(Eat_MouseUp_Input)
while(inputKey(N_4)) nothing
if (gtNum(0,Word_Index)) equateNum(Word_Index,0)
equateNum(Old_CurFile,curFile)
.. find word starting from Word_Index
if (!hyper(Hyper_Text_Buf,Hyper_Word,Word_Index,0)) {
clearBuf(Hyper_Word)
.. find word starting from top of table
if (!hyper(Hyper_Text_Buf,Hyper_Word,0,0)) return
}
if (!eqNum(curFile,Hyper_Text_Buf) & !gotoSplit(Hyper_Text_Buf)) {
getAddress(15,N_4) .. get maxLines
peek(N_4,N_3,2)
sub(N_3,N_3,7) .. subtract lines needed
equateNum(HT_Split_Size,N_3)
if (!splitWindow(Hyper_Text_Buf,HT_Split_Size)) {
putMsg("Close a split window so can bring up hyper text")
return
}
}
updateDisplay
GOSUB Paint_Options
GOSUB Forbid_Tiny_Window
Get_Next_Input
GOSUB Forbid_Tiny_Window
runKey(Eat_MouseUp_Input)
getKeyVal(macroNum,inputChar)
GOSUB Forbid_Tiny_Window
switch(macroNum) {
case(normal-gadget3)
case(normal-n) {
if (!runKey(Open_Hyper_Text)) GOTO label(39)
equateNum(Word_Index,0)
clearBuf(Hyper_Word)
GOSUB Paint_Options
GOTO Lookup_From_Top
}
case(normal-gadget4)
case(normal-c) { hyperClose goto label(39) }
case(normal-space)
case(normal-return) {
equateLoc(curfile,mouseloc,atcursor)
runkey(Capture_Word)
GOTO Lookup_Hyper_Word
}
case(normal-q)
case(normal-gadget1)
case(normal-closeBox)
case(normal-esc) {
label(39)
gotoSplit(buf[Old_CurFile])
splitWindow(Hyper_Text_Buf,0) .. close it if made it
clearBuf(Hyper_Word)
freeBuf(Hyper_Text_Buf)
putMsg(" ") putMsg("")
return
}
case(normal-buttonDown) { .. scroll, place cursor
moveCursor(curFile,mouseLoc)
updateDisplay
mouseXY(N_4,N_1)
equateNum(N_4,0)
if (mouseDown) while (not inputWaiting) {
trackMouse
mouseXY(N_2,N_3)
sub(N_3,N_3,N_1)
div(N_3,N_3,5)
if (!eqNum(N_3,0))
{ vscroll(N_3) updateDisplay equateNum(N_4,1) }
}
if (eqNum(N_4,1)) refreshDisplay
GOTO Get_Next_Input
}
case(shft-buttonDown)
case(alt-buttonDown)
case(ctl-buttonDown)
case(rAmiga-buttonDown) {
runKey(Capture_Word)
Lookup_Hyper_Word
if (gtNum(0,Word_Index)) equateNum(Word_Index,0)
if (eqNum(0,Word_Index)) {
Lookup_From_Top .. try from top of table
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,0)) GOTO Get_Next_Input
} else { .. try algorithm
if (..!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,1)
..&
!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,2)) GOTO Lookup_From_Top
}
}
case(normal-f1) {
clearBuf(Hyper_Word)
equateNum(Word_Index,0) .. set index to 0 for top of tree
.. GOTO index word (top of tree)
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,0))
GOTO Get_Next_Input
}
case(normal-f2) {
clearBuf(Hyper_Word) .. GOTO parent of Word_Index
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,1))
GOTO Get_Next_Input
}
case(normal-f3) {
clearBuf(Hyper_Word) .. GOTO child of Word_Index
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,2))
GOTO Get_Next_Input
}
case(normal-f4) {
clearBuf(Hyper_Word) .. GOTO next sibling of Word_Index
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,3))
GOTO Get_Next_Input
}
case(normal-f5) {
clearBuf(Hyper_Word) .. GOTO prev sibling of Word_Index
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,4))
GOTO Get_Next_Input
}
case(normal-f6) {
clearBuf(Hyper_Word) .. GOTO last lookup
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,5))
GOTO Get_Next_Input
}
case(normal-w)
case(normal-gadget2)
case(normal-f7) { .. get hyper word input
putMsg("Input hyper word/phrase to look up:")
clearBuf(Hyper_Word)
runKey(Eat_MouseUp_Input)
GOSUB Forbid_Tiny_Window
inputString(Hyper_Word)
GOSUB Forbid_Tiny_Window
updateDisplay
GOSUB Paint_Options
GOTO Lookup_Hyper_Word
}
case(normal-f8) { .. get hyper word of next index value
incNum(Word_Index)
clearBuf(Hyper_Word)
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,0)) {
equateNum(Word_Index,0)
GOTO Get_Next_Input
}
}
case(normal-f9) { .. get hyper word of prev index value
if (gtnum(Word_Index,0)) decNum(Word_Index)
clearBuf(Hyper_Word)
if (!hyper(Hyper_Text_Buf2,Hyper_Word,Word_Index,0))
GOTO Get_Next_Input
}
case(normal-kp8)
case(normal-uparrow) {
movecursor(curfile,upline)
updatedisplay
GOTO Get_Next_Input
}
case(normal-kp2)
case(normal-downarrow) {
movecursor(curfile,downline)
updatedisplay
GOTO Get_Next_Input
}
case(normal-kp4)
case(normal-leftarrow) {
movecursor(curfile,sWord)
updatedisplay
GOTO Get_Next_Input
}
case(normal-kp6)
case(normal-rightarrow) {
movecursor(curfile,eWord)
updatedisplay
GOTO Get_Next_Input
}
default { GOTO Get_Next_Input }
}
GOSUB Forbid_Tiny_Window
swapbuf(Hyper_Text_Buf2,Hyper_Text_Buf)
refreshDisplay
GOTO Get_Next_Input
Forbid_Tiny_Window ..SUBROUTINE label(40) forbid tiny window
if (!inTiny) return
toggle(toTiny)
..refreshDisplay
return
Paint_Options ..SUBROUTINE label(50) paint options in upper window
getAddress(10,N_4) .. get maxLines
peek(N_4,N_1,2)
div(N_1,N_1,4)
equateNum(N_3,6)
equateNum(N_2,2)
equateNum(N_4,0)
text(" [ESC] [Q]uit", 0,0 ,N_3,N_1)
text(" [W]ord lookup", 0,N_1,N_2,N_1)
add(N_4,N_1,N_1)
text(" [N]ew Hyper File", 0,N_4,N_3,N_1)
add(N_4,N_4,N_1)
text(" [C]lose Hyper Text",0,N_4,N_2,-1)
equateNum(N_4,1)
equateNum(N_1,2)
text("F1: top of table",1,0,N_4,-1)
text("F2: parent of current",2,0,N_4,-1)
text("F3: child of current",3,0,N_4,-1)
text("F4: next sibling",4,0,N_4,-1)
text("F5: prev sibling",5,0,N_4,-1)
text("F6: step history",6,0,N_4,-1)
text("RETURN/SPACE: lookup cursor word",1,26,N_4,0)
text("MOUSE: cursor/scroll ARROW KEYS: scroll",2,26,N_4,0)
text("S/A/C/R-MOUSE: lookup clicked word",3,26,N_4,0)
text("F7: input word & lookup",4,23,N_4,0)
text("F8: next word by index",5,23,N_4,0)
text("F9: prev word by index",6,23,N_4,0)
text(HT_FileName,6,50,N_4,0)
>
<defines: >
GREP COMMANDS
<defines:
define(Do_A_Grep ,virtual-f10)
define(Grep_Buf ,buf49)
define(N_4 ,n4)
>
Set grep (/search/replace/) string
<lAmiga-f7:
putMsg("Input grep string:")
push(buf99,Grep_Buf)
movecursor(Grep_Buf,sfile)
movecursor(Grep_Buf,echar)
inputString(Grep_Buf)
setGrep(Grep_Buf)
runKey(lAmiga-f9)
>
Called by grep cmds to perform grep based on N_4 flag
<Do_A_Grep:
if (!grep(curFile,invert,N_4)) {
putMsg("Search failed")
returnFalse
} else putMsg("")
>
Grep search forward
<lAmiga-f9: equateNum(N_4,1) runKey(Do_A_Grep) >
Grep search backward
<rAmiga-f9: equateNum(N_4,-1) runKey(Do_A_Grep) >
Grep search & replace forward
<lAmiga-f10: equateNum(N_4,2) runKey(Do_A_Grep) >
Grep search & replace backward
<rAmiga-f10: equateNum(N_4,-2) runKey(Do_A_Grep) >
<defines: >
BOOKMARK COMMANDS
((Improvements included in the following bookmark cmds were contributed by
Rene LeBlanc and Ken Perano. 3/5/91 RS))
<defines:
define(Eat_MouseUp_Input,624)
define(Select_BookMark ,312)
define(Display_Names ,208)
define(Cursor_To_Mark ,virtual-gadget3)
define(Dummy_Marks ,virtual-gadget4)
define(Mark_Name_List ,buf60)
define(N_0 ,n0)
define(N_1 ,n1)
define(BookMark_Number,n2)
define(N_3 ,n3)
define(N_4 ,n4)
define(B_3 ,buf53)
define(B_4 ,buf54)
>
Goto bookmark
<shft-gadget1:
if (!runKey(Select_BookMark)) returnFalse .. select bkmark with mouse
runKey(Cursor_To_Mark) >
Goto next bookmark
<shft-gadget2:
runKey(Dummy_Marks) .. fill Mark_Name_List with mark names if empty
incNum(BookMark_Number)
if (gtNum(BookMark_Number,7)) equateNum(BookMark_Number,0)
runKey(Cursor_To_Mark) >
Store bookmark at cursor
<shft-gadget3:
runKey(Dummy_Marks) .. fill Mark_Name_List with mark names if empty
if (!runKey(Select_BookMark)) returnFalse .. get a bookmark to name
.. get new bookmark name
moveCursor(Mark_Name_List,sFile)
do (N_4,0,BookMark_Number) moveCursor(Mark_Name_List,downLine)
moveCursor(Mark_Name_List,upLine)
freeBuf(B_3)
insertRgn(B_3,eFile,Mark_Name_List,line)
putMsg("Enter bookmark name (1-10 chars):")
inputString(B_3)
if (!isEmpty(B_3)) {
clearRgn(Mark_Name_List,line)
moveCursor(B_3,sFile)
insertRgn(Mark_Name_List,atCursor,B_3,line)
}
freebuf(B_4)
insertrgn(B_4,atcursor,"Mark = ",all)
insertRgn(B_4,eFile,B_3,line)
putmsg(B_4)
switch(BookMark_Number) {
case (0) { equateLoc(curFile,locC,atCursor) }
case (1) { equateLoc(curFile,locD,atCursor) }
case (2) { equateLoc(curFile,locE,atCursor) }
case (3) { equateLoc(curFile,locF,atCursor) }
case (4) { equateLoc(curFile,locG,atCursor) }
case (5) { equateLoc(curFile,locH,atCursor) }
case (6) { equateLoc(curFile,locI,atCursor) }
case (7) { equateLoc(curFile,locJ,atCursor) }
}
>
Used by bookmark cmds to move the cursor
<Cursor_To_Mark:
moveCursor(Mark_Name_List,sFile)
do (N_4,0,BookMark_Number) moveCursor(Mark_Name_List,downLine)
moveCursor(Mark_Name_List,upLine)
freebuf(B_4)
insertRgn(B_4,eFile,Mark_Name_List,line)
switch(BookMark_Number) {
case (0) { moveCursor(curFile,locC) }
case (1) { moveCursor(curFile,locD) }
case (2) { moveCursor(curFile,locE) }
case (3) { moveCursor(curFile,locF) }
case (4) { moveCursor(curFile,locG) }
case (5) { moveCursor(curFile,locH) }
case (6) { moveCursor(curFile,locI) }
case (7) { moveCursor(curFile,locJ) }
}
if (!eqNum(BookMark_Number,0) & is(curFile,sFile))
insertRgn(B_4,eFile," - May need to init marks (S-gadget4)",all)
putmsg(B_4)
>
Reset all bookmarks to sFile
<shft-gadget4:
putmsg("Bookmarks reset")
freeBuf(Mark_Name_List)
runKey(Dummy_Marks) .. fill Mark_Name_List with mark names if empty
equateLoc(curfile,locC,sFile)
equateLoc(curfile,locD,eFile)
equateLoc(curfile,locE,sHilite)
equateLoc(curfile,locF,eHilite)
equateLoc(curfile,locG,sInvert)
equateLoc(curfile,locH,eInvert)
equateLoc(curfile,locI,locA)
equateLoc(curfile,locJ,locB)
equateNum(BookMark_Number,0)
>
Put dummy bookmark names in Mark_Name_List
<Dummy_Marks:
if (isEmpty(Mark_Name_List)) insertRgn(Mark_Name_List,eFile,
"S File
E File
S Hilite
E Hilite
S Invert
E Invert
locA
locB
",all)
>
Display bookmark names in msg line
<Display_Names:
updateDisplay
movecursor(Mark_Name_List,sFile)
equateNum(N_0,0)
equateNum(N_1,1)
getAddress(10,N_4) .. get maxLineChars
peek(N_4,N_3,2)
div(N_3,N_3,8) .. chars per minigadget
do (N_4,0,7) {
clearBuf(B_4)
insertRgn(B_4,eFile,Mark_Name_List,line)
text(B_4,0,N_0,N_1,N_3)
if (eqNum(N_1,1)) equateNum(N_1,2)
else equateNum(N_1,1)
add(N_0,N_0,N_3)
moveCursor(Mark_Name_List,downLine)
}
>
Select a bookmark with mouse
<Select_BookMark:
runKey(Dummy_Marks) .. fill Mark_Name_List with mark names if empty
runKey(Display_Names) .. display bookmark names
runKey(Eat_MouseUp_Input) .. soak mouseUp
getKeyVal(N_3,N_4) .. get a mouse input
putMsg(" ")
putMsg("")
switch(N_3) {
case(normal-gadget1)
case(normal-gadget2)
case(normal-gadget3)
case(normal-gadget4)
case(shft-gadget1)
case(shft-gadget2)
case(shft-gadget3)
case(shft-gadget4) { nothing }
case(normal-f1) { equateNum(BookMark_Number,0) return }
case(normal-f2) { equateNum(BookMark_Number,1) return }
case(normal-f3) { equateNum(BookMark_Number,2) return }
case(normal-f4) { equateNum(BookMark_Number,3) return }
case(normal-f5) { equateNum(BookMark_Number,4) return }
case(normal-f6) { equateNum(BookMark_Number,5) return }
case(normal-f7) { equateNum(BookMark_Number,6) return }
case(normal-f8) { equateNum(BookMark_Number,7) return }
default { returnFalse }
}
getAddress(10,N_4)
peek(N_4,N_1,2) .. get maxLineChars
div(N_1,N_1,8) .. 8 minigadgets, chars per minigadget
mouseXY(N_4,N_3)
getFont(B_4,N_0,N_3) .. get font sizeX
div(N_4,N_4,N_0)
div(BookMark_Number,N_4,N_1)
runKey(Eat_MouseUp_Input)
returnTrue
>
<defines: >