home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: FD2Pragma.filer 1.1 (26.11.93)
-
- Author:
- Michael Böhnisch (billy@uni-paderborn.de) (mb)
-
- Function:
- Create files with SAS/C #pragma statements from library
- function description files (#?.fd). Automagically chooses
- "standard" file name for target file.
-
- Requires:
- SAS/C fd2pragma tool (SC:C/fd2pragma)
-
- Call:
- fd2pragma
-
- (no parameters, operates on selected files in Filer's
- source window)
-
- Example for "Filer.RC":
- XBUTTON 3,3,0,1,"fd2pragma","fd2pragma"
-
- History:
- 05.10.1993 1.0 Initial Release (mb)
- 26.11.1993 1.1 Review for Filer 3.10 Gamma 2 (mb)
- */
-
- OPTIONS RESULTS /* aquire results */
-
- /* -------------------------------------------------------------------- */
-
- fdcmd = 'SC:C/fd2pragma' /* conversion command to call */
- fdtail = '_lib.fd' /* fname suffix for validity check */
- fdtaillen = LENGTH( fdtail )
- pragmasuff = '_pragmas.h' /* suffix to replace fdtail */
-
- /* -------------------------------------------------------------------- */
-
- text1 = "is no fd file or has wrong name.|"
- text1 = text1 || "Continue anyway?"
-
- text2 = "Name of header file to create?"
- text2 = text2 || " (`" || pragmasuff || "´ is appended automagically)"
-
- /* -------------------------------------------------------------------- */
-
- ADDRESS 'FilerRexx' /* default to Filer's AReXX port */
-
- PANEL OFF /* deactivate Filer's GUI buttons */
-
- /* -------------------------------------------------------------------- */
- /* get source directory name, append "/" if it is not a device name */
- /* -------------------------------------------------------------------- */
-
- GETSOURCEPATH
- srcdir = RESULT
- IF RIGHT( srcdir, 1 ) ~= ":" THEN srcdir = srcdir || "/"
-
- /* -------------------------------------------------------------------- */
- /* get target directory name, append "/" if it is not a device name */
- /* -------------------------------------------------------------------- */
-
- GETTARGETPATH
- tgtdir = RESULT
- IF RIGHT( tgtdir, 1 ) ~= ":" THEN tgtdir = tgtdir || "/"
-
- GETNUMENTRIES /* get number of source entries */
- numentries = RESULT
-
- DO i = 1 TO numentries /* loop through all entries */
- GETNAME i /* get ith entry */
- entry = RESULT
-
- type = LEFT( entry, 1 ) /* parse filetype (f, d, F, D) */
- name = SUBSTR( entry, 2 ) /* parse filename */
-
- SELECT
-
- WHEN type = 'f' THEN DO /* if entry is a selected file... */
-
- /* ---------------------------------------------------------------- */
- /* do a validity check on the filename, consult user on */
- /* failure */
- /* ---------------------------------------------------------------- */
-
- IF RIGHT( name, fdtaillen ) ~= fdtail THEN DO
- txt1 = name || "|" || text1
- QUESTBOX txt1
- IF RESULT = 1 THEN DO
- SETSTRING name
- GETSTRING text2
- IF RESULT ~= 'RESULT' THEN DO
- node = RESULT
- CALL Convert
- END
- END
- END
- ELSE DO
- node = SUBSTR( name, 1, LENGTH( name ) - fdtaillen )
- CALL Convert
- END
-
- TOGGLEENTRY i
- END /* WHEN */
-
- WHEN type = 'd' THEN /* if entry is a directory... */
- TOGGLEENTRY i /* de-select and ignore */
-
- OTHERWISE /* ignore entries not selected */
-
- END /* SELECT */
- END /* DO i */
-
- UPDATETARGETDIR /* re-read Filer's dest window */
- PANEL ON /* activate buttons */
- EXIT /* voilá! */
-
- /* -------------------------------------------------------------------- */
- /* Subroutine "Convert": */
- /* Create History entry for filer, execute conversion command */
- /* -------------------------------------------------------------------- */
-
-
- Convert:
- HISTORY "fd2pragma" srcdir||name "-->" tgtdir||node||pragmasuff
- SHELL COMMAND fdcmd srcdir||name tgtdir||node||pragmasuff
- RETURN
-