newspeak / RuntimeForSqueak.ns3

Newspeak3
'NS2Squeak'
class RuntimeForSqueak packageUsing: namespace = (
"Bundles the module definitions needed  to create the platform object. Eventually the platform should be constructed given only the vm mirror, but we still cheat by accessing Squeak's global namespace. 

Copyright (c) 2010-2012 Ryan Macnak.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the ''Software''), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ''AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"|
	"Actors"
	Aliens = namespace Aliens Aliens.
		APIManager = namespace CAPI APIManager.
		CAPI = namespace CAPI CAPI.
		Win32API = namespace Win32API Win32API mixin apply: CAPI.
		"LibcAPI"
	Brazil = namespace Brazil Brazil.
		BrazilMappingForWin32 = namespace BrazilMappingForWin32.
		"BrazilForCocoa"
		"BrazilForX11/Gtk+"
		UISessionManager = namespace Brazil UISessionManager.
	Collections = namespace NSCollections Collections.
	Exceptions= namespace NSExceptions Exceptions.
	Ducts = namespace Brazil Ducts.
	Files = namespace NSFiles Files.
		WinFiles = namespace NSFiles Win32Files.
		UnixFiles = namespace NSFiles UnixFiles.
		MacFiles = namespace NSFiles MacOSXFiles.
	Graphics = namespace NSGraphics NSGraphics.
	Hopscotch = namespace Hopscotch HopscotchFramework.
	Kernel = namespace NSKernel Kernel.
	Mirrors = namespace Mirrors NewspeakMirrors.
		LowLevelMirrors = namespace Mirrors LowLevelMirrorsForSqueak.
		AtomicInstaller = namespace Mirrors AtomicInstaller.
		SqueakVmMirror = namespace VmMirror SqueakVmMirror.
		MirrorGroups = namespace Mirrors MirrorGroups.
	"Network"
		"WinNetwork"
		"UnixNetwork"
		"MaxNetwork"
	"NewspeakObjectFormat"
	"Numbers"
	Past = namespace Past Past.
	"Synchronization"
	Streams = namespace NSStreams NSStreams.
	"Text"
	Time = namespace DateAndTime NSDateAndTime.
	
	CP = namespace NS2CombinatorialParsing CombinatorialParsing.
	BCP = namespace NS2CombinatorialParsing BlocklessCombinatorialParsing.
	BlocklessCombinatorialParsing = BCP mixin apply: CP.
	NewspeakGrammar = namespace NewspeakGrammar.
	NewspeakASTs = namespace NewspeakASTs.
	NewspeakParsing = namespace NewspeakParsing.
	Newspeak2SqueakCompilation = namespace Newspeak2SqueakCompilation.
	
	Newspeak3CompilerAdaptor = namespace Newspeak3CompilerAdaptor Newspeak3CompilerAdaptor.
|)
(
class Platform usingVmMirror: vmm = (
"Speculation for the long-term API of Platform.  Newspeak has no global namespace: an application instead accesses functionality such as GUI, the file system and the network via the platform argument passed to its main:args: method.  This improves modularity and provides the foundation for an object capability security model."||
	blackMarket = vmm blackMarket.  "Access to Squeak's stateful global namespace.  Some glorious day we won't use this."

	namespace = outer RuntimeForSqueak.

	public aliens = Aliens usingPlatform: self vmMirror: vmm.
	apiManager = APIManager usingPlatform: self.
	public brazil = Brazil usingPlatform: self.
	uiSessionManager = UISessionManager usingPlatform: self.
	public collections = Collections usingPlatform: self.
	public ducts = Ducts usingPlatform: self.
	public exceptions = Exceptions usingPlatform: self.
	public files = Files usingPlatform: self.
	private winfiles = WinFiles usingPlatform: self.
	private unixfiles = UnixFiles usingPlatform: self.
	private macfiles = MacFiles usingPlatform: self.
	public graphics = Graphics usingPlatform: self.
	public hopscotch = Hopscotch usingPlatform: self.
	public kernel = Kernel usingPlatform: self vmMirror: vmm.
	public mirrors = Mirrors usingPlatform: self vmMirror: vmm.
	public past = Past usingPlatform: self.
	public streams = Streams usingPlatform: self.
	public time = Time usingPlatform: self vmMirror: vmm.
||self resetForNewImageSession)
('as yet unclassified'
doesNotUnderstand: message = (
	^message sendTo: blackMarket
)
resetForNewImageSession = (
	aliens resetForNewImageSession.
	apiManager resetForNewImageSession.

	"uiSessionManager resetForNewImageSession."
	
	blackMarket OSProcess OSProcess isWindows ifTrue:
		[winfiles resetForNewImageSession.
		files platformSpecificPathClass: winfiles Win32FilePath.
		files platformSpecificPatternClass: winfiles Win32FilePattern].
	blackMarket OSProcess OSProcess isUnix ifTrue:
		[unixfiles resetForNewImageSession.
		files platformSpecificPathClass: unixfiles UnixFilePath.
		files platformSpecificPatternClass: unixfiles UnixFilePattern].
	
	"Mac needs to be after unix or unix will override it, since isUnix is true on Macs"
	blackMarket OSProcess OSProcess isUnixMac ifTrue:
		[macfiles resetForNewImageSession.
		files platformSpecificPathClass: macfiles MacOSXFilePath.
		files platformSpecificPatternClass: macfiles MacOSXFilePattern].
)) : ()'as yet unclassified'
using: vmm <VMMirror> ^<Platform>= (
	^Platform usingVmMirror: vmm
)) : ()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.