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

Implementation
[Exception Compiler]


Detailed Description

Documentation for the sobjxc tool implementation.


Files

file  sobjxc.c
 Implementation of the definition file parser and data structures of the sobjxc tool.
file  sobjxc.h
 Common include file of the sobjxc tool.
file  sobjxc_c.c
 C output of the sobjxc tool.
file  sobjxc_main.c
 Main implementation file of the sobjxc SObject exception and message compiler.
file  sobjxc_xml.c
 XML I/O implementation file of the sobjxc tool.

Data Structures

struct  sobjxc_table
 Structure representing a message and exception table as read from a message file. More...
struct  sobjxc_param
 Structure representing an exception or message parameter. More...
struct  sobjxc_message
 Structure representing a message. More...
struct  sobjxc_exception
 Structure representing an exception class. More...

Defines

#define SOBJXC_MAX_INCLUDE_LEVEL   (20)
 The maximum nesting depth for include files.
#define SOBJXC_C_MAX_TYPE   (1000)
 The maximum number of types (including custom types) for the C backend.

Enumerations

enum  sobjxc_message_type {
  SXC_MTYPE_NONE = 0, SXC_MTYPE_DEBUG, SXC_MTYPE_INFO, SXC_MTYPE_WARNING,
  SXC_MTYPE_ERROR, SXC_MTYPE_FATAL
}
 Enumeration of message types. More...

Functions

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.
int sobjxc_c_new_type (struct sobj *def, const char *filename, int lineno)
 Add a user defined custom type to the C backend.
sobjxc_tablesobjxc_table::new_sobjxc_table (void)
 Create a new message/exception table object.
void sobjxc_table::delete_sobjxc_table (struct sobjxc_table *table)
 Delete a message/exception table object.
int sobjxc_table::sobjxc_table_add_message (struct sobjxc_table *table, struct sobjxc_message *message, const char *filename, int lineno)
 Add a message to a message/exception table.
int sobjxc_table::sobjxc_table_add_exception (struct sobjxc_table *table, struct sobjxc_exception *exception, const char *filename, int lineno)
 Add an exception to a message/exception table.
const char * sobjxc_table::sobjxc_table_get_module (const struct sobjxc_table *table)
 Get the module name from a table object.
sobjxc_paramsobjxc_param::new_sobjxc_param (const char *type, const char *name)
 Create a new parameter object.
void sobjxc_param::delete_sobjxc_param (struct sobjxc_param *param)
 Delete a parameter object.
sobjxc_messagesobjxc_message::new_sobjxc_message (enum sobjxc_message_type type, int level, const char *id)
 Create a new message object.
void sobjxc_message::delete_sobjxc_message (struct sobjxc_message *message)
 Delete a message object.
void sobjxc_message::sobjxc_message_add_fixed_param (struct sobjxc_message *message, const char *name, struct sobj *value)
 Add a fixed parameter to a message.
sobjxc_exceptionsobjxc_exception::new_sobjxc_exception (const char **xcls, int xcls_n, const char *id)
 Create a new exception object.
void sobjxc_exception::delete_sobjxc_exception (struct sobjxc_exception *exception)
 Delete an exception object.
void sobjxc_exception::sobjxc_exception_add_fixed_param (struct sobjxc_exception *exception, const char *name, struct sobj *value)
 Add a fixed parameter to an exception.
int sobjxc_table::sobjxc_table_read_def (struct sobjxc_table *table, FILE *fp, const char *filename, struct sobj *options)
 Read an input file and add the messages and exceptions to the specified table.
int sobjxc_table::sobjxc_table_write_c (const struct sobjxc_table *table, FILE *fp, const char *filename)
 Write the table to a C file.
int sobjxc_table::sobjxc_table_write_h (const struct sobjxc_table *table, FILE *fp, const char *filename)
 Write the table to a C include file.
int sobjxc_table::sobjxc_table_write_xml (const struct sobjxc_table *table, FILE *fp, const char *filename)
 Write the table to an XML file.
int sobjxc_param::sobjxc_param_write_xml (const struct sobjxc_param *param, FILE *fp, const char *filename)
 Write an XML representation of a parameter object to the specified stream.
int sobjxc_message::sobjxc_message_write_xml (const struct sobjxc_message *message, FILE *fp, const char *filename)
 Write an XML representation of a message object to the specified stream.
int sobjxc_exception::sobjxc_exception_write_xml (const struct sobjxc_exception *exception, FILE *fp, const char *filename)
 Write an XML representation of an exception object to the specified stream.


Define Documentation

#define SOBJXC_C_MAX_TYPE   (1000)
 

The maximum number of types (including custom types) for the C backend.

#define SOBJXC_MAX_INCLUDE_LEVEL   (20)
 

The maximum nesting depth for include files.

This limit is used for guarding against infinite recursion.


Enumeration Type Documentation

enum sobjxc_message_type
 

Enumeration of message types.

Enumeration values:
SXC_MTYPE_NONE  Message disabled.
SXC_MTYPE_DEBUG  Debug message.
SXC_MTYPE_INFO  Info message.
SXC_MTYPE_WARNING  Warning message.
SXC_MTYPE_ERROR  Error message.
SXC_MTYPE_FATAL  Fatal error message.


Function Documentation

void delete_sobjxc_exception struct sobjxc_exception exception  )  [related, inherited]
 

Delete an exception object.

Parameters:
exception The exception object.

void delete_sobjxc_message struct sobjxc_message message  )  [related, inherited]
 

Delete a message object.

Parameters:
message The message object.

void delete_sobjxc_param struct sobjxc_param param  )  [related, inherited]
 

Delete a parameter object.

Parameters:
param The parameter object.

void delete_sobjxc_table struct sobjxc_table table  )  [related, inherited]
 

Delete a message/exception table object.

Parameters:
table The table object.

struct sobjxc_exception * new_sobjxc_exception const char **  xcls,
int  xcls_n,
const char *  id
[related, inherited]
 

Create a new exception object.

Parameters:
xcls The vector of exception classes.
xcls_n The number of exception classes.
id The exception ID.
Returns:
The new exception object.

struct sobjxc_message * new_sobjxc_message enum sobjxc_message_type  type,
int  level,
const char *  id
[related, inherited]
 

Create a new message object.

Parameters:
type The message type.
level The message level.
id The message ID.
Returns:
The new message object.

struct sobjxc_param * new_sobjxc_param const char *  type,
const char *  name
[related, inherited]
 

Create a new parameter object.

Parameters:
type The parameter type.
name The parameter name.
Returns:
The new parameter object.

struct sobjxc_table * new_sobjxc_table void   )  [related, inherited]
 

Create a new message/exception table object.

Returns:
The new message/exception table object.

void sobjxc_add_include_dir const char *  dir  ) 
 

Add a dictionary to the include path.

Parameters:
dir The directory to be added.

int sobjxc_c_new_type struct sobj def,
const char *  filename,
int  lineno
 

Add a user defined custom type to the C backend.

Parameters:
def The type definition object.
filename The input file name.
lineno The input line number.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

void sobjxc_deinit void   ) 
 

De-initialize the sobjxc tool.

void sobjxc_error const char *  format,
  ...
 

Send an error message to the standard error stream.

Parameters:
format A printf() style format string.
... Variable arguments as declared in the format string.

void sobjxc_exception_add_fixed_param struct sobjxc_exception exception,
const char *  name,
struct sobj value
[related, inherited]
 

Add a fixed parameter to an exception.

Parameters:
exception The exception object.
name The parameter name.
value The parameter value.

int sobjxc_exception_write_xml const struct sobjxc_exception exception,
FILE *  fp,
const char *  filename
[related, inherited]
 

Write an XML representation of an exception object to the specified stream.

Parameters:
exception The exception object.
fp The output file stream.
filename The output file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

void sobjxc_init const char *  program_name  ) 
 

Initialize the sobjxc tool.

Parameters:
program_name The program name as received through argv[0].

void sobjxc_message_add_fixed_param struct sobjxc_message message,
const char *  name,
struct sobj value
[related, inherited]
 

Add a fixed parameter to a message.

Parameters:
message The message object.
name The parameter name.
value The parameter value.

int sobjxc_message_write_xml const struct sobjxc_message message,
FILE *  fp,
const char *  filename
[related, inherited]
 

Write an XML representation of a message object to the specified stream.

Parameters:
message The message object.
fp The output file stream.
filename The output file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

struct sobj* sobjxc_normalize_options struct sobj options  ) 
 

Normalize an options object.

The function expects a plain array object. The function will convert key-less element of the form "<i>option</i>" or "no-<i>option</i>" into boolean options.

Parameters:
options The options object to be normalized.
Returns:
A flat reference to the normalized options object.

int sobjxc_param_write_xml const struct sobjxc_param param,
FILE *  fp,
const char *  filename
[related, inherited]
 

Write an XML representation of a parameter object to the specified stream.

Parameters:
param The parameter object.
fp The output file stream.
filename The output file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_readline struct sobj_buffer line,
int  lineno,
FILE *  fp,
const char *  filename
 

Read an input line from the specified input stream.

Note:
The function will append a terminating null-character to the end of the buffer.
Parameters:
line The line buffer. The input data read is appended to the specified buffer.
lineno The current line number.
fp The input file stream.
filename The input file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_table_add_exception struct sobjxc_table table,
struct sobjxc_exception exception,
const char *  filename,
int  lineno
[related, inherited]
 

Add an exception to a message/exception table.

The function checks that the exception ID is unique within the module of the exception.

Parameters:
table The table object.
exception The exception to be added.
filename The input filename.
lineno The input line number.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_table_add_message struct sobjxc_table table,
struct sobjxc_message message,
const char *  filename,
int  lineno
[related, inherited]
 

Add a message to a message/exception table.

The function checks that the message ID is unique within the module of the message.

Parameters:
table The table object.
message The message to be added.
filename The input filename.
lineno The input line number.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

const char * sobjxc_table_get_module const struct sobjxc_table table  )  [related, inherited]
 

Get the module name from a table object.

The function checks that all exceptions and messages share the same module name.

Parameters:
table The table object.
Returns:
The module name. The function returns a null-pointer if
  • the message/exception table is empty, or
  • the messages/exceptions belong to different modules.

int sobjxc_table_read_def struct sobjxc_table table,
FILE *  fp,
const char *  filename,
struct sobj options
[related, inherited]
 

Read an input file and add the messages and exceptions to the specified table.

Parameters:
table The message/exception table.
fp The input file stream.
filename The input filename.
options A dictionary holding the default options. This may be a null-pointer.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_table_write_c const struct sobjxc_table table,
FILE *  fp,
const char *  filename
[related, inherited]
 

Write the table to a C file.

Parameters:
table The table object.
fp The output file stream.
filename The output file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_table_write_h const struct sobjxc_table table,
FILE *  fp,
const char *  filename
[related, inherited]
 

Write the table to a C include file.

Parameters:
table The table object.
fp The output file stream.
filename The output file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

int sobjxc_table_write_xml const struct sobjxc_table table,
FILE *  fp,
const char *  filename
[related, inherited]
 

Write the table to an XML file.

Parameters:
table The table object.
fp The output file stream.
filename The output file name.
Return values:
0 Success.
-1 An error occurred and has been logged through sobjxc_error().

void sobjxc_verror const char *  format,
va_list  ap
 

Send an error message to the standard error stream.

This is the va_list variant of sobjxc_error().

Parameters:
format A printf() style format string.
ap Pointer to the variable argument list.


Generated on Sat Jul 23 16:07:34 2005 for sobject by  doxygen 1.3.9.1