NOTE:
This project is no longer being maintained: it was developed for my masters thesis, which was completed in early 1997. I still, however, welcome any questions or comments that people may have.

[Home] [ToC] [Up] [Prev] [Next]


iHTML Library Services

Miscellaneous

A few miscellaneous iHTML library services don't fit into any particular category. These include functions for manipulating MIME content type information, mapping from strings to integer identifiers, retrieving version information, and initializing and terminating the entire iHTML system.


Types

IHContentType
Synopsis
The parsed representation of a MIME Content-type header.
Definition
typedef struct ih_content_type_rec {
  IHNode node;
  IHList params;        /* (IHEmbeddedParam*) List of MIME arguments. */
  char* type;           /* The MIME content type -- e.g., "image" */
  char* subtype;        /* The MIME content subtype -- e.g., "gif" */
} IHContentType;
See Also
IHEmbeddedParam, IHNode, IHList

This type represents the information in a MIME Content-type header. This includes the basic type and subtype, along with a list of any additional parameters.

IHNameEntry
Synopsis
An association between an ID number and its textual name.
Definition
typedef struct name_entry_rec {
  char* name;
  int attr;
} IHNameEntry;
See Also
IH_FindNameEntry()

This type maps between an arbirary identifier integer and a name string associated with it. The library includes a number of static arrays of these types, that are used to compute the ID code for a string. These are IH_ClassNames, IH_CodeNames, IH_AttrNames, and IH_WidgetMemberNames.


Functions

IH_FindNameEntry
Synopsis
IHNameEntry* IH_FindNameEntry(IHNameEntry* entries, int size, const char* name)
Arguments
(IHNameEntry*) entries
Array mapping names to IDs.
(int) size
Number of entries in the above array.
(const char*) name
The name to find an ID for.
Return
(IHNameEntry*) The entry that matches the given name.
See Also
IHNameEntry

This function performs a binary search on the given array of NameEntries, looking for the requested name. If found, it returns a pointer to that entry. Otherwise, returns NULL. There are also four functions that provide a simpler interface for retrieving standard names:

IHNameEntry* IH_FindClassEntry(char* name)
Return a IHNameEntry corresponding to the IECLASS with the given name.
IHNameEntry* IH_FindCodeEntry(char* name)
Return a IHNameEntry corresponding to the IECODE with the given name.
IHNameEntry* IH_FindAttrEntry(char* name)
Return a IHNameEntry corresponding to the IEATTR with the given name.
IHNameEntry* IH_FindWidgetMemberEntry(char* name)
Return a IHNameEntry corresponding to the IEATTR with the given name.

IH_FreeContentType
Synopsis
void IH_FreeContentType(IHContentType* ct)
Arguments
(IHContentType*) ct
Content-type node to deallocate.
Return
nothing.
See Also
IHContentType, IH_ParseContentType()

Deallocates the given MIME "Content-type" structure representation, which must have been previously allocated with IH_ParseContentType().

IH_GetVersion
Synopsis
void IH_GetVersion(char** build, int* ver, int* rev, int* sub)
Arguments
(char**) build
Variable in which to place build date string.
(int*) ver
Variable in which to place version number.
(int*) rev
Variable in which to place revision number.
(int*) sub
Variable in which to place sub-make number.
Return
nothing.

Fills in the given addresses with the library version information.

IH_Initialize
Synopsis
void IH_Initialize(int argc, char** argv)
Arguments
(int) argc
Number of arguments.
(char**) argv
Argument array.
Return
nothing.
Bugs
Should return an error code.
See Also
IH_Terminate()

Initializes the iHTML library and scans the system for language modules. This function must be called when the browser first starts up, with the command line that was supplied by the user.

IH_MatchContentType
Synopsis
int IH_MatchContentType(IHContentType* tpl, IHContentType* ct)
Arguments
(IHContentType*) tpl
Content-type template to compare against.
(IHContentType*) ct
Content-type to check.
Return
(int) Result of comparison: 1 if ct matches tpl, else 0.
See Also
IHContentType, IH_ParseContentType()

Compares two IHContentType structures. tpl is the template to match against, and ct is the content type that is being checked. Thus tpl may have values of "*" in its type or subtype to match any value in ct, and ct must have any additional parameters that are contained in tpl

IH_ParseContentType
Synopsis
IHContentType* IH_ParseContentType(const char* ctype)
Arguments
(const char*) ctype
The Content-type string to parse.
Return
(IHContentType*) A newly allocated Content-type structure.
Example
/* Create a Content-type for the iHTML Python module. */
IHContentType* python
  = IH_ParseContentType("application/ihtml; language=python")
See Also
IHContentType,

This routine parses a MIME Content-type header's data, returning a newly allocated IHContentType structure that is equivalent to the given string. If the given string is invalid -- e.g., there is no type or subtype supplied -- a NULL value is returned.

IH_Terminate
Synopsis
Arguments
none.
Return
nothing.
See Also
IH_Initialize()

Deallocates and cleans up iHTML library and language modules, prior to program exit.


[Home] [ToC] [Up] [Prev] [Next]

_________.oo_Q_Q_oo.____________________________________________
Dianne Kyra Hackborn <hackbod@angryredplanet.com>
Last modified: Sun Oct 27 14:11:31 PST 1996

This web page and all material contained herein is Copyright (c) 1997 Dianne Hackborn, unless otherwise noted. All rights reserved.