js_create(3)

NAME
js_create - create a new js_string object

SYNOPSIS
#include JsStr.h

js_string *js_create(int max_count, int unit_size);

DESCRIPTION
js_create creates a new js_string object, allocating the necessary memory for the object in question. The function also sets some default values for the js_string object.

ARGUMENTS
max_count is the maximum number of units that this js_string object is allowed to have. A single unit takes up one or more octets of memory space. The amount of space a single unit takes up is determined by the unit_size argument.

unit_size determines the number of bytes a single unit of a js_string object has in it. This will be set to 1 for normal ASCII or ISO-8859-1 character sets, but may be 2 (or higher) for UNICODE or other special character sets that require multiple octets to represent a single character.

RETURN VALUE
js_create returns a pointer to the js_string object in question. If it is unable to create a js_string object, this function will return the value 0 (the null pointer, as defined by the C standard).

EXAMPLE
The following example creates a js_string object that can have as many as 256 single-octet characters.

	js_string *foo;
	foo = js_create(256,1);

AUTHOR
Sam Trenholme <kiwi-zttfryb@koala.samiam.org>