Skip to content
Snippets Groups Projects
Select Git revision
  • 6d3ae7cf2123bda5b7eb61af09e3b40b3782b0a5
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

cpp.c

Blame
  • 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_);				\