mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-22 02:51:05 +00:00
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:
parent
7e1f23c3c9
commit
7e338f778b
6 changed files with 44 additions and 23 deletions
|
@ -1,19 +1,21 @@
|
||||||
" hello.st
|
" hello
|
||||||
|
|
||||||
|
Say hello to someone specified as an argument.
|
||||||
|
|
||||||
Ussage:
|
Ussage:
|
||||||
stexec hello.st name
|
stexec hello.st name
|
||||||
"
|
"
|
||||||
|
|
||||||
((Args count) < 1 )
|
" Is name specified? (Is there some script argument?) "
|
||||||
|
|
||||||
|
((Args count) > 0 )
|
||||||
ifTrue:
|
ifTrue:
|
||||||
[
|
[
|
||||||
Transcript showLine:'Hello ... who?'
|
" Args is an array of script arguments. "
|
||||||
]
|
|
||||||
ifFalse:
|
|
||||||
[
|
|
||||||
" See ..../Library/StepTalk/Environments/Foundation-operators.stenv
|
|
||||||
or Source/Environments/Foundation-operators.stenv
|
|
||||||
"
|
|
||||||
|
|
||||||
Transcript showLine: ('Hello ', (Args @ 0), '!').
|
Transcript showLine: ('Hello ', (Args @ 0), '!').
|
||||||
]
|
]
|
||||||
|
ifFalse:
|
||||||
|
[
|
||||||
|
Transcript showLine:'Hello ... who?'
|
||||||
|
]
|
||||||
|
|
|
@ -1,18 +1,28 @@
|
||||||
|
" List contents of current directory "
|
||||||
|
|
||||||
|
" Script variables "
|
||||||
| fileManager path files dict |
|
| fileManager path files dict |
|
||||||
|
|
||||||
|
" Get default file manager "
|
||||||
fileManager := NSFileManager defaultManager.
|
fileManager := NSFileManager defaultManager.
|
||||||
|
|
||||||
|
|
||||||
|
" Get current path "
|
||||||
path := fileManager currentDirectoryPath.
|
path := fileManager currentDirectoryPath.
|
||||||
|
|
||||||
|
" Write label on Transcript (for shell it is standard output) "
|
||||||
Transcript showLine:( 'Listing of directory: ', path ).
|
Transcript showLine:( 'Listing of directory: ', path ).
|
||||||
|
|
||||||
|
" Get files from 'path' "
|
||||||
files := fileManager directoryContentsAtPath:path.
|
files := fileManager directoryContentsAtPath:path.
|
||||||
|
|
||||||
|
" For each file from files do the following ..."
|
||||||
files do:
|
files do:
|
||||||
[ :file |
|
[ :file |
|
||||||
|
|
||||||
dict := fileManager fileAttributesAtPath: (path / file)
|
dict := fileManager fileAttributesAtPath: (path / file)
|
||||||
traverseLink:NO.
|
traverseLink:NO.
|
||||||
|
|
||||||
Transcript showLine:file.
|
Transcript showLine:file.
|
||||||
|
|
||||||
Transcript showLine: (' Type: ', (dict @ NSFileType)).
|
Transcript showLine: (' Type: ', (dict @ NSFileType)).
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
" Simple example "
|
" Smalltalk math example "
|
||||||
|
|
||||||
|
|
||||||
Transcript show:'1 + 1 = '.
|
Transcript show:'1 + 1 = '.
|
||||||
Transcript showLine: (1 + 1)
|
Transcript showLine: (1 + 1)
|
||||||
|
|
|
@ -1,23 +1,33 @@
|
||||||
" Notification example "
|
" Notification example
|
||||||
|
|
||||||
|
Show usage of NSNotification class and notification handling in scripts
|
||||||
|
|
||||||
|
"
|
||||||
[|
|
[|
|
||||||
|
|
||||||
|
" Main script method "
|
||||||
main
|
main
|
||||||
| nc |
|
| center |
|
||||||
|
|
||||||
nc := NSNotificationCenter defaultCenter.
|
center := NSNotificationCenter defaultCenter.
|
||||||
|
|
||||||
Transcript showLine:'Registering for notification'.
|
Transcript showLine:'Registering for notification.'.
|
||||||
nc addObserver:self selector:#notification: name:'Notification' object:nil.
|
|
||||||
|
|
||||||
Transcript showLine:'Posting notification'.
|
center addObserver:self
|
||||||
nc postNotificationName:'Notification' object:nil.
|
selector:#handleNotification:
|
||||||
|
name:'Notification' object:nil.
|
||||||
|
|
||||||
|
Transcript showLine:'Posting notification.'.
|
||||||
|
|
||||||
|
center postNotificationName:'Notification' object:nil.
|
||||||
|
|
||||||
^self
|
^self
|
||||||
!
|
!
|
||||||
|
|
||||||
notification:notif
|
" Method as notification handler "
|
||||||
|
handleNotification:notif
|
||||||
|
|
||||||
Transcript showLine:'Notification received'.
|
Transcript showLine:'Notification received.'.
|
||||||
|
|
||||||
^self
|
^self
|
||||||
|
|
||||||
|
|
4
TODO
4
TODO
|
@ -3,10 +3,7 @@ TODO list
|
||||||
1 handle 'connection did die' notification for distant objects in STEnvironment
|
1 handle 'connection did die' notification for distant objects in STEnvironment
|
||||||
2 fix class-info lookup for proxies in STEnvironment
|
2 fix class-info lookup for proxies in STEnvironment
|
||||||
3 implement NSRect object
|
3 implement NSRect object
|
||||||
4 write documentation for developers and users
|
|
||||||
5 Smalltalk: separate compiler and compilation context
|
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
|
9 create a 'Shell' scripting environment
|
||||||
10 Make loading of frameworks easier in STEnvironment, something like
|
10 Make loading of frameworks easier in STEnvironment, something like
|
||||||
loadFrameworkWithName:
|
loadFrameworkWithName:
|
||||||
|
@ -14,3 +11,4 @@ TODO list
|
||||||
passive application scripting (without linking) and active app. scripting
|
passive application scripting (without linking) and active app. scripting
|
||||||
(linking with the framewotk). Give it some reasonable name, becauase that one
|
(linking with the framewotk). Give it some reasonable name, becauase that one
|
||||||
is already used by Apple
|
is already used by Apple
|
||||||
|
12 Rename STEnvironment to STContext (better name for that object).
|
||||||
|
|
2
Version
2
Version
|
@ -4,7 +4,7 @@
|
||||||
# The version number of this release.
|
# The version number of this release.
|
||||||
MAJOR_VERSION=0
|
MAJOR_VERSION=0
|
||||||
MINOR_VERSION=7
|
MINOR_VERSION=7
|
||||||
SUBMINOR_VERSION=1
|
SUBMINOR_VERSION=2
|
||||||
|
|
||||||
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
|
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue