-- Copyright 2000 Robelle Solutions Technology Inc. -- Version 1.04 August 29, 2000 name QSLMPECompile group "Ro&belle" command "&MPE Compile"; property QSLScriptVersion = "MPECompile 1.04 - Copyright 2000 Robelle Solutions Technology Inc." ; << Close the document containing the output from the previous compile. >> sub CloseOutFile(ConnectionName, OutputFullFileName) ; -- We need to close the $stdlist output file if the user hasn't closed it. -- This forces QW to refresh its copy. FileHList = findopenfile(connection:ConnectionName, matches:OutputFullFileName); if length(FileHList) > 0 then FileH = FileHList[1] ; FileH.Close() ; endif endsub << Display informative messages in the Script Control Panel. >> sub DisplayStartupMessages(MyCommand) qedit.showscp = true; WriteLog QslScriptVersion ; WriteLog "" ; Writelog "This window will close when the compile completes." ; Writelog "The STDLIST output will then be opened." ; Writelog "" ; WriteLog "Compiling " + string(MyCommand); Writelog "...Working....Please wait a few moments..." ; endsub << Open the compile output file. >> sub OpenSTDLISTFile (HostConnection, OutputFilename) fileout = open(connection:HostConnection, filename: OutputFilename) ; -- Now lets show the last page of the compile fileout.select(startline: fileout.linecount) ; qedit.showscp = false ; endsub << Purge the previous compile output file in the temporary domain. >> sub PurgeSTDLISTfile(HostConnection, OutputFilename) MyCommand = "Purge " + OutputFilename + ";temp" ; hostcmdresult = hostcommand(connection:HostConnection, command: MyCommand, wait:True) ; endsub ; << File equate the compile output file in the temporary domain. >> sub FileEqSTDLISTfile(HostConnection, OutputFilename) -- Setup the file equate for the temporary output file MyCommand = "File " + OutputFilename + ",new;rec=-128,,f,ascii;disc=50000;temp;nocctl" ; hostcmdresult = hostcommand(connection:HostConnection, command: MyCommand, wait:True) ; endsub ; << Check a few things before proceeding. >> sub ConditionsAreOkToProceed(fileh) ThingsAreFine = true ; if not exists(FileH) then result = dialog("MPECompile: Sorry, there is no active host document to compile."); ThingsAreFine = false ; else if not FileH.isonhost then result = dialog("MPECompile: Sorry, this script can only compile MPE Source files.") ; ThingsAreFine = false ; endif endif return ThingsAreFine ; endsub << Check if things went OK. If the compile command did not work, display a message. >> sub CompiledHadOutput(hostcmdresult, CompileCommand) CompileOutput = true ; LastOutputLine =hostcmdresult.commandoutput[length(hostcmdresult.CommandOutput)] ; if hostcmdresult.exitcode = 0 then if pos(LastOutputLine, "975") > 0 then rtn=dialog("Sorry, I'm unable to compile your source using '" + string(CompileCommand) + "'. Perhaps that compiler is not installed.") ; writelog "" ; writelog "***************************************************"; writelog "*** ERROR *** Output from host command follows: ***" ; writelog "***************************************************"; writelog "" ; Repeat For EachOutRec IN hostcmdresult.commandoutput; writelog EachOutRec EndRepeat CompileOutput = false; endif else writelog "************************************************************" ; writelog "*** ERROR *** Unable to execute Host Command. Error = " + string(Hostcmdresult.exitcode); writelog "************************************************************" ; endif return CompileOutput ; endsub << Mainline >> sub DoMPECompile(CompileCommand); outputFilename = "QSLCOMPO"; FileH = qedit.activefile ; if ConditionsAreOkToProceed(FileH) then FileName = FileH.FullFileName ; HostConnection = FileH.ConnectionName ; CloseOutFile(HostConnection, outputFilename) ; MyCommand = CompileCommand + " " + FileName + ",,*" + outputFilename ; PurgeSTDLISTfile(HostConnection, outputFilename) ; FileEqSTDLISTfile(HostConnection, outputFilename) ; DisplayStartupMessages(MyCommand); hostcmdresult = hostcommand(connection:HostConnection, command: MyCommand, wait:True) ; if CompiledHadOutput(hostcmdresult,CompileCommand) then OpenSTDLISTFile (HostConnection, outputFilename); endif writelog CompileCommand + " compile has finished!"; endif endsub On Command "&Cob85XL" DoMPECompile("COB85XL") ; EndOn On Command "&Cob74XL" DoMPECompile("COB74XL") ; EndOn On Command "&FORTRAN" DoMPECompile("FORTRAN") ; EndOn On Command "&PasXL" DoMPECompile("PASXL") ; EndOn On Command "&SPL" DoMPECompile("SPL") ; EndOn On Command "&Trancomp" DoMPECompile("TRANCOMP") ; EndOn On Command "&Help" qedit.showscp = true ; WriteLog QSLScriptVersion ; WriteLog "" ; WriteLog "Using a compiler on the HP3000, this script will compile the current document." ; Writelog "" ; Writelog "The current document must be a file that exists on the HP 3000." ; Writelog "" ; Writelog "You have to have the compiler that you are using, of course." ; Writelog "Logon UDC's are not enabled." ; Writelog "" ; Writelog "The STDLIST output of the compile will be opened after the compile completes." ; EndOn