[Monodevelop-patches-list] r2506 - in trunk/MonoDevelop/Extras/BooBinding: . BooShell Gui

Peter Johanson <latexer@gentoo.org> pjohanson at mono-cvs.ximian.com
Mon May 2 21:42:30 EDT 2005


Author: pjohanson
Date: 2005-05-02 21:42:30 -0400 (Mon, 02 May 2005)
New Revision: 2506

Removed:
   trunk/MonoDevelop/Extras/BooBinding/Remoting/
Modified:
   trunk/MonoDevelop/Extras/BooBinding/BooShell/BooShell.boo
   trunk/MonoDevelop/Extras/BooBinding/ChangeLog
   trunk/MonoDevelop/Extras/BooBinding/Gui/BooShellModel.boo
   trunk/MonoDevelop/Extras/BooBinding/Makefile.am
Log:
Change over to using RemoteProcessObject instead of the original seperate BooShellServer.exe method to get the boo shell out of the MD process.


Modified: trunk/MonoDevelop/Extras/BooBinding/BooShell/BooShell.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/BooShell/BooShell.boo	2005-05-03 00:31:41 UTC (rev 2505)
+++ trunk/MonoDevelop/Extras/BooBinding/BooShell/BooShell.boo	2005-05-03 01:42:30 UTC (rev 2506)
@@ -29,7 +29,9 @@
 import Gtk
 import GLib
 
-class BooShell(MarshalByRefObject):
+import MonoDevelop.Services
+
+class BooShell (RemoteProcessObject):
 	private _interpreter = InteractiveInterpreter(RememberLastValue: true, Print: print)
 
 	private _commandQueue = Queue()

Modified: trunk/MonoDevelop/Extras/BooBinding/ChangeLog
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-03 00:31:41 UTC (rev 2505)
+++ trunk/MonoDevelop/Extras/BooBinding/ChangeLog	2005-05-03 01:42:30 UTC (rev 2506)
@@ -1,5 +1,15 @@
 2005-05-02  Peter Johanson <latexer at gentoo.org>
 
