Jump to content

  • Log In with Google      Sign In   
  • Create Account


Nasal, anyone


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Rickmeister   Members   -  Reputation: 182

Like
0Likes
Like

Posted 02 August 2005 - 05:07 PM

Hehe.. Bad name for a script language anyway.. If you don't have a clue what I'm talking about Click here! Anyone who has tried it?? If so, I've got a question since the documentation is pretty close to non-existant.. It's extremely easy to extend and embed, but I've skimmed through the sourcecode and read all the comments in it and I still haven't found out if it's possible to call separate functions in a scriptfile.. This might be related to lack of sleep for the moment, and the fact that I'm beginning to feal really, really frustrated.. Besides this setback it's perfect for my project as I'm searching for something that doesn't rely on dll;s (can't use them due to certain issues) or bloats my exe when linked to statically. Nasal adds about 35k to my exe, and I can live with that. I've mailed to the author about this, but it's been a few days and he hasn't answered yet, and I've tried google but searching for 'Nasal' there gives a few interesting hits..

Sponsor:

#2 Ranger_One   Members   -  Reputation: 300

Like
0Likes
Like

Posted 03 August 2005 - 01:28 AM

Well I've not seen it before now, but it's style is nice and pretty and the design doc is clear and forthright. I'm going to play with it more. I'll let you know if I figure anything out.

One this bugs me though, about the lexical closures. I must not understand them all that well since the example seems to be in error...


#3 Ranger_One   Members   -  Reputation: 300

Like
0Likes
Like

Posted 03 August 2005 - 01:34 AM

"I still haven't found out if it's possible to call separate functions in a scriptfile"

Do you mean: Call script functions from the host application?


#4 Rickmeister   Members   -  Reputation: 182

Like
0Likes
Like

Posted 03 August 2005 - 02:38 AM

Quote:
Original post by Ranger_One
"I still haven't found out if it's possible to call separate functions in a scriptfile"

Do you mean: Call script functions from the host application?


Eehh.. Yeah.. Maybe.. English is not my 1st language, so I might have got it all wrong.. but I guess so..



#5 Rickmeister   Members   -  Reputation: 182

Like
0Likes
Like

Posted 03 August 2005 - 03:09 AM

Better clarify myself here..

If I've got a scriptfile like this (some sort of pseudo-nasal..[smile]):

testFunc = func {

x = arg[0];
for(x; x < 10; x++) {

doSomethingInCCode(x);
}
}


The doSomethingInCCode is a native C function declared like this:


static naRef doSomethingInCCode(naContext c, naRef me, naRef args);
/* and registered with the nasal (hehe.. still think it's funny) VM */

naHash_set(namespace, NASTR("doSomeThinsInCCode"),
naNewFunc(ctx, naNewCCode(ctx, doSomeThingInCCode)));


Is it possible to call the "testFunc" function in the script? I hope to get an answer from Andy Ross later.

#6 Rickmeister   Members   -  Reputation: 182

Like
0Likes
Like

Posted 03 August 2005 - 05:49 AM

Quote:
Andy Ross tells me:
The final argument to naCall is a hash containing the local namespace. So you can get the value of any symbols you set in there using a naHash_get() call on it.

Beware, though, that holding onto naRef structures in the outer
program can be dangerous -- you need to make sure that they are always
"findable" by the garbage collector, or else they will be cleaned up
from underneath you. There is a primitive naSave() API to do this,
but the best way is to make sure that they are always referenced from
another findable Nasal object.




Works like a charm now :)





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS