String cname(name)

- convert name to name accepted by LLgen String name;

String cstring(str)

- convert a string to a c-string String str;

A name in the SGML standard may contain `.' and `-'. A name in LLgen and C consists only of letters and underscores. So a SGML-name must be converted; every `.' is replaced by `a' and every `-' is replaced by `z'. This gives no conflicts with existing SGML-names because those are in uppercase. The function cstring() converts a string, so that all occurrences of `"' and `\\' are escaped by `\\'. All newlines are converted to `\\n'.

int hash_string(s)

- return a hash value String s;

Bool streq(s1, s2)

- return TRUE whether s1 equals s2 String s1; String s2;

String strsave(s)

- return a copy of string s String s;

The value of hash_string() is calculated by adding the characters together. streq() returns TRUE if s1 equals s2 and FALSE otherwise. strsave() creates a new string and copies the content of s into the new string.

void to_upper(s)

- change string s to uppercase String s;

void to_lower(s)

- change string s to lowercase String s;

Bool check_int(key, key1,...,key15)

- check if key is any of the other keys int key; int key1,...,key15;

to_upper() converts a string to uppercase, only the letters are changed, underscores, digits etc, remain the same. to_lower() converts a string to lowercase, only the letters are affected. check_int() checks if key is in the list key1 ... key15. If so TRUE is returned, otherwise FALSE. Not all arguments are needed. The first key[1..15] that equals 0 is assumed to be the end of the list.

void* MALLOC(nr_bytes)

- memory allocate procedure unsigned nr_bytes;

void* CALLOC(nr_bytes, size)

- memory allocate procedure unsigned nr_bytes; unsigned size;

void FREE(x, nr_bytes)

- memory free procedure void *x; int nr_bytes;

void CFREE(x)

- memory free procedure String x;

MALLOC() and CALLOC() return a pointer to a piece of memory. If the memory can not be found an error is returned. FREE() and CFREE() free the allocated memory.

tools.c tools.h