aboutsummaryrefslogtreecommitdiff
path: root/antlr-3.4/runtime/C/include/antlr3defs.h
blob: 2435b02507c4a3b3f2bb634c641c52bde439ce90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
/** \file
 * Basic type and constant definitions for ANTLR3 Runtime.
 */
#ifndef	_ANTLR3DEFS_H
#define	_ANTLR3DEFS_H

// [The "BSD licence"]
// Copyright (c) 2005-2009 Jim Idle, Temporal Wave LLC
// http://www.temporal-wave.com
// http://www.linkedin.com/in/jimidle
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
//    derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/* Following are for generated code, they are not referenced internally!!!
 */
#if !defined(ANTLR3_HUGE) && !defined(ANTLR3_AVERAGE) && !defined(ANTLR3_SMALL)
#define	ANTLR3_AVERAGE
#endif

#ifdef	ANTLR3_HUGE
#ifndef	ANTLR3_SIZE_HINT
#define	ANTLR3_SIZE_HINT        2049
#endif
#ifndef	ANTLR3_LIST_SIZE_HINT
#define	ANTLR3_LIST_SIZE_HINT   127
#endif
#endif

#ifdef	ANTLR3_AVERAGE
#ifndef	ANTLR3_SIZE_HINT
#define	ANTLR3_SIZE_HINT        1025
#define	ANTLR3_LIST_SIZE_HINT   63
#endif
#endif

#ifdef	ANTLR3_SMALL
#ifndef	ANTLR3_SIZE_HINT
#define	ANTLR3_SIZE_HINT        211
#define	ANTLR3_LIST_SIZE_HINT   31
#endif
#endif

// Definitions that indicate the encoding scheme character streams and strings etc
//
/// Indicates Big Endian for encodings where this makes sense
///
#define ANTLR3_BE           1

/// Indicates Little Endian for encoidngs where this makes sense
///
#define ANTLR3_LE           2

/// General latin-1 or other 8 bit encoding scheme such as straight ASCII
///
#define ANTLR3_ENC_8BIT     4

/// UTF-8 encoding scheme
///
#define ANTLR3_ENC_UTF8     8

/// UTF-16 encoding scheme (which also covers UCS2 as that does not have surrogates)
///
#define ANTLR3_ENC_UTF16        16
#define ANTLR3_ENC_UTF16BE      16 + ANTLR3_BE
#define ANTLR3_ENC_UTF16LE      16 + ANTLR3_LE

/// UTF-32 encoding scheme (basically straight 32 bit)
///
#define ANTLR3_ENC_UTF32        32
#define ANTLR3_ENC_UTF32BE      32 + ANTLR3_BE
#define ANTLR3_ENC_UTF32LE      32 + ANTLR3_LE

/// Input is 8 bit EBCDIC (which we convert to 8 bit ASCII on the fly
///
#define ANTLR3_ENC_EBCDIC       64

/* Common definitions come first
 */
#include    <antlr3errors.h>

/* Work out what operating system/compiler this is. We just do this once
 * here and use an internal symbol after this.
 */
#ifdef	_WIN64

# ifndef	ANTLR3_WINDOWS
#   define	ANTLR3_WINDOWS
# endif
# define	ANTLR3_WIN64
# define	ANTLR3_USE_64BIT

#else

#ifdef	_WIN32
# ifndef	ANTLR3_WINDOWS
#  define	ANTLR3_WINDOWS
# endif

#define	ANTLR3_WIN32
#endif

#endif

#ifdef	ANTLR3_WINDOWS 

#ifndef WIN32_LEAN_AND_MEAN
#define	WIN32_LEAN_AND_MEAN
#endif

/* Allow VC 8 (vs2005) and above to use 'secure' versions of various functions such as sprintf
 */
#ifndef	_CRT_SECURE_NO_DEPRECATE 
#define	_CRT_SECURE_NO_DEPRECATE 
#endif

#include    <windows.h>
#include    <stdlib.h>
#include    <winsock.h>
#include    <stdio.h>
#include    <sys/types.h>
#include    <sys/stat.h>
#include    <stdarg.h>

#define	ANTLR3_API      __declspec(dllexport)
#define	ANTLR3_CDECL    __cdecl
#define ANTLR3_FASTCALL __fastcall

#ifdef __cplusplus
extern "C" {
#endif

#ifndef __MINGW32__
// Standard Windows types
//
typedef	INT32	ANTLR3_CHAR,	*pANTLR3_CHAR;
typedef	UINT32	ANTLR3_UCHAR,	*pANTLR3_UCHAR;

typedef	INT8	ANTLR3_INT8,	*pANTLR3_INT8;
typedef	INT16	ANTLR3_INT16,	*pANTLR3_INT16;
typedef	INT32	ANTLR3_INT32,	*pANTLR3_INT32;
typedef	INT64	ANTLR3_INT64,	*pANTLR3_INT64;
typedef	UINT8	ANTLR3_UINT8,	*pANTLR3_UINT8;
typedef	UINT16	ANTLR3_UINT16,	*pANTLR3_UINT16;
typedef	UINT32	ANTLR3_UINT32,	*pANTLR3_UINT32;
typedef	UINT64	ANTLR3_UINT64,	*pANTLR3_UINT64;
typedef UINT64  ANTLR3_BITWORD, *pANTLR3_BITWORD;
typedef	UINT8	ANTLR3_BOOLEAN, *pANTLR3_BOOLEAN;

#else
// Mingw uses stdint.h and fails to define standard Microsoft typedefs
// such as UINT16, hence we must use stdint.h for Mingw.
//
#include <stdint.h>
typedef int32_t     ANTLR3_CHAR,    *pANTLR3_CHAR;
typedef uint32_t    ANTLR3_UCHAR,   *pANTLR3_UCHAR;

typedef int8_t	    ANTLR3_INT8,    *pANTLR3_INT8;
typedef int16_t	    ANTLR3_INT16,   *pANTLR3_INT16;
typedef int32_t	    ANTLR3_INT32,   *pANTLR3_INT32;
typedef int64_t	    ANTLR3_INT64,   *pANTLR3_INT64;

typedef uint8_t	    ANTLR3_UINT8,   *pANTLR3_UINT8;
typedef uint16_t    ANTLR3_UINT16,  *pANTLR3_UINT16;
typedef uint32_t    ANTLR3_UINT32,  *pANTLR3_UINT32;
typedef uint64_t    ANTLR3_UINT64,  *pANTLR3_UINT64;
typedef uint64_t    ANTLR3_BITWORD, *pANTLR3_BITWORD;

typedef	uint8_t	    ANTLR3_BOOLEAN, *pANTLR3_BOOLEAN;

#endif



#define	ANTLR3_UINT64_LIT(lit)  lit##ULL

#define	ANTLR3_INLINE	        __inline

typedef FILE *	    ANTLR3_FDSC;
typedef	struct stat ANTLR3_FSTAT_STRUCT;

#ifdef	ANTLR3_USE_64BIT
#define	ANTLR3_FUNC_PTR(ptr)	(void *)((ANTLR3_UINT64)(ptr))
#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)(ptr))
#define	ANTLR3_UINT32_CAST(ptr)	(ANTLR3_UINT32)((ANTLR3_UINT64)(ptr))
typedef ANTLR3_INT64		ANTLR3_MARKER;			
typedef ANTLR3_UINT64		ANTLR3_INTKEY;
#else
#define	ANTLR3_FUNC_PTR(ptr)	(void *)((ANTLR3_UINT32)(ptr))
#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)((ANTLR3_UINT32)(ptr))
#define	ANTLR3_UINT32_CAST(ptr)	(ANTLR3_UINT32)(ptr)
typedef	ANTLR3_INT32		ANTLR3_MARKER;
typedef ANTLR3_UINT32		ANTLR3_INTKEY;
#endif

#ifdef	ANTLR3_WIN32
#endif

#ifdef	ANTLR3_WIN64
#endif


typedef	int			ANTLR3_SALENT;								// Type used for size of accept structure
typedef struct sockaddr_in	ANTLR3_SOCKADDRT, * pANTLR3_SOCKADDRT;	// Type used for socket address declaration
typedef struct sockaddr		ANTLR3_SOCKADDRC, * pANTLR3_SOCKADDRC;	// Type used for cast on accept()

#define	ANTLR3_CLOSESOCKET	closesocket

#ifdef __cplusplus
}
#endif

