Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-04 - decus/20-0110/sintrp.sai
There are 2 other files named sintrp.sai in the archive. Click here to see a list.
ENTRY;
COMMENT
.SOSPAGE_1
.SEC(SINTRP - PROC10 Special Command Interpreter)
.index(SINTRP - PROC10 Special Command Interpreter)
.;
BEGIN "SINTRP.SAI"


COMMENT




               P. LEMKIN, R. GORDON, B. SHAPIRO

                     IMAGE PROCESSING UNIT

           DIVISION OF CANCER BIOLOGY AND DIAGNOSIS
                   NATIONAL CANCER INSTITUTE
                 NATIONAL INSTITUTES OF HEALTH
                      BETHESDA, MD 20014


                         301-496-2394

Oct 12, 1976 - Lemkin, SEMANTICS==>HELP, del syntaxtoggle
Revised Aug 24, 1976 - Lemkin, modify SETDENSITY
Revised Aug 17, 1976 - Lemkin, fixed SEMANTICS.
Revised Aug 6, 1976 - Lemkin, fixed SMSG in SYNTAXTOGGLE,
		 SETXY==>SETLCS
May 25, 1976 - Lemkin, added SEMANTICS
May 22, 1976 - Lemkin, changed DEBUGTOGGLE to SYNTAXTOGGLE
May 17, 1976 - Lemkin, added sip6 clear timer on TIMERTOGGLE
April 12, 1976 - Lemkin, Shapiro fixed  APPENDMOVIE
April 10, 1976 - Lemkin, fixed KILLOMNI, APPENDMOVIE, RUNMOVIE
April 9, 1976 - Lemkin, fixed ENTER2001
April 7, 1976 - Lemkin, fixed ENTER2001, OMNI cmds
April 2, 1976 - Lemkin, fixed DOOMI so compiles
April 1, 1976 - Lemkin, added movie commands and activedata comment
;
COMMENT
.SS(SINTRP REQUIRE files)
.INDEX(SINTRP REQUIRE files)
.;
Comment
"	================================"
"	=    R E Q U I R E             ="
"	================================"

"	The following files are required for  use  by  PROC10.
They all reside in the Image Processing Unit's common user area
";

Comment
 note the following REQ's are for debugging and will be removed;
Require "ARINFO.REQ" source!file;

Comment	 Permanent REQ's;
Require "DEFINE.REQ" source!file;
Require "SAVER.REQ" source!file;
Require "PTYPKG.REQ" source!file;
Require "SYS:DISPRM.SAI" source!file;
Require "BOUND.REQ" source!file;

"	The following require  files  are  used  to  link  this
interpreter with PROC10 itself"
Require "PRCMAX.REQ" source!file;
Require "PRCINV.REQ" source!file;
Require "PRCWRK.REQ" source!file;
Require "SPAK.REQ" source!file;
Require "PINTRP.REQ" source!file;
Require "BINTRP.REQ" source!file;
COMMENT
.SS(Procedure SPCLCMD!ASSIGNMENT)
.INDEX(Procedure SPCLCMD!ASSIGNMENT)
.;

Internal Procedure SPCLCMD!ASSIGNMENT;
Begin "SPCLCMD!ASSIGNMENT"

String 
	s1,
	s2,
	s3,
	s,
	ss,
	sss;

List copyofmovie;

Integer 
	i,
	j,
	ival,
	jval;


Real val;

"	Find the SPCLCMDoperator index"
	For index_1 Step 1 Until max!number!special!commands Do
		If equ(cmd, lgl!spclcmds[index]) 
			Then Done;


"	DISPATCH AND TEST FOR UNARY IN EACH CASE"
	CASE (index-1) of
	Begin "DO SPCLCMDOPERATIONS"
