Internal Parser Routines

These are the parsing routines. Many are intra-libht routines, but the reading functions are useful for outside when you don't want to alter the contents of the current output page.

htelm * htpreadstr (htelm * head, htelm **pend, unsigned char * str)
Read a string, inserting the parsed elements in head. pend is set to the last element parsed.

htelm * htpreadfile (htelm * head, htelm **pend, char * file)
Read from file file, inserting the parsed elements in head. pend is set to the last element parsed.

htelm * htpreadfiletext (htelm * head, htelm **pend, char * file)
Read from file file, inserting the parsed elements in head. pend is set to the last element parsed. Unlike its cousin htpreadfile(), html tags are not parsed.

htelm * htpreadurl (htelm * head, htelm **pend, char * url, int * sts, char * type)
Read from URL url, inserting the parsed elements in head. pend is set to the last element parsed. You can capture the HTTP status and MIME encapsulation types by supplying these parameters.

struct token * htkgetword (struct token * tk, int n)
Get the n'th token in the token list for a given element. The token list is found in htelm->tk

char * htkgetval (struct token * tk, char * var)

struct token * htkckvar (struct token * tk, char * var)
Given the token list tk, return 1 if var is present, 0 otherwise.

void htprelease (htelm * h)
The internal routine to release storage of the tree starting at h

void htpdumpfile (htelm * h)
Dump the file starting at h.

void _htpdumpfile (htelm * h, int endtag, int (* dumper) (char * fmt, ...))
Dump from h to endtag (the type, not a string) emitting with the printf(3) like dumper function.

void htpdumptree (htelm * h, int lvl)
Dump a diagnostic state 'o affairs of the tree starting at h

int htpcompile (char * file, htelm * h)
As if! Actually, this function will eventually generate an output file which is the C representation of the internally parsed database. This will be much quicker to fire up than endlessly reparsing the same template(s), but of course has the disadvantage that the program will need to be recompiled to take affect.


© (copyright) 1997 MTCC
Last modified: Fri Apr 25 20:29:15 PDT 1997