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

cpp.c File Reference

#include "global.h"
#include "stralloc.h"
#include "module_support.h"
#include "interpret.h"
#include "svalue.h"
#include "pike_macros.h"
#include "hashtable.h"
#include "program.h"
#include "object.h"
#include "pike_error.h"
#include "array.h"
#include "mapping.h"
#include "builtin_functions.h"
#include "operators.h"
#include "constants.h"
#include "time.h"
#include "stuff.h"
#include "version.h"
#include "pike_types.h"
#include "cpp.h"
#include "lex.h"
#include <ctype.h>
#include "preprocessor.h"

Classes

struct  pike_predef_s
struct  define_part
struct  define_argument
struct  define
struct  cpp

Defines

#define sp   Pike_sp
#define CPP_NO_OUTPUT   1
#define CPP_EXPECT_ELSE   2
#define CPP_EXPECT_ENDIF   4
#define CPP_REALLY_NO_OUTPUT   8
#define CPP_END_AT_NEWLINE   16
#define CPP_DO_IF   32
#define CPP_NO_EXPAND   64
#define OUTP()   (!(flags & (CPP_NO_OUTPUT | CPP_REALLY_NO_OUTPUT)))
#define PUTNL()   string_builder_putchar(&this->buf, '\n')
#define GOBBLE(X)   (data[pos]==(X)?++pos,1:0)
#define PUTC(C)
#define MAX_ARGS   255
#define DEF_ARG_STRINGIFY   0x100000
#define DEF_ARG_NOPRESPACE   0x200000
#define DEF_ARG_NOPOSTSPACE   0x400000
#define DEF_ARG_MASK   0x0fffff
#define CALC_DUMPPOS(X)
#define find_define(N)   (this->defines?BASEOF(hash_lookup(this->defines, N), define, link):0)
#define FIND_END_OF_STRING()
#define FIND_END_OF_STRING2()
#define FIND_END_OF_CHAR()
#define DUMPPOS(X)
#define FIND_EOL()
#define SKIPWHITE()
#define SKIPSPACE()
#define SKIPCOMMENT()
#define READCHAR(C)
#define READSTRING(nf)
#define FIXSTRING(nf, outp)
#define READSTRING2(nf)
#define SHIFT   0
#define SHIFT   1
#define SHIFT   2

Typedefs

typedef void(* magic_define_fun )(struct cpp *, struct define *, struct define_argument *, struct string_builder *)

Functions

void cpp_change_compat (struct cpp *this, int major, int minor)
void cpp_func_constant (struct cpp *this, INT32 args)
void free_one_define (struct hash_entry *h)
void f_cpp (INT32 args)
void f__take_over_initial_predefines (INT32 args)
void init_cpp ()
void add_predefine (char *s)
void exit_cpp (void)

Variables

definedefined_macro = 0

Define Documentation

#define CALC_DUMPPOS  ) 
 

#define CPP_DO_IF   32
 

#define CPP_END_AT_NEWLINE   16
 

#define CPP_EXPECT_ELSE   2
 

#define CPP_EXPECT_ENDIF   4
 

#define CPP_NO_EXPAND   64
 

#define CPP_NO_OUTPUT   1
 

#define CPP_REALLY_NO_OUTPUT   8
 

#define DEF_ARG_MASK   0x0fffff
 

#define DEF_ARG_NOPOSTSPACE   0x400000
 

#define DEF_ARG_NOPRESPACE   0x200000
 

#define DEF_ARG_STRINGIFY   0x100000
 

#define DUMPPOS  ) 
 

Value:

fprintf(stderr,"\nSHIFT:%d, POS(%s):",SHIFT,X); \
                  fflush(stderr);                                       \
                  write(2,data+pos,20<<SHIFT);                          \
                  fprintf(stderr,"\n");                                 \
                  fflush(stderr)

#define find_define  )     (this->defines?BASEOF(hash_lookup(this->defines, N), define, link):0)
 

 
#define FIND_END_OF_CHAR  ) 
 

 
#define FIND_END_OF_STRING  ) 
 

 
#define FIND_END_OF_STRING2  ) 
 

Value:

do {                                    \
  while(1)                                                              \
  {                                                                     \
    if(pos>=len)                                                        \
    {                                                                   \
      cpp_error(this,"End of file in string.");                         \
      break;                                                            \
    }                                                                   \
    switch(data[pos++])                                                 \
    {                                                                   \
    case '\n':                                                          \
      this->current_line++;                                             \
      PUTNL();                                                          \
      continue;                                                         \
    case '"': break;                                                    \
    case '\\':                                                          \
      if(data[pos]=='\n') {                                             \
        this->current_line++;                                           \
        PUTNL();                                                        \
      }                                                                 \
      else if ((data[pos] == '\r') && (data[pos+1] == '\n')) {          \
        this->current_line++;                                           \
        pos++;                                                          \
        PUTNL();                                                        \
      }                                                                 \
      pos++;                                                            \
    default: continue;                                                  \
    }                                                                   \
   break;                                                               \
  } } while(0)

 
