Oberon || Library || Module Index || Search Engine || Definition || Module


Ulm's Oberon Library:
InetURLs


NAME

InetURLs - abstraction to handle Uniform Resource Locators

SYNOPSIS

TYPE URL = POINTER TO URLRec;
TYPE URLRec =
   RECORD
      (Disciplines.ObjectRec)
      scheme: Streams.Stream;
   END;


TYPE AssignProc = PROCEDURE (url: URL; s: Streams.Stream): BOOLEAN; TYPE ToStringProc = PROCEDURE (url: URL; VAR stringURL: ARRAY OF CHAR); Interface = POINTER TO InterfaceRec; InterfaceRec = RECORD assign: AssignProc; toString: ToStringProc; END;

PROCEDURE Init(url: URL; if: Interface); PROCEDURE Assign(url: URL; s: Streams.Stream): BOOLEAN; PROCEDURE ToString(url: URL; VAR stringURL: ARRAY OF CHAR);

DESCRIPTION

The module InetURLs provides an abstraction for Uniform Resource Locators (URLs). It defines the handling and the common part of all URLs (the sheme).

Providing URLs

Implementations must initialize new instances of web handlers using Init, specifying an interface if containing following procedures. Only the Assign procedure needs to be implemented. ToString is optional.

assign: PROCEDURE(url: URL; s: Streams.Stream) : BOOLEAN;
assigns the Stream s to the URL. The Stream is parsed from the actual position to EOF, or until the next space, tab, or newline is reached. The elements are stored in url. Escaped characters remain still escaped. s must be able to handle substreams. 'Assign' will return FALSE if url doesn`t conform to the URL expected (e.g. a stored FTP-URL can`t be parsed as a HTTP-URL). FALSE will also returned if there are other syntactical errors. Related events raised to url closer describe the errors.

toString: PROCEDURE(url: URL; VAR stringURL: ARRAY OF CHAR);
combines the parts of an URL to a string. Necessary fill characters will be added. This Procedure is optional.

Using URLs.

Assign parses the stream s and assigns the URL parts to separat variables. The parsing starts at the actual position of the s.

ToString combines all parts of an URL and provides a string.

DIAGNOSTICS

InetURLs does not generate error events by itself. Only underlying implementations raise errors as RelatedEvents to url.

SEE ALSO

Streams
stream operations
SubStreams
Interval of a Stream

AUTHOR

Manfred Rueß, University of Ulm
Edited by: borchert, last change: 1998/04/24, revision: 1.1, converted to HTML: 1998/04/24

Oberon || Library || Module Index || Search Engine || Definition || Module