Begin "1 HELP"
COMMENT
.SSS(HELP)
.INDEX(HELP)
.;
	If Equ(strcopy[6 to inf],null)
		Then 
		Begin "Print hints"
		Outstr("
New users should read PROC10.HLP.
Type
	CMD <Optional Picture, Mask, Boundary, or Special>
to get the list of PROC10 commands on specific data types. To
get all of the commands, use not additional argument.
Type
	HELP <specific command>
to get its syntax.
Type
	SEMANTICS <specific command>
to get its semantics.
Type
	PARAMETERS
to get the state of the various PROC10 parameters.
Type
	ACTIVEDATA <Optional Picture, Mask, Boundary,
		 Transform, Window>
to get the names, titles, and other information about the
specified data type (or all data types if no additional
argument is given).
");
		Return;
		End "Print hints"
		Else
		Begin "get help"
		Integer i,j,k,m,eof,digit,space, es;
"		[1] get <cmd> by reading past HELP and guessing"
		str_strcopy[6 to inf];
"		Now guess what is desired"
		cmd_If not Equ((s_GUESSER(str,lgl!spclcmds)),null)
		      Then s
		      Else 
		      If not Equ((s_GUESSER(str,lgl!pops)),null)
		      	Then s
		      	Else 
		      	If not Equ((s_GUESSER(str,lgl!mops)),null)
			   Then s
			   Else 
			   If not Equ((s_GUESSER(str,lgl!bops)),null)
				Then s
				Else null;
		If cmd=null 
			Then 
			Begin "nope"
			Outstr("No help for "&str&crlf);
			Return;
			End "nope";
		m_length(cmd);

"		[2] open the file"
		Setbreak(1,'12,'15,"INS");
"		first look on sys: then on dsk:"
		OPEN(i_Getchan,"SYS",0,2,0,200,j,eof);
		Lookup(i,"PROC10.HLP",eof);
		If eof
			Then
			Begin "not on SYS:"
#			now look on dsk:;
			OPEN(i,"DSK",0,2,0,200,j,eof);
			Lookup(i,"PROC10.HLP",eof);
			End "not on SYS:";

"		[3] look for the command and print paragraph"
		While not eof Do
			Begin "Search"
			s_Input(i,1)&crlf;
"			[3.1] look for cmd"
			If "0" leq s leq "9"
			    Then
			    Begin "Possible cmd"
			    For k_6 step 1 Until 10 Do
				If Equ(cmd,s[k for m])
					Then
					Begin "Verify"
					digit_s[k-2 for 1];
					space_s[k-1 for 1];
					If space=" " And
					  ("0" leq digit leq "9")
						Then
						Begin "print it"
						Outstr(s);
						es_0;
						While Not eof Do
						  Begin "print"
						  s_Input(i,1);
						   If s=null 
							Then
							es_es+1;
						  If es=2
						     Then Done;
						   Outstr(s&crlf);
						  End "print";
						End "print it";
					End "Verify";
			    End "Possible cmd";
				End "Search";
			Release(i);
"		ok, now see if any op or command"
"			test if no help available"
		        End "get help";
		End "1 HELP";

Begin "2 ACTIVEDATA"
COMMENT
.SSS(ACTIVEDATA)
.INDEX(ACTIVEDATA)
.;
	
	ACTIVE!DATA;
		End "2 ACTIVEDATA";

Begin "3 AUTOTITLETOGGLE"
COMMENT
.SSS(AUTOTITLETOGGLE)
.INDEX(AUTOTITLETOGGLE)
.;
		
		    outstr("Automatic Titling mode is now " &
			(if (auto!title_not auto!title) 
				then "on" else "off")&crlf);
		End "3 AUTOTITLETOGGLE";

Begin "4 CMD"
COMMENT
.SSS(CMD)
.INDEX(CMD)
.;
		
		LIST!COMMANDS;
		End "4 CMD";

Begin "5 --free--"
		End "5 --free--";

Begin "6 DELETE"
COMMENT
.SSS(DELETE)
.INDEX(DELETE)
.;
	
		DEL!WINDOW;
		End "6 DELETE";

Begin "7 ENDSESSION"
COMMENT
.SSS(END SESSION)
.INDEX(END SESSION)
.;
		
			Begin "Reenter"
			"print the clocks"
			outstr("Total PROGRAM Real time =" & 
			  cvs((call(0,"MSTIME")-runtime)/1000) &
		  	  " SECONDS" & crlf);
			outstr("Total PROGRAM CPU time =" & 
			  cvs((call(0,"RUNTIM")-cputime)/1000) &
			  " SECONDS" & crlf);

			"Go exit"
			SAVER;
"			reset the clocks on reenter"
			runtime_call(0,"MSTIME");
			cputime_call(0,"RUNTIM");
			omni!post_PHI;
			omni!unpost_PHI;
			omni!active_PHI;
			omni!free_PHI;
	For i_1 step 1 until 200 Do
		Begin "make omni free store"
		Itemvar xxx;
		s_CVS(i);
		xxx_New;
		New!Pname(xxx,s);
		Put xxx In omni!free;
		End "make omni free store";
			setupOMNI_false;
			End "Reenter";

		End "7 ENDSESSION";

Begin "8 GETWINDOW"
COMMENT
.SSS(GETWINDOW)
.INDEX(GETWINDOW)
.;
	
		GET!WINDOW;
		End "8 GETWINDOW";

Begin "9 PARAMETERS"
COMMENT
.SSS(PARAMETERS)
.INDEX(PARAMETERS)
.;
	
		PARAMETERS;
		End "9 PARAMETERS";

Begin "10 SAVEWINDOW"
COMMENT
.SSS(SAVEWINDOW)
.INDEX(SAVEWINDOW)
.;
	
		SAVE!WINDOW;
		End "10 SAVEWINDOW";
Begin "11 SETDENSITY"
COMMENT
.SSS(SETDENSITY)
.INDEX(SETDENSITY)
.;
	
		SET!DENSITY;
		End "11 SETDENSITY";

Begin "12 SETSAMPLING"
COMMENT
.SSS(SETSAMPLING)
.INDEX(SETSAMPLING)
.;
		SET!SAMPLING;
		End "12 SETSAMPLING";

Begin "13 SETSIZE"
COMMENT
.SSS(SETSIZE)
.INDEX(SETSIZE)
.;
	
		SET!SIZE;
		End "13 SETSIZE";

Begin "14 SETTERMINAL"
COMMENT
.SSS(SETTERMINAL)
.INDEX(SETTERMINAL)
.;
	
		SET!TERMINAL;
		End "14 SETTERMINAL";

Begin "15 SETTITLE"
COMMENT
.SSS(SETTITLE)
.INDEX(SETTITLE)
.;
	
		SET!TITLE;
		End "15 SETTITLE";

Begin "16 SETWINDOW"
COMMENT
.SSS(SETWINDOW)
.INDEX(SETWINDOW)
.;
	
	SET!WINDOW;
		End "16 SETWINDOW";

Begin "17 SETLCS"
COMMENT
.SSS(SETLCS)
.INDEX(SETLCS)
.;
	
	SET!LCS;
		End "17 SETLCS";

Begin "18 TERSE"
COMMENT
.SSS(TERSE)
.INDEX(TERSE)
.;
		
		terse_true;
		Outstr("Terse "&crlf);
		End "18 TERSE";

Begin "19 TIMERTOGGLE"
COMMENT
.SSS(TIMERTOGGLE)
.INDEX(TIMERTOGGLE)
.;
		
		    outstr("TIMER mode is now " &
			(if (tim!switch_not tim!switch) 
				then "on" else "off")&crlf);
		If tim!switch
			Then 
			Begin "reset clock"
			t!runtime_call(0,"MSTIME");
			t!cputime_call(0,"RUNTIM");
			End "reset clock";
		End "19 TIMERTOGGLE";
Begin "20 VERBOSE"
COMMENT
.SSS(VERBOSE)
.INDEX(VERBOSE)
.;
		
		terse_false;
		Outstr("Verbose"&crlf);
		End "20 VERBOSE";

Begin "21 DO"
COMMENT
.SSS(DO)
.INDEX(DO)
.;
		
		If not Equ(sout,null)
			Then
			Begin "Do command file"
			Own Integer inspbrc;
			inspool_GETCHAN;
			If dev!name=null
				Then dev!name_"DSK";
			sout_sout&proj!programmer;
			Open(inspool,dev!name,0,2,0,200,
				inspbrc,inspeof);
			Lookup(inspool,sout,inspeof);
			If inspeof
				Then
				Begin "Not file"
				inspool_0;
				Outstr("File: "&sout&" not found!"
					&crlf);
				End "Not file";
			End "Do command file"
			Else
			Outstr("Bad file spec."&crlf);
		End "21 DO";

Begin "22 ENTER2001"
COMMENT
.SSS(ENTER2001)
.INDEX(ENTER2001)
.;

		String escape;
		Integer i,j,k,pty!channel!number;
		
"		ENTER2001 is a means of escaping from PROC10 into the
		PDP10 through a PTY:"

	Outstr(
	"You are entering the PDP10 through a Pseudo teletype channel.
Type LEAVE2001 to return to PROC10."&crlf);

"		Get a pseudo tty:"
		If (pty!channel!number_GETPTY) < 0 
			Then Return;

"		Get the new TTY channel"
		escape_'33;
		Setbreak(15,('12&'15&escape),null,"INA");

		While true Do
			Begin "LOOP";
			If PTYSTS 
				Then 
				Begin  "send to 2001"
				Outstr(">");
				s_TTYINL(15,flag);
"				Test if return to PROC10"
				If not 
				   (Equ(s[1 for 9],"LEAVE2001") or
				   Equ(s[1 for 9],"leave2001"))
					Then OUTPTY(s)
					Else
					Begin "Returned from 2001"
					Release(pty!channel!number);
					Outstr("Returning to PROC10"&
						crlf);
					Return;
					End "Returned from 2001";

"				remove lf if crlf"
				If (s[inf for 1]='12) and 
				   (s[inf-1 for 1]='15)
					Then s_s[1 to (inf-1)];
				End "send to 2001"
				Else 
				Begin "listen to 2001"
				Outstr("<"&crlf);
				Outstr(INPPTY);
				End "listen to 2001";
			End "LOOP";
		End "22 ENTER2001";

Begin "23 AUTOOMNINUMBERTOGGLE"
COMMENT
.SSS(AUTOOMNINUMBERTOGGLE)
.INDEX(AUTOOMNINUMBERTOGGLE)
.;
		
		    outstr("ONMI numbering mode is now " &
			(If (autoOMNInumber_not autoOMNInumber) 
				then "on" else "off")&crlf);
		End "23 AUTOOMNINUMBERTOGGLE";

Begin "24 KILLOMNI"
COMMENT
.SSS(KILLOMNI)
.INDEX(KILLOMNI)
.;
		
		If Equ(sout,"ALL") or Equ(sip1,"ALL")
			Then
			Begin "kill all"
			Itemvar xxx;
			Set omni!union;
			omni!union_omni!post Union omni!unpost;
			Foreach xxx such that xxx in omni!union Do
				Begin "remove it"
				  s_CVIS(xxx,flag);
				  Outstr("Delete Omni pix"&s&crlf);
				  DEL!OMNI!NUMBER(s);
				End "remove it";
			Return;
			End "kill all"
			Else
			DEL!OMNI!NUMBER(sout);
		End "24 KILLOMNI";

Begin "25 UNPOSTOMNI"
COMMENT
.SSS(UNPOSTOMNI)
.INDEX(UNPOSTOMNI)
.;
		
		iname_CVSI(sout,flag);
		If flag or (npict_GET!OMNI!NUMBER(sout))=0
			Then
			Begin "no good"
			Outstr("Non-existent OMNI picture number."&
				crlf);
			Return;
			End "no good";
		If (iname IN omni!post)
			Then 
			Begin "UNPOST it"
			Put iname IN omni!unpost;
			DUNPOST(npict);
			Remove iname FROM omni!post;
			End "UNPOST it"
			Else Outstr("It is unposted already!"&crlf);
		End "25 UNPOSTOMNI";

Begin "26 POSTOMNI"
COMMENT
.SSS(POSTOMNI)
.INDEX(POSTOMNI)
.;
		
		iname_CVSI(sout,flag);
		If flag or (npict_GET!OMNI!NUMBER(sout))=0
			Then
			Begin "no good"
			Outstr("Non-existent OMNI picture number."&
				crlf);
			Return;
			End "no good";
		If (iname IN omni!unpost)
			Then 
			Begin "POST it"
			Put iname IN omni!post;
			DPOST(npict);
			Remove iname FROM omni!unpost;
			End "POST it"
			Else Outstr("It is posted already!"&crlf);
		End "26 POSTOMNI";

Begin "27 DOOMNI"
COMMENT
.SSS(DOOMNI)
.INDEX(DOOMNI)
.;
			If sout="E"
				Then DDONE
				Else DDONE1;
		End "27 DOOMNI";

Begin "28 SETSCALING"
COMMENT
.SSS(SETSCALING)
.INDEX(SETSCALING)
.;
		
		SET!SCALING;
		End "28 SETSCALING";

Begin "29 NEWMOVIE"
COMMENT
.SSS(NEWMOVIE)
.INDEX(NEWMOVIE)
.;
		
		movie_NIL;
		End "29 NEWMOVIE";
Begin "30 APPENDMOVIE"
COMMENT
.SSS(APPENDMOVIE)
.INDEX(APPENDMOVIE)
.;
		Integer supspc,ident;
		Itemvar xxx;
		
		ident_14;
		supspc_13;
		ss_strcopy;

"		find first space after APPENDMOVIE command"
		For i_1 step 1 until Length(ss) Do
			If ss[i for 1]=" " 
				Then Done;
		ss_ss[i to Inf];

"		build list of OMNI picture names"
		While not (ss=null) Do
			Begin "append"
			s_Scan(ss,supspc,flag);
			s_Scan(ss,ident,flag);
			xxx_CVSI(s,flag);
			If not flag 
				Then 
				Begin "Ok"
				Put xxx In movie After Inf;
				If not (xxx In omni!post or 
					xxx In omni!unpost)
					Then
					Outstr("Note: "&s&
						" is not OMNI picture"&
						crlf);
				End "Ok"
				Else
				Outstr("Bad pix name"&s&crlf);
			End "append";
		End "30 APPENDMOVIE";

Begin "31 RUNMOVIE"
COMMENT
.SSS(RUNMOVIE)
.INDEX(RUNMOVIE)
.;
		Integer skip, did!frame, doagain;
		Itemvar xxx;
		

"		Set the move to run for one matinee"
		doagain_false;

"		Get the number of frames to skip"
		If sout=null
			Then skip_0
			Else
			Begin "Get frames to skip"
			If 0 > (skip_Intscan(sout,flag)) >
				 length(movie)
				Then
				IBOUND(0,skip,length(movie),
					"Skip number frames?",null);
			End "Get frames to skip";
		While True Do
			Begin "movie"
"			[1] copy the movie"
			copyofmovie_movie;
			While copyofmovie neq Nil Do
				Begin "do frame"
"				[1.1] clear screen"
				Foreach xxx Such That xxx In omni!post
					Do Begin "clear it off"
					Put xxx In omni!unpost;
					Remove xxx From omni!post;
					s_CVIS(xxx,flag);
					npict_GET!OMNI!NUMBER(s);
					DUNPOST(npict);
					DDONE;
					End "clear it off";

"				[1.2] Post next item"
"				Note: for non-omni picture, do the 
				by doing a SHOW Pi or Bi. Otherwise,
				Do it by DPOSTing existing GT40 images."
				For did!frame_1 step 1 until skip+1 
					Do If copyofmovie=Nil 
						Then 
						Done "do frame"
						Else
						xxx_Lop(copyofmovie);

				If not (xxx In omni!unpost)
					Then
					Begin "never displayed"
"					fake a SHOW"
					cmd_"SHOW";
					sout_s_CVIS(xxx,flag);
					sip1_null;
					If not Equ(GUESSER(s,
						lgl!pnames),null)
						Then
						Begin "SHOW Pi"
						PIX!ASSIGNMENT;
						Continue;
						End "SHOW Pi";

					If not Equ(GUESSER(s,
						lgl!bnames),null)
						Then
						Begin "SHOW Bi"
						BND!ASSIGNMENT;
						Continue;
						End "SHOW Bi";
					Outstr("Illegal pix name"&
						crlf);
					Return;
					End "never displayed"

					Else
					Begin "Post by OMNI number"
					Remove xxx From omni!unpost;
					npict_GET!OMNI!NUMBER(s);
					DPOST(npict);
					DDONE;
					End "Post by OMNI number";
				End "do frame";

"			[1.3] Test if done"
			LBOUND(doagain,"Show movie again?",null);
			If not doagain
				Then Done;
			End "movie";
		End "31 RUNMOVIE";

Begin "32 SPLICEMOVIEFRAME"
COMMENT
.sss(SPLICEMOVIEFRAME)
.index(SPLICEMOVIEFRAME)
.;
		
		If 0 > (ival_Intscan(sout,flag)) > length(movie)
			Then
			IBOUND(0,ival,length(movie),"After frame#?",
				null);
		If sip1=null
			Then
			SBOUND(sip1,"any","Picture name?",null);
		iname_CVSI(sip1,flag);
		If flag
			Then
			Begin "Bad picture"
			Outstr("Bad picture name"&crlf);
			Return;
			End "Bad picture";
		If ival=0
			Then Put iname In movie Before 1
			Else Put iname In movie After ival;
		End "32 SPLICEMOVIEFRAME";

Begin "33 REMOVEMOVIEFRAME"
COMMENT
.sss(REMOVEMOVIEFRAME)
.index(REMOVEMOVIEFRAME)
.;
		
		If 0 > (ival_Intscan(sout,flag)) > length(movie)
			Then
			IBOUND(0,ival,length(movie),"Frame#?",
				null);
		jval_length(movie);
		copyofmovie_movie;
		movie_Nil;
		For i_1 step 1 Until jval Do
			Begin "Selective copy"
			iname_Lop(copyofmovie);
			If ival=i
				Then 
				Put iname In movie After Inf
				Else
				Outstr("Removing pix: "&CVIS(iname,
					flag)&crlf);
			End "Selective copy";
		End "33 REMOVEMOVIEFRAME";

Begin "34 SETBOUNDARYSCALEFACTOR"
COMMENT
.SSS(SETBOUNDARYSCALEFACTOR)
.INDEX(SETBOUNDARYSCALEFACTOR)
.;
	
	SET!BND!SCALE!FACT;
		End "34 SETBOUNDARYSCALEFACTOR";

	End "DO SPCLCMDOPERATIONS";

End "SPCLCMD!ASSIGNMENT";
End "SINTRP.SAI";