+	* Remoting/*:
+	* Gui/BooShellModel.boo:
+	* BooShell/BooShell.boo:
+	* Makefile.am: Switch over to using the new
+	RemoteProcessObject API. Removes the need for
+	all of BooShell.Remoting, and simplifies things
+	elsewhere.
+
+2005-05-02  Peter Johanson <latexer at gentoo.org>
+
 	* Gui/BooShellModel.boo: Fix from lluis to make
 	MD not crash when right clicking the shell with
 	no projects open.

Modified: trunk/MonoDevelop/Extras/BooBinding/Gui/BooShellModel.boo
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Gui/BooShellModel.boo	2005-05-03 00:31:41 UTC (rev 2505)
+++ trunk/MonoDevelop/Extras/BooBinding/Gui/BooShellModel.boo	2005-05-03 01:42:30 UTC (rev 2506)
@@ -24,13 +24,15 @@
 import System.Collections
 import System.IO
 import System.Threading
-import BooBinding.Properties
-
-import BooBinding.BooShell
-import BooBinding.Remoting
 import System.Runtime.Remoting
 import System.Runtime.Remoting.Channels
 
+import BooBinding.Properties
+import BooBinding.BooShell
+
+import MonoDevelop.Services
+import MonoDevelop.Core.Services
+
 class BooShellModel(IShellModel):
 	private _props = BooShellProperties()
 
@@ -41,8 +43,6 @@
 	
 	private _thread as System.Threading.Thread
 
-	private _process as Process
-
 	private _booShell as BooShell
 
 	MimeType as string:
@@ -57,23 +57,17 @@
 		pass
 
 	def constructor (program_path as string, socket_path as string):
-		StartShellServer (program_path, socket_path)
-		GetRemoteShellObject (socket_path)
-		_booShell.Run()
+		GetRemoteShellObject ()
+		_booShell.Run ()
 
-	def StartShellServer(program_path as string, socket_path as string):
-		psi = ProcessStartInfo()
-		psi.FileName = "mono"
-		psi.Arguments = "${program_path} ${socket_path}"
-		_process = Process.Start(psi)
-	
-	def GetRemoteShellObject (socket_path as string):
-		chan = UnixChannel (Hashtable(), BinaryClientFormatterSinkProvider (), BinaryServerFormatterSinkProvider ())
-		ChannelServices.RegisterChannel(chan)
-		_booShell = Activator.GetObject (typeof(BooShell), "unix://${socket_path}?BooShell")
+	def GetRemoteShellObject ():
+		_procService as ProcessService = ServiceManager.GetService (typeof (ProcessService))
+		_booShell = _procService.CreateExternalProcessObject ("../AddIns/BackendBindings/BooShell.dll", "BooBinding.BooShell.BooShell", false)
+		if _booShell is null:
+			raise Exception ("Unable to instantiate remote BooShell object")
 
 			
-	def Reset() as bool:
+	def Reset () as bool:
 		_booShell.Reset()
 		return true
 	
@@ -81,13 +75,13 @@
 		_booShell.LoadAssembly (assemblyPath)
 		return true
 	
-	def GetOutput() as (string):
+	def GetOutput () as (string):
 		ret as (string)
 		lock _outputQueue:
 			if _outputQueue.Count > 0:
 				ret = array (string, _outputQueue.Count)
 				_outputQueue.CopyTo (ret, 0)
-				_outputQueue.Clear()
+				_outputQueue.Clear ()
 
 		return ret
 
@@ -100,7 +94,7 @@
 		ensure:
 			Monitor.Exit (_commandQueue)
 
-	def ThreadRun():
+	def ThreadRun ():
 		while true:
 			com as string
 			try:
@@ -108,26 +102,26 @@
 				if _commandQueue.Count == 0:
 					Monitor.Wait (_commandQueue)
 
-				com = _commandQueue.Dequeue()
+				com = _commandQueue.Dequeue ()
 
 
 				if com is not null:
 					_booShell.QueueInput (com)
-					lines = _booShell.GetOutput()
+					lines = _booShell.GetOutput ()
 					if lines is not null:
-						EnqueueOutput(lines)
+						EnqueueOutput (lines)
 					com = null
 					lock _outputQueue:
 						if _outputHandler is not null:
-							_outputHandler()
+							_outputHandler ()
 
 			ensure:
 				Monitor.Exit (_commandQueue)
 
 	
-	def Run():
-		_thread = System.Threading.Thread(ThreadRun)
-		_thread.Start()
+	def Run ():
+		_thread = System.Threading.Thread (ThreadRun)
+		_thread.Start ()
 	
 	def RegisterOutputHandler (handler as callable):
 		_outputHandler = handler
@@ -135,13 +129,13 @@
 	def EnqueueOutput (lines as (string)):
 		lock _outputQueue:
 			for line in lines:
-				_outputQueue.Enqueue(line)
+				_outputQueue.Enqueue (line)
 	
-	def Dispose():
-		_thread.Abort()
-		_process.Kill()
-		_booShell = null
+	def Dispose ():
+		_thread.Abort ()
+		_thread.Join()
+		_booShell.Dispose ()
 		
-	def print(obj):
+	def print (obj):
 		lock _outputQueue:
-			_outputQueue.Enqueue(obj)
+			_outputQueue.Enqueue (obj)

Modified: trunk/MonoDevelop/Extras/BooBinding/Makefile.am
===================================================================
--- trunk/MonoDevelop/Extras/BooBinding/Makefile.am	2005-05-03 00:31:41 UTC (rev 2505)
+++ trunk/MonoDevelop/Extras/BooBinding/Makefile.am	2005-05-03 01:42:30 UTC (rev 2506)
@@ -1,9 +1,7 @@
 
 ADDIN_BUILD = $(top_builddir)/build/AddIns/BackendBindings
 ASSEMBLY = $(ADDIN_BUILD)/BooBinding.dll
-REMOTING_LIB = $(ADDIN_BUILD)/BooShellUnixRemoting.dll
 BOOSHELL_LIB = $(ADDIN_BUILD)/BooShell.dll
-BOOSHELL_SERVER_EXE = $(ADDIN_BUILD)/BooShellServer.exe
 
 DLLS = -r:System.Drawing \
 	-r:System.Xml \
@@ -14,23 +12,15 @@
 	-r:$(top_builddir)/build/bin/ICSharpCode.SharpRefactory.dll \
 	-r:$(top_builddir)/build/bin/MonoDevelop.Gui.Widgets.dll \
 	-r:$(BOOSHELL_LIB) \
-	-r:$(REMOTING_LIB) \
 	$(BOO_LIBS) \
 	$(GTK_SHARP_LIBS) \
 	$(GCONF_SHARP_LIBS) \
 	$(GTKSOURCEVIEW_SHARP_LIBS)
 
-REMOTING_DLLS = -r:System.Runtime.Remoting \
-		-r:Mono.Posix
-
-BOOSHELL_DLLS = $(GTK_SHARP_LIBS) \
+BOOSHELL_DLLS = -r:$(top_builddir)/build/bin/MonoDevelop.Base.dll \
+		$(GTK_SHARP_LIBS) \
 		$(BOO_LIBS)
 
-BOOSHELL_SERVER_DLLS = -r:$(BOOSHELL_LIB) \
-			-r:$(REMOTING_LIB) \
-			-r:System.Runtime.Remoting \
-			-r:Mono.Posix
-
 FILES = \
 Gui/ShellTextView.boo \
 Gui/IShellModel.boo \
@@ -56,20 +46,8 @@
 Parser/Tree.boo \
 Parser/Visitor.boo
 
-REMOTING_FILES = Remoting/UnixChannel.cs \
-Remoting/UnixClient.cs \
-Remoting/UnixClientChannel.cs \
-Remoting/UnixClientTransportSink.cs \
-Remoting/UnixClientTransportSinkProvider.cs \
-Remoting/UnixListener.cs \
-Remoting/UnixMessageIO.cs \
-Remoting/UnixServerChannel.cs \
-Remoting/UnixServerTransportSink.cs
-
 BOOSHELL_FILES = BooShell/BooShell.boo
 
-BOOSHELL_SERVER_FILES= BooShellServer/BooShellServer.boo
-
 TEMPLATES = \
 templates/BooGtkSharpProject.xpt.xml \
 templates/BooGtkSharpWindow.xft.xml \
@@ -77,9 +55,7 @@
 templates/EmptyBooProject.xpt.xml
 
 build_sources = $(addprefix $(srcdir)/, $(FILES))
-remoting_build_sources = $(addprefix $(srcdir)/, $(REMOTING_FILES))
 booshell_build_sources = $(addprefix $(srcdir)/, $(BOOSHELL_FILES))
-booshell_server_build_sources = $(addprefix $(srcdir)/, $(BOOSHELL_SERVER_FILES))
 
 ADDIN = BooBinding.addin.xml
 
@@ -91,7 +67,7 @@
 
 if ENABLE_BOO
 all: $(ASSEMBLY) $(ADDIN_BUILD)/$(ADDIN) $(build_TEMPLATES) \
-	$(BOOSHELL_LIB) $(BOOSHELL_SERVER_EXE)
+	$(BOOSHELL_LIB)
 else
 all:
 endif
@@ -108,32 +84,22 @@
 	mkdir -p $(ADDIN_BUILD)
 	cp $(srcdir)/$(ADDIN) $(ADDIN_BUILD)/.
 
-$(ASSEMBLY): $(FILES) $(REMOTING_LIB) $(BOOSHELL_LIB)
+$(ASSEMBLY): $(FILES) $(BOOSHELL_LIB)
 	mkdir -p $(ADDIN_BUILD)
 	$(BOOC) $(DLLS) $(build_sources) -o:$@ -t:library
 
-$(REMOTING_LIB): $(REMOTING_FILES)
-	mkdir -p $(ADDIN_BUILD)
-	$(MCS) $(REMOTING_DLLS) $(remoting_build_sources) -out:$@ -t:library
-
 $(BOOSHELL_LIB): $(BOOSHELL_FILES)
 	mkdir -p $(ADDIN_BUILD)
 	$(BOOC) $(BOOSHELL_DLLS) $(booshell_build_sources) -o:$@ -t:library
 
-$(BOOSHELL_SERVER_EXE): $(BOOSHELL_SERVER_FILES)
-	mkdir -p $(ADDIN_BUILD)
-	$(BOOC) $(BOOSHELL_SERVER_DLLS) $(booshell_server_build_sources) -o:$@
-
 if ENABLE_BOO
 assemblydir = $(libdir)/monodevelop/AddIns/BackendBindings
-assembly_DATA = $(ASSEMBLY) $(ADDIN) $(REMOTING_LIB) $(BOOSHELL_LIB) \
-		$(BOOSHELL_SERVER_EXE)
+assembly_DATA = $(ASSEMBLY) $(ADDIN) $(BOOSHELL_LIB)
 
 templatedir = $(assemblydir)/templates
 template_DATA = $(TEMPLATES)
 endif
 
-CLEANFILES = $(ASSEMBLY) $(REMOTING_LIB) $(BOOSHELL_LIB) $(BOOSHELL_SERVER_EXE)
-EXTRA_DIST = $(FILES) $(ADDIN) $(TEMPLATES) $(REMOTING_FILES) \
-	     $(BOOSHELL_FILES) $(BOOSHELL_SERVER_FILES)
+CLEANFILES = $(ASSEMBLY) $(BOOSHELL_LIB)
+EXTRA_DIST = $(FILES) $(ADDIN) $(TEMPLATES) $(BOOSHELL_FILES)
 




More information about the Monodevelop-patches-list mailing list