[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] scripts, debugging & arguments
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] scripts, debugging & arguments |
Date: |
Wed, 22 Sep 2004 09:06:15 +0200 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040207) |
But: how do we give that script parameters ?
We could do Smalltalk at: #arguments put: #('foo'), followed by the file
in, but that obvious concurrency problems. (i.e. testing two scripts in
parallel or similar..).
You can do this by:
1) adding an arguments variable to Process (also in dict.c and interp.h!).
2) the setter is standard; the getter uses SystemDictionary>>#arguments'
code if the variable is nil *without initializing the variable though*.
Also add `primArguments' doing just ^arguments.
3a) in BlockClosure>>#newProcess, initialize the arguments variable of
the new process to `Processor activeProcess primArguments'.
3b) Do a similar thing in the VM where it creates instances of
CallinProcess.
4) Change SystemDictionary>>#arguments to "^Processor activeProcess
arguments".
I'll do this myself if you want.
So, can we do something whereby scripts that check for their parameters
can be given custom parameters as part of the fileIn:
FileStream fileIn: 'foo.st' withArguments: #('foo.png')
[ Processor activeProcess arguments: #('foo.png').
FileStream fileIn: 'foo.st' ] fork.
Paolo