Select Git revision
-
Henrik (Grubba) Grubbström authoredHenrik (Grubba) Grubbström authored
cpp.c 54.15 KiB
/*
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
*/
#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>
#define sp Pike_sp
#define CPP_NO_OUTPUT 1 /* Inside false section of #if/#else */
#define CPP_EXPECT_ELSE 2 /* Expect #else/#elif/#elseif. */
#define CPP_EXPECT_ENDIF 4 /* Expect #endif */
#define CPP_REALLY_NO_OUTPUT 8 /* Entire preprocessor is in false section. */
#define CPP_END_AT_NEWLINE 16 /* Halt at end of line. */
#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) do { \
int c_=(C); if(OUTP() || c_=='\n') string_builder_putchar(&this->buf, c_); }while(0)
#define MAX_ARGS 255
#define DEF_ARG_STRINGIFY 0x100000
#define DEF_ARG_NOPRESPACE 0x200000
#define DEF_ARG_NOPOSTSPACE 0x400000
#define DEF_ARG_NEED_COMMA 0x800000
#define DEF_ARG_MASK 0x0fffff
#if 0
#define CALC_DUMPPOS(X) DUMPPOS(X)
#else /* !0 */
#define CALC_DUMPPOS(X)
#endif /* 0 */
static struct pike_string *efun_str;
static struct pike_string *constant_str;
static struct pike_string *defined_str;
/* Some string builder debug. */
#if 0
#define string_builder_putchar(X, Y) do { \
int Y_Y_ = Y; \
fprintf(stderr, "%s:%d string_builder_putchar(%s, %s, '%c')\n", \
__FILE__,__LINE__, #X, #Y, Y_Y_); \