gpp.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

Data Structures

struct  MODE
struct  COMMENT
struct  SPECS
struct  MACRO
struct  OUTPUTCONTEXT
struct  INPUTCONTEXT

Defines

#define SLASH   '/'
#define DEFAULT_CRLF   0
#define STACKDEPTH   50
#define MAXARGS   100
#define MAXINCL   14
#define MAX_GPP_NUM_SIZE   15
#define DEFAULT_OP_STRING   (unsigned char *)"+-*/\\^<>=`~:.?@#&!%|"
#define PROLOG_OP_STRING   (unsigned char *)"+-*/\\^<>=`~:.?@#&"
#define FLORA_OP_STRING   (unsigned char *)"+-*/\\^<>=`~:.?@#&%"
#define DEFAULT_OP_PLUS   (unsigned char *)"()[]{}"
#define DEFAULT_ID_STRING   (unsigned char *)"\005\007_"
#define LOG_LONG_BITS   5
#define CHARSET_SUBSET_LEN   (256>>LOG_LONG_BITS)
#define OUTPUT_TEXT   0x1
#define OUTPUT_DELIM   0x2
#define PARSE_MACROS   0x4
#define FLAG_IGNORE   0x40
#define FLAG_STRING   (OUTPUT_TEXT|OUTPUT_DELIM)
#define FLAG_COMMENT   0
#define FLAG_META   0
#define FLAG_USER   1
#define FLAG_TEXT   2
#define HASH_SIZE   256
#define HASH_CONST   37

Typedefs

typedef MODE MODE
typedef unsigned long * CHARSET_SUBSET
typedef COMMENT COMMENT
typedef SPECS SPECS
typedef MACRO MACRO
typedef OUTPUTCONTEXT OUTPUTCONTEXT
typedef INPUTCONTEXT INPUTCONTEXT

Functions

void ProcessContext (void)
int findIdent (char *b, int l, int *h)
void delete_macro (int h, int i)
static void getDirname (char *fname, char *dirname)
static FILE * openInCurrentDir (char *incfile)
char * ArithmEval (int pos1, int pos2)
void replace_definition_with_blank_lines (char *start, char *end, int skip)
void replace_directive_with_blank_line (FILE *file)
void write_include_marker (FILE *f, int lineno, char *filename, char *marker)
void construct_include_directive_marker (char **include_directive_marker, char *includemarker_input)
void escape_backslashes (char *instr, char **outstr)
void bug (char *s)
void warning (char *s)
int hash_str (char *s, int l)
SPECSCloneSpecs (struct SPECS *Q)
void FreeComments (struct SPECS *Q)
void PushSpecs (struct SPECS *X)
void PopSpecs (void)
void usage (void)
int isdelim (unsigned char c)
int iswhite (char c)
MACROnewmacro (char *s, int len, int hasspecs, int h)
void lookupArgRefs (struct MACRO *m)
char * strnl0 (char *s)
char * strnl (char *s)
char * strnl2 (char *s, int check_delim)
int iswhitesep (char *s)
int nowhite_strcmp (char *s, char *t)
void parseCmdlineDefine (char *s)
int readModeDescription (char **args, struct MODE *mode, int ismeta)
int parse_comment_specif (char c)
void add_comment (struct SPECS *S, char *specif, char *start, char *end, char quote, char warn)
void delete_comment (struct SPECS *S, char *start)
void outchar (char c)
void sendout (char *s, int l, int proc)
void extendBuf (int pos)
char getChar (int pos)
int whiteout (int *pos1, int *pos2)
int identifierEnd (int start)
int iterIdentifierEnd (int start)
int IsInCharset (CHARSET_SUBSET x, int c)
int matchSequence (char *s, int *pos)
int matchEndSequence (char *s, int *pos)
int matchStartSequence (char *s, int *pos)
void AddToCharset (CHARSET_SUBSET x, int c)
CHARSET_SUBSET MakeCharsetSubset (unsigned char *s)
int idequal (char *b, int l, char *s)
int findNamedArg (char *b, int l)
void shiftIn (int l)
void initthings (int argc, char **argv)
int findCommentEnd (char *endseq, char quote, char warn, int pos, int flags)
void SkipPossibleComments (int *pos, int cmtmode, int silentonly)
int SplicePossibleUser (int *idstart, int *idend, int *sh_end, int *lg_end, int *argb, int *arge, int *argc, int idcheck, int *id, int cmtmode, int *hash)
int findMetaArgs (int start, int *p1b, int *p1e, int *p2b, int *p2e, int *endm, int *argc, int *argb, int *arge)
char * ProcessText (char *buf, int l, int ambience)
char * ProcessFastDefinition (char *buf, int l, char **argnames)
int SpliceInfix (char *buf, int pos1, int pos2, char *sep, int *spl1, int *spl2)
int DoArithmEval (char *buf, int pos1, int pos2, int *result)
int comment_or_white (int start, int end, int cmtmode)
char * remove_comments (int start, int end, int cmtmode)
void SetStandardMode (struct SPECS *P, char *opt)
void ProcessModeCommand (int p1start, int p1end, int p2start, int p2end)
int ParsePossibleMeta ()
int ParsePossibleUser (void)
void ParseText (void)
int main (int argc, char **argv)

