Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

sobjxc.c File Reference


Detailed Description

Implementation of the definition file parser and data structures of the sobjxc tool.

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <assert.h>
#include <sobject/sobject.h>
#include "sobjxc.h"

Include dependency graph for sobjxc.c:

Include dependency graph

Functions

FILE * sobjxc_fopen_include (const char *, const char *, int)
 Open an include file.
int sobjxc_parse (struct sobjxc_table *, FILE *, const char *, struct sobj *, int)
 Parse a definition file.
int sobjxc_parse_message_or_exception (struct sobjxc_table *, FILE *, const char *, struct sobj *, int *, const char *, bool)
 Parse a message or exception definition.
char * sobjxc_parse_code (FILE *, const char *, int *)
 Parse a code block.
int sobjxc_parse_type (FILE *, const char *, int *, const char *)
 Parse a custom type declaration.
void sobjxc_error (const char *format,...)
 Send an error message to the standard error stream.
void sobjxc_verror (const char *format, va_list ap)
 Send an error message to the standard error stream.
void sobjxc_add_include_dir (const char *dir)
 Add a dictionary to the include path.
int sobjxc_readline (struct sobj_buffer *line, int lineno, FILE *fp, const char *filename)
 Read an input line from the specified input stream.
sobjsobjxc_normalize_options (struct sobj *options)
 Normalize an options object.
void sobjxc_init (const char *program_name)
 Initialize the sobjxc tool.
void sobjxc_deinit (void)
 De-initialize the sobjxc tool.

Function Documentation

FILE * sobjxc_fopen_include const char *  include_filename,
const char *  input_filename,
int  lineno
[static]
 

Open an include file.

The function scans the include path specified through sobjxc_add_include_dir(). If the file is not found in the include path, then the local directory is searched.

Parameters:
include_filename The filename of the file to be included.
input_filename The input filename.
lineno The input line number.
Returns:
On success, a new stream object for the specified include file is returned. In case of an error, an error message is logged through sobjxc_error() and a null-pointer is returned.

int sobjxc_parse struct sobjxc_table table,
FILE *  fp,
const char *  filename,
struct sobj options,
int  level
[static]
 

Parse a definition file.

Parameters:
table The table object.
fp The input file stream.
filename The input file name.
options The global options for the definition file. This may be a null-pointer.
level The recursion level. This should be 0 for the top-most call to this function.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

char * sobjxc_parse_code FILE *  fp,
const char *  filename,
int *  lineno_ref
[static]
 

Parse a code block.

Parameters:
fp The input file stream.
filename The input file name.
lineno_ref Pointer to the caller's line number variable.
Returns:
On success, a pointer to a heap allocated buffer holding the code block is returned (allocated through sobj_malloc()). In case of an error, a null-pointer is returned.

int sobjxc_parse_message_or_exception struct sobjxc_table table,
FILE *  fp,
const char *  filename,
struct sobj options,
int *  lineno_ref,
const char *  line,
bool  parse_message
[static]
 

Parse a message or exception definition.

Parameters:
table The table object.
fp The input file stream.
filename The input file name.
options The global options.
lineno_ref Pointer to the caller's line number variable.
line The remainder of the current input line.
parse_message Flag indicating if a message or an exception should be parsed.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_parse_type FILE *  fp,
const char *  filename,
int *  lineno_ref,
const char *  line
[static]
 

Parse a custom type declaration.

Parameters:
fp The input file stream.
filename The input filename.
lineno_ref Pointer to the caller's line number variable.
line The remainder of the current input line.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().


Generated on Sat Jul 23 16:05:58 2005 for sobject by  doxygen 1.3.9.1