Added comments into examples

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@16557 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Urbanek 2003-04-27 14:48:24 +00:00
parent 7e1f23c3c9
commit 7e338f778b
6 changed files with 44 additions and 23 deletions

View file

@ -1,19 +1,21 @@
" hello.st
" hello
Say hello to someone specified as an argument.
Ussage:
stexec hello.st name
"
((Args count) < 1 )
" Is name specified? (Is there some script argument?) "
((Args count) > 0 )
ifTrue:
[
Transcript showLine:'Hello ... who?'
]
ifFalse:
[
" See ..../Library/StepTalk/Environments/Foundation-operators.stenv
or Source/Environments/Foundation-operators.stenv
"
" Args is an array of script arguments. "
Transcript showLine: ('Hello ', (Args @ 0), '!').
]
ifFalse:
[
Transcript showLine:'Hello ... who?'
]

View file

@ -1,18 +1,28 @@
" List contents of current directory "
" Script variables "
| fileManager path files dict |
" Get default file manager "
fileManager := NSFileManager defaultManager.
" Get current path "
path := fileManager currentDirectoryPath.
" Write label on Transcript (for shell it is standard output) "
Transcript showLine:( 'Listing of directory: ', path ).
" Get files from 'path' "
files := fileManager directoryContentsAtPath:path.
" For each file from files do the following ..."
files do:
[ :file |
dict := fileManager fileAttributesAtPath: (path / file)
traverseLink:NO.
Transcript showLine:file.
Transcript showLine: (' Type: ', (dict @ NSFileType)).

View file

@ -1,4 +1,5 @@
" Simple example "
" Smalltalk math example "
Transcript show:'1 + 1 = '.
Transcript showLine: (1 + 1)

View file

@ -1,23 +1,33 @@
" Notification example "
" Notification example
Show usage of NSNotification class and notification handling in scripts
"
[|
" Main script method "
main
| nc |
| center |
nc := NSNotificationCenter defaultCenter.
center := NSNotificationCenter defaultCenter.
Transcript showLine:'Registering for notification'.
nc addObserver:self selector:#notification: name:'Notification' object:nil.
Transcript showLine:'Registering for notification.'.
Transcript showLine:'Posting notification'.
nc postNotificationName:'Notification' object:nil.
center addObserver:self
selector:#handleNotification:
name:'Notification' object:nil.
Transcript showLine:'Posting notification.'.
center postNotificationName:'Notification' object:nil.
^self
!
notification:notif
" Method as notification handler "
handleNotification:notif
Transcript showLine:'Notification received'.
Transcript showLine:'Notification received.'.
^self

4
TODO
View file

@ -3,10 +3,7 @@ TODO list
1 handle 'connection did die' notification for distant objects in STEnvironment
2 fix class-info lookup for proxies in STEnvironment
3 implement NSRect object
4 write documentation for developers and users
5 Smalltalk: separate compiler and compilation context
7 make GDL2 bundle automatically if GDL2 is present
8 prevent multiple loading of bundles in STEnvironment
9 create a 'Shell' scripting environment
10 Make loading of frameworks easier in STEnvironment, something like
loadFrameworkWithName:
@ -14,3 +11,4 @@ TODO list
passive application scripting (without linking) and active app. scripting
(linking with the framewotk). Give it some reasonable name, becauase that one
is already used by Apple
12 Rename STEnvironment to STContext (better name for that object).

View file

@ -4,7 +4,7 @@
# The version number of this release.
MAJOR_VERSION=0
MINOR_VERSION=7
SUBMINOR_VERSION=1
SUBMINOR_VERSION=2
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}