1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22 */
23 #ifndef Mrm_H
24 #define Mrm_H
25 
26 #define	urm_h	1
27 #include <Mrm/MrmPublic.h>
28 #include <Xm/Xm.h>			/* XmString definition and _NO_PROTO */
29 #include <Xm/XmosP.h>
30 
31 
32 /*
33  * This is the internal file used throughout URM for literal and
34  * struct definitions. It defines everything not found in public
35  * files.
36  */
37 
38 #ifndef MIN
39 #define MIN(x,y)	((x) < (y) ? (x) : (y))
40 #endif
41 #ifndef MAX
42 #define MAX(x,y)	((x) > (y) ? (x) : (y))
43 #endif
44 
45 #ifndef XmConst
46 #if defined(__STDC__) || !defined( NO_CONST )
47 #define XmConst const
48 #else
49 #define XmConst
50 #endif /* __STDC__ */
51 #endif /* XmConst */
52 
53 
54 /*
55  * The following macro is used to round the size of memory allocation requests
56  * up to eight bytes. This is done to help satisfy alignment
57  * request for MIPS, CRAY, Alpah, HP9000 (for doubles) and similar machines.
58  */
59 #define _sl sizeof(long)
60 #define _slm (sizeof(long) - 1)
61 #define _FULLWORD(exp) (_sl * (((exp) + _slm) / _sl))	/* (4*(((exp)+3)/4)) */
62 
63 /*
64  *  Swap the byte order of 4- and 2- byte quantities.
65  *  "tp +=" lines are needed on Cray (CARD32 is actually 64 bits).
66  */
67 
68 #define swap4bytes(l) {\
69         CARD32 t = (CARD32) l;\
70         char n, *tp = (char *) &t;\
71 	tp += sizeof(CARD32) - 4;\
72 	n = tp[0]; tp[0] = tp[3]; tp[3] = n;\
73 	n = tp[1]; tp[1] = tp[2]; tp[2] = n;\
74         l = t;\
75 }
76 
77 #define swap2bytes(s) {\
78         CARD16 t = (CARD16) s;\
79         char n, *tp = (char *) &t;\
80 	tp += sizeof(CARD16) - 2;\
81 	n = tp[0]; tp[0] = tp[1]; tp[1] = n;\
82         s = t;\
83 }
84 
85 #define swapbytes(v) {\
86         if (sizeof(v) == 2) \
87 	  swap2bytes(v) \
88 	else if (sizeof(v) == 4) \
89 	  swap4bytes(v); \
90 }
91 
92 #define swapdouble(d) {\
93         double dt = (double) d;\
94         unsigned m, *dp = (unsigned *) &dt;\
95 	swap4bytes( dp[0] );\
96 	swap4bytes( dp[1] );\
97         m = dp[0]; dp[0] = dp[1]; dp[1] = m;\
98 	d = dt;\
99 }
100 
101 
102 /*
103  * When a resource record is referenced but not yet fetched, logical or
104  * the convert type with this value as a flag.
105  */
106 #define MrmResourceUnswapped (unsigned char)128
107 
108 
109 /*
110  * URM-wide constants
111  */
112 
113 #define	URMversion		"URM 1.2"
114 #define URM1_1version		"URM 1.1"
115 
116 /*
117  * The indexes of the self-encoding compression tables in a UID file. They
118  * intentionally include characters which are illegal in UIL identifiers.
119  */
120 #define	UilMrmClassTableIndex		">ClassTable"
121 #define UilMrmResourceTableIndex	">ResourceTable"
122 
123 
124 /*
125  * Resource classes and types
126  */
127 #define	URMgNul		0
128 #define	URMgWidget	1
129 #define	URMgLiteral	2		/* types in MrmRtype... */
130 #define	URMgResourceSet	3		/* type in URMrs... */
131 /*			4		unused */
132 #define	URMgMessage	5
133 
134 #define URMgMin		1		/* lowest legal group value */
135 #define	URMgMax		5		/* highest legal group value */
136 #define	URMgVecSize	URMgMax+1	/* To size any vectors */
137 
138 /*
139  * The null resource type
140  */
141 #define	URMtNul		0
142 
143 
144 /*
145  * Access types
146  */
147 #define	URMaPublic	1
148 #define	URMaPrivate	2
149 
150 /*
151  * Index types. Immediate is included for the convenience of the UIL compiler
152  */
153 #define	URMrIndex	1
154 #define	URMrRID		2
155 #define	URMrImmediate	3
156 
157 /*
158  * Maximum number of characters in an index
159  */
160 #define	URMMaxIndexLen	31
161 #define	URMMaxIndexLen1	(URMMaxIndexLen + 1)	/* to size vectors */
162 
163 
164 /*
165  * File open access types
166  */
167 #define	URMReadAccess	1
168 #define	URMWriteAccess	2
169 
170 /*
171  * Standard date string length
172  */
173 #define	URMhsDate		29		/* any date string */
174 
175 
176 /*
177  * Types of resource sets.
178  */
179 #define	URMrsInterfaceModule	1	/* Interface module */
180 
181 
182 /*
183  * Values for the manage flag in memory only -- the manage field in RGMChildDesc
184  * is just a Boolean.
185  */
186 typedef enum {
187 MrmManageUnmanage,
188 MrmManageManage,
189 MrmManageDefault
190 } MrmManageFlag;
191 
192 
193 /*
194  * Urm typedefs
195  */
196 
197 /*
198  * The maximum number of arguments allowed in an arglist or children in
199  * a child list. A number intended to catch gross errors.
200  */
201 #define	RGMListSizeMax		32767
202 
203 
204 /*
205  * URM pointer list
206  *
207  * The following structure is inspired by resource contexts, but is used
208  * to store lists of pointers. Its supporting routines automatically manage
209  * space in the same the context routines do. Since this is used only
210  * internally, no validation is provided.
211  */
212 
213 typedef struct {
214 	int		num_slots ;	/* number of available pointer slots */
215 	int		num_ptrs ;	/* number of slots actually used */
216 	XtPointer	*ptr_vec ;	/* pointer slot vector */
217 } URMPointerList, *URMPointerListPtr ;
218 
219 
220 /*
221  * Accessors for the list or a pointer in the list
222  */
223 #define	UrmPlistPtrList(list) ((list)->ptr_vec)
224 #define	UrmPlistNum(list) ((list)->num_ptrs)
225 #define	UrmPlistPtrN(list,ndx) ((list)->ptr_vec[ndx])
226 
227 
228 
229 /*
230  * URM Resource context
231  *
232  * The following context structure is provided by URM to cover all memory
233  * management of in-memory resources. This mechanism provides:
234  *	o improved memory management efficiency through buffer re-use
235  *	o collection of resource attributes in one place
236  *	o support for non-standard allocation routines
237  */
238 #define	URMResourceContextValid	232570204
239 typedef struct {
240 	unsigned	validation ;	/* validation code =
241 					   URMResourceContextValid */
242 	char		*data_buffer ;	/* pointer to data buffer in memory */
243 	MrmSize		buffer_size ;	/* number of bytes in buffer */
244 	MrmSize		resource_size ;	/* number of bytes used by resource */
245 	MrmGroup	group ;		/* resource group */
246 	MrmType		type ;		/* resource type */
247 	MrmCode		access ;	/* URMaPrivate or URMaPublic */
248 	MrmCode		lock ;		/* resource locking code */
249 	char		*((*alloc_func) ()) ;	/* memory allocation func */
250 	void		(*free_func) () ;	/* deallocation func */
251 	MrmFlag		byte_swapped ;	/* resource is byte_swapped */
252 } URMResourceContext, *URMResourceContextPtr ;
253 
254 
255 /*
256  * Validation macro, returns TRUE/FALSE
257  */
258 #define	UrmRCValid(context) ((context)->validation==URMResourceContextValid)
259 
260 
261 /*
262  * The following are accessor macros for a resource context
263  */
264 #define	UrmRCBuffer(context)	((context)->data_buffer)
265 #define UrmRCBufSize(context)	((context)->buffer_size)
266 #define UrmRCSize(context)	((context)->resource_size)
267 #define UrmRCGroup(context)	((context)->group)
268 #define UrmRCType(context)	((context)->type)
269 #define UrmRCAccess(context)	((context)->access)
270 #define UrmRCLock(context)	((context)->lock)
271 #define UrmRCByteSwap(context)	((context)->byte_swapped)
272 
273 
274 /*
275  * The following are modifiers for a resource context
276  */
277 #define	UrmRCSetBuffer(context,bufadr)    {(context)->data_buffer=(bufadr);}
278 #define	UrmRCSetSize(context,sizval)      {(context)->resource_size=(sizval);}
279 #define UrmRCSetGroup(context,grpval)     {(context)->group=(grpval);}
280 #define UrmRCSetType(context,typval)      {(context)->type=(typval);}
281 #define UrmRCSetAccess(context,accval) 	  {(context)->access=(accval);}
282 #define UrmRCSetLock(context,lckval)	  {(context)->lock=(lckval);}
283 #define UrmRCSetByteSwap(context,swapval) {(context)->byte_swapped=(swapval);}
284 
285 
286 /*
287  * Error reporting states
288  */
289 #define	URMRCErrorDefault	1	/* default - report on line */
290 #define	URMRCErrorSave		2	/* save error, don't report */
291 
292 /*
293  * Error reporting destinations
294  */
295 #define	URMErrOutMemory	1	/* Save error messages in memory, no print */
296 #define	URMErrOutStdout	2	/* print error messages to stdout */
297 
298 
299 
300 /*
301  * IDB definitions in common use. The principal one is IDBFile; others
302  * are included to make that definition valid.
303  */
304 
305 /*
306  * Record type definitions - IDBrt...
307  */
308 #define	IDBrtMin		1
309 #define	IDBrtHeader		1
310 #define	IDBrtIndexLeaf		2
311 #define	IDBrtIndexNode		3
312 #define	IDBrtRIDMap		4
313 #define	IDBrtData		5
314 #define	IDBrtMax		5
315 #define	IDBrtVecSize		6
316 
317 
318 /*
319  * Sizes of fixed-length strings in the file header. Definitions are
320  * provided for both the number of characters in the string and the
321  * constant which gives the string length including the terminating nul.
322  * IDBhs...
323  */
324 #define	IDBhsVersion		9		/* Any version string */
325 #define	IDBhsVersion1		(IDBhsVersion + 1)
326 #define	IDBhsCreator		29		/* Creator id */
327 #define	IDBhsCreator1		(IDBhsCreator + 1)
328 #define	IDBhsDate		URMhsDate	/* Any date string */
329 #define	IDBhsDate1		(IDBhsDate + 1)
330 #define	IDBhsModule		29		/* Module id */
331 #define	IDBhsModule1		(IDBhsModule + 1)
332 
333 
334 /*
335  * Record number. 65k should be enough...
336  */
337 typedef short int       IDBRecordNumber ;
338 
339 
340 /*
341  * A resource ID consists of the resource map index and the ID index
342  * in the given resource map.
343  */
344 typedef short int       IDBResourceIndex ;
345 typedef union {
346 	unsigned		external_id ;	/* Looks like a fullword */
347         struct {
348 	    IDBRecordNumber	map_rec B32 ;    /* resource map record */
349 	    IDBResourceIndex	res_index B32 ;  /* resource index into map */
350         }       internal_id ;     		/* 2 fields internally */
351 } IDBridDesc ;
352 
353 /*
354  * A resource ID passed by value in a fullword.
355  */
356 typedef unsigned        IDBResource ;		/* a declaration for RIDs
357 						   passed by value */
358 
359 
360 
361 
362 /*
363  * Class descriptor.
364  *
365  * This descriptor contains the information URM requires about a toolkit
366  * class.
367  */
368 #define	URMWCIClassDescValid	39963371
369 #define	UrmWCIClassDescValid(classdesc)	\
370     ((classdesc)->validation==URMWCIClassDescValid)
371 
372 typedef struct _WCIClassDesc {
373 	unsigned	validation ;	/* URMWCIClassDescValid */
374 	struct _WCIClassDesc *next_desc ;
375 					/* next descriptor in chain */
376 	String		creator_name ;	/* create routine name. This is also
377 					   the accessor key for non-toolkit
378 					   widget classes. */
379 	Widget		(*creator) () ;	/* low-level create routine. This is
380 					   also the class identifier (name)
381 					   used to match user classes. */
382 	WidgetClass	class_record ;	/* Pointer to toolkit class record */
383 	void		(*cleanup) () ;
384 					/* low-level destructor routine.
385 					   Used to clean up after creation
386 					   routines that leave dangling
387 					   memory (i.e. XmRendition,
388 					   XmRenderTable) */
389 } WCIClassDesc, *WCIClassDescPtr ;
390 
391 
392 /*
393  * Table used to uncompress compression codes in a self-encoding UID file.
394  * Table entries can be overlaid with function pointers for tables which
395  * encode convenience functions.
396  *
397  * The table is accessed by the compression code. Code 0 is unused by
398  * convention, and code 1 is unused because it is the marker for an
399  * unknown (user defined) entry, which is specified by an explicit string.
400  * Thus the valid entries begin at 2 (UilMrmMinValidCode). Any code
401  * < UilMrmMinValidCode or > num_entries is invalid.
402  *
403  * When stored in a UID file, a table is a block of memory with the
404  * following properties:
405  *	o The table is allocated with enough space for all the decompression
406  *	  pointers required.
407  *	o The table is followed by the strings in the table. They are allocated
408  *	  in a heap built from contiguous memory following table itself.
409  */
410 #define UidCompressionTableValid	317938336
411 #define	UilMrmUnknownCode		1
412 #define UilMrmMinValidCode		2
413 #define	UilMrmReservedCodeCount		2
414 
415 typedef union
416     {
417     MrmOffset		stoffset;		/* offset of string in
418 						   heap (in file) */
419     char		*cstring;		/* compressed string as
420 						 a memory pointer */
421     WCIClassDescPtr	cldesc;			/* class descriptor for
422 						   class table */
423     } UidCTableEntry;
424 
425 typedef struct
426     {
427     unsigned		validation;		/* validation code =
428 						   UIDCompressionTableValid */
429     MrmCount		num_entries;		/* number of table entries */
430     UidCTableEntry	entry[1];		/* first entry */
431     } UidCompressionTable, *UidCompressionTablePtr;
432 
433 
434 
435 /*
436  * Hash table entry
437  */
438 #define k_hash_table_size	(127)
439 
440 typedef struct _URMHashTableEntry
441 {
442     char		*az_value;	/* value associated with this name */
443     struct _URMHashTableEntry
444 			*az_next_entry;	/* next entry on hash chain */
445     char		c_text[1];	/* text of the name */
446 } URMHashTableEntry, *URMHashTableEntryPtr;
447 
448 
449 
450 /*
451  * Low level file information.
452  *
453  * This structure is pointed to in the IDBOpenFile structure and blindly
454  * passed to the low level routines.
455  */
456 typedef struct {
457 	unsigned	rab;		/* Record Access Block	*/
458 	int		file_desc;	/* File Descriptor */
459 	char		*name;		/* The file name		*/
460 } IDBLowLevelFile, *IDBLowLevelFilePtr;
461 
462 /*
463  * IDB open file information
464  *
465  * The following is the information retained by IDB for an open file.
466  * Much of this information matches that found in the file header,
467  * and is the source of for that info when the header is updated.
468  */
469 
470 #define	IDBOpenFileValid	421642674
471 typedef struct {
472 	unsigned	validation ;		/* validation code =
473 						   IDBOpenFileValid */
474 	int		get_count ;		/* # get operations on file */
475 	int		put_count ;		/* # put operations on file */
476 	MrmCode		access ;		/* URMReadAccess or
477 						   URMWriteAccess */
478 	IDBLowLevelFilePtr lowlevel_id ;	/* open file id returned
479 						   by low-level routines */
480 	IDBRecordNumber	index_root ;		/* index root pointer */
481 	MrmCount	num_indexed ;		/* # entries in index */
482 	MrmCount	num_RID ;		/* # RID entries in file */
483 	IDBridDesc	next_RID ;		/* next available RID */
484 	IDBRecordNumber	last_record ;		/* last record used in file */
485 	IDBRecordNumber	last_data_record ;	/* last data record in file.
486 						   NULL if no records yet */
487 	MrmCount	group_counts[URMgVecSize] ;
488 						/* vector of record counts
489 						   by resource group */
490 	MrmCount	rt_counts[IDBrtVecSize] ;
491 						/* vector of record counts by
492 						   record type (statistics) */
493 	unsigned long	timer ;			/* for statistics */
494 	char		db_version[IDBhsVersion1] ;
495 						/* database version */
496 	char		creator[IDBhsCreator1] ; /* creator id */
497 	char		creator_version[IDBhsVersion1] ;
498 						/* creator version */
499 	char		creation_date[IDBhsDate1] ;
500 						/* creation date */
501 	char		module[IDBhsModule1] ;	/* module id */
502 	char		module_version[IDBhsVersion1] ;
503 						/* module version */
504 	UidCompressionTablePtr
505 			class_ctable;		/* compression table for
506 						   class info */
507 	UidCompressionTablePtr
508 			resource_ctable;	/* compression table for
509 						   resource info */
510 	int		user1 ;			/* for caller use */
511 	int		user2 ;			/* for caller use */
512 	MrmFlag         byte_swapped ;          /* indicates uid file created on
513 	  					   opposite-endian machine */
514 	MrmFlag		in_memory ;		/* for memory mapped files */
515 	unsigned char 	*uid_buffer ;		/* pointer to memory buffer */
516 } IDBOpenFile, *IDBFile ;
517 
518 
519 
520 /*
521  * Open hierarchy struct
522  *
523  * The following structure represents an open hierarchy. A hierarchy
524  * is principally a list of open IDB files in search order. As an aid to
525  * efficient searching, a list of files by resource group is also kept.
526  * Each entry in the list is the subset of the files in the hierarchy
527  * which contains resources in the corresponding group.
528  */
529 
530 #define	MrmHIERARCHY_VALID	102214835
531 typedef struct MrmHierarchyDescStruct {
532 	unsigned	validation ;		/* MrmHIERARCHY_VALID */
533 	MrmCount	num_file ;		/* number of files open */
534 	IDBFile		*file_list ;		/* list of open files */
535 	MrmCount	grp_num[URMgVecSize] ;	/* vector of file counts by
536 						   resource group */
537 	IDBFile		*grp_ids[URMgVecSize] ;	/* vectors of file ids by
538 						   resource group */
539 	URMHashTableEntryPtr
540 			*name_registry;		/* to register names */
541 } MrmHierarchyDesc;
542 
543 
544 /*
545  * Validation macro
546  */
547 #define	MrmHierarchyValid(hierarchy)		\
548     ((hierarchy)->validation==MrmHIERARCHY_VALID)
549 
550 
551 
552 /*
553  * RGM widget record typedefs
554  */
555 
556 /*
557  * RGM Widget record. All offset are relative to the beginning of the record
558  */
559 #define	URMWidgetRecordValid	373946338
560 
561 /* Variety codes. */
562 #define UilMrmWidgetVariety	0
563 #define UilMrmAutoChildVariety	1
564 
565 typedef struct {
566 	unsigned		validation;	/* validation code =
567 					   URMWidgetRecordValid */
568 	MrmSize		size;		/* Total number of bytes for record */
569 	MrmCode		access;		/* URMaPublic or URMaPrivate */
570 	MrmCode		lock;		/* locking code */
571 	MrmType		type;		/* widget type, equates to class
572 					   for toolkit widgets.  (Unknown or
573 					   a uid-based compression code). */
574 	MrmOffset	name_offs;	/* Offset of widget name. Locates a
575 					   String. Empty string is illegal */
576 	MrmOffset	class_offs;	/* Offset of class name. The class name
577 					   is required for application-defined
578 					   widgets. */
579 	MrmOffset	arglist_offs; 	/* Offset of arglist descriptor.
580 					   Locates a RGMArgListDesc struct */
581 	MrmOffset	children_offs;	/* Offset of children descriptor.
582 					   Locates a RGMChildrenDesc struct */
583 	MrmOffset	comment_offs; 	/* Offset of comment string for
584 					   this widget. (URM extension) */
585 	MrmOffset	creation_offs;	/* Offset of RGMCallnackDesc struct
586 					   specifying URM creation callback
587 					   for this widget */
588 	unsigned long		variety;/* Regular widget or auto child. */
589 	unsigned long		annex; 	/* annex allows compatible growth */
590 } RGMWidgetRecord, *RGMWidgetRecordPtr ;
591 
592 /*
593  * Size of the header part of the record
594  */
595 #define	RGMWidgetRecordHdrSize	sizeof(RGMWidgetRecord)
596 
597 /*
598  * Macro to access the widget record in a context
599  */
600 #define	UrmWRWidgetRec(context)	\
601 	((RGMWidgetRecordPtr) UrmRCBuffer(context))
602 
603 
604 /*
605  * All validation, accessor, and setting macros access a widget record in
606  * a context. They all take a pointer to the widget record, which is
607  * the context buffer CAST to RGMWidgetRecordptr.
608  */
609 #define	UrmWRValid(widgetrec)	\
610     ((widgetrec)->validation==URMWidgetRecordValid)
611 
612 /*
613  * Accessor macros for the widget record header
614  */
615 #define UrmWRPSize(context)		(UrmWRWidgetRec(context)->size)
616 #define	UrmWRPAccess(context)		(UrmWRWidgetRec(context)->access)
617 #define	UrmWRPLock(context)		(UrmWRWidgetRec(context)->lock)
618 #define	UrmWRPType(context)		(UrmWRWidgetRec(context)->type)
619 
620 
621 
622 /*
623  * value descriptor. This consists of a representation type, followed
624  * by a union of either an immediate value or an offset, depending
625  * on the representation type.
626  */
627 typedef struct {
628 	MrmType		rep_type;	/* representation type from
629 					   RGMrType... */
630 	union {
631 	  int		ival;		/* integer, boolean, compressed */
632 	  MrmOffset	offset ;	/* offset for all others */
633 	} datum ;			/* immediate value or offset */
634 } RGMArgValue, *RGMArgValuePtr ;
635 
636 
637 /*
638  * RGM widget record argument descriptor
639  */
640 typedef struct {
641 	MrmCode		tag_code;	/* Either the compressed code for
642 					   the argument tag from URMc...,
643 					   or UilMrmUnknownCode to indicate no
644 					   known string. If UilMrmUnknownCode, then
645 					   the offset is in tag_off */
646 	union
647 	    {
648 	    MrmOffset	tag_offs;	/* offset to tag string if needed */
649 	    MrmCode	related_code;	/* related argument code for case
650 					   where tag_code is valid and a
651 					   related argument is to be set */
652 	    } stg_or_relcode;
653 	RGMArgValue	arg_val ;	/* argument value */
654 } RGMArgument, *RGMArgumentPtr ;
655 
656 
657 /*
658  * RGM widget record arglist descriptor
659  */
660 typedef struct {
661 	MrmCount	count;		/* number of arguments in list */
662 	MrmCount	extra;		/* # extra runtime args needed */
663 	unsigned long	annex1 ;	/* annex allows compatible growth */
664 	RGMArgument	args[1] ;	/* first of the argument descriptors */
665 } RGMArgListDesc, *RGMArgListDescPtr ;
666 
667 
668 
669 /*
670  * RGM widget record text vector item (text vector literal)
671  *
672  * The following represents vectors of either ASCIZ or compound strings.
673  * each member of the vector is type-tagged so that mixed vectors are possible.
674  * This descriptor is a union so that a vector of these items can be over-
675  * written to become an in-memory list of pointers. This avoids some
676  * allocation problems at widget instantiation. Char8 items are String,
677  * CString items are XmString.
678  *
679  * Offsets are interpreted as follows:
680  *	text vector as immediate in widget record - offset from beginning
681  *		of record buffer.
682  *	text vector as UID literal - offset from beginning of resource buffer
683  */
684 typedef union {
685 	  XtPointer	pointer ;	/* for use as memory pointer */
686 	  struct {
687 	      MrmType	rep_type B32;	/* MrmRtypeChar8 or MrmRtypeCString */
688 	      MrmOffset	offset B32;	/* offset of item in record */
689 	  } text_item ;			/* for use as item type & offset */
690 } RGMTextEntry, *RGMTextEntryPtr ;
691 
692 /*
693  * The text Vector. This is designed to allow the vector of text entries
694  * to be over-written into an in-memory vector of pointers. Thus this list
695  * has one extra entry to provide a terminating null.
696  */
697 #define	URMTextVectorValid	34966592
698 typedef struct {
699 	unsigned	validation;	/* URMTextVectorValid */
700 	MrmCount	count;		/* Number of text items in vector */
701 	RGMTextEntry	item[1] ;	/* first text item in a vector of
702 					   n = .count+1 items. item[.count]
703 					   always = NULL */
704 } RGMTextVector, *RGMTextVectorPtr ;
705 
706 
707 /*
708  * The integer Vector. This is designed to allow the vector of integers
709  * to be over-written into an in-memory vector of pointers.
710  */
711 #define	URMIntegerVectorValid	34966593
712 typedef struct {
713 	unsigned	validation;	/* URMIntegerVectorValid */
714 	MrmCount	count;		/* Number of integer items in vector */
715 	int		item[1] ;	/* first integer item in a vector   */
716 					/* of n = .count+1 items.	    */
717 } RGMIntegerVector, *RGMIntegerVectorPtr ;
718 
719 
720 /*
721  * RGM widget record callback item
722  *
723  * A callback item is the offset of a routine name (which must be a
724  * non-imported string), and the routine tag value, which is encoded
725  * as a value. The tag value can evaluate to almost anything, including
726  * an imported value.
727  *
728  * This structure is intended to be over-written with memory pointers
729  * and thus function as an arglist value.
730  */
731 typedef union
732 {
733   int		ival;		/* integer, boolean, compressed */
734   MrmOffset	offset;		/* offset for all others */
735 } RGMdatum;			/* immediate value, offset, widget */
736 
737 
738 typedef union {
739   struct {
740     XtCallbackRec	callback ;	/* item as Xt callback */
741     MrmFlag		resolved; 	/* Item resolved to XtCallbackRec */
742     String		wname;		/* Name of widget reference */
743   } 	runtime;
744 
745   struct {
746     MrmOffset		routine B32;	/* offset to routine name string */
747 					/* duplicate RGMArgValue, avoiding
748 					   union alignment hassles */
749     MrmType		rep_type B32;	/* from RGMrType... */
750     RGMdatum		datum ;		/* immediate value, offset, widget */
751   } 	cb_item ;			/* callback item in record */
752 } RGMCallbackItem, *RGMCallbackItemPtr ;
753 
754 /*
755  * RGM widget record callback argument descriptor. This list has
756  * count + 1 entries so that this structure may be overwritten
757  */
758 #define	URMCallbackDescriptorValid	107397480
759 typedef struct {
760         unsigned	validation;		/* URMCallbackDescriptorValid */
761 	MrmCount	count;			/* Number of callback items */
762 	MrmCount	annex;		  	/* annex allows growth */
763 	MrmCount	unres_ref_count;	/* # of unresolved widget refs
764 	                                           in the RGMCallbackItems */
765 	RGMCallbackItem item[1] ;		/* First callback item in a list
766 	                                           of n = .count+1 items */
767 } RGMCallbackDesc, *RGMCallbackDescPtr ;
768 
769 /*
770  * We need to have the 1.1 versions of RGMCallbackItem and RGMCallbackDesc
771  * so that backwards compatibility can be maintained between 1.1 and 1.2.
772  */
773 typedef union {
774 	XtCallbackRec	runtime ;	/* item as Xt callback */
775 	struct {
776 	  MrmOffset	routine ;	/* offset to routine name string */
777 					/* duplicate RGMArgValue, avoiding
778 					   union alignment hassles */
779 	  MrmType	rep_type ;	/* from RGMrType... */
780 	  RGMdatum	 datum ;	/* immediate value or offset */
781 	} cb_item ;			/* callback item in record */
782 } OldRGMCallbackItem, *OldRGMCallbackItemPtr ;
783 
784 typedef struct {
785 	unsigned	validation ;	/* URMCallbackDescriptorValid */
786 	MrmCount	count ;		/* Number of callback items */
787 	unsigned long	annex1 ;	/* annex allows compatible growth */
788 	OldRGMCallbackItem  item[1] ;	/* First callback item in a list
789 					   of n = .count+1 items */
790 } OldRGMCallbackDesc, *OldRGMCallbackDescPtr ;
791 
792 /* BEGIN OSF Fix CR 4859 */
793 
794 /*
795  * Wide character uid form
796  *
797  * The following represents a multi-byte string which needs to be converted
798  * to a wide-character string when it is retrieved.
799  * The structure contains a byte count followed by the bytes.
800  */
801 typedef union {
802     XtPointer	pointer;			  /* for use as memory pointer */
803     struct {
804       MrmCount	count;				  /* # of bytes */
805       char bytes[1];				  /* vector of bytes */
806     } wchar_item;
807 } RGMWCharEntry, *RGMWCharEntryPtr;
808 
809 /* END OSF Fix CR 4859 */
810 
811 /*
812  * Font literal
813  *
814  * The following represents a MrmRtypeFont literal. Since it contains two
815  * strings, the same offset mechanism is used to store both, and this
816  * is a fixed-length data structure.
817  * data structure.
818  */
819 typedef struct {
820     union
821 	{
822 	/*XmStringCharset*/char* 	charset; /* character set (resolved) */
823 	MrmOffset	cs_offs;	/* character set in buffer */
824 
825 	} cset;
826     union
827 	{
828 	String		font;		/* string naming font */
829 	MrmOffset	font_offs;	/* font name in buffer */
830 	} font;
831     MrmCode		type;
832 } RGMFontItem, *RGMFontItemPtr ;
833 
834 
835 /*
836  * A font list, which is a vector of font items. The font items are
837  * treated as a heap store following the fixed length list (similar
838  * to text vectors). Font lists in widget records have offsets from
839  * the beginning of the record; font list literals in a UID file have
840  * offsets from the beginning of the list itself (just like text
841  * vectors). Font items in a font list are a union of a pointer and
842  * an offset, so that (as in text vectors) they can be converted in
843  * place to an in-memory pointer list.
844  */
845 #define URMFontListValid	74149235
846 typedef struct {
847 	unsigned		validation;	/* URMFontListValid */
848 	MrmCount		count;		/* # of font items in list */
849 	RGMFontItem		item[1] ;	/* vector of RGMFontItems */
850 } RGMFontList, *RGMFontListPtr ;
851 
852 /*
853  * We need to have the 1.1 versions of RGMFontItem and RGMFontList
854  * so that backwards compatibility can be maintained between 1.1 and 1.2.
855  */
856 typedef struct {
857     union
858 	{
859 	/*XmStringCharset*/char*	charset;	/* character set (resolved) */
860 	MrmOffset	cs_offs;	/* character set in buffer */
861 	} cset;
862     union
863 	{
864 	String		font;		/* string naming font */
865 	MrmOffset	font_offs;	/* font name in buffer */
866 	} font;
867 } OldRGMFontItem, *OldRGMFontItemPtr ;
868 
869 typedef struct {
870 	unsigned		validation ;	/* URMFontListValid */
871 	MrmCount		count ;		/* # of font items in list */
872 	OldRGMFontItem		item[1] ;	/* vector of RGMFontItems */
873 } OldRGMFontList, *OldRGMFontListPtr ;
874 
875 
876 /*
877  * RGM widget record child descriptor
878  */
879 typedef struct {
880 	MrmFlag		manage ;	/* true if child is managed by parent
881 					   at initialization */
882 	MrmSCode	access ;	/* URMaPublic or URMaPrivate */
883 	MrmSCode	unused1 ;	/* formerly class, unused anywhere */
884 	MrmSCode	type ;		/* specifier type - URMrIndex or
885 					   URMrRID */
886 	unsigned long	annex1;		/* annex allows compatible growth */
887 	union {
888 	  int		index_offs;	/* index string offset (URMrIndex) */
889 	  MrmResource_id	id;	/* IDB resource id (URMrRID) */
890 	} key ;				/* key to widget by index or id */
891 } RGMChildDesc, *RGMChildDescPtr ;
892 
893 
894 /*
895  * RGM widget record children list descriptor
896  */
897 typedef struct {
898 	MrmCount	count;		/* number of children */
899 	MrmCode		unused1;	/* formerly access, unused anywhere */
900 	unsigned long	annex1;		/* annex allows compatible growth */
901 	RGMChildDesc	child[1] ;	/* First child descriptor in a list of
902 					   n = .count descriptors. */
903 } RGMChildrenDesc, *RGMChildrenDescPtr ;
904 
905 
906 /*
907  * RGM widget record URM resource descriptor. This is commonly used as the
908  * value of an argument which is a discrete resource. In this case, the
909  * resource specifies the data type required for the argument (from
910  * RGMrType...) to allow conversion if the literal is a different type
911  * when read.
912  */
913 typedef struct {
914 	MrmSize		size;		/* number of bytes in structure */
915 	MrmFlag		access ;	/* Public/private - URMaPublic or
916 					   URMaPrivate for this resource */
917 	MrmSCode	type ;		/* URMrIndex or URMrRID */
918 	MrmSCode	res_group ;	/* resource group */
919 	MrmSCode	cvt_type ;	/* RGMrType... to which the resource
920 					   needs to be converted when used
921 					   as an argument value. RGMwrType
922 					   for widget references. */
923 	unsigned long	annex1 ;	/* annex allows compatible growth */
924 
925 	union {
926 	  char		index[1] ;	/* index for URMrIndex resource
927 					   (nul teminated) */
928 	  MrmResource_id	id ;	/* resource id */
929 	} key ;				/* key to resource by index or id */
930 } RGMResourceDesc, *RGMResourceDescPtr ;
931 
932 /*
933  * When a resource descriptor names a widget, the cvt_type is used to
934  * indicate the type of reference, which indicates the processing required.
935  */
936 #define	RGMwrTypeReference	233	/* Reference a widget defined by
937 					   a CreateInstance elsewhere */
938 #define	RGMwrTypeSubTree	234	/* Subtree reference. The subtree
939 					   must be instantiated as part of
940 					   the current operation */
941 
942 
943 
944 /*
945  * Interface module descriptor
946  *
947  * An interface module is currently the only type of resource set defined.
948  * It defines the topmost widgets for some application (there is no
949  * requirement that there be only one interface module for an application).
950  */
951 
952 /*
953  * A topmost widget descriptor. These are currently required to be
954  * accessed by index only, and the index is currently the only information
955  * saved. The index is stored as a fixed-length entry to simplify the
956  * layout of an interface module.
957  *
958  * The widgets referenced in an interface module are those who have
959  * no parent in the interface definition. Commonly these will have
960  * the top-level widget as their parent at runtime, but this is not
961  * required.
962  */
963 typedef struct {
964 	char		index[URMMaxIndexLen1] ;
965 					/* Index (name) of widget */
966 } RGMTopmostDesc, *RGMTopmostDescPtr ;
967 
968 
969 #define URMInterfaceModuleValid	408427447
970 typedef struct {
971 	unsigned	validation;	/* URMInterfaceModuleValid */
972 	MrmCount	count;		/* number of topmost widgets */
973 	unsigned long	annex1;		/* annex allows compatible growth */
974 	unsigned long	annex2;		/* annex allows compatible growth */
975 	RGMTopmostDesc	topmost[1] ;	/* First topmost descriptor in a
976 					   list of n= .count descriptors */
977 } RGMModuleDesc, *RGMModuleDescPtr ;
978 
979 
980 /*
981  * Validation macro
982  */
983 #define	UrmInterfaceModuleValid(module)		\
984     ((module)->validation==URMInterfaceModuleValid)
985 
986 
987 
988 /*
989  * Representations for URM color descriptor (MrmRtypeColor) and
990  * color table (MrmRtypeColorTable).
991  */
992 
993 /*
994  * RGB color data structure
995  */
996 
997 typedef struct {
998 	unsigned short	red;   		/* RGB colors */
999 	unsigned short	green;   	/* RGB colors */
1000 	unsigned short	blue;   	/* RGB colors */
1001 }RGBColor, *RGBColorPtr;
1002 
1003 /*
1004  * URM color descriptor. This is a color name plus a fallback
1005  * designator specifying the color as foreground or background.
1006  */
1007 typedef struct {
1008 	MrmSCode	mono_state ;	/* monochrome treatment, from
1009 					   URMColorMonochrome... */
1010 	MrmSCode	desc_type;	/* color desc_type from
1011 					   URMColorDescType... */
1012         union {
1013 	    char	name[1] ;	/* color name */
1014 	    RGBColor	rgb ;		/* RGB Color */
1015 	    } desc;
1016 } RGMColorDesc, *RGMColorDescPtr ;
1017 
1018 /*
1019  * Monochrome treatments
1020  */
1021 #define	URMColorMonochromeUnspecified	1
1022 #define	URMColorMonochromeForeground	2
1023 #define	URMColorMonochromeBackground	3
1024 
1025 
1026 /*
1027  * Color descriptor types
1028  */
1029 #define URMColorDescTypeName	1
1030 #define URMColorDescTypeRGB	2
1031 
1032 /*
1033  * Use this Min size plus the size of the color name string to determine the
1034  * exact size that the RGMColorDesc will need to allocate.
1035  */
1036 #define RGMColorDescNameMinSize (sizeof (RGMColorDesc)\
1037 				 - sizeof (RGBColor)\
1038 				 + sizeof (char))
1039 
1040 /*
1041  * URM color table item. This is a pointer to a color descriptor, plus
1042  * a Pixel for the runtime conversion of the color.
1043  */
1044 typedef struct {
1045 	Pixel			color_pixel ;	/* runtime translation */
1046 	MrmType			type;	/* descriptor reference type,
1047 					   either MrmRtypeColor, or
1048 					   or MrmRtypeResource if
1049 					   coffs locates a resource */
1050 	unsigned long		annex1;	/* annex allows growth */
1051 
1052 	union {
1053 	  RGMColorDescPtr	cptr ;	/* in-memory color descriptor */
1054 	  MrmOffset		coffs; 	/* descriptor/resource in record */
1055 	} color_item ;			/* pointer or offset */
1056 } RGMColorTableEntry, *RGMColorTableEntryPtr ;
1057 
1058 
1059 /*
1060  * A color table. This is a vector of color items. Items 0 and 1 are
1061  * reserved for "background"(0) and "foreground"(1) in all color tables;
1062  * user-specified colors begin at entry 2. The color count always
1063  * includes these predefined colors, so the minimum count is 2. No
1064  * color descriptor is required or used for the predefined entries;
1065  * only the color_pixel field in the table item is ever used.
1066  *
1067  * Color descriptor offsets are valid only in a widget record. All
1068  * other instances of a color table, including those which are
1069  * are parameters to the widget record creation routines, must have
1070  * valid memory pointers.
1071  */
1072 #define	URMColorTableValid	9424574
1073 typedef struct {
1074 	unsigned		validation ;	/* URMColorTableValid */
1075 	MrmCount		count ;		/* # entries in table */
1076 	RGMColorTableEntry	item[1] ;	/* 1st entry in table */
1077 } RGMColorTable, *RGMColorTablePtr ;
1078 
1079 /*
1080  * Predefined entries, first accessible user-defined entry
1081  */
1082 #define	URMColorTableBG		0
1083 #define	URMColorTableFG		1
1084 #define	URMColorTableUserMin	2
1085 
1086 
1087 
1088 /*
1089  * Definitions to a support a URM icon; the representation for
1090  * MrmRtypeIconImage objects.
1091  *
1092  * A URM icon supports a pixmap of arbitrary size and with, and with support
1093  * for up to 256 colors including foreground and background. The
1094  * icon pixels are stored using either 1, 4, or 8 bits, depending on
1095  * how much information is required to index the icon's color map.
1096  *
1097  * The pixel array is stored in row-major order. Each row begins on a byte
1098  * boundary no matter what the pixel size is. URM uses the ZPixmap
1099  * representation for the image data at runtime, and attempts to avoid
1100  * allocating memory for the pixel array by overwriting the pixel data
1101  * array with Pixel values if the number of bits per pixel is sufficient.
1102  *
1103  * The color table design is intended to support eventual creation of
1104  * color tables as discrete resources, possibly accessible as resource
1105  * references. Currently, the color table must be allocated and managed
1106  * as part of the icon image.
1107  *
1108  * Icon image offsets are valid only in a widget record. All
1109  * other instances of an icon image, including those which are
1110  * are parameters to the widget record creation routines, must have
1111  * valid memory pointers.
1112  */
1113 
1114 #define	URMIconImageValid	160003640
1115 typedef struct {
1116 	unsigned		validation;	/* URMIconImageValid */
1117 	MrmSCode		pixel_size ;	/* from URMIconPixelSize... */
1118 	MrmCount		width;		/* # pixels wide */
1119 	MrmCount		height;		/* # pixels high */
1120 	MrmCount		hot_x, hot_y ;	/* hot spot location */
1121 	MrmType			ct_type;	/* MrmRtypeColorTable for
1122 						   table in record.
1123 						   MrmRtypeResource for
1124 						   separate resource ref. */
1125 	unsigned long		annex1;	 	/* annex allows growth */
1126 	union {
1127 	  RGMColorTablePtr	ctptr ;		/* in-memory color table */
1128 	  MrmOffset		ctoff;		/* color table or resource
1129 						   desc offset in record */
1130 	} color_table ;				/* memory/record color table */
1131 	union {
1132 	  char			*pdptr ;	/* pixel data in memory */
1133 	  MrmOffset		pdoff;		/* pixel data record offset */
1134 	} pixel_data ;
1135 } RGMIconImage, *RGMIconImagePtr ;
1136 
1137 
1138 /*
1139  * Pixel sizes. These are limited and specified with literals.
1140  */
1141 #define	URMPixelSize1Bit	1	/* 1 bit (bitmap) */
1142 #define	URMPixelSize2Bit	2	/* 2 bits */
1143 #define	URMPixelSize4Bit	3	/* 4 bits */
1144 #define	URMPixelSize8Bit	4	/* 8 bits */
1145 
1146 
1147 
1148 /*
1149  * Definitions of the data structures used to store units information for
1150  * dimensional values.
1151  */
1152 typedef struct {
1153     unsigned value; /* the actual integer value */
1154     unsigned units; /* the units designation of the value. Matches
1155 		     the Xm units values in Xm.h */
1156 } RGMUnitsInteger, *RGMUnitsIntegerPtr ;
1157 
1158 typedef struct {
1159     unsigned long value[2]; /* the actual floating point value */
1160     unsigned units;  /* the units designation of the value. Matches
1161 		     the Xm units values in Xm.h */
1162 } RGMUnitsFloat, *RGMUnitsFloatPtr ;
1163 
1164 
1165 /*
1166  * Definition of the data structure used during widget creation to retain
1167  * and provide the information required to resolve widget arguments which
1168  * must be SetValue rather than create. The layout and use of
1169  * the descriptor depends on the type argument:
1170  *		URMsvWidgetRef - widget resource forward reference. Resolved
1171  *			when the widget is defined, applied when all the
1172  *			widgets in a tree are instantiated.
1173  *		URMsvIconImage - Icon image which is SetValued immediately
1174  *			after the widget create (when foreground/backgound
1175  *			info is available).
1176  */
1177 typedef struct {
1178 	Widget		setw ;		/* widget to be modified */
1179 	MrmCode		type ;		/* from URMsv... */
1180 	MrmCode		tagcode ;	/* code of argument to be set */
1181 	String		tagname ;	/* string name of argument. If
1182 					   the tag code is UilMrmUnknownCode,
1183 					   this must be freed. */
1184 	MrmFlag		done ;		/* set TRUE when SetValues done */
1185 	union {
1186 	    String		wname ;		/* arg widget index */
1187 	    RGMIconImagePtr	icon ;		/* icon pointer only */
1188 	    RGMCallbackDescPtr	callbacks;	/* callback list */
1189 	} sv ;				/* some SetValues descriptor */
1190 } URMSetValuesDesc, *URMSetValuesDescPtr ;
1191 
1192 /*
1193  * SetValues descriptor types
1194  */
1195 #define	URMsvWidgetRef		1	/* widget reference */
1196 #define	URMsvIconImage		2	/* icon image */
1197 #define	URMsvCallBackList	3	/* list of callbacks */
1198 
1199 
1200 /*
1201  * The following data structures support resolving references to widgets
1202  * found during creation of a widget tree. The data structure retains
1203  * an ordered list of the widget name/id pairs instantiated during
1204  * tree creation. The data structure is maintained in a resource context
1205  * which allows for expansion. The top part of the data structure retains
1206  * fixed-length information, while the bottom part of the buffer is
1207  * used as a string heap.
1208  */
1209 
1210 /*
1211  * Single element in the fixed-length vector
1212  */
1213 typedef struct {
1214     Widget		w_id;			/* widget id */
1215     MrmOffset		w_name_offs;		/* name offset in heap */
1216 } URMWRef, URMWRefPtr;
1217 
1218 /*
1219  * Header for the structure
1220  */
1221 typedef struct {
1222     MrmCount		num_refs;		/* # entries defined */
1223     MrmCount		heap_size;		/* # bytes used in heap */
1224     URMWRef		refs[1];		/* beginning of vector */
1225 } URMWRefStruct, *URMWRefStructPtr;
1226 
1227 
1228 /*
1229  * size and access macros
1230  */
1231 #define UrmWRefHeaderBytes(ref_id) \
1232     (sizeof(URMWRefStruct)+((ref_id)->num_refs-1)*sizeof(URMWRef))
1233 #define UrmWRefBytesUsed(ref_id) \
1234     (UrmWRefHeaderBytes((ref_id))+(ref_id)->heap_size)
1235 #define UrmWRefIdN(ref_id,ndx) \
1236     ((ref_id)->refs[(ndx)].w_id)
1237 #define UrmWRefNameN(ref_id,ndx) \
1238     ((String)((String)(ref_id)+(ref_id)->refs[(ndx)].w_name_offs))
1239 
1240 
1241 
1242 /*
1243  * Function prototypes for URM routines
1244  */
1245 #ifndef _ARGUMENTS
1246 #define _ARGUMENTS(arglist) arglist
1247 #endif
1248 
1249 #include "IDB.h"			/* needed for prototype definitions */
1250 
1251 /* mrmcontext.c */
1252 extern Cardinal UrmGetResourceContext  _ARGUMENTS(( char *((*alloc_func )()),
1253 						    void (*free_func )(),
1254 						    MrmSize size ,
1255 						    URMResourceContextPtr *context_id_return ));
1256 extern Cardinal UrmResizeResourceContext  _ARGUMENTS(( URMResourceContextPtr context_id ,
1257 						    int size ));
1258 extern Cardinal UrmFreeResourceContext  _ARGUMENTS(( URMResourceContextPtr context_id ));
1259 
1260 /* mrmerror.c */
1261 extern Cardinal Urm__UT_Error  _ARGUMENTS(( char *module ,
1262 					    char *error ,
1263 					    IDBFile file_id ,
1264 					    URMResourceContextPtr context_id ,
1265 					    Cardinal status ));
1266 extern Cardinal Urm__UT_SetErrorReport  _ARGUMENTS(( MrmCode report_type ));
1267 extern MrmCode Urm__UT_LatestErrorCode  _ARGUMENTS(( void ));
1268 extern String Urm__UT_LatestErrorMessage  _ARGUMENTS(( void ));
1269 extern String Urm__UT_UrmCodeString  _ARGUMENTS(( MrmCode cod ));
1270 
1271 /* mrmhier.c */
1272 extern Cardinal Urm__OpenHierarchy  _ARGUMENTS(( MrmCount num_files ,
1273 						 String *name_list ,
1274 						 MrmOsOpenParamPtr *os_ext_list ,
1275 						 MrmHierarchy *hierarchy_id_return,
1276 						 MrmFlag in_memory,
1277 						 unsigned char *uid_buffer));
1278 extern Cardinal Urm__CloseHierarchy  _ARGUMENTS(( MrmHierarchy hierarchy_id ));
1279 extern Cardinal UrmHGetIndexedResource  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1280 						String index ,
1281 						MrmGroup group_filter ,
1282 						MrmType type_filter ,
1283 						URMResourceContextPtr context_id ,
1284 						IDBFile *file_id_return ));
1285 extern Cardinal Urm__RegisterNamesInHierarchy  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1286 							    String *names ,
1287 							    XtPointer *values ,
1288 							    MrmCount num_cb ));
1289 extern Cardinal Urm__LookupNameInHierarchy  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1290 							String name ,
1291 							XtPointer *value_return ));
1292 
1293 /* mrmibuffer.c */
1294 extern Cardinal Idb__BM_InitBufferVector _ARGUMENTS(( void ));
1295 extern Cardinal Idb__BM_GetBuffer  _ARGUMENTS(( IDBFile file_id ,
1296 						IDBRecordBufferPtr *buffer_return ));
1297 extern Cardinal Idb__BM_MarkActivity  _ARGUMENTS(( IDBRecordBufferPtr buffer ));
1298 extern Cardinal Idb__BM_MarkModified  _ARGUMENTS(( IDBRecordBufferPtr buffer ));
1299 extern Cardinal Idb__BM_GetRecord  _ARGUMENTS(( IDBFile file_id ,
1300 						IDBRecordNumber record ,
1301 						IDBRecordBufferPtr *buffer_return ));
1302 extern Cardinal Idb__BM_InitRecord  _ARGUMENTS(( IDBFile file_id ,
1303 						IDBRecordNumber record ,
1304 						MrmType type ,
1305 						IDBRecordBufferPtr *buffer_return ));
1306 extern Cardinal Idb__BM_InitDataRecord  _ARGUMENTS(( IDBFile file_id ,
1307 						IDBRecordBufferPtr *buffer_return ));
1308 extern Cardinal Idb__BM_Decommit  _ARGUMENTS(( IDBRecordBufferPtr buffer ));
1309 extern Cardinal Idb__BM_DecommitAll  _ARGUMENTS(( IDBFile file_id ));
1310 
1311 /* mrmicon.c */
1312 extern Cardinal UrmCreatePixmap  _ARGUMENTS(( RGMIconImagePtr icon ,
1313 					    Screen *screen ,
1314 					    Display *display ,
1315 					    Pixel fgpix ,
1316 					    Pixel bgpix ,
1317 					    Pixel *pixmap ,
1318 					    Widget parent ));
1319 extern Cardinal UrmCreateBitmap	_ARGUMENTS(( RGMIconImagePtr icon ,
1320 					    Screen *screen ,
1321 					    Display *display ,
1322 					    Pixel *pixmap ));
1323 extern Cardinal Urm__CW_ReadBitmapFile  _ARGUMENTS(( String filename ,
1324 						    Screen *screen ,
1325 						    Pixel fgint ,
1326 						    Pixel bgint ,
1327 						    Pixmap *pixmap ,
1328 						    Widget parent ));
1329 extern Cardinal Urm__MapIconBitmap  _ARGUMENTS(( RGMIconImagePtr icon ,
1330 						int srcpix ,
1331 						RGMColorTablePtr ctable ,
1332 						Screen *screen ,
1333 						Display *display ,
1334 						Pixmap *pixmap ));
1335 extern Cardinal Urm__MapIconBitmapDepth1  _ARGUMENTS(( RGMIconImagePtr icon ,
1336  						int srcpix ,
1337  						Screen *screen ,
1338  						Display *display ,
1339  						Pixmap *pixmap ));
1340 extern Cardinal Urm__MapIconReplace  _ARGUMENTS(( RGMIconImagePtr icon ,
1341 						int srcpix ,
1342 						RGMColorTablePtr ctable ,
1343 						Screen *screen ,
1344 						Display *display ,
1345 						Pixmap *pixmap ,
1346 						Widget parent ));
1347 extern Cardinal Urm__MapIconAllocate  _ARGUMENTS(( RGMIconImagePtr icon ,
1348 						int srcpix ,
1349 						int dstpix ,
1350 						RGMColorTablePtr ctable ,
1351 						Screen *screen ,
1352 						Display *display ,
1353 						Pixmap *pixmap ,
1354 						Widget parent ));
1355 extern Cardinal Urm__RealizeColorTable  _ARGUMENTS(( Screen *screen ,
1356 						Display *display ,
1357 						Pixel fgpix ,
1358 						Pixel bgpix ,
1359 						RGMColorTablePtr ctable ,
1360 						Widget parent ));
1361 extern RGMIconImagePtr UrmCopyAllocatedIconImage  _ARGUMENTS(( RGMIconImagePtr dst_icon ,
1362 							    RGMIconImagePtr src_icon ));
1363 extern Cardinal Urm__UT_GetNamedColorPixel  _ARGUMENTS(( Display *display ,
1364 							Colormap cmap ,
1365 							RGMColorDescPtr colorptr ,
1366 							Pixel *pixel_return ,
1367 							Pixel fallback));
1368 extern Cardinal Urm__UT_GetColorPixel  _ARGUMENTS(( Display *display ,
1369 						    Colormap cmap ,
1370 						    RGMColorDescPtr colorptr ,
1371 						    Pixel *pixel_return,
1372 						    Pixel fallback));
1373 extern Cardinal UrmIconImageSize  _ARGUMENTS(( RGMIconImagePtr icon ));
1374 extern Cardinal UrmColorTableSize  _ARGUMENTS(( RGMColorTablePtr ctable ));
1375 
1376 /* mrmientry.c */
1377 extern Cardinal Idb__DB_GetDataEntry  _ARGUMENTS(( IDBFile file_id ,
1378 						IDBDataHandle data_entry ,
1379 						URMResourceContextPtr context_id ));
1380 extern Cardinal Idb__DB_PutDataEntry  _ARGUMENTS(( IDBFile file_id ,
1381 						URMResourceContextPtr context_id ,
1382 						IDBDataHandle *data_entry ));
1383 extern Boolean Idb__DB_MatchFilter  _ARGUMENTS(( IDBFile file_id ,
1384 						IDBDataHandle data_entry ,
1385 						MrmCode group_filter ,
1386 						MrmCode type_filter ));
1387 
1388 /* mrmifile.c */
1389 extern Cardinal Idb__FU_OpenFile  _ARGUMENTS(( char *name ,
1390 						MrmCode access ,
1391 						MrmOsOpenParamPtr os_ext ,
1392 						IDBLowLevelFilePtr *file_id ,
1393 						char *returned_fname ));
1394 extern Cardinal Idb__FU_PutBlock _ARGUMENTS((IDBLowLevelFile	*file_id,
1395 					     IDBRecordNumber	block_num,
1396 					     char		*buffer)) ;
1397 extern Cardinal Idb__FU_CloseFile _ARGUMENTS((IDBLowLevelFile	*file_id,
1398 				   int			del)) ;
1399 extern Cardinal Idb__FU_GetBlock  _ARGUMENTS(( IDBLowLevelFile *file_id ,
1400 						IDBRecordNumber block_num ,
1401 						char *buffer ));
1402 
1403 /* mrmiheader.c */
1404 extern Cardinal Idb__HDR_GetHeader  _ARGUMENTS(( IDBFile file_id ));
1405 extern Cardinal Idb__HDR_InitHeader  _ARGUMENTS(( IDBFile file_id ,
1406 						String creator ,
1407 						String creator_version ,
1408 						String module ,
1409 						String module_version ));
1410 extern Cardinal Idb__HDR_PutHeader  _ARGUMENTS(( IDBFile file_id ));
1411 extern Cardinal Idb__HDR_UpdateHeader  _ARGUMENTS(( IDBFile file_id ,
1412 						    IDBRecordBufferPtr *buffer ));
1413 extern Cardinal Idb__HDR_EnterItem  _ARGUMENTS(( IDBFile file_id ,
1414 						IDBResource resource_id ,
1415 						IDBDataHandle data_entry ));
1416 extern Cardinal Idb__HDR_ReturnItem  _ARGUMENTS(( IDBFile file_id ,
1417 						IDBResource resource_id ,
1418 						Boolean signal_null ,
1419 						IDBDataHandle *entry_return ));
1420 extern Cardinal Idb__HDR_NextRID  _ARGUMENTS(( IDBFile file_id ,
1421 						IDBResource *res_id_return ));
1422 extern Cardinal Idb__HDR_GetDataEntry  _ARGUMENTS(( IDBFile file_id ,
1423 						    IDBDataHandle data_entry ,
1424 						    URMResourceContextPtr context_id ));
1425 extern Cardinal Idb__HDR_PutDataEntry  _ARGUMENTS(( IDBFile file_id ,
1426 						    URMResourceContextPtr context_id ,
1427 						    IDBDataHandle *data_entry ));
1428 extern Boolean Idb__HDR_MatchFilter  _ARGUMENTS(( IDBFile file_id ,
1429 						    IDBDataHandle data_entry ,
1430 						    MrmCode group_filter ,
1431 						    MrmCode type_filter ));
1432 
1433 /* mrmiindex.c */
1434 extern Cardinal Idb__INX_ReturnItem  _ARGUMENTS(( IDBFile file_id ,
1435 						    char *index ,
1436 						    IDBDataHandle *data_entry ));
1437 extern Cardinal Idb__INX_FindIndex  _ARGUMENTS(( IDBFile file_id ,
1438 						    char *index ,
1439 						    IDBRecordBufferPtr *buffer_return ,
1440 						    MrmCount *index_return ));
1441 extern Cardinal Idb__INX_SearchIndex  _ARGUMENTS(( IDBFile file_id ,
1442 						    char *index ,
1443 						    IDBRecordBufferPtr buffer ,
1444 						    MrmCount *index_return ));
1445 extern Cardinal Idb__INX_GetBtreeRecord  _ARGUMENTS(( IDBFile file_id ,
1446 							IDBRecordBufferPtr *buffer_return ,
1447 							MrmCount entry_index ,
1448 							Cardinal order ));
1449 extern Cardinal Idb__INX_FindResources  _ARGUMENTS(( IDBFile file_id ,
1450 							IDBRecordNumber recno ,
1451 							MrmGroup group_filter ,
1452 							MrmType type_filter ,
1453 							URMPointerListPtr index_list ));
1454 
1455 /* mrmiindexw.c */
1456 extern Cardinal Idb__INX_EnterItem  _ARGUMENTS(( IDBFile file_id ,
1457 						    char *index ,
1458 						    IDBDataHandle data_entry ));
1459 extern Cardinal Idb__INX_EnterLeafIndex  _ARGUMENTS(( IDBFile file_id ,
1460 							IDBRecordBufferPtr buffer ,
1461 							char *index ,
1462 							IDBDataHandle data_entry ,
1463 							MrmCount entry_index ,
1464 							Cardinal order ));
1465 extern Cardinal Idb__INX_EnterNodeIndex  _ARGUMENTS(( IDBFile file_id ,
1466 							IDBRecordBufferPtr buffer ,
1467 							char *index ,
1468 							IDBDataHandle data_entry ,
1469 							IDBRecordNumber lt_record ,
1470 							IDBRecordNumber gt_record ));
1471 extern Cardinal Idb__INX_SplitLeafRecord  _ARGUMENTS(( IDBFile file_id ,
1472 							IDBRecordBufferPtr gt_buffer ));
1473 extern Cardinal Idb__INX_SplitNodeRecord  _ARGUMENTS(( IDBFile file_id ,
1474 							IDBRecordBufferPtr gt_buffer ));
1475 extern Cardinal Idb__INX_InitRootLeafRecord  _ARGUMENTS(( IDBFile file_id ,
1476 							    IDBRecordBufferPtr *buffer_return ));
1477 extern Cardinal Idb__INX_InitRootNodeRecord  _ARGUMENTS(( IDBFile file_id ,
1478 							    IDBRecordBufferPtr *buffer_return ,
1479 							    char *index ,
1480 							    IDBDataHandle data_entry ,
1481 							    IDBRecordNumber lt_record ,
1482 							    IDBRecordNumber gt_record ));
1483 extern void Idb__INX_CopyLeafRecord  _ARGUMENTS(( IDBIndexLeafRecordPtr dst_recptr ,
1484 						    IDBIndexLeafRecordPtr src_recptr ));
1485 extern void Idb__INX_CopyNodeRecord  _ARGUMENTS(( IDBIndexNodeRecordPtr dst_recptr ,
1486 						    IDBIndexNodeRecordPtr src_recptr ));
1487 extern void Idb__INX_CollapseLeafRecord  _ARGUMENTS(( IDBIndexLeafRecordPtr recptr ,
1488 							MrmCount start ,
1489 							MrmCount end ));
1490 extern void Idb__INX_CollapseNodeRecord  _ARGUMENTS(( IDBIndexNodeRecordPtr recptr ,
1491 							MrmCount start ,
1492 							MrmCount end ));
1493 extern Cardinal Idb__INX_ConfirmNodeSpace  _ARGUMENTS(( IDBFile file_id ,
1494 							IDBRecordBufferPtr buffer ));
1495 extern Cardinal Idb__INX_SetParent  _ARGUMENTS(( IDBFile file_id ,
1496 						    IDBRecordNumber parent_record ,
1497 						    IDBRecordNumber child_record ));
1498 extern Cardinal Idb__INX_FixNodeChildren  _ARGUMENTS(( IDBFile file_id ,
1499 							IDBRecordNumber p_record ));
1500 
1501 /* mrmirid.c */
1502 extern Cardinal Idb__RID_EnterItem  _ARGUMENTS(( IDBFile file_id ,
1503 						    IDBResource resource_id ,
1504 						    IDBDataHandle data_entry ));
1505 extern Cardinal Idb__RID_ReturnItem  _ARGUMENTS(( IDBFile file_id ,
1506 						    IDBResource resource_id ,
1507 						    Boolean signal_null ,
1508 						    IDBDataHandle *entry_return ));
1509 extern Cardinal Idb__RID_NextRID  _ARGUMENTS(( IDBFile file_id ,
1510 						IDBResource *res_id_return ));
1511 extern Cardinal Idb__RID_AddRecord  _ARGUMENTS(( IDBFile file_id ));
1512 
1513 /* mrmitop.c */
1514 extern Cardinal UrmIdbOpenFileRead  _ARGUMENTS(( String name ,
1515 						    MrmOsOpenParamPtr os_ext ,
1516 						    IDBFile *file_id_return ,
1517 						    char *fname_return ));
1518 extern Cardinal UrmIdbOpenBuffer  _ARGUMENTS(( unsigned char *uid_buffer ,
1519 						    IDBFile *file_id_return ));
1520 extern Cardinal UrmIdbCloseFile  _ARGUMENTS(( IDBFile file_id ,
1521 						Boolean keep_new_file ));
1522 extern Cardinal UrmIdbGetIndexedResource  _ARGUMENTS(( IDBFile file_id ,
1523 							String index ,
1524 							MrmGroup group_filter ,
1525 							MrmType type_filter ,
1526 							URMResourceContextPtr context_id ));
1527 extern Cardinal UrmIdbFindIndexedResource  _ARGUMENTS(( IDBFile file_id ,
1528 							MrmGroup group_filter ,
1529 							MrmType type_filter ,
1530 							URMPointerListPtr index_list ));
1531 extern Cardinal UrmIdbGetRIDResource  _ARGUMENTS(( IDBFile file_id ,
1532 							MrmResource_id resource_id ,
1533 							MrmGroup group_filter ,
1534 							MrmType type_filter ,
1535 							URMResourceContextPtr context_id ));
1536 extern Cardinal UrmIdbGetResourceId  _ARGUMENTS(( IDBFile file_id ,
1537 							MrmResource_id *resource_id_return ));
1538 extern Cardinal Idb__FIL_Valid  _ARGUMENTS(( IDBFile file_id ));
1539 
1540 /* mrmitopw.c */
1541 extern Cardinal UrmIdbOpenFileWrite  _ARGUMENTS(( String name ,
1542 						    MrmOsOpenParamPtr os_ext ,
1543 						    String creator ,
1544 						    String creator_version ,
1545 						    String module ,
1546 						    String module_version ,
1547 						    IDBFile *file_id_return ,
1548 						    char *fname_return ));
1549 extern Cardinal UrmIdbPutIndexedResource  _ARGUMENTS(( IDBFile file_id ,
1550 						    String index ,
1551 						    URMResourceContextPtr context_id ));
1552 extern Cardinal UrmIdbPutRIDResource  _ARGUMENTS(( IDBFile file_id ,
1553 						    MrmResource_id resource_id ,
1554 						    URMResourceContextPtr context_id ));
1555 
1556 /* mrmlread.c */
1557 extern Cardinal Urm__FetchLiteral  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1558 						    String index ,
1559 						    URMResourceContextPtr context_id ,
1560 						    URMPointerListPtr *ctxlist ));
1561 extern Cardinal UrmGetIndexedLiteral  _ARGUMENTS(( IDBFile file_id ,
1562 						    String index ,
1563 						    URMResourceContextPtr context_id ));
1564 extern Cardinal UrmGetRIDLiteral  _ARGUMENTS(( IDBFile file_id ,
1565 						MrmResource_id resource_id ,
1566 						URMResourceContextPtr context_id ));
1567 extern Cardinal Urm__HGetIndexedLiteral  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1568 							String index ,
1569 							URMResourceContextPtr context_id ,
1570 							IDBFile *file_id_return ));
1571 extern Cardinal UrmHGetIndexedLiteral  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1572 							String index ,
1573 							URMResourceContextPtr context_id ));
1574 
1575 /* mrmlwrite.c */
1576 extern Cardinal UrmPutIndexedLiteral  _ARGUMENTS(( IDBFile file_id ,
1577 						    String index ,
1578 						    URMResourceContextPtr context_id ));
1579 extern Cardinal UrmPutRIDLiteral  _ARGUMENTS(( IDBFile file_id ,
1580 						    MrmResource_id resource_id ,
1581 						    URMResourceContextPtr context_id ));
1582 
1583 /* mrmmodule.c */
1584 extern Cardinal UrmIFMInitModule  _ARGUMENTS(( URMResourceContextPtr context_id ,
1585 						MrmCount num_widget ,
1586 						MrmCode access ,
1587 						MrmCode lock ));
1588 extern Cardinal UrmIFMSetTopmost  _ARGUMENTS(( URMResourceContextPtr context_id ,
1589 						Cardinal topmost_ndx ,
1590 						String index ));
1591 extern Cardinal UrmIFMPutModule  _ARGUMENTS(( IDBFile file_id ,
1592 						String index ,
1593 						URMResourceContextPtr context_id ));
1594 extern Cardinal UrmIFMHGetModule  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1595 						String index ,
1596 						URMResourceContextPtr context_id ,
1597 						IDBFile *file_id_return ));
1598 extern Cardinal UrmIFMGetModule  _ARGUMENTS(( IDBFile file_id ,
1599 						String index ,
1600 						URMResourceContextPtr context_id ));
1601 
1602 /* mrmptrlist.c */
1603 extern Cardinal UrmPlistInit  _ARGUMENTS(( int size ,
1604 					    URMPointerListPtr *list_id_return ));
1605 extern Cardinal UrmPlistResize  _ARGUMENTS(( URMPointerListPtr list_id ,
1606 						int size ));
1607 extern Cardinal UrmPlistFree  _ARGUMENTS(( URMPointerListPtr list_id ));
1608 extern Cardinal UrmPlistFreeContents  _ARGUMENTS(( URMPointerListPtr list_id ));
1609 extern Cardinal UrmPlistAppendPointer  _ARGUMENTS(( URMPointerListPtr list_id ,
1610 						    XtPointer ptr ));
1611 extern Cardinal UrmPlistAppendString  _ARGUMENTS(( URMPointerListPtr list_id ,
1612 						    String stg ));
1613 extern MrmCount UrmPlistFindString  _ARGUMENTS(( URMPointerListPtr list_id ,
1614 						    String stg ));
1615 
1616 /* mrmtable.c */
1617 extern Cardinal Urm__FixupCompressionTable  _ARGUMENTS(( UidCompressionTablePtr ctable ,
1618 							    Boolean qfindcldesc,							    Boolean byte_swapped ));
1619 extern Cardinal Urm__FindClassDescriptor  _ARGUMENTS(( IDBFile cfile ,
1620 							MrmCode code ,
1621 							char *name ,
1622 							WCIClassDescPtr *class_return ));
1623 extern Cardinal Urm__UncompressCode  _ARGUMENTS(( IDBFile cfile ,
1624 						    MrmCode code ,
1625 						    String *stg_return ));
1626 extern Boolean Urm__IsSubtreeResource  _ARGUMENTS(( IDBFile cfile ,
1627 						    MrmCode code ));
1628 
1629 /* mrmtime.c */
1630 extern void Urm__UT_Time  _ARGUMENTS(( char *time_stg ));
1631 
1632 /* mrmvm.c */
1633 extern String Urm__UT_AllocString  _ARGUMENTS(( String stg ));
1634 
1635 /* mrmwci.c */
1636 extern Cardinal Urm__WCI_RegisterNames  _ARGUMENTS(( String *names ,
1637 							XtPointer *values ,
1638 							MrmCount num_cb ));
1639 extern Cardinal Urm__WCI_UnregisterName  _ARGUMENTS(( String name ));
1640 extern Cardinal Urm__WCI_LookupClassDescriptor  _ARGUMENTS(( String class_name ,
1641 								WCIClassDescPtr *class_return ));
1642 extern WidgetClass Urm__WCI_GetClRecOfName  _ARGUMENTS(( String clname ));
1643 extern Cardinal Urm__WCI_LookupRegisteredName  _ARGUMENTS(( String name ,
1644 							    XtPointer *value_return ));
1645 extern void hash_initialize  _ARGUMENTS(( URMHashTableEntryPtr *htable ,
1646 					    Boolean *initflag ));
1647 extern URMHashTableEntryPtr hash_find_name  _ARGUMENTS(( URMHashTableEntryPtr *htable ,
1648 							    char *c_text ));
1649 extern URMHashTableEntryPtr hash_insert_name  _ARGUMENTS(( URMHashTableEntryPtr *htable ,
1650 							    char *c_text ));
1651 extern URMHashTableEntryPtr hash_delete_name  _ARGUMENTS(( URMHashTableEntryPtr *htable ,
1652 							    char *c_text ));
1653 
1654 /* mrmwcrw.c */
1655 extern Cardinal UrmCreateWidgetTree
1656                                _ARGUMENTS(( URMResourceContextPtr context_id ,
1657 					    Widget parent ,
1658 					    MrmHierarchy hierarchy_id ,
1659 					    IDBFile file_id ,
1660 					    String ov_name ,
1661 					    ArgList ov_args ,
1662 					    Cardinal ov_num_args ,
1663 					    MrmCode keytype ,
1664 					    String kindex ,
1665 					    MrmResource_id krid ,
1666 					    MrmManageFlag manage ,
1667 					    URMPointerListPtr *svlist ,
1668 					    URMResourceContextPtr wref_id ,
1669 					    Widget *w_return ));
1670 extern Cardinal UrmCreateWidgetInstance
1671                                _ARGUMENTS((URMResourceContextPtr context_id ,
1672 					   Widget parent ,
1673 					   MrmHierarchy hierarchy_id ,
1674 					   IDBFile file_id ,
1675 					   String ov_name ,
1676 					   ArgList ov_args ,
1677 					   Cardinal ov_num_args ,
1678 					   MrmCode keytype ,
1679 					   String kindex ,
1680 					   MrmResource_id krid ,
1681 					   MrmManageFlag manage,
1682 					   URMPointerListPtr *svlist ,
1683 					   URMResourceContextPtr wref_id ,
1684 					   Widget *w_return,
1685 					   char **w_name));
1686 extern Cardinal UrmCreateOrSetWidgetInstance
1687                                _ARGUMENTS((URMResourceContextPtr context_id ,
1688 					   Widget parent ,
1689 					   MrmHierarchy hierarchy_id ,
1690 					   IDBFile file_id ,
1691 					   String ov_name ,
1692 					   ArgList ov_args ,
1693 					   Cardinal ov_num_args ,
1694 					   MrmCode keytype ,
1695 					   String kindex ,
1696 					   MrmResource_id krid ,
1697 					   MrmManageFlag manage ,
1698 					   URMPointerListPtr *svlist ,
1699 					   URMResourceContextPtr wref_id ,
1700 					   Widget *w_return,
1701 					   char **w_name));
1702 extern Cardinal UrmSetWidgetInstance
1703                                _ARGUMENTS((URMResourceContextPtr context_id ,
1704 					   Widget parent ,
1705 					   MrmHierarchy hierarchy_id ,
1706 					   IDBFile file_id ,
1707 					   ArgList ov_args ,
1708 					   Cardinal ov_num_args ,
1709 					   MrmCode keytype ,
1710 					   String kindex ,
1711 					   MrmResource_id krid ,
1712 					   MrmManageFlag manage ,
1713 					   URMPointerListPtr *svlist ,
1714 					   URMResourceContextPtr wref_id ,
1715 					   Widget *w_return ));
1716 extern void Urm__CW_CreateArglist  _ARGUMENTS(( Widget parent ,
1717 						RGMWidgetRecordPtr widgetrec ,
1718 						RGMArgListDescPtr argdesc ,
1719 						URMPointerListPtr ctxlist ,
1720 						URMPointerListPtr cblist,
1721 					        URMPointerListPtr ftllist ,
1722 						MrmHierarchy hierarchy_id ,
1723 						IDBFile file_id ,
1724 						ArgList args ,
1725 						URMPointerListPtr *svlist ,
1726 						URMResourceContextPtr wref_id ,
1727 						Cardinal *num_used ));
1728 extern long Urm__CW_EvaluateValOrOffset  _ARGUMENTS(( MrmType reptype ,
1729 						XtPointer bufptr ,
1730 						long ival ,
1731 						MrmOffset offset ));
1732 extern Cardinal Urm__CW_FixupValue  _ARGUMENTS(( long val ,
1733 						 MrmType reptype ,
1734 						 XtPointer bufptr ,
1735 						 IDBFile file_id ,
1736 						 Boolean *swap_needed));
1737 extern String Urm__CW_DisplayToString _ARGUMENTS(( char *val ,
1738 						    String add_string ,
1739 						    int add_string_size ));
1740 extern Cardinal Urm__CW_ConvertValue  _ARGUMENTS((  Widget parent,
1741 						    long *val ,
1742 						    MrmType reptype ,
1743 						    MrmType cvttype ,
1744 						    Display *display ,
1745 						    MrmHierarchy hierarchy_id ,
1746 						    URMPointerListPtr ftllist ));
1747 extern void Urm__CW_SafeCopyValue  _ARGUMENTS(( long *val ,
1748 						MrmType reptype ,
1749 					        URMPointerListPtr cblist,
1750 						int vec_count ,
1751 					        int vec_size ));
1752 extern void UrmDestroyCallback _ARGUMENTS((Widget w ,
1753 					    URMPointerListPtr list_id ,
1754 					    XmAnyCallbackStruct *reason));
1755 extern Cardinal Urm__CW_ReadLiteral  _ARGUMENTS(( RGMResourceDescPtr resptr ,
1756 						  MrmHierarchy hierarchy_id ,
1757 						  IDBFile file_id ,
1758 						  URMPointerListPtr ctxlist ,
1759 						  MrmType *type ,
1760 						  long *val ,
1761 						  int *vec_count ,
1762 						  IDBFile *act_file_id ,
1763 						  int *vec_size ));
1764 extern Cardinal Urm__CW_LoadIconImage  _ARGUMENTS(( RGMIconImagePtr iconptr ,
1765 						    XtPointer bufptr ,
1766 						    MrmHierarchy hierarchy_id ,
1767 						    IDBFile file_id ,
1768 						    URMPointerListPtr ctxlist ));
1769 extern Cardinal Urm__CW_FixupCallback  _ARGUMENTS(( Widget parent ,
1770 						    XtPointer bufptr ,
1771 						    RGMCallbackDescPtr cbdesc ,
1772 						    URMPointerListPtr ctxlist ,
1773 						    URMPointerListPtr cblist ,
1774 						    MrmHierarchy hierarchy_id ,
1775 						    IDBFile file_id ,
1776 						    URMResourceContextPtr   wref_id));
1777 extern Cardinal Urm__CW_LoadWidgetResource  _ARGUMENTS(( Widget parent ,
1778 						    RGMWidgetRecordPtr widgetrec ,
1779 						    RGMResourceDescPtr resptr ,
1780 						    URMPointerListPtr ctxlist ,
1781 						    MrmHierarchy hierarchy_id ,
1782 						    IDBFile file_id ,
1783 						    URMPointerListPtr *svlist ,
1784 						    URMResourceContextPtr wref_id ,
1785 						    long *val ));
1786 extern void Urm__CW_GetPixmapParms  _ARGUMENTS(( Widget w ,
1787 						    Screen **screen ,
1788 						    Display **display ,
1789 						    Pixel *fgint ,
1790 						    Pixel *bgint ));
1791 extern RGMCallbackDescPtr
1792   Urm__CW_TranslateOldCallback _ARGUMENTS(( OldRGMCallbackDescPtr oldptr));
1793 
1794 /* mrmwcrwr.c */
1795 extern Cardinal UrmCWRInit  _ARGUMENTS(( URMResourceContextPtr context_id ,
1796 					    String name ,
1797 					    MrmCode access ,
1798 					    MrmCode lock ));
1799 extern Cardinal UrmCWRSetClass  _ARGUMENTS(( URMResourceContextPtr context_id,
1800 					     MrmCode type,
1801 					     String urm_class,
1802 					     unsigned long variety ));
1803 extern Cardinal UrmCWRInitArglist  _ARGUMENTS(( URMResourceContextPtr context_id ,
1804 						Cardinal nargs ));
1805 extern Cardinal UrmCWRSetCompressedArgTag  _ARGUMENTS(( URMResourceContextPtr context_id ,
1806 							Cardinal arg_ndx ,
1807 							MrmCode tag ,
1808 							MrmCode related_tag ));
1809 extern Cardinal UrmCWRSetUncompressedArgTag  _ARGUMENTS(( URMResourceContextPtr context_id ,
1810 							    Cardinal arg_ndx ,
1811 							    String tag ));
1812 extern Cardinal UrmCWRSetArgValue  _ARGUMENTS(( URMResourceContextPtr context_id ,
1813 						Cardinal arg_ndx ,
1814 						MrmCode type ,
1815 						unsigned long arg_val ));
1816 extern Cardinal UrmCWRSetArgResourceRef  _ARGUMENTS(( URMResourceContextPtr context_id ,
1817 							Cardinal arg_ndx ,
1818 							MrmCode access ,
1819 							MrmGroup group ,
1820 							MrmCode type ,
1821 							MrmCode key_type ,
1822 							String index ,
1823 							MrmResource_id resource_id ));
1824 extern Cardinal UrmCWRSetArgChar8Vec  _ARGUMENTS(( URMResourceContextPtr context_id ,
1825 						    Cardinal arg_ndx ,
1826 						    String *stg_vec ,
1827 						    MrmCount num_stg ));
1828 extern Cardinal UrmCWRSetArgCStringVec  _ARGUMENTS(( URMResourceContextPtr context_id ,
1829 							Cardinal arg_ndx ,
1830 							XmString *cstg_vec ,
1831 							MrmCount num_cstg ));
1832 extern Cardinal UrmCWRSetArgCallback  _ARGUMENTS(( URMResourceContextPtr context_id ,
1833 						    Cardinal arg_ndx ,
1834 						    Cardinal nitems ,
1835 						    MrmOffset *cb_offs_return ));
1836 extern Cardinal UrmCWRSetCallbackItem  _ARGUMENTS(( URMResourceContextPtr context_id ,
1837 						    MrmOffset cb_offs ,
1838 						    Cardinal item_ndx ,
1839 						    String routine ,
1840 						    MrmCode type ,
1841 						    unsigned long itm_val ));
1842 extern Cardinal UrmCWRSetCallbackItemRes  _ARGUMENTS(( URMResourceContextPtr context_id ,
1843 							MrmOffset cb_offs ,
1844 							Cardinal item_ndx ,
1845 							String routine ,
1846 							MrmGroup group ,
1847 							MrmCode access ,
1848 							MrmCode type ,
1849 							MrmCode key_type ,
1850 							String index ,
1851 							MrmResource_id resource_id ));
1852 extern Cardinal UrmCWRSetExtraArgs  _ARGUMENTS(( URMResourceContextPtr context_id ,
1853 						    Cardinal nextra ));
1854 extern Cardinal UrmCWRInitChildren  _ARGUMENTS(( URMResourceContextPtr context_id ,
1855 						    Cardinal nchildren ));
1856 extern Cardinal UrmCWRSetChild  _ARGUMENTS(( URMResourceContextPtr context_id ,
1857 						Cardinal child_ndx ,
1858 						Boolean manage ,
1859 						MrmCode access ,
1860 						MrmCode key_type ,
1861 						String index ,
1862 						MrmResource_id resource_id ));
1863 extern Cardinal UrmCWRSetComment  _ARGUMENTS(( URMResourceContextPtr context_id ,
1864 						String comment ));
1865 extern Cardinal UrmCWRSetCreationCallback  _ARGUMENTS(( URMResourceContextPtr context_id ,
1866 							Cardinal nitems ,
1867 							MrmOffset *cb_offs_return ));
1868 extern Cardinal UrmCWR__AppendString  _ARGUMENTS(( URMResourceContextPtr context_id ,
1869 						    String stg ,
1870 						    MrmOffset *offset ));
1871 extern Cardinal UrmCWR__AppendCString  _ARGUMENTS(( URMResourceContextPtr context_id ,
1872 						    XmString cstg ,
1873 						    MrmOffset *offset ));
1874 extern Cardinal UrmCWR__AppendWcharString
1875                                _ARGUMENTS(( URMResourceContextPtr context_id ,
1876 					    wchar_t *wcs ,
1877 					    MrmOffset *offset ));
1878 extern Cardinal UrmCWR__GuaranteeSpace  _ARGUMENTS(( URMResourceContextPtr context_id ,
1879 							MrmSize delta ,
1880 							MrmOffset *offset ,
1881 							char **addr ));
1882 extern Cardinal UrmCWR__AppendResource  _ARGUMENTS(( URMResourceContextPtr context_id ,
1883 							MrmCode access ,
1884 							MrmCode group ,
1885 							MrmCode type ,
1886 							MrmCode key_type ,
1887 							String index ,
1888 							MrmResource_id resource_id ,
1889 							MrmOffset *offset ));
1890 extern Cardinal UrmCWR__ValidateContext  _ARGUMENTS(( URMResourceContextPtr context_id ,
1891 							String routine));
1892 extern Cardinal UrmCWR__BindArgPtrs  _ARGUMENTS(( URMResourceContextPtr context_id ,
1893 						    String routine ,
1894 						    Cardinal argndx ,
1895 						    RGMArgListDescPtr *descptr ,
1896 						    RGMArgumentPtr *argptr ));
1897 extern Cardinal UrmCWR__BindCallbackPtrs  _ARGUMENTS(( URMResourceContextPtr context_id ,
1898 							String routine ,
1899 							MrmOffset descoffs ,
1900 							Cardinal itemndx ,
1901 							RGMCallbackDescPtr *descptr ,
1902 							RGMCallbackItemPtr *itmptr ));
1903 
1904 /* mrmwread.c */
1905 extern Cardinal UrmHGetWidget  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1906 						String index ,
1907 						URMResourceContextPtr context_id ,
1908 						IDBFile *file_id_return ));
1909 extern Cardinal UrmGetIndexedWidget  _ARGUMENTS(( IDBFile file_id ,
1910 						    String index ,
1911 						    URMResourceContextPtr context_id ));
1912 extern Cardinal UrmGetRIDWidget  _ARGUMENTS(( IDBFile file_id ,
1913 						MrmResource_id resource_id ,
1914 						URMResourceContextPtr context_id ));
1915 
1916 /* mrmwrefs.c */
1917 extern Cardinal Urm__CW_InitWRef  _ARGUMENTS(( URMResourceContextPtr *wref_id ));
1918 extern Cardinal Urm__CW_AddWRef  _ARGUMENTS(( URMResourceContextPtr wref_id ,
1919 						String w_name ,
1920 						Widget w_id ));
1921 extern Cardinal Urm__CW_FindWRef  _ARGUMENTS(( URMResourceContextPtr wref_id ,
1922 						String w_name ,
1923 						Widget *w_id_return ));
1924 extern void Urm__CW_AppendSVWidgetRef  _ARGUMENTS(( IDBFile file_id ,
1925 						    URMPointerListPtr *svlist ,
1926 						    String w_name ,
1927 						    MrmCode argtag ,
1928 						    String argname ));
1929 extern void Urm__CW_AppendCBSVWidgetRef _ARGUMENTS((IDBFile file_id,
1930 						    URMPointerListPtr *svlist,
1931 						    RGMCallbackDescPtr cbptr,
1932 						    MrmCode argtag,
1933 						    String argname));
1934 extern void Urm__CW_UpdateSVWidgetRef  _ARGUMENTS(( URMPointerListPtr *svlist ,
1935 						    Widget cur_id ));
1936 extern void Urm__CW_ResolveSVWidgetRef  _ARGUMENTS(( URMPointerListPtr *svlist ,
1937 						    String cur_name ,
1938 						    Widget cur_id ));
1939 
1940 extern void Urm__CW_FreeSetValuesDesc _ARGUMENTS((URMSetValuesDescPtr svdesc));
1941 
1942 
1943 /* mrmwvalues.c */
1944 extern Cardinal UrmFetchSetValues  _ARGUMENTS(( MrmHierarchy hierarchy_id ,
1945 						Widget w ,
1946 						ArgList args ,
1947 						Cardinal num_args ));
1948 
1949 /* mrmwwrite.c */
1950 extern Cardinal UrmPutIndexedWidget  _ARGUMENTS(( IDBFile file_id ,
1951 						    String index ,
1952 						    URMResourceContextPtr context_id ));
1953 extern Cardinal UrmPutRIDWidget  _ARGUMENTS(( IDBFile file_id ,
1954 						MrmResource_id resource_id ,
1955 						URMResourceContextPtr context_id ));
1956 
1957 /* mrmiswap.c */
1958 extern Cardinal Idb__BM_SwapRecordBytes _ARGUMENTS(( IDBRecordBufferPtr	buffer ));
1959 extern unsigned Urm__SwapValidation _ARGUMENTS(( unsigned validation ));
1960 extern Cardinal Urm__SwapRGMResourceDesc _ARGUMENTS(( RGMResourceDescPtr res_desc ));
1961 extern Cardinal Urm__SwapRGMCallbackDesc _ARGUMENTS(( RGMCallbackDescPtr callb_desc,
1962 					      RGMWidgetRecordPtr widget_rec ));
1963 extern Cardinal Urm__SwapRGMWidgetRecord _ARGUMENTS(( RGMWidgetRecordPtr widget_rec ));
1964 
1965 
1966 
1967 /*
1968  * string copy macro
1969  */
1970 
1971 /* If the alignment characteristics of your machine are right, these may be
1972    faster */
1973 
1974 #ifdef UNALIGNED
1975 
1976 #define UrmBCopy(src, dst, size)                            \
1977     if (size == sizeof(long))                               \
1978         *((long *) (dst)) = *((long *) (src));              \
1979     else if (size == sizeof(int))                           \
1980         *((int *) (dst)) = *((int *) (src));                \
1981     else if (size == sizeof(short))                         \
1982         *((short *) (dst)) = *((short *) (src));            \
1983     else if (size == sizeof(char))                          \
1984         *((char *) (dst)) = *((char *) (src));              \
1985     else                                                    \
1986         memmove((char *) (dst), (char *) (src), (int) (size));
1987 
1988 #else
1989 
1990 #define UrmBCopy(src, dst, size)                \
1991         memmove((char *) (dst), (char *) (src), (int) (size));
1992 
1993 #endif /* UNALIGNED */
1994 
1995 /********    Conditionally defined macros for thread_safe DtTerm ******/
1996 #ifdef XTHREADS
1997 #define _MrmWidgetToAppContext(w) \
1998         XtAppContext app = XtWidgetToApplicationContext(w)
1999 #define _MrmDisplayToAppContext(d) \
2000         XtAppContext app = XtDisplayToApplicationContext(d)
2001 #define _MrmAppLock(app) XtAppLock(app)
2002 #define _MrmAppUnlock(app) XtAppUnlock(app)
2003 #define _MrmProcessLock() XtProcessLock()
2004 #define _MrmProcessUnlock() XtProcessUnlock()
2005 #else /* XTHREADS */
2006 #define _MrmWidgetToAppContext(w)
2007 #define _MrmDisplayToAppContext(d)
2008 #define _MrmAppLock(app)
2009 #define _MrmAppUnlock(app)
2010 #define _MrmProcessLock()
2011 #define _MrmProcessUnlock()
2012 #endif /* XTHREADS */
2013 
2014 #endif /* Mrm_H */
2015 /* DON'T ADD STUFF AFTER THIS #endif */
2016