[NTLK] Shell arguments in NEWT/0?

Morgan Aldridge morgant at makkintosshu.com
Wed Jan 11 12:45:59 EST 2012


On Wed, Jan 11, 2012 at 8:41 AM, Matthias Melcher <mm at matthiasm.com> wrote:
>
> On 11.01.2012, at 04:36, Morgan Aldridge wrote:
>
>> Quick question for the few of you out there that have used NEWT/0--is
>> that anyone other than Matthias, Eckhart, and Paul?--when calling it
>> from the command line, do you have any access to the command line
>> arguments (argv & argc; $0, $1, $2... & $#; or whatever) from the
>> NewtonScript side? If so, how, if not, any idea how hard it'd be to
>> add?
>
> Ah, what a nice idea! I don;t think this exists, but it should be fairly easy to implement.
>
> Solution 1:
> Use DefGlobalFunction to define an access function the the arguments:
>
>                NewtDefGlobalFunc(
>                        NSSYM(GetVArgs),
>                        GetVArgs,
>                        0,
>                        "GetVArgs()");
>
> Then if the user calls this function, use the NewtCreate... functions to create an array of strings that you can return.
>
> Solution 2:
> Use NcSetGlobalVar(NSSYM(VArgs), NewtMakeArray(...)); to generate a globally accesible array of the command line parameters.

Thanks! That gave me enough to look through the NEWT/0 code and I have
a rough idea of what the above means and see that the arguments do, in
fact, make it that far.

I see the references to NSSYM0(_ARGV_) on the C side, so how does it
become NSSYM(VArgs) or NSSYM(GetVArgs) on the NewtonScript side? Is
there a translation somewhere that I missed or am I misunderstanding?

Thanks again,

Morgan
---
http://makkintosshu.com/
http://seriesparts.com/
http://rikuwoiku.com/
http://unna.org/



More information about the NewtonTalk mailing list