#define FIND_EOL  ) 
 

Value:

do {                                            \
    while(pos < len && data[pos]!='\n') pos++;                  \
    if (data[pos] == '\\') {                                    \
      if (data[pos+1] == '\n') {                                \
        pos+=2;                                                 \
      } else if ((data[pos+1] == '\r') &&                       \
                 (data[pos+2] == '\n')) {                       \
        pos+=3;                                                 \
      } else {                                                  \
        break;                                                  \
      }                                                         \
    } else {                                                    \
      break;                                                    \
    }                                                           \
    PUTNL();                                                    \
    this->current_line++;                                       \
  } while (1)

#define FIXSTRING nf,
outp   ) 
 

#define GOBBLE  )     (data[pos]==(X)?++pos,1:0)
 

#define MAX_ARGS   255
 

 
#define OUTP  )     (!(flags & (CPP_NO_OUTPUT | CPP_REALLY_NO_OUTPUT)))
 

#define PUTC  ) 
 

Value:

do { \
 int c_=(C); if(OUTP() || c_=='\n') string_builder_putchar(&this->buf, c_); }while(0)

 
#define PUTNL  )     string_builder_putchar(&this->buf, '\n')
 

#define READCHAR  ) 
 

#define READSTRING nf   ) 
 

#define READSTRING2 nf   ) 
 

#define SHIFT   2
 

#define SHIFT   1
 

#define SHIFT   0
 

 
#define SKIPCOMMENT  ) 
 

Value:

do{                             \
        pos++;                                          \
        while(data[pos]!='*' || data[pos+1]!='/')       \
        {                                               \
          if(pos+2>=len)                                \
          {                                             \
            cpp_error(this,"End of file in comment.");  \
            break;                                      \
          }                                             \
                                                        \
          if(data[pos]=='\n')                           \
          {                                             \
            this->current_line++;                       \
            PUTNL();                                    \
          }                                             \
                                                        \
          pos++;                                        \
        }                                               \
        pos+=2;                                         \
  }while(0)

 
#define SKIPSPACE  ) 
 

Value:

do {                                                            \
    while (WC_ISSPACE(data[pos]) && data[pos]!='\n') {          \
      pos++;                                                    \
    }                                                           \
    if (data[pos] == '\\') {                                    \
      if (data[pos+1] == '\n') {                                \
        pos+=2;                                                 \
      } else if ((data[pos+1] == '\r') &&                       \
                 (data[pos+2] == '\n')) {                       \
        pos+=3;                                                 \
      } else {                                                  \
        break;                                                  \
      }                                                         \
    } else {                                                    \
      break;                                                    \
    }                                                           \
    PUTNL();                                                    \
    this->current_line++;                                       \
  } while (1)

 
#define SKIPWHITE  ) 
 

Value:

do {                                    \
    if(!WC_ISSPACE(data[pos])) {                                \
      if (data[pos] == '\\') {                                  \
        if (data[pos+1] == '\n') {                              \
          pos += 2;                                             \
          PUTNL();                                              \
          this->current_line++;                                 \
          continue;                                             \
        } else if ((data[pos+1] == '\r') &&                     \
                   (data[pos+2] == '\n')) {                     \
          pos += 3;                                             \
          PUTNL();                                              \
          this->current_line++;                                 \
          continue;                                             \
        }                                                       \
      }                                                         \
      break;                                                    \
    }                                                           \
    if(data[pos]=='\n') { PUTNL(); this->current_line++; }      \
    pos++;                                                      \
  } while(1)

#define sp   Pike_sp
 


Typedef Documentation

typedef void(* magic_define_fun)(struct cpp *, struct define *, struct define_argument *, struct string_builder *)
 


Function Documentation

void add_predefine char *  s  ) 
 

void cpp_change_compat struct cpp this,
int  major,
int  minor
 

void cpp_func_constant struct cpp this,
INT32  args
 

void exit_cpp void   ) 
 

void f__take_over_initial_predefines INT32  args  ) 
 

void f_cpp INT32  args  ) 
 

void free_one_define struct hash_entry h  ) 
 

void init_cpp void   ) 
 


Variable Documentation

struct define* defined_macro = 0
 


Generated on Fri Jul 22 23:44:28 2005 for Pike by  doxygen 1.3.9.1