home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
editors
/
amac41.arj
/
JMPPOS11.QM
< prev
next >
Wrap
Text File
|
1991-05-22
|
22KB
|
438 lines
* JMPPOS11.QM ver. 1.1a May 22, 1991
* Jump to Position Macros for QEdit
* ┌──────────────────────────────[ Index ]────────────────────────────────┐
* │
* │ @(1) Set Position Marker at Current Line |chg
* │ @(2) Set Position Marker at Top of Screen |chg
* │
* │ @(3) Jump to Previous Position Marker in Current File
* │ @(4) Jump to Next Position Marker in Current File
* │
* │ @(5) Jump to Previous Position Marker in Loaded Files |chg
* │ @(6) Jump to Next Position Marker in Loaded Files |chg
* │
* │ @(7) Jump to Previous Position Marker in Current File, Wraps File
* │ @(8) Jump to Next Position Marker in Current File, Wraps File
* │
* │ @(9) Delete All Position Markers in Current File
* │ @(0) Delete All Position Markers in All Loaded Files
* │
* └───────────────────────────────────────────────────────────────────────┘
* Written by: Tom Hogshead and John Goodman
* Description:
* ------------
* The following set of QEdit macros provides an alternative to the
* "bookmarking" macros in BOOKxx.QM. The JMPPOS macros allow the user
* to set "Position Markers" at various points in a file, then jump
* quickly to the next or previous position marker from anywhere in the
* file. Position markers are "labels" that are placed any where on
* separate lines in a file enabling us to jump to the next or previous
* position marker in any of the currently loaded files (that is, jump
* across files).
* A typical application of these macros is to set position markers at
* the top of each function/subroutine in a source code file, or each
* section and chapter of a documentation file. The JMPPOS macros will
* allow you to jump quickly from function to function or section to
* section by pressing a single key.
* Another application of these macros is to jump quickly between
* browsing a calling and called function in a source code file. When
* browsing the calling function, press one of the "Set Position Marker"
* macro keys to mark the calling function's position. Then move to the
* called function and mark it's position in the same way. You can then
* quickly alternate between browsing the calling and called functions
* by pressing one of the "Jump to Next Position Marker" or "Jump to
* Previous Position Marker" macro keys.
* The following describes the functions of the JMPPOS macro keys:
* Position markers are "labels" that are placed on separate lines in a
* file. These position markers can be placed in a file (set) using two
* different macro keys, @1 or @2:
* @1 - Places a position marker one line above the line currently being
* edited. This macro key is useful for marking specific line
* locations in a file that you'll want to jump back to later.
* @2 - Places a position marker one line above the top line currently
* displayed on the screen. This macro key is useful for taking a
* "snapshot" of the currently displayed screen so that you can
* return to the location and have the screen displayed just as it
* was when the position marker was set. Note that when a position
* marker is set using this macro key, nothing appears to happen.
* This is because the position marker label is placed one line
* above the first line displayed on the screen and the cursor is
* returned to its original position.
* Six different macro keys are provided to "Jump to Position Markers":
* @3 - Jumps to the previous position marker in the file currently
* being edited. The macro searches from one line above the line
* at the top of the screen to the beginning of the file.
* @4 - Jumps to the next position marker in the file currently being
* edited. The macro searches from the current cursor location to
* the end of the file.
* @5 - Jumps to the previous position marker in any of the files that
* are currently loaded. The macro first searches from one line
* above the line at the top of the screen to the beginning of the
* current file, then searches from bottom to top in the previous
* file in the file ring, then moves to the nextmost previous file
* in the ring, etc. If a position marker is not found in any of
* the files in the ring, the bottom of the current file is
* searched.
* @6 - Jumps to the next position marker in any of the files that are
* currently loaded. The macro first searches from the current
* cursor position to the bottom of the current file, then searches
* from top to bottom in the next file in the file ring, then moves
* to the next file in the ring, etc. If a position marker is not
* found in any of the files in the ring, the top of the current
* file is searched.
* @7 - Wraps within the current file when it hits the *top* of the file
* (i.e., treat the current file as a "ring" when no marker is
* found from the starting position to the *top* of the file). This
* way, hitting a jump key will come up with something if there is
* a marker anywhere in the current file. You don't have to worry
* about whether you're at the first/last position in the file. It
* also makes it easier to jump back and forth between two
* positions.
* @8 - Wraps within the current file when it hits the *bottom* of the
* file and no marker has been found from the starting position to
* the *bottom*.
* When a position marker is found by any of the above macros, the line
* containing the position marker is moved one line above the current
* display. If the position marker was set using @2, the screen will
* appear just as it did when the position marker was set (except that
* the cursor is placed at the top of the screen). If a position marker
* is not found by any of the jump macros, the cursor will be left at
* its original location (or at the beginning of the same line if
* searching backwards).
* Two keys are provided to Delete Position Markers:
* @9 - Deletes all position marker label lines in the current file.
* @0 - Deletes all position marker label lines in all currently loaded
* files.
* A few notes:
* a. The "Jump to Position Marker" macros do not set or use any
* blocks. Block copies and moves can therefore be performed when
* jumping between positions.
* b. In this version, the position marker label lines include an
* asterisk in column 1. This was done so that if the user
* inadvertantly (or intentionally) does not delete the label lines
* when saving the file, the label lines will be treated as comments
* by dBase or QConfig/QMac (still need to watch out for comments in
* the middle of multi-line statements!). If you commonly use these
* macros for other languages (e.g., C source code files), you may
* want to change the "Set Position Marker" macros to use different
* initial characters. The other macros should not need to be
* changed.
* c. The user may wish to add numbers or letters at the end of the
* position marker labels to uniquely identify different positions
* in a file. For example, you might create the macros @a and @b
* that set "Position Marker A" and "Position Marker B",
* respectively. You could then create the macros ^a and ^b that
* would search only for "Position Marker A's" and "Position Marker
* B's", respectively. A variation of this sort would require very
* few modifications to the JMPPOS macros provided.
* Macros:
* -------
* *
* ----------------------------------------------------------------------
* @(1) Set Position Marker at Current Line
* ----------------------------------------------------------------------
*
@1 MacroBegin
InsertLine BegLine * Insert a blank line
"*" * with Marker on it
CursorRight * |
#031 #030 *
*
* 14 bytes Mon 04-29-1991 23:34:56
* 13 bytes Wed 05-22-1991 12:42:54 (TH - replaced space w/ CursorRight)
*
* ----------------------------------------------------------------------
* @(2) Set Position Marker at Top of Screen
* ----------------------------------------------------------------------
*
@2 MacroBegin
UnmarkBlock * Ensure No Blocks Marked
DropAnchor DropAnchor * Mark current Position
BegScreen * Goto 1st Line of Screen
InsertLine * Insert a Blank Line
BegLine * Goto to Start of Line
"*" * Type Pos Marker Label
CursorRight * |
#031 #030 *
ScrollDown * Scroll Down 1 Line, Remove from View
GotoBlockBeg * Return to Orig Position
UnmarkBlock * Unmark the Block
*
* 21 bytes Tue 04-30-1991 00:40:51
* 20 bytes Wed 05-22-1991 12:44:29 (TH - replaced space w/ CursorRight)
*
* ----------------------------------------------------------------------
* @(3) Jump to Previous Position Marker in Current File
* ----------------------------------------------------------------------
*
@3 MacroBegin
BegLine ScrollUp BegScreen * Move cursor in front of Marker in
* case current screen is positioned
* with marker right on top
Find #031 #030 Return * Search current file for next Marker
"B" Return * backwards
Jtrue FOUND: * If found, re-position
NOTFOUND: *ELSE no Marker above where we are
PrevPosition * Return cursor to our original position
JUMP END: * End macro
FOUND: *ELSE no Marker in top of current file
MakeTopofScreen * Put Marker line on top of screen
END:
ScrollDown * Remove marker line from view
*
* 25 bytes Fri 05-03-1991 02:06:08
*
* ----------------------------------------------------------------------
* @(4) Jump to Next Position Marker in Current File
* ----------------------------------------------------------------------
*
@4 MacroBegin
Find #031 #030 Return * Search current file for Marker
DelLine Return * forwards
JFalse END: * If Marker found, end macro
MakeTopofScreen * ELSE put Marker line on top of screen
ScrollDown * and remove it from view
END:
*
* 17 bytes Mon 04-29-1991 23:33:46
*
* --------------------------------------------------------------------
* @(5) Jump to Previous Position Marker in Loaded Files
* ----------- REVISED Sun 05-19-1991 20:26:29 ---------------------
*
@5 MacroBegin
Editfile "NUL" Return * Load NUL file ahead of current file
DropAnchor * Need a block marker for StoreScrBuff |
StoreScrBuff * Create a buffer named |
CurrentFileName * "path:\NULpath:\NUL" eg |
CurrentFileName * "c:\nulc:\nul" |
Return * |
PrevFile * Move back to file we started in
BegLine ScrollUp BegScreen * Move cursor in front of Marker in
* case current screen is positioned
* with marker right on top
Find #031 #030 Return * Search Remainder of Current File
"B" Return * for Pos Marker Label backwards
JTrue FOUND: * If Found, Reposition
*ELSE no marker in top of current file
PrevPosition * Return cursor to original position
ScrollDown * and screen to original position
RINGLOOP: * Loop through file ring until Marker
* found or begin point reached
PrevFile * Edit previous file in ring
Find Return "GB" Return * Search file for Marker backwards
* Retain cursor pos if not found
JTrue FOUND: * If Marker found, exit Loop
CursorDown CursorUp * Test if file has more than one line
JTrue RINGLOOP: * If if does, we are not in the
* NUL file, move to next file
GetScrBuff * Try retrieving a buffer named |
CurrentFileName * current file's name 2x, eg |
CurrentFileName * "c:\current.extc:\current.ext" |
Return * |
JFalse RINGLOOP: * Buffer only exists for "c:\nulc:\nul"
Quit *ELSE quit NUL file and return to
* file we started search in
Find Return "GB" Return * Search bottom of original file
JFalse END: * Give up if not there either
FOUND: * Label Marker was found
MakeTopofScreen * Position Marker line at top of screen
ScrollDown * Remove it from view
OneWindow * Close windows
HorizontalWindow * Open one window
EditFile Return Quit * Load NUL file in window and quit it
* which closes windows and puts us
* back in file with first found marker
CloseWindow * Needed if QConfig Close Window
* Option = 'N'
END:
*
* 65 bytes Mon 04-29-1991 23:47:06
* 77 bytes Sun 05-19-1991 20:26:05 (TH |)
*
* ----------------------------------------------------------------------
* @(6) Jump to Next Position Marker in Loaded Files
* ----------- REVISED Sun 05-19-1991 20:26:47 -----------------------
*
@6 MacroBegin
PrevFile * Move to file before the one we're in
Editfile "NUL" Return * Load NUL file in case Marker is in
* file we started search in
DropAnchor * Need a block marker for StoreScrBuff
StoreScrBuff * Create a buffer named |
CurrentFileName * "path:\NULpath:\NUL" eg |
CurrentFileName * "c:\nulc:\nul" |
Return * |
NextFile * Move back to file we started in
Find #031 #030 Return * Search Remainder of Current File
* for Pos Marker Label
DelLine Return * Clear Find Prompts (Find Forward)
JTrue FOUND: * If Found, Reposition & Cleanup
RINGLOOP: * Loop Through File Ring Until Marker
* Found or Begin Point Reached
NextFile * Edit Next File in Ring
Find Return "G" Return * Search File for Label Marker
* Retain Cursor Pos If Not Found
JTrue FOUND: * If label Marker found, exit Loop
CursorDown CursorUp * Test if file has more than one line
JTrue RINGLOOP: * If if does, we are not in the
* NUL file, move to next file
GetScrBuff * Try retrieving a buffer named |
CurrentFileName * current file's name 2x, eg |
CurrentFileName * "c:\current.extc:\current.ext" |
Return * |
JFalse RINGLOOP: * Buffer only exists for "c:\nulc:\nul" |
Quit NextFile *ELSE quit NUL file and return to
* file we started search in
Find Return "G" Return * Search Top of Original File
JFalse END: * Give Up If Not There Either
FOUND: * Label Marker Was Found
MakeTopofScreen * Position Label Line at Top of Screen
ScrollDown * Remove it from View
OneWindow * Close windows
HorizontalWindow * Open one window
EditFile Return Quit * Load NUL file in window and quit it
* which closes windows and puts us
* back in file with first found marker
CloseWindow * Needed if QConfig Close Window
* Option = 'N'
END:
*
* 57 bytes Tue 04-30-1991 00:45:00
* 69 bytes Sun 05-19-1991 20:25:47 (TH |)
*
* ----------------------------------------------------------------------
* @(7) Jump to Previous Position Marker in Current File, Wraps File
* ----------- REVISED Sat 05-04-1991 01:37:34 -----------------------
@7 MacroBegin
BegLine ScrollUp BegScreen * Move cursor in front of Marker in
* case current screen is positioned
* with marker right on top
Find * Search
#031 #030 Return "B" Return * backwards for Marker
JTrue FOUND: * Test if Found, go to FOUND
Prevposition *ELSE if not found,
Find Return "GB" Return * Do global search from bottom up
* Keeps starting cursor position
* if no marker in file
Jfalse END: * Test if not found, end macro
FOUND: *ELSE marker was found
MakeTopofScreen * Position Label Line at Top of Screen
END: *
ScrollDown * Remove it from View
*
* 32 bytes Sat 05-04-1991 01:36:19
*
* ----------------------------------------------------------------------
* @(8) Jump to Next Position Marker in Current File, Wraps File
* ----------------------------------------------------------------------
@8 MacroBegin
Find * Search Down for Pos Marker Label
#031 #030 Return DelLine Return *
JTrue FOUND: * Test if Found
BegFile * If Not, Start at Top of File
RepeatFind * and Repeat the Search
JTrue FOUND: * Test if Now Found
PrevPosition * No Label in File, Return to
MakeCtrofScreen * orig Position and Center
Jump END:
FOUND: * Label Was Found
MakeTopofScreen * Position Label Line at Top of Screen
ScrollDown * Remove it from View
END:
*
* 28 bytes Fri 05-03-1991 02:48:51
*
* -------------------------------------------------------------------------
* @(9) Delete All Position Markers in Current File
* -------------------------------------------------------------------------
*
@9 MacroBegin
InsertLine #224 * Insertline w/ weird character
FILELOOP: * Loop until all Markers are deleted
Find #031 #030 Return * Search file for next label Marker
"G" Return * Retain cursor pos if not found
JFalse FILECLEAN: * Label Marker not found, exit loop
DelLine * Label Marker found, del the line
Jump FILELOOP: * See if more Markers in current file
FILECLEAN: * File now clean of Markers
Find #224 Return "G" Return * Search file for begin point Marker
DelLine * Delete line w/ weird character
*
* 31 bytes Mon 04-29-1991 23:34:45
*
* -------------------------------------------------------------------------
* @(0) Delete All Position Markers in All Loaded Files
* -------------------------------------------------------------------------
@0 MacroBegin
InsertLine #224 * InsertLine w/ Weird Character
RINGLOOP: * Loop Through File Ring Until
* Begin Point Reached
NextFile * Edit Next File in Ring
FILELOOP: * Loop Until All Markers in
* File are Deleted
Find * Search File
#031 #030 Return * for Next Label Marker
"G" Return * Retain Cursor Pos If Not Found
JFalse FILECLEAN: * Label Marker Not Found, Exit Loop
DelLine * Label Marker Found, Del the Line
Jump FILELOOP: * See if More Markers in Current File
FILECLEAN: * File Now Clean of Markers
Find * Search File
#224 Return * for Begin Point Marker
"G" Return
JFalse RINGLOOP: * Begin Point Not Found, Try Next File
* If Here, All Markers Deleted and
* Back to Starting Point
DelLine * Delete line with Marker in Original File
*
* 35 bytes Tue 04-30-1991 00:53:21
* Version History:
* ----------------
* 1.0 May 3, 1991 Initial.
* 1.0a May 4, 1991 Changed @7 to return to starting position if
* no marker found.
* 1.0b May 4, 1991 Decscription of @4 and @5 were switched. Corrected.
* 1.0c May 10, 1991 Minor documentation changes.
* 1.1 May 19, 1991 Modified @5 and @6 to use scratch buffer test
* for all file and cursor position cases.
* 1.1a May 22, 1991 Shortened @1 and @2 one byte each.