/* Warnings that are over-zealous such as complaining about strdup, we
 * can turn off.
 */

/* Don't complain about "deprecated" functions such as strdup
 */
#pragma warning( disable : 4996 )

#else

/* Include configure generated header file
 */
#include	<antlr3config.h>

#include <stdio.h>

#if HAVE_STDINT_H
# include <stdint.h>
#endif

#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif

#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif

#if STDC_HEADERS
# include   <stdlib.h>
# include   <stddef.h>
# include   <stdarg.h>
#else
# if HAVE_STDLIB_H
#  include  <stdlib.h>
# endif
# if HAVE_STDARG_H
#  include  <stdarg.h>
# endif
#endif

#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif

#if HAVE_STRINGS_H
# include <strings.h>
#endif

#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif

#if HAVE_UNISTD_H
# include <unistd.h>
#endif

#ifdef HAVE_NETINET_IN_H
#include	<netinet/in.h>
#endif

#ifdef HAVE_SOCKET_H
# include	<socket.h>
#else
# if HAVE_SYS_SOCKET_H
#  include	<sys/socket.h>
# endif
#endif

#ifdef HAVE_NETINET_TCP_H
#include	<netinet/tcp.h>
#endif

#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h> /* DNS HEADER struct */
#endif

#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif


#ifdef HAVE_SYS_RESOLVE_H
#include	<sys/resolv.h>
#endif

#ifdef HAVE_RESOLVE_H
#include	<resolv.h>
#endif


#ifdef	HAVE_MALLOC_H
# include    <malloc.h>
#else
# ifdef	HAVE_SYS_MALLOC_H
#  include    <sys/malloc.h>
# endif
#endif

#ifdef  HAVE_CTYPE_H
# include   <ctype.h>
#endif

/* Some platforms define a macro, index() in string.h. AIX is
 * one of these for instance. We must get rid of that definition
 * as we use ->index all over the place. defining macros like this in system header
 * files is a really bad idea, but I doubt that IBM will listen to me ;-)
 */
#ifdef	index
#undef	index
#endif

#define _stat   stat

// SOCKET not defined on Unix
// 
typedef	int	SOCKET;

#define ANTLR3_API
#define	ANTLR3_CDECL
#define ANTLR3_FASTCALL

#ifdef	__hpux

 // HPUX is always different usually for no good reason. Tru64 should have kicked it
 // into touch and everyone knows it ;-)
 //
 typedef struct sockaddr_in ANTLR3_SOCKADDRT, * pANTLR3_SOCKADDRT;	// Type used for socket address declaration
 typedef void *		    pANTLR3_SOCKADDRC;				// Type used for cast on accept()
 typedef int		    ANTLR3_SALENT;

#else

# if defined(_AIX) || __GNUC__ > 3 

   typedef  socklen_t   ANTLR3_SALENT;

# else

   typedef  size_t	ANTLR3_SALENT;

# endif

   typedef struct sockaddr_in   ANTLR3_SOCKADDRT, * pANTLR3_SOCKADDRT;	// Type used for socket address declaration
   typedef struct sockaddr	* pANTLR3_SOCKADDRC;                    // Type used for cast on accept()

#endif

#define INVALID_SOCKET      ((SOCKET)-1)
#define	ANTLR3_CLOSESOCKET  close

