home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
lpexmac.zip
/
loadfile.lx
< prev
next >
Wrap
Text File
|
1998-09-05
|
4KB
|
98 lines
/* english text follows below */
/* Datei: loadfile.lx
Zweck: Macro zum laden einer anderen Datei in ein neues Editorfenster.
Erstellt: 03.08.98
Autor: Jens Fettkenheuer (Clearwater Software & System Service GmbH)
Erläuterungen:
Diese Datei muss sich entweder im Verzeichnis X:\IBMCPP\MACROS oder
in einem Verzeichnis das in der Umgebungsvariablen "LPATH" aufgeführt
ist, befinden.
Um das Macro zu aktivieren, muss in die Datei PROFILE.LX die Zeile:
'SET ACTION.C-F2 MACRO LOADFILE'
eingefügt werden. Diese sorgt dafür, daß durch drücken der Tastenkombination:
CTRL+F2 bzw. Strg+F2
das Macro gestartet wird.
Voraussetzung für das Laden einer Datei ist
entweder:
der Cursor befindet sich in einer Zeile die mit dem #include- Statement beginnt
oder
der Dateiname wird als Textblock im Editorfenster markiert
Es können nur Dateien geladen werden die sich entweder im aktuellen Path der Editor-
Session befinden oder in einem der Pfade die in der Umgebungsvariablen "INCLUDE" auf-
geführt sind.
Ich habe festgestellt, daß neue Macros erst nach einem Reboot (OS/2) aktiv werden.
*/
/* File: loadfile.lx
Purpose: macro to load an other file into a new editor window
Created: 03.08.98
Author: Jens Fettkenheuer (Clearwater Software & System Service GmbH)
Explanations:
This file must be stored either into the directory X:\IBMCPP\MACROS or in a
directory stated in the environment variable "LPATH".
To activate the macro the following line must be inserted into the file
PROFILE.LX
'SET ACTION.C-F2 MACRO LOADFILE'
These line activates the keys
Ctrl+F2
to start the macro.
Precondition to load a file is
either:
the cursor must be located in a line beginning with the #include- statement
or:
the file name must be marked as a block of text inside the current editor session.
Only files located either in the current directory of the current editor session or
located in one of the directories statet in the "INCLUDE" environment variable can
be found and therefore loaded via this macro.
i found that new macros become active after a reboot only
*/
call RxFuncAdd 'SysSearchPath', 'RexxUtil', 'SysSearchPath'
'extract content into lCurrentLine'
lIncludeString= subword(lCurrentLine, 1, 1)
lFileName= ""
if (lIncludeString = "#include") then
do
lFileName= subword(lCurrentLine, 2, 1)
lFileName= strip(lFileName, 'L', '<')
lFileName= strip(lFileName, 'T', '>')
lFileName= strip(lFileName, 'B', '"')
end
else
do
'extract blockstart into lBlockStart'
'extract blocklength into lBlockLength'
if (lBlockStart > 0) & (lBlockLength > 0) then
lFileName= substr(lCurrentLine, lBlockStart, lBlockLength)
else
do
alarm
say "move cursor to line starting with #include statement or mark the filename to load as block of text"
exit
end
end
if (length(lFileName) > 0) then
do
lFoundFile= SysSearchPath('INCLUDE', lFileName)
if (lFoundFile = "") then
do
'alarm'
say 'the file --> ' lFileName' <-- could not be found (must be either in the current directory or in the INCLUDE path)'
end
else
do
say 'file ' lFoundFile ' successfully loaded'
'lx' lFoundFile
end
end