Browse Source

Amberified some more files, fixed meta example. Deleted some needless js files, added gitignore file.

Göran Krampe 13 years ago
parent
commit
7e47705c1a

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+# Ignoring compiled files in examples
+examples/nodejs/**/*.js
+examples/webos/**/*.js
+
+# Ignoring compiled files in st
+st/*.js

+ 0 - 18
examples/nodejs/hello/Hello.js

@@ -1,18 +0,0 @@
-smalltalk.addClass('Hello', smalltalk.Object, [], 'Hello');
-
-smalltalk.addMethod(
-'_main',
-smalltalk.method({
-selector: 'main',
-category: 'main',
-fn: function (){
-var self=this;
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", ["Hello world from JTalk in Node.js"]);
-return self;},
-source: unescape('main%0A%09console%20log%3A%20%27Hello%20world%20from%20JTalk%20in%20Node.js%27'),
-messageSends: ["log:"],
-referencedClasses: []
-}),
-smalltalk.Hello.klass);
-
-

File diff suppressed because it is too large
+ 0 - 6409
examples/nodejs/hello/Program.js


+ 1 - 1
examples/nodejs/meta/Makefile

@@ -1,5 +1,5 @@
 Program.js: MyScript.st
-	../../../bin/amberc -L COMPILER -m MyScript MyScript.st Program
+	../../../bin/amberc -l parser,Compiler -m MyScript MyScript.st Program
 
 run: Program.js
 	node Program.js

+ 0 - 30
examples/nodejs/meta/MyScript.js

@@ -1,30 +0,0 @@
-smalltalk.addClass('MyScript', smalltalk.Object, [], 'MyScript');
-
-smalltalk.addMethod(
-'_main',
-smalltalk.method({
-selector: 'main',
-category: 'main',
-fn: function (){
-var self=this;
-var class=nil;
-var compiler=nil;
-var method=nil;
-smalltalk.send((smalltalk.Object || Object), "_subclass_instanceVariableNames_category_", ["Dummy", "", "Dummy"]);
-class=smalltalk.send((typeof smalltalk == 'undefined' ? nil : smalltalk), "_at_", ["Dummy"]);
-compiler=smalltalk.send((smalltalk.Compiler || Compiler), "_new", []);
-method=smalltalk.send(compiler, "_load_forClass_", [unescape("foo%20%5E%2010"), class]);
-smalltalk.send(method, "_category_", ["foo"]);
-smalltalk.send(class, "_addCompiledMethod_", [method]);
-method=smalltalk.send(compiler, "_load_forClass_", [unescape("bar%20%5E%20self%20foo%20*%202"), class]);
-smalltalk.send(method, "_category_", ["foo"]);
-smalltalk.send(class, "_addCompiledMethod_", [method]);
-smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [smalltalk.send(smalltalk.send((smalltalk.Exporter || Exporter), "_new", []), "_exportCategory_", ["Dummy"])]);
-return self;},
-source: unescape('main%0A%09%7C%20class%20compiler%20method%20%7C%0A%09Object%20subclass%3A%20%23Dummy%20instanceVariableNames%3A%20%27%27%20category%3A%20%27Dummy%27.%0A%09class%20%3A%3D%20smalltalk%20at%3A%20%23Dummy.%09%0A%09compiler%20%3A%3D%20Compiler%20new.%0A%0A%09method%20%3A%3D%20compiler%20load%3A%20%27foo%20%5E%2010%27%20forClass%3A%20class.%0A%09method%20category%3A%20%27foo%27.%0A%09class%20addCompiledMethod%3A%20method.%0A%0A%09method%20%3A%3D%20compiler%20load%3A%20%27bar%20%5E%20self%20foo%20*%202%27%20forClass%3A%20class.%0A%09method%20category%3A%20%27foo%27.%0A%09class%20addCompiledMethod%3A%20method.%0A%0A%09console%20log%3A%20%28Exporter%20new%20exportCategory%3A%20%27Dummy%27%29'),
-messageSends: ["subclass:instanceVariableNames:category:", "at:", "new", "load:forClass:", "category:", "addCompiledMethod:", "log:", "exportCategory:"],
-referencedClasses: [smalltalk.Object,smalltalk.Compiler,smalltalk.Exporter]
-}),
-smalltalk.MyScript.klass);
-
-

+ 8 - 4
examples/nodejs/meta/MyScript.st

@@ -4,12 +4,16 @@ Object subclass: #MyScript
 
 !MyScript class methodsFor: 'main'!
 main
+	"Just a trivial example showing some meta programming by
+	creating a class, compiling some methods and then exporting
+	this package in javascript format to stdout"
+
 	| klass compiler method |
-	Object subclass: #Dummy instanceVariableNames: '' category: 'Dummy'.
-	klass := smalltalk at: #Dummy.	
+	Object subclass: #Dummy instanceVariableNames: '' package: 'Dummy'.
+	klass := Smalltalk current at: #Dummy.
 	compiler := Compiler new.
 
-	method := compiler load: 'foo ^ 10' forClass: klass.
+	method := compiler load: 'foo ^10' forClass: klass.
 	method category: 'foo'.
 	klass addCompiledMethod: method.
 
@@ -17,7 +21,7 @@ main
 	method category: 'foo'.
 	klass addCompiledMethod: method.
 
-	console log: (Exporter new exportCategory: 'Dummy')
+	console log: (Exporter new exportPackage: 'Dummy')
 ! !
 
 

File diff suppressed because it is too large
+ 0 - 6409
examples/nodejs/meta/Program.js


+ 1 - 1
examples/webos/eris/Eris.st

@@ -67,7 +67,7 @@ initialize
 			{kind: 'PageHeader', content: 'Eris'},
  			{kind: 'RowGroup', caption: 'Workspace', components: [
 				{kind: 'RichText', richContent: false,
-					value: 'Put some funky Jtalk code here...',
+					value: 'Put some funky Amber code here...',
 					autoWordComplete: false, spellcheck: false, autocorrect: false,
 					autoCapitalize: 'lowercase', alwaysLooksFocused: true
 				},

+ 1 - 1
st/Kernel.st

@@ -366,7 +366,7 @@ Object subclass: #Package
 	instanceVariableNames: ''
 	category: 'Kernel'!
 !Package commentStamp!
-A Package is similar to a "class category" typically found in other Smalltalks like Pharo or Squeak. Jtalk does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.
+A Package is similar to a "class category" typically found in other Smalltalks like Pharo or Squeak. Amber does not have class categories anymore, it had in the beginning but now each class in the system knows which package it belongs to.
 
 A Package has a name, an Array of "requires", a comment and a Dictionary with other optional key value attributes. A Package can also be queried for its classes, but it will then resort to a reverse scan of all classes to find them.
 Packages are manipulated through "Smalltalk current", like for example finding one based on a name:

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