PERFORCE change 12576 for review

[email protected] (Chris Nandor) Mon, 22 Oct 2001 18:00:19 -0400
Newsgroups perl.perl5.changes.mac
Message-ID <p05100311b7fa3f82ac60@[10.0.1.177]>
Change 12576 by pudge@pudge-mobile on 2001/10/22 18:58:22

	Fix exit code (MacPerl bug #422129) and add Stop Script
	Apple event.

Affected files ...

... //depot/maint-5.6/macperl/macos/macish.c#7 edit
... //depot/maint-5.6/macperl/macos/macish.h#8 edit
... //depot/maint-5.6/macperl/macos/macperl/MPAppleEvents.c#2 edit
... //depot/maint-5.6/macperl/macos/macperl/MPConsole.cp#2 edit
... //depot/maint-5.6/macperl/macos/macperl/MPMain.c#2 edit
... //depot/maint-5.6/macperl/macos/macperl/MPTerminology.aete#2 edit

Differences ...

==== //depot/maint-5.6/macperl/macos/macish.c#7 (text) ====
Index: perl/macos/macish.c
--- perl/macos/macish.c.~1~	Mon Oct 22 13:15:05 2001
+++ perl/macos/macish.c	Mon Oct 22 13:15:05 2001
@@ -1010,3 +1010,10 @@
 	/* No file/line found */
 	WriteMsg(io, msg, len, true);
 }
+
+void MacPerl_Exit(int status) 
+{
+	dTHX;
+	
+	my_exit(status);
+}

==== //depot/maint-5.6/macperl/macos/macish.h#8 (text) ====
Index: perl/macos/macish.h
--- perl/macos/macish.h.~1~	Mon Oct 22 13:15:05 2001
+++ perl/macos/macish.h	Mon Oct 22 13:15:05 2001
@@ -76,6 +76,7 @@
 unsigned char * MacPerl_CopyC2P(const char * c, unsigned char * p);
 const char * MacPerl_CanonDir(const char * dir, char * buf);
 void MacPerl_WriteMsg(void * io, const char * msg, size_t len);
+void MacPerl_Exit(int status);
 
 #undef PerlProc_exit
 #define PerlProc_exit(s)	my_exit((s))

==== //depot/maint-5.6/macperl/macos/macperl/MPAppleEvents.c#2 (text) ====
Index: perl/macos/macperl/MPAppleEvents.c
--- perl/macos/macperl/MPAppleEvents.c.~1~	Mon Oct 22 13:15:05 2001
+++ perl/macos/macperl/MPAppleEvents.c	Mon Oct 22 13:15:05 2001
@@ -9,6 +9,9 @@
 Language	:	MPW C
 
 $Log: MPAppleEvents.c,v $
+Revision 1.3  2001/10/22 19:28:01  pudge
+Sync with perforce
+
 Revision 1.2  2001/04/03 06:51:37  neeri
 Alias code was messing up double clicks from the finder (MacPerl bug #409948)
 
@@ -239,6 +242,23 @@
 } /*CountWindows*/
 
 /**-----------------------------------------------------------------------
+		Name: 		DoStopScript
+		Purpose:		Stop currently running script.
+	-----------------------------------------------------------------------**/
+
+#if !defined(powerc) && !defined(__powerc)
+#pragma segment Main
+#endif
+
+pascal OSErr DoStopScript(const AppleEvent *message, AppleEvent *reply, long refcon)
+{
+	if (gRunningPerl)
+		gAborting = true;
+
+	return noErr;
+}
+
+/**-----------------------------------------------------------------------
 		Name: 		DoOpenApp
 		Purpose:		Called on startup, creates a new document.
 	-----------------------------------------------------------------------**/
@@ -5555,6 +5575,7 @@
 	AEInstallEventHandler( kCoreEventClass, kAEPrintDocuments,  NewAEEventHandlerProc(DoPrintDocuments), noRefCon, false) ;
 	AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerProc(MyQuit), noRefCon, false) ;
 
