H2INC is designed to provide automatic translation of C declarations that you need to include in the MASM portions of an application. However, the set of C statements processed by H2INC must be those needed by and interpretable by MASM. H2INC converts only function prototypes, some preprocessor directives,and C declarations outside the scope of procedures. For example, H2INC translates the C statement
#define MAX_EMPLOYEES 400
into this MASM statement:
MAX_EMPLOYEES EQU 400t
The t specifies the decimal radix.
H2INC does not translate C code into MASM code. Statements such as the following are ignored:
printf( "This is an executable statement.\n" );
Summary: H2INC translates declarations, not executable code.
By default, H2INC creates a single .INC file. If the C header file includes other header files, the statements from the original and nested files are translated and combined into one .INC file. This behavior can be changed with the /Ni option (see Section 16.2).
The program also preprocesses some statements, just as the C preprocessor would. For example, given the following statements, if VERSION is not defined, H2INC ignores the #ifdef block.
#ifdef VERSION
#define BOX_VALUE 4
#endif
If VERSION is defined, H2INC translates the statements inside the block from C syntax to MASM syntax.
H2INC normally discards comments. If you use the /C option, C comments are passed to the output file. If the line starts with a /* or // , the comment specifier is converted to a semicolon (;). If the line is part of a multiline comment, a semicolon is prefixed to each line.
H2INC ignores anything that is not a comment or that cannot be translated. These items do not appear in the output file. If H2INC encounters an error, it stops translating and deletes the resulting .INC file.