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

Language Modules

The iHTML library language services provide data structures and functions for managing and interacting with the system's back-end language modules.


Types

IHLanguage
Synopsis
The high-level interface to a language module.
Definition
typedef struct ih_language_rec IHLanguage;
struct ih_language_rec {

  /* The interface functions for this language.  Must always be set. */
  IHLanguageFunc* Fn;

  /* Version information */
  int Version;
  int Revision;
  int Submake;
  char* BuildDate;

  /* ASCII name of this language */
  char* Name;

  /* The total size in bytes of this language's IHLangEnv structure. */
  int LangEnvSize;
};
See Also
IHLanguageFunc, LanguageInit, Language Services.

This structure defines the entire public interface to an externally loaded language module. It is returned by the language's initialization function, and includes fields indicating the name and version of the module, as well as a pointer to the module's function table.

IHLanguageFunc
Synopsis
The functional interface to a language module.
Definition
typedef struct ih_language_func_rec {
  void              (*Term) IH_PROTO((IHLanguage* language));
  IHLangEnv*        (*AllocLangEnv)      IH_PROTO((IHLangEnv* le));
  void              (*FreeLangEnv)       IH_PROTO((IHLangEnv* le));
  int               (*ExecLangEnv)       IH_PROTO((IHLangEnv* le,
					           IHModuleInfo* main));
  void              (*StopLangEnv)       IH_PROTO((IHLangEnv* le,
					           IHModuleInfo* main));
  IHModuleInfo*     (*AllocModule)       IH_PROTO((IHModuleInfo* mi));
  void              (*FreeModule)        IH_PROTO((IHModuleInfo* mi));
  IHEmbeddedInfo*   (*AllocEmbedded)     IH_PROTO((IHEmbeddedInfo* ei));
  void              (*FreeEmbedded)      IH_PROTO((IHEmbeddedInfo* ei));
  int               (*ExecEmbedded)      IH_PROTO((IHEmbeddedInfo* ei));
  void              (*StopEmbedded)      IH_PROTO((IHEmbeddedInfo* ei));
  int               (*HandleEvent)       IH_PROTO((IHLangEnv* env,
					           IHEvent* event));
  HTMLNode          (*IHMarkup_HeadNode) IH_PROTO((IHMarkup markup));
  HTMLNode          (*IHMarkup_TailNode) IH_PROTO((IHMarkup markup));
  void              (*IHMarkup_SetHead)  IH_PROTO((IHMarkup markup,
						   HTMLNode node));
  void              (*IHMarkup_Ref)      IH_PROTO((IHMarkup markup));
  void              (*IHMarkup_Deref)    IH_PROTO((IHMarkup markup));
} IHLanguageFunc;
See Also
IHLanguage, Language Services.

This structure contains a language module's functional interface. It is composed of pointers to the various functions the module implements, used by the iHTML Library to make calls into the module.

LanguageInit
Synopsis
Language initialization function.
Definition
typedef IHLanguage* (LanguageInit) IH_PROTO((static char* browser,
                                             static char* language));
Parameters
(static char*) browser
The name of the browser executable, as it was invoked.
(static char*) language
The name of the language that is being loaded.
See Also
IHLanguage, Language Services.

This is the type of a language module's initialization function, which is called to initialize the language upon loading it, and get the language's public interface. This entry point is the only public symbol defined by a dynamically loaded module, and most be globally visible as IHTML_language, where language is the (case-sensitive!) name of the module. If that symbol is not found, the generic symbol IHTMLinterface will be tried instead.


Functions

IH_AllocWidget
Synopsis
IHWidgetObj IH_AllocWidget(IHGlobalInfo* gi, IHDocument doc, IHLangEnv* langenv, IHWidgetObj par, IHWidgetRep rep, IHMemberValue* init)
Arguments
(IHGlobalInfo*) gi
iHTML library context making widget.
(IHDocument) doc
Browser-side document that widget is associated with.
(IHLangEnv*) doc
Language context in which to allocate widget.
(IHWidgetObj) par
Widget this is a child of, or NULL if it is a top-level widget.
(IHWidgetRep) rep
Browser-side widget representation, or NULL.
(const IHMemberValue*) init
The initial values of the new widget's members. This is an array of IHMemberValue structures, which is terminated with a member of IWM_NULL_ID.
Return
(IHWidgetObj) The newly created language-side widget.
See Also
IHGlobalInfo, IHDocument, IHLangEnv, IHWidgetObj, IHWidgetRep, IHMemberValue, BR_AllocWidget()

Creates a new language widget object. Similar to BR_AllocWidget(), except that a specific IHWidgetRep can be supplied for this object to use; otherwise, it will allocate its own from the browser.

IH_CleanHTMLNode
Synopsis
void IH_CleanHTMLNode(HTMLNode node)
Arguments
(HTMLNode) node
The browser-side node to clean.
Return
nothing.
See Also
HTMLNode

Cleans any interface information that has been associated with the given HTMLNode before deallocating it. This routine must be called when freeing any HTMLNodes owned by the interface, e.g. when freeing nodes in BR_FreeMarkup().

IH_DerefMarkup
Synopsis
void IH_DerefMarkup(IHLanguage* lang, IHMarkup markup)
Arguments
(IHLanguage*) lang
The language that made this markup object.
(IHMarkup) markup
The language-side object to dereference.
Return
nothing.
See Also
HTMLNode, IHMarkup, IHLanguage,

