home *** CD-ROM | disk | FTP | other *** search
- /*
- * Reference Macro for TxEd. Supposed to work like the
- * reference utility in dme. REQUIRES THE FULL AREXX SYSTEM
- * TO WORK. (rename file to reference.txed)
- */
-
- SIGNAL ON ERROR /* catch any errors */
- OPTIONS FAILAT 60 /* but don't die and go away */
- OPTIONS RESULTS
-
- MARK 1 /* get the current word from TxEd */
- word
- 'COPY +X'
- 'STATUS M+X'
- find = strip(result,,' ') /* strip string is a blank and a tab */
-
- /* put a nice message on the txed window */
- line = "Attempting to reference" find
- msg line
-
- /* extract the 'stuff' if it exists */
- address command 'getrefs' find
-
- /* it exists, so start another txed process and get it's address */
- line = setclip("Reference","1")
- Moretxed
-
- /* wait loop to allow new txed to finish being born */
- call time 'r'
- do while time(e) < 2.5
- nop
- end
-
- newtx = getclip("Reference") /* get address of new txed */
- line = setclip("Reference") /* don't want anyone else to use OUR var */
-
- /* tell new txed to move to top of screen and display extracted text */
- /* this particular set of commands will display the function call */
- /* template if you are referencing the autodocs. change to taste */
- address value newtx
- 'window 0 0 640 50'
- 'load ram:extract.txt'
- top
- down 4
-
- /* now tell the original txed to get out of the way and activate itself */
- address
- 'window 0 45 640 154'
-
- /* be nice and tidy by deleteing the temporary file */
- address command 'delete ram:extract.txt'
- exit
-
- /* if the GetRefs program failed, ARexx will come here. The DOS */
- /* return code will be in the variable rc so we can construct a */
- /* specific error message to send back to the original txed */
- ERROR:
- select
- when rc = 50 then line = "Bad command line to GetRefs command"
- when rc = 51 then line = "Can't open reference file TxEd.refs"
- when rc = 52 then line = "Reference string" find "was not found"
- when rc = 53 then line = "Bad line format in TxEd.refs - couldn't decode"
- when rc = 54 then line = "Can't open reference source file"
- when rc = 55 then line = "Can't find referenced text"
- when rc = 56 then line = "Can't open ram:extract.txt - bad news"
- otherwise line = "Unrecognized error - something is very wrong"
- end
- msg line
- exit /* we don't exit with an error code since that erases our nice message*/
-