Browse Source

Amber update
skinnier documentation header

Nicolas Petton 12 years ago
parent
commit
fec474a9dd

+ 11 - 1
amber/css/documentation.css

@@ -5,7 +5,16 @@
 
 #header {
     text-align: left;
-    margin: 20px;
+    margin: 20px 0;
+}
+
+#header .left {
+    float: left;
+    margin-right: 20px;
+}
+
+#header h1 {
+    margin: 10px 0;
 }
 
 .documentation {
@@ -28,6 +37,7 @@
     border: 1px solid #ccc;
     background: #eee;
     padding: 5px;
+    margin: 0 20px;
 }
 
 .documentation code {

+ 9 - 7
amber/documentation.html

@@ -16,14 +16,16 @@
     <div id="wrapper"> 
       
       <div id="header"> 
-	<h1>Documentation</h1>
-	<h2>Version 0.9.1</h2>
-	<img src="images/amber.png"/> 
+	<img class="left" src="images/amber_small.png"/> 
+	<div class="left">
+	  <h1>Documentation</h1>
+	  <h2>Version 0.9.1</h2>
+	</div>
+	<div class="clear"></div>
       <ul id="tabs"> 
-	<li><a target="_blank" href="http://amber-lang.net/index.html">Overview</a></li> · 
-	<li><a target="_blank" href="http://amber-lang.net/index.html#download">Download</a></li> · 
-	<li><a target="_blank" href="http://amber-lang.net/learn.html">Learn</a></li> ·
-	<li><a target="_blank" href="http://amber-lang.net/documentation.html">Documentation</a></li> ·
+	<li><a href="./index.html">Overview</a></li> · 
+	<li><a href="./learn.html">Learn</a></li> ·
+	<li><a href="./documentation.html">Documentation</a></li> ·
 	<li><a target="_blank" target="_blank" href="https://github.com/NicolasPetton/amber">Source</a></li> 
       </ul> 
       

BIN
amber/images/profstef.png


+ 4 - 5
amber/index.html

@@ -23,10 +23,9 @@
 	  </div> 
 	  
 	  <ul id="tabs"> 
-	    <li><a target="_blank" href="http://amber-lang.net/index.html">Overview</a></li> · 
-	    <li><a target="_blank" href="http://amber-lang.net/index.html#download">Download</a></li> · 
-	    <li><a target="_blank" href="http://amber-lang.net/learn.html">Learn</a></li> ·
-	    <li><a target="_blank" href="http://amber-lang.net/documentation.html">Documentation</a></li> ·
+	    <li><a href="./index.html">Overview</a></li> · 
+	    <li><a href="./learn.html">Learn</a></li> ·
+	    <li><a href="./documentation.html">Documentation</a></li> ·
 	    <li><a target="_blank" target="_blank" href="https://github.com/NicolasPetton/amber">Source</a></li> 
 	  </ul> 
 	  
@@ -109,7 +108,7 @@
       </div> 
     </div> 
     
-    <script type='text/javascript'> loadAmber({files: ['Documentation.js']}) </script> 
+    <script type='text/javascript'> loadAmber() </script> 
     
   </body> 
 </html> 

File diff suppressed because it is too large
+ 0 - 6
amber/js/Documentation.deploy.js


File diff suppressed because it is too large
+ 0 - 7
amber/js/Documentation.js


+ 44 - 0
amber/js/Kernel-Objects.deploy.js

@@ -1620,6 +1620,39 @@ return self;}
 }),
 smalltalk.Number);
 
+smalltalk.addMethod(
+'_negative',
+smalltalk.method({
+selector: 'negative',
+fn: function (){
+var self=this;
+return self < (0);
+return self;}
+}),
+smalltalk.Number);
+
+smalltalk.addMethod(
+'_positive',
+smalltalk.method({
+selector: 'positive',
+fn: function (){
+var self=this;
+return self >= (0);
+return self;}
+}),
+smalltalk.Number);
+
+smalltalk.addMethod(
+'_isZero',
+smalltalk.method({
+selector: 'isZero',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "__eq", [(0)]);
+return self;}
+}),
+smalltalk.Number);
+
 
 smalltalk.addMethod(
 '_pi',
@@ -2528,6 +2561,17 @@ return self;}
 }),
 smalltalk.Point);
 
