PROTO

NAME
SYNOPSIS
DESCRIPTION
CAVEATS
BUGS
SEE ALSO

Nokia nmake alu3.9 PROTO(1)

NAME

proto − make prototyped C source compatible with K&R, ANSI and C++

SYNOPSIS

proto [ −c name=value ] [ −fhinprs ] file ...

DESCRIPTION

proto converts ANSI C prototype constructs in file to constructs compatible with K&R C, ANSI C, and C++. Only files with the line #pragma prototyped in the first 64 lines are processed; other files are silently ignored. If −f is specified then all files are processed. If −h is specified then the proto inline header definitions are omitted. If −n is specified then the output will contain #line cpp(1) directives to maintain line number compatibility with the original source file. If −p is specified then ignored file contents are passed untouched to the output. If −s is specified then #include <prototyped.h> is output instead of the inline header definitions. If −r is specified then the files are modified in place; otherwise the output is placed on the standard output.

−i specifies inverse proto: classic function definitions are converted to ANSI prototype form and non-ANSI directives are commented out. In this case files with the line #pragma noprototyped in the first 64 lines are silently ignored. If −h is specified with −i then only extern prototypes are emitted for each non-static function. This option requires that all classic function formal arguments be declared, i.e., omitted declarations for int formals will not generate the correct prototype. Typical usage would be to first run proto −ih *.c to generate the external prototypes that should be placed in a .h file shared by *.c and then proto −ir *.c to convert the function prototypes in place. Note that prototype code conditioned on __STDC__ will most likely confuse −i.

−c name=value generates a copyright notice comment at the top of the output controlled by one or more name=value pairs. If value contains space characters then it must be enclosed in either "..." or ’...’ quotes. name may be:

type

The copyright type. proprietary (default) and nonexclusive are supported.

corporation

They own it all, e.g., Nokia .

company

Within the corporation, e.g., Bell Laboratories.

organization

Within the company, e.g., Software Engineering Research Department.

license

External reference to the detailed license text, e.g., http://www.research.att.com/orgs/ssr/book/reuse.

contact

External reference for more information, e.g., bozo@bigtop.research.att.com.

The copyright notice text can be generated by:

proto -hfc "..." /dev/null | egrep -v ’^$| : : .* : :’

All conversion is done before macro expansion, so programs that disguise C syntax in macros lose. A single prototype must not span more than 1024 bytes.

ANSI <stdarg.h> variable argument constructs are recognized. va_start( must appear within 1024 bytes of the enclosing function prototype.

The ANSI macro operators # (stringize) and ## (concatenate) are recognized, but note that old K&R preprocessors cannot be coaxed to expand arguments to # or ##.

For C++, extern declarations and references are placed in the "C" linkage class. Although C allows extern in function bodies, C++ restricts linkage class specifications to file scope.

The macros __V_ and __VARARG__ must not be used in the input source files.

The pp(3) based cpp(1) uses the same transformations to pre-pre-process #pragma prototyped files. The transformations are disabled when pp(3) is preprocessing for ANSI. If the pp(3) cpp(1) is used for all C compiles then proto need only be used when transporting files to places lacking pp(3).

CAVEATS

proto is not an ANSI C compiler.

BUGS

Function-returning-function prototypes and casts are not handled -- nested typedefs get around the problem.

SEE ALSO

cpp(1), pp(3)


nmake alu3.9 July 2007 PROTO(1)