#ifdef __cplusplus
extern "C" {
#endif

/* Inherit type definitions for autoconf
 */
typedef int32_t	    ANTLR3_CHAR,    *pANTLR3_CHAR;
typedef uint32_t    ANTLR3_UCHAR,   *pANTLR3_UCHAR;

typedef int8_t	    ANTLR3_INT8,    *pANTLR3_INT8;
typedef int16_t	    ANTLR3_INT16,   *pANTLR3_INT16;
typedef int32_t	    ANTLR3_INT32,   *pANTLR3_INT32;
typedef int64_t	    ANTLR3_INT64,   *pANTLR3_INT64;

typedef uint8_t	    ANTLR3_UINT8,   *pANTLR3_UINT8;
typedef uint16_t    ANTLR3_UINT16,  *pANTLR3_UINT16;
typedef uint32_t    ANTLR3_UINT32,  *pANTLR3_UINT32;
typedef uint64_t    ANTLR3_UINT64,  *pANTLR3_UINT64;
typedef uint64_t    ANTLR3_BITWORD, *pANTLR3_BITWORD;

typedef uint32_t    ANTLR3_BOOLEAN, *pANTLR3_BOOLEAN;

#define ANTLR3_INLINE   inline
#define	ANTLR3_API

typedef FILE *	    ANTLR3_FDSC;
typedef	struct stat ANTLR3_FSTAT_STRUCT;

#ifdef	ANTLR3_USE_64BIT
#define	ANTLR3_FUNC_PTR(ptr)    (void *)((ANTLR3_UINT64)(ptr))
#define ANTLR3_UINT64_CAST(ptr)	(ANTLR3_UINT64)(ptr))
#define	ANTLR3_UINT32_CAST(ptr) (ANTLR3_UINT32)((ANTLR3_UINT64)(ptr))
typedef ANTLR3_INT64		ANTLR3_MARKER;
typedef ANTLR3_UINT64		ANTLR3_INTKEY;
#else
#define	ANTLR3_FUNC_PTR(ptr)	(void *)((ANTLR3_UINT32)(ptr))
#define ANTLR3_UINT64_CAST(ptr) (ANTLR3_UINT64)((ANTLR3_UINT32)(ptr))
#define	ANTLR3_UINT32_CAST(ptr)	(ANTLR3_UINT32)(ptr)
typedef	ANTLR3_INT32		ANTLR3_MARKER;
typedef ANTLR3_UINT32		ANTLR3_INTKEY;
#endif
#define	ANTLR3_UINT64_LIT(lit)	lit##ULL

#ifdef __cplusplus
}
#endif

#endif

#ifdef ANTLR3_USE_64BIT
#define ANTLR3_TRIE_DEPTH 63
#else
#define ANTLR3_TRIE_DEPTH 31
#endif
/* Pre declare the typedefs for all the interfaces, then 
 * they can be inter-dependant and we will let the linker
 * sort it out for us.
 */
#include    <antlr3interfaces.h>

// Include the unicode.org conversion library header.
//
#include    <antlr3convertutf.h>

/* Prototypes
 */
#ifndef ANTLR3_MALLOC
/// Default definition of ANTLR3_MALLOC. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_MALLOC(request)          malloc  ((size_t)(request))
#endif

#ifndef ANTLR3_CALLOC
/// Default definition of ANTLR3_CALLOC. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_CALLOC(numEl, elSize)    calloc  (numEl, (size_t)(elSize))
#endif

#ifndef ANTLR3_REALLOC
/// Default definition of ANTLR3_REALLOC. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define ANTLR3_REALLOC(current, request)    realloc ((void *)(current), (size_t)(request))
#endif
#ifndef ANTLR3_FREE
/// Default definition of ANTLR3_FREE. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_FREE(ptr)		free    ((void *)(ptr))
#endif
#ifndef ANTLR3_FREE_FUNC						
/// Default definition of ANTLR3_FREE_FUNC. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_FREE_FUNC		free
#endif
#ifndef ANTLR3_STRDUP
/// Default definition of ANTLR3_STRDUP. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_STRDUP(instr)		(pANTLR3_UINT8)(strdup  ((const char *)(instr)))
#endif
#ifndef ANTLR3_MEMCPY
/// Default definition of ANTLR3_MEMCPY. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_MEMCPY(target, source, size) memcpy((void *)(target), (const void *)(source), (size_t)(size))
#endif
#ifndef ANTLR3_MEMMOVE
/// Default definition of ANTLR3_MEMMOVE. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_MEMMOVE(target, source, size)    memmove((void *)(target), (const void *)(source), (size_t)(size))
#endif
#ifndef ANTLR3_MEMSET
/// Default definition of ANTLR3_MEMSET. You can override this before including
/// antlr3.h if you wish to use your own implementation.
///
#define	ANTLR3_MEMSET(target, byte, size)   memset((void *)(target), (int)(byte), (size_t)(size))
#endif

