Browse Source

Merge branch 'master' into flatter-cli-hierarchy

Herbert Vojčík 10 years ago
parent
commit
cef9d54c90
100 changed files with 104 additions and 87 deletions
  1. 15 7
      Gruntfile.js
  2. 1 1
      external/amber-cli/package.json
  3. 8 8
      external/amber-cli/support/amberc-cli.js
  4. 18 10
      external/amber-dev/lib/amberc.js
  5. 1 1
      external/amber-dev/package.json
  6. 1 1
      grunt/tasks/grunt-peg.js
  7. 1 1
      package.json
  8. 9 4
      src/Kernel-ImportExport.js
  9. 4 2
      src/Kernel-ImportExport.st
  10. 0 20
      support/_st.js
  11. 4 4
      support/amber.js
  12. 0 18
      support/as-receiver.js
  13. 25 2
      support/boot.js
  14. 1 1
      support/browser-compatibility.js
  15. 3 0
      support/deprecated-vm-files/_st.js
  16. 3 0
      support/deprecated-vm-files/as-receiver.js
  17. 3 0
      support/deprecated-vm-files/boot.js
  18. 0 0
      support/deprecated-vm-files/globals.js
  19. 0 0
      support/deprecated-vm-files/nil.js
  20. 0 0
      support/deprecated-vm-files/smalltalk.js
  21. 1 1
      support/helios/all.js
  22. 0 0
      support/helios/resources/all-inner.js
  23. 0 0
      support/helios/resources/announcement.png
  24. 0 0
      support/helios/resources/arrowLeft.png
  25. 0 0
      support/helios/resources/arrowRight.png
  26. 0 0
      support/helios/resources/browser.png
  27. 0 0
      support/helios/resources/class.png
  28. 0 0
      support/helios/resources/close-dark.png
  29. 0 0
      support/helios/resources/close.gif
  30. 0 0
      support/helios/resources/collection.png
  31. 0 0
      support/helios/resources/debugger.png
  32. 0 0
      support/helios/resources/exception.png
  33. 0 0
      support/helios/resources/extension.png
  34. 2 2
      support/helios/resources/helios-niflheim.css
  35. 2 2
      support/helios/resources/helios-niflheim.less
  36. 1 1
      support/helios/resources/helios.css
  37. 1 1
      support/helios/resources/helios.less
  38. 0 0
      support/helios/resources/helios_frame.css
  39. 0 0
      support/helios/resources/initialization.png
  40. 0 0
      support/helios/resources/inspector.png
  41. 0 0
      support/helios/resources/magnitude.png
  42. 0 0
      support/helios/resources/modified.png
  43. 0 0
      support/helios/resources/niflheim.css
  44. 0 0
      support/helios/resources/off.png
  45. 0 0
      support/helios/resources/offHover.png
  46. 0 0
      support/helios/resources/overridden.png
  47. 0 0
      support/helios/resources/override-overridden.png
  48. 0 0
      support/helios/resources/override.png
  49. 0 0
      support/helios/resources/package-dirty.png
  50. 0 0
      support/helios/resources/package.png
  51. 0 0
      support/helios/resources/pause.png
  52. 0 0
      support/helios/resources/private.png
  53. 0 0
      support/helios/resources/proceed.png
  54. 0 0
      support/helios/resources/references.png
  55. 0 0
      support/helios/resources/spinner.gif
  56. 0 0
      support/helios/resources/sprite.png
  57. 0 0
      support/helios/resources/squared_metal-dark.png
  58. 0 0
      support/helios/resources/squared_metal.png
  59. 0 0
      support/helios/resources/step-into.png
  60. 0 0
      support/helios/resources/step-out.png
  61. 0 0
      support/helios/resources/step-over.png
  62. 0 0
      support/helios/resources/sunit.png
  63. 0 0
      support/helios/resources/test.png
  64. 0 0
      support/helios/resources/testGreen.png
  65. 0 0
      support/helios/resources/testNotRun.png
  66. 0 0
      support/helios/resources/testRed.png
  67. 0 0
      support/helios/resources/testYellow.png
  68. 0 0
      support/helios/resources/tinylogo.png
  69. 0 0
      support/helios/resources/uncommented.png
  70. 0 0
      support/helios/resources/widget.png
  71. 0 0
      support/helios/resources/workspace.png
  72. 0 0
      support/helios/src/Helios-Announcements.js
  73. 0 0
      support/helios/src/Helios-Announcements.st
  74. 0 0
      support/helios/src/Helios-Browser.js
  75. 0 0
      support/helios/src/Helios-Browser.st
  76. 0 0
      support/helios/src/Helios-Commands-Browser.js
  77. 0 0
      support/helios/src/Helios-Commands-Browser.st
  78. 0 0
      support/helios/src/Helios-Commands-Core.js
  79. 0 0
      support/helios/src/Helios-Commands-Core.st
  80. 0 0
      support/helios/src/Helios-Commands-Tools.js
  81. 0 0
      support/helios/src/Helios-Commands-Tools.st
  82. 0 0
      support/helios/src/Helios-Core.js
  83. 0 0
      support/helios/src/Helios-Core.st
  84. 0 0
      support/helios/src/Helios-Debugger.js
  85. 0 0
      support/helios/src/Helios-Debugger.st
  86. 0 0
      support/helios/src/Helios-Exceptions.js
  87. 0 0
      support/helios/src/Helios-Exceptions.st
  88. 0 0
      support/helios/src/Helios-Helpers.js
  89. 0 0
      support/helios/src/Helios-Helpers.st
  90. 0 0
      support/helios/src/Helios-Inspector.js
  91. 0 0
      support/helios/src/Helios-Inspector.st
  92. 0 0
      support/helios/src/Helios-KeyBindings.js
  93. 0 0
      support/helios/src/Helios-KeyBindings.st
  94. 0 0
      support/helios/src/Helios-Layout.js
  95. 0 0
      support/helios/src/Helios-Layout.st
  96. 0 0
      support/helios/src/Helios-References.js
  97. 0 0
      support/helios/src/Helios-References.st
  98. 0 0
      support/helios/src/Helios-SUnit.js
  99. 0 0
      support/helios/src/Helios-SUnit.st
  100. 0 0
      support/helios/src/Helios-Transcript.js