Variables

MODE CUser = {"", "", "(", ",", ")", "#", '\\', "(", ")" }
MODE CMeta = {"#", "\n", "\001","\001","\n","#", '\\', "(", ")" }
MODE KUser = {"", "", "(", ",", ")", "#", 0, "(", ")" }
MODE KMeta = {"\n#\002","\n", "\001","\001","\n","#", 0, "", "" }
MODE Tex = {"\\", "", "{", "}{", "}", "#", '@', "{", "}" }
MODE Html = {"<#", ">", "\003","|", ">", "#", '\\', "<", ">" }
CHARSET_SUBSET DefaultOp
CHARSET_SUBSET DefaultExtOp
CHARSET_SUBSET PrologOp
CHARSET_SUBSET FloraOp
CHARSET_SUBSET DefaultId
SPECSS
MACROmacros [HASH_SIZE]
int nmacros [HASH_SIZE]
int nalloced [HASH_SIZE]
char * includedir [MAXINCL]
int nincludedirs
int execallowed
int dosmode
int autoswitch
char * include_directive_marker = NULL
short WarningLevel = 2
int NoStdInc = 0
int NoCurIncFirst = 0
int CurDirIncLast = 0
int file_and_stdout = 0
INPUTCONTEXTC
int commented [STACKDEPTH]
int iflevel

Define Documentation

#define CHARSET_SUBSET_LEN   (256>>LOG_LONG_BITS)
 

#define DEFAULT_CRLF   0
 

#define DEFAULT_ID_STRING   (unsigned char *)"\005\007_"
 

#define DEFAULT_OP_PLUS   (unsigned char *)"()[]{}"
 

#define DEFAULT_OP_STRING   (unsigned char *)"+-*/\\^<>=`~:.?@#&!%|"
 

#define FLAG_COMMENT   0
 

#define FLAG_IGNORE   0x40
 

#define FLAG_META   0
 

#define FLAG_STRING   (OUTPUT_TEXT|OUTPUT_DELIM)
 

#define FLAG_TEXT   2
 

#define FLAG_USER   1
 

#define FLORA_OP_STRING   (unsigned char *)"+-*/\\^<>=`~:.?@#&%"
 

#define HASH_CONST   37
 

#define HASH_SIZE   256
 

#define LOG_LONG_BITS   5
 

#define MAX_GPP_NUM_SIZE   15
 

#define MAXARGS   100
 

#define MAXINCL   14
 

#define OUTPUT_DELIM   0x2
 

#define OUTPUT_TEXT   0x1
 

#define PARSE_MACROS   0x4
 

#define PROLOG_OP_STRING   (unsigned char *)"+-*/\\^<>=`~:.?@#&"
 

#define SLASH   '/'
 

#define STACKDEPTH   50
 


Typedef Documentation

typedef unsigned long* CHARSET_SUBSET
 

typedef struct COMMENT COMMENT
 

typedef struct INPUTCONTEXT INPUTCONTEXT
 

typedef struct MACRO MACRO
 

typedef struct MODE MODE
 

typedef struct OUTPUTCONTEXT OUTPUTCONTEXT
 

typedef struct SPECS SPECS
 


Function Documentation

void add_comment struct SPECS S,
char *  specif,
char *  start,
char *  end,
char  quote,
char  warn
 

void AddToCharset CHARSET_SUBSET  x,
int  c
 

char * ArithmEval int  pos1,
int  pos2
 

void bug char *  s  ) 
 

struct SPECS* CloneSpecs struct SPECS Q  ) 
 

int comment_or_white int  start,
int  end,
int  cmtmode
 

void construct_include_directive_marker char **  include_directive_marker,
char *  includemarker_input
 

void delete_comment struct SPECS S,
char *  start
 

void delete_macro int  h,
int  i
 

int DoArithmEval char *  buf,
int  pos1,
int  pos2,
int result
 

void escape_backslashes char *  instr,
char **  outstr
 

void extendBuf int  pos  ) 
 

int findCommentEnd char *  endseq,
char  quote,
char  warn,
int  pos,
int  flags
 

int findIdent char *  b,
int  l,
int h
 

int findMetaArgs int  start,
int p1b,
int p1e,
int p2b,
int p2e,
int endm,
int argc,
int argb,
int arge
 

