Automatic C Header Files

Functions

int aop_write_c_header (const char *filename, const char *guard, const char *license, const char *preamble)

Function Documentation

int aop_write_c_header ( const char *  filename,
const char *  guard,
const char *  license,
const char *  preamble 
)

Add prototypes for every advice function added with aop_insert_advice(). If the specified header file already exists, aop_write_c_header() reads it and adds only prototypes that do not already appear in the file. InterAspect uses advisory file locks to control access to a header file, so it is ok for parallel compiles to write to the same header (so long as your system supports advisory locks).

Note that generated header files are not bound to InterAspect's license. If you choose to distribute an InterAspect-generated header, you may use any terms you wish.

Parameters:
filename The name of the header file to generate. The file will be created if it does not exist. May not be NULL.
guard A valid C preprocessor symbol to use for the header file's ifdef guard. If this is NULL, the header file will not have an ifdef guard. Guard symbols are typically of the form _FILENAME_H_.
license Your choice of license text, if you wish to distribute the generated header under a license. Your text should be in the form of a C comment. If this is NULL, the header will begin with the default license text, which indicates that the file is not bound by the terms of any license. Pass the empty string if you do not wish to include any license text.
preamble Any other preamble text you wish to begin the header with. This text should be valid C/C++ comments or code. If this is NULL, the header preamble will be a general comment about InterAspect-generated headers.
Returns:
On success, the return value is 0. On failure, the return value is one of the UNIX error codes from errno.h.
  • EINVAL: The specified filename is NULL, or the specified guard is not a valid C preprocessor symbol.
  • Any of the possible errno results from the open(2) function.
  • Any of the possible errno results from the write(2) function.
  • Any of the possilbe errno results from the fcntl(2) function. Failure will also set errno to the returned error value, so you can use the perror(3) function to print a user-readable error message.
Examples:
advice_header.c.
Generated on Tue Jul 31 21:46:42 2012 for InterAspect by doxygen 1.6.1