#ifndef	ANTLR3_PRINTF
/// Default definition of printf, set this to something other than printf before including antlr3.h
/// if your system does not have a printf. Note that you can define this to be <code>//</code>
/// without harming the runtime.
///
#define	ANTLR3_PRINTF   printf
#endif

#ifndef	ANTLR3_FPRINTF
/// Default definition of fprintf, set this to something other than fprintf before including antlr3.h
/// if your system does not have a fprintf. Note that you can define this to be <code>//</code>
/// without harming the runtime. 
///
#define	ANTLR3_FPRINTF	fprintf
#endif

#ifdef __cplusplus
extern "C" {
#endif

ANTLR3_API pANTLR3_INT_TRIE antlr3IntTrieNew    (ANTLR3_UINT32 depth);

ANTLR3_API pANTLR3_BITSET   antlr3BitsetNew	(ANTLR3_UINT32 numBits);
ANTLR3_API pANTLR3_BITSET   antlr3BitsetOf	(ANTLR3_INT32 bit, ...);
ANTLR3_API pANTLR3_BITSET   antlr3BitsetList	(pANTLR3_HASH_TABLE list);
ANTLR3_API pANTLR3_BITSET   antlr3BitsetCopy	(pANTLR3_BITSET_LIST blist);
ANTLR3_API pANTLR3_BITSET   antlr3BitsetLoad    (pANTLR3_BITSET_LIST blist);
ANTLR3_API void             antlr3BitsetSetAPI  (pANTLR3_BITSET bitset);


ANTLR3_API pANTLR3_BASE_RECOGNIZER  antlr3BaseRecognizerNew                     (ANTLR3_UINT32 type, ANTLR3_UINT32 sizeHint, pANTLR3_RECOGNIZER_SHARED_STATE state);
ANTLR3_API void			    antlr3RecognitionExceptionNew               (pANTLR3_BASE_RECOGNIZER recognizer);
ANTLR3_API void			    antlr3MTExceptionNew                        (pANTLR3_BASE_RECOGNIZER recognizer);
ANTLR3_API void			    antlr3MTNExceptionNew                       (pANTLR3_BASE_RECOGNIZER recognizer);
ANTLR3_API pANTLR3_HASH_TABLE	    antlr3HashTableNew                          (ANTLR3_UINT32 sizeHint);
ANTLR3_API ANTLR3_UINT32	    antlr3Hash                                  (void * key, ANTLR3_UINT32 keylen);
ANTLR3_API pANTLR3_HASH_ENUM	    antlr3EnumNew                               (pANTLR3_HASH_TABLE table);
ANTLR3_API pANTLR3_LIST		    antlr3ListNew                               (ANTLR3_UINT32 sizeHint);
ANTLR3_API pANTLR3_VECTOR_FACTORY   antlr3VectorFactoryNew                      (ANTLR3_UINT32 sizeHint);
ANTLR3_API pANTLR3_VECTOR	    antlr3VectorNew                             (ANTLR3_UINT32 sizeHint);
ANTLR3_API pANTLR3_STACK	    antlr3StackNew                              (ANTLR3_UINT32 sizeHint);
ANTLR3_API void                     antlr3SetVectorApi                          (pANTLR3_VECTOR vector, ANTLR3_UINT32 sizeHint);
ANTLR3_API ANTLR3_UCHAR		    antlr3c8toAntlrc                            (ANTLR3_INT8 inc);
ANTLR3_API pANTLR3_TOPO             antlr3TopoNew();

ANTLR3_API pANTLR3_EXCEPTION	    antlr3ExceptionNew                          (ANTLR3_UINT32 exception, void * name, void * message, ANTLR3_BOOLEAN freeMessage);


ANTLR3_API pANTLR3_INPUT_STREAM     antlr3FileStreamNew                         (pANTLR3_UINT8 fileName, ANTLR3_UINT32 encoding);
ANTLR3_API pANTLR3_INPUT_STREAM     antlr3StringStreamNew                       (pANTLR3_UINT8 data, ANTLR3_UINT32 encoding, ANTLR3_UINT32 size, pANTLR3_UINT8 name);

ANTLR3_API pANTLR3_INT_STREAM	    antlr3IntStreamNew                          (void);

ANTLR3_API pANTLR3_STRING_FACTORY   antlr3StringFactoryNew                      (ANTLR3_UINT32 encoding);

ANTLR3_API pANTLR3_COMMON_TOKEN	    antlr3CommonTokenNew                        (ANTLR3_UINT32 ttype);
ANTLR3_API pANTLR3_TOKEN_FACTORY    antlr3TokenFactoryNew                       (pANTLR3_INPUT_STREAM input);
ANTLR3_API void			    antlr3SetTokenAPI                           (pANTLR3_COMMON_TOKEN token);

ANTLR3_API pANTLR3_LEXER	    antlr3LexerNewStream                        (ANTLR3_UINT32 sizeHint, pANTLR3_INPUT_STREAM input, pANTLR3_RECOGNIZER_SHARED_STATE state);
ANTLR3_API pANTLR3_LEXER	    antlr3LexerNew                              (ANTLR3_UINT32 sizeHint, pANTLR3_RECOGNIZER_SHARED_STATE state);
ANTLR3_API pANTLR3_PARSER	    antlr3ParserNewStreamDbg                    (ANTLR3_UINT32 sizeHint, pANTLR3_TOKEN_STREAM tstream, pANTLR3_DEBUG_EVENT_LISTENER dbg, pANTLR3_RECOGNIZER_SHARED_STATE state);
ANTLR3_API pANTLR3_PARSER	    antlr3ParserNewStream                       (ANTLR3_UINT32 sizeHint, pANTLR3_TOKEN_STREAM tstream, pANTLR3_RECOGNIZER_SHARED_STATE state);
ANTLR3_API pANTLR3_PARSER           antlr3ParserNew                             (ANTLR3_UINT32 sizeHint, pANTLR3_RECOGNIZER_SHARED_STATE state);

ANTLR3_API pANTLR3_COMMON_TOKEN_STREAM  antlr3CommonTokenStreamSourceNew        (ANTLR3_UINT32 hint, pANTLR3_TOKEN_SOURCE source);
ANTLR3_API pANTLR3_COMMON_TOKEN_STREAM	antlr3CommonTokenStreamNew              (ANTLR3_UINT32 hint);
ANTLR3_API pANTLR3_COMMON_TOKEN_STREAM	antlr3CommonTokenDebugStreamSourceNew   (ANTLR3_UINT32 hint, pANTLR3_TOKEN_SOURCE source, pANTLR3_DEBUG_EVENT_LISTENER debugger);

ANTLR3_API pANTLR3_BASE_TREE_ADAPTOR	ANTLR3_TREE_ADAPTORNew                  (pANTLR3_STRING_FACTORY strFactory);
ANTLR3_API pANTLR3_BASE_TREE_ADAPTOR	ANTLR3_TREE_ADAPTORDebugNew             (pANTLR3_STRING_FACTORY strFactory, pANTLR3_DEBUG_EVENT_LISTENER	debugger);
ANTLR3_API pANTLR3_COMMON_TREE		antlr3CommonTreeNew                     (void);
ANTLR3_API pANTLR3_COMMON_TREE		antlr3CommonTreeNewFromTree             (pANTLR3_COMMON_TREE tree);
ANTLR3_API pANTLR3_COMMON_TREE		antlr3CommonTreeNewFromToken            (pANTLR3_COMMON_TOKEN tree);
ANTLR3_API pANTLR3_ARBORETUM		antlr3ArboretumNew                      (pANTLR3_STRING_FACTORY factory);
ANTLR3_API void				antlr3SetCTAPI                          (pANTLR3_COMMON_TREE tree);
ANTLR3_API pANTLR3_BASE_TREE		antlr3BaseTreeNew                       (pANTLR3_BASE_TREE tree);

ANTLR3_API void				antlr3BaseTreeAdaptorInit               (pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_DEBUG_EVENT_LISTENER debugger);

ANTLR3_API pANTLR3_TREE_PARSER		antlr3TreeParserNewStream               (ANTLR3_UINT32 sizeHint, pANTLR3_COMMON_TREE_NODE_STREAM ctnstream, pANTLR3_RECOGNIZER_SHARED_STATE state);

ANTLR3_API ANTLR3_INT32			antlr3dfaspecialTransition              (void * ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA dfa, ANTLR3_INT32 s);
ANTLR3_API ANTLR3_INT32			antlr3dfaspecialStateTransition         (void * ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA dfa, ANTLR3_INT32 s);
ANTLR3_API ANTLR3_INT32			antlr3dfapredict                        (void * ctx, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_INT_STREAM is, pANTLR3_CYCLIC_DFA cdfa);

ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM  antlr3CommonTreeNodeStreamNewTree   (pANTLR3_BASE_TREE tree, ANTLR3_UINT32 hint);
ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM  antlr3CommonTreeNodeStreamNew       (pANTLR3_STRING_FACTORY strFactory, ANTLR3_UINT32 hint);
ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM  antlr3UnbufTreeNodeStreamNewTree    (pANTLR3_BASE_TREE tree, ANTLR3_UINT32 hint);
ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM  antlr3UnbufTreeNodeStreamNew        (pANTLR3_STRING_FACTORY strFactory, ANTLR3_UINT32 hint);
ANTLR3_API pANTLR3_COMMON_TREE_NODE_STREAM  antlr3CommonTreeNodeStreamNewStream (pANTLR3_COMMON_TREE_NODE_STREAM inStream);
ANTLR3_API pANTLR3_TREE_NODE_STREAM         antlr3TreeNodeStreamNew             ();
ANTLR3_API void				    fillBufferExt                       (pANTLR3_COMMON_TOKEN_STREAM tokenStream);

ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM 
    antlr3RewriteRuleTOKENStreamNewAE	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description);
ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM 
    antlr3RewriteRuleTOKENStreamNewAEE	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement);
ANTLR3_API pANTLR3_REWRITE_RULE_TOKEN_STREAM 
    antlr3RewriteRuleTOKENStreamNewAEV	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector);

ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM 
    antlr3RewriteRuleNODEStreamNewAE	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description);
ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM 
    antlr3RewriteRuleNODEStreamNewAEE	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement);
ANTLR3_API pANTLR3_REWRITE_RULE_NODE_STREAM 
    antlr3RewriteRuleNODEStreamNewAEV	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector);

ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM 
    antlr3RewriteRuleSubtreeStreamNewAE	(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description);
ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM 
    antlr3RewriteRuleSubtreeStreamNewAEE(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, void * oneElement);
ANTLR3_API pANTLR3_REWRITE_RULE_SUBTREE_STREAM 
    antlr3RewriteRuleSubtreeStreamNewAEV(pANTLR3_BASE_TREE_ADAPTOR adaptor, pANTLR3_BASE_RECOGNIZER rec, pANTLR3_UINT8 description, pANTLR3_VECTOR vector);

ANTLR3_API pANTLR3_DEBUG_EVENT_LISTENER antlr3DebugListenerNew();

#ifdef __cplusplus
}
#endif

#endif	/* _ANTLR3DEFS_H	*/