int findNamedArg char *  b,
int  l
 

void FreeComments struct SPECS Q  ) 
 

char getChar int  pos  ) 
 

static void getDirname char *  fname,
char *  dirname
[static]
 

int hash_str char *  s,
int  l
 

int identifierEnd int  start  ) 
 

int idequal char *  b,
int  l,
char *  s
 

void initthings int  argc,
char **  argv
 

int isdelim unsigned char  c  ) 
 

int IsInCharset CHARSET_SUBSET  x,
int  c
 

int iswhite char  c  ) 
 

int iswhitesep char *  s  ) 
 

int iterIdentifierEnd int  start  ) 
 

void lookupArgRefs struct MACRO m  ) 
 

int main int  argc,
char **  argv
 

CHARSET_SUBSET MakeCharsetSubset unsigned char *  s  ) 
 

int matchEndSequence char *  s,
int pos
 

int matchSequence char *  s,
int pos
 

int matchStartSequence char *  s,
int pos
 

struct MACRO* newmacro char *  s,
int  len,
int  hasspecs,
int  h
 

int nowhite_strcmp char *  s,
char *  t
 

static FILE * openInCurrentDir char *  incfile  )  [static]
 

void outchar char  c  ) 
 

int parse_comment_specif char  c  ) 
 

void parseCmdlineDefine char *  s  ) 
 

int ParsePossibleMeta  ) 
 

int ParsePossibleUser void   ) 
 

void ParseText void   ) 
 

void PopSpecs void   ) 
 

void ProcessContext void   ) 
 

char* ProcessFastDefinition char *  buf,
int  l,
char **  argnames
 

void ProcessModeCommand int  p1start,
int  p1end,
int  p2start,
int  p2end
 

char* ProcessText char *  buf,
int  l,
int  ambience
 

void PushSpecs struct SPECS X  ) 
 

int readModeDescription char **  args,
struct MODE mode,
int  ismeta
 

char* remove_comments int  start,
int  end,
int  cmtmode
 

void replace_definition_with_blank_lines char *  start,
char *  end,
int  skip
 

void replace_directive_with_blank_line FILE *  file  ) 
 

void sendout char *  s,
int  l,
int  proc
 

void SetStandardMode struct SPECS P,
char *  opt
 

void shiftIn int  l  ) 
 

void SkipPossibleComments int pos,
int  cmtmode,
int  silentonly
 

int SpliceInfix char *  buf,
int  pos1,
int  pos2,
char *  sep,
int spl1,
int spl2
 

int SplicePossibleUser int idstart,
int idend,
int sh_end,
int lg_end,
int argb,
int arge,
int argc,
int  idcheck,
int id,
int  cmtmode,
int hash
 

char* strnl char *  s  ) 
 

char* strnl0 char *  s  ) 
 

char* strnl2 char *  s,
int  check_delim
 

void usage void   ) 
 

void warning char *  s  ) 
 

int whiteout int pos1,
int pos2
 

void write_include_marker FILE *  f,
int  lineno,
char *  filename,
char *  marker
 


Variable Documentation

int autoswitch
 

struct INPUTCONTEXT* C
 

struct MODE CMeta = {"#", "\n", "\001","\001","\n","#", '\\', "(", ")" }
 

int commented[STACKDEPTH]
 

int CurDirIncLast = 0
 

struct MODE CUser = {"", "", "(", ",", ")", "#", '\\', "(", ")" }
 

CHARSET_SUBSET DefaultExtOp
 

CHARSET_SUBSET DefaultId
 

CHARSET_SUBSET DefaultOp
 

int dosmode
 

int execallowed
 

int file_and_stdout = 0
 

CHARSET_SUBSET FloraOp
 

struct MODE Html = {"<#", ">", "\003","|", ">", "#", '\\', "<", ">" }
 

int iflevel
 

char* include_directive_marker = NULL
 

char* includedir[MAXINCL]
 

struct MODE KMeta = {"\n#\002","\n", "\001","\001","\n","#", 0, "", "" }
 

struct MODE KUser = {"", "", "(", ",", ")", "#", 0, "(", ")" }
 

struct MACRO* macros[HASH_SIZE]
 

int nalloced[HASH_SIZE]
 

int nincludedirs
 

int nmacros[HASH_SIZE]
 

int NoCurIncFirst = 0
 

int NoStdInc = 0
 

CHARSET_SUBSET PrologOp
 

struct SPECS* S
 

struct MODE Tex = {"\\", "", "{", "}{", "}", "#", '@', "{", "}" }
 

short WarningLevel = 2
 


Generated on Wed Jul 26 13:26:55 2006 for XSB by  doxygen 1.4.5