COMMENT * SIMULA specification; OPTIONS(/E:CODE,tmpnam); TEXT PROCEDURE tmpnam(progid); VALUE progid; TEXT progid; COMMENT Returns a text of the form "jjjppp.TMP", where jjj is decimal job no, ppp=first 3 characters of progid. May be used in conjunction with the RUN procedure to generate a command file for another program such as PIP or the SIMULA compiler. Example: Assume the current job number is 29. A command file name to be used for passing command strings to the SIMULA compiler would then be generated by: ! filename:-tmpnam("SIM"); ! and may be used thus: ! INSPECT NEW Outfile(filename) DO ! BEGIN Open(Blanks(20); ! Outtext(progfil1);! Outimage; ! Outtext(progfil2);! Outimage; ! Outtext("DSK:");! Outtext(tmpnam("xxx")); ! Outchar('!');! Outimage; ! Close; ! END; ! returncode:=save(tmpnam("xxx"),FALSE); ! IF returncode=0 THEN run("SYS:SIMULA",1); ! IF returncode<0 THEN abort("Could not run SIMULA"); ; !*;! MACRO-10 code !*;! TITLE tmpnam ENTRY tmpnam SUBTTL SIMULA utility, Lars Enderin Mar 1976 ;!*** Copyright 1976 by the Swedish Defence Research Institute. *** ;!*** Copying is allowed. *** sall search simmac,simmcr,simrpa macinit ;! Local definitions ;! result==2 progid==4 bp1==XWAC3 bp2==XWAC4 tmpnam: PROC ;! Make a text for file name LI XWAC1,^D10 EXEC TXBL XWD 0,0 ;! Get Job number PJOB X1, ;! Convert to ASCII and accumulate LI bp1,3 SETZ X0, LOOP LSH X0,7 IDIVI X1,^D10 ADDI X0,"0"(X2) AS SOJG bp1,TRUE SA LF bp1,ZTVZTE(,XWAC1) ADD bp1,[POINT 7,2] LOOP ;! Place job number in first three chars IDPB X0,bp1 LSH X0,-7 AS JUMPN X0,TRUE SA LF bp2,ZTVZTE(XCB,progid) JUMPE bp2,L9 ;! NOTEXT progid ADD bp2,[POINT 7,2] LI X1,3 ;! Copy first characters of progid LOOP ILDB X0,bp2 JUMPE X0,FALSE IDPB X0,bp1 AS SOJG X1,TRUE SA L9():! ;! Append ".TMP" L bp2,[POINT 7,[ASCII".TMP"]] LI X1,4 LOOP ILDB bp2 IDPB bp1 AS SOJG X1,TRUE SA STD XWAC1,result(XCB) BRANCH CSEP EPROC LIT END;