/*********************************************************************** * Launching HSPC HiSpeed Pascal compiler from Textra. This * * script first saves the Pascal source file to disk, then * * compiles it to RAM: * * * * A nice AREXX script that compiles HSPascal from my favorite text * * editor, Textra. * * * * The script first saves the source code to disk. * * Then it calls the HSPascal compiler to compile the file. * * If the compiler detects errors, * * Textra reads in the error file, parses it for the line number of the * * error, reports it, jumps back to the source code file, and sends * * the cursor to the offending line number. * ***********************************************************************/ /*********************************************************************** * You can order Textra from: * * Mike Haas * * 3867 La Colina Road * * El Sobrante, CA 94803 * ***********************************************************************/ /*********************************************************************** * Nick Didkovsky, 72250.3313@compuserve.com * * 9/24/92 * ***********************************************************************/ /* MOD: handles volume names with blanks now 1/5/93 */ /* MOD: (mdh) moved address TEXTRA past version check 1/6/93 */ /* MOD: Parses $0D iin error file correctly now 1/7/93 */ options results /*check Textra version*/ rex = 0; result = "NOTSUPPORTED" address 'TEXTRA' 'textraversion' parse var result maj min rex if (result == "NOTSUPPORTED") | (rex < 3) then do address 'TEXTRA' 'notify "Textra V1.13 or later required for this script."' exit end address 'TEXTRA' GET file name fname = result GET file path pname = result fullname = pname || fname IF fname == 'Untitled' THEN DO notify 'Cannot compile Untitled source code' notify 'Please name this file by selecting SAVE FILE AS' exit END saveas fullname IF ~(result == 'OK' ) THEN DO notify 'trouble' exit END /* Check your HSPascal manual for the appropriate HSPC options for your system and change the following Options accordingly. */ Opts1 = '-$M25,1,350,15 -M -$D+ -$L+ -ERAM:' Opts2 = '-Ihsp:Include -Uhspunits2: -DWORKBENCH_2' CompileCommand = 'hsp:hspc >t:err ' || Opts1 || ' ' || Opts2 || ' ' || '"'fullname'"' say CompileCommand address command CompileCommand address 'TEXTRA' IF rc=10 THEN DO OPENFILE 't:err' wp = result top /* Find the line in the error file which notifies which error occurred */ find 'error' UNSELECT GET cursor position parse var result x ' ' y /* notify 'error found at pos' x ' line ' y */ SELECTLINE y GET select text parse var result junk ' ' TheLine unselect parse var TheLine FirstPart '0D'x TheRest /* notify 'FirstPart=' FirstPart notify 'TheREst=' TheRest notify (TheRest ~== '') */ IF (TheRest ~== '') THEN DO /* notify 'doing the rest' */ /* keep DO alone on a line */ TheLine = TheRest END ELSE DO /* notify 'doing the line' */ /* keep DO alone on a line */ TheLine = FirstPart END parse var TheLine junk '(' LineNum ')' junk2 parse var TheLine junk 'Error' TheError CLOSEWINDOW FINDFILE fullname wp = result IF wp==0 THEN notify 'Can''t find filewindow in Textra' ELSE DO selectwindow wp GOTOXY 0 LineNum-1 NOTIFY 'Error' TheError 'on line' LineNum END END ELSE NOTIFY 'Compiled successfully to RAM:'