+	AEInstallEventHandler( MPAppSig,	'STOP',			NewAEEventHandlerProc(DoStopScript),	noRefCon,	false) ;
 	AEInstallEventHandler( MPAppSig, 		  kAEOpenDocuments,   NewAEEventHandlerProc(DoOpenDocument), 	1, false) ;
 	AEInstallEventHandler( MPAppSig, 		  'DATA',   			 NewAEEventHandlerProc(Relay), 			 	0, false) ;
 	AEInstallEventHandler( MPAppSig, 		  'xEDT',   			 NewAEEventHandlerProc(DoExternalEditor), 0, false) ;

==== //depot/maint-5.6/macperl/macos/macperl/MPConsole.cp#2 (text) ====
Index: perl/macos/macperl/MPConsole.cp
--- perl/macos/macperl/MPConsole.cp.~1~	Mon Oct 22 13:15:05 2001
+++ perl/macos/macperl/MPConsole.cp	Mon Oct 22 13:15:05 2001
@@ -5,6 +5,9 @@
 Language	:	MPW C/C++
 
 $Log: MPConsole.cp,v $
+Revision 1.4  2001/10/11 05:19:31  neeri
+Fix exit code (MacPerl bug #422129)
+
 Revision 1.3  2001/04/13 05:28:13  neeri
 Forgot to install MPConsoleSpin (MacPerl bug #230880)
 
@@ -600,22 +603,11 @@
 
 bool MPConsoleSpin(bool /* wait */)
 {
-#if NOT_YET
-	if ((gAborting || (!gInBackground && GUSIConfiguration::Instance()->CheckInterrupt())) 
-		&& gRunningPerl) {
-		FlushEvents(-1, 0);
+	if (gAborting && gRunningPerl) {
+		ResetConsole();
 
-		if (spin == SP_AUTO_SPIN || spin == SP_SLEEP) {
-			ResetConsole();
-
-			Perl_my_exit(-128);
-		} else {
-			raise(SIGINT);
-			
-			return true;
-		}
-	}
-#endif
+		MacPerl_Exit(-128);
+	} 
 		
 	// 
 	// It would be nightmarish for MacPerl drawing code if a cursor spin altered the

==== //depot/maint-5.6/macperl/macos/macperl/MPMain.c#2 (text) ====
Index: perl/macos/macperl/MPMain.c
--- perl/macos/macperl/MPMain.c.~1~	Mon Oct 22 13:15:05 2001
+++ perl/macos/macperl/MPMain.c	Mon Oct 22 13:15:05 2001
@@ -9,6 +9,9 @@
 Language	:	MPW C
 
 $Log: MPMain.c,v $
+Revision 1.4  2001/10/11 05:19:31  neeri
+Fix exit code (MacPerl bug #422129)
+
 Revision 1.3  2001/04/28 23:28:01  neeri
 Need to register MPAEVTStreamDevice (MacPerl Bug #418932)
 
@@ -1278,7 +1281,7 @@
 		HandleEvent(&myEvent);
 		
 	if (gQuitting && gRunningPerl)
-		Perl_my_exit(-128);
+		MacPerl_Exit(-128);
 }
 
 pascal long VoodooChile(Size cbNeeded)

==== //depot/maint-5.6/macperl/macos/macperl/MPTerminology.aete#2 (text) ====
Index: perl/macos/macperl/MPTerminology.aete
--- perl/macos/macperl/MPTerminology.aete.~1~	Mon Oct 22 13:15:05 2001
+++ perl/macos/macperl/MPTerminology.aete	Mon Oct 22 13:15:05 2001
@@ -95,6 +95,10 @@
 		@PARAM	"environment", 'ENVT', 'TEXT', "environment variables.", 								OPT, LIST,   NOENUM
 		@PARAM	"directory",   'DIRE', 'alis', "working directory.", 										OPT, SINGLE, NOENUM
 	
+	@EVENT "Stop Script",	"Stop the currently running Perl script",	'McPL', 'STOP'
+		@REPLY 	'null', "", 								OPT, SINGLE, NOENUM
+		@DIRECT	'null', "No direct parameter required", 	OPT, SINGLE, NOENUM, CHANGE
+
 	@EVENT "Send Data", "Send data to a remote controlled Perl script", 'McPL', 'DATA'
 		@REPLY 	'TEXT', "Standard Output", 	OPT, SINGLE, NOENUM
 		@DIRECT	'TEXT', "Standard Input", 		OPT, SINGLE, NOENUM, CHANGE
End of Patch.