home *** CD-ROM | disk | FTP | other *** search
- /*
- * Name GENERIC.ERX
- *
- * Author Ralph E. Yozzo, Larry Margolis
- *
- * Function An example EPM REXX macro. Used by RXMENU.ERX
- */
- arg function .
- if function='' then function='TRANSLATE'
- select
- when function='LEFT' | function='RIGHT' | function='CENTER' then boundary=',80'
- otherwise boundary=''
- end
- if function='REVERSE' then function_call = "reverse(getline.1)" /* Don't strip for Reverse() */
- else function_call = "strip("function"(strip(getline.1)"boundary"),'t')"
-
- 'extract /getmark/filename'
- if getmark.0 > 0 then 'dokey a+Y' /* Move to beginning of mark, even if in a different file. */
- oldfilename = filename.1
- 'extract /last/modify/autosave/line/filename'
- call etksetfilefield 'autosave', 0 /* Turn off autosaving... */
- if getmark.0 > 0 then do
- firstline=getmark.1
- lastline=getmark.2
- marked = 'marked lines'
- if filename.1 <> oldfilename then
- 'sayerror Working on marked area in' filename.1 '...'
- else
- 'sayerror Working on marked area...'
- end ; else do
- firstline=1
- lastline=last.1
- marked = ''
- 'sayerror Working on file...'
- end
- limit = lastline - firstline + 1
-
- do i = firstline to lastline /* For every line in the file or mark, */
- call etksetfilefield 'line', i /* make that line the current line */
- 'extract /getline'
- interpret "call etkreplacetext" function_call
- j = i - firstline + 1
- if j // 50 = 0 then
- 'sayerror Processed' j 'lines of' limit marked
- end
- 'sayerror 0'
- call etksetfilefield 'modify', modify.1 + 1 /* Treat as a single change */
- call etksetfilefield 'autosave', autosave.1 /* Restore autosaving */
- call etksetfilefield 'line', line.1 /* Restore current line */
-