Main Page | Class List | Directories | File List | Class Members | File Members

cpp_parse.c File Reference

CKPM C pre-processor parser. More...

#include <unistd.h>
#include <string.h>
#include <strings.h>
#include "cpp_io.h"
#include "cpp_calc.h"
#include "cpp_conv.h"
#include "cpp_macros.h"
#include "cpp_path.h"
#include "cpp_scan.h"
#include "cpp_parse.h"

Functions

int simple_Expression (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a simple expression
int defined_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a defined statement
int if_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a if statement
int endif_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a endif statement
int ifdef_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a ifdef statement
int ifndef_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a ifndef statement
int cpp_error (int fd, struct _token *t, char *s1, char *s2)
 write an error message with two strings and a newline to an open file
int cpp_warning (int fd, struct _token *t, char *s1, char *s2)
 write an warning message with two strings and a newline to an open file
int cpp_info (int fd, struct _token *t, char *s1, char *s2)
 write an info message with two strings and a newline to an open file
void calculate (int fd_err, int sym, struct _calc *st)
 calculate expressions using the stack based calculator
int comp_Expression (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a logical and expression
int logical_And_Expression (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a logical and expression
int logical_Or_Expression (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a logical or expression
int factor (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a factor
int term (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st, int neg)
 parse a term
int elsif_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a elsif statement
int else_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a else statement
void write_line (int fd_out, struct _token *t)
 write the current line number and file name to the output file
int include_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st, struct _include_path *pl)
 parse a include statement
int define_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a define statement
int undef_Statement (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st)
 parse a undef statement
int PreProcLine (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st, struct _include_path *pl)
 parse a pre-processor line
int cpp_parse (int fd_in, int fd_out, int fd_err, struct _token *t, struct _macro_list *ml, struct _calc *st, struct _include_path *pl)
 the C pre-processor parser


Detailed Description

CKPM C pre-processor parser.


Function Documentation

void calculate int  fd_err,
int  sym,
struct _calc st
 

calculate expressions using the stack based calculator

Parameters:
fd_err file descriptor index of the error output file
sym the operation to be performed
st the calculator stack
Returns:

int comp_Expression int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a logical and expression

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int cpp_error int  fd,
struct _token t,
char *  s1,
char *  s2
 

write an error message with two strings and a newline to an open file

Parameters:
fd an already opened file to write to
t the actual token (including line number)
s1 the first string to be written
s2 the second string to be written
Returns:
the response code from write(2)

int cpp_info int  fd,
struct _token t,
char *  s1,
char *  s2
 

write an info message with two strings and a newline to an open file

Parameters:
fd an already opened file to write to
t the actual token (including line number)
s1 the first string to be written
s2 the second string to be written
Returns:
the response code from write(2)

int cpp_parse int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st,
struct _include_path *  pl
 

the C pre-processor parser

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
pl include path list
Returns:
1 on success, otherwise 0

int cpp_warning int  fd,
struct _token t,
char *  s1,
char *  s2
 

write an warning message with two strings and a newline to an open file

Parameters:
fd an already opened file to write to
t the actual token (including line number)
s1 the first string to be written
s2 the second string to be written
Returns:
the response code from write(2)

int define_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a define statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int defined_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a defined statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int else_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a else statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int elsif_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a elsif statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int endif_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a endif statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int factor int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a factor

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int if_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a if statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int ifdef_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a ifdef statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int ifndef_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a ifndef statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int include_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st,
struct _include_path *  pl
 

parse a include statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
pl include path list
Returns:

int logical_And_Expression int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a logical and expression

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int logical_Or_Expression int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a logical or expression

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int PreProcLine int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st,
struct _include_path *  pl
 

parse a pre-processor line

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
pl include path list
Returns:

int simple_Expression int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a simple expression

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

int term int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st,
int  neg
 

parse a term

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
neg if != 0 then negate the first factor
Returns:

int undef_Statement int  fd_in,
int  fd_out,
int  fd_err,
struct _token t,
struct _macro_list ml,
struct _calc st
 

parse a undef statement

Parameters:
fd_in file descriptor index of the input file
fd_out file descriptor index of the output file
fd_err file descriptor index of the error output file
t the current token
ml the macro list
st the calculator stack
Returns:

void write_line int  fd_out,
struct _token t
 

write the current line number and file name to the output file

Parameters:
fd_out file descriptor index of the output file
t the current token


Generated on Thu Jul 13 03:56:36 2006 for CKPMcc by  doxygen 1.4.4