Thread View: alt.sources.amiga
1 messages
1 total messages
Started by Edward Bacon
Mon, 16 Nov 1992 19:44
SAS/C Browser and TurboText script
Author: Edward Bacon
Date: Mon, 16 Nov 1992 19:44
Date: Mon, 16 Nov 1992 19:44
267 lines
6062 bytes
6062 bytes
Here is an AREXX script I use to go to lines with errors from the
SAS/C message browser(scmsg). Please read the comments for more
information.
Regards,
Ed.
/*
** $VER: FileSC.ttx 1.0 (30 Oct 1992)
** By E. F, Bacon. This code may be freely distributed.
**
** Used by SCmsg (SAS/C Message Browser) to open file and goto the line
** of the current error when you double click or type return on an error
** message. Set the GOTOFILE option to this file and set the PORTNAME
** to AREXX.
**
** My SCMSG environment is:
**
** LEFT 0
** TOP 329
** WIDTH 640
** HEIGHT 71
** NOHIDDEN
** NOREXXONLY
** AUTOEDIT
** PORTNAME AREXX
** EDITCOMMAND turbotext:TTX "%f"
** GOTOFILE REXX:FileSc.TTX
** NOGOTOLINE
**
** Note that I have not had much success when PORTNAME is TURBOTEXT,
** so I send the commands to AREXX which just executes this script.
** [I guess this filename should really be FileSC.rexx ?]
**
** I do not know why scmsg does not start the editor, see Locate_TURBOTEXT
** below.
**
** BUGS:
** If the error is in a file that has the same name as an active document,
** then this code may go to the line of the wrong document. See the
** FindFilePort procedure below.
**
** Some ideas for this were borrowed from the TTX scripts that came
** with SAS/C v6.0 by Kenneth Yarnall.
*/
OPTIONS RESULTS
/*
* You need to have TTX running first. I do not know why scmsg does
* not start the editor. So if TTX is not running this starts it.
*/
CALL Locate_TURBOTEXT
IF RESULT ~= 1 THEN EXIT
/*
* Get basic info from scmsg
*/
ADDRESS 'SC_SCMSG'
/*
* Get the name of the main file from scmsg. If there is no file name,
* there are no errors.
*/
'file'
main.path = RESULT
IF main.path = "" THEN DO
/* No messages in the Browser */
EXIT
END
/*
* Now check for an alternate file
*/
'altfile'
alt.path = RESULT
/*
* Retrieve the number and text of the message from scmsg.
*/
'number'
err.num = RESULT
'text'
err.text = RESULT
/*
* Process the main file.
*/
CALL MainFile
/* ****************** no alt file processing ***********
IF alt.path ~= "" THEN
CALL AltFile
*************************** */
/* All there is to it. */
EXIT 0
/*-------------------------------------------------------------------*/
MainFile:
ADDRESS SC_SCMSG
'line'
main.line = RESULT
/* Now find the filename portion of main.path */
CALL FindFileName main.path
main.name = RESULT
/*
* Find the window containing the main file.
*/
CALL FindFilePort main.name,main.path
main.port = RESULT
IF main.port = "" THEN RETURN
/* bring the window to the front and goto to the line with the error */
ADDRESS VALUE main.port
Window2Front
IconifyWindow OFF
ActivateWindow
Move FOLDS main.line
SetStatusBar err.num||': '||err.text
RETURN
/*-------------------------------------------------------------------*/
AltFile:
ADDRESS SC_SCMSG
'altline'
alt.line = RESULT
/* Now find the filename portion of alt.path */
CALL FindFileName alt.path
alt.name = RESULT
/*
** Find the window containing the alternate file.
*/
CALL FindFilePort alt.name,alt.path
alt.port = RESULT
IF alt.port = "" THEN RETURN
/* bring the window to the front and goto to the line with the error */
ADDRESS VALUE alt.port
Window2Front
IconifyWindow OFF
ActivateWindow
Move FOLDS alt.line
SetStatusBar err.num||': '||err.text
RETURN
/*-------------------------------------------------------------------*/
/*
** FindFileName -- Extracts the filename part of a path specification.
*/
FindFileName: PROCEDURE
parse arg path
dirend = LastPos('/', path)
IF dirend = 0 THEN
dirend = Pos(':', path)
IF dirend ~= 0 THEN
name = SubStr(path, dirend+1)
ELSE name = path
RETURN name
/*-------------------------------------------------------------------*/
/*
* FindFilePort -- Finds the TurboText port corresponding to a file, or
* tries to open the file if it is not in memory.
*
* Note that if this is the second file with same name as an active
* document, this code returns the port of the first document.
*/
FindFilePort: PROCEDURE
parse arg file,path
/*
* Search current documents for file
*/
ADDRESS TURBOTEXT
GetDocuments
docs = RESULT
DO WHILE docs ~= ''
PARSE VAR docs '"' docname '"' port docs
IF file == docname THEN DO
RETURN port
END
END
/* there was no port open a new one */
ADDRESS TURBOTEXT
OpenDoc NAME path
Return RESULT
/*-------------------------------------------------------------------*/
/*
** Looks for TURBOTEXT port, starts ttx if not found
*/
Locate_TURBOTEXT:
/* if the port is there, just return (afirmative) */
IF POS('TURBOTEXT' , SHOW('Ports')) ~= 0 THEN RETURN 1
Max_Seconds_To_Load = 60
Flag = 0
LibName = 'rexxsupport.library'
/* make sure we have needed libraries */
IF POS(LibName , SHOW('Libraries')) = 0 THEN ADDLIB(LibName , 0 , -30 , 0)
IF POS(LibName , SHOW('Libraries')) = 0 THEN RETURN 0
/* is there a volume TURBOTEXT: ? */
IF STATEF('TURBOTEXT:') = "" THEN RETURN 0
/* start up TTX and wait for the port */
TIME('R')
DO WHILE (Time('E') < Max_Seconds_To_Load) & (POS('TURBOTEXT' , SHOW('Ports')) = 0)
IF Flag = 0 THEN DO
/* Set whatever command line arguments you want. */
ADDRESS COMMAND 'run < nil: > nil: TURBOTEXT:TTX BG NW'
Flag = 1
END
ADDRESS COMMAND 'WAIT 1'
END
/* final check for the port */
IF POS('TURBOTEXT' , SHOW('Ports')) = 0 THEN RETURN 0
ELSE RETURN 1
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads