[MAP] Section

Syntax

[MAP]

context_string context number
.
.
.

The [MAP] section associates context strings (or aliases) to context numbers for context-sensitive Help. The context number corresponds to a value the parent application passes to Windows Help to display a particular topic. This section is optional.

Parameters

context-string

Specifies the context string of a topic in the Help file. The string can be any combination of characters, except spaces, and must also be specified in a context string footnote (#) in some topic in the Help file.

context-number

Specifes the context number to associate with the context string. The number can be in either decimal or standard C hexadecimal format.

Comments

Only one context number may be assigned to a context string or alias. Assigning the same number to more than one context string generates a compiler error.

You can separate context numbers and context strings by an arbitrary amount of white space using space characters or tabs, but there must be at least one space between the context number and the context string.

If you do not explicitly assign context numbers to topics, the Help compiler generates default values by converting topic context strings into context numbers.

You can define the context strings listed in the [MAP] section either in a Help topic or in the [ALIAS] section. The compiler generates a warning message if a context string appearing in the [MAP] section is not defined in any of the topic files or in the [ALIAS] section.

If you use an alias, the [ALIAS] section must precede the [MAP] section in the Help project file.

If you remove a Help topic that the application defines as context sensitive, users will get a “Topic does not exist” error message when they request Help on the item. To prevent the error from occurring, you must either change the application so that it no longer sends the context number to Help or map that context number to an existing topic.

The [MAP] section supports two additional statements for specifying context strings and their associated context numbers: #include and #define.

The #include statement has the following form:

#include <filename>

The filename parameter, which can be enclosed in either angle brackets (<>) or double quotation marks, specifies the name of a file containing one or more #define statements. The file may contain additional #include statements as well, but files may not be nested in this way more than five deep.

The #define statement has the following form:

#define context-string context-number

The context-string and context-number parameters are the same as those described in the “Parameters” section above.

If context numbers use the #define directive and the file containing the #define statements is included in both the application code and the Help file, updates made to the context numbers by the application programmers are reflected in the next Help build.

When using the #define statement in the [MAP] section, observe these rules:

nYou can use C-style comments (/* open comment and */ close comment) with the #define directive. The comments can occur anywhere in the line.

#define context_string    context_number     /* comment */

nThe Help compiler supports 32-bit constants in #define statements. It also accepts (as 32-bit constants) numbers that end with L and are accepted by the C compiler for a long constant:

#define vscroll      1234000L

nThe Help compiler does not perform arithmetic on the object of the #define statement. It does not support the following forms of #define:

#define A  1
#define B  (A+1)
#define C  (A+2)

nThe Help compiler only accepts #define statements; it does not support other forms such as #ifdef and #endif.

Examples

The following example uses a decimal number to specify the context number:

dtb_scr           34      ;document title bar

The following example uses a hexadecimal number to specify the context number:

Minimize_Icon      0x0004

The following example uses an #include directive to point to another file containing the context strings and context numbers:

#include <sample.h>

The following example uses a #define statement to specify the mapping:

#define up_scroll    0x0112   /* up scroll arrow */

See Also

[ALIAS] Section