├── .gitattributes ├── .gitignore ├── ADocument.html ├── APIManager.ns ├── AccessModifierTestApp.ns ├── AccessModifierTesting.ns ├── AccessModifierTestingConfiguration.ns ├── ActivationMirrorTesting.ns ├── ActivationMirrorTestingConfiguration.ns ├── ActivationMirrors.ns ├── Actors.ns ├── ActorsForJS.ns ├── ActorsTesting.ns ├── ActorsTestingConfigurationForSqueak.ns ├── AliensForJS.ns ├── AliensForSqueak.ns ├── AllSqueakTestsConfiguration.ns ├── Ampleforth.ns ├── AmpleforthEmbedder.ns ├── AmpleforthViewer.ns ├── AtomicInstallTestConfiguration.ns ├── AtomicInstallTesting.ns ├── AtomicInstaller.ns ├── BankAccount.ns ├── BankAccountExemplarDemo.ns ├── BootstrapRuntimeForSqueak.ns ├── Brazil.ns ├── BrazilMappingForWin32.ns ├── Browsing.ns ├── CAPI.ns ├── CAliensTesting.ns ├── CAliensTestingConfiguration.ns ├── CodeMirrorDemo.ns ├── Collections.ns ├── CollectionsTesting.ns ├── CollectionsTestingConfiguration.ns ├── CombinatorialParsing.ns ├── CommandLineTestingStrategy.ns ├── CounterApp.ns ├── CounterUI.ns ├── CroquetCounterApp.ns ├── CroquetCounterUI.ns ├── Debugging.ns ├── DeploymentManager.ns ├── DocumentHolder.ns ├── Documents.ns ├── Ducts.ns ├── Files.ns ├── FilesTesting.ns ├── FilesTestsConfiguration.ns ├── FontsForHTML5.ns ├── GraphicsForHTML5.ns ├── GraphicsForSqueak.ns ├── HelloDOM.ns ├── HopscotchDemo.ns ├── HopscotchFontDemo.ns ├── HopscotchForBrazil.ns ├── HopscotchForCroquet.ns ├── HopscotchForHTML5.ns ├── HopscotchGestureDemo.ns ├── HopscotchWebIDE.ns ├── IDETools.ns ├── InImageNSCompilerTestingStrategy.ns ├── Inspecting.ns ├── IntermediatesForSqueak.ns ├── JSForCroquet.ns ├── JSTesting.ns ├── JSTestingConfiguration.ns ├── JavascriptGeneration.ns ├── KernelForJS.ns ├── KernelTests.ns ├── KernelTestsConfiguration.ns ├── KernelWeakTests.ns ├── LICENSE ├── LanguageUiDescriptionRegistry.ns ├── MacOSXFiles.ns ├── MetadataParsing.ns ├── MetadataTesting.ns ├── MetadataTestingConfiguration.ns ├── Minitest.ns ├── MinitestTests.ns ├── MinitestTestsConfiguration.ns ├── MinitestUI.ns ├── MirrorBuilderTesting.ns ├── MirrorBuilderTestingConfiguration.ns ├── MirrorGroups.ns ├── MirrorTesting.ns ├── MirrorTestingConfiguration.ns ├── MirrorTestingModel.ns ├── MirrorsForJS.ns ├── MirrorsForSqueak.ns ├── MiscBrowsing.ns ├── NS2JSApplicationPackaging.ns ├── NS2JSCompilerTestingConfiguration.ns ├── NS2SqueakCompilerTestingConfiguration.ns ├── NSCompilerTesting.ns ├── NSPatternMatching.ns ├── Namespacing.ns ├── NewShell.ns ├── Newspeak2JSCompilation.ns ├── Newspeak2SqueakCompilation.ns ├── NewspeakASTs.ns ├── NewspeakBrowsing.ns ├── NewspeakColorization.ns ├── NewspeakCompilation.ns ├── NewspeakGrammar.ns ├── NewspeakParsing.ns ├── NewspeakPrettyPrinter.ns ├── NewspeakTypechecker.ns ├── NewspeakTypecheckerTesting.ns ├── NewspeakTypecheckerTestingConfiguration.ns ├── NodeAPI.ns ├── ObjectPresenterDemo.ns ├── ParserTesting.ns ├── ParserTestingConfiguration.ns ├── Particles.ns ├── ProcessFinalizer.ns ├── README.md ├── RegexMatcher.ns ├── RegexTesting.ns ├── RegexTestingConfiguration.ns ├── Request.ns ├── RuntimeForCroquet.ns ├── RuntimeForElectron.ns ├── RuntimeForHopscotchForHTML.ns ├── RuntimeForJS.ns ├── RuntimeForJSWithMirrorBuilders.ns ├── RuntimeForSqueak.ns ├── SmalltalkBrowsing.ns ├── SqueakMirrorTesting.ns ├── SqueakMirrorTestingConfiguration.ns ├── Streams.ns ├── Telescreen.ns ├── TelescreenApp.ns ├── TelescreenTemplate.zip ├── TelescreenTemplate ├── TelescreenTemplate.html ├── contents │ └── TelescreenTemplate_slide_1.zip └── documents │ └── NewspeakMasterSlide.zip ├── TestActor.ns ├── TextModule.ns ├── TimeForSqueak.ns ├── TodoMVC.ns ├── TodoMVCApp.ns ├── TwoViewEditor.ns ├── TwoViewEditorApp.ns ├── UISessionManager.ns ├── UnixFiles.ns ├── VCSCore.ns ├── VCSDiffing.ns ├── VCSGitBackendProvider.ns ├── VCSImageMirrorCaching.ns ├── VCSLib.ns ├── VCSMercurialBackendProvider.ns ├── VCSNewspeakSourceMirrors.ns ├── VCSSmalltalkSourceMirrors.ns ├── VCSSourceMirrors.ns ├── VCSSubversionBackendProvider.ns ├── VCSUI.ns ├── VMMirror.ns ├── VictoryFuel.ns ├── VictoryFuelTesting.ns ├── VictoryFuelTestingConfiguration.ns ├── WebFiles.ns ├── Win32API.ns ├── Win32Files.ns ├── Words.ns ├── WorkspaceHolder.ns ├── WorkspaceManager.ns ├── accept16px.png ├── ampleforthDocument.png ├── cancel16px.png ├── classPresenterImage.png ├── classUnknownImage.png ├── clearImage.png ├── croquetpsoup.html ├── croquetpsoup.js ├── disclosureClosedImage.png ├── disclosureOpenImage.png ├── downloadImage.png ├── electron-stuff ├── main.js ├── package.json ├── preload.js └── renderer.js ├── findImage.png ├── helpImage.png ├── hsAddImage.png ├── hsBackImage.png ├── hsCollapseImage.png ├── hsDropdownImage.png ├── hsExpandImage.png ├── hsForwardImage.png ├── hsHistoryImage.png ├── hsHomeImage.png ├── hsNewImage.png ├── hsRefreshImage.png ├── itemReferencesImage.png ├── languageNewspeak3.png ├── peekingeye1610.png ├── platforms ├── apple │ ├── .gitignore │ ├── Hopscotch │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AccentColor.colorset │ │ │ │ └── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-1024.png │ │ │ │ ├── Icon-128.png │ │ │ │ ├── Icon-16.png │ │ │ │ ├── Icon-256.png │ │ │ │ ├── Icon-257.png │ │ │ │ ├── Icon-32.png │ │ │ │ ├── Icon-33.png │ │ │ │ ├── Icon-512.png │ │ │ │ ├── Icon-513.png │ │ │ │ └── Icon-64.png │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ └── Main.storyboard │ │ ├── ContentView.swift │ │ ├── Hopscotch.entitlements │ │ ├── Info.plist │ │ ├── Newspeak-Bridging-Header.h │ │ ├── Web │ │ │ ├── NSViewContainerView.swift │ │ │ ├── UIViewContainerView.swift │ │ │ ├── WebView.swift │ │ │ ├── WebViewNavigationHelper.swift │ │ │ └── WebViewStore.swift │ │ ├── WebViewController.swift │ │ └── newspeak │ │ │ ├── primordialsoup.html │ │ │ └── primordialsoup.js │ ├── Newspeak.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ ├── Hopscotch.xcscheme │ │ │ │ └── Newspeak.xcscheme │ │ └── xcuserdata │ │ │ └── diskzero.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ └── README.md ├── docker │ └── Dockerfile └── webIDE │ ├── README.md │ ├── index.html │ ├── manifest.json │ ├── public │ └── assets │ │ ├── icons │ │ ├── icon-120.png │ │ ├── icon-128.png │ │ ├── icon-144.png │ │ ├── icon-152.png │ │ ├── icon-16.png │ │ ├── icon-180.png │ │ ├── icon-192.png │ │ ├── icon-24.png │ │ ├── icon-32.png │ │ ├── icon-384.png │ │ ├── icon-512.png │ │ ├── icon-64.png │ │ ├── icon-72.png │ │ └── icon-96.png │ │ ├── lib │ │ ├── codemirror.css │ │ ├── codemirror.js │ │ ├── codemirror_autorefresh.js │ │ ├── jszip.min.js │ │ ├── primordialsoup-setup.js │ │ ├── primordialsoup.html │ │ └── primordialsoup.js │ │ └── screenshots │ │ └── screen.png │ ├── src │ ├── app.ts │ └── index.js │ ├── sw.js │ ├── swa-cli.config.json │ ├── tsconfig.json │ └── vite.config.ts ├── primordialsoup.html ├── primordialsoup.js ├── privateImage.png ├── protectedImage.png ├── publicImage.png ├── pwa-deployed-versions └── newspeaklanguage.org.version ├── saveImage.png ├── sectionImage.png ├── squeak ├── BrowsingForSqueak.ns ├── DebuggingForSqueak.ns ├── HopscotchIDEApp.ns ├── HopscotchImages.st ├── JavascriptGenerationForSqueak.ns ├── KernelForSqueak.ns ├── MinitestForSqueak.ns ├── MinitestUIForSqueak.ns ├── NamespacingForSqueak.ns ├── Newspeak2V8Compilation.ns ├── Newspeak2V8CompilationForSqueak.ns ├── NewspeakColorizationForSqueak.ns ├── WorkspaceManagerForSqueak.ns ├── accept16px.png ├── accept16pxDown.png ├── accept16pxOver.png ├── arrowGreenLeft.png ├── arrowGreenRight.png ├── arrowOrangeLeft.png ├── cancel16px.png ├── cancel16pxDown.png ├── cancel16pxOver.png ├── classPresenterImage.png ├── classUnknownImage.png ├── conflictRed.png ├── disclosureClosedImage.png ├── disclosureMinusImage.png ├── disclosureOpenImage.png ├── disclosurePlusImage.png ├── disclosureTransitionImage.png ├── editImage.png ├── findSquareLeftDownImage.png ├── findSquareLeftImage.png ├── findSquareLeftOutImage.png ├── findSquareLeftOverImage.png ├── hsAddDownImage.png ├── hsAddImage.png ├── hsAddOutImage.png ├── hsAddOverImage.png ├── hsBackDownImage.png ├── hsBackOutImage.png ├── hsBackOverImage.png ├── hsCollapseDownImage.png ├── hsCollapseImage.png ├── hsCollapseOutImage.png ├── hsCollapseOverImage.png ├── hsDropdownDownImage.png ├── hsDropdownImage.png ├── hsDropdownOutImage.png ├── hsDropdownOverImage.png ├── hsExpandDownImage.png ├── hsExpandImage.png ├── hsExpandOutImage.png ├── hsExpandOverImage.png ├── hsFindDownImage.png ├── hsFindImage.png ├── hsFindOutImage.png ├── hsFindOverImage.png ├── hsForwardDownImage.png ├── hsForwardOutImage.png ├── hsForwardOverImage.png ├── hsHistoryDownImage.png ├── hsHistoryImage.png ├── hsHistoryOutImage.png ├── hsHistoryOverImage.png ├── hsHomeDownImage.png ├── hsHomeImage.png ├── hsHomeOutImage.png ├── hsHomeOverImage.png ├── hsNewDownImage.png ├── hsNewOutImage.png ├── hsNewOverImage.png ├── hsRefreshDownImage.png ├── hsRefreshImage.png ├── hsRefreshOutImage.png ├── hsRefreshOverImage.png ├── hsReorderDownImage.png ├── hsReorderImage.png ├── hsReorderOutImage.png ├── hsReorderOverImage.png ├── hsToolsDownImage.png ├── hsToolsImage.png ├── hsToolsOutImage.png ├── hsToolsOverImage.png ├── itemBothOverride.png ├── itemDeleteImage.png ├── itemMenuImage.png ├── itemReferencesImage.png ├── itemSubOverride.png ├── itemSuperOverride.png ├── languageJS.png ├── languageM.png ├── languageNewspeak3.png ├── languageSmalltalk.png ├── menu16px.png ├── menu16pxDown.png ├── menu16pxOver.png ├── menuButtonImage.png ├── metaMenuDownImage.png ├── metaMenuImage.png ├── metaMenuOutImage.png ├── metaMenuOverImage.png ├── operateMenuDownImage.png ├── operateMenuImage.png ├── operateMenuOutImage.png ├── operateMenuOverImage.png ├── privateImage.png ├── protectedImage.png ├── publicImage.png ├── repositoryGit.png ├── repositoryMercurial.png └── tinySubclassResponsibilityImage.png ├── tool ├── build.sh ├── configure-http-server │ ├── serve-newspeak.sh │ ├── server2.py │ └── server3.py ├── deploy-all-vfuels-as-website.sh ├── deploy-webide-vfuel-as-pwa.sh ├── newspeak_env.sh └── newspeak_util.sh ├── updateApp.sh └── wordsByFrequency.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | *.ns linguist-language=Smalltalk 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | dist 4 | dev-dist 5 | build 6 | types 7 | .idea 8 | .github 9 | package-lock.json 10 | 11 | # The directory 'pwa-deployed-versions' keeps track of PWA cache versions 12 | # for URLs deployed from this repository. 13 | # Only the 'newspeaklanguage.org.version' (the PWA version for newspeaklanguage.org) 14 | # is kept in git. 15 | # Any other version files, for example 'localhost.version', should not be committed. 16 | !pwa-deployed-versions 17 | pwa-deployed-versions/* 18 | !pwa-deployed-versions/newspeaklanguage.org.version 19 | 20 | # The directory 'out' is ignored 21 | /out/ 22 | -------------------------------------------------------------------------------- /APIManager.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'CAPI' 3 | class APIManager usingPlatform: platform = ( 4 | (* Manages native API instances for various platforms, so that stale instances are cleaned up in new image sessions. *) 5 | | 6 | private OSProcess = platform squeak OSProcess. 7 | private Smalltalk = platform squeak Smalltalk. 8 | private Win32API = platform namespace Win32API. 9 | 10 | public win32api = Win32API platform: platform. 11 | |) ( 12 | public resetForNewImageSession = ( 13 | win32api resetForNewImageSession. 14 | ) 15 | ) : ( 16 | ) 17 | -------------------------------------------------------------------------------- /AccessModifierTestApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'AccessModifierTests' 3 | class AccessModifierTestApp packageUsing: manifest = (| 4 | AccessModifierTesting = manifest AccessModifierTesting. 5 | Minitest = manifest Minitest. 6 | |) ( 7 | public main: p args: args = ( 8 | | 9 | minitest = Minitest usingPlatform: p. 10 | testing = AccessModifierTesting usingPlatform: p testFramework: minitest. 11 | tester = minitest Tester testModules: {testing}. 12 | | 13 | tester runAll. 14 | (tester errors size printString, ' errors') out. 15 | (tester failures size printString, ' failures') out. 16 | (tester successes size printString, ' successes') out. 17 | ) 18 | ) : ( 19 | ) 20 | -------------------------------------------------------------------------------- /AccessModifierTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class AccessModifierTestingConfiguration packageTestsUsing: manifest = (| 4 | private AccessModifierTesting = manifest AccessModifierTesting. 5 | |) ( 6 | public testModulesUsingPlatform: platform minitest: minitest = ( 7 | ^{AccessModifierTesting 8 | usingPlatform: platform 9 | testFramework: minitest} 10 | ) 11 | ) : ( 12 | ) 13 | -------------------------------------------------------------------------------- /ActivationMirrorTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class ActivationMirrorTestingConfiguration packageTestsUsing: manifest = (| 4 | private ActivationMirrorTesting = manifest ActivationMirrorTesting. 5 | |) ( 6 | public testModulesUsingPlatform: p minitest: m = ( 7 | ^{ActivationMirrorTesting usingPlatform: p testFramework: m} 8 | ) 9 | ) : ( 10 | ) 11 | -------------------------------------------------------------------------------- /ActorsTestingConfigurationForSqueak.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Actors' 3 | class ActorsTestingConfigurationForSqueak packageTestsUsing: manifest = (| 4 | private ActorsTesting = manifest ActorsTesting. 5 | private Actors = manifest Actors. 6 | private TestActor = manifest TestActor. 7 | |) ( 8 | public testModulesUsingPlatform: p minitest: m = ( 9 | | 10 | vm = p squeak VMMirror new. 11 | a = Actors usingPlatform: p vm: vm. 12 | | 13 | ^{ActorsTesting usingPlatform: p actors: a testActor: TestActor minitest: m} 14 | ) 15 | ) : ( 16 | ) 17 | -------------------------------------------------------------------------------- /AliensForSqueak.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Aliens' 3 | class AliensForSqueak usingPlatform: p vmMirror: vmm = ( 4 | (* Aliens are Newspeak's capabilities for FFI. They represent C data and allow callouts and callbacks. This module simply provides access to the Smalltalk classes. The story for NS3 Aliens is not yet well-defined. 5 | 6 | More documentuation is available at 7 | http://wiki.squeak.org/squeak/uploads/6100/Alien%20FFI.2.pdf 8 | http://wiki.squeak.org/squeak/uploads/6100/Alien%20FFI%20bowels.2.pdf *) 9 | | 10 | public Alien = p squeak Alien. 11 | public Callback = p squeak Callback. 12 | public IllegalAlien = p squeak IllegalAlien. 13 | public UnsafeAlien = p squeak UnsafeAlien. 14 | public ObjectiveCAlien = p squeak ObjectiveCAlien. 15 | |) ( 16 | public resetForNewImageSession = ( 17 | ) 18 | ) : ( 19 | ) 20 | -------------------------------------------------------------------------------- /AllSqueakTestsConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NS2Squeak' 3 | class AllSqueakTestsConfiguration packageTestsUsing: manifest = (| 4 | configs = { 5 | manifest AccessModifierTestingConfiguration packageTestsUsing: manifest. 6 | (* manifest ActivationMirrorTestingConfiguration packageTestsUsing: manifest. *) 7 | manifest ActorsTestingConfigurationForSqueak packageTestsUsing: manifest. 8 | manifest AtomicInstallTestConfiguration packageTestsUsing: manifest. 9 | manifest CAliensTestingConfiguration packageTestsUsing: manifest. 10 | manifest CollectionsTestingConfiguration packageTestsUsing: manifest. 11 | (* manifest FilesTestsConfiguration packageTestsUsing: manifest. *) 12 | manifest KernelTestsConfiguration packageTestsUsing: manifest. 13 | manifest MinitestTestsConfiguration packageTestsUsing: manifest. 14 | manifest MirrorTestingConfiguration packageTestsUsing: manifest. 15 | manifest MirrorBuilderTestingConfiguration packageTestsUsing: manifest. 16 | manifest SqueakMirrorTestingConfiguration packageTestsUsing: manifest. 17 | manifest NS2SqueakCompilerTestingConfiguration packageTestsUsing: manifest. 18 | (* manifest NewspeakTypecheckerTestingConfiguration packageTestsUsing: manifest. *) 19 | manifest RegexTestingConfiguration packageTestsUsing: manifest. 20 | manifest VictoryFuelTestingConfiguration packageTestsUsing: manifest. 21 | }. 22 | |) ( 23 | public testModulesUsingPlatform: platform minitest: minitest = ( 24 | | testModules = platform collections List new. | 25 | configs do: [:config | 26 | testModules addAll: 27 | (config testModulesUsingPlatform: platform minitest: minitest)]. 28 | ^testModules 29 | ) 30 | ) : ( 31 | ) 32 | -------------------------------------------------------------------------------- /Ampleforth.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class Ampleforth packageUsing: manifest = ( 4 | (* Ampleforth is designed to support live literate programming. It supports embedding Newspeak code inside the text of a normal web page. This class relates to an older version of Ampleforth. It has different properties than the latest one. It relies on AmpleforthEmbedder to process a web page once and for all, inserting Hopscotch widgets from a limited set into the page at startup. 5 | It does not support live editing of the HTML, and any extension of the set of widgets would require changing AmpleforthEmbedder. 6 | The pages so created are not self contained. They are effectively read-only, which can be an advantage in some cases. It also relies on a arguably simpler conventions in the HTML. 7 | 8 | Ampleforth documents can be produced by editing HTML in any tool. Use this application to run such pages stand alone. One can also interactively edit and run such documents in the Newspeak IDE (see the HopscotchWebIDE module). 9 | 10 | Ampleforth is a character in 1984 whose role is to convert works of Oldspeak literature into Newspeak. He's a literary editor conversant in Newspeak. 11 | 12 | Copyright 2014-2017 Google Inc. 13 | Copyright 2022-2024 Gilad Bracha. 14 | *) 15 | | 16 | private AmpleforthEmbedder = manifest AmpleforthEmbedder. 17 | private HopscotchIDE = manifest HopscotchWebIDE packageUsing: manifest. 18 | | 19 | ) ( 20 | public main: platform args: args = ( 21 | | 22 | namespace embedder ide 23 | | 24 | ide:: HopscotchIDE ideUsingPlatform: platform. 25 | 26 | namespace:: ide namespacing Root. 27 | namespace at: #Ampleforth put: self class. 28 | embedder:: AmpleforthEmbedder usingPlatform: platform ide: ide. 29 | embedder start. 30 | ) 31 | ) : ( 32 | ) 33 | -------------------------------------------------------------------------------- /AmpleforthViewer.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class AmpleforthViewer packageUsing: manifest = ( 4 | (* 5 | An app that opens a pre-determined Ampleforth document. 6 | 7 | Given a URI of the form primordialsoup.html/?snapshot=AmpleforthEditorApp&docName=myDoc, it can open to the desired document. 8 | 9 | If the document is not avaliable on the server, an error document is opened with an explanation of the problem. 10 | 11 | Ideally, we would isolate the web dependencies we have here so that the code would work on alternate platforms. 12 | Among other things, we would need the web implementation to pass in the URI arguments to #main:args: so we would not be concerned with that here. We'd want a mature, portable Newspeak file API as well. For the foreseeable future, this will do. 13 | *) 14 | | 15 | private HopscotchIDE = manifest HopscotchWebIDE packageUsing: manifest. 16 | | 17 | ) ( 18 | missingDocument: docName in: ide ^ = ( 19 | | 20 | errorMessage = docName isEmpty 21 | ifFalse: [ '

