1 /* $XConsortium: util.c,v 1.7 94/01/27 15:21:15 gildea Exp $ */
2 /* Copyright International Business Machines,Corp. 1991
5 * License to use, copy, modify, and distribute this software
6 * and its documentation for any purpose and without fee is
7 * hereby granted, provided that the above copyright notice
8 * appear in all copies and that both that copyright notice and
9 * this permission notice appear in supporting documentation,
10 * and that the name of IBM not be used in advertising or
11 * publicity pertaining to distribution of the software without
12 * specific, written prior permission.
14 * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
15 * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
16 * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
18 * THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE QUALITY AND
19 * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
20 * OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF
21 * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
22 * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN
23 * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
24 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
25 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
26 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
27 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
30 /* Author: Katherine A. Hitchcock IBM Almaden Research Laboratory */
36 static char *vm_base = NULL; /* Start of virtual memory area */
37 char *vm_next = NULL; /* Pointer to first free byte */
38 long vm_free = 0; /* Count of free bytes */
39 long vm_size = 0; /* Total size of memory */
47 vm_next = vm_base = (char *)xalloc (cnt);
49 if (vm_base != NULL) {
64 /* Round to next word multiple */
65 bytes = (bytes + 7) & ~7;
67 /* Allocate the space, if it is available */
68 if (bytes <= vm_free) {
80 * Format an Integer object
82 void objFormatInteger(objP,value)
87 objP->type = OBJ_INTEGER;
89 objP->data.integer = value;
94 * Format a Real object
96 void objFormatReal(objP,value)
101 objP->type = OBJ_REAL;
103 objP->data.real = value;
108 * Format a Boolean object
110 void objFormatBoolean(objP,value)
115 objP->type = OBJ_BOOLEAN;
117 objP->data.boolean = value;
122 * Format an Encoding object
124 void objFormatEncoding(objP,length,valueP)
130 objP->type = OBJ_ENCODING;
132 objP->data.arrayP = valueP;
137 * Format an Array object
139 void objFormatArray(objP,length,valueP)
145 objP->type = OBJ_ARRAY;
147 objP->data.arrayP = valueP;
153 * Format a String object
155 void objFormatString(objP,length,valueP)
161 objP->type = OBJ_STRING;
163 objP->data.valueP = valueP;
168 * Format a Name object
170 void objFormatName(objP,length,valueP)
176 objP->type = OBJ_NAME;
178 objP->data.nameP = valueP;
183 * Format a File object
185 void objFormatFile(objP,valueP)
190 objP->type = OBJ_FILE;
192 objP->data.fileP = valueP;