FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
fbint.bi
Go to the documentation of this file.
1
#ifndef
__FBINT_BI__
2
#define
__FBINT_BI__
3
4
''
5
'' internal compiler definitions
6
''
7
8
#include once
"
fb.bi
"
9
10
const
FB_MINSTACKSIZE
= 32 * 1024
11
const
FB_DEFSTACKSIZE
= 1024 * 1024
12
13
const
FB_MAXINTNAMELEN
= 1 +
FB_MAXNAMELEN
+ 1 + 1 + 2
14
const
FB_MAXINTLITLEN
=
FB_MAXLITLEN
+ 32
15
16
const
FB_MAXGOTBITEMS
= 64
17
18
''
19
const
FB_INITSYMBOLNODES
= 8000
20
const
FB_INITFIELDNODES
= 16
21
const
FB_INITDEFARGNODES
= 500
22
const
FB_INITDEFTOKNODES
= 1000
23
const
FB_INITDIMNODES
= 400
24
const
FB_INITLIBNODES
= 20
25
const
FB_INITFWDREFNODES
= 500
26
const
FB_INITVARININODES
= 1000
27
const
FB_INITINCFILES
= 256
28
const
FB_INITSTMTSTACKNODES
= 128
29
30
'' DATA stmt internal format
31
enum
FB_DATASTMT_ID
32
FB_DATASTMT_ID_NULL
= &h0000
33
FB_DATASTMT_ID_WSTR
= &h8000
'' start point
34
FB_DATASTMT_ID_LINK
= &hffff
35
FB_DATASTMT_ID_OFFSET
= &hfffe
36
37
FB_DATASTMT_ID_ZSTR
= &h0001
'' used by AST only
38
FB_DATASTMT_ID_CONST
= &h0002
'' /
39
end enum
40
41
const
FB_DATASTMT_PREFIX
=
"_{fbdata}_"
42
43
44
'' print modes (same as in rtlib/fb_console.h)
45
enum
FBPRINTMASK
46
FB_PRINTMASK_NEWLINE
= &h00000001
47
FB_PRINTMASK_PAD
= &h00000002
48
FB_PRINTMASK_APPEND_SPACE
= &h00000010
49
FB_PRINTMASK_ISLAST
= &h80000000
50
end enum
51
52
'' file constants (same as in rtlib/fb_file.h)
53
enum
FBFILEMODE
54
FB_FILE_MODE_BINARY
55
FB_FILE_MODE_RANDOM
56
FB_FILE_MODE_INPUT
57
FB_FILE_MODE_OUTPUT
58
FB_FILE_MODE_APPEND
59
end enum
60
61
enum
FBFILEACCESS
62
FB_FILE_ACCESS_ANY
63
FB_FILE_ACCESS_READ
64
FB_FILE_ACCESS_WRITE
65
FB_FILE_ACCESS_READWRITE
66
end enum
67
68
enum
FBFILELOCK
69
FB_FILE_LOCK_SHARED
70
FB_FILE_LOCK_READ
71
FB_FILE_LOCK_WRITE
72
FB_FILE_LOCK_READWRITE
73
end enum
74
75
enum
FBOPENKIND
76
FB_FILE_TYPE_FILE
77
FB_FILE_TYPE_CONS
78
FB_FILE_TYPE_ERR
79
FB_FILE_TYPE_PIPE
80
FB_FILE_TYPE_SCRN
81
FB_FILE_TYPE_LPT
82
FB_FILE_TYPE_COM
83
FB_FILE_TYPE_QB
84
end enum
85
86
'' FB runtime errors (same as rtlib/fb_error.h)
87
enum
FB_RTERROR
88
FB_RTERROR_OK
= 0
89
FB_RTERROR_ILLEGALFUNCTIONCALL
90
FB_RTERROR_FILENOTFOUND
91
FB_RTERROR_FILEIO
92
FB_RTERROR_OUTOFMEM
93
FB_RTERROR_ILLEGALRESUME
94
FB_RTERROR_OUTOFBOUNDS
95
FB_RTERROR_NULLPTR
96
FB_RTERROR_NOPRIVILEDGES
97
FB_RTERROR_SIGINT
98
FB_RTERROR_SIGILL
99
FB_RTERROR_SIGFPE
100
FB_RTERROR_SIGSEGV
101
FB_RTERROR_SIGTERM
102
FB_RTERROR_SIGABRT
103
FB_RTERROR_SIGQUIT
104
FB_RTERROR_RETURNWITHOUTGOSUB
105
FB_RTERROR_ENDOFFILE
106
end enum
107
108
''
109
const
FB_MAINSCOPE
= 0
110
const
FB_MAINPROCNAME
=
"__FB_MAINPROC__"
111
const
FB_MODLEVELNAME
=
"__FB_MODLEVELPROC__"
112
const
FB_GLOBCTORNAME
=
"_GLOBAL__I"
113
const
FB_GLOBDTORNAME
=
"_GLOBAL__D"
114
115
const
FB_INSTANCEPTR
=
"THIS"
116
117
''
118
''
119
''
120
121
'' some chars
122
const
CHAR_NULL
= 00, _
123
CHAR_BELL
= 07, _
124
CHAR_BKSPC
= 08, _
125
CHAR_TAB
= 09, _
126
CHAR_LF
= 10, _
127
CHAR_VTAB
= 11, _
128
CHAR_FORMFEED
= 12, _
129
CHAR_CR
= 13, _
130
CHAR_SPACE
= 32, _
131
CHAR_0
= 48, _
132
CHAR_1
= 49, _
133
CHAR_2
= 50, _
134
CHAR_3
= 51, _
135
CHAR_4
= 52, _
136
CHAR_5
= 53, _
137
CHAR_6
= 54, _
138
CHAR_7
= 55, _
139
CHAR_8
= 56, _
140
CHAR_9
= 57, _
141
CHAR_AUPP
= 65,
CHAR_ALOW
= 97, _
142
CHAR_BUPP
= 66,
CHAR_BLOW
= 98, _
143
CHAR_CUPP
= 67,
CHAR_CLOW
= 99, _
144
CHAR_DUPP
= 68,
CHAR_DLOW
= 100, _
145
CHAR_EUPP
= 69,
CHAR_ELOW
= 101, _
146
CHAR_FUPP
= 70,
CHAR_FLOW
= 102, _
147
CHAR_GUPP
= 71,
CHAR_GLOW
= 103, _
148
CHAR_HUPP
= 72,
CHAR_HLOW
= 104, _
149
CHAR_IUPP
= 73,
CHAR_ILOW
= 105, _
150
CHAR_JUPP
= 74,
CHAR_JLOW
= 106, _
151
CHAR_KUPP
= 75,
CHAR_KLOW
= 107, _
152
CHAR_LUPP
= 76,
CHAR_LLOW
= 108, _
153
CHAR_MUPP
= 77,
CHAR_MLOW
= 109, _
154
CHAR_NUPP
= 78,
CHAR_NLOW
= 110, _
155
CHAR_OUPP
= 79,
CHAR_OLOW
= 111, _
156
CHAR_PUPP
= 80,
CHAR_PLOW
= 112, _
157
CHAR_QUPP
= 81,
CHAR_QLOW
= 113, _
158
CHAR_RUPP
= 82,
CHAR_RLOW
= 114, _
159
CHAR_SUPP
= 83,
CHAR_SLOW
= 115, _
160
CHAR_TUPP
= 84,
CHAR_TLOW
= 116, _
161
CHAR_UUPP
= 85,
CHAR_ULOW
= 117, _
162
CHAR_VUPP
= 86,
CHAR_VLOW
= 118, _
163
CHAR_WUPP
= 87,
CHAR_WLOW
= 119, _
164
CHAR_XUPP
= 88,
CHAR_XLOW
= 120, _
165
CHAR_YUPP
= 89,
CHAR_YLOW
= 121, _
166
CHAR_ZUPP
= 90,
CHAR_ZLOW
= 122, _
167
CHAR_LPRNT
= 40, _
168
CHAR_RPRNT
= 41, _
169
CHAR_COMMA
= 44, _
170
CHAR_DOT
= 46, _
171
CHAR_PLUS
= 43, _
172
CHAR_MINUS
= 45, _
173
CHAR_RSLASH
= 92, _
174
CHAR_SLASH
= 47, _
175
CHAR_CART
= 94, _
176
CHAR_EQ
= 61, _
177
CHAR_LT
= 60, _
178
CHAR_GT
= 62, _
179
CHAR_AMP
= 38, _
180
CHAR_UNDER
= 95, _
181
CHAR_EXCL
= 33, _
182
CHAR_SHARP
= 35, _
183
CHAR_DOLAR
= 36, _
184
CHAR_PERC
= 37, _
185
CHAR_QUOTE
= 34, _
186
CHAR_APOST
= 39, _
187
CHAR_TIMES
= 42, _
188
CHAR_STAR
=
CHAR_TIMES
, _
189
CHAR_COLON
= 58, _
190
CHAR_SEMICOLON
= 59, _
191
CHAR_AT
= 64, _
192
CHAR_QUESTION
= 63, _
193
CHAR_TILD
= 126, _
194
CHAR_ESC
= 27, _
195
CHAR_LBRACE
= 123, _
196
CHAR_RBRACE
= 125, _
197
CHAR_LBRACKET
= 91, _
198
CHAR_RBRACKET
= 93
199
200
201
'' assuming it won't ever be used inside lit strings
202
const
FB_INTSCAPECHAR
=
CHAR_ESC
203
204
205
'' tokens
206
enum
FB_TOKEN
207
FB_TK_EOF
= 256
208
FB_TK_EOL
209
FB_TK_STMTSEP
210
FB_TK_COMMENT
211
FB_TK_REM
212
213
FB_TK_NUMLIT
214
FB_TK_STRLIT
215
FB_TK_STRLIT_ESC
216
FB_TK_STRLIT_NOESC
217
FB_TK_ID
218
219
FB_TK_IF
220
FB_TK_THEN
221
FB_TK_ELSE
222
FB_TK_ELSEIF
223
FB_TK_SELECT
224
FB_TK_CASE
225
FB_TK_IS
226
FB_TK_WHILE
227
FB_TK_UNTIL
228
FB_TK_WEND
229
FB_TK_CONTINUE
230
FB_TK_EXIT
231
FB_TK_DO
232
FB_TK_LOOP
233
FB_TK_WITH
234
FB_TK_FOR
235
FB_TK_STEP
236
FB_TK_NEXT
237
FB_TK_TO
238
FB_TK_SCOPE
239
FB_TK_NAMESPACE
240
FB_TK_USING
241
242
FB_TK_AND
243
FB_TK_OR
244
FB_TK_ANDALSO
245
FB_TK_ORELSE
246
FB_TK_XOR
247
FB_TK_EQV
248
FB_TK_IMP
249
FB_TK_NOT
250
FB_TK_MOD
251
FB_TK_SHL
252
FB_TK_SHR
253
FB_TK_EQ
254
FB_TK_GT
255
FB_TK_LT
256
FB_TK_NE
257
FB_TK_LE
258
FB_TK_GE
259
FB_TK_DBLEQ
260
261
FB_TK_EXTERN
262
FB_TK_STATIC
263
FB_TK_DIM
264
FB_TK_VAR
265
FB_TK_REDIM
266
FB_TK_COMMON
267
FB_TK_SHARED
268
FB_TK_PRESERVE
269
270
FB_TK_ENDIF
271
FB_TK_DEFINED
272
273
FB_TK_INCLUDE
274
FB_TK_DYNAMIC
275
276
FB_TK_EXPLICIT
277
FB_TK_BYVAL
278
FB_TK_BYREF
279
280
FB_TK_DEFBYTE
281
FB_TK_DEFUBYTE
282
FB_TK_DEFSHORT
283
FB_TK_DEFUSHORT
284
FB_TK_DEFINT
285
FB_TK_DEFUINT
286
FB_TK_DEFLNG
287
FB_TK_DEFULNG
288
FB_TK_DEFLNGINT
289
FB_TK_DEFULNGINT
290
FB_TK_DEFSNG
291
FB_TK_DEFDBL
292
FB_TK_DEFSTR
293
294
FB_TK_DECLARE
295
FB_TK_CONST
296
FB_TK_TYPE
297
FB_TK_UNION
298
FB_TK_ENUM
299
FB_TK_CLASS
300
FB_TK_END
301
FB_TK_EXPORT
302
FB_TK_IMPORT
303
FB_TK_OPTION
304
FB_TK_ASM
305
FB_TK_SUB
306
FB_TK_FUNCTION
307
FB_TK_CONSTRUCTOR
308
FB_TK_DESTRUCTOR
309
FB_TK_OPERATOR
310
FB_TK_PROPERTY
311
FB_TK_EXTENDS
312
FB_TK_IMPLEMENTS
313
FB_TK_BASE
314
FB_TK_VIRTUAL
315
FB_TK_ABSTRACT
316
317
FB_TK_BYTE
318
FB_TK_UBYTE
319
FB_TK_SHORT
320
FB_TK_USHORT
321
FB_TK_INTEGER
322
FB_TK_UINT
323
FB_TK_LONG
324
FB_TK_ULONG
325
FB_TK_LONGINT
326
FB_TK_ULONGINT
327
FB_TK_SINGLE
328
FB_TK_DOUBLE
329
FB_TK_STRING
330
FB_TK_ZSTRING
331
FB_TK_WSTRING
332
FB_TK_ANY
333
FB_TK_PTR
334
FB_TK_POINTER
335
FB_TK_UNSIGNED
336
FB_TK_AS
337
338
FB_TK_TYPEOF
339
340
FB_TK_PUBLIC
341
FB_TK_PRIVATE
342
FB_TK_PROTECTED
343
FB_TK_PASCAL
344
FB_TK_CDECL
345
FB_TK_STDCALL
346
FB_TK_ALIAS
347
FB_TK_LIB
348
FB_TK_OVERLOAD
349
FB_TK_NEW
350
FB_TK_DELETE
351
352
FB_TK_LET
353
FB_TK_RETURN
354
FB_TK_GOTO
355
FB_TK_GOSUB
356
357
FB_TK_CALL
358
359
FB_TK_VARPTR
360
FB_TK_STRPTR
361
FB_TK_PROCPTR
362
FB_TK_SADD
363
364
FB_TK_FIELDDEREF
365
FB_TK_CBYTE
366
FB_TK_CUBYTE
367
FB_TK_CSHORT
368
FB_TK_CUSHORT
369
FB_TK_CINT
370
FB_TK_CUINT
371
FB_TK_CLNG
372
FB_TK_CULNG
373
FB_TK_CLNGINT
374
FB_TK_CULNGINT
375
FB_TK_CSNG
376
FB_TK_CDBL
377
FB_TK_CSIGN
378
FB_TK_CUNSG
379
FB_TK_CPTR
380
FB_TK_CAST
381
382
FB_TK_LSET
383
FB_TK_RSET
384
FB_TK_ASC
385
FB_TK_CHR
386
FB_TK_WCHR
387
FB_TK_STR
388
FB_TK_CVD
389
FB_TK_CVS
390
FB_TK_CVI
391
FB_TK_CVL
392
FB_TK_CVSHORT
393
FB_TK_CVLONGINT
394
FB_TK_MKD
395
FB_TK_MKS
396
FB_TK_MKI
397
FB_TK_MKL
398
FB_TK_MKSHORT
399
FB_TK_MKLONGINT
400
FB_TK_WSTR
401
FB_TK_MID
402
FB_TK_INSTR
403
FB_TK_INSTRREV
404
FB_TK_TRIM
405
FB_TK_RTRIM
406
FB_TK_LTRIM
407
FB_TK_LCASE
408
FB_TK_UCASE
409
FB_TK_RESTORE
410
FB_TK_READ
411
FB_TK_DATA
412
FB_TK_ABS
413
FB_TK_SGN
414
FB_TK_FIX
415
FB_TK_FRAC
416
FB_TK_SIN
417
FB_TK_ASIN
418
FB_TK_COS
419
FB_TK_ACOS
420
FB_TK_TAN
421
FB_TK_ATN
422
FB_TK_SQR
423
FB_TK_LOG
424
FB_TK_EXP
425
FB_TK_INT
426
FB_TK_ATAN2
427
FB_TK_PRINT
428
FB_TK_LPRINT
429
FB_TK_LEN
430
FB_TK_SIZEOF
431
FB_TK_PEEK
432
FB_TK_POKE
433
FB_TK_SWAP
434
FB_TK_OPEN
435
FB_TK_CLOSE
436
FB_TK_SEEK
437
FB_TK_PUT
438
FB_TK_GET
439
FB_TK_ACCESS
440
FB_TK_WRITE
441
FB_TK_LOCK
442
FB_TK_INPUT
443
FB_TK_WINPUT
444
FB_TK_OUTPUT
445
FB_TK_BINARY
446
FB_TK_RANDOM
447
FB_TK_APPEND
448
FB_TK_ENCODING
449
FB_TK_NAME
450
FB_TK_SPC
451
FB_TK_TAB
452
FB_TK_LINE
453
FB_TK_VIEW
454
FB_TK_UNLOCK
455
FB_TK_WIDTH
456
FB_TK_COLOR
457
FB_TK_FIELD
458
FB_TK_ERASE
459
FB_TK_LBOUND
460
FB_TK_UBOUND
461
FB_TK_VA_FIRST
462
463
FB_TK_ON
464
FB_TK_ERROR
465
FB_TK_LOCAL
466
FB_TK_ERR
467
FB_TK_RESUME
468
FB_TK_IIF
469
470
FB_TK_PSET
471
FB_TK_PRESET
472
FB_TK_POINT
473
FB_TK_CIRCLE
474
FB_TK_WINDOW
475
FB_TK_PALETTE
476
FB_TK_SCREEN
477
FB_TK_SCREENQB
478
FB_TK_PAINT
479
FB_TK_DRAW
480
FB_TK_IMAGECREATE
481
482
FB_TK_THREADCALL
483
484
FB_TOKENS
=
FB_TK_THREADCALL
-
FB_TK_EOF
485
end enum
486
487
'' single char tokens
488
const
FB_TK_DIRECTIVECHAR
=
CHAR_DOLAR
'' $
489
const
FB_TK_DECLSEPCHAR
=
CHAR_COMMA
'' ,
490
const
FB_TK_ASSIGN
=
FB_TK_EQ
'' special case, because lex
491
const
FB_TK_DEREFCHAR
=
CHAR_STAR
'' *
492
const
FB_TK_ADDROFCHAR
=
CHAR_AT
'' @
493
494
const
FB_TK_INTTYPECHAR
=
CHAR_PERC
495
const
FB_TK_LNGTYPECHAR
=
CHAR_AMP
496
const
FB_TK_SGNTYPECHAR
=
CHAR_EXCL
497
const
FB_TK_DBLTYPECHAR
=
CHAR_SHARP
498
const
FB_TK_STRTYPECHAR
=
CHAR_DOLAR
499
500
501
'' token classes
502
enum
FB_TKCLASS
503
FB_TKCLASS_IDENTIFIER
504
FB_TKCLASS_KEYWORD
505
FB_TKCLASS_QUIRKWD
506
FB_TKCLASS_NUMLITERAL
507
FB_TKCLASS_STRLITERAL
508
FB_TKCLASS_OPERATOR
509
FB_TKCLASS_DELIMITER
510
FB_TKCLASS_UNKNOWN
511
end enum
512
513
#include once
"
hash.bi
"
514
#include once
"
stack.bi
"
515
#include once
"
symb.bi
"
516
517
''
518
enum
FBFILE_FORMAT
519
FBFILE_FORMAT_ASCII
520
FBFILE_FORMAT_UTF8
521
FBFILE_FORMAT_UTF16LE
522
FBFILE_FORMAT_UTF16BE
523
FBFILE_FORMAT_UTF32LE
524
FBFILE_FORMAT_UTF32BE
525
end enum
526
527
type
FBFILE
528
num
as integer
529
name
as zstring
* FB_MAXPATHLEN+1
530
incfile
as zstring ptr
531
ismain
as integer
532
format
as
FBFILE_FORMAT
533
end type
534
535
enum
FB_TARGETOPT
536
FB_TARGETOPT_UNIX
= &h00000001
'' Unix-like system? (for __FB_UNIX__ #define)
537
FB_TARGETOPT_UNDERSCORE
= &h00000002
'' Underscore prefix for symbols?
538
FB_TARGETOPT_EXPORT
= &h00000004
'' Support for exporting symbols from DLLs?
539
540
'' Whether callee always pops the hidden struct result ptr
541
'' i386 SysV ABI (MinGW GCC 4.6, Linux, DJGPP, etc.):
542
'' callee always pops hidden param, even for cdecl ("hybrid")
543
'' MinGW GCC 4.7, MSVC ABI:
544
'' hidden param is popped according to calling convention
545
FB_TARGETOPT_CALLEEPOPSHIDDENPTR
= &h00000008
546
547
'' Returning structures in registers only exists on Win32, and
548
'' - neither Linux GCC (following the i386 SysV ABI),
549
'' - nor DJGPP
550
'' do it. TODO: what about the BSDs and Darwin/MacOSX?
551
FB_TARGETOPT_RETURNINREGS
= &h00000010
552
end enum
553
554
type
FBTARGET
555
id
as zstring ptr
556
size_t32
as
FB_DATATYPE
'' 32bit size_t type
557
size_t64
as
FB_DATATYPE
'' 64bit size_t type
558
wchar
as
FB_DATATYPE
'' Real wstring data type
559
fbcall
as
FB_FUNCMODE
'' Default calling convention, must match the rtlib's FBCALL
560
stdcall
as
FB_FUNCMODE
'' Calling convention to use for stdcall (stdcall or stdcallms)
561
options
as
FB_TARGETOPT
562
end type
563
564
type
FBOPTION
565
base
as integer
'' default= 0
566
parammode
as integer
'' def = byref
567
explicit
as integer
'' def = false
568
procpublic
as integer
'' def = true
569
escapestr
as integer
'' def = false
570
dynamic
as integer
'' def = false
571
gosub
as integer
'' def = true in FB_LANG_QB, false in all other dialects
572
end type
573
574
type
FBMAIN
575
proc
as
FBSYMBOL
ptr
576
initnode
as
ASTNODE
ptr
577
end type
578
579
type
FB_LANG_CTX
580
opt
as
FB_LANG_OPT
'' language supported features
581
integerkeyworddtype
as
FB_DATATYPE
'' dtype produced by INTEGER (and related) keywords
582
int15literaldtype
as
FB_DATATYPE
'' default dtype for integer number literals that fit into 15 bits
583
int16literaldtype
as
FB_DATATYPE
'' etc.
584
int31literaldtype
as
FB_DATATYPE
585
int32literaldtype
as
FB_DATATYPE
586
floatliteraldtype
as
FB_DATATYPE
'' default dtype for float number literals
587
end type
588
589
type
FBENV
590
'' Global fb interface data
591
predefines
as
TLIST
592
preincludes
as
TLIST
593
includepaths
as
TLIST
594
595
clopt
as
FBCMMLINEOPT
'' cmm-line options
596
target
as
FBTARGET
'' target specific
597
wchar_doconv
as integer
'' ok to convert literals at compile-time?
598
599
pointersize
as integer
600
601
'' Parse-specific things
602
603
inf
as
FBFILE
'' source file
604
outf
as
FBFILE
'' destine file
605
606
ppfile_num
as integer
'' -pp output file
607
608
'' include files
609
incfilehash
as
THASH
610
inconcehash
as
THASH
611
includerec
as integer
'' >0 if parsing an include file
612
613
main
as
FBMAIN
614
615
lang
as
FB_LANG_CTX
'' language supported features
616
617
opt
as
FBOPTION
'' context-sensitive options
618
619
restarts
as integer
'' number of parser restarts
620
dorestart
as integer
'' request parser restart
621
622
'' Lists to collect #inclibs and #libpaths
623
libs
as
TSTRSET
624
libpaths
as
TSTRSET
625
626
fbctinf_started
as integer
627
end type
628
629
#include once
"
hlp.bi
"
630
631
declare function
fbGetInputFileParentDir
( )
as string
632
declare sub
fbAddLib
(
byval
libname
as zstring ptr
)
633
declare sub
fbAddLibPath
(
byval
path
as zstring ptr
)
634
635
''
636
'' super globals
637
''
638
common
shared
as
FBENV
env
639
640
#endif
''__FBINT_BI__
641
compiler
fbint.bi
Generated on Thu Jan 23 2014 19:39:26 for FreeBASIC by
1.8.4