Decrements the number of pointer references on the given IHMarkup. The IHMarkup or any HTMLNode nodes owned by it can not be relied upon to exist after this call.

IH_FreeWidget
Synopsis
void IH_FreeWidget(IHLangEnv* langenv,IHWidgetObj widget)
Arguments
(IHLangEnv*) doc
Language context in which widget exists.
(IHWidgetObj) widget
Widget to deallocate
Return
nothing.
See Also
IHLangEnv, IHWidgetObj

Deallocates a previously allocated language-side widget, freeing all resources that were originally allocated along with it.

IH_GetWidgetMembers
Synopsis
void IH_GetWidgetMembers(IHLangEnv* langenv, IHWidgetObj widget, IHMemberValue* values)
Arguments
(IHLangEnv*) doc
Language context in which widget exists.
(IHWidgetObj) widget
Widget to examine.
(const IHMemberValue*) value
The widget member values to get. This is an array of IHMemberValue structures, which is terminated with a member of IWM_NULL_ID; each value in the array is a pointer to the place in member in which the widget's value should be stored.
Return
nothing.
See Also
IHLangEnv, IHWidgetObj, IHMemberValue, BR_SetWidgetMembers()

Retrieves the values of the given widget's member attributes. The argument values is an array of IHMemberValue structures, terminated with a member of IWM_NULL_ID.

IH_HandleEvent
Synopsis
void IH_HandleEvent(IHEvent* event)
Arguments
(IHEvent*) event
An event to process.
Return
nothing.
See Also
IHEvent

Send the given event off to the language module that can handle it.

IH_HeadMarkupNode
Synopsis
HTMLNode IH_HeadMarkupNode(IHLanguage* lang, IHMarkup markup)
Arguments
(IHLanguage*) lang
The language that made this markup node.
(IHMarkup) markup
The language-side node to look at.
Return
(HTMLNode) The first node in the tree owned by markup
See Also
HTMLNode, IHMarkup, IHLanguage,

This routine returns the first HTMLNode that is owned and being managed by the language-side tree markup.

IH_ImportLanguage
Synopsis
IHLanguage* IH_ImportLanguage(IHContentType* type)
Arguments
(IHContentType*) type
The content type that the important language needs to handle.
Return
(IHLanguage*) A handle on the requested language.
See Also
IHLanguage, IHContentType

Loads an external language module, links it into the browser, and returns its public interface. The language is found by looking through an internally generated list of available languages, searching for one that implements the given content type. Once one is found, an external module named "impl" is hunted for in the path for that name'd language. The module is then loaded and initialized, and the interface to it returned.

If a language implementing the given content type has already been loaded, its interface is immediately returned, instead.

IH_RefMarkup
Synopsis
void IH_RefMarkup(IHLanguage* lang, IHMarkup markup)
Arguments
(IHLanguage*) lang
The language that made this markup object.
(IHMarkup) markup
The language-side object to reference.
Return
nothing.
See Also
HTMLNode, IHMarkup, IHLanguage,

Adds a pointer reference to the given IHMarkup. This is used when linking HTMLNode trees together, to indicate links between trees with different owners.

IH_ReleaseLanguage
Synopsis
void IH_ReleaseLanguage(IHLanguage* lang)
Arguments
(IHLanguage*) lang
A previously important language interface.
Return
nothing.
See Also
IHLanguage, IH_ImportLanguage,

Releases a handle in the given language interface, as returned previously by IH_ImportLanguage(). Every IH_ImportLanguage() call that returns a non-NULL value must be matched with exactly one IH_ReleaseLanguage() call, when the language is no longer needed.

IH_SetMarkupHead
Synopsis
void IH_SetMarkupHead(IHLanguage* lang, IHMarkup markup, HTMLNode node)
Arguments
(IHLanguage*) lang
The language that made this markup object.
(IHMarkup) markup
The language-side object to set.
(HTMLNode) node
The new head of the language-side tree.
Return
nothing.
See Also
HTMLNode, IHMarkup, IHLanguage,

Informs that IHMarkup that it has a new head node. This is called when deleting a tree of nodes, to make sure that the head node saved by the IHMarkup is kept up to date. If NULL, this IHMarkup does not own any more nodes.

IH_SetWidgetMembers
Synopsis
void IH_SetWidgetMembers(IHLangEnv* langenv, IHWidgetObj widget, IHMemberValue* values)
Arguments
(IHLangEnv*) doc
Language context in which widget exists.
(IHWidgetObj) widget
Widget to modify.
(const IHMemberValue*) value
The widget member values to set. This is an array of IHMemberValue structures, which is terminated with a member of IWM_NULL_ID.
Return
nothing.
See Also
IHLangEnv, IHWidgetObj, IHMemberValue, BR_SetWidgetMembers()

Sets the values of the given widget's member attributes. The argument values is an array of IHMemberValue structures, terminated with a member of IWM_NULL_ID.

IH_TailMarkupNode
Synopsis
HTMLNode IH_TailMarkupNode(IHLanguage* lang, IHMarkup markup)
Arguments
(IHLanguage*) lang
The language that made this markup node.
(IHMarkup) markup
The language-side node to look at.
Return
(HTMLNode) The last node in the tree owned by markup
See Also
HTMLNode, IHMarkup, IHLanguage,

This routine returns the last HTMLNode that is owned and being managed by the language-side tree markup.


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

_________.oo_Q_Q_oo.____________________________________________
Dianne Kyra Hackborn <hackbod@angryredplanet.com>
Last modified: Tue Oct 8 04:31:26 PDT 1996

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