Annotation of researchv10dc/630/man/src/p_man/man3/balloc.3r, revision 1.1.1.1

1.1       root        1: .ds ZZ DEVELOPMENT PACKAGE
                      2: .TH BALLOC 3R "630 MTG"
                      3: .XE "balloc()"
                      4: .XE "bfree()"
                      5: .SH NAME
                      6: balloc, bfree \- bitmap allocation
                      7: .SH SYNOPSIS
                      8: .B #include <dmd.h>
                      9: .sp
                     10: .B Bitmap \(**balloc (r)
                     11: .br
                     12: .B Rectangle r;
                     13: .br
                     14: .PP
                     15: .B void bfree (b)
                     16: .br
                     17: .B Bitmap \(**b;
                     18: .br
                     19: .SH DESCRIPTION
                     20: The
                     21: .I balloc
                     22: function
                     23: either
                     24: returns a pointer to a Bitmap large enough to contain the Rectangle
                     25: .IR r ,
                     26: or a 0 (\s-1NULL\s+1) for failure. 
                     27: The bitmap is allocated first by a call to \fIalloc(3R)\fR for the
                     28: Bitmap data structure and then to \fIgcalloc(3R)\fR for the actual
                     29: Bitmap storage.
                     30: The coordinate system inside the Bitmap is set by
                     31: .IR r .
                     32: The origin and corner of the Bitmap are those of
                     33: .I r
                     34: which must itself be in screen coordinates.
                     35: .PP
                     36: The
                     37: .I bfree
                     38: frees the storage associated with a Bitmap allocated by
                     39: .IR balloc .
                     40: .PP
                     41: The terminal
                     42: automatically frees all memory \fIballoc\fR'ed by a process
                     43: when the process terminates or when
                     44: the window it is running in is deleted.
                     45: However, it is recommended that a process free its \fIballoc\fR'ed
                     46: memory when the storage is no longer needed so that other
                     47: processes
                     48: will be able to use it.
                     49: 
                     50: .SH EXAMPLE
                     51: The following example shows the use of
                     52: .I balloc
                     53: and
                     54: .I bfree
                     55: in dynamically allocating memory for a Bitmap.
                     56: .PP
                     57: .RS 3
                     58: .ft CM
                     59: .nf
                     60: #include <dmd.h>
                     61: 
                     62: main()
                     63: {
                     64:     Bitmap *b;
                     65:     Bitmap *balloc();
                     66:     void bfree();
                     67: 
                     68:     b = balloc (Rect (0, 0, 48, 48));
                     69:     .
                     70:     .
                     71:     .
                     72:     bfree (b);
                     73: }
                     74: .fi
                     75: .ft R
                     76: .RE
                     77: .SH SEE ALSO
                     78: alloc(3R), gcalloc(3R), structures(3R).
                     79: .bp
                     80: .SH BUGS
                     81: .P
                     82: If the bitmap image requested needs over 7000000 bytes, \f2balloc\f1
                     83: may produce a process exception. If this happens, \f2gcalloc\f1
                     84: memory will be corrupted, and other programs running in the
                     85: terminal may be damaged.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.