home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Der Mediaplex Sampler - Die 6 von Plex
/
6_v_plex.zip
/
6_v_plex
/
DISK5
/
DOS_34
/
AMAC44.ZIP
/
MIS002.QM
< prev
next >
Wrap
Text File
|
1992-06-22
|
22KB
|
473 lines
* mis002.qm
* Miscellaneous Counting and Line Numbering Macros
* Written By Tom Hogshead
* [ See MISCxx.QM For Use ]
* 6/18/92
* Key Subfile Description
* ===== ========= =====================================================
* Make File of Numbers 1 to 99, No Leading Zeros:
* @f2 - Small version ( ) |new
* @7 - Longer Version Using @5 Technique |new
* @9 Add Line Numbers 001 to 999 In Col 1
* @0 Add Line Numbers 0001 to 9999 In Col 1
* @3 Make File of Numbers 0001 to 9999 Ascending
* @4 Make File of Numbers 9999 to 0001 Descending
* @5 Make File of Numbers 001 to 999 Ascending
* @6 Make File of Numbers 999 to 001 Descending
* @1 Add Line Numbers 0001 to 9999 In Col 81
* @2 Remove Previous Line Numbers Made With @1
*
* @3 {e:\up\rfr005}--Count Words in a File (Use this)
* @0 {e:\up\rfr005}-- (Alternate version of rfr005.qm @3)
* @1 {e:\up\rfr005}--Count Characters in a Block
* @2 {e:\up\rfr005}--Count Characters in a File EXCLUDING Spaces
* @4 {e:\up\rfr005}--Count Words in a Block
* @5 {e:\up\rfr005}--Count Characters In A File INCLUDING Spaces
* @6 {e:\up\rfr005}--Count Words & Characters in File w/COUNT.EXE
* @f1 {e:\up\PAGE*} --Number Pages in File Containing 'Page' <space> '-'
*
* {e:\up\MISC*} Return To MISCxx.QM
*
* (Generic) Counting
*
*-- eoi
* M A C R O S
* --------------------------------------------------------------------------
* @(1) Number Lines in File 0001 To 9999 In Col. 81, Ver #3, QEdit v2.15 Reqd.
* --------------------------------------------------------------------------
* This macro is a versatile macro which can be easily modified and used
* to add line numbers to any column with any desired characters
* preceding the line number as shown in @0. The maximum lines that can
* be numbered is limited only by available memory.
* As written, this macro will number up to 9,999 lines in a file with
* line numbers in column 81 preceded by "Asterisk and Ascii #173 (¡)".
* Previous line numbers may be removed with macro @2.
* Speed of inserting line numbers is approximately 40 - 50 lines/sec on
* my 12 mhz AT. For approximately 10% faster operation, remove the
* line "SETSCREENON SETSCREENOFF". This macro assumes there is no text
* in col's 81+.
* I have modified and used the excellent line numbering line numbering
* algorithm originally written by John Goodman. Thanks again to John
* for this excellent technique. It is one of the most creative QEdit
* macro algorithms I have seen.
@1 macrobegin
SETSCREENOFF
savesettings setinsmode setwordwrapmode togglewordwrap
unmarkblock dropanchor editfile "NUL" return quit gotoblockbeg
*--- (Insert @2 here to remove previous line numbers)
DO: begfile onewindow horizontalwindow editfile return dropanchor
"0123456789" copy begline paste paste paste markcharacter endline
storescrbuff "1" return unmarkblock prevwindow
gotocolumn "81" return "*" #173 "0000 " cursorleft
MAINLOOP: nextwindow begfile
LOOP: delch isendline jfalse INCR unmarkblock
SETSCREENON SETSCREENOFF * Remove this line for speed
getscrbuff "1" return unmarkblock prevwindow backspace "0"
cursorleft nextwindow cursordown jump LOOP
INCR: markcolumn prevwindow backspace copyblock cursordown jfalse END
gotocolumn return
getprev 7 jump MAINLOOP
END: nextwindow quit prevwindow onewindow
begfile endline unmarkblock restoresettings
*
* 145 bytes Mon 10-28-1991 22:19:27 (TH @1, ver 1)
* 173 bytes Tue 10-29-1991 22:23:15 (TH @1, ver 2)
* 132 bytes Tue 11-12-1991 02:12:40 (TH @1, ver 3)
*
* ----------------------------------------------------------------------
* @(2) Remove Previous Line Numbers Made With @1, QEdit v2.15 Reqd.
* ----------------------------------------------------------------------
@2 macrobegin
SETSCREENOFF
* *--- (Add these lines if needed to @1)
begfile find "*" #173 return delline return
jfalse DO begfile gotocolumn "81" return
isendline jfalse COL1 begfile
COL1: unmarkblock markcolumn
gotoline "9999" return
cursorright 6 deleteblock
ODD: Find return "B" return jfalse DO wordright markword
gotoblockend markcolumn Find return "B" return
markcolumn deleteblock jump ODD
* *---
DO: begfile
*
* 24 bytes Mon 10-28-1991 15:42:18 (TH @2)
* 70 bytes Sat 11-02-1991 10:30:34 (TH @2)
*
* --------------------------------------------------------------------------
* @(3) Make File of Numbers 0001 to 9999 In Ascending Order, QEdit v2.15 Reqd.
* --------------------------------------------------------------------------
* This macro will make a single column of consecutive numbers from 0001
* to 9999 in file $9999#.
* Speed of inserting line numbers is approximately 40 - 50 lines/sec on
* my 12 mhz AT. For approximately 10% faster operation, remove the
* line "SETSCREENON SETSCREENOFF".
* I have modified and used the excellent line numbering line numbering
* algorithm originally written by John Goodman. Thanks again to John
* for this excellent technique. It is one of the most creative QEdit
* macro algorithms I have seen.
@3 macrobegin
SETSCREENOFF
savesettings setinsmode setwordwrapmode togglewordwrap
editfile "$9999#" return
endline begfile jtrue END
dupline repeatcmd "9997" return
unmarkblock dropanchor editfile "NUL" return quit gotoblockbeg
DO: begfile onewindow horizontalwindow editfile return dropanchor
"0123456789" copy begline paste paste paste markcharacter endline
storescrbuff "1" return unmarkblock prevwindow "0000 " cursorleft
MAINLOOP: nextwindow begfile
LOOP: delch isendline jfalse INCR unmarkblock
SETSCREENON SETSCREENOFF * Remove this line for speed
getscrbuff "1" return unmarkblock prevwindow backspace "0"
cursorleft nextwindow cursordown jump LOOP
INCR: markcolumn prevwindow backspace copyblock cursordown jfalse END1
begline getprev 5 jump MAINLOOP
END1: nextwindow quit prevwindow onewindow
begfile endline unmarkblock restoresettings
END:
*
* 121 bytes Fri 12-13-1991 01:42:23 (TH @3)
* 151 bytes Sun 12-15-1991 14:03:54 (TH @3)
*
* --------------------------------------------------------------------------
* @(4) Make File of Numbers 9999 to 0001 In Descending Order, QEdit v2.15 Reqd.
* --------------------------------------------------------------------------
* This macro will make a single column of consecutive numbers from 9999
* to 0001 in file $9999#r.
* Speed of inserting line numbers is approximately 40 - 50 lines/sec on
* my 12 mhz AT. For approximately 10% faster operation, remove the
* line "SETSCREENON SETSCREENOFF".
@4 macrobegin
SETSCREENOFF
savesettings setinsmode setwordwrapmode togglewordwrap
editfile "$9999#r" return
endline begfile jtrue END
dupline repeatcmd "9996" return
unmarkblock dropanchor editfile "NUL" return quit gotoblockbeg
DO: begfile onewindow horizontalwindow editfile return dropanchor
"9876543210" copy begline paste paste paste markcharacter endline
storescrbuff "1" return unmarkblock prevwindow "9999 " cursorleft
MAINLOOP: nextwindow begfile
LOOP: delch isendline jfalse INCR unmarkblock
SETSCREENON SETSCREENOFF * Remove this line for speed
getscrbuff "1" return unmarkblock prevwindow
backspace "9" cursorleft nextwindow cursordown jump LOOP
INCR: markcolumn prevwindow backspace copyblock cursordown jfalse END1
begline getprev 5 jump MAINLOOP
END1: nextwindow quit prevwindow onewindow
begfile insertline "9999" begline unmarkblock restoresettings
END:
*
* 162 bytes Sun 12-15-1991 14:04:53 (TH @4)
*
* --------------------------------------------------------------------------
* @(5) Make File of Numbers 001 to 999 In Ascending Order, QEdit v2.15 Reqd.
* --------------------------------------------------------------------------
* This macro will make a single column of consecutive numbers from 001
* to 999 in file c:\$temp.
* Speed of inserting line numbers is approximately 40 - 50 lines/sec on
* my 12 mhz AT. For approximately 10% faster operation, remove the
* line "SETSCREENON SETSCREENOFF".
@5 macrobegin
SETSCREENOFF
savesettings setinsmode setwordwrapmode togglewordwrap
editfile "c:\$temp" return *:18
endline begfile jtrue END
dupline repeatcmd "997" return
unmarkblock dropanchor editfile "NUL" return quit gotoblockbeg
DO: begfile onewindow horizontalwindow editfile return dropanchor
"0123456789" copy begline
paste paste *:18
markcharacter endline
storescrbuff "1" return unmarkblock prevwindow "000 " cursorleft
MAINLOOP: nextwindow begfile
LOOP: delch isendline jfalse INCR unmarkblock
SETSCREENON SETSCREENOFF * Remove this line for speed
getscrbuff "1" return unmarkblock prevwindow backspace "0"
cursorleft nextwindow cursordown jump LOOP
INCR: markcolumn prevwindow backspace copyblock cursordown jfalse END1
begline getprev 4 jump MAINLOOP
END1: nextwindow quit prevwindow onewindow
begfile endline unmarkblock restoresettings
END:
*
* 147 bytes Sun 12-15-1991 14:10:12 (TH @5, #3/796)
* 150 bytes Thu 06-18-1992 14:38:01 (TH @5 changed to c:\$temp)
*
* --------------------------------------------------------------------------
* @(6) Make File of Numbers 999 to 001 In Descending Order, QEdit v2.15 Reqd.
* --------------------------------------------------------------------------
* This macro will make a single column of consecutive numbers from 999
* to 001 in file c:\$temp.
* Speed of inserting line numbers is approximately 40 - 50 lines/sec on
* my 12 mhz AT. For approximately 10% faster operation, remove the
* line "SETSCREENON SETSCREENOFF".
@6 macrobegin
SETSCREENOFF
savesettings setinsmode setwordwrapmode togglewordwrap
editfile "c:\$temp" return *:18
endline begfile jtrue END
dupline repeatcmd "996" return
unmarkblock dropanchor editfile "NUL" return quit gotoblockbeg
DO: begfile onewindow horizontalwindow editfile return dropanchor
"9876543210" copy begline
paste paste *:18
markcharacter endline
storescrbuff "1" return unmarkblock prevwindow "999 " cursorleft
MAINLOOP: nextwindow begfile
LOOP: delch isendline jfalse INCR unmarkblock
SETSCREENON SETSCREENOFF * Remove this line for speed
getscrbuff "1" return unmarkblock prevwindow
backspace "9" cursorleft nextwindow cursordown jump LOOP
INCR: markcolumn prevwindow backspace copyblock cursordown jfalse END1
begline getprev 4 jump MAINLOOP
END1: nextwindow quit prevwindow onewindow
begfile insertline "999" begline unmarkblock restoresettings
END:
*
* 156 bytes Sun 12-15-1991 14:14:19 (TH @6, #3/796)
* 157 bytes Thu 06-18-1992 14:38:34 (TH @6 changed to c:\$temp)
*
* --------------------------------------------------------------------------
* @(7) Make File of Numbers 1 to 99, No Leading Zeros,
* Alternate Longer Version of @f2, Requires QEdit v2.15
* --------------------------------------------------------------------------
* This macro will make a single column of consecutive numbers from 1
* to 99 in the empty temporary file c:\$temp with *no* leading zeros.
@7 macrobegin
SETSCREENOFF
savesettings setinsmode setwordwrapmode togglewordwrap
editfile "c:\$temp" return
begfile
unmarkblock
markline endfile markline
deleteblock
dupline 98 *:18
unmarkblock dropanchor
editfile "NUL" return quit
gotoblockbeg
DO: begfile
onewindow horizontalwindow
editfile return
dropanchor "0123456789" copy begline
paste *:18
markcharacter endline
storescrbuff "1" return
unmarkblock prevwindow "00 " cursorleft *:17
MAINLOOP: nextwindow begfile
LOOP: delch isendline jfalse INCR unmarkblock
SETSCREENON SETSCREENOFF * Remove this line for speed
getscrbuff "1" return
unmarkblock
prevwindow
backspace "0" cursorleft
nextwindow cursordown
jump LOOP
INCR: markcolumn
prevwindow
backspace copyblock
cursordown jfalse END1
begline
getprev getprev *:18
jump MAINLOOP
END1: nextwindow
quit
prevwindow
onewindow
begline *:17
unmarkblock markcolumn *:17
begfile *:17
findreplace '0' return ' ' return 'ln' return *:17
unmarkblock
restoresettings
END:
*
* 161 bytes Wed 06-17-1992 18:10:21 (TH @7, changed @5 *|)
* 157 bytes Thu 06-18-1992 14:42:38 (TH @7 removed unnecessary paste *:)
*
* ----------------------------------------------------------------------
* @(9) Add Line Numbers 001 to 999 in Col 1, QEdit v2.15 Required
* ----------------------------------------------------------------------
* This macro will add line numbers 001 to 999 in file in any file. I
* have modified and used the excellent line numbering line numbering
* algorithm originally written by John Goodman. Thanks again to John
* for this excellent technique. It is one of the most creative QEdit
* macro algorithms I have seen.
* 500 41/11
@9 macrobegin
SETSCREENOFF
SetInsMode
UnmarkBlock BegFile DropAnchor EditFile "NUL" Return Quit
GotoBlockBeg UnmarkBlock OneWindow HorizontalWindow
EditFile Return DropAnchor "0123456789" Copy BegLine
Paste Paste DropAnchor EndLine CursorLeft
StoreScrBuff "1" Return UnmarkBlock
PrevWindow ShiftRight "000"
MAINLOOP: NextWindow BegFile
LOOP: DelCh EndLine JTrue INCR: GetScrBuff "1" Return UnmarkBlock
SETSCREENON SETSCREENOFF * Remove this line for speed
PrevWindow BackSpace "0" CursorLeft
NextWindow CursorDown Jump LOOP:
INCR: BegLine DropAnchor
PrevWindow BackSpace CopyBlock BegLine CursorDown JFalse END:
ShiftRight GetPrev GetPrev GetPrev
Jump MAINLOOP:
END: NextWindow Quit PrevWindow OneWindow GoToBlockEnd
BegFile UnmarkBlock
*
* 110 bytes Sat 11-02-1991 10:31:02 (TH @9, to TF #20/252, 2/1/92)
* 113 bytes Sat 02-01-1992 14:24:36 (TH @9, added SETSCREENON|off+4x faster)
*
* ----------------------------------------------------------------------
* @(0) Add Line Number 0001 to 9999 in Col 1, QEdit v2.15 Required
* ----------------------------------------------------------------------
* This macro will add line numbers 0001 to 9999 in file in any file.
@0 macrobegin
SETSCREENOFF
SaveSettings SetInsMode
UnmarkBlock BegFile DropAnchor EditFile "NUL" Return Quit
GotoBlockBeg UnmarkBlock OneWindow HorizontalWindow
EditFile Return DropAnchor "0123456789" Copy BegLine
Paste Paste Paste DropAnchor EndLine CursorLeft
StoreScrBuff "1" Return UnmarkBlock
PrevWindow ShiftRight "0000"
MAINLOOP: NextWindow BegFile
LOOP: DelCh EndLine JTrue INCR: GetScrBuff "1" Return UnmarkBlock
SETSCREENON SETSCREENOFF * Remove this line for speed
PrevWindow BackSpace "0" CursorLeft
NextWindow CursorDown Jump LOOP:
INCR: BegLine DropAnchor
PrevWindow BackSpace CopyBlock BegLine CursorDown JFalse END:
ShiftRight GetPrev GetPrev GetPrev GetPrev
Jump MAINLOOP:
END: NextWindow Quit PrevWindow OneWindow GoToBlockEnd
BegFile UnmarkBlock
*
* 115 bytes Tue 10-29-1991 17:28:04 (TH @0)
* 118 bytes Sat 02-01-1992 14:26:18 (TH @0, added SETSCREENON|off+4x faster)
*
* ----------------------------------------------------------------------
* @(f2) Make File of Numbers 1-99, No Leading Zeros
* ----------------------------------------------------------------------
* This macro will insert numbers 1-99 in ascending order with no
* leading zeros, in an empty temporary file 'c:\$temp'. Without having
* a macro counting or incrementing function, this macro could be
* modified to simulate 'if/then/count/end at count'. Un-Comment
* 'closewindow' line at end if Qconfig not set to close window on quit.
* Macro requires QEdit v2.15.
@f2 macrobegin
SETSCREENOFF setinsmode
setautoindentmode toggleindent
onewindow
markcolumn * Mark pos in starting file
editfile 'c:\$temp' return quit
gotoblockend
editfile 'nul' return quit * Load/quit nul
gotoblockend
prevfile prevfile * For correct ring pos *:
horizontalwindow * Window 2
editfile return * Load nul as next file
markcharacter
'1234567890' * Insert counting line
storescrbuff 'c' return * Store to scratch buff 'c'
dupline *:
cursorup *:
shiftright * Put's space in col 1
delch * Remove '0' line 1
cursordown *:
unmarkblock
horizontalwindow * Window 3
editfile 'c:\$temp' return *
COUNT:
prevwindow * Window 2
begline markcolumn
getprev * Get ten's digit line 2 col 1
cut * Cut count to scrap
NEXT_TEN:
nextwindow * Window 3
paste unmarkblock * Insert count
addline * Make room for next count
prevwindow * Window 2
cursorright
isendline jfalse NOT_EOL * Test if we need to jump 10
cursorup begline delch * Move next ten's to col 1
isemptyline jtrue QUIT
cursordown begline
markcolumn
getprev * Put ten's digit line 2 col 1
cut * Cut count to scrap
getscrbuff 'c' return * Insert new one's line
unmarkblock *:
SETSCREENON SETSCREENOFF * Remove this line for speed *:
jump NEXT_TEN
NOT_EOL:
cursorleft * Re-position after eol test
nextwindow * Window 3
jump COUNT * Count 'till no more count
QUIT:
quit * Quit nul
* closewindow * Add if no quit window/close
END:
nextwindow * Window 3
onewindow
delline
begfile
toggleindent
*
* 142 bytes Wed 06-17-1992 17:33:15 (TH @f2, to All #3/870)
* 143 bytes Thu 06-18-1992 15:04:27 (TH @f2, changed for ring pos)
*
* (Generic) Counting
* -------------------
* The following can be used for different number of counting digits.
* From Line# development file...
* For every extra digit, must add 'paste, 0, getprev' as follows:
* # # # # # Start
* Digits Paste's Getprev's 0's Chars. Key
* -------- ------- ---------- ---- -------- ------
* 2+1=3 1 2 2 00 @7
* 3+1=4 2 3 3 000 @5,6,9
* 4+1=5 3 4 4 0000 @3,4,0
* 4+3=7 3 7 4 #173 0000 @1