home *** CD-ROM | disk | FTP | other *** search
- /* HTML-Helper Arexx script for SAS-C's SE (Stream Editor)
- * Ver : 1.0 (7th January 1996)
- * Copyright: Paul Kolenbrander (InterNet: paul@serena.iaehv.nl)
- * Function : Pass on the HTML commands from HTML-Helper to SE.
- * Input : HTMLCMD - The HTML command to be inserted.
- */
-
- OPTIONS RESULTS /* enable return codes */
- PARSE ARG MYCMD HTMLCMD
- HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-1) /* strip leading space */
-
- HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-2) /* strip leading/trailing " */
-
- posit=1 /* replace all '"' by '\"' */
- NEWSTRING="" /* as SE eats the '"'. :-( */
- max=LENGTH(HTMLCMD)
- DO UNTIL posit = max
- IF SUBSTR(HTMLCMD,posit,1) = '"' THEN
- NEWSTRING = NEWSTRING || '\'
- NEWSTRING = NEWSTRING || SUBSTR(HTMLCMD,posit,1)
- posit=posit+1
- END
- NEWSTRING = NEWSTRING || SUBSTR(HTMLCMD,LENGTH(HTMLCMD),1)
- HTMLCMD=NEWSTRING
-
- address 'SC_SE' /* SE's ARexx port */
-
- IF POS('><',HTMLCMD) ~= 0 THEN DO /* Is it a split command? */
- /* If yes, then.... */
- 'BM "E"' /* Get Block end position */
- options results
- 'GL' /* get the line number */
- end = result
- 'LL "'|| end ||'\n"' /* Move to end of block */
- 'NL'
- 'BL'
- CMD2 = right(HTMLCMD,(LENGTH(HTMLCMD)-(LASTPOS('<',HTMLCMD))+1))
- 'IL' CMD2 /* insert the back tag */
-
- 'BM "B"' /* Get Block start position */
- options results
- 'GL' /* get the line number */
- begin = result
- 'LL "'|| begin ||'\n"' /* Move to start of block */
- CMD1 = substr(HTMLCMD,1,(LENGTH(HTMLCMD)-LENGTH(CMD2)))
- 'BL'
- 'IL' CMD1 /* insert the front tag */
- END
- ELSE
- 'IL' HTMLCMD /* Insert at current pos. */
-
- EXIT /* And exit the script. */
-