No document named ', docName, ' found on server

'] 22 | ifTrue: [ '

No document specified. You must specify a document name in the URI using the docName parameter. Use the format 23 |

24 | primordialsoup.html/?snapshot=AmpleforthEditorApp&docName=myDoc 25 |

26 | where myDoc is the name of the desired document. 27 |
28 | Make sure you didn''t write ?docName=myDoc, or mispell or omit docName. 29 | ']. 30 | | 31 | ^ide documents freshDocumentNamed: #MissingDocumentNotice initialText: errorMessage 32 | ) 33 | public main: platform args: args = ( 34 | | 35 | ide = HopscotchIDE ideUsingPlatform: platform. 36 | documents = ide documents. 37 | (* Get the current URI and return the value of parameter 'docName', this being the name of the document we should open *) 38 | rawName = (((platform js global at: #URL) new: ((platform js global at: #window) at: #location)) at: #searchParams) get: #docName. 39 | (* If docName argument is missing, rawName will be nil, which would cause difficulties. Guard against this. *) 40 | docName = rawName isNil ifFalse: [rawName] ifTrue: ['']. 41 | request = (platform js global at: #XMLHttpRequest) new. 42 | JSZip = platform js global at: 'JSZip'. 43 | | 44 | ide setupNames. 45 | ide launch: (ide browsing HomeSubject new). 46 | request 47 | open: 'GET' filenamed: docName, '.zip' flag: true; 48 | at: #responseType put: 'blob'; 49 | at: #onload put: [:event | 50 | | 51 | jszp = JSZip loadAsync: (request at: #response). 52 | | 53 | jszp then: [:jsz | 54 | | namespace = ide browsing NamespaceSubject onModel: ide namespacing Root key: #Root. | 55 | documents loadDocument: jsz named: docName into: namespace 56 | ifSuccess: [ide browsing Utilities enterSubject: (documents DocumentSubject onModel: (namespace model at: docName))] 57 | ifFailure: [ 58 | | failureDoc = missingDocument: docName in: ide. | 59 | ide browsing Utilities enterSubject: (documents DocumentSubject onModel: failureDoc). 60 | ]. 61 | nil 62 | ] onError: [:ex | 63 | | failureDoc = missingDocument: docName in: ide. | 64 | ide browsing Utilities enterSubject: (documents DocumentSubject onModel: failureDoc). 65 | nil 66 | ] 67 | ]; 68 | send. 69 | ) 70 | ) : ( 71 | ) 72 | -------------------------------------------------------------------------------- /AtomicInstallTestConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Mirrors' 3 | class AtomicInstallTestConfiguration packageTestsUsing: ideNamespace = ( 4 | (* Test configuration for AtomicInstallTesting *) 5 | | 6 | AtomicInstaller = ideNamespace AtomicInstaller. 7 | AtomicInstallTesting = ideNamespace AtomicInstallTesting. 8 | Mirrors = ideNamespace MirrorsForSqueak. 9 | |) ( 10 | public testModulesUsingPlatform: platform minitest: minitest ^ <{AtomicInstallTesting}> = ( 11 | | 12 | mirrors 13 | installer 14 | compiler 15 | vmm = platform squeak VMMirror new. 16 | | 17 | 18 | installer:: AtomicInstaller usingPlatform: platform vmMirror: vmm. 19 | mirrors:: Mirrors usingPlatform: platform vmMirror: vmm. 20 | compiler:: mirrors compiler. 21 | ^{AtomicInstallTesting 22 | usingPlatform: platform 23 | testing: installer 24 | compiler: compiler 25 | mirrors: mirrors 26 | testFramework: minitest 27 | }. 28 | ) 29 | ) : ( 30 | ) 31 | -------------------------------------------------------------------------------- /BankAccount.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class BankAccount balance: b 4 | (* :exemplar: BankAccount balance: 100 *) = ( 5 | (* Copyright 2021-2022 Gilad Bracha *) 6 | | 7 | balance_slot ::= b. 8 | | 9 | ) ( 10 | public balance = ( 11 | ^balance_slot 12 | ) 13 | public deposit: amount (* :exemplar: deposit: 100 *) = ( 14 | balance_slot:: balance + amount 15 | ) 16 | public withdraw: amount 17 | (* :exemplar1: withdraw: 10 *) (* :exemplar2: withdraw: 0 *) (* :exemplar3: withdraw: 110 *)(* :exemplar4: withdraw: 20 negated *) = ( 18 | amount > balance ifTrue: [ 19 | Error signal: 'Overdraft not allowed. Withdrawal amount ', amount printString, ' exceeds balance ', balance printString 20 | ]. 21 | balance_slot:: balance - amount 22 | ) 23 | ) : ( 24 | ) 25 | -------------------------------------------------------------------------------- /BankAccountExemplarDemo.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class BankAccountExemplarDemo packageUsing: manifest = ( 4 | (* 5 | Demo of exemplars using BankAccount class. 6 | 7 | Copyright 2014-2017 Google Inc. 8 | Copyright 2021-2022 Gilad Bracha 9 | *) 10 | | 11 | private AmpleforthEmbedder = manifest AmpleforthEmbedder. 12 | private HopscotchIDE = manifest HopscotchWebIDE packageUsing: manifest. 13 | private BankAccount = manifest BankAccount. 14 | |) ( 15 | populateNamespace: namespace = ( 16 | namespace at: #BankAccountExemplarDemo put: self class. 17 | namespace at: #BankAccount put: BankAccount. 18 | ) 19 | public main: platform args: args = ( 20 | | 21 | ide = HopscotchIDE ideUsingPlatform: platform. 22 | namespace = ide namespacing Root. 23 | embedder = AmpleforthEmbedder usingPlatform: platform namespace: namespace browsing: ide browsing. 24 | | 25 | populateNamespace: namespace. 26 | embedder start. 27 | ) 28 | ) : ( 29 | ) 30 | -------------------------------------------------------------------------------- /BootstrapRuntimeForSqueak.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NS2Squeak' 3 | class BootstrapRuntimeForSqueak packageUsing: manifest = ( 4 | (* Bundles enough module definitions to create a subset of the platform object that can compile NS3. 5 | 6 | Copyright (c) 2010-2012 Ryan Macnak. 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the ''Software''), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED ''AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. *) 25 | | 26 | Collections = manifest Collections. 27 | Ducts = manifest Ducts. 28 | Kernel = manifest KernelForSqueak. 29 | Mirrors = manifest MirrorsForSqueak. 30 | public Intermediates = manifest IntermediatesForSqueak. 31 | public AtomicInstaller = manifest AtomicInstaller. 32 | public MirrorGroups = manifest MirrorGroups. 33 | Streams = manifest Streams. 34 | 35 | public CombinatorialParsing = manifest CombinatorialParsing. 36 | public NewspeakGrammar = manifest NewspeakGrammar. 37 | public NewspeakASTs = manifest NewspeakASTs. 38 | public NewspeakParsing = manifest NewspeakParsing. 39 | public Newspeak2SqueakCompilation = manifest Newspeak2SqueakCompilation mixinApply: manifest NewspeakCompilation. 40 | |) ( 41 | class Platform usingVmMirror: vmm = ( 42 | (* Just enought to get the NS3 compiler going *) 43 | || 44 | public namespace = outer BootstrapRuntimeForSqueak. 45 | 46 | public collections = Collections usingPlatform: self. 47 | public ducts = Ducts usingPlatform: self. 48 | public kernel = Kernel usingPlatform: self vmMirror: vmm. 49 | public mirrors = Mirrors usingPlatform: self vmMirror: vmm. 50 | public streams = Streams usingPlatform: self. 51 | public squeak = Squeak wrapping: vmm Smalltalk. 52 | ||self resetForNewImageSession) ( 53 | class Squeak wrapping: globals = ( 54 | (* The platform-specific namespace for Squeak. *) 55 | | Smalltalk = globals. |) ( 56 | protected doesNotUnderstand: message = ( 57 | ^Smalltalk at: message selector ifAbsent: [super doesNotUnderstand: message] 58 | ) 59 | ) : ( 60 | ) 61 | public resetForNewImageSession = ( 62 | ) 63 | ) : ( 64 | ) 65 | public using: vmm ^ = ( 66 | ^Platform usingVmMirror: vmm 67 | ) 68 | ) : ( 69 | ) 70 | -------------------------------------------------------------------------------- /CAliensTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Aliens' 3 | class CAliensTestingConfiguration packageTestsUsing: manifest = (| 4 | private CAliensTesting = manifest CAliensTesting. 5 | |) ( 6 | public testModulesUsingPlatform: p minitest: m = ( 7 | ^{CAliensTesting usingPlatform: p aliens: p aliens minitest: m} 8 | ) 9 | ) : ( 10 | ) 11 | -------------------------------------------------------------------------------- /CodeMirrorDemo.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Samples' 3 | class CodeMirrorDemo packageUsing: manifest = ( 4 | (*An experiment integrating CodeMirror into the Newspeak UI.*) 5 | | 6 | JSObject 7 | private hopscotchRuntime = manifest HopscotchForHTML5Runtime packageUsing: manifest. 8 | | 9 | ) ( 10 | class Demo usingPlatform: p = ( 11 | (* Describe the class in this comment. *) 12 | | 13 | Subject = p hopscotch core Subject. 14 | Presenter = p hopscotch core Presenter. 15 | TextEditorFragment = p hopscotch fragments TextEditorFragment. 16 | CodeMirror = p js global at: 'CodeMirror'. 17 | | 18 | ) ( 19 | class DemoPresenter onSubject: s = Presenter onSubject: s ( 20 | (* A test class for using CodeMirror in HopscotchForHTML. *) 21 | | 22 | editor 23 | | 24 | ) ( 25 | public definition ^ = ( 26 | editor:: codeMirror: 27 | 'forEach: i do: b <[String]> = ( 28 | 1 to: i do: [:j | b value]. 29 | )'. 30 | ^column: { 31 | textString: 'Below is a CodeMirror text editor:'. 32 | editor. 33 | } 34 | ) 35 | public setupEditor = ( 36 | editor refresh 37 | ) 38 | public style = ( 39 | | bloo = JSObject new. bold = JSObject new. | 40 | bold at: 'css' put: 'font-weight:bold'. 41 | bloo at: 'css' put: 'color:#0000FF; font-weight:bold'. 42 | editor style: bold from: 0 to: 7. 43 | editor style: bloo from: 11 to: 20. 44 | editor style: bold from: 21 to: 24. 45 | editor style: bloo from: 27 to: 38. 46 | editor refresh. 47 | ) 48 | ) : ( 49 | ) 50 | public class DemoSubject new = Subject onModel: nil ( 51 | (* Describe the class in this comment. *) 52 | | 53 | | 54 | ) ( 55 | public createPresenter = ( 56 | ^DemoPresenter onSubject: self 57 | ) 58 | public setupEditor = ( 59 | presenter setupEditor 60 | ) 61 | public style = ( 62 | presenter style 63 | ) 64 | ) : ( 65 | ) 66 | ) : ( 67 | ) 68 | public main: platform args: args = ( 69 | | 70 | hopscotchPlatform = hopscotchRuntime using: platform. 71 | demo = Demo usingPlatform: hopscotchPlatform. 72 | demoSubject = demo DemoSubject new. 73 | | 74 | 75 | JSObject:: hopscotchPlatform js global at: 'Object'. 76 | hopscotchPlatform hopscotch core HopscotchWindow openSubject: demoSubject. 77 | demoSubject setupEditor; style. 78 | ) 79 | ) : ( 80 | ) 81 | -------------------------------------------------------------------------------- /CollectionsTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NSCollections' 3 | class CollectionsTestingConfiguration packageTestsUsing: manifest = (| 4 | private CollectionsTesting = manifest CollectionsTesting. 5 | |) ( 6 | public testModulesUsingPlatform: platform minitest: minitest = ( 7 | ^{CollectionsTesting usingCollections: platform collections minitest: minitest} 8 | ) 9 | ) : ( 10 | ) 11 | -------------------------------------------------------------------------------- /CounterApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class CounterApp packageUsing: manifest = ( 4 | | 5 | private CounterUI = manifest CounterUI. 6 | | 7 | ) ( 8 | public main: platform args: args = ( 9 | | 10 | ui = CounterUI usingPlatform: platform. 11 | | 12 | platform hopscotch HopscotchWindow openSubject: (ui CounterSubject onModel: ui Counter new). 13 | ) 14 | ) : ( 15 | ) 16 | -------------------------------------------------------------------------------- /CounterUI.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class CounterUI usingPlatform: p = ( 4 | | 5 | private Subject = p hopscotch Subject. 6 | private Presenter = p hopscotch Presenter. 7 | | 8 | ) ( 9 | public class Counter = ( 10 | | public count ::= 0. | 11 | ) ( 12 | ) : ( 13 | ) 14 | class CounterPresenter onSubject: s = Presenter onSubject: s( 15 | ) ( 16 | definition = ( 17 | ^row: { 18 | label: subject count. 19 | mediumBlank. 20 | button: 'increment' action: [updateGUI: [subject increment]]. 21 | button: 'decrement' action: [updateGUI: [subject decrement]]. 22 | button: 'reset' action: [updateGUI: [subject clear]]. 23 | }. 24 | ) 25 | public isKindOfCounterPresenter = ( 26 | ^true 27 | ) 28 | isMyKind: other = ( 29 | ^other isKindOfCounterPresenter 30 | ) 31 | ) : ( 32 | ) 33 | public class CounterSubject onModel: m = Subject onModel: m( 34 | ) ( 35 | createPresenter ^ = ( 36 | ^CounterPresenter onSubject: self 37 | ) 38 | public isKindOfCounterSubject = ( 39 | ^true 40 | ) 41 | isMyKind: other = ( 42 | ^other isKindOfCounterSubject 43 | ) 44 | public decrement = ( 45 | model count: count - 1 46 | ) 47 | public increment = ( 48 | model count: count + 1 49 | ) 50 | public count ^ = ( 51 | ^model count 52 | ) 53 | public clear = ( 54 | model count: 0 55 | ) 56 | ) : ( 57 | ) 58 | ) : ( 59 | ) 60 | -------------------------------------------------------------------------------- /CroquetCounterApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class CroquetCounterApp packageUsing: manifest = ( 4 | | 5 | (*private hopscotchRuntime = manifest HopscotchForHTML5Runtime packageUsing: manifest.*) 6 | private CounterUI = manifest (*Croquet*)CounterUI. 7 | | 8 | ) ( 9 | public main: platform args: args = ( 10 | | 11 | (*hopscotchPlatform = platform isKindOfPlatformWithHopscotch ifTrue: [platform] ifFalse: [hopscotchRuntime using: platform]. *) 12 | ui = CounterUI usingPlatform: platform. 13 | | 14 | platform hopscotch HopscotchWindow openSubject: (ui CounterSubject onModel: ui Counter new). 15 | ) 16 | ) : ( 17 | ) 18 | -------------------------------------------------------------------------------- /CroquetCounterUI.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class CroquetCounterUI usingPlatform: p = ( 4 | | 5 | private Subject = p hopscotch Subject. 6 | private Presenter = p hopscotch Presenter. 7 | first ::= true. 8 | getCroquetView = [p js global at: #theView]. 9 | croquetView_slot 10 | | 11 | 12 | ) ( 13 | public class Counter = ( 14 | | public count ::= 0. | 15 | ) ( 16 | ) : ( 17 | ) 18 | class CounterPresenter onSubject: s = Presenter onSubject: s ( 19 | ) ( 20 | public isKindOfCounterPresenter = ( 21 | ^true 22 | ) 23 | isMyKind: other = ( 24 | ^other isKindOfCounterPresenter 25 | ) 26 | scope = ( 27 | ^'newspeak_croquet_counter' 28 | ) 29 | definition = ( 30 | ^row: { 31 | label: subject count. 32 | mediumBlank. 33 | button: 'increment' action: [croquetView publish: scope event: #increment]. 34 | button: 'decrement' action: [croquetView publish: scope event: #decrement]. 35 | button: 'reset' action: [croquetView publish: scope event: #reset]. 36 | }. 37 | ) 38 | croquetView = ( 39 | croquetView_slot isNil ifTrue: [ensureSubscriptions]. 40 | ^croquetView_slot. 41 | ) 42 | ensureSubscriptions = ( 43 | first ifTrue: [ 44 | first:: false. 45 | croquetView_slot:: getCroquetView value. 46 | croquetView subscribe: scope eventSpec: #model_increment handler: [:e | updateGUI: [subject increment]]. 47 | croquetView subscribe: scope eventSpec: #model_decrement handler: [:e |updateGUI: [subject decrement]]. 48 | croquetView subscribe: scope eventSpec: #model_reset handler: [:e | updateGUI: [subject clear]]. 49 | ] 50 | ) 51 | ) : ( 52 | ) 53 | public class CounterSubject onModel: m = Subject onModel: m( 54 | ) ( 55 | createPresenter ^ = ( 56 | ^CounterPresenter onSubject: self 57 | ) 58 | public isKindOfCounterSubject = ( 59 | ^true 60 | ) 61 | isMyKind: other = ( 62 | ^other isKindOfCounterSubject 63 | ) 64 | public decrement = ( 65 | model count: count - 1 66 | ) 67 | public count ^ = ( 68 | ^model count 69 | ) 70 | public clear = ( 71 | model count: 0 72 | ) 73 | public increment = ( 74 | 'incrementing ' out. 75 | model count: count + 1 76 | ) 77 | ) : ( 78 | ) 79 | ) : ( 80 | ) 81 | -------------------------------------------------------------------------------- /DocumentHolder.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class DocumentHolder usingDocumentClass: dc ide: webIDE 4 | (*:exemplar: ide documentHolder *) = ( 5 | | 6 | Document = dc. 7 | ide = webIDE. 8 | | ) ( 9 | ) : ( 10 | ) 11 | -------------------------------------------------------------------------------- /FilesTesting.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NSFiles' 3 | class FilesTesting usingPlatform: p files: f testFramework: u = ( 4 | (* Copyright 2008-2009 Gilad Bracha and other contributors. 5 | Copyright 2010 Ryan Macnak and other contributors. 6 | 7 | Licensed under the MIT license: 8 | 9 | Permission is hereby granted, free of charge, to any person 10 | obtaining a copy of this software and associated documentation 11 | files (the ''Software''), to deal in the Software without 12 | restriction, including without limitation the rights to use, 13 | copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following 16 | conditions: 17 | 18 | The above copyright notice and this permission notice shall be 19 | included in all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED ''AS IS'', WITHOUT WARRANTY OF ANY KIND, 22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 23 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 25 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 26 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28 | OTHER DEALINGS IN THE SOFTWARE. 29 | *) 30 | | 31 | TestContext = u TestContext. 32 | 33 | FilePath = f FilePath. 34 | FilePattern = f FilePattern. 35 | |) ( 36 | public class FilesTests = TestContext ( 37 | ) ( 38 | read: f = ( 39 | | stm | 40 | stm:: f readStream. 41 | assert: stm size equals: 10000. 42 | 1 to: 10000 do: [:ea | assert: stm next equals: (ea \\ 256)]. 43 | stm close. 44 | ) 45 | public testSize = ( 46 | withFile: (FilePath for: '/tmp/testFile') 47 | do: 48 | [:f | write: f. 49 | assert: f size equals: 10000] 50 | ) 51 | public testWriteThenRead = ( 52 | withFile: (FilePath for: '/tmp/testFile') 53 | do: [:f | self writeThenRead: f] 54 | ) 55 | withDirectory: dir do: block = ( 56 | deny: [dir exists]. 57 | 58 | dir createDirectoryIfFail: [:why | failWithMessage: why]. 59 | assert: [dir exists]. 60 | 61 | block value: dir. 62 | 63 | dir deleteIfFail: [:why | failWithMessage: why]. 64 | deny: [dir exists]. 65 | ) 66 | withFile: f do: block = ( 67 | deny: [f exists]. 68 | 69 | block value: f. 70 | 71 | f deleteIfFail: [:why | failWithMessage: why]. 72 | deny: [f exists]. 73 | ) 74 | write: f = ( 75 | | stm | 76 | stm:: f writeStream. 77 | 1 to: 10000 do: [:ea | stm nextPut: ea \\ 256]. 78 | stm close. 79 | ) 80 | writeThenRead: f = ( 81 | self write: f. 82 | self read: f. 83 | ) 84 | ) : ( 85 | TEST_CONTEXT = () 86 | ) 87 | ) : ( 88 | ) 89 | -------------------------------------------------------------------------------- /FilesTestsConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NSFiles' 3 | class FilesTestsConfiguration packageTestsUsing: manifest = ( 4 | (* Test configuration for class FilesTesting. 5 | 6 | Copyright 2008-2009 Gilad Bracha and other contributors. 7 | Copyright 2010 Ryan Macnak and other contributors. 8 | 9 | Licensed under the MIT license: 10 | 11 | Permission is hereby granted, free of charge, to any person 12 | obtaining a copy of this software and associated documentation 13 | files (the ''Software''), to deal in the Software without 14 | restriction, including without limitation the rights to use, 15 | copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | copies of the Software, and to permit persons to whom the 17 | Software is furnished to do so, subject to the following 18 | conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED ''AS IS'', WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 25 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 27 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 28 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 30 | OTHER DEALINGS IN THE SOFTWARE. *) 31 | | FilesTesting = manifest FilesTesting. |) ( 32 | public testModulesUsingPlatform: platform minitest: minitest ^ <{FilesTesting}> = ( 33 | ^{FilesTesting 34 | usingPlatform: platform 35 | files: platform files 36 | testFramework: minitest 37 | } 38 | ) 39 | ) : ( 40 | ) 41 | -------------------------------------------------------------------------------- /FontsForHTML5.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class FontsForHTML5 usingPlatform: p (* :exemplar: platform fonts *) = ( 4 | (* 5 | Font support for Newspeak. 6 | 7 | Copyright Gene Z. Ragan 2021 8 | *) 9 | | 10 | private Map = p collections Map. 11 | 12 | private DefaultSize = 12.0. 13 | | 14 | ) ( 15 | public class FontConfig = ( 16 | | 17 | public designs = computeDesignMap. 18 | public leading = computeLeadingMap. 19 | public weights = computeWeightMap. 20 | | 21 | ) ( 22 | private computeDesignMap ^ = ( 23 | ^Map new 24 | at: #default put: 'system, -apple-system, sans-serif'; 25 | at: #serif put: 'Cambria, Utopia, Times, Times New Roman, serif'; 26 | at: #monospaced put: 'Consolas, Monaco, Courier, monospace'; 27 | yourself. 28 | ) 29 | private computeLeadingMap ^ = ( 30 | ^Map new 31 | at: #standard put: 'normal'; 32 | at: #tight put: '0.5'; 33 | at: #loose put: '1.5'; 34 | yourself. 35 | ) 36 | private computeWeightMap ^ = ( 37 | ^Map new 38 | at: #ultralight put: 100; 39 | at: #thin put: 200; 40 | at: #light put: 300; 41 | at: #regular put: 400; 42 | at: #medium put: 500; 43 | at: #semibold put: 600; 44 | at: #bold put: 700; 45 | at: #heavy put: 800; 46 | at: #black put: 900; 47 | yourself. 48 | ) 49 | ) : ( 50 | ) 51 | public class Font config: c (* :exemplar: Font config: FontConfig new*) = ( 52 | | 53 | public size ::= DefaultSize. 54 | public design ::= #default. 55 | public weight ::= #regular. 56 | public style ::= #normal. 57 | public decoration ::= #none. 58 | public leading ::= #standard. 59 | public smallCaps 60 | public monospaceDigits 61 | config = c. 62 | | 63 | ) ( 64 | public applyStyle: element = ( 65 | | 66 | css = element at: 'style'. 67 | | 68 | 69 | css 70 | at: 'font-style' put: style asString; 71 | at: 'font-weight' put: (config weights at: weight); 72 | at: 'line-height' put: (config leading at: leading). 73 | 74 | 75 | #linethrough = decoration 76 | ifTrue: [ 77 | css at: 'text-decoration' put: 'line-through'. 78 | ] 79 | ifFalse: [ 80 | css at: 'text-decoration' put: decoration asString. 81 | ]. 82 | ) 83 | ) : ( 84 | ) 85 | ) : ( 86 | ) 87 | -------------------------------------------------------------------------------- /GraphicsForSqueak.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NSGraphics' 3 | class GraphicsForSqueak usingPlatform: p = (| 4 | public Color = p squeak Color. 5 | public Cursor = p squeak Cursor. 6 | public Point = p squeak Point. 7 | public Rectangle = p squeak Rectangle. 8 | public TranslucentColor = p squeak TranslucentColor. 9 | public Gradient = Future computing: [p brazil plumbing Gradient]. 10 | |) ( 11 | public resetForNewImageSession = ( 12 | ) 13 | ) : ( 14 | ) 15 | -------------------------------------------------------------------------------- /HelloDOM.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Samples' 3 | class HelloDOM packageUsing: manifest = () ( 4 | public main: platform args: args = ( 5 | | 6 | Image = platform js global at: 'Image'. 7 | document = platform js global at: 'document'. 8 | body = document at: 'body'. 9 | | 10 | 11 | body appendChild: 12 | (document createTextNode: 'Hello, DOM New World!'). 13 | body appendChild: 14 | ((document createElement: 'p') 15 | appendChild: 16 | ((document createElement: 'a') 17 | at: 'href' put: 'http://newspeaklanguage.org'; 18 | at: 'innerHTML' put: 'Newspeak Language'; 19 | yourself); 20 | yourself). 21 | body appendChild: 22 | (Image new 23 | at: 'src' put: 'http://newspeaklanguage.org/peeking-eye-16-10.png'; 24 | yourself). 25 | 26 | (body at: 'style') 27 | at: 'border-style' put: 'solid'; 28 | at: 'border-width' put: '20px'; 29 | at: 'border-radius' put: '25px'; 30 | at: 'border-color' put: 'black'; 31 | at: 'padding' put: '10px'. 32 | ) 33 | ) : ( 34 | ) 35 | -------------------------------------------------------------------------------- /HopscotchDemo.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class HopscotchDemo packageUsing: manifest = ( 4 | | 5 | private findImage = manifest findImage. 6 | private peekingEye = manifest peekingeye1610. 7 | | 8 | ) ( 9 | class Demo usingPlatform: p = (| 10 | Subject = p hopscotch core Subject. 11 | Presenter = p hopscotch core Presenter. 12 | Color = p graphics Color. 13 | Point = p graphics Point. 14 | Stopwatch = p kernel Stopwatch. 15 | TextEditorFragment = p hopscotch fragments TextEditorFragment. 16 | |) ( 17 | class DemoPresenter onSubject: s = Presenter onSubject: s (| counter ::= 0. |) ( 18 | public definition = ( 19 | | slowHolder echo | 20 | ^(column: { 21 | row: { 22 | filler. 23 | (label: 'Hello, Hopscotch Demo!') color: (Color r: 1 g: 0 b: 0). 24 | filler. 25 | }. 26 | row: { 27 | (label: 'Allow this really long label to get cut off by the other one') compressibility: 1. 28 | filler compressibility: 0. 29 | label: 'Dont cut me off'. 30 | }. 31 | label: ' This label should have a leading space and should be cut off rather than wrapping onto another line.'. 32 | textDisplay: ' This text display should have a leading space. There should be lots of space between these words. This text should wrap. Until after here. 33 | This is after a newline.'. 34 | row: {label: 'Nested'. label: ' in '. label: 'Outer'. filler. sampleMenu. filler}. 35 | echo:: textDisplay: ''. 36 | TextEditorFragment new changeResponse: [:editor | echo text: editor textBeingAccepted]. 37 | row: { 38 | link: 'Alan Kay' action: [echo text: '"In computer terms, Smalltalk is a recursion on the notion of computer itself. Instead of dividing "computer stuff" into things each less strong than the whole--like data structures, procedures, and functions which are the usual paraphernalia of programming languages--each Smalltalk object is a recursion on the entire possibilities of the computer. Thus its semantics are a bit like having thousands and thousands of computers all hooked together by a very fast network." --Alan Kay, The Early History of Smalltalk']. 39 | mediumBlank. 40 | link: 'Puck' action: [echo text: 'Yet but three? Come one more 41 | Two of both kinds make up four']. 42 | mediumBlank. 43 | (link: 'Clear' action: [echo text: '']) color: (Color r: 1 g: 0 b: 0). 44 | blank: 25. 45 | link: 'Alert' action: [alert: 'Bar']. 46 | }. 47 | slowHolder:: holder: [column: {slow. slow}]. 48 | button: 'Do it again!' action: [slowHolder refresh]. 49 | image: peekingEye. 50 | }) color: (Color r: 0.855 g: 0.855 b: 0.9) 51 | ) 52 | fib: n = ( 53 | ^n < 2 ifTrue: [1] ifFalse: [(fib: n - 1) + (fib: n - 2)] 54 | ) 55 | public isKindOfDemoPresenter ^ = ( 56 | ^true 57 | ) 58 | isMyKind: f ^ = ( 59 | ^f isKindOfDemoPresenter 60 | ) 61 | sampleMenu ^ = ( 62 | ^dropDownMenu: [{{counter printString. [counter:: counter + 1. alert: counter]}. {'one'. [alert: '1']}. {'two'. [alert: '2']}. #separator. {'three'. [alert: '3']}. {subject elapsedMilliseconds printString. [alert: 'Dynamic!']} }] 63 | ) 64 | slow = ( 65 | ^initially: 66 | (label: 'Doing something slow...') 67 | deferred: [ 68 | slowFib. 69 | row: { 70 | label: 'Done!'. 71 | mediumBlank. 72 | image: findImage.}]. 73 | ) 74 | slowFib = ( 75 | | stopwatch ::= Stopwatch new start. | 76 | [ fib: 20. 77 | stopwatch elapsedMilliseconds < 1000] whileTrue. 78 | ) 79 | ) : ( 80 | ) 81 | public class DemoSubject new = Subject onModel: nil ( 82 | | stopwatch = Stopwatch new. | 83 | stopwatch start) ( 84 | public createPresenter = ( 85 | ^DemoPresenter onSubject: self 86 | ) 87 | isMyKind: other ^ = ( 88 | ^other isKindOfDemoPresenter 89 | ) 90 | public elapsedMilliseconds = ( 91 | ^stopwatch elapsedMilliseconds 92 | ) 93 | ) : ( 94 | ) 95 | ) : ( 96 | ) 97 | public main: platform args: args = ( 98 | | demo | 99 | 100 | demo:: Demo usingPlatform: platform. 101 | platform hopscotch core HopscotchWindow openSubject: demo DemoSubject new. 102 | ) 103 | ) : ( 104 | ) 105 | -------------------------------------------------------------------------------- /HopscotchGestureDemo.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class HopscotchGestureDemo packageUsing: manifest = ( 4 | ) ( 5 | class Demo usingPlatform: p = (| 6 | Holder = p hopscotch ducts Holder. 7 | Subject = p hopscotch Subject. 8 | Presenter = p hopscotch Presenter. 9 | Color = p graphics Color. 10 | |) ( 11 | class DemoPresenter onSubject: s = Presenter onSubject: s ( 12 | | 13 | borderWidth = Holder with: 10.0. 14 | | 15 | ) ( 16 | public definition = ( 17 | ^column: { 18 | 19 | (row: { 20 | (label: 'Border:') 21 | bold; 22 | italic; 23 | underline; 24 | foregroundColor: Color gray. 25 | 26 | slider: borderWidth 27 | min: 0 28 | max: 100. 29 | }). 30 | 31 | mediumBlank. 32 | 33 | (row: { 34 | rectangle 35 | fill: Color green; 36 | frame: 300 height: 300; 37 | border: Color yellow width: borderWidth; 38 | onClick: [:event | 39 | 'onClick' out. 40 | ]; 41 | onMouseDown: [:event | 42 | 'onMouseDown' out. 43 | ]; 44 | onMouseUp: [:event | 45 | 'onMouseUp' out. 46 | ]; 47 | onMouseEnter: [:event | 48 | 'onMouseEnter' out. 49 | ]; 50 | onMouseMove: [:event | 51 | 'onMouseMove' out. 52 | ]; 53 | onMouseOut: [:event | 54 | 'onMouseOut' out. 55 | ]; 56 | onWheel: [:event | 57 | 'onWheel' out. 58 | ]; 59 | onTouchStart: [:event | 60 | 'onTouchStart' out. 61 | ]; 62 | onTouchMove: [:event | 63 | 'onTouchMove' out. 64 | ]; 65 | onTouchEnd: [:event | 66 | 'onTouchEnd' out. 67 | ]; 68 | onTouchCancel: [:event | 69 | 'onTouchCancel' out. 70 | ]. 71 | }). 72 | } 73 | ) 74 | public isKindOfDemoPresenter ^ = ( 75 | ^true 76 | ) 77 | isMyKind: f ^ = ( 78 | ^f isKindOfDemoPresenter 79 | ) 80 | ) : ( 81 | ) 82 | public class DemoSubject new = Subject onModel: nil ( 83 | ) ( 84 | public createPresenter = ( 85 | ^DemoPresenter onSubject: self 86 | ) 87 | isMyKind: other ^ = ( 88 | ^other isKindOfDemoPresenter 89 | ) 90 | ) : ( 91 | ) 92 | ) : ( 93 | ) 94 | public main: platform args: args = ( 95 | | demo = Demo usingPlatform: platform. | 96 | platform hopscotch core HopscotchWindow openSubject: demo DemoSubject new. 97 | ) 98 | ) : ( 99 | ) 100 | -------------------------------------------------------------------------------- /JSForCroquet.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class JSForCroquet usingPlatform: platform js: jsForPsoup = ( 4 | | 5 | private JsForPsoup = jsForPsoup. 6 | | 7 | ) ( 8 | public class Js usingPlatform: p = JsForPsoup usingPlatform: p ( 9 | | sessionLocalStorage | 10 | ) ( 11 | public localStorage ^ < Alien[LocalStorage]> = ( 12 | (* Get a per-session storage object. These objects do not actually contain any data; they contain access methods that prefix all data with a session specific key. The data is in fact stored in the browser's regular local storage. We cache the per-session object the first time we access it. The caching itself is not too crucial, since any instance returned from the #createSessionStorage() function in Javascript will work. However, having it cached gives us the oportunity to clear the actual storage. We must clear it on startup, since we have to ensure that we always have the same initial state on all clients. This limits the utility of local storage, but provides compatibility with the normal platform.*) 13 | sessionLocalStorage isNil ifTrue: [ 14 | (* allocate a per-session local storage object and cache it *) 15 | sessionLocalStorage:: global createSessionStorage: sessionId. 16 | (* clear the per-session local storage. *) 17 | sessionLocalStorage clear. 18 | ]. 19 | ^sessionLocalStorage 20 | ) 21 | public sessionId ^ = ( 22 | ^super localStorage at: #name 23 | ) 24 | ) : ( 25 | ) 26 | ) : ( 27 | ) 28 | -------------------------------------------------------------------------------- /JSTesting.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class JSTesting usingPlatform: platform testFramework: minitest = ( 4 | | 5 | private js = platform js. 6 | private TestContext = minitest TestContext. 7 | |) ( 8 | public class JSTests = TestContext ( 9 | ) ( 10 | public testJSMath = ( 11 | | Math n | 12 | Math:: js global at: 'Math'. 13 | 14 | n:: Math random. 15 | assert: n isKindOfFloat. 16 | assert: n >= 0.0 asFloat. 17 | assert: n < 1.0 asFloat. 18 | 19 | n:: Math at: 'E'. 20 | assert: n isKindOfFloat. 21 | assert: n > 2.718 asFloat. 22 | assert: n < 2.719 asFloat. 23 | ) 24 | public testJSObject = ( 25 | | JSObject object | 26 | JSObject:: js global at: 'Object'. 27 | object:: JSObject new. 28 | 29 | should: [object methodDoesNotExist] signal: Exception. 30 | 31 | assert: (object at: 'property' put: 42) equals: 42. 32 | assert: (object at: 'property') equals: 42. 33 | assert: (object removeKey: 'property') equals: true. 34 | ) 35 | public testJSString = ( 36 | (* String argument *) 37 | assert: (js global parseInt: '42') equals: 42. 38 | 39 | (* String return value *) 40 | assert: ((js global at: 'Math') toString) equals: '[object Math]'. 41 | ) 42 | public testJSUndefined = ( 43 | assert: js undefined isUndefined. 44 | deny: js global isUndefined. 45 | assert: (js global at: 'DoesNotExist') isUndefined. 46 | deny: (js global at: 'Object') isUndefined. 47 | assert: js undefined printString equals: 'undefined'. 48 | ) 49 | public testJSInteger = ( 50 | assert: (js global parseInt: '0') equals: 0. 51 | assert: (js global parseInt: '1') equals: 1. 52 | assert: (js global parseInt: '-1') equals: -1. 53 | 54 | assert: (js global parseInt: '0x7F') equals: 16r7F. 55 | assert: (js global parseInt: '0xEF') equals: 16rEF. 56 | assert: (js global parseInt: '0xFF') equals: 16rFF. 57 | assert: (js global parseInt: '0x7FFF') equals: 16r7FFF. 58 | assert: (js global parseInt: '0xEFFF') equals: 16rEFFF. 59 | assert: (js global parseInt: '0xFFFF') equals: 16rFFFF. 60 | assert: (js global parseInt: '0x7FFFFFFF') equals: 16r7FFFFFFF. 61 | assert: (js global parseInt: '0xEFFFFFFF') equals: 16rEFFFFFFF. 62 | assert: (js global parseInt: '0xFFFFFFFF') equals: 16rFFFFFFFF. 63 | assert: (js global parseInt: '0x7FFFFFFFFFFF') equals: 16r7FFFFFFFFFFF. 64 | assert: (js global parseInt: '0xEFFFFFFFFFFF') equals: 16rEFFFFFFFFFFF. 65 | assert: (js global parseInt: '0xFFFFFFFFFFFF') equals: 16rFFFFFFFFFFFF. 66 | 67 | assert: (js global parseInt: '-0x7F') equals: -16r7F. 68 | assert: (js global parseInt: '-0xEF') equals: -16rEF. 69 | assert: (js global parseInt: '-0xFF') equals: -16rFF. 70 | assert: (js global parseInt: '-0x7FFF') equals: -16r7FFF. 71 | assert: (js global parseInt: '-0xEFFF') equals: -16rEFFF. 72 | assert: (js global parseInt: '-0xFFFF') equals: -16rFFFF. 73 | assert: (js global parseInt: '-0x7FFFFFFF') equals: -16r7FFFFFFF. 74 | assert: (js global parseInt: '-0xEFFFFFFF') equals: -16rEFFFFFFF. 75 | assert: (js global parseInt: '-0xFFFFFFFF') equals: -16rFFFFFFFF. 76 | assert: (js global parseInt: '-0x7FFFFFFFFFFF') equals: -16r7FFFFFFFFFFF. 77 | assert: (js global parseInt: '-0xEFFFFFFFFFFF') equals: -16rEFFFFFFFFFFF. 78 | assert: (js global parseInt: '-0xFFFFFFFFFFFF') equals: -16rFFFFFFFFFFFF. 79 | ) 80 | public testJSEval = ( 81 | assert: (js global eval: 'null') equals: nil. 82 | assert: (js global eval: 'false') equals: false. 83 | assert: (js global eval: 'true') equals: true. 84 | assert: (js global eval: '42') equals: 42. 85 | assert: (js global eval: '42.5') equals: 42.5 asFloat. 86 | assert: (js global eval: '"string"') equals: 'string'. 87 | ) 88 | ) : ( 89 | TEST_CONTEXT = () 90 | ) 91 | ) : ( 92 | ) 93 | -------------------------------------------------------------------------------- /JSTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class JSTestingConfiguration packageTestsUsing: manifest = ( 4 | | 5 | private JSTesting = manifest JSTesting. 6 | |) ( 7 | public testModulesUsingPlatform: platform minitest: minitest = ( 8 | platform operatingSystem = 'emscripten' ifFalse: [^{}]. 9 | ^{JSTesting usingPlatform: platform testFramework: minitest} 10 | ) 11 | ) : ( 12 | ) 13 | -------------------------------------------------------------------------------- /KernelTestsConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Newspeak' 3 | class KernelTestsConfiguration packageTestsUsing: manifest = (| 4 | private KernelTests = manifest KernelTests. 5 | |) ( 6 | public testModulesUsingPlatform: platform minitest: minitest = ( 7 | ^{KernelTests 8 | usingPlatform: platform 9 | minitest: minitest} 10 | ) 11 | ) : ( 12 | ) 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | License 3 | 4 | The source code for the Newspeak system consists of code developed as part of the Newspeak project 5 | at Cadence Design Systems, of code that constitutes the underlying Squeak Smalltalk system, and of other contributions. 6 | Code developed by Cadence is licensed under the Apache 2.0 license, and all such files or classes bear the following 7 | copyright and licensing notice: 8 | 9 | Copyright 2008 Cadence Design Systems, Inc. Licensed under the Apache License, Version 2.0 (the ''License''); 10 | you may not use this file except in compliance with the License. 11 | You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Code that is part of Squeak is licensed under the Squeak license: 14 | 15 | Licensed under the Squeak License (the ''License''); you may not use this file except in compliance with the License. 16 | You may obtain a copy of the License at http://www.squeak.org/SqueakLicense/ 17 | 18 | (note that in a Squeak or Newspeak image, Squeak classes do not usually come with an explicit copyright and license) 19 | 20 | Code that has been individually contributed will have its copyright and licensing terms described in the class comment in the image, 21 | and in the individual source files. 22 | The preferred license for individual contributions going forward is the MIT license. 23 | -------------------------------------------------------------------------------- /MetadataTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class MetadataTestingConfiguration packageTestsUsing: manifest = ( 4 | | 5 | private MetadataParsing = manifest MetadataParsing. 6 | private MetadataTesting = manifest MetadataTesting. 7 | | 8 | ) ( 9 | public testModulesUsingPlatform: p minitest: m = ( 10 | ^{MetadataTesting usingPlatform: p metadata: MetadataParsing minitest: m} 11 | ) 12 | ) : ( 13 | ) 14 | -------------------------------------------------------------------------------- /MinitestTestsConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class MinitestTestsConfiguration packageTestsUsing: ideNamespace = ( 4 | (* Runs MinitestTests. *) 5 | | 6 | Minitest = ideNamespace Minitest. 7 | MinitestTests = ideNamespace MinitestTests. 8 | |) ( 9 | public testModulesUsingPlatform: platform minitest: minitest ^<{MiniTests}> = ( 10 | ^{MinitestTests usingPlatform: platform testFramework: minitest} 11 | ) 12 | ) : ( 13 | ) 14 | -------------------------------------------------------------------------------- /MirrorBuilderTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class MirrorBuilderTestingConfiguration packageTestsUsing: manifest = (| 4 | private MirrorBuilderTesting = manifest MirrorBuilderTesting. 5 | |) ( 6 | public testModulesUsingPlatform: p minitest: m = ( 7 | ^{MirrorBuilderTesting usingPlatform: p testFramework: m} 8 | ) 9 | ) : ( 10 | ) 11 | -------------------------------------------------------------------------------- /MirrorGroups.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class MirrorGroups usingPlatform: platform = ( 4 | (* Mirror groups are designed to aggregate mirrors of any kind. 5 | They make the mirror API compositional and not too 6 | heavyweight. Consider the API of an immutable mixin mirror: 7 | 8 | 9 | name 10 | methods 11 | slots 12 | classes 13 | 14 | the latter three all return mirror groups, which all share a common protocol: 15 | 16 | findMirrorNamed: #foo 17 | includesMirrorNamed: #foo 18 | do: blk 19 | 20 | In a more traditional API, we would need to support methods like: 21 | 22 | findMethodNamed: #foo 23 | findSlotNamed: #foo 24 | findClassNamed: #foo 25 | 26 | includesMethodNamed: #foo 27 | includesSlotNamed: #foo 28 | includesClassNamed: #foo 29 | 30 | methodsDo: blk 31 | slotsDo: blk 32 | classesDo: blk 33 | 34 | This means 3 times as many methods, which need to be kept consistent. 35 | When the mirror is mutable, the actual mixin API does not change much. The 36 | implementation returns mutable mirror groups, which support: 37 | 38 | addMirror: aMirror 39 | addFromSource: aSourceString 40 | 41 | instead of having the mutable mixin support: 42 | 43 | addMethodMirror: 44 | addMethodFromSource: 45 | addSlotMirror: 46 | addSlotFromSource: 47 | addClassStencilMirror: 48 | addClassFromSource: 49 | 50 | Copyright 2008 Cadence Design Systems, Inc. 51 | Copyright 2011 Ryan Macnak 52 | 53 | Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 *) 54 | | 55 | private Collection = platform collections Collection. 56 | private List = platform collections List. 57 | |) ( 58 | public class ImmutableMirrorGroup group: ms = Collection ( 59 | (* Immutable mirror groups do not support adding or removing mirrors. They are created from an initial set of mirrors passed to the factory method. 60 | 61 | However, the API does include mutators, which all fail if called. This allows them to provide good error messages when used in a context that might attempt to mutate them. An example would be a mutable mixin mirror that does not allow changes to its representation; it includes immutable mirror groups for its slots and classes, and a mutable mirror group for its methods. *) 62 | | 63 | protected mirrors = List withAll: ms. (* Preserve order. Keep source code order if applicable. Shape is important for many classes known to the VM. *) 64 | |) ( 65 | public addFromSource: s = ( 66 | ^Error signal: 'Adding mirrors not allowed on an immutable mirror group!' 67 | ) 68 | public addMirror: m = ( 69 | ^Error signal: 'Adding mirrors not allowed on an immutable mirror group!' 70 | ) 71 | public do: blk <[:Mirror]> = ( 72 | mirrors do: blk 73 | ) 74 | public findMirrorNamed: n ^ = ( 75 | mirrors do: [:mirror | mirror name = n ifTrue: [^mirror]]. 76 | ^nil 77 | ) 78 | public includesMirrorNamed: n = ( 79 | mirrors do: [:mirror | mirror name = n ifTrue: [^true]]. 80 | ^false 81 | ) 82 | public removeMirror: m = ( 83 | ^Error signal: 'Removng mirrors not allowed on an immutable mirror group!' 84 | ) 85 | public removeMirrorNamed: m = ( 86 | ^Error signal: 'Removng mirrors not allowed on an immutable mirror group!' 87 | ) 88 | public size ^ = ( 89 | ^mirrors size 90 | ) 91 | ) : ( 92 | ) 93 | class MirrorGroup group: ms = ImmutableMirrorGroup group: ms ( 94 | (* A mutable mirror group; mirrors can be added or removed after its creation. *) 95 | ) ( 96 | public addFromSource: s = ( 97 | self subclassResponsibility 98 | ) 99 | addMirror: m = ( 100 | mirrors keysAndValuesDo: [:index :mirror | 101 | mirror simpleName = m simpleName ifTrue: [^mirrors at: index put: m]]. 102 | ^mirrors addLast: m 103 | ) 104 | removeAll = ( 105 | mirrors: List new. 106 | ) 107 | removeAllSuchThat: blk = ( 108 | mirrors select: blk thenDo: [:m | removeMirrorNamed: m name]. 109 | ) 110 | removeMirror: m = ( 111 | ^mirrors remove: m 112 | ) 113 | removeMirrorNamed: n = ( 114 | | m | 115 | m:: findMirrorNamed: n. 116 | ^m ifNotNil: [removeMirror: m]. 117 | ) 118 | ) : ( 119 | ) 120 | ) : ( 121 | ) 122 | -------------------------------------------------------------------------------- /MirrorTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Mirrors' 3 | class MirrorTestingConfiguration packageTestsUsing: manifest = (| 4 | private MirrorTesting = manifest MirrorTesting. 5 | private MirrorTestingModel = manifest MirrorTestingModel. 6 | |) ( 7 | public testModulesUsingPlatform: p minitest: m = ( 8 | ^{MirrorTesting usingPlatform: p minitest: m model: MirrorTestingModel new} 9 | ) 10 | ) : ( 11 | ) 12 | -------------------------------------------------------------------------------- /MirrorTestingModel.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Mirrors' 3 | class MirrorTestingModel = () ( 4 | public class Klass factory: arg = SuperKlass superFactory: arg (| 5 | public publicSlot = 1. 6 | protected protectedSlot = 2. 7 | defaultSlot = 3. 8 | private privateSlot = 4. 9 | mutableSlot ::= 5. 10 | immutableSlot = 6. 11 | uninitializedSlot 12 | |) ( 13 | class DefaultNestedClass = () ( 14 | ) : ( 15 | ) 16 | public class Nested = () ( 17 | nestedMethod = ( 18 | ) 19 | ) : ( 20 | ) 21 | private class PrivateNestedClass = () ( 22 | ) : ( 23 | ) 24 | protected class ProtectedNestedClass = () ( 25 | ) : ( 26 | ) 27 | public class PublicNestedClass = () ( 28 | ) : ( 29 | ) 30 | 31 | lazy public lazyPublicSlot = 100 + defaultSlot. 32 | lazy private lazyPrivateSlot = 200*privateSlot. 33 | lazy lazyProtectedSlot ::= 300. 34 | 35 | >>> binaryMethod = ( 36 | ) 37 | defaultMethod = ( 38 | ) 39 | keyword: kw1 method: kw2 = ( 40 | ) 41 | private privateMethod = ( 42 | ) 43 | protected protectedMethod = ( 44 | ) 45 | public publicMethod = ( 46 | ) 47 | ) : ( 48 | public classMethod = ( 49 | ) 50 | ) 51 | public class SuperKlass superFactory: arg = (| 52 | superSlot = arg. 53 | |) ( 54 | class SuperNestedClass = () ( 55 | ) : ( 56 | ) 57 | superMethod = ( 58 | ) 59 | ) : ( 60 | superClassMethod = ( 61 | ) 62 | ) 63 | ) : ( 64 | ) 65 | -------------------------------------------------------------------------------- /NS2JSCompilerTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NS2JS' 3 | class NS2JSCompilerTestingConfiguration packageTestsUsing: manifest = ( 4 | (* Configuration to run the compiler tests against the node.js strategy. 5 | 6 | Derived from NSCompilerTestingConfiguration 7 | 8 | Copyright 2011 Vassili Bykov 9 | Copyright 2012 Google Inc. 10 | Copyright 2013 Ryan Macnak 11 | 12 | Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 *) 13 | | 14 | appPackaging = manifest NS2JSApplicationPackaging packageUsing: manifest. 15 | 16 | NewShell = manifest NewShell. 17 | NSCompilerTesting = manifest NSCompilerTesting. 18 | CommandLineTestingStrategy = manifest CommandLineTestingStrategy. 19 | |) ( 20 | public testModulesUsingPlatform: p minitest: minitest ^ = ( 21 | | 22 | newShell = NewShell usingPlatform: p. 23 | appPackager = appPackaging WebPagePackager usingPlatform: p. 24 | strategy = CommandLineTestingStrategy 25 | platform: p 26 | newShell: newShell 27 | appPackager: appPackager 28 | path: '/usr/local/bin/node' 29 | options: {}. 30 | | 31 | ^{NSCompilerTesting usingPlatform: p testingStrategy: strategy minitest: minitest} 32 | ) 33 | ) : ( 34 | ) 35 | -------------------------------------------------------------------------------- /NS2SqueakCompilerTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NS2Squeak' 3 | class NS2SqueakCompilerTestingConfiguration packageTestsUsing: manifest = ( 4 | (* A replacement of NSCompilerTestConfiguration to pass a pluggable testing strategy to NSCompilerTesting. See the class comment of InImageNSCompilerTestingStrategy for a description of testing strategies. 5 | 6 | Copyright 2011 Vassili Bykov 7 | 8 | Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 *) 9 | | 10 | runtime = manifest BootstrapRuntimeForSqueak packageUsing: manifest. 11 | 12 | NSCompilerTesting = manifest NSCompilerTesting. 13 | InImageNSCompilerTestingStrategy = manifest InImageNSCompilerTestingStrategy. 14 | |) ( 15 | public testModulesUsingPlatform: platform minitest: minitest ^ = ( 16 | | strategy mirrors | 17 | mirrors:: (runtime using: platform squeak VMMirror new) mirrors. 18 | strategy:: InImageNSCompilerTestingStrategy platform: platform mirrors: mirrors. 19 | ^{NSCompilerTesting usingPlatform: platform testingStrategy: strategy minitest: minitest} 20 | ) 21 | ) : ( 22 | ) 23 | -------------------------------------------------------------------------------- /NewShell.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'ExternalProcess' 3 | class NewShell usingPlatform: platform = ( 4 | (* 5 | 6 | Copyright 2008 Cadence Design Systems, Inc. 7 | 8 | Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 9 | *) 10 | | 11 | private ExternalLauncher = platform squeak ExternalLauncher. 12 | private Map = platform collections Map. 13 | private MessageBox = platform brazil tools MessageBox. 14 | 15 | protected launchers = Map new. 16 | |) ( 17 | class CommandError forLauncher: l with: args = Error (| 18 | launcher = l. 19 | arguments = args. 20 | stdoutContents 21 | |) ( 22 | abort = ( 23 | super defaultAction 24 | ) 25 | public defaultAction = ( 26 | | response | 27 | response:: MessageBox new 28 | message: self messageText; 29 | buttonLabels: {'Retry'. 'Abort'. 'Debug'} selections: {[retryCommand]. [abort]. nil}; 30 | open. 31 | response ifNotNil: [:it | self resume: it value]. 32 | super defaultAction 33 | ) 34 | public isResumable = ( 35 | ^true 36 | ) 37 | public retryCommand = ( 38 | ^launcher runWith: arguments 39 | ifSuccess: 40 | [:stdout :stderr | 41 | stdout contents asString] 42 | ifFailure: 43 | [:stdout :stderr | 44 | stdoutContents:: stdout contents asString. 45 | self signal: stderr contents asString] 46 | ) 47 | ) : ( 48 | ) 49 | class CommandSession for: l = (| 50 | launcher = l. 51 | |) ( 52 | public - arg = ( 53 | ^self value: '-', arg 54 | ) 55 | public value = ( 56 | ^with: {} 57 | ) 58 | public value: arg1 = ( 59 | ^with: {arg1} 60 | ) 61 | public value: arg1 value: arg2 = ( 62 | ^with: {arg1. arg2} 63 | ) 64 | public value: arg1 value: arg2 value: arg3 = ( 65 | ^with: {arg1. arg2. arg3} 66 | ) 67 | public value: arg1 value: arg2 value: arg3 value: arg4 = ( 68 | ^with: {arg1. arg2. arg3. arg4} 69 | ) 70 | public value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 = ( 71 | ^with: {arg1. arg2. arg3. arg4. arg5} 72 | ) 73 | public value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6 = ( 74 | ^with: {arg1. arg2. arg3. arg4. arg5. arg6} 75 | ) 76 | public with: arguments = ( 77 | ^(CommandError forLauncher: launcher with: arguments) 78 | retryCommand 79 | ) 80 | ) : ( 81 | ) 82 | doesNotUnderstand: message = ( 83 | ^CommandSession for: 84 | (launchers 85 | at: message selector 86 | ifPresent: [:e | e] 87 | ifAbsentPut: [ExternalLauncher for: message selector]) 88 | ) 89 | ) : ( 90 | ) 91 | -------------------------------------------------------------------------------- /NewspeakPrettyPrinter.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Newspeak' 3 | class NewspeakPrettyPrinter parser: p asts: asts = ( 4 | (* 5 | WIP. DO NOT USE. Completely dysfunctional right now! 6 | This class pretty prints Newspeak code. 7 | *) 8 | | 9 | ASTTraverser = asts ASTTraverser. 10 | parser = p. 11 | prettyPrinter = ASTPrettyPrinter new. 12 | |) ( 13 | class ASTPrettyPrinter = ASTTraverser ( 14 | (* A visitor that produces pretty printed source for Newspeak ASTs. *) 15 | ) ( 16 | ) : ( 17 | ) 18 | public printAST: aNode ^ = ( 19 | ^aNode apply: prettyPrinter 20 | ) 21 | public printClass: src ^ = ( 22 | ^printAST: (parser classDeclaration parseString: src) 23 | ) 24 | public printClassHeader: src ^ = ( 25 | ^printAST: (parser classHeader parseString: src) 26 | ) 27 | public printInitializer: src ^ = ( 28 | ^printAST: (parser iinstanceInitializer parseString: src) 29 | ) 30 | public printMethod: src ^ = ( 31 | ^printAST: (parser methodDecl parseString: src) 32 | ) 33 | ) : ( 34 | public usingPlatform: p = ( 35 | | systemParser = p mirrors compiler parser. | 36 | ^parser: systemParser asts: systemParser ASTModule 37 | ) 38 | ) 39 | -------------------------------------------------------------------------------- /NewspeakTypecheckerTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Newspeak' 3 | class NewspeakTypecheckerTestingConfiguration packageTestsUsing: manifest = ( 4 | (* Testing configuration of NS typechecker. *) 5 | | 6 | NewspeakASTs = manifest NewspeakASTs. 7 | NewspeakTypechecker = manifest NewspeakTypechecker. 8 | NewspeakTypecheckerTesting = manifest NewspeakTypecheckerTesting. 9 | InImageNSCompilerTestingStrategy = manifest InImageNSCompilerTestingStrategy. 10 | Namespacing = manifest Namespacing. 11 | |) ( 12 | public testModulesUsingPlatform: platform minitest: minitest ^ <{NewspeakTypecheckerTesting}> = ( 13 | | 14 | typechecker 15 | astModule 16 | strategy 17 | namespace = (Namespacing usingPlatform: platform) Root select: [:e | e isKindOfBehavior]. 18 | | 19 | 20 | astModule:: NewspeakASTs usingPlatform: platform. 21 | 22 | typechecker:: NewspeakTypechecker usingPlatform: platform ide: nil ast: astModule namespace: namespace. 23 | strategy:: InImageNSCompilerTestingStrategy platform: platform mirrors: platform mirrors. 24 | ^{NewspeakTypecheckerTesting usingPlatform: platform testing: typechecker namespace: namespace strategy: strategy testFramework: minitest} 25 | ) 26 | ) : ( 27 | ) 28 | -------------------------------------------------------------------------------- /NodeAPI.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class NodeAPI usingPlatform: platform = ( 4 | (* 5 | Copyright 2020 - 2021 F5 Networks Inc. 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | *) 18 | | private global = platform js global. | 19 | ) ( 20 | public require: str = ( 21 | (* we don't need to maintain a cache on our end, node already maintains one *) 22 | ^global require: str 23 | ) 24 | protected doesNotUnderstand: message = ( 25 | 0 = message arguments size ifTrue: [ 26 | (message selector startsWith: 'isKindOf') ifTrue: [^false]. 27 | ^require: message selector 28 | ] ifFalse: [ 29 | (* noop, we don't handle anything other than implicit requires yet *) 30 | ] 31 | ) 32 | ) : ( 33 | ) 34 | -------------------------------------------------------------------------------- /ObjectPresenterDemo.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class ObjectPresenterDemo packageUsing: manifest = ( 4 | (*An experiment for testing debugging the Hopscotch 2 UI.*) 5 | | 6 | private WebIDE = manifest HopscotchWebIDE packageUsing: manifest. 7 | | 8 | ) ( 9 | class Demo usingPlatform: p browsing: browsing = ( 10 | (* Describe the class in this comment. *) 11 | | 12 | Subject = p hopscotch core Subject. 13 | ProgrammingPresenter = browsing ProgrammingPresenter. 14 | EvaluationSubject = browsing EvaluationViewState. 15 | | 16 | ) ( 17 | class DemoPresenter onSubject: s = ProgrammingPresenter onSubject: s ( 18 | (* A test class for Hopscotch 2. *) 19 | ) ( 20 | public definition ^ = ( 21 | ^row: {homeButton. subject evaluator presenter} 22 | ) 23 | public isKindOfDemoPresenter ^ = ( 24 | ^true 25 | ) 26 | isMyKind: otherFragment ^ = ( 27 | ^otherFragment isKindOfDemoPresenter 28 | ) 29 | ) : ( 30 | ) 31 | public class DemoSubject onModel: os = Subject onModel: os ( 32 | (* Describe the class in this comment. *) 33 | | 34 | public evaluator = EvaluationSubject onModel: os. 35 | | 36 | ) ( 37 | public createPresenter = ( 38 | ^DemoPresenter onSubject: self 39 | ) 40 | public evaluate: src = ( 41 | ^evaluator evaluate: src 42 | ) 43 | public resetPresenters = ( 44 | super resetPresenters. 45 | evaluator resetPresenters. 46 | ) 47 | public isKindOfDemoSubject ^ = ( 48 | ^true 49 | ) 50 | isMyKind: otherFragment ^ = ( 51 | ^otherFragment isKindOfDemoSubject 52 | ) 53 | ) : ( 54 | ) 55 | ) : ( 56 | ) 57 | public main: platform args: args = ( 58 | | 59 | om = platform mirrors ObjectMirror reflecting: Object new. 60 | ide = WebIDE ideUsingPlatform: platform. 61 | os = ide browsing ObjectSubject onModel: om. 62 | demo = Demo usingPlatform: platform browsing: ide browsing. 63 | demoSubject = demo DemoSubject onModel: os . 64 | | 65 | 66 | platform hopscotch core HopscotchWindow openSubject: demoSubject. 67 | ) 68 | ) : ( 69 | ) 70 | -------------------------------------------------------------------------------- /ParserTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'CombinatorialParsing' 3 | class ParserTestingConfiguration packageTestsUsing: ns = (| 4 | ParserTesting = ns ParserTesting. 5 | CombinatorialParsing = ns CombinatorialParsing. 6 | |) ( 7 | public testModulesUsingPlatform: platform minitest: minitest ^ <{MirrorTesting}> = ( 8 | ^{ 9 | CombinatorialParsing usingPlatform: platform. 10 | (* FastBlocklessCombinatorialParsing usingPlatform: platform. *) 11 | } collect: [:parserLib | 12 | ParserTesting usingPlatform: platform parserLib: parserLib minitest: minitest] 13 | ) 14 | ) : ( 15 | ) 16 | -------------------------------------------------------------------------------- /Particles.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class Particles packageUsing: manifest = ( 4 | ) ( 5 | class World usingPlatform: p = (| 6 | Timer = p actors Timer. 7 | Point = p graphics Point. 8 | Color = p graphics Color. 9 | List = p collections List. 10 | Subject = p hopscotch core Subject. 11 | Presenter = p hopscotch core Presenter. 12 | Math = p js global at: 'Math'. 13 | tau = 6.28318530718 asFloat. 14 | |) ( 15 | class Atom = (| 16 | public x ::= Math random * 800. 17 | public y ::= Math random * 600. 18 | public vx ::= (Math random - 0.5) * 6. 19 | public vy ::= (Math random - 0.5) * 6. 20 | public m = Math random * 150 + 5. 21 | public r = m sqrt + 1. 22 | public color = Color r: Math random g: Math random b: Math random. 23 | |) ( 24 | public collideWith: b = ( 25 | | a = self. dx dy R distance overlap ox oy e dvx dvy top bottom j | 26 | 27 | dx:: a x - b x. 28 | dy:: a y - b y. 29 | R:: a r + b r. 30 | (dx*dx) + (dy*dy) > (R*R) ifTrue: [^self]. 31 | 32 | distance:: ((dx*dx) + (dy*dy)) sqrt. 33 | overlap:: R - distance. 34 | ox:: overlap * dx / distance. 35 | oy:: overlap * dy / distance. 36 | 37 | a x: (a x + (ox / 2)). 38 | a y: (a y + (oy / 2)). 39 | b x: (b x - (ox / 2)). 40 | b y: (b y - (oy / 2)). 41 | 42 | dvx:: a vx - b vx. 43 | dvy:: a vy - b vy. 44 | e:: 1. 45 | 46 | top:: (-1*(1+e)) * ((dvx*dx) + (dvy*dy)). 47 | bottom:: ((1 / a m) + (1 / b m)) * ((dx*dx) + (dy*dy)). 48 | j:: top/bottom. 49 | 50 | a vx: (a vx + ((j / a m)*dx)). 51 | a vy: (a vy + ((j / a m)*dy)). 52 | b vx: (b vx - ((j / b m)*dx)). 53 | b vy: (b vy - ((j / b m)*dy)). 54 | ) 55 | public drawOn: gc = ( 56 | gc fillStyle: color. 57 | gc beginPath. 58 | gc arcAt: (Point x: x y: y) radius: r from: 0 to: tau. 59 | gc fill. 60 | ) 61 | public tick = ( 62 | x:: x + vx. 63 | y:: y + vy. 64 | 65 | x < r ifTrue: [vx:: vx abs]. 66 | x > (800 - r) ifTrue: [vx:: vx abs * -1]. 67 | y < r ifTrue: [vy:: vy abs]. 68 | y > (600 - r) ifTrue: [vy:: vy abs * -1]. 69 | 70 | vx abs > 16 ifTrue: [vx: vx * 0.9]. 71 | vy abs > 16 ifTrue: [vy: vy * 0.9]. 72 | ) 73 | ) : ( 74 | ) 75 | public class World withExtent: e = ( 76 | | 77 | extent = e. 78 | public atoms = List new. 79 | timer 80 | | 81 | 10 timesRepeat: [atoms add: Atom new]. 82 | ) ( 83 | public drawOn: gc = ( 84 | gc fillStyle: (Color r: 0 g: 0 b: 0 a: 0.12 asFloat). 85 | gc beginPath. 86 | gc rectangle: ((Point x: 0 y: 0) corner: extent). 87 | gc fill. 88 | atoms do: [:atom | atom drawOn: gc]. 89 | ) 90 | public tick = ( 91 | 1 to: atoms size -1 do: [:i | 92 | i + 1 to: atoms size do: [:j | 93 | (atoms at: i) collideWith: (atoms at: j). 94 | ]. 95 | ]. 96 | 97 | atoms do: [:atom | atom tick]. 98 | ) 99 | ) : ( 100 | ) 101 | class WorldPresenter onSubject: s = Presenter onSubject: s () ( 102 | definition = ( 103 | | c | 104 | c:: canvas: (Point x: 800 y: 600). 105 | Timer every: 30 do: [:timer | subject model tick. subject model drawOn: c context]. 106 | ^column: { 107 | c. 108 | link: 'Add Atom' action: [subject model atoms add: Atom new]. 109 | link: 'Remove Atom' action: [subject model atoms removeFirst]. 110 | } 111 | ) 112 | public isKindOfWorldPresenter ^ = ( 113 | ^true 114 | ) 115 | isMyKind: f ^ = ( 116 | ^f isKindOfWorldPresenter 117 | ) 118 | ) : ( 119 | ) 120 | public class WorldSubject onModel: m = Subject onModel: m () ( 121 | public createPresenter = ( 122 | ^WorldPresenter onSubject: self 123 | ) 124 | public model = ( 125 | ^super model 126 | ) 127 | public isKindOfWorldSubject ^ = ( 128 | ^true 129 | ) 130 | isMyKind: s = ( 131 | ^s isKindOfWorldSubject 132 | ) 133 | ) : ( 134 | ) 135 | ) : ( 136 | ) 137 | public main: platform args: args = ( 138 | | world | 139 | world:: World usingPlatform: platform. 140 | platform hopscotch core HopscotchWindow openSubject: 141 | (world WorldSubject onModel: 142 | (world World withExtent: (platform graphics Point x: 800 y: 600))). 143 | ) 144 | ) : ( 145 | ) 146 | -------------------------------------------------------------------------------- /ProcessFinalizer.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'HopscotchIDE' 3 | class ProcessFinalizer usingPlatform: p ide: ide_ debuggerClass: debuggerClass_ = ( 4 | (* Central registry for all suspended processes. Ensures that any process forgotten by UI is terminated/unwound. 5 | 6 | Copyright (c) 2012 Cadence Design Systems, Inc. 7 | Copyright (c) 2009 Peter von der Ahe 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining 10 | a copy of this software and associated documentation files (the 11 | ''Software''), to deal in the Software without restriction, including 12 | without limitation the rights to use, copy, modify, merge, publish, 13 | distribute, sublicense, and/or sell copies of the Software, and to 14 | permit persons to whom the Software is furnished to do so, subject to 15 | the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included 18 | in all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED ''AS IS'', WITHOUT WARRANTY OF ANY KIND, 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *) 27 | | 28 | brazil = p brazil. 29 | ide = ide_. 30 | debuggerClass = debuggerClass_. 31 | 32 | private WeakRegistry = p squeak WeakRegistry. 33 | private Process = p squeak Process. 34 | private Processor = p squeak Processor. 35 | private platform = p. 36 | debuggerRegistry = WeakRegistry new. 37 | |) ( 38 | class Finalizer for: p = ( 39 | (* Terminates process when finalized. *) 40 | | 41 | process = p. 42 | |) ( 43 | public finalize = ( 44 | [process terminate] fork 45 | ) 46 | ) : ( 47 | ) 48 | debug: thread activation: activation title: title = ( 49 | | debugger | 50 | debugger:: debuggerFor: thread activation: activation title: title. 51 | brazil theDesktop scheduleUIAction: [debugger open] 52 | ) 53 | public debug: process context: context title: title = ( 54 | (* Bridge from Squeak Process/ContextPart to ThreadMirror and ActivationMirrors *) 55 | | thread activation | 56 | thread:: platform activationMirrors onProcess: process. 57 | activation:: thread createActivationFromContext: context. 58 | 59 | (* Avoid debugging the current process *) 60 | thread isActiveThread 61 | ifTrue: 62 | [[debug: thread activation: activation title: title] forkAt: process priority. 63 | Processor yield] 64 | ifFalse: 65 | [debug: thread activation: activation title: title] 66 | ) 67 | debuggerFor: thread activation: activation title: title = ( 68 | ^instanceOfDebuggerClass: debuggerClass for: thread activation: activation title: title 69 | ) 70 | instanceOfDebuggerClass: klass for: thread activation: activation title: title = ( 71 | | debugger | 72 | debugger:: klass thread: thread activation: activation description: title. 73 | assert: [thread isActiveThread not] message: 'Cannot debug the active thread'. 74 | thread suspend. 75 | debuggerRegistry add: debugger executor: (Finalizer for: thread). 76 | debugger registry: self. 77 | ^debugger 78 | ) 79 | public release: debugger = ( 80 | debuggerRegistry remove: debugger ifAbsent: [] 81 | ) 82 | public subjectFor: exception in: process ^ = ( 83 | | thread activation debugger | 84 | thread:: platform activationMirrors onProcess: process. 85 | activation:: thread createActivationFromContext: exception signalerContext. 86 | debugger:: debuggerFor: thread activation: activation title: exception description. 87 | ^debugger ThreadSubject onModel: thread 88 | ) 89 | public subjectForContext: context ^ = ( 90 | | thread activation debugger process | 91 | 92 | process:: Process 93 | forContext: context 94 | priority: Processor activePriority. 95 | process name: 'Exemplar'. 96 | thread:: platform activationMirrors onProcess: process. 97 | activation:: thread createActivationFromContext: context. 98 | 99 | debugger:: debuggerFor: thread activation: activation title: 'Foo'. 100 | ^debugger ThreadSubject onModel: thread 101 | ) 102 | public terminateAll = ( 103 | debuggerRegistry keys do: 104 | [:each | 105 | each releaseThread ifNotNil: [:thread | thread terminate]] 106 | ) 107 | ) : ( 108 | ) 109 | -------------------------------------------------------------------------------- /RegexTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Regex' 3 | class RegexTestingConfiguration packageTestsUsing: ideNamespace = ( 4 | | 5 | RegexMatcher = ideNamespace RegexMatcher. 6 | RegexTesting = ideNamespace RegexTesting. 7 | |) ( 8 | public testModulesUsingPlatform: platform minitest: minitest ^<{RegexTesting}> = ( 9 | | regex = RegexMatcher usingPlatform: platform. | 10 | ^{RegexTesting usingRegex: regex minitest: minitest}. 11 | ) 12 | ) : ( 13 | ) 14 | -------------------------------------------------------------------------------- /RuntimeForJS.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'NS2JS' 3 | class RuntimeForJS packageUsing: manifest = ( 4 | (* Provides the platform object for Newspeak on Javascript. 5 | 6 | Copyright 2012 Google Inc. 7 | Copyright 2013 Ryan Macnak 8 | 9 | Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 *) 10 | | 11 | Kernel = manifest KernelForJS. 12 | Actors = manifest ActorsForJS. 13 | Aliens = manifest AliensForJS. 14 | Collections = manifest Collections. 15 | Mirrors = manifest MirrorsForJS. 16 | public MirrorGroups = manifest MirrorGroups. 17 | Streams = manifest Streams. 18 | |) ( 19 | class Platform usingVmMirror: vmmirror = ( 20 | | 21 | public kernel = Object enclosingObject. (* Instantiated specially to avoid bootstrapping issues. *) 22 | public actors = Future computing: [Actors usingPlatform: self]. 23 | public js = Future computing: [Aliens usingPlatform: self]. 24 | public collections = Future computing: [Collections usingPlatform: self]. 25 | public mirrors = Future computing: [Mirrors usingPlatform: self runtime: outer RuntimeForJS vmMirror: vmmirror]. 26 | public streams = Future computing: [Streams usingPlatform: self]. 27 | public operatingSystem = 'web'. 28 | | 29 | kernel platform: self. 30 | actors yourself. 31 | ) ( 32 | public Exception = ( 33 | ^Error 34 | ) 35 | public Message = ( 36 | ^kernel Message 37 | ) 38 | public MessageNotUnderstood = ( 39 | ^kernel MessageNotUnderstood 40 | ) 41 | public UnhandledError = ( 42 | ^Error 43 | ) 44 | ) : ( 45 | ) 46 | public using: vmmirror = ( 47 | Object enclosingObject augmentPrototypes. 48 | ^Platform usingVmMirror: vmmirror 49 | ) 50 | ) : ( 51 | ) 52 | -------------------------------------------------------------------------------- /RuntimeForJSWithMirrorBuilders.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class RuntimeForJSWithMirrorBuilders packageUsing: manifest = ( 4 | (* Provides the platform object for Newspeak on Javascript. 5 | 6 | Copyright 2012 Google Inc. 7 | Copyright 2013 Ryan Macnak 8 | 9 | Licensed under the Apache License, Version 2.0 (the ''License''); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 *) 10 | | 11 | Kernel = manifest KernelForJS. 12 | Actors = manifest ActorsForJS. 13 | Aliens = manifest AliensForJS. 14 | Collections = manifest Collections. 15 | Mirrors = manifest MirrorsForJS. 16 | public MirrorGroups = manifest MirrorGroups. 17 | Streams = manifest Streams. 18 | 19 | public CombinatorialParsing = manifest CombinatorialParsing. 20 | public NewspeakGrammar = manifest NewspeakGrammar. 21 | public NewspeakASTs = manifest NewspeakASTs. 22 | public NewspeakParsing = manifest NewspeakParsing. 23 | public MetadataParsing = manifest MetadataParsing. 24 | 25 | public JavascriptGeneration = manifest JavascriptGeneration. 26 | public Compilation = manifest Newspeak2JSCompilation mixinApply: manifest NewspeakCompilation. 27 | |) ( 28 | class Platform usingVmMirror: vmmirror = ( 29 | | 30 | public kernel = Object enclosingObject. (* Instantiated specially to avoid bootstrapping issues. *) 31 | public actors = Future computing: [Actors usingPlatform: self]. 32 | public js = Future computing: [Aliens usingPlatform: self]. 33 | public collections = Future computing: [Collections usingPlatform: self]. 34 | public mirrors = Future computing: [Mirrors usingPlatform: self runtime: outer RuntimeForJSWithMirrorBuilders vmMirror: vmmirror]. 35 | public streams = Future computing: [Streams usingPlatform: self]. 36 | public operatingSystem = 'web'. 37 | | 38 | kernel platform: self. 39 | actors yourself. 40 | ) ( 41 | public Exception = ( 42 | ^Error 43 | ) 44 | public Message = ( 45 | ^kernel Message 46 | ) 47 | public MessageNotUnderstood = ( 48 | ^kernel MessageNotUnderstood 49 | ) 50 | public UnhandledError = ( 51 | ^Error 52 | ) 53 | ) : ( 54 | ) 55 | public using: vmmirror = ( 56 | Object enclosingObject augmentPrototypes. 57 | ^Platform usingVmMirror: vmmirror 58 | ) 59 | ) : ( 60 | ) 61 | -------------------------------------------------------------------------------- /SqueakMirrorTesting.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Mirrors' 3 | class SqueakMirrorTesting usingPlatform: platform minitest: minitest = (| 4 | private TestContext = minitest TestContext. 5 | private vmmirror = platform squeak VMMirror new. 6 | |) ( 7 | public class VMMirrorTests = TestContext ( 8 | ) ( 9 | class A = (| 10 | public foo 11 | public bar 12 | |) ( 13 | public isA = ( 14 | ^true 15 | ) 16 | public isB = ( 17 | ^false 18 | ) 19 | ) : ( 20 | ) 21 | class B = (| 22 | public baz 23 | public quo 24 | |) ( 25 | public isA = ( 26 | ^false 27 | ) 28 | public isB = ( 29 | ^true 30 | ) 31 | ) : ( 32 | ) 33 | public testChangeClass = ( 34 | | obj | 35 | obj:: A new. 36 | obj foo: 3. 37 | obj bar: 4. 38 | assert: obj isA. 39 | vmmirror changeClassOf: obj to: B ifFail: [:why | failWithMessage: why ]. 40 | assert: obj isB. 41 | assert: obj baz equals: 3. 42 | assert: obj quo equals: 4. 43 | ) 44 | ) : ( 45 | TEST_CONTEXT = () 46 | ) 47 | bar = ( 48 | ^'enclosing' 49 | ) 50 | classFromSource: src ^ = ( 51 | ^(ClassDeclarationBuilder fromSource: src) install reflectee apply: Object 52 | ) 53 | foo = ( 54 | ^'enclosing' 55 | ) 56 | fooWithArg: n = ( 57 | ^'enclosing' 58 | ) 59 | ) : ( 60 | ) 61 | -------------------------------------------------------------------------------- /SqueakMirrorTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Mirrors' 3 | class SqueakMirrorTestingConfiguration packageTestsUsing: ideNamespace = (| 4 | SqueakMirrorTesting = ideNamespace SqueakMirrorTesting. 5 | |) ( 6 | public testModulesUsingPlatform: platform minitest: minitest ^ <{MirrorTesting}> = ( 7 | ^{SqueakMirrorTesting 8 | usingPlatform: platform 9 | minitest: minitest} 10 | ) 11 | ) : ( 12 | ) 13 | -------------------------------------------------------------------------------- /TelescreenApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class TelescreenApp packageUsing: manifest = ( 4 | | 5 | private Telescreen = manifest Telescreen. 6 | private Documents = manifest Documents. 7 | private HopscotchIDE = manifest HopscotchWebIDE packageUsing: manifest. 8 | | 9 | ) ( 10 | public main: platform args: args = ( 11 | | 12 | ide = HopscotchIDE ideUsingPlatform: platform. 13 | telescreen = Telescreen usingPlatform: platform ide: ide. 14 | | 15 | ide namespacing Root 16 | at: #TelescreenApp put: class; 17 | at: #Telescreen put: Telescreen. 18 | ide browsing IDEWindow openSubject: telescreen presentationListSubject 19 | ) 20 | loadPresentations = ( 21 | (* WIP. load a set of desired presentations in advance. This includes the presentations themselves, and any classes or documents they depend on. If there is only one presentation, we should open it directly as well. We need to figure out where the dependency list comes from - a standard file or directory (maybe part of the telescreen file?*) 22 | (* code sample of preloading a URL with text. We'll need to do this for classes and documents as well as for complete zips of presentations. The main code should end up in a utility somewhere.*) 23 | (platform js global fetch: 'https://newspeaklanguage.org/samples/Literate/literate.html') then: [:r | r blob then: [:b | b text then: [:s | s out ]]] 24 | ) 25 | ) : ( 26 | ) 27 | -------------------------------------------------------------------------------- /TelescreenTemplate.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/TelescreenTemplate.zip -------------------------------------------------------------------------------- /TelescreenTemplate/contents/TelescreenTemplate_slide_1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/TelescreenTemplate/contents/TelescreenTemplate_slide_1.zip -------------------------------------------------------------------------------- /TelescreenTemplate/documents/NewspeakMasterSlide.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/TelescreenTemplate/documents/NewspeakMasterSlide.zip -------------------------------------------------------------------------------- /TestActor.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Actors' 3 | class TestActor = (| 4 | public Promise 5 | public link 6 | |) ( 7 | public echo: answer = ( 8 | ^answer 9 | ) 10 | public echoItself: answer = ( 11 | ^answer <-: yourself 12 | ) 13 | public forwardNoWaitAdd: a and: b = ( 14 | ^link <-: noWaitAdd: a and: b 15 | ) 16 | public forwardReturn42 = ( 17 | ^link <-: return42 18 | ) 19 | public noWaitAdd: nearA and: nearB = ( 20 | ^nearA yourself + nearB yourself 21 | ) 22 | public on: checker check: event happensAfter: predecessor = ( 23 | checker <-: check: event happensAfter: predecessor. 24 | ^checker 25 | ) 26 | public pass: token = ( 27 | ^nil = link ifTrue: [token] ifFalse: [link <-: pass: token] 28 | ) 29 | public return42 = ( 30 | ^42 31 | ) 32 | public returnPromise42 = ( 33 | ^42 <-: yourself. 34 | ) 35 | public returnPromiseSignalError = ( 36 | ^self <-: signalError. 37 | ) 38 | public returnPromiseYourself = ( 39 | ^self <-: yourself. 40 | ) 41 | public signalError = ( 42 | Error signal: 'You asked for it.' 43 | ) 44 | public waitAdd: eventualA and: eventualB = ( 45 | ^Promise when: eventualA fulfilled: [:a | Promise when: eventualB fulfilled: [:b | a + b]]. 46 | ) 47 | ) : ( 48 | ) 49 | -------------------------------------------------------------------------------- /TimeForSqueak.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Time' 3 | class TimeForSqueak usingPlatform: p vmMirror: vmm = (| 4 | public Time = p squeak Time. 5 | public Date = p squeak Date. 6 | |) ( 7 | ) : ( 8 | ) 9 | -------------------------------------------------------------------------------- /TodoMVCApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class TodoMVCApp packageUsing: manifest = ( 4 | | private TodoMVC = manifest TodoMVC. | 5 | ) ( 6 | public main: platform args: args = ( 7 | | todos = TodoMVC usingPlatform: platform. | 8 | platform hopscotch HopscotchWindow openSubject: todos TodoMVCSubject new 9 | ) 10 | ) : ( 11 | ) 12 | -------------------------------------------------------------------------------- /TwoViewEditor.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class TwoViewEditor usingPlatform: p = ( 4 | (* 5 | This module implements an editor with two views: one view is a text editor on raw HTML, and the second is the same HTML, rendered. The editor is live - every edit causes immediate change in the rendered HTML. 6 | 7 | Importantly, the HTML can specify embedded Hopscotch fragments using Ampleforth (still unsupported). Indeed, the primary purpose here is to facilitate the creation of live documents which include programmed UI elements such as live literate programs. 8 | 9 | Design discussion: 10 | 11 | The question arises, how to specify the mapping from class names used in the HTML to actual fragments. This mapping is required by Ampleforth. The set of UI elements one might want to embed is open-ended, and often created by the document author. Therefore we need to able to compute a fragment instance in the context of the document. This leads to the need to access all standard fragment classes, and to able to load new ones. Better yet, it would be nice to support widget development within the tool. 12 | 13 | The above leads to the view that this tool is an extension of the IDE (or even, part of the IDE). This aspect is still unimplemented. Need to figure out how to provide it in the UI. We will perhaps want a workspace that has access to this editor (or conversely, a presenter on the editor that has access to the IDE namespace) so that we can define the mapping that will be used by Ampleforth. And we'd want access to the IDE namespace, and so we end up with what amounts to providing the IDE as part of the tool. It then seems natural to make this part of the IDE, so the namespace access, as well as search, help and workspaces are part of the UI already. Then the mapping is a slot of this module and accessible from regular workspaces. We have one mapping for all documents. We could also have per subject mappings, and set them on subject creation, managing them as sub-namespaces in the IDE. 14 | *) 15 | | 16 | private Subject = p hopscotch Subject. 17 | private Presenter = p hopscotch Presenter. 18 | | 19 | ) ( 20 | public class TwoViewEditorSubject onModel: m = Subject onModel: m ( 21 | (* We really want a mutable string as a model, but there is no such 22 | thing in our system, so we use a one-element Array[String]. 23 | *) 24 | | public isAmpleforth ::= false. | 25 | ) ( 26 | public createPresenter ^ = ( 27 | ^TwoViewEditorPresenter onSubject: self 28 | ) 29 | public text ^ = ( 30 | ^model first 31 | ) 32 | public setText: s = ( 33 | model at: 1 put: s 34 | ) 35 | public isKindOfTwoViewSubject ^ = ( 36 | ^true 37 | ) 38 | isMyKind: f ^ = ( 39 | ^f isKindOfTwoViewSubject 40 | ) 41 | ) : ( 42 | public initialContents: s = ( 43 | ^onModel: (Array withAll: {s}) 44 | ) 45 | ) 46 | class TwoViewEditorPresenter onSubject: s = Presenter onSubject: s ( 47 | | rendered = holder: (render: subject text). | 48 | ) ( 49 | public isKindOfTwoViewPresenter ^ = ( 50 | ^true 51 | ) 52 | isMyKind: f ^ = ( 53 | ^f isKindOfTwoViewPresenter 54 | ) 55 | definition ^ = ( 56 | | cm = codeMirror: subject text. | 57 | rendered content: (render: subject text). 58 | cm 59 | changeResponse: [:ed :event | 60 | subject setText: ed textBeingAccepted. 61 | rendered content: (render: subject text) 62 | ]; 63 | (*cancelResponse: cancelResponse;*) 64 | acceptResponse: [:ed :event | updateGUI: [ subject setText: ed textBeingAccepted]]. 65 | ^row: { expanded: [cm] collapsed: [nothing]. rendered} 66 | ) 67 | updateVisualsFromSameKind: oldFragment ^ = ( 68 | ^visual 69 | ) 70 | render: s = ( 71 | (* Problem: there is no method #ampleforth:. The actual method is #ampleforth:mapping:. 72 | The root issue here is that we have no mapping. specified. We need real thought over how to define/provide a mapping 73 | in the editor, and how to provide access to the various widgets one might want to use. 74 | *) 75 | ^subject isAmpleforth ifTrue: [ampleforth: s] ifFalse: [html: s] 76 | ) 77 | ) : ( 78 | ) 79 | ) : ( 80 | ) 81 | -------------------------------------------------------------------------------- /TwoViewEditorApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class TwoViewEditorApp packageUsing: manifest = ( 4 | | private TwoViewEditor = manifest TwoViewEditor. | 5 | ) ( 6 | public main: platform args: args = ( 7 | | ui = TwoViewEditor usingPlatform: platform. | 8 | platform hopscotch HopscotchWindow openSubject: (ui TwoViewEditorSubject initialContents: 'Edit me '). 9 | 10 | ) 11 | ) : ( 12 | ) 13 | -------------------------------------------------------------------------------- /VCSImageMirrorCaching.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'MemoryHole' 3 | class VCSImageMirrorCaching usingPlatform: platform = ( 4 | (* Keeps track of mirrors corresponding to classes in image and removes them from the cache when corresponding classes change in the image. 5 | 6 | Any changes that are loaded by the new version control cause the top-level classes that are affected by the change to be reloaded. As long as we're still using the old compiler, loading a top-level class happens incrementally. As a result, classes that are being loaded may be inconsistent. Reloading the class that removes mirrors for classes that are changed then causes problems. 7 | 8 | By keeping this code in a separate top-level class we reduce the number of times it has to be changed. 9 | 10 | Copyright (c) 2010-2011 Matthias Kleine 11 | 12 | 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: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 15 | 16 | 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. *) 17 | | 18 | 19 | private Map = platform squeak Dictionary. 20 | private SystemChangeNotifier = platform squeak SystemChangeNotifier. 21 | private PackageOrganizer = platform squeak PackageOrganizer. 22 | private updatesFromMirrors = platform mirrors channelForMemoryHole. 23 | |) ( 24 | public class ImageMirrorCache = (| 25 | classNameToMirrorCache = Map new. 26 | stringToMirrorCache = Map new. 27 | outlet 28 | |) ( 29 | public at: key ifAbsentPut: block = ( 30 | ^classNameToMirrorCache at: key ifAbsentPut: block 31 | ) 32 | resetMirrorOfClass: aClass = ( 33 | | mirror name | 34 | nil = aClass ifTrue: [^self]. 35 | 36 | name:: aClass theNonMetaClass mixin definingModule name , '.ns'. 37 | classNameToMirrorCache removeKey: name ifAbsent: []. 38 | 39 | name:: (PackageOrganizer default packageOfClass: aClass ifNone: [^self]) 40 | name , '.st'. 41 | classNameToMirrorCache removeKey: name ifAbsent: []. 42 | ) 43 | public start = ( 44 | outlet:: updatesFromMirrors => [:mixin | resetMirrorOfClass: mixin]. 45 | SystemChangeNotifier uniqueInstance 46 | notify: self 47 | ofAllSystemChangesUsing: #systemChangeEvent: 48 | ) 49 | public stop = ( 50 | updatesFromMirrors detach: outlet. 51 | outlet:: nil. 52 | SystemChangeNotifier uniqueInstance noMoreNotificationsFor: self. 53 | ) 54 | public stringToMirrorCacheForProduction: production = ( 55 | ^stringToMirrorCache 56 | at: production 57 | ifAbsentPut: [Map new] 58 | ) 59 | public systemChangeEvent: event = ( 60 | event itemKind = SystemChangeNotifier classKind ifTrue: [ 61 | resetMirrorOfClass: event item]. 62 | event itemKind = SystemChangeNotifier methodKind ifTrue: [ 63 | resetMirrorOfClass: event item methodClass] 64 | ) 65 | public void = ( 66 | classNameToMirrorCache keysAndValuesRemove: [:k :v| true]. 67 | stringToMirrorCache keysAndValuesRemove: [:k :v| true]. 68 | ) 69 | ) : ( 70 | ) 71 | ) : ( 72 | ) 73 | -------------------------------------------------------------------------------- /VCSLib.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'MemoryHole' 3 | class VCSLib packageUsing: manifest = (| 4 | Core = manifest VCSCore. 5 | UI = manifest VCSUI. 6 | Diffing = manifest VCSDiffing. 7 | ImageMirrorCaching = manifest VCSImageMirrorCaching. 8 | 9 | MercurialBackendProvider = manifest VCSMercurialBackendProvider. 10 | GitBackendProvider = manifest VCSGitBackendProvider. 11 | SubversionBackendProvider = manifest VCSSubversionBackendProvider. 12 | 13 | SourceMirrors = manifest VCSSourceMirrors. 14 | NewspeakSourceMirrors = manifest VCSNewspeakSourceMirrors. 15 | SmalltalkSourceMirrors = manifest VCSSmalltalkSourceMirrors. 16 | 17 | gitIcon = manifest repositoryGit. 18 | hgIcon = manifest repositoryMercurial. 19 | |) ( 20 | class VCS usingPlatform: p ide: ide = (|| 21 | public core = Core usingPlatform: p vcs: self ide: ide. 22 | 23 | public sourceMirrors = SourceMirrors usingPlatform: p vcs: self ide: ide. 24 | public newspeakSourceMirrors = NewspeakSourceMirrors usingPlatform: p vcs: self ide: ide. 25 | public smalltalkSourceMirrors = SmalltalkSourceMirrors usingPlatform: p vcs: self. 26 | 27 | public ui = UI usingPlatform: p vcs: self ide: ide. 28 | public diffing = Diffing usingPlatform: p vcs: self ide: ide. 29 | 30 | public git = GitBackendProvider usingPlatform: p vcs: self. 31 | public hg = MercurialBackendProvider usingPlatform: p vcs: self. 32 | public svn = SubversionBackendProvider usingPlatform: p vcs: self. 33 | 34 | public imageMirrorCache = (ImageMirrorCaching usingPlatform: p) 35 | ImageMirrorCache new start; yourself. 36 | || 37 | ) ( 38 | public gitIcon = ( ^outer VCSLib gitIcon ) 39 | public hgIcon = ( ^outer VCSLib hgIcon ) 40 | ) : ( 41 | ) 42 | public usingPlatform: p ide: ide= ( 43 | ^VCS usingPlatform: p ide: ide 44 | ) 45 | ) : ( 46 | ) 47 | -------------------------------------------------------------------------------- /VCSSubversionBackendProvider.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'MemoryHole' 3 | class VCSSubversionBackendProvider usingPlatform: platform vcs: vcs = ( 4 | (* Back-end for accessing subversion repositories 5 | 6 | Copyright (c) 2010-2011 Matthias Kleine 7 | 8 | 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: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | 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. *) 13 | | 14 | 15 | private AbstractBackend = vcs core AbstractBackend. 16 | 17 | private logger = vcs core logger. 18 | 19 | private FileDirectory = platform squeak FileDirectory. 20 | |) ( 21 | public class Backend = AbstractBackend ( 22 | ) ( 23 | public class LocalRepository onRepositoryId: repositoryId = AbstractLocalRepository onRepositoryId: repositoryId (| 24 | private svnAdmin = SvnAdminCommand new. 25 | private remoteRepositoryDirectory = FileDirectory on: repositoryDirectory pathName, '_svnrepo'. 26 | |) ( 27 | class Command = AbstractCommand (| 28 | commandLine = 'svn'. 29 | |) ( 30 | public addStream: stream asFileNamed: filename = ( 31 | writeStream: stream toFileNamed: filename. 32 | launcher run: {'add'. (repository repositoryDirectory / filename) fullName} 33 | ) 34 | createEmptyWorkingCopy = ( 35 | launcher run: {'checkout'. remoteRepositoryDirectory url. repository repositoryDirectory pathName}. 36 | addStream: '' readStream asFileNamed: ignoredFilename. 37 | launcher run: {'commit'. '-m'. 'Initial Commit'. workingCopyPath}. 38 | ) 39 | defaultArguments = ( 40 | ^{} 41 | ) 42 | topLevelDirectoryNames = ( 43 | halt. 44 | ^launcher runLines: {'ls'. workingCopyPath} 45 | ) 46 | workingCopyPath = ( 47 | ^repository repositoryDirectory pathName 48 | ) 49 | ) : ( 50 | ) 51 | class Historian named: historianName version: v = AbstractLocalHistorian named: historianName version: v ( 52 | ) ( 53 | ) : ( 54 | ) 55 | class RepositoryVersionAccessing = AbstractRepositoryVersionAccessing () ( 56 | class RepositoryVersion = AbstractRepositoryVersion ( 57 | ) ( 58 | ) : ( 59 | ) 60 | ) : ( 61 | ) 62 | class SvnAdminCommand = AbstractCommand (| 63 | commandLine = 'svnadmin'. 64 | |) ( 65 | public createEmptyRepository = ( 66 | launcher noDefaultArgumentsRun: {'create'. remoteRepositoryDirectory pathName}. 67 | ) 68 | ) : ( 69 | ) 70 | clone: location = ( 71 | logger warn: 'Cloning repositories is not supported' 72 | ) 73 | create = ( 74 | svnAdmin createEmptyRepository. 75 | command createEmptyWorkingCopy 76 | ) 77 | public historians = ( 78 | ^command topLevelDirectoryNames collect: [:each | Historian named: each version: nil] 79 | ) 80 | repository = ( 81 | ^self 82 | ) 83 | ) : ( 84 | ) 85 | Repository = ( 86 | ^AbstractRepository 87 | ) 88 | ) : ( 89 | ) 90 | ) : ( 91 | ) 92 | -------------------------------------------------------------------------------- /VMMirror.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class VMMirror usingPlatform: platform = ( 4 | (* 5 | The VMMirror is the source of all power in the Newspeak system. 6 | It controls access to VM primitives. A class can have a primitive method installed 7 | by using the #bestowPrimitive:access:named:onClass: method. 8 | 9 | A primitive can also be encapsulated as an instance of 10 | class CapabilityForPrimitive, so that capabilities for individual primitives can be distributed 11 | independently. Individual primitive capabilities are obtained by calling #capabilityForPrimitive:named:. 12 | *) 13 | | 14 | private Method = platform kernel Method. 15 | | 16 | ) ( 17 | class CapabilityForPrimitive number: n named: s = ( 18 | | 19 | public primitiveNumber = n. 20 | public name = n. 21 | | 22 | ) ( 23 | public bestowOnClass: c = ( 24 | bestowOnClass: c access: #protected 25 | ) 26 | public bestowOnClass: c access: a = ( 27 | bestowPrimitive: primitiveNumber access: a named: name onClass: c 28 | ) 29 | ) : ( 30 | ) 31 | public capabilityForPrimitive: pnum named: s ^ = ( 32 | ^CapabilityForPrimitive number: pnum named: s 33 | ) 34 | public bestowPrimitive: n access: a named: s onClass: c = ( 35 | | 36 | numArgs = numberOfArgumentsFor: s. 37 | hdr = Method headerForAccessModifier: a primitive: n numTemps: 0 numArgs: numArgs. 38 | method = Method new header: hdr. 39 | | 40 | method selector: s. 41 | method mixin: m. (* how to get at m *) 42 | (* add method to mixin *) 43 | ) 44 | ) : ( 45 | ) 46 | -------------------------------------------------------------------------------- /VictoryFuelTesting.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'VictoryFuel' 3 | class VictoryFuelTesting usingPlatform: p victoryFuel: vf minitest: m icons: i bootstrapRuntime: br = (| 4 | private WeakArray = p collections WeakArray. 5 | private icons = i. 6 | private bootstrapRuntime = br. 7 | private globals = p squeak Smalltalk globals. 8 | 9 | private Serializer = vf Serializer. 10 | private Deserializer = vf Deserializer. 11 | 12 | private TestContext = m TestContext. 13 | |) ( 14 | public class VFTests = TestContext () ( 15 | roundTrip: object = ( 16 | | 17 | bytes 18 | serializer 19 | deserializer 20 | | 21 | bytes:: ByteArray new writeStream. 22 | serializer:: Serializer over: bytes withGlobals: globals. 23 | serializer serialize: object. 24 | deserializer:: Deserializer over: bytes contents readStream withGlobals: globals. 25 | ^deserializer deserialize. 26 | ) 27 | public testArrays = ( 28 | | x | 29 | assert: (roundTrip: {}) equals: {}. 30 | assert: (roundTrip: {true. false. nil}) equals: {true. false. nil}. 31 | assert: (roundTrip: {{}. {}}) equals: {{}. {}}. 32 | 33 | x:: Array new: 1. 34 | x at: 1 put: x. 35 | x:: roundTrip: x. 36 | assert: [(x at: 1) == x]. 37 | ) 38 | public testBootstrapRuntime = ( 39 | | br2 = roundTrip: bootstrapRuntime. | 40 | assert: [br2 printString startsWith: 'BootstrapRuntimeForSqueak']. 41 | ) 42 | public testByteArrays = ( 43 | assert: (roundTrip: ByteArray new) equals: ByteArray new. 44 | assert: (roundTrip: 'foobar' asByteArray) equals: 'foobar' asByteArray. 45 | ) 46 | public testCharacters = ( 47 | | 48 | NUL = Character value: 0. 49 | snowflake = Character codePoint: 16r2744. 50 | | 51 | assert: (roundTrip: "a") equals: "a". 52 | assert: (roundTrip: NUL) equals: NUL. 53 | assert: (roundTrip: snowflake) equals: snowflake. 54 | ) 55 | public testCompiledMethods = ( 56 | | x | 57 | x:: Array compiledMethodAt: #printOn:. 58 | assert: (roundTrip: x) equals: x. 59 | ) 60 | public testFloats = ( 61 | assert: (roundTrip: Float pi) equals: Float pi. 62 | assert: (roundTrip: Float infinity) equals: Float infinity. 63 | assert: (roundTrip: Float epsilon) equals: Float epsilon. 64 | ) 65 | public testForms = ( 66 | (* Form equality does an identity check. *) 67 | icons do: [:icon | assert: (roundTrip: icon) bits equals: icon bits]. 68 | ) 69 | public testLargeNegativeIntegers = ( 70 | assert: (roundTrip: -1 << 31) equals: -1 << 31. 71 | assert: (roundTrip: -1 << 32) equals: -1 << 32. 72 | assert: (roundTrip: -1 << 33) equals: -1 << 33. 73 | 74 | assert: (roundTrip: -1 << 63) equals: -1 << 63. 75 | assert: (roundTrip: -1 << 64) equals: -1 << 64. 76 | assert: (roundTrip: -1 << 65) equals: -1 << 65. 77 | ) 78 | public testLargePositiveIntegers = ( 79 | assert: (roundTrip: 1 << 31) equals: 1 << 31. 80 | assert: (roundTrip: 1 << 32) equals: 1 << 32. 81 | assert: (roundTrip: 1 << 33) equals: 1 << 33. 82 | 83 | assert: (roundTrip: 1 << 63) equals: 1 << 63. 84 | assert: (roundTrip: 1 << 64) equals: 1 << 64. 85 | assert: (roundTrip: 1 << 65) equals: 1 << 65. 86 | ) 87 | public testOddballs = ( 88 | assert: (roundTrip: nil) equals: nil. 89 | assert: (roundTrip: false) equals: false. 90 | assert: (roundTrip: true) equals: true. 91 | ) 92 | public testPoints = ( 93 | assert: (roundTrip: 3@4) equals: 3@4. 94 | ) 95 | public testSmallIntegers = ( 96 | assert: (roundTrip: 0) equals: 0. 97 | 98 | assert: (roundTrip: 16r7FFF) equals: 16r7FFF. 99 | assert: (roundTrip: -32768) equals: -32768. (* -16r8000 *) 100 | 101 | assert: (roundTrip: 16r3FFFFFFF) equals: 16r3FFFFFFF. 102 | assert: (roundTrip: -1073741824) equals: -1073741824. (* -16r40000000 *) 103 | ) 104 | public testSymbols = ( 105 | | a b | 106 | a:: #foobar. 107 | b:: roundTrip: a. 108 | assert: [a == b]. (* Identical *) 109 | ) 110 | public testWeakArrays = ( 111 | | x | 112 | assert: (roundTrip: WeakArray new) equals: WeakArray new. 113 | 114 | x:: WeakArray new: 1. 115 | x at: 1 put: x. 116 | x:: roundTrip: x. 117 | assert: [(x at: 1) == x]. 118 | 119 | x:: WeakArray new: 1. 120 | x at: 1 put: 'Otherwise unreferenced'. 121 | x:: roundTrip: x. 122 | assert: [(x at: 1) == nil]. 123 | 124 | x:: Array new: 2. 125 | x at: 1 put: 'Also strongly referenced'. 126 | x at: 2 put: (WeakArray new: 1). 127 | (x at: 2) at: 1 put: (x at: 1). 128 | x:: roundTrip: x. 129 | assert: [(x at: 1) == ((x at: 2) at: 1)]. 130 | ) 131 | public testWideSymbols = ( 132 | | 133 | snowflake = (Character codePoint: 16r2744) asSymbol. 134 | snowflake2 = roundTrip: snowflake. 135 | | 136 | assert: [snowflake == snowflake2]. (* Identical *) 137 | ) 138 | ) : ( 139 | TEST_CONTEXT = () 140 | ) 141 | ) : ( 142 | ) 143 | -------------------------------------------------------------------------------- /VictoryFuelTestingConfiguration.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'VictoryFuel' 3 | class VictoryFuelTestingConfiguration packageTestsUsing: manifest = (| 4 | private VictoryFuel = manifest VictoryFuel. 5 | private VictoryFuelTesting = manifest VictoryFuelTesting. 6 | private icons = {manifest hsHistoryImage. manifest hsHomeImage}. 7 | private bootstrapRuntime = manifest BootstrapRuntimeForSqueak packageUsing: manifest. 8 | |) ( 9 | public testModulesUsingPlatform: p minitest: m = ( 10 | | 11 | vf = VictoryFuel usingPlatform: p vm: p squeak VMMirror new. 12 | | 13 | ^{VictoryFuelTesting 14 | usingPlatform: p 15 | victoryFuel: vf 16 | minitest: m 17 | icons: icons 18 | bootstrapRuntime: bootstrapRuntime} 19 | ) 20 | ) : ( 21 | ) 22 | -------------------------------------------------------------------------------- /Words.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Samples' 3 | class Words packageUsing: manifest = ( 4 | | 5 | private hopscotchRuntime = manifest HopscotchForHTML5Runtime packageUsing: manifest. 6 | private wordsByFrequency ::= manifest wordsByFrequency. 7 | | 8 | ) ( 9 | class WordsUI usingPlatform: p = (| 10 | Subject = p hopscotch core Subject. 11 | Presenter = p hopscotch core Presenter. 12 | Timer = p actors Timer. 13 | randomFunc 14 | |[| Math = p js global at: 'Math'. | 15 | randomFunc:: [Math random]] 16 | on: Error 17 | do: [ | random = p squeak Random new. | randomFunc:: [random next]]) ( 18 | class DictionaryPresenter onSubject: s = Presenter onSubject: s (| contentHolder refreshTimer |) ( 19 | definition = ( 20 | refreshTimer:: Timer every: 1000 do: [:timer | contentHolder refresh]. 21 | ^contentHolder:: holder: [label: subject nextWord] 22 | ) 23 | public noticeConcealment = ( 24 | refreshTimer isNil ifFalse: [refreshTimer cancel. refreshTimer:: nil]. 25 | ) 26 | public noticeExposure = ( 27 | refreshTimer isNil ifFalse: [refreshTimer cancel. refreshTimer:: nil]. 28 | refreshTimer:: Timer every: 1000 do: [:timer | refresh]. 29 | ) 30 | ) : ( 31 | ) 32 | public class DictionarySubject onModel: m = Subject onModel: m () ( 33 | createPresenter = ( 34 | ^DictionaryPresenter onSubject: self 35 | ) 36 | public nextWord = ( 37 | ^wordsByFrequency at: (randomFunc value * wordsByFrequency size) floor. 38 | ) 39 | public title = ( 40 | ^'Words' 41 | ) 42 | ) : ( 43 | ) 44 | ) : ( 45 | ) 46 | public main: platform args: args = ( 47 | | hopscotchPlatform | 48 | hopscotchPlatform:: hopscotchRuntime using: platform. 49 | wordsByFrequency:: wordsByFrequency splitBy: ' '. 50 | hopscotchPlatform hopscotch core HopscotchWindow openSubject: 51 | ((WordsUI usingPlatform: hopscotchPlatform) DictionarySubject onModel: wordsByFrequency). 52 | ) 53 | ) : ( 54 | ) 55 | -------------------------------------------------------------------------------- /WorkspaceHolder.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 2 | 'Root' 3 | class WorkspaceHolder usingPlatform: platform ide: i = ( 4 | | private retainedPlatform = platform. private ide = i. | 5 | ) ( 6 | public class Workspace = ( 7 | (* The superclass of workspaces. For the time being, we do not dynamically create distinct classes per workspace. Instead, 8 | we pass a name for each instance to the factory. *) 9 | | 10 | public workspaceText 11 | |) ( 12 | public workspaceName ^ = ( 13 | ^class name 14 | ) 15 | public actors = (^retainedPlatform actors) 16 | public aliens = (^retainedPlatform aliens) 17 | public class = ( 18 | ^super class 19 | ) 20 | public collections = (^retainedPlatform collections) 21 | protected doesNotUnderstand: message = ( 22 | ^Root 23 | at: message selector 24 | ifAbsent: [super doesNotUnderstand: message] 25 | ) 26 | public files = (^retainedPlatform files) 27 | public findInSource: stringOrRegex = ( 28 | stringOrRegex isKindOfString ifFalse: [unimplemented]. 29 | ^methods select: [:method | method getSource includesSubString: stringOrRegex]. 30 | ) 31 | public graphics = (^retainedPlatform graphics) 32 | public hopscotch = (^retainedPlatform hopscotch) 33 | public ide ^ = ( 34 | ^outer WorkspaceHolder ide 35 | ) 36 | public kernel = (^retainedPlatform kernel) 37 | public mirrors = (^retainedPlatform mirrors) 38 | platform ^ = ( 39 | ^retainedPlatform 40 | ) 41 | public printString ^ = ( 42 | ^workspaceName 43 | ) 44 | public streams = (^retainedPlatform streams) 45 | public text = ( 46 | ^retainedPlatform text 47 | ) 48 | ) : ( 49 | ) 50 | ) : ( 51 | ) 52 | -------------------------------------------------------------------------------- /accept16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/accept16px.png -------------------------------------------------------------------------------- /ampleforthDocument.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/ampleforthDocument.png -------------------------------------------------------------------------------- /cancel16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/cancel16px.png -------------------------------------------------------------------------------- /classPresenterImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/classPresenterImage.png -------------------------------------------------------------------------------- /classUnknownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/classUnknownImage.png -------------------------------------------------------------------------------- /clearImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/clearImage.png -------------------------------------------------------------------------------- /croquetpsoup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Primordial Soup 6 | 7 | 8 | 9 | 10 | 11 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /disclosureClosedImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/disclosureClosedImage.png -------------------------------------------------------------------------------- /disclosureOpenImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/disclosureOpenImage.png -------------------------------------------------------------------------------- /downloadImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/downloadImage.png -------------------------------------------------------------------------------- /electron-stuff/main.js: -------------------------------------------------------------------------------- 1 | // Modules to control application life and create native browser window 2 | const {app, BrowserWindow} = require('electron') 3 | const path = require('path') 4 | 5 | async function createWindow () { 6 | // Create the browser window. 7 | const mainWindow = new BrowserWindow({ 8 | width: 800, 9 | height: 600, 10 | webPreferences: {nodeIntegration: true} 11 | }) 12 | 13 | // and load the index.html of the app. 14 | await mainWindow.loadURL(`file:///${__dirname}/out/primordialsoup.html?snapshot=HopscotchWebIDE.vfuel`); 15 | 16 | // Open the DevTools. 17 | // mainWindow.webContents.openDevTools() 18 | } 19 | 20 | // This method will be called when Electron has finished 21 | // initialization and is ready to create browser windows. 22 | // Some APIs can only be used after this event occurs. 23 | app.whenReady().then(() => { 24 | createWindow() 25 | 26 | app.on('activate', function () { 27 | // On macOS it's common to re-create a window in the app when the 28 | // dock icon is clicked and there are no other windows open. 29 | if (BrowserWindow.getAllWindows().length === 0) createWindow() 30 | }) 31 | }) 32 | 33 | // Quit when all windows are closed, except on macOS. There, it's common 34 | // for applications and their menu bar to stay active until the user quits 35 | // explicitly with Cmd + Q. 36 | app.on('window-all-closed', function () { 37 | if (process.platform !== 'darwin') app.quit() 38 | }) 39 | 40 | // In this file you can include the rest of your app's specific main process 41 | // code. You can also put them in separate files and require them here. 42 | -------------------------------------------------------------------------------- /electron-stuff/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "HopscotchWebIDE", 3 | "version": "1.0.0", 4 | "description": "A single page web app for developing Newspeak applications", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron ." 8 | }, 9 | "author": "Emmanuel Goldstein", 10 | "license": "Apache 2.0", 11 | "devDependencies": { 12 | "electron": "^9.1.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /electron-stuff/preload.js: -------------------------------------------------------------------------------- 1 | // All of the Node.js APIs are available in the preload process. 2 | // It has the same sandbox as a Chrome extension. 3 | window.addEventListener('DOMContentLoaded', () => { 4 | const replaceText = (selector, text) => { 5 | const element = document.getElementById(selector) 6 | if (element) element.innerText = text 7 | } 8 | 9 | for (const type of ['chrome', 'node', 'electron']) { 10 | replaceText(`${type}-version`, process.versions[type]) 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /electron-stuff/renderer.js: -------------------------------------------------------------------------------- 1 | // This file is required by the index.html file and will 2 | // be executed in the renderer process for that window. 3 | // No Node.js APIs are available in this process because 4 | // `nodeIntegration` is turned off. Use `preload.js` to 5 | // selectively enable features needed in the rendering 6 | // process. 7 | -------------------------------------------------------------------------------- /findImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/findImage.png -------------------------------------------------------------------------------- /helpImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/helpImage.png -------------------------------------------------------------------------------- /hsAddImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsAddImage.png -------------------------------------------------------------------------------- /hsBackImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsBackImage.png -------------------------------------------------------------------------------- /hsCollapseImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsCollapseImage.png -------------------------------------------------------------------------------- /hsDropdownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsDropdownImage.png -------------------------------------------------------------------------------- /hsExpandImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsExpandImage.png -------------------------------------------------------------------------------- /hsForwardImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsForwardImage.png -------------------------------------------------------------------------------- /hsHistoryImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsHistoryImage.png -------------------------------------------------------------------------------- /hsHomeImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsHomeImage.png -------------------------------------------------------------------------------- /hsNewImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsNewImage.png -------------------------------------------------------------------------------- /hsRefreshImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/hsRefreshImage.png -------------------------------------------------------------------------------- /itemReferencesImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/itemReferencesImage.png -------------------------------------------------------------------------------- /languageNewspeak3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/languageNewspeak3.png -------------------------------------------------------------------------------- /peekingeye1610.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/peekingeye1610.png -------------------------------------------------------------------------------- /platforms/apple/.gitignore: -------------------------------------------------------------------------------- 1 | Pods 2 | 3 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | 2 | import Cocoa 3 | import SwiftUI 4 | 5 | protocol feedBack { 6 | func output() 7 | } 8 | 9 | @NSApplicationMain 10 | class AppDelegate: NSObject, NSApplicationDelegate { 11 | 12 | var window: NSWindow! 13 | 14 | private var contentView : ContentView! 15 | 16 | private let runtimeKey = "runtime" 17 | private let runtimeName = "newspeak" 18 | 19 | func applicationDidFinishLaunching(_ aNotification: Notification) { 20 | 21 | self.contentView = ContentView() 22 | 23 | window = NSWindow( 24 | contentRect: NSRect(x: 0, y: 0, width: 480, height: 300), 25 | styleMask: [.titled, 26 | .closable, 27 | .miniaturizable, 28 | .resizable, 29 | .fullSizeContentView], 30 | backing: .buffered, 31 | defer: false) 32 | window.isReleasedWhenClosed = false 33 | window.tabbingMode = .disallowed 34 | window.center() 35 | window.setFrameAutosaveName("Main Window") 36 | window.contentView = NSHostingView(rootView: contentView) 37 | window.makeKeyAndOrderFront(nil) 38 | 39 | self.loadRuntime() 40 | } 41 | 42 | private func runtimeBundlePath() -> String { 43 | if let path = Bundle.main.resourcePath { 44 | return path + "/" + self.runtimeName 45 | } else { 46 | let alert: NSAlert = NSAlert() 47 | alert.messageText = "Unable to locate Newspeak environment." 48 | alert.beginSheetModal(for: self.window) { _ in 49 | } 50 | } 51 | return "" 52 | } 53 | 54 | private func runtimePath() -> String { 55 | return self.runtimeBundlePath() 56 | } 57 | 58 | private func loadRuntime() { 59 | 60 | let path = self.runtimePath() 61 | if !path.isEmpty { 62 | let url = URL(fileURLWithPath: path) 63 | self.contentView.load(url) 64 | } else { 65 | self.alertRuntimeNotCreated() 66 | } 67 | } 68 | 69 | private func alertRuntimeNotFound() { 70 | let alert: NSAlert = NSAlert() 71 | alert.messageText = "Unable to locate Newspeak environment " 72 | alert.beginSheetModal(for: self.window) { _ in 73 | } 74 | } 75 | 76 | private func alertRuntimeNotCreated() { 77 | let alert: NSAlert = NSAlert() 78 | alert.messageText = "Unable to create Newspeak environment " 79 | alert.beginSheetModal(for: self.window) { _ in 80 | } 81 | } 82 | } 83 | 84 | struct AppDelegate_Previews: PreviewProvider { 85 | static var previews: some View { 86 | /*@START_MENU_TOKEN@*/Text("Hello, World!")/*@END_MENU_TOKEN@*/ 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Icon-16.png", 5 | "idiom" : "mac", 6 | "scale" : "1x", 7 | "size" : "16x16" 8 | }, 9 | { 10 | "filename" : "Icon-32.png", 11 | "idiom" : "mac", 12 | "scale" : "2x", 13 | "size" : "16x16" 14 | }, 15 | { 16 | "filename" : "Icon-33.png", 17 | "idiom" : "mac", 18 | "scale" : "1x", 19 | "size" : "32x32" 20 | }, 21 | { 22 | "filename" : "Icon-64.png", 23 | "idiom" : "mac", 24 | "scale" : "2x", 25 | "size" : "32x32" 26 | }, 27 | { 28 | "filename" : "Icon-128.png", 29 | "idiom" : "mac", 30 | "scale" : "1x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "filename" : "Icon-256.png", 35 | "idiom" : "mac", 36 | "scale" : "2x", 37 | "size" : "128x128" 38 | }, 39 | { 40 | "filename" : "Icon-257.png", 41 | "idiom" : "mac", 42 | "scale" : "1x", 43 | "size" : "256x256" 44 | }, 45 | { 46 | "filename" : "Icon-512.png", 47 | "idiom" : "mac", 48 | "scale" : "2x", 49 | "size" : "256x256" 50 | }, 51 | { 52 | "filename" : "Icon-513.png", 53 | "idiom" : "mac", 54 | "scale" : "1x", 55 | "size" : "512x512" 56 | }, 57 | { 58 | "filename" : "Icon-1024.png", 59 | "idiom" : "mac", 60 | "scale" : "2x", 61 | "size" : "512x512" 62 | } 63 | ], 64 | "info" : { 65 | "author" : "xcode", 66 | "version" : 1 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-1024.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-128.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-16.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-256.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-257.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-257.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-32.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-33.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-512.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-513.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-513.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/Hopscotch/Assets.xcassets/AppIcon.appiconset/Icon-64.png -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/ContentView.swift: -------------------------------------------------------------------------------- 1 | 2 | import SwiftUI 3 | 4 | struct ContentView: View { 5 | 6 | @ObservedObject var store = WebViewStore() 7 | 8 | var body: some View { 9 | WebView(webView: store.webView).onAppear { 10 | } 11 | } 12 | 13 | func load(_ url: URL) { 14 | var url = url 15 | url.appendPathComponent("primordialsoup.html") 16 | url.appendQueryItem(name: "snapshot", value: "HopscotchWebIDE.vfuel") 17 | let request = URLRequest(url: url) 18 | self.store.webView.load(request) 19 | } 20 | } 21 | 22 | struct ContentView_Previews: PreviewProvider { 23 | 24 | static var store = WebViewStore() 25 | 26 | static var previews: some View { 27 | WebView(webView: store.webView) 28 | } 29 | } 30 | 31 | extension URL { 32 | 33 | mutating func appendQueryItem(name: String, value: String?) { 34 | 35 | guard var urlComponents = URLComponents(string: absoluteString) else { return } 36 | 37 | var queryItems: [URLQueryItem] = urlComponents.queryItems ?? [] 38 | let queryItem = URLQueryItem(name: name, value: value) 39 | queryItems.append(queryItem) 40 | urlComponents.queryItems = queryItems 41 | self = urlComponents.url! 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Hopscotch.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.assets.movies.read-write 8 | 9 | com.apple.security.assets.music.read-write 10 | 11 | com.apple.security.assets.pictures.read-write 12 | 13 | com.apple.security.files.downloads.read-write 14 | 15 | com.apple.security.files.user-selected.read-write 16 | 17 | com.apple.security.network.client 18 | 19 | com.apple.security.network.server 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | 32 | NSMainStoryboardFile 33 | Main 34 | NSPrincipalClass 35 | NSApplication 36 | 37 | 38 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Newspeak-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Web/NSViewContainerView.swift: -------------------------------------------------------------------------------- 1 | 2 | #if os(macOS) 3 | import AppKit 4 | 5 | public class NSViewContainerView: NSView { 6 | var contentView: ContentView? { 7 | willSet { 8 | contentView?.removeFromSuperview() 9 | } 10 | 11 | didSet { 12 | if let contentView = contentView { 13 | addSubview(contentView) 14 | contentView.translatesAutoresizingMaskIntoConstraints = false 15 | 16 | NSLayoutConstraint.activate([ 17 | contentView.leadingAnchor.constraint(equalTo: leadingAnchor), 18 | contentView.trailingAnchor.constraint(equalTo: trailingAnchor), 19 | contentView.topAnchor.constraint(equalTo: topAnchor), 20 | contentView.bottomAnchor.constraint(equalTo: bottomAnchor) 21 | ]) 22 | } 23 | } 24 | } 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Web/UIViewContainerView.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | #if !os(macOS) 4 | import UIKit 5 | 6 | /// A UIView which simply adds some view to its view hierarchy 7 | public class UIViewContainerView: UIView { 8 | var contentView: ContentView? { 9 | willSet { 10 | contentView?.removeFromSuperview() 11 | } 12 | didSet { 13 | if let contentView = contentView { 14 | addSubview(contentView) 15 | contentView.translatesAutoresizingMaskIntoConstraints = false 16 | NSLayoutConstraint.activate([ 17 | contentView.leadingAnchor.constraint(equalTo: leadingAnchor), 18 | contentView.trailingAnchor.constraint(equalTo: trailingAnchor), 19 | contentView.topAnchor.constraint(equalTo: topAnchor), 20 | contentView.bottomAnchor.constraint(equalTo: bottomAnchor) 21 | ]) 22 | } 23 | } 24 | } 25 | } 26 | #endif 27 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Web/WebViewNavigationHelper.swift: -------------------------------------------------------------------------------- 1 | 2 | import Foundation 3 | import WebKit 4 | 5 | struct MimeType { 6 | var type:String 7 | var fileExtension:String 8 | } 9 | 10 | protocol WebViewNavigationHelperDelegate { 11 | func fileDownloadedAtURL(url:URL) 12 | } 13 | 14 | class WebViewNavigationHelper : NSObject { 15 | 16 | var webView : WKWebView 17 | var mimeTypes : [MimeType] 18 | var delegate :WebViewNavigationHelperDelegate 19 | 20 | init(webView:WKWebView, mimeTypes:[MimeType], delegate:WebViewNavigationHelperDelegate) { 21 | self.webView = webView 22 | self.mimeTypes = mimeTypes 23 | self.delegate = delegate 24 | super.init() 25 | webView.navigationDelegate = self 26 | } 27 | } 28 | 29 | extension WebViewNavigationHelper: WKNavigationDelegate { 30 | 31 | func webView(_ webView: WKWebView, 32 | decidePolicyFor navigationAction: WKNavigationAction, 33 | decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { 34 | if let navigationURL = navigationAction.request.url { 35 | if (navigationURL.absoluteString.contains("blob")) { 36 | downloadBlob(navigationURL: navigationURL) 37 | decisionHandler(.cancel) 38 | return 39 | } 40 | } 41 | decisionHandler(.allow) 42 | } 43 | 44 | func downloadBlob(navigationURL: URL) { 45 | 46 | let script = """ 47 | var xhr = new XMLHttpRequest(); 48 | xhr.open('GET', '\(navigationURL.absoluteString)', true); 49 | 50 | xhr.onload = function() { 51 | if (this.status == 200) { 52 | var blob = this.response; 53 | window.webkit.messageHandlers.readBlob.postMessage(blob); 54 | var reader = new FileReader(); 55 | reader.readAsBinaryString(blob); 56 | reader.onloadend = function() { 57 | window.webkit.messageHandlers.readBlob.postMessage(reader.result); 58 | } 59 | } 60 | }; 61 | xhr.send(); 62 | """ 63 | 64 | self.webView.evaluateJavaScript(script) { (results, error) in 65 | 66 | if let results = results { 67 | print(results) 68 | } 69 | 70 | if let error = error { 71 | print(error) 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/Web/WebViewStore.swift: -------------------------------------------------------------------------------- 1 | import WebKit 2 | import Combine 3 | 4 | public class WebViewStore: ObservableObject { 5 | 6 | private var observers = Set() 7 | 8 | @Published public var webView: WKWebView { 9 | didSet { 10 | setupObservers() 11 | } 12 | } 13 | 14 | public init() { 15 | 16 | self.webView = WKWebView(frame: .zero) 17 | webView 18 | .configuration 19 | .preferences 20 | .setValue(true, 21 | forKey: "allowFileAccessFromFileURLs") 22 | 23 | #if DEBUG 24 | self.webView 25 | .configuration 26 | .preferences 27 | .setValue(true, 28 | forKey: "developerExtrasEnabled") 29 | #endif 30 | 31 | setupObservers() 32 | } 33 | 34 | private func setupObservers() { 35 | 36 | func subscriber(for keyPath: KeyPath) -> NSKeyValueObservation { 37 | return webView.observe(keyPath, options: [.prior]) { _, change in 38 | if change.isPrior { 39 | self.objectWillChange.send() 40 | } 41 | } 42 | } 43 | 44 | // Observers for all KVO compliant properties 45 | observers = [ 46 | subscriber(for: \.title), 47 | subscriber(for: \.url), 48 | subscriber(for: \.isLoading), 49 | subscriber(for: \.estimatedProgress), 50 | subscriber(for: \.hasOnlySecureContent), 51 | subscriber(for: \.serverTrust), 52 | subscriber(for: \.canGoBack), 53 | subscriber(for: \.canGoForward) 54 | ] 55 | } 56 | 57 | deinit { 58 | observers.forEach { 59 | // Not even sure if this is required? 60 | // Probably wont be needed in future betas? 61 | $0.invalidate() 62 | } 63 | } 64 | } 65 | 66 | extension WebViewStore { 67 | 68 | func update(_ HTML: String, baseURL: URL) { 69 | webView.evaluateJavaScript("window.pageYOffset") { [weak self] object, error in 70 | self?.webView.loadHTMLString(HTML, baseURL: baseURL) 71 | 72 | if let offset = object as? Int { 73 | self?.scrollTo(offset) 74 | } 75 | } 76 | } 77 | 78 | private func scrollTo(_ YOffset: Int) { 79 | let script = "window.scrollTo(0, \(YOffset));" 80 | let scrollScript = WKUserScript(source: script, 81 | injectionTime: .atDocumentEnd, 82 | forMainFrameOnly: true) 83 | self.webView.configuration.userContentController.addUserScript(scrollScript) 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/WebViewController.swift: -------------------------------------------------------------------------------- 1 | 2 | import Combine 3 | import SwiftUI 4 | import WebKit 5 | 6 | public class WebViewStore: ObservableObject { 7 | @Published public var webView: WKWebView { 8 | didSet { 9 | setupObservers() 10 | } 11 | } 12 | 13 | public init(webView: WKWebView = WKWebView()) { 14 | self.webView = webView 15 | setupObservers() 16 | } 17 | 18 | private func setupObservers() { 19 | func subscriber(for keyPath: KeyPath) -> NSKeyValueObservation { 20 | return webView.observe(keyPath, options: [.prior]) { _, change in 21 | if change.isPrior { 22 | self.objectWillChange.send() 23 | } 24 | } 25 | } 26 | // Setup observers for all KVO compliant properties 27 | observers = [ 28 | subscriber(for: \.title), 29 | subscriber(for: \.url), 30 | subscriber(for: \.isLoading), 31 | subscriber(for: \.estimatedProgress), 32 | subscriber(for: \.hasOnlySecureContent), 33 | subscriber(for: \.serverTrust), 34 | subscriber(for: \.canGoBack), 35 | subscriber(for: \.canGoForward) 36 | ] 37 | } 38 | 39 | private var observers: [NSKeyValueObservation] = [] 40 | 41 | deinit { 42 | observers.forEach { 43 | // Not even sure if this is required? 44 | // Probably wont be needed in future betas? 45 | $0.invalidate() 46 | } 47 | } 48 | } 49 | 50 | /// A container for using a WKWebView in SwiftUI 51 | public struct WebView: View, UIViewRepresentable { 52 | /// The WKWebView to display 53 | public let webView: WKWebView 54 | 55 | public typealias UIViewType = UIViewContainerView 56 | 57 | public init(webView: WKWebView) { 58 | self.webView = webView 59 | } 60 | 61 | public func makeUIView(context: UIViewRepresentableContext) -> WebView.UIViewType { 62 | return UIViewContainerView() 63 | } 64 | 65 | public func updateUIView(_ uiView: WebView.UIViewType, context: UIViewRepresentableContext) { 66 | // If its the same content view we don't need to update. 67 | if uiView.contentView !== webView { 68 | uiView.contentView = webView 69 | } 70 | } 71 | } 72 | 73 | /// A UIView which simply adds some view to its view hierarchy 74 | public class UIViewContainerView: UIView { 75 | var contentView: ContentView? { 76 | willSet { 77 | contentView?.removeFromSuperview() 78 | } 79 | didSet { 80 | if let contentView = contentView { 81 | addSubview(contentView) 82 | contentView.translatesAutoresizingMaskIntoConstraints = false 83 | NSLayoutConstraint.activate([ 84 | contentView.leadingAnchor.constraint(equalTo: leadingAnchor), 85 | contentView.trailingAnchor.constraint(equalTo: trailingAnchor), 86 | contentView.topAnchor.constraint(equalTo: topAnchor), 87 | contentView.bottomAnchor.constraint(equalTo: bottomAnchor) 88 | ]) 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /platforms/apple/Hopscotch/newspeak/primordialsoup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Primordial Soup 6 | 7 | 8 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /platforms/apple/Newspeak.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /platforms/apple/Newspeak.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /platforms/apple/Newspeak.xcodeproj/xcshareddata/xcschemes/Hopscotch.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /platforms/apple/Newspeak.xcodeproj/xcshareddata/xcschemes/Newspeak.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 44 | 50 | 51 | 57 | 58 | 59 | 60 | 62 | 63 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /platforms/apple/Newspeak.xcodeproj/xcuserdata/diskzero.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /platforms/apple/Newspeak.xcodeproj/xcuserdata/diskzero.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Hopscotch.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 3 11 | 12 | Newspeak.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 4 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /platforms/apple/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/apple/README.md -------------------------------------------------------------------------------- /platforms/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Making Newspeak build in a Docker container (author: Mircea Trofimciuc) 2 | FROM emscripten/emsdk 3 | 4 | # Clonning the required repos 5 | RUN git clone https://github.com/newspeaklanguage/newspeak.git 6 | RUN git clone https://github.com/newspeaklanguage/primordialsoup -b extraRevs 7 | RUN git clone https://github.com/codemirror/CodeMirror.git -b 5.62.0 8 | 9 | # Installing the primordialsoup dependencies 10 | RUN sudo apt-get update 11 | RUN sudo apt-get -y install g++-multilib scons 12 | 13 | # Installing python 14 | RUN sudo apt install python3.8 15 | 16 | # Building primordialsoup 17 | RUN cd primordialsoup && ./build 18 | 19 | # Build CodeMirror for JS 20 | RUN cd CodeMirror && npm i && npm run build 21 | 22 | # Copying CodeMirror to the right directory 23 | RUN cp -R CodeMirror newspeak/CodeMirror 24 | 25 | # Setting emsdk vars 26 | RUN . /emsdk/emsdk_env.sh 27 | 28 | # remove the emsdk settings in build 29 | RUN sed '2,6d' newspeak/build.sh > newspeak/new_build.sh 30 | 31 | # Building Newspeak 32 | RUN cd newspeak && chmod 777 new_build.sh && bash new_build.sh 33 | 34 | # Serve Newspeak on 8080 35 | # RUN python3 /src/newspeak/server3.py 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /platforms/webIDE/README.md: -------------------------------------------------------------------------------- 1 | # Newspeak Web IDE (as PWA) 2 | 3 | This version of the Newspeak Web IDE uses PWA capabilities like ServiceWorker (`sw.js`) and Caching (`newspeak-ide-cache`). All of the `assets` from the `public` folder are cached. 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /platforms/webIDE/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Newspeak Web IDE 6 | 7 | 8 | 9 | 10 | 14 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /platforms/webIDE/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "NewspeakIDE", 3 | "scope": "/", 4 | "name": "Newspeak IDE", 5 | "display": "standalone", 6 | "start_url": "/webIDE/", 7 | "short_name": "newspeak-ide", 8 | "theme_color": "blue", 9 | "description": "This is a PWA version of the Newspeak IDE", 10 | "orientation": "any", 11 | "background_color": "#E1477E", 12 | "related_applications": [], 13 | "prefer_related_applications": false, 14 | "icons": [ 15 | { 16 | "src": "/webIDE/public/assets/icons/icon-512.png", 17 | "sizes": "512x512", 18 | "type": "image/png" 19 | }, 20 | { 21 | "src": "/webIDE/public/assets/icons/icon-192.png", 22 | "sizes": "192x192", 23 | "type": "image/png" 24 | }, 25 | { 26 | "src": "/webIDE/public/assets/icons/icon-64.png", 27 | "sizes": "64x64", 28 | "type": "image/png" 29 | }, 30 | { 31 | "src": "/webIDE/public/assets/icons/icon-32.png", 32 | "sizes": "32x32", 33 | "type": "image/png" 34 | } 35 | ], 36 | "screenshots": [ 37 | { 38 | "src": "/webIDE/public/assets/screenshots/screen.png", 39 | "sizes": "2836x1660", 40 | "type": "image/png" 41 | } 42 | ], 43 | "features": [ 44 | "Cross Platform", 45 | "fast", 46 | "simple" 47 | ], 48 | "categories": [ 49 | "utility" 50 | ], 51 | "shortcuts": [ 52 | { 53 | "name": "Open About", 54 | "short_name": "About", 55 | "description": "Open the about page", 56 | "url": "/about", 57 | "icons": [{ "src": "/webIDE/public/assets/icons/icon-192.png", "sizes": "192x192" }] 58 | } 59 | ] 60 | } 61 | -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-120.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-128.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-144.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-152.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-16.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-180.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-192.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-24.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-32.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-384.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-512.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-64.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-72.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/icons/icon-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/icons/icon-96.png -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/lib/codemirror_autorefresh.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function(CodeMirror) { 12 | "use strict" 13 | 14 | CodeMirror.defineOption("autoRefresh", false, function(cm, val) { 15 | if (cm.state.autoRefresh) { 16 | stopListening(cm, cm.state.autoRefresh) 17 | cm.state.autoRefresh = null 18 | } 19 | if (val && cm.display.wrapper.offsetHeight == 0) 20 | startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250}) 21 | }) 22 | 23 | function startListening(cm, state) { 24 | function check() { 25 | if (cm.display.wrapper.offsetHeight) { 26 | stopListening(cm, state) 27 | if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight) 28 | cm.refresh() 29 | } else { 30 | state.timeout = setTimeout(check, state.delay) 31 | } 32 | } 33 | state.timeout = setTimeout(check, state.delay) 34 | state.hurry = function() { 35 | clearTimeout(state.timeout) 36 | state.timeout = setTimeout(check, 50) 37 | } 38 | CodeMirror.on(window, "mouseup", state.hurry) 39 | CodeMirror.on(window, "keyup", state.hurry) 40 | } 41 | 42 | function stopListening(_cm, state) { 43 | clearTimeout(state.timeout) 44 | CodeMirror.off(window, "mouseup", state.hurry) 45 | CodeMirror.off(window, "keyup", state.hurry) 46 | } 47 | }); 48 | -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/lib/primordialsoup-setup.js: -------------------------------------------------------------------------------- 1 | const vfuelFile = '/webIDE/public/assets/lib/HopscotchWebIDE.vfuel'; 2 | 3 | function scheduleTurn(timeout) { 4 | if (timeout >= 0) { 5 | setTimeout(function () { 6 | var timeout = Module._handle_message(); 7 | scheduleTurn(timeout); 8 | }, timeout); 9 | } 10 | } 11 | 12 | var Module = { 13 | noInitialRun: true, 14 | noExitRuntime: true, 15 | onRuntimeInitialized: function () { 16 | var url = new URLSearchParams(window.location.search); 17 | var request = new XMLHttpRequest(); 18 | request.open('GET', vfuelFile, true); 19 | request.responseType = 'arraybuffer'; 20 | request.onload = function (event) { 21 | var jsBuffer = new Uint8Array(request.response); 22 | var cBuffer = _malloc(jsBuffer.length); 23 | writeArrayToMemory(jsBuffer, cBuffer); 24 | Module._load_snapshot(cBuffer, jsBuffer.length); 25 | _free(cBuffer); 26 | scheduleTurn(0); 27 | }; 28 | request.send(); 29 | }, 30 | print: function (text) { 31 | if (arguments.length > 1) { 32 | text = Array.prototype.slice.call(arguments).join(' '); 33 | } 34 | console.log(text); 35 | }, 36 | printErr: function (text) { 37 | if (arguments.length > 1) { 38 | text = Array.prototype.slice.call(arguments).join(' '); 39 | } 40 | console.error(text); 41 | }, 42 | setStatus: function (text) { 43 | console.log(text); 44 | }, 45 | }; 46 | -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/lib/primordialsoup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Primordial Soup 6 | 7 | 8 | 17 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /platforms/webIDE/public/assets/screenshots/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/platforms/webIDE/public/assets/screenshots/screen.png -------------------------------------------------------------------------------- /platforms/webIDE/src/app.ts: -------------------------------------------------------------------------------- 1 | export const App = ""; -------------------------------------------------------------------------------- /platforms/webIDE/src/index.js: -------------------------------------------------------------------------------- 1 | const cacheName = 'newspeak-ide-cache' 2 | // Installing Service Worker 3 | self.addEventListener('install', (e) => { 4 | console.log('[Service Worker] Install'); 5 | // e.waitUntil((async () => { 6 | // const cache = await caches.open(cacheName); 7 | // console.log('[Service Worker] Caching all: app shell and content'); 8 | // await cache.addAll(contentToCache); 9 | // })()); 10 | }); 11 | 12 | // Fetching content using Service Worker 13 | self.addEventListener('fetch', (e) => { 14 | e.respondWith((async () => { 15 | const r = await caches.match(e.request); 16 | console.log(`[Service Worker] Fetching resource: ${e.request.url}`); 17 | if (r) return r; 18 | const response = await fetch(e.request); 19 | const cache = await caches.open(cacheName); 20 | console.log(`[Service Worker] Caching new resource: ${e.request.url}`); 21 | cache.put(e.request, response.clone()); 22 | return response; 23 | })()); 24 | }); -------------------------------------------------------------------------------- /platforms/webIDE/swa-cli.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://aka.ms/azure/static-web-apps-cli/schema", 3 | "configurations": { 4 | "newspeak-ide": { 5 | "appLocation": ".", 6 | "outputLocation": "dist", 7 | "appBuildCommand": "npm run build --if-present", 8 | "run": "npm start", 9 | "appDevserverUrl": "http://localhost:3000" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /platforms/webIDE/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "esnext", 4 | "target": "esnext", 5 | "lib": ["es2017", "esnext", "dom", "dom.iterable"], 6 | "declaration": true, 7 | "emitDeclarationOnly": true, 8 | "outDir": "./types", 9 | "strict": true, 10 | "noUnusedLocals": true, 11 | "noUnusedParameters": true, 12 | "noImplicitReturns": true, 13 | "noFallthroughCasesInSwitch": true, 14 | "moduleResolution": "node", 15 | "allowSyntheticDefaultImports": true, 16 | "experimentalDecorators": true, 17 | "forceConsistentCasingInFileNames": true, 18 | "useDefineForClassFields": false, 19 | "isolatedModules": true, 20 | "types": [ 21 | "vite-plugin-pwa/client" 22 | ] 23 | }, 24 | "include": ["src/**/*.ts", "src/index.js"], 25 | "exclude": ["node_modules"] 26 | } 27 | -------------------------------------------------------------------------------- /platforms/webIDE/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import { VitePWA } from 'vite-plugin-pwa'; 3 | 4 | // https://vitejs.dev/config/ 5 | export default defineConfig({ 6 | base: "/", 7 | build: { 8 | sourcemap: true, 9 | assetsDir: "code", 10 | }, 11 | plugins: [ 12 | VitePWA({ 13 | registerType: "autoUpdate", 14 | injectRegister: false, 15 | manifest: false, 16 | workbox: { 17 | globDirectory: 'dist', 18 | globPatterns: [ 19 | '**/*.{html,js,css,png,webp,jpg}' 20 | ], 21 | runtimeCaching: [ 22 | { 23 | urlPattern: /^https:\/\/unpkg\.com\/.*/i, 24 | handler: 'CacheFirst', 25 | options: { 26 | cacheName: 'newspeak-ide-cache', 27 | expiration: { 28 | maxEntries: 10, 29 | maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days 30 | }, 31 | cacheableResponse: { 32 | statuses: [0, 200] 33 | } 34 | } 35 | } 36 | ] 37 | }, 38 | devOptions: { 39 | enabled: true 40 | } 41 | }) 42 | ] 43 | }) 44 | -------------------------------------------------------------------------------- /primordialsoup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Primordial Soup 6 | 7 | 8 | 17 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /privateImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/privateImage.png -------------------------------------------------------------------------------- /protectedImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/protectedImage.png -------------------------------------------------------------------------------- /publicImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/publicImage.png -------------------------------------------------------------------------------- /pwa-deployed-versions/newspeaklanguage.org.version: -------------------------------------------------------------------------------- 1 | 58 2 | -------------------------------------------------------------------------------- /saveImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/saveImage.png -------------------------------------------------------------------------------- /sectionImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/sectionImage.png -------------------------------------------------------------------------------- /squeak/HopscotchIDEApp.ns: -------------------------------------------------------------------------------- 1 | Newspeak3 'HopscotchIDE' class HopscotchIDEApp packageUsing: manifest = ( (* Application object for the IDE. A Newspeak application is an object that responds to the message main:args:. The Newspeak runtime invokes main:args: with a platform object (see RuntimeForSqueak/V8`Platform) and a collection of any runtime arguments. An application typically responds to main:args: by instantiating and wiring together modules definitions it has stored in its slots. By convention, if a top-level class implements packageUsing:, the IDE will provide links to automatically send packageUsing: with the IDE namespace and serialize the returned object with VictoryFuel or package it into a Web app. *) | Tools = manifest IDETools. Browsing = manifest BrowsingForSqueak. SmalltalkBrowsing = manifest SmalltalkBrowsing. NewspeakBrowsing = manifest NewspeakBrowsing. MiscBrowsing = manifest MiscBrowsing. Namespacing = manifest NamespacingForSqueak. Inspecting = manifest Inspecting. Debugging = manifest DebuggingForSqueak. ProcessFinalizer = manifest ProcessFinalizer. WorkspaceManager = manifest WorkspaceManagerForSqueak. LanguageUiDescriptionRegistry = manifest LanguageUiDescriptionRegistry. Minitest = manifest MinitestForSqueak. MinitestUI = manifest MinitestUIForSqueak. NewspeakColorization = manifest NewspeakColorizationForSqueak. vcsLib = manifest VCSLib packageUsing: manifest. jsPackagingLib = manifest NS2V8ApplicationPackaging packageUsing: manifest. |) ( class HopscotchIDE using: p = ( (* I am to the IDE as Platform is to the runtime. I wire together and store the IDE modules. *) || (* Siml slots *) public tools = Tools usingPlatform: p ide: self. public browsing = Browsing usingPlatform: p ide: self. public browsingST = SmalltalkBrowsing usingPlatform: p ide: self. public browsingNS = NewspeakBrowsing usingPlatform: p ide: self. public browsingMisc = MiscBrowsing usingPlatform: p ide: self. public namespacing = Namespacing usingPlatform: p. public inspection = Inspecting usingPlatform: p ide: self. public debugging = Debugging usingPlatform: p ide: self. public finalizer = ProcessFinalizer usingPlatform: p ide: self debuggerClass: debugging Debugger. public theWorkspaceManager = WorkspaceManager usingPlatform: p ide: self. public minitest = Minitest usingPlatform: p. public minitestUI = MinitestUI usingPlatform: p minitest: minitest ide: self. public languageUiDescriptionRegistry = LanguageUiDescriptionRegistry usingPlatform: p ide: self. public systemScope = namespacing systemScope. public newspeakColorization = NewspeakColorization usingPlatform: p. public vcs (* memoryhole *) = vcsLib usingPlatform: p ide: self. public jsPackaging = jsPackagingLib. public webPackager public defaultPopularityRecord = tools PopularityRecord new. public settings = IDESettings new. ||webPackager: nil) ( class IDESettings = (| public useExemplarPresenters ::= false. |) ( ) : ( ) public IDEWindow = ( ^tools IDEWindow ) ) : ( ) public main: p args: v = ( | ide = HopscotchIDE using: p. | (*` ide tools IDEWindow open.*) ^ide ) ) : ( ) -------------------------------------------------------------------------------- /squeak/accept16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/accept16px.png -------------------------------------------------------------------------------- /squeak/accept16pxDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/accept16pxDown.png -------------------------------------------------------------------------------- /squeak/accept16pxOver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/accept16pxOver.png -------------------------------------------------------------------------------- /squeak/arrowGreenLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/arrowGreenLeft.png -------------------------------------------------------------------------------- /squeak/arrowGreenRight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/arrowGreenRight.png -------------------------------------------------------------------------------- /squeak/arrowOrangeLeft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/arrowOrangeLeft.png -------------------------------------------------------------------------------- /squeak/cancel16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/cancel16px.png -------------------------------------------------------------------------------- /squeak/cancel16pxDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/cancel16pxDown.png -------------------------------------------------------------------------------- /squeak/cancel16pxOver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/cancel16pxOver.png -------------------------------------------------------------------------------- /squeak/classPresenterImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/classPresenterImage.png -------------------------------------------------------------------------------- /squeak/classUnknownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/classUnknownImage.png -------------------------------------------------------------------------------- /squeak/conflictRed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/conflictRed.png -------------------------------------------------------------------------------- /squeak/disclosureClosedImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/disclosureClosedImage.png -------------------------------------------------------------------------------- /squeak/disclosureMinusImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/disclosureMinusImage.png -------------------------------------------------------------------------------- /squeak/disclosureOpenImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/disclosureOpenImage.png -------------------------------------------------------------------------------- /squeak/disclosurePlusImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/disclosurePlusImage.png -------------------------------------------------------------------------------- /squeak/disclosureTransitionImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/disclosureTransitionImage.png -------------------------------------------------------------------------------- /squeak/editImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/editImage.png -------------------------------------------------------------------------------- /squeak/findSquareLeftDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/findSquareLeftDownImage.png -------------------------------------------------------------------------------- /squeak/findSquareLeftImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/findSquareLeftImage.png -------------------------------------------------------------------------------- /squeak/findSquareLeftOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/findSquareLeftOutImage.png -------------------------------------------------------------------------------- /squeak/findSquareLeftOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/findSquareLeftOverImage.png -------------------------------------------------------------------------------- /squeak/hsAddDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsAddDownImage.png -------------------------------------------------------------------------------- /squeak/hsAddImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsAddImage.png -------------------------------------------------------------------------------- /squeak/hsAddOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsAddOutImage.png -------------------------------------------------------------------------------- /squeak/hsAddOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsAddOverImage.png -------------------------------------------------------------------------------- /squeak/hsBackDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsBackDownImage.png -------------------------------------------------------------------------------- /squeak/hsBackOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsBackOutImage.png -------------------------------------------------------------------------------- /squeak/hsBackOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsBackOverImage.png -------------------------------------------------------------------------------- /squeak/hsCollapseDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsCollapseDownImage.png -------------------------------------------------------------------------------- /squeak/hsCollapseImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsCollapseImage.png -------------------------------------------------------------------------------- /squeak/hsCollapseOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsCollapseOutImage.png -------------------------------------------------------------------------------- /squeak/hsCollapseOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsCollapseOverImage.png -------------------------------------------------------------------------------- /squeak/hsDropdownDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsDropdownDownImage.png -------------------------------------------------------------------------------- /squeak/hsDropdownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsDropdownImage.png -------------------------------------------------------------------------------- /squeak/hsDropdownOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsDropdownOutImage.png -------------------------------------------------------------------------------- /squeak/hsDropdownOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsDropdownOverImage.png -------------------------------------------------------------------------------- /squeak/hsExpandDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsExpandDownImage.png -------------------------------------------------------------------------------- /squeak/hsExpandImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsExpandImage.png -------------------------------------------------------------------------------- /squeak/hsExpandOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsExpandOutImage.png -------------------------------------------------------------------------------- /squeak/hsExpandOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsExpandOverImage.png -------------------------------------------------------------------------------- /squeak/hsFindDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsFindDownImage.png -------------------------------------------------------------------------------- /squeak/hsFindImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsFindImage.png -------------------------------------------------------------------------------- /squeak/hsFindOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsFindOutImage.png -------------------------------------------------------------------------------- /squeak/hsFindOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsFindOverImage.png -------------------------------------------------------------------------------- /squeak/hsForwardDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsForwardDownImage.png -------------------------------------------------------------------------------- /squeak/hsForwardOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsForwardOutImage.png -------------------------------------------------------------------------------- /squeak/hsForwardOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsForwardOverImage.png -------------------------------------------------------------------------------- /squeak/hsHistoryDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHistoryDownImage.png -------------------------------------------------------------------------------- /squeak/hsHistoryImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHistoryImage.png -------------------------------------------------------------------------------- /squeak/hsHistoryOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHistoryOutImage.png -------------------------------------------------------------------------------- /squeak/hsHistoryOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHistoryOverImage.png -------------------------------------------------------------------------------- /squeak/hsHomeDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHomeDownImage.png -------------------------------------------------------------------------------- /squeak/hsHomeImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHomeImage.png -------------------------------------------------------------------------------- /squeak/hsHomeOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHomeOutImage.png -------------------------------------------------------------------------------- /squeak/hsHomeOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsHomeOverImage.png -------------------------------------------------------------------------------- /squeak/hsNewDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsNewDownImage.png -------------------------------------------------------------------------------- /squeak/hsNewOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsNewOutImage.png -------------------------------------------------------------------------------- /squeak/hsNewOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsNewOverImage.png -------------------------------------------------------------------------------- /squeak/hsRefreshDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsRefreshDownImage.png -------------------------------------------------------------------------------- /squeak/hsRefreshImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsRefreshImage.png -------------------------------------------------------------------------------- /squeak/hsRefreshOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsRefreshOutImage.png -------------------------------------------------------------------------------- /squeak/hsRefreshOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsRefreshOverImage.png -------------------------------------------------------------------------------- /squeak/hsReorderDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsReorderDownImage.png -------------------------------------------------------------------------------- /squeak/hsReorderImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsReorderImage.png -------------------------------------------------------------------------------- /squeak/hsReorderOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsReorderOutImage.png -------------------------------------------------------------------------------- /squeak/hsReorderOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsReorderOverImage.png -------------------------------------------------------------------------------- /squeak/hsToolsDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsToolsDownImage.png -------------------------------------------------------------------------------- /squeak/hsToolsImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsToolsImage.png -------------------------------------------------------------------------------- /squeak/hsToolsOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsToolsOutImage.png -------------------------------------------------------------------------------- /squeak/hsToolsOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/hsToolsOverImage.png -------------------------------------------------------------------------------- /squeak/itemBothOverride.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/itemBothOverride.png -------------------------------------------------------------------------------- /squeak/itemDeleteImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/itemDeleteImage.png -------------------------------------------------------------------------------- /squeak/itemMenuImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/itemMenuImage.png -------------------------------------------------------------------------------- /squeak/itemReferencesImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/itemReferencesImage.png -------------------------------------------------------------------------------- /squeak/itemSubOverride.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/itemSubOverride.png -------------------------------------------------------------------------------- /squeak/itemSuperOverride.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/itemSuperOverride.png -------------------------------------------------------------------------------- /squeak/languageJS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/languageJS.png -------------------------------------------------------------------------------- /squeak/languageM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/languageM.png -------------------------------------------------------------------------------- /squeak/languageNewspeak3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/languageNewspeak3.png -------------------------------------------------------------------------------- /squeak/languageSmalltalk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/languageSmalltalk.png -------------------------------------------------------------------------------- /squeak/menu16px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/menu16px.png -------------------------------------------------------------------------------- /squeak/menu16pxDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/menu16pxDown.png -------------------------------------------------------------------------------- /squeak/menu16pxOver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/menu16pxOver.png -------------------------------------------------------------------------------- /squeak/menuButtonImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/menuButtonImage.png -------------------------------------------------------------------------------- /squeak/metaMenuDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/metaMenuDownImage.png -------------------------------------------------------------------------------- /squeak/metaMenuImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/metaMenuImage.png -------------------------------------------------------------------------------- /squeak/metaMenuOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/metaMenuOutImage.png -------------------------------------------------------------------------------- /squeak/metaMenuOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/metaMenuOverImage.png -------------------------------------------------------------------------------- /squeak/operateMenuDownImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/operateMenuDownImage.png -------------------------------------------------------------------------------- /squeak/operateMenuImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/operateMenuImage.png -------------------------------------------------------------------------------- /squeak/operateMenuOutImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/operateMenuOutImage.png -------------------------------------------------------------------------------- /squeak/operateMenuOverImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/operateMenuOverImage.png -------------------------------------------------------------------------------- /squeak/privateImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/privateImage.png -------------------------------------------------------------------------------- /squeak/protectedImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/protectedImage.png -------------------------------------------------------------------------------- /squeak/publicImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/publicImage.png -------------------------------------------------------------------------------- /squeak/repositoryGit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/repositoryGit.png -------------------------------------------------------------------------------- /squeak/repositoryMercurial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/repositoryMercurial.png -------------------------------------------------------------------------------- /squeak/tinySubclassResponsibilityImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newspeaklanguage/newspeak/f30a7fe64604c1052a37fab1ef08042fe7c8680c/squeak/tinySubclassResponsibilityImage.png -------------------------------------------------------------------------------- /tool/configure-http-server/serve-newspeak.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | # Ensure user provided a port number 4 | 5 | if [ $# -ne 1 ] || [ "$(echo "$1" | grep -E '^[[:digit:]]{1,}$')" = "" ]; then 6 | echo "When starting the Newspeak HTTP server, please always specify numerical port number as the first argument." 7 | echo "Usage: $0 portNumber" 8 | echo "Exiting." 9 | exit 1 10 | fi 11 | 12 | port=$1 13 | 14 | # Use a comment to help user run 15 | nextStep=" 16 | If you deployed a webIDE as Progressive Web App (PWA), access it on a URL such as 17 | 'http://localhost:$port/webIDE'. 18 | 19 | If you deployed a vfuel file as a website, access the vfuel on a URL such as 20 | 'http://localhost:$port/primordialsoup.html?snapshot=HopscotchWebIDE.vfuel' 21 | 'http://localhost:$port/primordialsoup.html?snapshot=CounterApp.vfuel' 22 | etc 23 | " 24 | 25 | # Start the server 26 | 27 | if command -v python3; then 28 | echo "Starting Newspeak HTTP on port=$port using Python3" 29 | echo "$nextStep" 30 | python3 ./server3.py "$port" 31 | elif command -v python; then 32 | version=$(python --version 2>&1) 33 | case "$version" in 34 | *'Python 3'*) 35 | echo "Starting Newspeak HTTP on port=$port using Python3" 36 | echo "$nextStep" 37 | python ./server3.py "$port";; 38 | *'Python 2'*) 39 | echo "Starting Newspeak HTTP on port=$port using Python2" 40 | echo "$nextStep" 41 | python ./server2.py "$port";; 42 | *'Python 1'*) 43 | echo "Cannot serve Newspeak from localhost. Python 2 or 3 is needed to run the web server, but you have Python 1. Upgrade to Python 2 or 3."; exit 1 ;; 44 | *) 45 | echo "Cannot serve Newspeak from localhost. Python 2 or 3 is needed to run the web server, but Python version not recognized"; exit 1 ;; 46 | esac 47 | else 48 | echo "Cannot serve Newspeak from localhost. Python is needed to run the web server, but Python could not be found on this system" 49 | exit 1 50 | fi 51 | 52 | 53 | -------------------------------------------------------------------------------- /tool/configure-http-server/server2.py: -------------------------------------------------------------------------------- 1 | import SimpleHTTPServer 2 | import SocketServer 3 | import sys 4 | 5 | print(sys.argv) 6 | if len(sys.argv) != 2: 7 | print('Missing port number argument, exiting') 8 | quit() 9 | 10 | PORT = int(sys.argv[1]) 11 | print('PORT=', PORT) 12 | 13 | class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler): 14 | pass 15 | 16 | Handler.extensions_map['.wasm'] = 'application/wasm' 17 | 18 | httpd = SocketServer.TCPServer(("", PORT), Handler) 19 | 20 | print "my-server.py serving at port", PORT 21 | httpd.serve_forever() 22 | -------------------------------------------------------------------------------- /tool/configure-http-server/server3.py: -------------------------------------------------------------------------------- 1 | import http.server 2 | import socketserver 3 | import sys 4 | 5 | print(sys.argv) 6 | if len(sys.argv) != 2: 7 | print('Missing port number argument, exiting') 8 | quit() 9 | 10 | PORT = int(sys.argv[1]) 11 | print('PORT=', PORT) 12 | 13 | class Handler(http.server.SimpleHTTPRequestHandler): 14 | pass 15 | # To set top server DIRECTORY, e.g. "webIDE" explicitly, we could use: 16 | # def __init__(self, *args, **kwargs): 17 | # super().__init__(*args, directory=DIRECTORY, **kwargs) 18 | # By default undefined, which causes start in pwd of the executed script. 19 | 20 | Handler.extensions_map['.wasm'] = 'application/wasm' 21 | 22 | with socketserver.TCPServer(("", PORT), Handler) as httpd: 23 | print ("Python3: server3.py serving at port", PORT) 24 | httpd.serve_forever() 25 | -------------------------------------------------------------------------------- /tool/newspeak_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## 4 | ## Description: 5 | ## This file sets environment variables for functions in 'newspeak_util.sh'. 6 | ## It is sourced in all scripts running Newspeak build and deploy, 7 | ## indirectly through 'newspeak_util.sh'. 8 | ## 9 | 10 | # 11 | # Environment variables for directories needed to build Newspeak. 12 | # Modify them according to your directory structure, but do not push. 13 | # 14 | export EMSDK=~/software/emsdk # Emscripten directory 15 | export NEWSPEAK=~/software/nswasm/newspeak # Newspeak directory 16 | export PRIMORDIALSOUP=~/software/nswasm/primordialsoup # Primordialsoup directory 17 | echo "$0: EXPORTING: EMSDK=$EMSDK, NEWSPEAK=$NEWSPEAK, PRIMORDIALSOUP=$PRIMORDIALSOUP" 18 | -------------------------------------------------------------------------------- /updateApp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | source build.sh 4 | # If on a mac, leave the definition of APPVFUELPATH untouched. 5 | # If one Windows, if your app is located at x, then set 6 | # APPVFUELPATH=x/resources/app/out/ 7 | APPVFUELPATH=/Applications/NewspeakElectronIDE.app/Contents/Resources/app/out/ 8 | cp out/HopscotchElectronIDE.vfuel $APPVFUELPATH 9 | cp out/primordialsoup.wasm $APPVFUELPATH 10 | cp out/primordialsoup.js $APPVFUELPATH 11 | cp out/primordialsoup.html $APPVFUELPATH 12 | 13 | 14 | --------------------------------------------------------------------------------