diff --git a/src/tools/rc/compile.h b/src/tools/rc/compile.h index 9ba0026dd4..0e544eb988 100644 --- a/src/tools/rc/compile.h +++ b/src/tools/rc/compile.h @@ -63,9 +63,10 @@ struct data_t // Describes a data field in a user-defined type. struct field_t { - type_t type; // data type - char* name; // name of this field - data_t data; // default value + type_t type; // data type + char* name; // name of this field + size_t resize; // if not 0, data will be resized + data_t data; // default value }; // Describes an array of data_t or field_t objects. diff --git a/src/tools/rc/docs/grammar.html b/src/tools/rc/docs/grammar.html index d66000bce6..53794855a0 100644 --- a/src/tools/rc/docs/grammar.html +++ b/src/tools/rc/docs/grammar.html @@ -61,8 +61,8 @@ number, hex number, or four character code. Examples: #200, #0x00C8,

The following are treated as keywords and special symbols:

-
enum resource array message archive type { } ( ) , ; = - -
+
enum resource array message archive type import +{ } ( ) , ; = -

The lexer also deals with #include statements, which look like: #include "filename"\n. When you #include a file, the lexer expects it to contain valid @@ -113,7 +113,7 @@ BNF, so the actual bison source file may look a little different. Legend:

typedefTYPE [id] [TYPECODE] IDENT '{' fielddef {',' fieldef} '}' ';' -fielddefdatatype IDENT ['=' data] +fielddefdatatype IDENT ['[' INTEGER ']'] ['=' data] resourceRESOURCE [id] [typecode] data ';' @@ -132,7 +132,8 @@ BNF, so the actual bison source file may look a little different. Legend:

float['-'] FLOAT -arrayARRAY ['{' [data {',' data}] '}'] +arrayARRAY ['{' [data {',' data}] '}'] | [ARRAY] IMPORT +STRING messageMESSAGE ['(' integer ')'] ['{' [msgfield {',' msgfield}] '}'] @@ -371,9 +372,11 @@ resource(1) vector { 1, 3, x = 2 };

Note: if a user-defined type contains string, raw, or message fields, the size of the type depends on the data that the user puts into it, because these -fields have a variable size. In a future version we will add "constraints" that -let you force the size of a field to a fixed number of bytes. (And possibly -other constraints as well, such as a valid data range.)

+fields have a variable size. However, the user may specify a fixed size for a +field (number of bytes, enclosed in square brackets following the field name). +In this case, data that is too long will be truncated and data that is too +short will be padded with zeroes. You can do this for all types, but it really +only makes sense for strings and raw data.

A type definition may also contain a default resource ID and name. The default ID of built-in types is usually 1 and the name is empty (NULL). For diff --git a/src/tools/rc/docs/history.html b/src/tools/rc/docs/history.html index e5d41ff1ba..d036353c74 100644 --- a/src/tools/rc/docs/history.html +++ b/src/tools/rc/docs/history.html @@ -8,6 +8,18 @@

This is the change history of the rc resource compiler and librdef.

+

Version 1.1 (not released yet):

+ + +

Version 1.0 (February 16, 2003):