+smalltalk.addMethod(
+'_printString',
+smalltalk.method({
+selector: 'printString',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@x'], "_printString", []), "__comma", [unescape("@")])]);((($receiver = smalltalk.send(smalltalk.send(self['@y'], "_notNil", []), "_and_", [(function(){return smalltalk.send(self['@y'], "_negative", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_space", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_space", []);})]));return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self['@y'], "_printString", [])]);})]);
+return self;}
+}),
+smalltalk.Point);
+
 
 smalltalk.addMethod(
 '_x_y_',

+ 68 - 1
amber/js/Kernel-Objects.js

@@ -891,6 +891,7 @@ smalltalk.Object.klass);
 
 
 smalltalk.addClass('Smalltalk', smalltalk.Object, [], 'Kernel-Objects');
+smalltalk.Smalltalk.comment=unescape('Smalltalk%20has%20only%20one%20instance%2C%20accessed%20with%20%60Smalltalk%20current%60.%20%0AIt%20represents%20the%20global%20JavaScript%20variable%20%60smalltalk%60%20declared%20in%20%60js/boot.js%60.%0A%0AThe%20%60smalltalk%60%20object%20holds%20all%20class%20and%20packages%20defined%20in%20the%20system.%0A%0A%23%23%20Classes%0A%0AClasses%20can%20be%20accessed%20using%20the%20following%20methods%3A%0A%0A-%20%60%23classes%60%20answers%20the%20full%20list%20of%20Smalltalk%20classes%20in%20the%20system%0A-%20%60%23at%3A%60%20answers%20a%20specific%20class%20of%20%60nil%60%0A%0A%23%23%20Packages%0A%0APackages%20can%20be%20accessed%20using%20the%20following%20methods%3A%0A%0A-%20%60%23packages%60%20answers%20the%20full%20list%20of%20packages%0A-%20%60%23packageAt%3A%60%20answers%20a%20specific%20class%20of%20%60nil%60%0A%0A__note%3A__%20classes%20and%20packages%20are%20accessed%20using%20strings%2C%20not%20symbols%0A%0A%23%23%20Parsing%0A%0AThe%20%60%23parse%3A%60%20method%20is%20used%20to%20parse%20Smalltalk%20source%20code.%20%0AIt%20requires%20the%20%60Compiler%60%20package%20and%20the%20%60js/parser.js%60%20parser%20file%20in%20order%20to%20work')
 smalltalk.addMethod(
 unescape('_classes'),
 smalltalk.method({
@@ -2312,6 +2313,54 @@ referencedClasses: []
 }),
 smalltalk.Number);
 
+smalltalk.addMethod(
+unescape('_negative'),
+smalltalk.method({
+selector: unescape('negative'),
+category: 'testing',
+fn: function (){
+var self=this;
+return self < (0);
+return self;},
+args: [],
+source: unescape('negative%0A%09%22Answer%20whether%20the%20receiver%20is%20mathematically%20negative.%22%0A%0A%09%5E%20self%20%3C%200'),
+messageSends: [unescape("%3C")],
+referencedClasses: []
+}),
+smalltalk.Number);
+
+smalltalk.addMethod(
+unescape('_positive'),
+smalltalk.method({
+selector: unescape('positive'),
+category: 'testing',
+fn: function (){
+var self=this;
+return self >= (0);
+return self;},
+args: [],
+source: unescape('positive%0A%09%22Answer%20whether%20the%20receiver%20is%20positive%20or%20equal%20to%200.%20%28ST-80%20protocol%29.%22%0A%0A%09%5E%20self%20%3E%3D%200'),
+messageSends: [unescape("%3E%3D")],
+referencedClasses: []
+}),
+smalltalk.Number);
+
+smalltalk.addMethod(
+unescape('_isZero'),
+smalltalk.method({
+selector: unescape('isZero'),
+category: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.send(self, "__eq", [(0)]);
+return self;},
+args: [],
+source: unescape('isZero%0A%09%5Eself%20%3D%200'),
+messageSends: [unescape("%3D")],
+referencedClasses: []
+}),
+smalltalk.Number);
+
 
 smalltalk.addMethod(
 unescape('_pi'),
@@ -3210,6 +3259,7 @@ smalltalk.Date.klass);
 
 
 smalltalk.addClass('UndefinedObject', smalltalk.Object, [], 'Kernel-Objects');
