An application can also define its own resource. The resource can be any data that the application intends to use. A user-defined resource statement has the following form:
Summary: Syntax
nameID typeID[[loadoption]] [[memoption]] {[[filename]] |
[[BEGIN
rawdata
END]]}
The nameID field specifies either a unique name or an integer that identifies the resource.
The typeID field specifies either a unique name or an integer that identifies the resource type. If a number is given, it must be greater than 255. The numbers 1 through 255 are reserved for existing and future predefined resource types.
The optional loadoption field takes a keyword that specifies when the resource is to be loaded. The keyword must be one of the following:
PRELOAD
Resource is loaded immediately.
LOADONCALL
Resource is loaded when called. This is the default option.
The optional memoption field takes the following keyword or keywords, which specify the memory status of the resource:
FIXED
Resource remains at a fixed memory location.
MOVEABLE
Resource can be moved if necessary to compress memory. This is the default option.
DISCARDABLE
Resource can be discarded if it is no longer needed.
The optional filename field is an ASCII string that specifies the DOS filename of the file that contains the resource. A full path must be given if the file is not in the current working directory. Do not use the filename field if you supply raw data between the optional BEGIN and END statements.
The rawdata field specifies one or more integers and strings. Integers can be in decimal, octal, or hexadecimal format. Do not use the rawdata field and the BEGIN and END statements if you specify a filename.
The following example demonstrates the correct usage for user-defined statements:
array MYRES data.res
14 300 custom.res
18 MYRES2
BEGIN
“Here is a data string\0", /* A string. Note: explicitly
null-terminated */
1024, /* int */
0x029a, /* hex int */
0o733, /* octal int */
”\07" /* octal byte */
END