jsish
Jsi-Lite
Not logged in

A subset of the C functions for use without the script engine. This is made use of as follows:

#define JSI_LITE_ONLY
#include "jsi.c"
//Your code goes here.

Demo Code

Following is some demo code:


Jsi_DString

Jsi_DString provides a dynamic string implementation where heap memory allocation is avoid for short strings.

Jsi_DString is documented here.


Jsi_Hash

This pages describes how to use Jsi_Hash. Search for Jsi_Hash in jsi.h for details.

Hash provides simple hash table functionality.

int isNew;
Jsi_Hash *tbl = Jsi_HashNew(interp, JSI_KEYS_STRING, NULL);
hPtr = Jsi_HashEntryNew(tbl, "foo", &isNew);
Jsi_HashEntrySet(hPtr, 99);
Jsi_HashSet(tbl, "bar", 100);
Jsi_HashSearch search;
for (hPtr = Jsi_HashEntryFirst(tbl, &search);
    hPtr != NULL; hPtr = Jsi_HashEntryNext(&search)) {
    key = Jsi_HashKeyGet(hPtr);
    int n = Jsi_HashValueGet(hPtr);
}

There are plenty of examples using Hash in the Jsi source code.


Jsi_Tree

The underlying data structure for objects in JSI is a tree Red-Black trees with invariant node pointers: nodes are allocated using a single malloc, including space for the key. This introduces a problem in that varying string keys can not be copied between nodes, which is required when re-balancing the tree. Although tree supports swapping node positions instead of keys, objects instead use a key of type STRINGPTR, a combination Hash table and and Tree, which is fairly efficient because objects often share keys.


Jsi_List

Jsi_List implements a double linked list.

Jsi_Map

Jsi_Map encapsulates Hash/Tree/List.


Jsi_DbQuery

Jsi_OptionSpec