<resource-statement> resource-statement ::= RESOURCE <struct-name> [ <resource-name> ] { <resource-initialiser-list> }
The RESOURCE statement is used to generate a resource in the resource file. The statement specifies three things:
a struct-name which denotes the structure that will be used for the resource
It must have been defined in a previous STRUCT statement and must be in upper case.
an optional resource-name which identifies the resource
The resource-name must be in lower case.
The resource-name causes a symbolic constant to be generated in the resource compiler’s output header file, so that a resource
RESOURCE TEST my_test { /* etc */ }
will result in a definition of the form
#define MY_TEST 1
in the generated header file.
The default ID for the first resource defined in the file is one with subsequent resources’ IDs generated in ascending sequence. See Resource file definition for more information on how resource IDs are generated.
If no resource name is specified then the resource is generated in the object file and assigned a resource ID as usual, but will not be published in the header file. Anonymous resources are used mainly for playback scripts where the resources are read in sequentially by default, so that assigning names to them would be superfluous.
The resource-name may also be used by the resource compiler for LINK and LLINK members — see Resource identifiers for LINKs and LLINKs.
initialisation for members of the resource struct, where their default values are not appropriate
As an example, given the struct definition
STRUCT NCEDIT { WORD current; WORD low; WORD high=65535; }
you could define a resource:
RESOURCE NCEDIT memory_size { low=640; high=1024; }
Thus, in the resource file, current has the value compiler default value of 0, low has the value 640 (specified in the resource definition) and high has the value 1024 (specified in the resource definition, overriding the default for the struct type).