00001 #ifndef STDPCCTS_H
00002 #define STDPCCTS_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ANTLR_VERSION
00013 #define ANTLR_VERSION 13333
00014 #endif
00015
00016 #include "pcctscfg.h"
00017 #include "pccts_stdio.h"
00018
00019 #include "charbuf.h"
00020 #include "stringbuffer.h"
00021 #include "libicl.h"
00022 #include "libicl_private.h"
00023 #include "glib.h"
00024 #include <stdio.h>
00025 #ifdef _WINDOWS
00026 #include "oaa-windows.h"
00027 #endif
00028
00029
00030 #define AST_FIELDS int isDefined; int type; char* tokenData; size_t tokenLen;
00031
00032 #define ZZCOL
00033
00034 #define USER_ZZSYN
00035
00036
00037 #define ZZLEXBUFSIZE 10485760
00038
00039 extern GByteArray* parser_dblQuoteBuf;
00040 extern char* parser_tmpStrIn;
00041 #ifdef NORMAL_GC
00042 extern void* GC_debug_malloc(size_t, const char*, int);
00043 extern char* gc_strdup(char*);
00044 #endif
00045
00046 #ifdef NORMAL_GC
00047 #define zzcr_ast(ast, attr, ttype, text) { \
00048 if(((ttype) == ICLDATAQ) || \
00049 ((ttype) == DBLQUOTED)) { \
00050 char* buf = parser_dblQuoteBuf->data; \
00051 g_byte_array_free(parser_dblQuoteBuf, FALSE); \
00052
00053
00054
00055
00056 \
00057 ast->tokenData = buf; \
00058 ast->tokenLen = parser_dblQuoteLen; \
00059 } \
00060 else { \
00061 if(zzbufovf) { \
00062 ast->tokenLen = ZZLEXBUFSIZE; \
00063 ast->tokenData = (char*)GC_debug_malloc(ZZLEXBUFSIZE + 1, __FILE__, __LINE__); \
00064 strncpy(ast->tokenData, text, ZZLEXBUFSIZE); \
00065 fprintf(stderr, "ZZLEXBUFSIZE overflowed (%i)\n", ZZLEXBUFSIZE); \
00066 } \
00067 else { \
00068 ast->tokenData = gc_strdup(text); \
00069 ast->tokenLen = strlen(text); \
00070 } \
00071 } \
00072 ast->type = (ttype); \
00073 ast->isDefined = 1; \
00074 ast->right = NULL; \
00075 ast->down = NULL; \
00076 \
00077 };
00078
00079
00080
00081
00082
00083
00084
00085
00086 #undef zzd_ast
00087
00088 #else
00089 #define zzcr_ast(ast, attr, ttype, text) { \
00090 if(((ttype) == ICLDATAQ) || \
00091 ((ttype) == DBLQUOTED)) { \
00092 char* buf = parser_dblQuoteBuf->data; \
00093 g_byte_array_free(parser_dblQuoteBuf, FALSE); \
00094
00095
00096
00097
00098 \
00099 ast->tokenData = buf; \
00100 ast->tokenLen = parser_dblQuoteLen; \
00101 } \
00102 else { \
00103 if(zzbufovf) { \
00104 ast->tokenLen = ZZLEXBUFSIZE; \
00105 ast->tokenData = (char*)malloc(ZZLEXBUFSIZE + 1); \
00106 strncpy(ast->tokenData, text, ZZLEXBUFSIZE); \
00107 fprintf(stderr, "ZZLEXBUFSIZE overflowed (%i)\n", ZZLEXBUFSIZE); \
00108 } \
00109 else { \
00110 ast->tokenData = strdup(text); \
00111 ast->tokenLen = strlen(text); \
00112 } \
00113 } \
00114 ast->type = (ttype); \
00115 ast->isDefined = 1; \
00116 ast->right = NULL; \
00117 ast->down = NULL; \
00118 \
00119 };
00120
00121
00122
00123
00124
00125
00126
00127 #undef zzd_ast
00128
00129 #endif
00130
00131 extern int parser_dblQuoteLen;
00132 extern ICLTerm* parser_getTermFromString(char* str, size_t len);
00133 extern ICLTerm* parser_getTermFromStringDebug(char* str, size_t len);
00134 extern int parser_getTermFromBuf(ICLTerm** result, stringbuffer_t* buf, int* lookedAhead);
00135 extern int parser_getNetTermFromBuf(ICLTerm** result, stringbuffer_t* buf);
00136
00137 extern int parser_error;
00138 extern int parser_setDebug(int b);
00139 extern void handleDblQuotedData();
00140 #define LL_K 2
00141 #define GENAST
00142 #define zzSET_SIZE 8
00143 #include "antlr.h"
00144 #include "ast.h"
00145 #include "tokens.h"
00146 #include "dlgdef.h"
00147 #include "mode.h"
00148 #endif