+smalltalk.UndefinedObject.comment=unescape('UndefinedObject%20describes%20the%20behavior%20of%20its%20sole%20instance%2C%20%60nil%60.%20%60nil%60%20represents%20a%20prior%20value%20for%20variables%20that%20have%20not%20been%20initialized%2C%20or%20for%20results%20which%20are%20meaningless.%0A%0A%60nil%60%20is%20the%20Smalltalk%20representation%20of%20the%20%60undefined%60%20JavaScript%20object.')
 smalltalk.addMethod(
 unescape('_subclass_instanceVariableNames_'),
 smalltalk.method({
@@ -3422,7 +3472,7 @@ smalltalk.UndefinedObject.klass);
 
 
 smalltalk.addClass('Random', smalltalk.Object, [], 'Kernel-Objects');
-smalltalk.Random.comment=unescape('Random%20is%20just%20a%20wrapper%20around%20javascript%20Math.random%28%29%20and%20is%20trivially%20used%20like%20this%3A%0A%0A%09Random%20new%20next%0A%0AThis%20will%20return%20a%20float%20x%20where%20x%20%3C%201%20and%20x%20%3E%200.%20If%20you%20want%20a%20random%20integer%20between%201%20and%2010%20you%20can%20use%20%23atRandom%0A%0A%0910%20atRandom%0A%0A...which%20is%20also%20implemented%20in%20SequencableCollection%20so%20you%20can%20easy%20pick%20an%20element%20at%20random%3A%0A%0A%09%23%28%27a%27%20%27b%27%20%27c%27%29%20atRandom')
+smalltalk.Random.comment=unescape('Random%20is%20a%20random%20number%20generator%20and%20is%20implemented%20as%20a%20wrapper%20around%20javascript%20Math.random%28%29%20and%20is%20trivially%20used%20like%20this%3A%0A%0A%09Random%20new%20next%0A%0AThis%20will%20return%20a%20float%20x%20where%20x%20%3C%201%20and%20x%20%3E%200.%20If%20you%20want%20a%20random%20integer%20from%201%20to%2010%20you%20can%20use%20%23atRandom%0A%0A%0910%20atRandom%0A%0A...and%20if%20you%20want%20a%20random%20number%20in%20a%20specific%20interval%20this%20also%20works%3A%0A%0A%09%283%20to%3A%207%29%20atRandom%0A%0A...but%20be%20aware%20that%20%23to%3A%20does%20not%20create%20an%20Interval%20as%20in%20other%20Smalltalks%20but%20in%20fact%20an%20Array%20of%20numbers%2C%20so%20it%27s%20better%20to%20use%3A%0A%0A%095%20atRandom%20+%202%0A%0ASince%20%23atRandom%20is%20implemented%20in%20SequencableCollection%20you%20can%20easy%20pick%20an%20element%20at%20random%3A%0A%0A%09%23%28%27a%27%20%27b%27%20%27c%27%29%20atRandom%0A%0A...or%20perhaps%20a%20letter%20from%20a%20String%3A%0A%0A%09%27abc%27%20atRandom')
 smalltalk.addMethod(
 unescape('_next'),
 smalltalk.method({
@@ -3458,6 +3508,7 @@ smalltalk.Random);
 
 
 smalltalk.addClass('Point', smalltalk.Object, ['x', 'y'], 'Kernel-Objects');
+smalltalk.Point.comment=unescape('A%20Point%20represents%20an%20x-y%20pair%20of%20numbers%20usually%20designating%20a%20geometric%20coordinate.%0APoints%20are%20traditionally%20created%20using%20the%20binary%20%23@%20message%20to%20a%20number%3A%0A%0A%09100@120%0A%0APoints%20can%20then%20be%20arithmetically%20manipulated%20using%20math%3A%0A%0A%09100@100%20+%20%2810@10%29%0A%0ACreating%20a%20Point%20with%20a%20negative%20y-value%20will%20need%20a%20space%20after%20@%20in%20order%20to%20avoid%20a%20parsing%20error%2C%0A10@%20-5%20works%20fine%2C%20but%20not%2010@-5%0A%0AAmber%20does%20not%20have%20much%20behavior%20in%20this%20class%20out-of-the-box.')
 smalltalk.addMethod(
 unescape('_x'),
 smalltalk.method({
@@ -3618,6 +3669,22 @@ referencedClasses: []
 }),
 smalltalk.Point);
 
+smalltalk.addMethod(
+unescape('_printString'),
+smalltalk.method({
+selector: unescape('printString'),
+category: 'printing',
+fn: function (){
+var self=this;
+return smalltalk.send((smalltalk.String || String), "_streamContents_", [(function(stream){smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.send(self['@x'], "_printString", []), "__comma", [unescape("@")])]);((($receiver = smalltalk.send(smalltalk.send(self['@y'], "_notNil", []), "_and_", [(function(){return smalltalk.send(self['@y'], "_negative", []);})])).klass === smalltalk.Boolean) ? ($receiver ? (function(){return smalltalk.send(stream, "_space", []);})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return smalltalk.send(stream, "_space", []);})]));return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self['@y'], "_printString", [])]);})]);
+return self;},
+args: [],
+source: unescape('printString%0A%09%22Print%20receiver%20in%20classic%20x@y%20notation.%22%0A%0A%09%5EString%20streamContents%3A%20%5B%3Astream%20%7C%0A%09%09stream%20nextPutAll%3A%20x%20printString%2C%20%27@%27.%0A%09%09%28y%20notNil%20and%3A%20%5By%20negative%5D%29%0A%09%09%09ifTrue%3A%20%5B%0A%09%09%09%09%22Avoid%20ambiguous%20@-%20construct%22%0A%09%09%09%09stream%20space%5D.%0A%09%09stream%20nextPutAll%3A%20y%20printString%5D'),
+messageSends: ["streamContents:", "nextPutAll:", unescape("%2C"), "printString", "ifTrue:", "and:", "notNil", "negative", "space"],
+referencedClasses: ["String"]
+}),
+smalltalk.Point);
+
 
 smalltalk.addMethod(
 unescape('_x_y_'),

+ 167 - 88
amber/st/Documentation.st

@@ -143,94 +143,6 @@ NOTE: We can use any webDAV server and Apache2 has been used earlier and works f
 '
 !
 
-ch4FirstApp
-	^DocChapter new
-		title: 'A first application';
-		contents: '
-
-Let''s make Hello World in Amber.
-
-First, you need a place for your new project. I made a new directory under amber:
-
-    amber/projects/hello
-
-This will store your project files. To get started, add a new index.html file to this folder, as well as empty js and st folders.
-
-Your index.html can be really basic. The most important thing it does is include amber.js and run loadAmber. Here is a basic index.html you can use:
-
-
-    <!!DOCTYPE html>
-    <html>
-      <head>
-        <title>My First Amber Project</title>
-        <script src="../../js/amber.js" type="text/javascript"></script>
-        <script type="text/javascript">
-          loadAmber({
-            files: [],
-            prefix: ''projects/hello/js'',
-            ready: function() {
-              
-            }}); 
-        </script>
-      </head>
-      <body>
-        <article>
-          <h1>My First Amber Project</h1>
-          <button onclick="smalltalk.Browser._open()">class browser</button>
-          <button id="sayHello">say hello</button>
-        </article>
-      </body>
-    </html>
-
-Now start up amber with node.js and navigate to  http://localhost:4000/projects/hello/index.html
-
-It''s boring so far, so lets write some code. Click the button to open the class browser. Find an existing class and change its name to Hello and its package to HelloApp. 
-Then click save. This creates a new class and leaves the old one intact, it doesn''t overwrite it. Your class will look like this:
-
-    Object subclass: #Hello
-        instanceVariableNames: ''''
-        package: ''HelloApp''
-
-Now click save and navigate to your new class in its new package.
- Then click ''commit package''. You just created a new class and saved your work. 
-On your file system check out your js and st folders. Your new class is now saved in both JavaScript and Smalltalk.
-
-Now, refresh your browser page and reopen the class browser. Oh no, your new class is gone!! To load your new class automatically, you have to add it in index.html. Make your JavaScript look like this:
-
-
-    loadAmber({
-        files: [''HelloApp.js''],
-        prefix: ''projects/hello/js'',
-        ready: function() {      
-    }}); 
-
-Save and refresh again. Now your class is loaded and shows up in the class browser.
-
-Now, let''s make this class do something. Create a new message in the class browser by navigating to your class, then clicking ''not yet classified'' and fill in a simple message. Try this for example:
-
-    begin
-	"Makes me say hello to the user."
-
-	| msg button |
-	msg := ''Hello world!!''.
-	button := ''#sayHello'' asJQuery.
-	button click: [button after: ''<p>'' , msg , ''</p>''].
-
-Your message isn''t too helpful if it doesn''t get called. Save it, commit the package, then edit index.html again. You can write JavaScript code that sends a message to Smalltalk:
-
-    loadAmber({
-        files: [''HelloApp.js''],
-        prefix: ''projects/hello/js'', // path for js files i think
-        ready: function() {
-          $(function() {
-            smalltalk.Hello._new()._begin();
-          });
-    }}); 
-
-From there, you can create new Smalltalk classes and messages to build up your app. Enjoy!!
-'
-!
-
 ch5Index
 	^ClassesIndexChapter new
 !
@@ -241,6 +153,10 @@ ch6KernelObjects
 
 ch7KernelClasses
 	^PackageDocChapter on: (Package named: 'Kernel-Classes')
+!
+
+ch4Tutorials
+	^TutorialsChapter new
 ! !
 
 !DocumentationBuilder methodsFor: 'routing'!
@@ -660,3 +576,166 @@ id: aString
 	id := aString
 ! !
 
+DocChapter subclass: #TutorialsChapter
+	instanceVariableNames: ''
+	category: 'Documentation'!
+
+!TutorialsChapter methodsFor: 'accessing'!
+
+title
+	^'Tutorials'
+!
+
+contents
+	^'Here''s a serie of tutorials. If you are new to Smalltalk, you can also learn Amber online with [ProfStef](http://www.amber-lang.net/learn.html)'
+!
+
+chapters
+	^{ self firstAppChapter. self counterChapter }
+!
+
+firstAppChapter
+	^DocChapter new
+		title: 'A first application';
+		contents: '
+
+Let''s make Hello World in Amber.
+
+First, you need a place for your new project. I made a new directory under amber:
+
+    amber/projects/hello
+
+This will store your project files. To get started, add a new index.html file to this folder, as well as empty js and st folders.
+
+Your index.html can be really basic. The most important thing it does is include amber.js and run loadAmber. Here is a basic index.html you can use:
+
+
+    <!!DOCTYPE html>
+    <html>
+      <head>
+        <title>My First Amber Project</title>
+        <script src="../../js/amber.js" type="text/javascript"></script>
+        <script type="text/javascript">
+          loadAmber({
+            files: [],
+            prefix: ''projects/hello/js'',
+            ready: function() {
+              
+            }}); 
+        </script>
+      </head>
+      <body>
+        <article>
+          <h1>My First Amber Project</h1>
+          <button onclick="smalltalk.Browser._open()">class browser</button>
+          <button id="sayHello">say hello</button>
+        </article>
+      </body>
+    </html>
+
+Now start up amber with node.js and navigate to  http://localhost:4000/projects/hello/index.html
+
+It''s boring so far, so lets write some code. Click the button to open the class browser. Find an existing class and change its name to Hello and its package to HelloApp. 
+Then click save. This creates a new class and leaves the old one intact, it doesn''t overwrite it. Your class will look like this:
+
+    Object subclass: #Hello
+        instanceVariableNames: ''''
+        package: ''HelloApp''
+
+Now click save and navigate to your new class in its new package.
+ Then click ''commit package''. You just created a new class and saved your work. 
+On your file system check out your js and st folders. Your new class is now saved in both JavaScript and Smalltalk.
+
+Now, refresh your browser page and reopen the class browser. Oh no, your new class is gone!! To load your new class automatically, you have to add it in index.html. Make your JavaScript look like this:
+
+
+    loadAmber({
+        files: [''HelloApp.js''],
+        prefix: ''projects/hello/js'',
+        ready: function() {      
+    }}); 
+
+Save and refresh again. Now your class is loaded and shows up in the class browser.
+
+Now, let''s make this class do something. Create a new message in the class browser by navigating to your class, then clicking ''not yet classified'' and fill in a simple message. Try this for example:
+
+    begin
+	"Makes me say hello to the user."
+
+	| msg button |
+	msg := ''Hello world!!''.
+	button := ''#sayHello'' asJQuery.
+	button click: [button after: ''<p>'' , msg , ''</p>''].
+
+Your message isn''t too helpful if it doesn''t get called. Save it, commit the package, then edit index.html again. You can write JavaScript code that sends a message to Smalltalk:
+
+    loadAmber({
+        files: [''HelloApp.js''],
+        prefix: ''projects/hello/js'', // path for js files i think
+        ready: function() {
+          $(function() {
+            smalltalk.Hello._new()._begin();
+          });
+    }}); 
+
+From there, you can create new Smalltalk classes and messages to build up your app. Enjoy!!
+'
+!
+
+counterChapter
+	^DocChapter new
+		title: 'The counter application';
+		contents: '
+
+This tutorial will teach you how to build HTML with Amber using jQuery and the HTMLCanvas API. It is freely adapted from 
+the [Seaside counter example](http://www.seaside.st/about/examples/counter)
+
+##The counter widget
+
+The counter is the most basic example of a widget. It allows to increment and decrement a number by clicking a button.
+
+Amber already comes with a counter example in the `Examples` package. To avoid class name conflict, we''ll name our counter class `TCounter`.
+
+    Widget subclass: #TCounter
+        instanceVariableNames: ''count header''
+        package: ''Tutorials''
+
+The first method is used to initialize the component with the default state, in this case we set the counter to 0:
+
+    initialize
+        super initialize.
+        count := 0
+
+The method used for rendering a widget is `#renderOn:`. It takes an instance of HTMLCanvas as parameter. 
+The `header` h1 kept as an instance variable, so when the count value change, we can update it''s contents accordingly.
+
+    renderOn: html
+        header := html h1 
+            with: count asString;
+            yourself.
+        html button
+            with: ''++'';
+            onClick: [self increase].
+        html button
+            with: ''--'';
+            onClick: [self decrease]
+
+The counter is almost ready. All we need now is to implement the two action methods `#increase` and `#decrease` to change the state 
+of our counter and update its header.
+
+    increase
+        count := count + 1.
+        header contents: [:html | html with: count asString]
+
+    decrease
+        count := count - 1.
+        header contents: [:html | html with: count asString]
+
+
+That''s it!! We can now display an instance of TCounter by rendering it on the page using jQuery:
+
+    TCounter new appendToJQuery: ''body'' asJQuery
+
+'
+! !
+

+ 90 - 4
amber/st/Kernel-Objects.st

@@ -315,6 +315,32 @@ initialize
 Object subclass: #Smalltalk
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
+!Smalltalk commentStamp!
+Smalltalk has only one instance, accessed with `Smalltalk current`. 
+It represents the global JavaScript variable `smalltalk` declared in `js/boot.js`.
+
+The `smalltalk` object holds all class and packages defined in the system.
+
+## Classes
+
+Classes can be accessed using the following methods:
+
+- `#classes` answers the full list of Smalltalk classes in the system
+- `#at:` answers a specific class of `nil`
+
+## Packages
+
+Packages can be accessed using the following methods:
+
+- `#packages` answers the full list of packages
+- `#packageAt:` answers a specific class of `nil`
+
+__note:__ classes and packages are accessed using strings, not symbols
+
+## Parsing
+
+The `#parse:` method is used to parse Smalltalk source code. 
+It requires the `Compiler` package and the `js/parser.js` parser file in order to work!
 
 !Smalltalk methodsFor: 'accessing'!
 
@@ -839,6 +865,22 @@ even
 
 odd
 	^ self even not
+!
+
+negative
+	"Answer whether the receiver is mathematically negative."
+
+	^ self < 0
+!
+
+positive
+	"Answer whether the receiver is positive or equal to 0. (ST-80 protocol)."
+
+	^ self >= 0
+!
+
+isZero
+	^self = 0
 ! !
 
 !Number methodsFor: 'timeouts/intervals'!
@@ -1141,6 +1183,10 @@ millisecondsToRun: aBlock
 Object subclass: #UndefinedObject
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
+!UndefinedObject commentStamp!
+UndefinedObject describes the behavior of its sole instance, `nil`. `nil` represents a prior value for variables that have not been initialized, or for results which are meaningless.
+
+`nil` is the Smalltalk representation of the `undefined` JavaScript object.!
 
 !UndefinedObject methodsFor: 'class creation'!
 
@@ -1215,17 +1261,29 @@ Object subclass: #Random
 	instanceVariableNames: ''
 	category: 'Kernel-Objects'!
 !Random commentStamp!
-Random is just a wrapper around javascript Math.random() and is trivially used like this:
+Random is a random number generator and is implemented as a wrapper around javascript Math.random() and is trivially used like this:
 
 	Random new next
 
-This will return a float x where x < 1 and x > 0. If you want a random integer between 1 and 10 you can use #atRandom
+This will return a float x where x < 1 and x > 0. If you want a random integer from 1 to 10 you can use #atRandom
 
 	10 atRandom
 
-...which is also implemented in SequencableCollection so you can easy pick an element at random:
+...and if you want a random number in a specific interval this also works:
+
+	(3 to: 7) atRandom
+
+...but be aware that #to: does not create an Interval as in other Smalltalks but in fact an Array of numbers, so it's better to use:
+
+	5 atRandom + 2
 
-	#('a' 'b' 'c') atRandom!
+Since #atRandom is implemented in SequencableCollection you can easy pick an element at random:
+
+	#('a' 'b' 'c') atRandom
+
+...or perhaps a letter from a String:
+
+	'abc' atRandom!
 
 !Random methodsFor: 'accessing'!
 
@@ -1240,6 +1298,20 @@ next: anInteger
 Object subclass: #Point
 	instanceVariableNames: 'x y'
 	category: 'Kernel-Objects'!
+!Point commentStamp!
+A Point represents an x-y pair of numbers usually designating a geometric coordinate.
+Points are traditionally created using the binary #@ message to a number:
+
+	100@120
+
+Points can then be arithmetically manipulated using math:
+
+	100@100 + (10@10)
+
+Creating a Point with a negative y-value will need a space after @ in order to avoid a parsing error,
+10@ -5 works fine, but not 10@-5
+
+Amber does not have much behavior in this class out-of-the-box.!
 
 !Point methodsFor: 'accessing'!
 
@@ -1288,6 +1360,20 @@ asPoint
 	^self
 ! !
 
+!Point methodsFor: 'printing'!
+
+printString
+	"Print receiver in classic x@y notation."
+
+	^String streamContents: [:stream |
+		stream nextPutAll: x printString, '@'.
+		(y notNil and: [y negative])
+			ifTrue: [
+				"Avoid ambiguous @- construct"
+				stream space].
+		stream nextPutAll: y printString]
+! !
+
 !Point class methodsFor: 'instance creation'!
 
 x: aNumber y: anotherNumber

+ 11 - 1
css/documentation.css

@@ -5,7 +5,16 @@
 
 #header {
     text-align: left;
-    margin: 20px;
+    margin: 20px 0;
+}
+
+#header .left {
+    float: left;
+    margin-right: 20px;
+}
+
+#header h1 {
+    margin: 10px 0;
 }
 
 .documentation {
@@ -28,6 +37,7 @@
     border: 1px solid #ccc;
     background: #eee;
     padding: 5px;
+    margin: 0 20px;
 }
 
 .documentation code {

+ 28 - 11
documentation.html

@@ -8,24 +8,41 @@
     <link rel="stylesheet" type="text/css" href='css/documentation.css' /> 
     <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico"/> 
     <link href='http://fonts.googleapis.com/css?family=Istok+Web' rel='stylesheet' type='text/css'> 
-    <script type='text/javascript' src='amber/js/amber.js'></script> 
-    <script type='text/javascript' src='amber/js/lib/showdown.js'></script> 
+    <script type='text/javascript' src='js/amber.js'></script> 
+    <script type='text/javascript' src='js/lib/showdown.js'></script> 
+    <script type="text/javascript">
+
+      var _gaq = _gaq || [];
+      _gaq.push(['_setAccount', 'UA-2246313-6']);
+      _gaq.push(['_trackPageview']);
+
+      (function() {
+      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+      })();
+
+    </script>
   </head> 
   <body> 
     
     <div id="wrapper"> 
       
       <div id="header"> 
-	<h1>Documentation</h1>
-	<h2>Version 0.9.1</h2>
-	<img src="images/amber.png"/> 
+	<img class="left" src="images/amber_small.png"/> 
+	<div class="left">
+	  <h1>Documentation</h1>
+	  <h2>Version 0.9.1</h2>
+	</div>
+	<div class="clear"></div>
       <ul id="tabs"> 
-	<li><a target="_blank" href="http://amber-lang.net/index.html">Overview</a></li> · 
-	<li><a target="_blank" href="http://amber-lang.net/index.html#download">Download</a></li> · 
-	<li><a target="_blank" href="http://amber-lang.net/learn.html">Learn</a></li> ·
-	<li><a target="_blank" href="http://amber-lang.net/documentation.html">Documentation</a></li> ·
-	<li><a target="_blank" target="_blank" href="https://github.com/NicolasPetton/amber">Source</a></li> 
-      </ul> 
+	<li><a href="index.html">Overview</a></li> · 
+	<li><a href="index.html#download">Download</a></li> · 
+	<li><a href="learn.html">Learn</a></li> ·
+	<li><a id="doc_link" href="documentation.html">Documentation</a></li> ·
+	<li><a target="_blank" href="https://github.com/NicolasPetton/amber">Source</a></li> 
+      </ul>
+
       
       <div class="clear"></div> 
     </div>

BIN
images/amber_small.png


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