Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G


Jump to: navigation, search

Howto:Extend Nasal

644 bytes added, 17:09, 16 April 2012
Hash Manipulation API: using a HASHSET macro
int naMember_get(naRef obj, naRef field, naRef* out);
int naMember_cget(naRef obj, const char* field, naRef* out);
A common way to set hash field members easily, is using a simple macro like:
<syntaxhighlight lang="C">
#define HASHSET(s,l,n) naHash_set(navdata, naStr_fromdata(naNewString(c),s,l),n)
//... do your hash setup here
#undef HASHSET
As you can see, this allows you to easily set up hash fields.
The macro can be even further simplified by automatically computing the length of the hash key using strlen() instead of the explicit length argument:
<syntaxhighlight lang="C">
#define HASHSET(s,n) naHash_set(navdata, naStr_fromdata(naNewString(c),s,strlen(s)),n)
//... do your hash setup here
#undef HASHSET
= Conversion & Comparison routines =

Navigation menu