Content-type: text/html Manpage of CH2C+H

CH2C+H

Section: 20:05:34 (1)
Updated: $Date:
Index Return to Main Contents
 

NAME

ch2c+h - extract C source (.c) and header (.h) files from a common source  

SYNOPSIS

ch2c+h [ options ] filename  

DESCRIPTION

ch2c+h extracts C source (.c) and header (.h) files from a common source file filename line by line. Each line in the common source file either belongs to the .c source file, the .h header file, or both. This is controlled by directives that each occur by themselves on lines of the common source file. Such a directive determines inclusion of all following lines (upto the next directive) in one or both of the files. Every line starting with @ in the first column is considered a directive. Lines containing a directive are otherwise ignored.

By convention, common source files have extension .ch.

 

OPTIONS

Four variables can be set through the options section
verbose=0
No diagnostic output is generated, unless one or more errors occur.
cfile=c-filename
Changes the name of the .c source file to c-filename. By default, .c is substituted for the .ch extension of the input file filename. If c-filename equals "", no .c source file is generated.
hfile=h-filename
Changes the name of the .h header file to h-filename. By default, .h is substituted for the .ch extension of the input file filename. If h-filename equals "", no .h header file is generated.
conditional=0
Disables the automatic inclusion of a conditional in the .H header file that would make it get loaded once-only. By default this conditional is included.

Conditionalized header files start with the following two preprocessor commands on single lines

#ifndef __ basename __

#define __ basename __

and end with the preprocessor command

#endif

on the last line (where basename is the basename of the inputfile (without extensions). Setting conditional=0 omits these lines.

 

DIRECTIVES

The following directives are recognized.
@C
include lines that follow only in the .c source file.
@H
include lines that follow only in the .h header file.
@CH
include lines that follow both in the .c source and in the .h header file.
@EXTERN
write extern to the .h header file and include lines that follow both in the .c source and in the .h header file. Useful for variable declarations that must be made external in the header file.
@PROTO
include lines that follow both in the .c source file and the .h header file. However, the first line that contains the character { (not necessarily in the first column) terminates this mode and writes a semicolon ; to the .h header file and the whole line to the .c source file, and switches to a mode where lines that follow are included in the .c source file only.

Thus a @PROTO preceding a function declaration writes its prototype to the .h header file.

The first lines before the first directive in the common source file are not output to any file.

 

DIAGNOSTICS

Messages are printed on standard output.

 

BUGS

Messages are printed on standard output.

The filename used in the preprocessor commands of a conditionalised header file should depend on the name of the header file, not on the name of the input file.

 

AUTHOR

Jaap-Henk Hoepman <jhh@xs4all.nl>

Also reachable at http://www.xs4all.nl/~jhh


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
DIRECTIVES
DIAGNOSTICS
BUGS
AUTHOR

This document was created by man2html, using the manual pages.
Time: 16:28:35 GMT, January 14, 2000