/*REXX*/ /*------------------------------------------------------------------- This Help Macro is used to display a help screen for a keyword based on the extension of the filename such as SPF, REX, CMD, PHP, etc. Works with web pages (on or off-line) and with Windows Compiled HTML Manuals (CHM). Using SPFPRO/SPFPC4: Assign a key to the H3.SPF macro, place cursor over keyword in document and press key. SPF/PC, SPFSE, XE or non-REXX integrated editor, use the editor's DOS command to call the REXX interpreter passing it the macro path/name, language and keyword. Example: SPF/PC: TSO c:\path\REXX.EXE C:\PATH\H3.SPF PHP REQUIRE SPFSE: DOS c:\path\REXX.EXE C:\PATH\H3.SPF PHP REQUIRE XE: cmd c:\path\REXX.EXE C:\PATH\H3.SPF PHP REQUIRE NOTE1: For SPF/PC, XE or other non-REXX integrated editor it makes calling this macro easier if you set up a batch script to call the REXX interpreter. EXAMPLE: @ECHO OFF REM --------------------------------------------------------- REM H.BAT Calls my Help System REM Presumes that H.BAT resides somewhere in the command path REM --------------------------------------------------------- H:\U\PCDOS\REXX.EXE H:\U\SPFPC40\MACROS\H3.SPF %1 %2 so SPF/PC would be: TSO H PHP REQUIRE SPFSE would be: DOS H php require (yes, spfse via a batch file can execute rexx macros) XE would be: CMD h PHP REQUIRE For HTML or CHM type helps Internet Explorer is Invoked. Press ALT F4 to close that window when done. Change the THELP variable to point to your .BDX files. NOTE2: The normal path for IE contains spaces which will not work for SPFPC 4.x (DOS) or any DOS based REXX interpreter. Hence the reason you need a DOS friendly path to IEXPLORE. Copy IEXPLORE.EXE to directory without spaces. Be sure to change the TBROWSER path in this macro to match the new path. NOTE3: You can call info from the Help file or from any help file by entering the resquest on the command line. EXAMPLE: H3 PBW strings regardless of what type of code is being edited in from the PBW strings will be displayed. H3 strings Will display the strings info of the current code type (Extension BAS REX) NOTE4: For SPFPRO users, when editing .spf/isp files the SFPRO help system is called. NOTE5: To call this macro with a double left moust click: SPFPRO: Edit the keyboard mouse value by selecting =0.k then edit (e) the keyboard profile (such as DEFAULT) then selection option 6 (Mouse) then change LEFT-Doubleclick from [Cursor-mouse-select] to h3.spf SPFPCv4: Same changing Button-1-Double from [CURSOR-MOUSE-SELECT] to h3.spf NOTE6: If using OOREXX you need to delete the SPFPCv/SPFPRO ISREDIT code or it will refuse to execute. This is due to OOREXX scanning the code for errors before it executes the code. A debatable benefit. By Mark McDonald - Last Update 18 Mar 2008 -------------------------------------------------------------------*/ /* TRACE I */ /*--- Determine IF SPFPRO, SPFPC v4.x or Stand-alone REXX Interpreter ---*/ parse version name level date1 date2 date3 /*--- Use this section to display REXX Interpreter Info ---*/ /* SAY ' name = "'name'"' SAY 'level = "'level'"' SAY 'date1 = "'date1'"' SAY 'date2 = "'date2'"' SAY 'date3 = "'date3'"' EXIT */ /*-- Determine which REXX interpreter is being used ---*/ TSPF = 0 /* Using a stand-alone DOSREXX Interpreter */ IF (name = "REXX-r4" & date3 = 2007) THEN TSPF = 1 IF (name = "REXX/2" & date3 = 1995) THEN TSPF = 4 /* Using SPFPC v4 */ IF (name = "REXX/2" & date3 = 1996) THEN TSPF = 5 /* Using SPFPRO */ /*--- Determine Path of Browser for Interpreter ---*/ TBROWSER = "H:\U\IE.EXE" /* USE FOR SPC/PC 4.x or Stand Alone REXX Interpreter*/ /*--- Path of Help File Indexs (BDX) ---*/ THELP = "H:\U\MHELP\" TFILEOUT = "C:\TEMP\DRET.HTM" TBATCHIN = "C:\TEMP\DRET.DAT" /*--- Use for stand-alone REXX */ IF (TSPF <> 4 & TSPF <> 5) THEN DO PARSE UPPER ARG EXNT PARMS /*--- Remember DOS can not handle a parm with a < or > in it --*/ IF EXNT = "HTML" | EXNT = "HTM" THEN PARMS = '<'PARMS IF EXNT = "SPFSE" THEN DO column = WORD(PARMS,1) FULLNAME = WORD(PARMS,2) EXNT = SUBSTR(FULLNAME,POS('.',FULLNAME)+1,3) text = TRANSLATE(WORD(PARMS,3),' %<>|@"=',"Çüéâäàåç") PARMS = TUNMASK(text, column) END END /*--- This section used for SPFPRO/SPFPCv3/4 Only ---*/ IF (TSPF = 4 | TSPF = 5) THEN DO /*--- Since OOREXX/Reginald checks ALL syntax prior to execution if using OOREXX/Reginald ---*/ 'ISREDIT MACRO(PARMS)' IF WORDS(PARMS) = 1 & TRANSLATE(PARMS) = "H" THEN DO ERRLINE = "H3.SPF PARMS: H3 EXT KEYWORD H3 KEYWORD H3 PHP SUBSTR H3 HTM 1 THEN DO EXNT = WORD(PARMS,1) PARMS = WORD(PARMS,2) SIGNAL TJUMP END NWRDS = WORDS(PARMS) PASSED = '' /*--- Get Cursor Position and Line Data ---*/ 'isredit (line, column) = cursor' 'isredit (text) = line .zcsr' 'isredit (lrecl) = lrecl' 'isredit (cur_file) = member' /*--- Is Cursor on Command Line or On a Keyword? ---*/ IF column = 0 THEN NOP ELSE DO IF NWRDS = 0 THEN DO PARMS = TUNMASK(text, column) NWRDS = 3 END END END /*--- End SPFPRO/SPFPC4 Only Section ---*/ TJUMP: /*--- Type 1 Plain Text MHELP File? ---*/ IF POS(EXNT,"ASM C DL6 HTM WBT BAS") > 0 THEN DO TTYPE = 1 TPRE = THELP IF EXNT = 'ASM' THEN TFILEIN = TPRE'ASM' /*PC Intel Assembler Reference*/ IF EXNT = 'C' THEN TFILEIN = TPRE'C' /*Generic C*/ IF EXNT = 'WBT' THEN TFILEIN = TPRE'WB' IF EXNT = 'BAS' THEN TFILEIN = TPRE'ZB' END /*--- Type 2 Web Page? --*/ IF POS(EXNT,"ADS HTML HTM REX CMD SPF ISP PBW LBS COB CBL PBS PBC") > 0 THEN DO TTYPE = 2 TPRE = THELP IF EXNT = "ADS" THEN TFILEIN = TPRE'ADS' /*IDMS ADSO Reference*/ IF EXNT = 'HTML' THEN TFILEIN = TPRE'HTML' /*Uses W3C web site*/ IF EXNT = 'HTM' THEN TFILEIN = TPRE'HTML' IF EXNT = 'PBW' THEN TFILEIN = TPRE'PBWIN' /*PowerBASIC Windows Compiler*/ IF EXNT = 'REX' THEN TFILEIN = TPRE'OOREXX' /*OOREXX Reference*/ IF EXNT = 'CMD' THEN TFILEIN = TPRE'REXXC' /*Classic REXX Reference*/ IF EXNT = 'SPF' THEN TFILEIN = TPRE'SPFPRO' /*Uses SPFPROINDX.HTM on manmark*/ IF EXNT = 'ISP' THEN TFILEIN = TPRE'SPFPRO' IF EXNT = 'LBS' THEN TFILEIN = TPRE'LB' IF EXNT = 'COB' THEN TFILEIN = TPRE'COBOL' IF EXNT = 'CBL' THEN TFILEIN = TPRE'COBOL' IF EXNT = 'PBS' THEN TFILEIN = TPRE'PBS' IF EXNT = 'PBC' THEN TFILEIN = TPRE'PBC' END /*--- Type 3 Windows CHM Help File? ---*/ IF POS(EXNT,"PHP") > 0 THEN DO TTYPE = 3 TPRE = THELP IF EXNT = 'PHP' THEN TFILEIN = TPRE'PHP' /*PHP Compiled Windows Reference*/ END /*--- Type 4 SPFPRO HELP File (Change the path to where you have SPFPRO ---*/ IF (POS(EXNT,"SPF ISP") > 0 & TSPF = 5) THEN DO ADDRESS ISREDIT 'C:\SPFPRO\REXX\SPF5HELP.ISP 'PARMS EXIT 0 END /*--- Main Loop --*/ DO WHILE LINES(TFILEIN'.BDX') > 0 T = LINEIN(TFILEIN'.BDX') /*--- Type 1 Plain Text File on PC - Puts line in code as note (SPFPRO/SPFPC4 Only) ---*/ IF (TTYPE = 1 & (TSPF = 4 | TSPF = 5)) THEN DO IF PARMS = WORD(T,4) THEN DO DATALINE = SUBSTR(T,24) CALL FIXQUOTES T = LINEOUT(TFILEIN'.BDX') EXIT 0 END END /*--- Type 2 Web Page - Calls Browser ---*/ IF TTYPE = 2 THEN DO IF PARMS = TRANSLATE(WORD(T,1)) THEN DO TCMD = TBROWSER' 'WORD(T,2) T = LINEOUT(TFILEIN'.BDX') CALL TOSCMD TSPF, TCMD EXIT 0 END END /*--- Type 3 Compiled HTML Manual (CHM) --*/ IF TTYPE = 3 THEN DO IF PARMS = TRANSLATE(WORD(T,1)) THEN DO TCMD = TBROWSER" mk:@MSITStore:"THELP''WORD(T,2) T = LINEOUT(TFILEIN'.BDX') CALL TOSCMD TSPF, TCMD EXIT 0 END END END EXIT 0 /*--- Unmask Keyword ------------------------------------------------------*/ TUNMASK: PROCEDURE PARSE ARG text, column /* --- Get first previous text position ---*/ TableYes = '_\:.*?<#$' || XRANGE('0','9') || XRANGE('A','Z') || XRANGE('a','z') TableNo = TRANSLATE(XRANGE(D2C(32),D2C(255)),,TableYes,' ') wordmask = TRANSLATE(text,,TableNo, ' ') wordmask = TRANSLATE(wordmask,,TableYes,'*') /* --- Get wordindex for the cursor position when function key pressed ---*/ n = 1 Wi = 0 Wn = 0 DO FOREVER; i = WORDINDEX(wordmask,n) IF (i = 0) THEN LEAVE IF (i <= column) THEN DO Wi = i Wn = n END ELSE LEAVE n = n+1 END /*--- Get word text ---*/ Wm = WORD(wordmask,Wn) TL = LENGTH(Wm) WFile = SUBSTR(text,Wi,TL) PARMS = TRANSLATE(WFile) PARMS = STRIP(PARMS) RETURN (PARMS) /*--- Pass Command to OS --------------------------------------------------*/ TOSCMD: PROCEDURE PARSE ARG TSPF, TCMD IF TSPF = 0 THEN ADDRESS COMMAND TCMD /*DOSREXX*/ IF (TSPF = 4 | TSPF = 5) THEN ADDRESS DOS TCMD /*SPFPC4/SPFPRO - Delete if using OOREXX*/ IF (TSPF = 1 | TSPF = 6) THEN TCMD /*OOREXX/R4*/ RETURN /*--- Change quotes(single/double) to tildes - prevents REXX errors - SPFPRO/SPFPCv3/4 - Delete if using OOREXX ---*/ FIXQUOTES: ERRLINE = TRANSLATE(DATALINE,"~","'") ERRLINE = TRANSLATE(ERRLINE,'~','"') "ISREDIT LINE_BEFORE " line "= NOTELINE '"ERRLINE"'" RETURN