— Inferno 1.1ed
Introduction to Limbo modules
This section introduces the Limbo modules available to the programmer; see the corresponding manual pages for more information. Each module is declared with a single Limbo include file. Before calling a module's functions, an application must load the module; the application uses the resulting handle as the module qualifier. The examples above illustrate the style. It will usually be necessary to qualify names with the appropriate module pointer or to import the types and functions. The manual pages assume the names are accessible in the current scope.Although many modules are self-contained, dependencies may exist. For example, the system module, Sys, provides basic services that some other modules require.
A number of minor functions are packaged as individual modules but share a single include file. For example, see /include/lib.m.
The manual pages describe in their synopsis sections how to include a module definition during compilation and load an implementation during execution. The synopsis sections also list the functions, abstract data types, and constants that are discussed in the following Description sections. Although the include files declare these components, the manual pages list them explicitly. In all cases, the enclosing module declaration is assumed so that unqualified identifiers can be used in the text without ambiguity.
Some modules are described in a single page, such as regex. Larger modules are divided into several related pages, such as Limbo Math Modules , elem , fp , and linalg.
include "sys.m"; sys:= load Sys Sys->PATH; include "draw.m"; draw:= load Draw Draw->PATH; include "tk.m"; tk:= load Tk Tk->PATH; ... etc. Generically include "module.m"; mod:= load Module Module ->PATH;
Draw Modules
Keyring Modules
Library Modules
Math Modules
|
elem
|
elementary functions of applied mathematics
|
|
fp
|
floating point operations
|
|
linalg
|
linear algebra primitives
|
Prefab Modules
System Modules
Toolkit Modules
|
tk
|
graphics toolkit
|
|
tklib
tkquote, is_err, tkcmds,
|
Tk user interface functions
|
Miscellaneous Modules
Draw Modules
Synopsis
include "draw.m"; draw:= load Draw Draw->PATH;
Description
Inferno's Draw module provides basic graphics facilities, defining drawing contexts, images, character fonts, and rectangular geometric operations. See Limbo Prefab Modules and tk for higher level operations, such as windows and menu handling.
Pixels
Images are defined on a rectangular region of an integer plane with a picture element, or pixel, at each grid point. Pixel values are integers with 0, 1, 2, 4, or 8 bits per pixel, and all pixels in a given image have the same size, or depth. Some operations allow images with different depths to be combined, for example to do masking.
More about Images
An image occupies a rectangle, Image.r, of the graphics plane. A second rectangle, Image.clipr, defines a clipping region for the image. Typically, the clipping rectangle is the same as the basic image, but they may differ. For example, the clipping region may be made smaller and centered on the basic image to define a protected border.The pixel depth of an Image is stored as a logarithm called Image.ldepth; pixels with 1, 2, 4, and 8 bits correspond to ldepth values 0, 1, 2, and 3. In future, other image depths may be supported.
An image may be marked for replication: when set, the boolean Image.repl causes the image to behave as if replicated across the entire integer plane, thus tiling the destination graphics area with copies of the source image. When replication is turned on, the clipping rectangle limits the extent of the replication and may even usefully be disjoint from Image.r. See image for examples.
The Image member functions provide facilities for drawing text and geometric objects, manipulating windows, and so on.
Return Values
Most drawing operations operate asynchronously, so they have no error return. Functions that allocate objects return nil for failure; in such cases the system error string may be interrogated (such as by the %r print format) for more information. See Also
ir, Limbo Prefab Modules, tk, font, and image
infernosupport@lucent.com Copyright © 1996,Lucent Technologies, Inc. All rights reserved.