+ 15 - 7
Gruntfile.js

@@ -8,6 +8,7 @@ module.exports = function(grunt) {
   grunt.loadNpmTasks('grunt-execute');
 
   grunt.registerTask('default', ['peg', 'amberc:all']);
+  grunt.registerTask('amberc:all', ['amberc:core', 'amberc:helios']);
   grunt.registerTask('test', ['amberc:test_runner', 'execute:test_runner', 'clean:test_runner']);
 
   grunt.initConfig({
@@ -33,7 +34,7 @@ module.exports = function(grunt) {
         amber_dir: process.cwd(),
         closure_jar: ''
       },
-      all: {
+      core: {
         output_dir : 'src',
         src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',
               'src/Kernel-Infrastructure.st', 'src/Kernel-Exceptions.st', 'src/Kernel-Transcript.st', 'src/Kernel-Announcements.st',
@@ -41,16 +42,23 @@ module.exports = function(grunt) {
               'src/Compiler-IR.st', 'src/Compiler-Inlining.st', 'src/Compiler-Semantic.st', 'src/Compiler-Interpreter.st',
               'src/Web.st', 'src/SUnit.st', 'src/IDE.st',
               'src/Kernel-Tests.st', 'src/Compiler-Tests.st', 'src/SUnit-Tests.st',
-              'src/Helios-Core.st', 'src/Helios-Exceptions.st', 'src/Helios-Announcements.st',
-              'src/Helios-KeyBindings.st', 'src/Helios-Layout.st',
-              'src/Helios-Commands-Core.st', 'src/Helios-Commands-Tools.st', 'src/Helios-Commands-Browser.st',
-              'src/Helios-References.st', 'src/Helios-Inspector.st', 'src/Helios-Browser.st',
-              'src/Helios-Transcript.st', 'src/Helios-Workspace.st', 'src/Helios-Debugger.st',
-              'src/Helios-Workspace-Tests.st',
               'src/Benchfib.st', 'src/Examples.st', 'src/Spaces.st'
               ],
         jsGlobals: ['navigator']
       },
+      helios: {
+        output_dir : 'support/helios/src',
+        src: ['support/helios/src/Helios-Core.st', 'support/helios/src/Helios-Exceptions.st', 'support/helios/src/Helios-Announcements.st',
+              'support/helios/src/Helios-KeyBindings.st', 'support/helios/src/Helios-Layout.st',
+              'support/helios/src/Helios-Commands-Core.st', 'support/helios/src/Helios-Commands-Tools.st', 'support/helios/src/Helios-Commands-Browser.st',
+              'support/helios/src/Helios-References.st', 'support/helios/src/Helios-Inspector.st', 'support/helios/src/Helios-Browser.st',
+              'support/helios/src/Helios-Transcript.st', 'support/helios/src/Helios-Workspace.st', 'support/helios/src/Helios-Debugger.st',
+              'support/helios/src/Helios-Workspace-Tests.st'
+              ],
+        libraries: ['Web', 'SUnit'],
+        amd_namespace: 'helios',
+        jsGlobals: ['navigator']
+      },
       amber_kernel: {
         output_dir : 'src',
         src: ['src/Kernel-Objects.st', 'src/Kernel-Classes.st', 'src/Kernel-Methods.st', 'src/Kernel-Collections.st',

+ 1 - 1
external/amber-cli/package.json

@@ -40,7 +40,7 @@
     "grunt-init-amber": "0.0.1",
     "grunt-init": "~0.3.1",
     "bower": "~1.3.2",
-    "amber-dev": "~0.1.0"
+    "amber-dev": "~0.1.1"
   },
   "devDependencies": {
     "grunt": "~0.4.0",

+ 8 - 8
external/amber-cli/support/amberc-cli.js

@@ -9,8 +9,7 @@ var parameters = process.argv.slice(2);
 
 // check if at least one parameter was passed to the script
 if (1 > parameters.length) {
-	print_usage();
-	process.exit();
+	print_usage_and_exit();
 }
 
 
@@ -57,9 +56,9 @@ function handle_options(optionsArray) {
 			case '-D':
 				defaults.output_dir = optionsArray.shift();
 				break;
-            case '-d':
-                amber_dir = path.normalize(optionsArray.shift());
-                break;
+			case '-d':
+				amber_dir = path.normalize(optionsArray.shift());
+				break;
 			case '-s':
 				defaults.suffix = optionsArray.shift();
 				defaults.suffix_used = defaults.suffix;
@@ -74,7 +73,7 @@ function handle_options(optionsArray) {
 			case '-h':
 			case '--help':
 			case '?':
-				print_usage();
+				print_usage_and_exit();
 				break;
 			default:
 				var fileSuffix = path.extname(currentItem);
@@ -104,7 +103,7 @@ function handle_options(optionsArray) {
 
 
 // print available flags
-function print_usage() {
+function print_usage_and_exit() {
 	var usage = [
 		'Usage: amberc [-l lib1,lib2...] [-g jsGlobal1,jsGlobla2] [-m main_class] [-M main_file]',
 		'          [-n namespace] [-D output_dir] [-v] [-s suffix] [-S suffix] [file1 [file2 ...]] [Program]',
@@ -192,6 +191,7 @@ function print_usage() {
 		'        amberc -M main.js myboot.js myKernel.js Cat1.st Cat2.st Program',
 	];
 	usage.forEach(function (line) {
-        console.log(line);
+		console.log(line);
 	});
+	process.exit();
 }

+ 18 - 10
external/amber-dev/lib/amberc.js

@@ -38,16 +38,17 @@ function createConcatenator () {
 		start: function () {
 			this.add(
 				'var define = (' + require('amdefine') + ')(null, function (id) { throw new Error("Dependency not found: " +  id); }), requirejs = define.require;',
-				'define("amber_vm/browser-compatibility", [], {});'
+				'define("amber_vm/browser-compatibility", [], {});',
+				'define("amber/browser-compatibility", [], {});'
 			);
 		},
 		finish: function (realWork) {
 			this.add(
-				'define("amber_vm/_init", ["amber_vm/smalltalk", "amber_vm/globals", "' + this.ids.join('","') + '"], function (vm, globals) {',
-				'vm.initialize();',
+				'define("amber/_init", ["' + this.ids.join('","') + '"], function (boot) {',
+				'boot.vm.initialize();',
 				realWork,
 				'});',
-				'requirejs("amber_vm/_init");'
+				'requirejs("amber/_init");'
 			);
 		},
 		toString: function () {
@@ -71,6 +72,7 @@ function AmberCompiler(amber_dir) {
 	}
 
 	this.amber_dir = amber_dir;
+	// Important: in next list, boot MUST be first
 	this.kernel_libraries = ['boot', 'smalltalk', 'globals', 'nil', '_st', 'Kernel-Objects', 'Kernel-Classes', 'Kernel-Methods',
 							'Kernel-Collections', 'Kernel-Infrastructure', 'Kernel-Exceptions', 'Kernel-Transcript',
 							'Kernel-Announcements'];
@@ -120,6 +122,7 @@ AmberCompiler.prototype.main = function(configuration, finished_callback) {
 	if (undefined !== configuration.jsLibraryDirs) {
 		configuration.jsLibraryDirs.push(path.join(this.amber_dir, 'src'));
 		configuration.jsLibraryDirs.push(path.join(this.amber_dir, 'support'));
+		configuration.jsLibraryDirs.push(path.join(this.amber_dir, 'support', 'deprecated-vm-files'));
 	}
 
 	console.ambercLog = console.log;
@@ -325,9 +328,9 @@ function create_compiler(configuration) {
 			// data is an array where index 0 is the error code and index 1 contains the data
 			builder.add(data);
 			// matches and returns the "module_id" string in the AMD definition: define("module_id", ...)
-			var match = ('' + data).match(/^define\("([^"]*)"/);
+			var match = ('' + data).match(/(^|\n)define\("([^"]*)"/);
 			if (match) {
-				builder.addId(match[1]);
+				builder.addId(match[2]);
 			}
 		});
 	})
@@ -362,8 +365,11 @@ function create_compiler(configuration) {
 				loadIds.push(match[1]);
 			}
 		});
+		//backward compatibility
+		if (builder.ids.indexOf("amber_vm/boot") === -1) { console.log(builder.ids); console.log("defining amber_vm/boot"); builder.add('define("amber_vm/boot", ["amber/boot"], function (boot) { return boot; });'); }
+
 		// store the generated smalltalk env in configuration.{vm,globals}
-		builder.finish('configuration.vm = vm; configuration.globals = globals;');
+		builder.finish('configuration.vm = boot.vm; configuration.globals = boot.globals;');
 		loadIds.forEach(function (id) {
 			builder.add('requirejs("' + id + '");');
 		});
@@ -547,9 +553,9 @@ function compose_js_files(configuration) {
 				console.log('Adding : ' + file);
 				var buffer = fs.readFileSync(file);
 				// matches and returns the "module_id" string in the AMD define: define("module_id", ...)
-				var match = buffer.toString().match(/^define\("([^"]*)"/);
+				var match = buffer.toString().match(/(^|\n)define\("([^"]*)"/);
 				if (match /*&& match[1].slice(0,9) !== "amber_vm/"*/) {
-					builder.addId(match[1]);
+					builder.addId(match[2]);
 				}
 				builder.add(buffer);
 			} else {
@@ -557,8 +563,10 @@ function compose_js_files(configuration) {
 				reject(Error('Can not find file ' + file));
 			}
 		});
+		//backward compatibility
+		if (builder.ids.indexOf("amber_vm/boot") === -1) { builder.add('define("amber_vm/boot", ["amber/boot"], function (boot) { return boot; });'); }
 
-		var mainFunctionOrFile = '';
+		var mainFunctionOrFile = 'var vm = boot.vm, globals = boot.globals;\n';
 
 		if (undefined !== configuration.main) {
 			console.log('Adding call to: %s>>main', configuration.main);

+ 1 - 1
external/amber-dev/package.json

@@ -1,6 +1,6 @@
 {
   "name": "amber-dev",
-  "version": "0.1.0",
+  "version": "0.1.1",
   "description": "Development goodies for Amber Smalltalk",
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1"

+ 1 - 1
grunt/tasks/grunt-peg.js

@@ -18,7 +18,7 @@ module.exports = function(grunt) {
       export_var: 'module.exports'
     });
     var parser = PEG.buildParser(grunt.file.read(this.data.src), options);
-    var content = 'define("amber_vm/parser", ["./globals", "./nil"], function(globals, nil) {\n'+options.export_var + ' = ' + parser + ';\n});';
+    var content = 'define("amber/parser", ["./boot"], function(boot) {\nvar globals = boot.globals, nil = boot.nil;\n'+options.export_var + ' = ' + parser + ';\n});';
     grunt.file.write(this.data.dest, content);
   });
 };

+ 1 - 1
package.json

@@ -33,7 +33,7 @@
     "grunt": "~0.4.0",
     "grunt-contrib-jshint": "~0.3.0",
     "grunt-execute": "~0.2.1",
-    "amber-dev": "~0.1.0",
+    "amber-dev": "~0.1.1",
     "grunt-contrib-clean": "~0.5.0"
   }
 }

+ 9 - 4
src/Kernel-ImportExport.js

@@ -1,4 +1,5 @@
-define("amber_core/Kernel-ImportExport", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function(smalltalk,nil,_st, globals){
+define("amber_core/Kernel-ImportExport", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Infrastructure"], function($boot){
+var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
 smalltalk.addPackage('Kernel-ImportExport');
 smalltalk.packages["Kernel-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
 
@@ -1098,13 +1099,17 @@ _st(aStream)._nextPutAll_(_st(aPackage)._name());
 $ctx1.sendIdx["nextPutAll:"]=4;
 _st(aStream)._nextPutAll_("\x22, ");
 $ctx1.sendIdx["nextPutAll:"]=5;
-_st(aStream)._nextPutAll_(_st(["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_vm/globals"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
+_st(aStream)._nextPutAll_(_st(["amber/boot"].__comma(self._amdNamesOfPackages_(_st(aPackage)._loadDependencies())))._asJavascript());
 $ctx1.sendIdx["nextPutAll:"]=6;
-_st(aStream)._nextPutAll_(", function(smalltalk,nil,_st, globals){");
+_st(aStream)._nextPutAll_(", function($boot){");
+$ctx1.sendIdx["nextPutAll:"]=7;
+_st(aStream)._lf();
+$ctx1.sendIdx["lf"]=1;
+_st(aStream)._nextPutAll_("var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;");
 $1=_st(aStream)._lf();
 return self}, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},globals.AmdExporter)})},
 args: ["aPackage", "aStream"],
-source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st' 'amber_vm/globals'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function(smalltalk,nil,_st, globals){';\x0a\x09\x09lf",
+source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09nextPutAll: 'define(\x22';\x0a\x09\x09nextPutAll: (self amdNamespaceOfPackage: aPackage);\x0a\x09\x09nextPutAll: '/';\x0a\x09\x09nextPutAll: aPackage name;\x0a\x09\x09nextPutAll: '\x22, ';\x0a\x09\x09nextPutAll: (#('amber/boot'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;\x0a\x09\x09nextPutAll: ', function($boot){';\x0a\x09\x09lf;\x0a\x09\x09nextPutAll: 'var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;';\x0a\x09\x09lf",
 messageSends: ["nextPutAll:", "amdNamespaceOfPackage:", "name", "asJavascript", ",", "amdNamesOfPackages:", "loadDependencies", "lf"],
 referencedClasses: []
 }),

+ 4 - 2
src/Kernel-ImportExport.st

@@ -386,8 +386,10 @@ exportPackagePrologueOf: aPackage on: aStream
 		nextPutAll: '/';
 		nextPutAll: aPackage name;
 		nextPutAll: '", ';
-		nextPutAll: (#('amber_vm/smalltalk' 'amber_vm/nil' 'amber_vm/_st' 'amber_vm/globals'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;
-		nextPutAll: ', function(smalltalk,nil,_st, globals){';
+		nextPutAll: (#('amber/boot'), (self amdNamesOfPackages: aPackage loadDependencies)) asJavascript;
+		nextPutAll: ', function($boot){';
+		lf;
+		nextPutAll: 'var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;';
 		lf
 ! !
 

+ 0 - 20
support/_st.js

@@ -1,20 +0,0 @@
-// !!! THIS FILE IS DEPRECATED !!!
-// Use as-receiver.js instead.
-
-/**
- * _st is a function used all over the compiled amber code that
- * takes any value (JavaScript or Smalltalk)
- * and returns a proper Amber Smalltalk receiver.
- *
- * null or undefined -> nil,
- * plain JS object -> wrapped JS object,
- * otherwise unchanged
- */
-
-define("amber_vm/_st", ["./globals", "./nil"], function (globals, nil) {
-    return function (o) {
-        if (o == null) { return nil; }
-        if (o.klass) { return o; }
-        return globals.JSObjectProxy._on_(o);
-    };
-});

+ 4 - 4
support/amber.js

@@ -77,14 +77,14 @@ require = function (require) {
     var config = {
         paths: {
             'amber': amber_home + '/support',
-            'amber_vm': amber_home + '/support',
-            'amber_vm/_st': amber_home + '/support/as-receiver',
+            'amber_vm': amber_home + '/support/deprecated-vm-files',
+            'amber_vm/_st': amber_home + '/support/deprecated-vm-files/as-receiver',
             'amber_css': amber_home + '/css',
             'amber_lib': library_home,
             'amber_core': amber_home + '/src',
-            'helios': amber_home + '/src',
+            'helios': amber_home + '/support/helios/src',
             'helios/all': amber_home + '/support/helios/all',
-            'helios/resources': amber_home + '/support/helios',
+            'helios/resources': amber_home + '/support/helios/resources',
             'helios/index': amber_home + '/support/helios/index',
             'jquery': library_home + '/jquery/jquery.min'
         },

+ 0 - 18
support/as-receiver.js

@@ -1,18 +0,0 @@
-
-/**
- * _st is a function used all over the compiled amber code that
- * takes any value (JavaScript or Smalltalk)
- * and returns a proper Amber Smalltalk receiver.
- *
- * null or undefined -> nil,
- * plain JS object -> wrapped JS object,
- * otherwise unchanged
- */
-
-define("amber_vm/_st", ["./globals", "./nil"], function (globals, nil) {
-    return function (o) {
-        if (o == null) { return nil; }
-        if (o.klass) { return o; }
-        return globals.JSObjectProxy._on_(o);
-    };
-});

+ 25 - 2
support/boot.js

@@ -38,7 +38,7 @@
  ==================================================================== */
 
 
-define("amber_vm/boot", [ 'require', './browser-compatibility' ], function (require) {
+define("amber/boot", [ 'require', './browser-compatibility' ], function (require) {
 
 	/* Reconfigurable micro composition system, https://github.com/amber-smalltalk/brikz */
 
@@ -1122,6 +1122,28 @@ define("amber_vm/boot", [ 'require', './browser-compatibility' ], function (requ
 		};
 	}
 
+    /* Defines asReceiver to be present at load time */
+    /* (logically it belongs more to PrimitiveBrik) */
+    function AsReceiverBrik(brikz, st) {
+
+        var nil = brikz.ensure("root").nil;
+
+        /**
+         * This function is used all over the compiled amber code.
+         * It takes any value (JavaScript or Smalltalk)
+         * and returns a proper Amber Smalltalk receiver.
+         *
+         * null or undefined -> nil,
+         * plain JS object -> wrapped JS object,
+         * otherwise unchanged
+         */
+        this.asReceiver = function (o) {
+            if (o == null) { return nil; }
+            if (o.klass) { return o; }
+            return globals.JSObjectProxy._on_(o);
+        };
+    }
+
 
 	/* Making smalltalk that can load */
 
@@ -1136,6 +1158,7 @@ define("amber_vm/boot", [ 'require', './browser-compatibility' ], function (requ
 	brikz.stInit = SmalltalkInitBrik;
 	brikz.augments = AugmentsBrik;
 	brikz.amdBrik = AMDBrik;
+	brikz.asReceiverBrik = AsReceiverBrik;
 
 	brikz.rebuild();
 
@@ -1149,5 +1172,5 @@ define("amber_vm/boot", [ 'require', './browser-compatibility' ], function (requ
 		brikz.rebuild();
 	};
 
-	return { vm: api, nil: brikz.root.nil, globals: globals };
+	return { vm: api, nil: brikz.root.nil, globals: globals, asReceiver: brikz.asReceiverBrik.asReceiver };
 });

+ 1 - 1
support/browser-compatibility.js

@@ -1,4 +1,4 @@
-define("amber_vm/browser-compatibility", [
+define([
     './ensure-console',
     'amber_lib/es5-shim/es5-shim.min',
     'amber_lib/es5-shim/es5-sham.min'

+ 3 - 0
support/deprecated-vm-files/_st.js

@@ -0,0 +1,3 @@
+define("amber_vm/_st", ["./boot"], function (boot) {
+    return boot.asReceiver;
+});

+ 3 - 0
support/deprecated-vm-files/as-receiver.js

@@ -0,0 +1,3 @@
+define("amber_vm/_st", ["./boot"], function (boot) {
+    return boot.asReceiver;
+});

+ 3 - 0
support/deprecated-vm-files/boot.js

@@ -0,0 +1,3 @@
+define("amber_vm/boot", ["amber/boot"], function (boot) {
+    return boot;
+});

+ 0 - 0
support/globals.js → support/deprecated-vm-files/globals.js


+ 0 - 0
support/nil.js → support/deprecated-vm-files/nil.js


+ 0 - 0
support/smalltalk.js → support/deprecated-vm-files/smalltalk.js


+ 1 - 1
support/helios/all.js

@@ -24,5 +24,5 @@ define([
 	'./resources/all-inner',
     'css!./resources/helios',
 	'css!./resources/helios-niflheim',
-    'css!amber_css/niflheim'
+    'css!./resources/niflheim'
 ], function (smalltalk) { return smalltalk; });

+ 0 - 0
support/helios/all-inner.js → support/helios/resources/all-inner.js


+ 0 - 0
support/helios/announcement.png → support/helios/resources/announcement.png


+ 0 - 0
support/helios/arrowLeft.png → support/helios/resources/arrowLeft.png


+ 0 - 0
support/helios/arrowRight.png → support/helios/resources/arrowRight.png


+ 0 - 0
support/helios/browser.png → support/helios/resources/browser.png


+ 0 - 0
support/helios/class.png → support/helios/resources/class.png


+ 0 - 0
support/helios/close-dark.png → support/helios/resources/close-dark.png


+ 0 - 0
support/helios/close.gif → support/helios/resources/close.gif


+ 0 - 0
support/helios/collection.png → support/helios/resources/collection.png


+ 0 - 0
support/helios/debugger.png → support/helios/resources/debugger.png


+ 0 - 0
support/helios/exception.png → support/helios/resources/exception.png


+ 0 - 0
support/helios/extension.png → support/helios/resources/extension.png


+ 2 - 2
support/helios/helios-niflheim.css → support/helios/resources/helios-niflheim.css

@@ -4,7 +4,7 @@ body[id="helios"].niflheim {
 		  width: 100%;
 		}*/
   /*.tool_container .pane .nav-pills i.package {
-			background-image: url('package.png');
+			background-image: url('resources/package.png');
 		}*/
 }
 body[id="helios"].niflheim .btn-group > .dropdown-menu {
@@ -125,7 +125,7 @@ body[id="helios"].niflheim .welcome {
 body[id="helios"].niflheim [class^="icon-"],
 body[id="helios"].niflheim body[id="helios"][class*=" icon-"] {
   opacity: 0.68;
-  background-image: url("../../bower_components/bootstrap/img/glyphicons-halflings-white.png");
+  background-image: url("../../../bower_components/bootstrap/img/glyphicons-halflings-white.png");
 }
 body[id="helios"].niflheim .welcome h2 {
   text-align: center;

+ 2 - 2
support/helios/helios-niflheim.less → support/helios/resources/helios-niflheim.less

@@ -152,7 +152,7 @@ body[id="helios"] {
 
 		[class^="icon-"], body[id="helios"][class*=" icon-"]{
 			opacity: 0.68;
-			background-image: url("../../bower_components/bootstrap/img/glyphicons-halflings-white.png");
+			background-image: url("../../../bower_components/bootstrap/img/glyphicons-halflings-white.png");
 		}
 
 		.welcome h2 {
@@ -186,7 +186,7 @@ body[id="helios"] {
 	
 		//todo: remove
 		/*.tool_container .pane .nav-pills i.package {
-			background-image: url('package.png');
+			background-image: url('resources/package.png');
 		}*/
 
 		.tool_container .list-label {

+ 1 - 1
support/helios/helios.css → support/helios/resources/helios.css

@@ -443,7 +443,7 @@ body[id="helios"] .tool_container .pane .nav-pills i.package {
   background-image: url('package.png');
 }
 body[id="helios"] .tool_container .pane .nav-pills i.override {
-  background-image: url('override.png ');
+  background-image: url('resources/override.png ');
 }
 body[id="helios"] .tool_container .pane .nav-pills i.overridden {
   background-image: url('overridden.png');

+ 1 - 1
support/helios/helios.less → support/helios/resources/helios.less

@@ -515,7 +515,7 @@ body[id="helios"] {
 		background-image: url('package.png');
 	}
 	.tool_container .pane .nav-pills i.override {
-		background-image: url('override.png ');
+		background-image: url('resources/override.png ');
 	}
 	.tool_container .pane .nav-pills i.overridden {
 		background-image: url('overridden.png');

+ 0 - 0
support/helios/helios_frame.css → support/helios/resources/helios_frame.css


+ 0 - 0
support/helios/initialization.png → support/helios/resources/initialization.png


+ 0 - 0
support/helios/inspector.png → support/helios/resources/inspector.png


+ 0 - 0
support/helios/magnitude.png → support/helios/resources/magnitude.png


+ 0 - 0
support/helios/modified.png → support/helios/resources/modified.png


+ 0 - 0
css/niflheim.css → support/helios/resources/niflheim.css


+ 0 - 0
support/helios/off.png → support/helios/resources/off.png


+ 0 - 0
support/helios/offHover.png → support/helios/resources/offHover.png


+ 0 - 0
support/helios/overridden.png → support/helios/resources/overridden.png


+ 0 - 0
support/helios/override-overridden.png → support/helios/resources/override-overridden.png


+ 0 - 0
support/helios/override.png → support/helios/resources/override.png


+ 0 - 0
support/helios/package-dirty.png → support/helios/resources/package-dirty.png


+ 0 - 0
support/helios/package.png → support/helios/resources/package.png


+ 0 - 0
support/helios/pause.png → support/helios/resources/pause.png


+ 0 - 0
support/helios/private.png → support/helios/resources/private.png


+ 0 - 0
support/helios/proceed.png → support/helios/resources/proceed.png


+ 0 - 0
support/helios/references.png → support/helios/resources/references.png


+ 0 - 0
support/helios/spinner.gif → support/helios/resources/spinner.gif


+ 0 - 0
support/helios/sprite.png → support/helios/resources/sprite.png


+ 0 - 0
support/helios/squared_metal-dark.png → support/helios/resources/squared_metal-dark.png


+ 0 - 0
support/helios/squared_metal.png → support/helios/resources/squared_metal.png


+ 0 - 0
support/helios/step-into.png → support/helios/resources/step-into.png


+ 0 - 0
support/helios/step-out.png → support/helios/resources/step-out.png


+ 0 - 0
support/helios/step-over.png → support/helios/resources/step-over.png


+ 0 - 0
support/helios/sunit.png → support/helios/resources/sunit.png


+ 0 - 0
support/helios/test.png → support/helios/resources/test.png


+ 0 - 0
support/helios/testGreen.png → support/helios/resources/testGreen.png


+ 0 - 0
support/helios/testNotRun.png → support/helios/resources/testNotRun.png


+ 0 - 0
support/helios/testRed.png → support/helios/resources/testRed.png


+ 0 - 0
support/helios/testYellow.png → support/helios/resources/testYellow.png


+ 0 - 0
support/helios/tinylogo.png → support/helios/resources/tinylogo.png


+ 0 - 0
support/helios/uncommented.png → support/helios/resources/uncommented.png


+ 0 - 0
support/helios/widget.png → support/helios/resources/widget.png


+ 0 - 0
support/helios/workspace.png → support/helios/resources/workspace.png


+ 0 - 0
src/Helios-Announcements.js → support/helios/src/Helios-Announcements.js


+ 0 - 0
src/Helios-Announcements.st → support/helios/src/Helios-Announcements.st


+ 0 - 0
src/Helios-Browser.js → support/helios/src/Helios-Browser.js


+ 0 - 0
src/Helios-Browser.st → support/helios/src/Helios-Browser.st


+ 0 - 0
src/Helios-Commands-Browser.js → support/helios/src/Helios-Commands-Browser.js


+ 0 - 0
src/Helios-Commands-Browser.st → support/helios/src/Helios-Commands-Browser.st


+ 0 - 0
src/Helios-Commands-Core.js → support/helios/src/Helios-Commands-Core.js


+ 0 - 0
src/Helios-Commands-Core.st → support/helios/src/Helios-Commands-Core.st


+ 0 - 0
src/Helios-Commands-Tools.js → support/helios/src/Helios-Commands-Tools.js


+ 0 - 0
src/Helios-Commands-Tools.st → support/helios/src/Helios-Commands-Tools.st


+ 0 - 0
src/Helios-Core.js → support/helios/src/Helios-Core.js


+ 0 - 0
src/Helios-Core.st → support/helios/src/Helios-Core.st


+ 0 - 0
src/Helios-Debugger.js → support/helios/src/Helios-Debugger.js


+ 0 - 0
src/Helios-Debugger.st → support/helios/src/Helios-Debugger.st


+ 0 - 0
src/Helios-Exceptions.js → support/helios/src/Helios-Exceptions.js


+ 0 - 0
src/Helios-Exceptions.st → support/helios/src/Helios-Exceptions.st


+ 0 - 0
src/Helios-Helpers.js → support/helios/src/Helios-Helpers.js


+ 0 - 0
src/Helios-Helpers.st → support/helios/src/Helios-Helpers.st


+ 0 - 0
src/Helios-Inspector.js → support/helios/src/Helios-Inspector.js


+ 0 - 0
src/Helios-Inspector.st → support/helios/src/Helios-Inspector.st


+ 0 - 0
src/Helios-KeyBindings.js → support/helios/src/Helios-KeyBindings.js


+ 0 - 0
src/Helios-KeyBindings.st → support/helios/src/Helios-KeyBindings.st


+ 0 - 0
src/Helios-Layout.js → support/helios/src/Helios-Layout.js


+ 0 - 0
src/Helios-Layout.st → support/helios/src/Helios-Layout.st


+ 0 - 0
src/Helios-References.js → support/helios/src/Helios-References.js


+ 0 - 0
src/Helios-References.st → support/helios/src/Helios-References.st


+ 0 - 0
src/Helios-SUnit.js → support/helios/src/Helios-SUnit.js


+ 0 - 0
src/Helios-SUnit.st → support/helios/src/Helios-SUnit.st


+ 0 - 0
src/Helios-Transcript.js → support/helios/src/Helios-Transcript.js


Some files were not shown because too many files changed in this diff