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 Browser Services

Miscellaneous

A few miscellaneous browser services don't fit into any particular category. These include functions for handling search paths, files, string comparison, and version information.

Many of these function's implementations -- the most important being those for path and file handling -- are usually implemented as part of the common operating system glue for a platform, rather than for a specific host browser.


Types

IHDirScan
Synopsis
A handle on a file system directory that is being examined.
Definition
void* (This is an opaque type that is defined by the browser's internal implementation.)
See Also
BR_BeginDirScan()

This type represents a handle on an opened file system direction, which is being scanned for files and directories.


Functions

BR_BeginDirScan
Synopsis
IHDirScan BR_BeginDirScan(const char* dir)
Arguments
(const char*) dir
Name of directory to examine.
Return
(IHDirScan) A handle on a new directory scan operation.
See Also
IHDirScan, BR_ParsePath()

Open the given file-system directory, to begin scanning it for the files and directories it contains. The syntax of the given directory name is browser-defines, and must be a string returned by BR_ParsePath().

BR_EndDirScan
Synopsis
void BR_EndDirScan(IHDirScan ds)
Arguments
(IHDirScan) ds
Terminate an active directory scan.
Return
nothing.
See Also
IHDirScan, BR_BeginDirScan()

Ends an active directory scan, and deallocates all resources associated with it.

BR_FreeParsePath
Synopsis
void BR_FreeParsePath(const char** path)
Arguments
(const char**) path
A path previously returned by BR_ParsePath().
Return
nothing.
See Also
BR_ParsePath()

Deallocates the memory returned by BR_ParsePath().

BR_GetBasePath
Synopsis
const char* BR_GetBasePath(const char* language, const char* defpath)
Arguments
(const char*) language
The language the requested path is for, or NULL for the top-level iHTML path.
(const char*) defpath
The default path if one is not defined, or NULL.
Return
(const char*) A string representing the search path.
See Also
BR_ParsePath()

Returns a string defining the base search path to use. This may then be parsed by passing it to BR_ParsePath(). The string returned by this function must be deallocated with free().

BR_GetCapability
Synopsis
int BR_GetCapability(IHDocument doc, const char* name)
Arguments
(IHDocument) doc
The document context in which to check the capability.
(const char*) name
The name of the capability to check.
Return
(int) Resulting capability level of browser.
See Also
IHDocument

Checks the capability level available in the current browser/document. This defines the set of actions a script may perform and the environment it is running in. The returned integer level tells whether the capability is available; it should be 0 if not available or unknown, and 1 if it is allowed. Some capabilities define other return values.

The currently defined capability names are:

Basic capabilities:
"forms"
Browser supports fill-in forms
"tables".
Browser can render HTML tables.
"sockets".
Browser allows low-level socket connections.
Composite capabilties:
"comp_mosaic"
Implements capabilities as well or better than Mosaic implementation. Returned value is the Mosaic level compatible with. (This is not the browser version code.
Display capabilities:
"disp_text"
Able to display text in the browser.
"disp_graphics"
Able to display graphics in the browser.
"disp_mono"
Able to display monochrome text/graphics.
"disp_color"
Able to display color; returned value is the total number of colors that can be on-screen.
"disp_true"
Able to display true-color; value is the number of bits per color gun.

BR_GetVersion
Synopsis
void BR_GetVersion(char** fullname,char** name,int* ver,int* rev)
Arguments
(char**) fullname
Location to place a string with the full name of this specific browser.
(char**) name
Location to place a string with the browser's standard "brand" name.
(int*) ver
Location to place an integer representing the browser's major version code
(int*) rev
Location to place an integer representing the browser's minor revision code.
Return
nothong.

This function returns type and version information about the browser under which the system is running. Some example return values for the X Mosaic implementation are:

fullname
"NCSA X-Mosaic 2.7b2"
name
"X-Mosaic"
ver
7
rev
2

BR_NextDirScan
Synopsis
const char* BR_NextDirScan(IHDirScan ds)
Arguments
(IHDirScan) ds
Handle on an active directory scan.
Return
(const char*) The name of the next file in the directory.
See Also
IHDirScan, BR_BeginDirScan()

Returns the name of the next file in the scanned directory, as a NULL-terminated string. A NULL pointer is returned when the end of the directory is reached.

BR_OpenDirFile
Synopsis
FILE* BR_OpenDirFile(const char* dir, const char* fname, const char* type)
Arguments
(const char*) dir
Directory in which file exists.
(const char*) fname
Name of file to open
(const char*) type
Mode to open file in.
Return
(FILE*) An opened file handle, that can be manipulated with ANSI C file functions.
See Also
BR_ParsePath(), BR_NextDirScan()

Opens a file in the given directory with the given name. The arguments dir must be a directory name as returned by BR_ParsePath() and fname must be the name of a file as returned by BR_NextDirScan(). The type argument is as per the ANSI fopen() funcion.

BR_OpenTempFile
Synopsis
FILE* BR_OpenTempFile(IHDocument doc)
Arguments
(IHDocument) doc
The document context to associate file with.
Return
(FILE*) A newly opened file handle.
See Also
IHDocument

Opens a temporary file that can the be used to read/write data with standard ANSI C file functions.

BR_ParsePath
Synopsis
const char** BR_ParsePath(const char* path_descr, const char* langstr)
Arguments
(const char*) path_descr
A string defining the search path.
(const char*) langstr
The name of the language module this path is to be for, or NULL to look at top-level iHTML directories.
Return
(const char**) A NULL-terminated array of strings, representing the individual directories in the path.
See Also
BR_GetBasePath()

Parses a search path string returned by BR_GetBasePath() into its individual components. The syntax of the input string is not specified, but for Unix it will be, for example, of the form ".:/usr/local/lib".

The returned array must be deallocated with BR_FreeParsePath().

BR_StrCmp
Synopsis
int BR_StrCmp(const char* str1, const char* str2)
Arguments
(const char*) str1
First string to compare.
(const char*) str2
Second string to compare.
Return
(int) 1 if str1 and str2 are equal, else zero.

Performs a case-insensitive comparison of two strings. This should be used when manipulating strings that are used with the browser's functionality, such as attributes and tag names.


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

_________.oo_Q_Q_oo.____________________________________________
Dianne Kyra Hackborn <hackbod@angryredplanet.com>
Last modified: Tue Oct 8 03:32:13 PDT 1996

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