Utility -- hdivide


Basic

Hdivide divides a source file (.w) into multiple files (.x) as specified in the source files. Those output files may be supposed to be processed by wcshdr utility.

Output will be in the same directory as the source file.

Outputs

Hdivide redirects the output to the multiple files. The current output context (tag context) is specified by lined or inline tag.

Hdivide also inserts the output of other files into specified point. The range of inclusion is specified with reference_start and reference_end tag in the tag context of the source.


Tags

Tag context

Tag context is specified by either or both of line and inline tags. Output is redirected to the current tag context.

Inline tags override the current tag context just for the current line. If "+" is spcified at the top of inline tag, line tag adds the specified tags to the current tag context.

Line tag is effective until other line tag appears.

The default tag context is "all."

Tag format

Line tag should start with ";". Line tag should start at the beginning of the line.

Inline tags should start with "@". It can appear at any place in non line tag line, but the rest of the line will be ex Multiple tag is separated by ";".

Not all of the valid tags are multiple.

If "+" appears right after "@", following tags are the additions to the current tag context.

Tags should only include filename portion. The extention ".x" is automatically added. Tags should not include any path: i.e. drive name or directory name.

Output tag

Output tag redirects the output to specified files. Output tag can be multiple. It is one or any combination of:

filename should not include the extension. File extension is fixed as ".x".

If one or more of the output tags are specified, the output is redirected to specified files until the next line tag appears.

All and null tags are special, and cannot be multiple. See the table below for the detail.

Reverse

If the the first tag begins with "!", tag specification is reversed. May not be effective for all and null tags.

Tag validity

Inline tag temporarily overrides the line tag. If specified, inline tag redirects the current line to specifed tag context.

Special tags

Special tags include begin_symbol_version, end_symbol_version, else, insert_tag, reference_start, reference_end. See the following table for the detail.

List of valid tags

The following table summarizes the valid tags.

Tag

Multiple

Inline

Semantics

public

yes

yes

Redirects to public .x file. The file name is same as the source file.

internal

yes

yes

Redirects to private .x file. The file name is the source file + "p".

filename

yes

yes

Redirects the output to filename.x.

all

no

yes

Redirects to all files declared before this tag.

null

no

yes

Specifies no output.

begin_symbol_version

no

no

Generates the C/C++ preprocessor macro. Will be translated to:

        #if (symbol >= 0xversion)
        
Symbol is translated to upper case. Version is also translated to upper case and 4 hex digits.

Example:

        ;begin_winver_40a
        ->
        #if (WINVER >= 0x040A)

        ;begin__win32_winnt_500
        ->
        #if (_WIN32_WINNT >= 0x500)
        

end_symbol_version

no

no

Generates the C/C++ preprocessor macro. Will be translated to:

        #endif // symbol >= 0xversion
        

else

no

no

Generates the C/C++ preprocessor macro. Will be translated to:

        #else
        

insert_tag

no

no

Specifies the insertion point of the output of tag.

The portion of the file inserted from tag should be specified in the context of tag, by reference_start tag and reference_end tag.

Multiple occurence of insert_tag is supported.

The source file should not have cyclic insertion.

reference_start

no

no

Specifies the beginning of the reference of the current tag context.

Multiple occurence of reference_start is supported. However, each reference_start should be ended by reference_end before another reference_start (in the same tag context) appears.

reference_end

no

no

Specifies the end of the reference of the current tag context.

Multiple occurence of reference_end is supported. Before reference_end appears, corresponding reference_start should be appeared in the same tag context.