~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/compiler/scandir.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    Copyright (c) 1998-2002 by Peter Vreman
 
3
 
 
4
    This unit implements directive parsing for the scanner
 
5
 
 
6
    This program is free software; you can redistribute it and/or modify
 
7
    it under the terms of the GNU General Public License as published by
 
8
    the Free Software Foundation; either version 2 of the License, or
 
9
    (at your option) any later version.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
    GNU General Public License for more details.
 
15
 
 
16
    You should have received a copy of the GNU General Public License
 
17
    along with this program; if not, write to the Free Software
 
18
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
19
 
 
20
 ****************************************************************************
 
21
}
 
22
unit scandir;
 
23
 
 
24
{$i fpcdefs.inc}
 
25
 
 
26
interface
 
27
 
 
28
 
 
29
    procedure InitScannerDirectives;
 
30
 
 
31
implementation
 
32
 
 
33
    uses
 
34
      SysUtils,
 
35
      cutils,cfileutils,
 
36
      globtype,globals,systems,widestr,cpuinfo,
 
37
      verbose,comphook,ppu,
 
38
      scanner,switches,
 
39
      fmodule,
 
40
      symconst,symtable,
 
41
      rabase;
 
42
 
 
43
    const
 
44
      localswitchesstackmax = 20;
 
45
 
 
46
    var
 
47
      localswitchesstack: array[0..localswitchesstackmax] of tlocalswitches;
 
48
      localswitchesstackpos: Integer;
 
49
 
 
50
{*****************************************************************************
 
51
                                    Helpers
 
52
*****************************************************************************}
 
53
 
 
54
    procedure do_delphiswitch(sw:char);
 
55
      var
 
56
        state : char;
 
57
      begin
 
58
      { c contains the next char, a + or - would be fine }
 
59
        state:=current_scanner.readstate;
 
60
        if state in ['-','+'] then
 
61
          HandleSwitch(sw,state);
 
62
      end;
 
63
 
 
64
 
 
65
    procedure do_setverbose(flag:char);
 
66
      var
 
67
        state : char;
 
68
      begin
 
69
      { support ON/OFF }
 
70
        state:=current_scanner.ReadState;
 
71
        SetVerbosity(flag+state);
 
72
      end;
 
73
 
 
74
 
 
75
    procedure do_moduleswitch(sw:tmoduleswitch);
 
76
      var
 
77
        state : char;
 
78
      begin
 
79
        state:=current_scanner.readstate;
 
80
        if (sw<>cs_modulenone) and (state in ['-','+']) then
 
81
         begin
 
82
           if state='-' then
 
83
            exclude(current_settings.moduleswitches,sw)
 
84
           else
 
85
            include(current_settings.moduleswitches,sw);
 
86
         end;
 
87
      end;
 
88
 
 
89
 
 
90
    procedure do_localswitch(sw:tlocalswitch);
 
91
      var
 
92
        state : char;
 
93
      begin
 
94
        state:=current_scanner.readstate;
 
95
        if (sw<>cs_localnone) and (state in ['-','+']) then
 
96
         begin
 
97
           if not localswitcheschanged then
 
98
             nextlocalswitches:=current_settings.localswitches;
 
99
           if state='-' then
 
100
            exclude(nextlocalswitches,sw)
 
101
           else
 
102
            include(nextlocalswitches,sw);
 
103
           localswitcheschanged:=true;
 
104
         end;
 
105
      end;
 
106
 
 
107
    procedure do_localswitchdefault(sw:tlocalswitch);
 
108
      var
 
109
        state : char;
 
110
      begin
 
111
        state:=current_scanner.readstatedefault;
 
112
        if (sw<>cs_localnone) and (state in ['-','+','*']) then
 
113
         begin
 
114
           if not localswitcheschanged then
 
115
             nextlocalswitches:=current_settings.localswitches;
 
116
           if state='-' then
 
117
            exclude(nextlocalswitches,sw)
 
118
           else
 
119
            if state='+' then
 
120
             include(nextlocalswitches,sw)
 
121
            else
 
122
             begin
 
123
              if sw in init_settings.localswitches then
 
124
               include(nextlocalswitches,sw)
 
125
              else
 
126
               exclude(nextlocalswitches,sw);
 
127
             end;
 
128
           localswitcheschanged:=true;
 
129
         end;
 
130
      end;
 
131
 
 
132
 
 
133
    procedure do_message(w:integer);
 
134
      begin
 
135
        current_scanner.skipspace;
 
136
        Message1(w,current_scanner.readcomment);
 
137
      end;
 
138
 
 
139
{*****************************************************************************
 
140
                              Directive Callbacks
 
141
*****************************************************************************}
 
142
 
 
143
    procedure dir_align;
 
144
      var
 
145
        hs : string;
 
146
      begin
 
147
        current_scanner.skipspace;
 
148
        if not(c in ['0'..'9']) then
 
149
         begin
 
150
           { Support also the ON and OFF as switch }
 
151
           hs:=current_scanner.readid;
 
152
           if (hs='ON') then
 
153
            current_settings.packrecords:=4
 
154
           else if (hs='OFF') then
 
155
             current_settings.packrecords:=1
 
156
           else if m_mac in current_settings.modeswitches then
 
157
             begin
 
158
               { Support switches used in Apples Universal Interfaces}
 
159
               if (hs='MAC68K') then
 
160
                 current_settings.packrecords:=2
 
161
               else if (hs='POWER') then
 
162
                 current_settings.packrecords:=4
 
163
               else if (hs='RESET') then
 
164
                 current_settings.packrecords:=0
 
165
               else
 
166
                 Message1(scan_e_illegal_pack_records,hs);
 
167
             end
 
168
           else
 
169
             Message1(scan_e_illegal_pack_records,hs);
 
170
         end
 
171
        else
 
172
         begin
 
173
           case current_scanner.readval of
 
174
             1 : current_settings.packrecords:=1;
 
175
             2 : current_settings.packrecords:=2;
 
176
             4 : current_settings.packrecords:=4;
 
177
             8 : current_settings.packrecords:=8;
 
178
            16 : current_settings.packrecords:=16;
 
179
            32 : current_settings.packrecords:=32;
 
180
           else
 
181
            Message1(scan_e_illegal_pack_records,hs);
 
182
           end;
 
183
         end;
 
184
      end;
 
185
 
 
186
    procedure dir_a1;
 
187
      begin
 
188
        current_settings.packrecords:=1;
 
189
      end;
 
190
 
 
191
    procedure dir_a2;
 
192
      begin
 
193
        current_settings.packrecords:=2;
 
194
      end;
 
195
 
 
196
    procedure dir_a4;
 
197
      begin
 
198
        current_settings.packrecords:=4;
 
199
      end;
 
200
 
 
201
    procedure dir_a8;
 
202
      begin
 
203
        current_settings.packrecords:=8;
 
204
      end;
 
205
 
 
206
    procedure dir_asmmode;
 
207
      var
 
208
        s : string;
 
209
      begin
 
210
        current_scanner.skipspace;
 
211
        s:=current_scanner.readid;
 
212
        If Inside_asm_statement then
 
213
          Message1(scan_w_no_asm_reader_switch_inside_asm,s);
 
214
        if s='DEFAULT' then
 
215
         current_settings.asmmode:=init_settings.asmmode
 
216
        else
 
217
         if not SetAsmReadMode(s,current_settings.asmmode) then
 
218
           Message1(scan_e_illegal_asmmode_specifier,s);
 
219
      end;
 
220
 
 
221
{$if defined(m68k) or defined(arm)}
 
222
    procedure dir_appid;
 
223
      begin
 
224
        if target_info.system<>system_m68k_palmos then
 
225
          Message(scan_w_appid_not_support);
 
226
        { change description global var in all cases }
 
227
        { it not used but in win32 and os2 }
 
228
        current_scanner.skipspace;
 
229
        palmos_applicationid:=current_scanner.readcomment;
 
230
      end;
 
231
 
 
232
    procedure dir_appname;
 
233
      begin
 
234
        if target_info.system<>system_m68k_palmos then
 
235
          Message(scan_w_appname_not_support);
 
236
        { change description global var in all cases }
 
237
        { it not used but in win32 and os2 }
 
238
        current_scanner.skipspace;
 
239
        palmos_applicationname:=current_scanner.readcomment;
 
240
      end;
 
241
{$endif defined(m68k) or defined(arm)}
 
242
 
 
243
    procedure dir_apptype;
 
244
      var
 
245
         hs : string;
 
246
      begin
 
247
        if not (target_info.system in system_all_windows + [system_i386_os2,
 
248
                                       system_i386_emx, system_powerpc_macos,
 
249
                                       system_arm_nds]) then
 
250
          begin
 
251
            if m_delphi in current_settings.modeswitches then
 
252
              Message(scan_n_app_type_not_support)
 
253
            else
 
254
              Message(scan_w_app_type_not_support);
 
255
          end
 
256
        else
 
257
          begin
 
258
            if not current_module.in_global then
 
259
              Message(scan_w_switch_is_global)
 
260
            else
 
261
              begin
 
262
                 current_scanner.skipspace;
 
263
                 hs:=current_scanner.readid;
 
264
                 if hs='GUI' then
 
265
                   apptype:=app_gui
 
266
                 else if hs='CONSOLE' then
 
267
                   apptype:=app_cui
 
268
                 else if (hs='NATIVE') and (target_info.system in system_windows) then
 
269
                   apptype:=app_native
 
270
                 else if (hs='FS') and (target_info.system in [system_i386_os2,
 
271
                                                             system_i386_emx]) then
 
272
                   apptype:=app_fs
 
273
                 else if (hs='TOOL') and (target_info.system in [system_powerpc_macos]) then
 
274
                   apptype:=app_tool
 
275
                 else if (hs='ARM9') and (target_info.system in [system_arm_nds]) then
 
276
                   apptype:=app_arm9
 
277
                 else if (hs='ARM7') and (target_info.system in [system_arm_nds]) then
 
278
                   apptype:=app_arm7
 
279
                 else
 
280
                   Message1(scan_w_unsupported_app_type,hs);
 
281
              end;
 
282
          end;
 
283
      end;
 
284
 
 
285
 
 
286
    procedure dir_calling;
 
287
      var
 
288
         hs : string;
 
289
      begin
 
290
        current_scanner.skipspace;
 
291
        hs:=current_scanner.readid;
 
292
        if not SetAktProcCall(hs,current_settings.defproccall) then
 
293
          begin
 
294
            if (hs <> '') then
 
295
              Message1(parser_w_unknown_proc_directive_ignored,hs)
 
296
            else
 
297
              Message(parser_e_proc_directive_expected);
 
298
          end;
 
299
      end;
 
300
 
 
301
 
 
302
    procedure dir_checkpointer;
 
303
      begin
 
304
        do_localswitchdefault(cs_checkpointer);
 
305
      end;
 
306
 
 
307
 
 
308
    procedure dir_objectchecks;
 
309
      begin
 
310
        do_localswitch(cs_check_object);
 
311
      end;
 
312
 
 
313
 
 
314
    procedure dir_assertions;
 
315
      begin
 
316
        do_delphiswitch('C');
 
317
      end;
 
318
 
 
319
    procedure dir_booleval;
 
320
      begin
 
321
        do_delphiswitch('B');
 
322
      end;
 
323
 
 
324
    procedure dir_debuginfo;
 
325
      begin
 
326
        do_delphiswitch('D');
 
327
      end;
 
328
 
 
329
    procedure dir_description;
 
330
      begin
 
331
        if not (target_info.system in [system_i386_os2,system_i386_emx,
 
332
                 system_i386_win32,system_i386_netware,system_i386_wdosx,system_i386_netwlibc]) then
 
333
          Message(scan_w_description_not_support);
 
334
        { change description global var in all cases }
 
335
        { it not used but in win32, os2 and netware }
 
336
        current_scanner.skipspace;
 
337
        description:=current_scanner.readcomment;
 
338
        DescriptionSetExplicity:=true;
 
339
      end;
 
340
 
 
341
    procedure dir_screenname; {ad}
 
342
      begin
 
343
        if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
 
344
          {Message(scan_w_decription_not_support);}
 
345
          comment (V_Warning,'Screenname only supported for target netware');
 
346
        current_scanner.skipspace;
 
347
        nwscreenname:=current_scanner.readcomment;
 
348
      end;
 
349
 
 
350
      procedure dir_threadname; {ad}
 
351
      begin
 
352
        if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
 
353
          {Message(scan_w_decription_not_support);}
 
354
          comment (V_Warning,'Threadname only supported for target netware');
 
355
        current_scanner.skipspace;
 
356
        nwthreadname:=current_scanner.readcomment;
 
357
      end;
 
358
 
 
359
      procedure dir_copyright; {ad}
 
360
      begin
 
361
        if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
 
362
          {Message(scan_w_decription_not_support);}
 
363
          comment (V_Warning,'Copyright only supported for target netware');
 
364
        current_scanner.skipspace;
 
365
        nwcopyright:=current_scanner.readcomment;
 
366
      end;
 
367
 
 
368
    procedure dir_error;
 
369
      begin
 
370
        do_message(scan_e_user_defined);
 
371
      end;
 
372
 
 
373
    procedure dir_extendedsyntax;
 
374
      begin
 
375
        do_delphiswitch('X');
 
376
      end;
 
377
 
 
378
    procedure dir_fatal;
 
379
      begin
 
380
        do_message(scan_f_user_defined);
 
381
      end;
 
382
 
 
383
    procedure dir_fputype;
 
384
      begin
 
385
        current_scanner.skipspace;
 
386
        undef_system_macro('FPU'+fputypestr[current_settings.fputype]);
 
387
        if not(SetFPUType(upper(current_scanner.readcomment),current_settings.fputype)) then
 
388
          comment(V_Error,'Illegal FPU type');
 
389
        def_system_macro('FPU'+fputypestr[current_settings.fputype]);
 
390
     end;
 
391
 
 
392
    procedure dir_goto;
 
393
      begin
 
394
        do_moduleswitch(cs_support_goto);
 
395
      end;
 
396
 
 
397
    procedure dir_hint;
 
398
      begin
 
399
        do_message(scan_h_user_defined);
 
400
      end;
 
401
 
 
402
    procedure dir_hints;
 
403
      begin
 
404
        do_setverbose('H');
 
405
      end;
 
406
 
 
407
    procedure dir_imagebase;
 
408
      begin
 
409
        if not (target_info.system in (system_windows+system_wince)) then
 
410
          Message(scan_w_imagebase_not_support);
 
411
        current_scanner.skipspace;
 
412
        imagebase:=current_scanner.readval;
 
413
        ImageBaseSetExplicity:=true
 
414
      end;
 
415
 
 
416
    procedure dir_implicitexceptions;
 
417
      begin
 
418
        do_moduleswitch(cs_implicit_exceptions);
 
419
      end;
 
420
 
 
421
    procedure dir_includepath;
 
422
      begin
 
423
        if not current_module.in_global then
 
424
         Message(scan_w_switch_is_global)
 
425
        else
 
426
          begin
 
427
            current_scanner.skipspace;
 
428
            current_module.localincludesearchpath.AddPath(current_scanner.readcomment,false);
 
429
          end;
 
430
      end;
 
431
 
 
432
    procedure dir_info;
 
433
      begin
 
434
        do_message(scan_i_user_defined);
 
435
      end;
 
436
 
 
437
    procedure dir_inline;
 
438
      begin
 
439
        do_localswitch(cs_do_inline);
 
440
      end;
 
441
 
 
442
    procedure dir_interfaces;
 
443
      var
 
444
        hs : string;
 
445
      begin
 
446
        {corba/com/default}
 
447
        current_scanner.skipspace;
 
448
        hs:=current_scanner.readid;
 
449
        if (hs='CORBA') then
 
450
          current_settings.interfacetype:=it_interfacecorba
 
451
        else if (hs='COM') then
 
452
          current_settings.interfacetype:=it_interfacecom
 
453
        else if (hs='DEFAULT') then
 
454
          current_settings.interfacetype:=init_settings.interfacetype
 
455
        else
 
456
          Message(scan_e_invalid_interface_type);
 
457
      end;
 
458
 
 
459
    procedure dir_iochecks;
 
460
      begin
 
461
        do_delphiswitch('I');
 
462
      end;
 
463
 
 
464
    procedure dir_libexport;
 
465
      begin
 
466
        {not implemented}
 
467
      end;
 
468
 
 
469
    procedure dir_librarypath;
 
470
      begin
 
471
        if not current_module.in_global then
 
472
         Message(scan_w_switch_is_global)
 
473
        else
 
474
          begin
 
475
            current_scanner.skipspace;
 
476
            current_module.locallibrarysearchpath.AddPath(current_scanner.readcomment,false);
 
477
          end;
 
478
      end;
 
479
 
 
480
    procedure dir_link;
 
481
      var
 
482
        s : string;
 
483
      begin
 
484
        current_scanner.skipspace;
 
485
        if scanner.c = '''' then
 
486
          begin
 
487
            s:= current_scanner.readquotedstring;
 
488
            current_scanner.readcomment
 
489
          end
 
490
        else
 
491
          s:= trimspace(current_scanner.readcomment);
 
492
        s:=FixFileName(s);
 
493
        if ExtractFileExt(s)='' then
 
494
          s:=ChangeFileExt(s,target_info.objext);
 
495
        current_module.linkotherofiles.add(s,link_always);
 
496
      end;
 
497
 
 
498
    procedure dir_linklib;
 
499
      type
 
500
        tLinkMode=(lm_shared,lm_static);
 
501
      var
 
502
        s : string;
 
503
        quote : char;
 
504
        libext,
 
505
        libname,
 
506
        linkmodestr : string;
 
507
        p : longint;
 
508
        linkMode : tLinkMode;
 
509
      begin
 
510
        current_scanner.skipspace;
 
511
        if scanner.c = '''' then
 
512
          begin
 
513
            libname:= current_scanner.readquotedstring;
 
514
            s:= current_scanner.readcomment;
 
515
            p:=pos(',',s);
 
516
          end
 
517
        else
 
518
          begin
 
519
            s:= current_scanner.readcomment;
 
520
            p:=pos(',',s);
 
521
            if p=0 then
 
522
              libname:=TrimSpace(s)
 
523
            else
 
524
              libname:=TrimSpace(copy(s,1,p-1));
 
525
          end;
 
526
        if p=0 then
 
527
          linkmodeStr:=''
 
528
        else
 
529
          linkmodeStr:=Upper(TrimSpace(copy(s,p+1,255)));
 
530
 
 
531
 
 
532
        if (libname='') or (libname='''''') or (libname='""') then
 
533
         exit;
 
534
        { create library name }
 
535
        if libname[1] in ['''','"'] then
 
536
         begin
 
537
           quote:=libname[1];
 
538
           Delete(libname,1,1);
 
539
           p:=pos(quote,libname);
 
540
           if p>0 then
 
541
            Delete(libname,p,1);
 
542
         end;
 
543
        libname:=FixFileName(libname);
 
544
 
 
545
        { get linkmode, default is to check the extension for
 
546
          the static library, otherwise shared linking is assumed }
 
547
        linkmode:=lm_shared;
 
548
        if linkModeStr='' then
 
549
         begin
 
550
           libext:=ExtractFileExt(libname);
 
551
           if libext=target_info.staticClibext then
 
552
             linkMode:=lm_static;
 
553
         end
 
554
        else if linkModeStr='STATIC' then
 
555
         linkmode:=lm_static
 
556
        else if (LinkModeStr='SHARED') or (LinkModeStr='') then
 
557
         linkmode:=lm_shared
 
558
        else
 
559
         Comment(V_Error,'Wrong link mode specified: "'+Linkmodestr+'"');
 
560
 
 
561
        { add to the list of other libraries }
 
562
        if linkMode=lm_static then
 
563
         current_module.linkOtherStaticLibs.add(libname,link_always)
 
564
        else
 
565
         current_module.linkOtherSharedLibs.add(libname,link_always);
 
566
      end;
 
567
 
 
568
    procedure dir_localsymbols;
 
569
      begin
 
570
        do_delphiswitch('L');
 
571
      end;
 
572
 
 
573
    procedure dir_longstrings;
 
574
      begin
 
575
        do_delphiswitch('H');
 
576
      end;
 
577
 
 
578
    procedure dir_macro;
 
579
      begin
 
580
        do_moduleswitch(cs_support_macro);
 
581
      end;
 
582
 
 
583
    procedure dir_maxfpuregisters;
 
584
      var
 
585
         l  : integer;
 
586
         hs : string;
 
587
      begin
 
588
         current_scanner.skipspace;
 
589
         if not(c in ['0'..'9']) then
 
590
           begin
 
591
              hs:=current_scanner.readid;
 
592
              if (hs='NORMAL') or (hs='DEFAULT') then
 
593
                current_settings.maxfpuregisters:=-1
 
594
              else
 
595
                Message(scan_e_invalid_maxfpureg_value);
 
596
           end
 
597
         else
 
598
           begin
 
599
              l:=current_scanner.readval;
 
600
              case l of
 
601
                 0..8:
 
602
                   current_settings.maxfpuregisters:=l;
 
603
                 else
 
604
                   Message(scan_e_invalid_maxfpureg_value);
 
605
              end;
 
606
           end;
 
607
      end;
 
608
 
 
609
    procedure dir_maxstacksize;
 
610
      begin
 
611
        if not (target_info.system in (system_windows+system_wince)) then
 
612
          Message(scan_w_maxstacksize_not_support);
 
613
        current_scanner.skipspace;
 
614
        maxstacksize:=current_scanner.readval;
 
615
        MaxStackSizeSetExplicity:=true;
 
616
      end;
 
617
 
 
618
    procedure dir_memory;
 
619
      var
 
620
        l : longint;
 
621
      begin
 
622
        current_scanner.skipspace;
 
623
        l:=current_scanner.readval;
 
624
        if l>1024 then
 
625
          stacksize:=l;
 
626
        if c=',' then
 
627
          begin
 
628
            current_scanner.readchar;
 
629
            current_scanner.skipspace;
 
630
            l:=current_scanner.readval;
 
631
            if l>1024 then
 
632
              heapsize:=l;
 
633
          end;
 
634
      end;
 
635
 
 
636
 
 
637
    procedure dir_message;
 
638
      var
 
639
        hs : string;
 
640
        w  : longint;
 
641
      begin
 
642
        w:=0;
 
643
        current_scanner.skipspace;
 
644
        { Message level specified? }
 
645
        if c='''' then
 
646
          w:=scan_n_user_defined
 
647
        else
 
648
          begin
 
649
            hs:=current_scanner.readid;
 
650
            if (hs='WARN') or (hs='WARNING') then
 
651
              w:=scan_w_user_defined
 
652
            else
 
653
              if (hs='ERROR') then
 
654
                w:=scan_e_user_defined
 
655
            else
 
656
              if (hs='FATAL') then
 
657
                w:=scan_f_user_defined
 
658
            else
 
659
              if (hs='HINT') then
 
660
                w:=scan_h_user_defined
 
661
            else
 
662
              if (hs='NOTE') then
 
663
                w:=scan_n_user_defined
 
664
            else
 
665
              Message1(scan_w_illegal_directive,hs);
 
666
          end;
 
667
        { Only print message when there was no error }
 
668
        if w<>0 then
 
669
          begin
 
670
            current_scanner.skipspace;
 
671
            if c='''' then
 
672
              hs:=current_scanner.readquotedstring
 
673
            else
 
674
              hs:=current_scanner.readcomment;
 
675
            Message1(w,hs);
 
676
          end
 
677
        else
 
678
          current_scanner.readcomment;
 
679
      end;
 
680
 
 
681
 
 
682
    procedure dir_minstacksize;
 
683
      begin
 
684
        if not (target_info.system in (system_windows+system_wince)) then
 
685
          Message(scan_w_minstacksize_not_support);
 
686
        current_scanner.skipspace;
 
687
        minstacksize:=current_scanner.readval;
 
688
        MinStackSizeSetExplicity:=true;
 
689
      end;
 
690
 
 
691
 
 
692
    procedure dir_mode;
 
693
 
 
694
    begin
 
695
      if not current_module.in_global then
 
696
        Message(scan_w_switch_is_global)
 
697
      else
 
698
        begin
 
699
          current_scanner.skipspace;
 
700
          current_scanner.readstring;
 
701
          if not current_module.mode_switch_allowed and
 
702
              not ((m_mac in current_settings.modeswitches) and (pattern='MACPAS')) then
 
703
            Message1(scan_e_mode_switch_not_allowed,pattern)
 
704
          else if not SetCompileMode(pattern,false) then
 
705
            Message1(scan_w_illegal_switch,pattern)
 
706
        end;
 
707
      current_module.mode_switch_allowed:= false;
 
708
    end;
 
709
 
 
710
    procedure dir_mmx;
 
711
      begin
 
712
        do_localswitch(cs_mmx);
 
713
      end;
 
714
 
 
715
    procedure dir_note;
 
716
      begin
 
717
        do_message(scan_n_user_defined);
 
718
      end;
 
719
 
 
720
    procedure dir_notes;
 
721
      begin
 
722
        do_setverbose('N');
 
723
      end;
 
724
 
 
725
    procedure dir_objectpath;
 
726
      begin
 
727
        if not current_module.in_global then
 
728
         Message(scan_w_switch_is_global)
 
729
        else
 
730
          begin
 
731
            current_scanner.skipspace;
 
732
            current_module.localobjectsearchpath.AddPath(current_scanner.readcomment,false);
 
733
          end;
 
734
      end;
 
735
 
 
736
    procedure dir_openstrings;
 
737
      begin
 
738
        do_delphiswitch('P');
 
739
      end;
 
740
 
 
741
    procedure dir_optimization;
 
742
      var
 
743
        hs : string;
 
744
      begin
 
745
        current_scanner.skipspace;
 
746
        { Support also the ON and OFF as switch }
 
747
        hs:=current_scanner.readid;
 
748
        if (hs='ON') then
 
749
          current_settings.optimizerswitches:=level2optimizerswitches
 
750
        else if (hs='OFF') then
 
751
          current_settings.optimizerswitches:=[]
 
752
        else if (hs='DEFAULT') then
 
753
          current_settings.optimizerswitches:=init_settings.optimizerswitches
 
754
        else
 
755
          begin
 
756
            if not UpdateOptimizerStr(hs,current_settings.optimizerswitches) then
 
757
              Message1(scan_e_illegal_optimization_specifier,hs);
 
758
          end;
 
759
      end;
 
760
 
 
761
    procedure dir_overflowchecks;
 
762
      begin
 
763
        do_delphiswitch('Q');
 
764
      end;
 
765
 
 
766
    procedure dir_packenum;
 
767
      var
 
768
        hs : string;
 
769
      begin
 
770
        current_scanner.skipspace;
 
771
        if not(c in ['0'..'9']) then
 
772
         begin
 
773
           hs:=current_scanner.readid;
 
774
           if (hs='NORMAL') or (hs='DEFAULT') then
 
775
            current_settings.packenum:=4
 
776
           else
 
777
            Message1(scan_e_illegal_pack_enum, hs);
 
778
         end
 
779
        else
 
780
         begin
 
781
           case current_scanner.readval of
 
782
            1 : current_settings.packenum:=1;
 
783
            2 : current_settings.packenum:=2;
 
784
            4 : current_settings.packenum:=4;
 
785
           else
 
786
            Message1(scan_e_illegal_pack_enum, pattern);
 
787
           end;
 
788
         end;
 
789
      end;
 
790
 
 
791
    procedure dir_packrecords;
 
792
      var
 
793
        hs : string;
 
794
      begin
 
795
        current_scanner.skipspace;
 
796
        if not(c in ['0'..'9']) then
 
797
         begin
 
798
           hs:=current_scanner.readid;
 
799
           { C has the special recordalignmax of C_alignment }
 
800
           if (hs='C') then
 
801
            current_settings.packrecords:=C_alignment
 
802
           else
 
803
            if (hs='NORMAL') or (hs='DEFAULT') then
 
804
             current_settings.packrecords:=0
 
805
           else
 
806
            Message1(scan_e_illegal_pack_records,hs);
 
807
         end
 
808
        else
 
809
         begin
 
810
           case current_scanner.readval of
 
811
             1 : current_settings.packrecords:=1;
 
812
             2 : current_settings.packrecords:=2;
 
813
             4 : current_settings.packrecords:=4;
 
814
             8 : current_settings.packrecords:=8;
 
815
            16 : current_settings.packrecords:=16;
 
816
            32 : current_settings.packrecords:=32;
 
817
           else
 
818
            Message1(scan_e_illegal_pack_records,pattern);
 
819
           end;
 
820
         end;
 
821
      end;
 
822
 
 
823
 
 
824
    procedure dir_packset;
 
825
      var
 
826
        hs : string;
 
827
      begin
 
828
        current_scanner.skipspace;
 
829
        if not(c in ['1','2','4','8']) then
 
830
         begin
 
831
           hs:=current_scanner.readid;
 
832
           if (hs='FIXED') or ((hs='DEFAULT') OR (hs='NORMAL')) then
 
833
            current_settings.setalloc:=0               {Fixed mode, sets are 4 or 32 bytes}
 
834
           else
 
835
            Message(scan_e_only_packset);
 
836
         end
 
837
        else
 
838
         begin
 
839
           case current_scanner.readval of
 
840
            1 : current_settings.setalloc:=1;
 
841
            2 : current_settings.setalloc:=2;
 
842
            4 : current_settings.setalloc:=4;
 
843
            8 : current_settings.setalloc:=8;
 
844
           else
 
845
            Message(scan_e_only_packset);
 
846
           end;
 
847
         end;
 
848
      end;
 
849
 
 
850
 
 
851
    procedure dir_pic;
 
852
      begin
 
853
        { windows doesn't need/support pic }
 
854
        if not(target_info.system in system_windows+system_wince) then
 
855
          do_moduleswitch(cs_create_pic)
 
856
        else
 
857
          message(scan_w_pic_ignored);
 
858
      end;
 
859
 
 
860
    procedure dir_pop;
 
861
 
 
862
    begin
 
863
      if localswitchesstackpos < 1 then
 
864
        Message(scan_e_too_many_pop);
 
865
 
 
866
      if not localswitcheschanged then
 
867
        nextlocalswitches:=current_settings.localswitches;
 
868
 
 
869
      Dec(localswitchesstackpos);
 
870
      nextlocalswitches:= localswitchesstack[localswitchesstackpos];
 
871
 
 
872
      localswitcheschanged:=true;
 
873
    end;
 
874
 
 
875
    procedure dir_profile;
 
876
      begin
 
877
        do_moduleswitch(cs_profile);
 
878
        { defined/undefine FPC_PROFILE }
 
879
        if cs_profile in current_settings.moduleswitches then
 
880
          def_system_macro('FPC_PROFILE')
 
881
        else
 
882
          undef_system_macro('FPC_PROFILE');
 
883
      end;
 
884
 
 
885
    procedure dir_push;
 
886
 
 
887
    begin
 
888
      if localswitchesstackpos > localswitchesstackmax then
 
889
        Message(scan_e_too_many_push);
 
890
 
 
891
      if localswitcheschanged then
 
892
        begin
 
893
          current_settings.localswitches:=nextlocalswitches;
 
894
          localswitcheschanged:=false;
 
895
        end;
 
896
 
 
897
      localswitchesstack[localswitchesstackpos]:= current_settings.localswitches;
 
898
      Inc(localswitchesstackpos);
 
899
    end;
 
900
 
 
901
    procedure dir_rangechecks;
 
902
      begin
 
903
        do_delphiswitch('R');
 
904
      end;
 
905
 
 
906
    procedure dir_referenceinfo;
 
907
      begin
 
908
        do_delphiswitch('Y');
 
909
      end;
 
910
 
 
911
    procedure dir_resource;
 
912
      var
 
913
        s : string;
 
914
      begin
 
915
        current_scanner.skipspace;
 
916
        if scanner.c = '''' then
 
917
          begin
 
918
            s:= current_scanner.readquotedstring;
 
919
            current_scanner.readcomment
 
920
          end
 
921
        else
 
922
          s:= trimspace(current_scanner.readcomment);
 
923
 
 
924
        { replace * with the name of the main source.
 
925
          This should always be defined. }
 
926
        if s[1]='*' then
 
927
          if Assigned(Current_Module) then
 
928
            begin
 
929
              delete(S,1,1);
 
930
              insert(ChangeFileExt(ExtractFileName(current_module.mainsource^),''),S,1 );
 
931
            end;
 
932
        s:=FixFileName(s);
 
933
        if ExtractFileExt(s)='' then
 
934
          s:=ChangeFileExt(s,target_info.resext);
 
935
        if target_info.res<>res_none then
 
936
          begin
 
937
          current_module.flags:=current_module.flags or uf_has_resourcefiles;
 
938
          if (target_info.res = res_emxbind) and
 
939
                                 not (Current_module.ResourceFiles.Empty) then
 
940
            Message(scan_w_only_one_resourcefile_supported)
 
941
          else
 
942
            current_module.resourcefiles.insert(FixFileName(s));
 
943
          end
 
944
        else
 
945
          Message(scan_e_resourcefiles_not_supported);
 
946
      end;
 
947
 
 
948
    procedure dir_saturation;
 
949
      begin
 
950
        do_localswitch(cs_mmx_saturation);
 
951
      end;
 
952
 
 
953
    procedure dir_safefpuexceptions;
 
954
      begin
 
955
        do_localswitch(cs_fpu_fwait);
 
956
      end;
 
957
 
 
958
    procedure dir_setpeflags;
 
959
      begin
 
960
        if not (target_info.system in (system_windows+system_wince)) then
 
961
          Message(scan_w_setpeflags_not_support);
 
962
        current_scanner.skipspace;
 
963
        peflags:=current_scanner.readval;
 
964
        SetPEFlagsSetExplicity:=true;
 
965
      end;
 
966
 
 
967
    procedure dir_smartlink;
 
968
      begin
 
969
        do_moduleswitch(cs_create_smart);
 
970
      end;
 
971
 
 
972
    procedure dir_stackframes;
 
973
      begin
 
974
        do_delphiswitch('W');
 
975
      end;
 
976
 
 
977
    procedure dir_static;
 
978
      begin
 
979
        do_moduleswitch(cs_static_keyword);
 
980
      end;
 
981
 
 
982
    procedure dir_stop;
 
983
      begin
 
984
        do_message(scan_f_user_defined);
 
985
      end;
 
986
 
 
987
{$ifdef powerpc}
 
988
    procedure dir_syscall;
 
989
      var
 
990
        sctype : string;
 
991
      begin
 
992
        { not needed on amiga/m68k for now, because there's only one }
 
993
        { syscall convention (legacy) (KB) }
 
994
        { not needed on amiga/powerpc because there's only one }
 
995
        { syscall convention (sysv) (KB) }
 
996
        if not (target_info.system in [system_powerpc_morphos]) then
 
997
          comment (V_Warning,'Syscall directive is useless on this target.');
 
998
        current_scanner.skipspace;
 
999
 
 
1000
        sctype:=current_scanner.readid;
 
1001
        if (sctype='LEGACY') or (sctype='SYSV') or (sctype='SYSVBASE') or
 
1002
          (sctype='BASESYSV') or (sctype='R12BASE') then
 
1003
          syscall_convention:=sctype
 
1004
        else
 
1005
          comment (V_Warning,'Invalid Syscall directive ignored.');
 
1006
      end;
 
1007
{$endif}
 
1008
 
 
1009
    procedure dir_typedaddress;
 
1010
      begin
 
1011
        do_delphiswitch('T');
 
1012
      end;
 
1013
 
 
1014
    procedure dir_typeinfo;
 
1015
      begin
 
1016
        do_delphiswitch('M');
 
1017
      end;
 
1018
 
 
1019
    procedure dir_unitpath;
 
1020
      begin
 
1021
        if not current_module.in_global then
 
1022
         Message(scan_w_switch_is_global)
 
1023
        else
 
1024
          with current_scanner,current_module,localunitsearchpath do
 
1025
            begin
 
1026
              skipspace;
 
1027
              AddPath(path^,readcomment,false);
 
1028
            end;
 
1029
      end;
 
1030
 
 
1031
    procedure dir_varstringchecks;
 
1032
      begin
 
1033
        do_delphiswitch('V');
 
1034
      end;
 
1035
 
 
1036
    procedure dir_version;
 
1037
      var
 
1038
        major, minor, revision : longint;
 
1039
        error : integer;
 
1040
      begin
 
1041
        if not (target_info.system in [system_i386_os2,system_i386_emx,
 
1042
                 system_i386_win32,system_i386_netware,system_i386_wdosx,
 
1043
                 system_i386_netwlibc]) then
 
1044
          begin
 
1045
            Message(scan_n_version_not_support);
 
1046
            exit;
 
1047
          end;
 
1048
        if (compile_level<>1) then
 
1049
          Message(scan_n_only_exe_version)
 
1050
        else
 
1051
          begin
 
1052
            { change description global var in all cases }
 
1053
            { it not used but in win32, os2 and netware }
 
1054
            current_scanner.skipspace;
 
1055
            { we should only accept Major.Minor format for win32 and os2 }
 
1056
            current_scanner.readnumber;
 
1057
            major:=0;
 
1058
            minor:=0;
 
1059
            revision:=0;
 
1060
            val(pattern,major,error);
 
1061
            if (error<>0) or (major > high(word)) or (major < 0) then
 
1062
              begin
 
1063
                Message1(scan_w_wrong_version_ignored,pattern);
 
1064
                exit;
 
1065
              end;
 
1066
            if c='.' then
 
1067
              begin
 
1068
                current_scanner.readchar;
 
1069
                current_scanner.readnumber;
 
1070
                val(pattern,minor,error);
 
1071
                if (error<>0) or (minor > high(word)) or (minor < 0) then
 
1072
                  begin
 
1073
                    Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
 
1074
                    exit;
 
1075
                  end;
 
1076
                if (c='.') and
 
1077
                   (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
 
1078
                  begin
 
1079
                     current_scanner.readchar;
 
1080
                     current_scanner.readnumber;
 
1081
                     val(pattern,revision,error);
 
1082
                     if (error<>0) or (revision > high(word)) or (revision < 0) then
 
1083
                       begin
 
1084
                          Message1(scan_w_wrong_version_ignored,tostr(revision)+'.'+pattern);
 
1085
                          exit;
 
1086
                       end;
 
1087
                     dllmajor:=word(major);
 
1088
                     dllminor:=word(minor);
 
1089
                     dllrevision:=word(revision);
 
1090
                     dllversion:=tostr(major)+','+tostr(minor)+','+tostr(revision);
 
1091
                  end
 
1092
                else
 
1093
                  begin
 
1094
                     dllmajor:=word(major);
 
1095
                     dllminor:=word(minor);
 
1096
                     dllversion:=tostr(major)+'.'+tostr(minor);
 
1097
                  end;
 
1098
              end
 
1099
            else
 
1100
              dllversion:=tostr(major);
 
1101
          end;
 
1102
      end;
 
1103
 
 
1104
    procedure dir_wait;
 
1105
      var
 
1106
        had_info : boolean;
 
1107
      begin
 
1108
        had_info:=(status.verbosity and V_Info)<>0;
 
1109
        { this message should allways appear !! }
 
1110
        status.verbosity:=status.verbosity or V_Info;
 
1111
        Message(scan_i_press_enter);
 
1112
        readln;
 
1113
        If not(had_info) then
 
1114
          status.verbosity:=status.verbosity and (not V_Info);
 
1115
      end;
 
1116
 
 
1117
    { delphi compatible warn directive:
 
1118
      $warn <identifier> on
 
1119
      $warn <identifier> off
 
1120
      not implemented yet
 
1121
    }
 
1122
    procedure dir_warn;
 
1123
      var
 
1124
        warning_string,state : string;
 
1125
      begin
 
1126
        current_scanner.skipspace;
 
1127
        warning_string:=current_scanner.readid;
 
1128
        current_scanner.skipspace;
 
1129
        state:=current_scanner.readid;
 
1130
        if (upper(state)='ON') then
 
1131
          begin
 
1132
          end
 
1133
        else if (upper(state)='OFF') then
 
1134
          begin
 
1135
          end
 
1136
        else
 
1137
          Message1(scanner_e_illegal_warn_state,state);
 
1138
      end;
 
1139
 
 
1140
    procedure dir_warning;
 
1141
      begin
 
1142
        do_message(scan_w_user_defined);
 
1143
      end;
 
1144
 
 
1145
    procedure dir_warnings;
 
1146
      begin
 
1147
        do_setverbose('W');
 
1148
      end;
 
1149
 
 
1150
    procedure dir_writeableconst;
 
1151
      begin
 
1152
        do_delphiswitch('J');
 
1153
      end;
 
1154
 
 
1155
    procedure dir_z1;
 
1156
      begin
 
1157
        current_settings.packenum:=1;
 
1158
      end;
 
1159
 
 
1160
    procedure dir_z2;
 
1161
      begin
 
1162
        current_settings.packenum:=2;
 
1163
      end;
 
1164
 
 
1165
    procedure dir_z4;
 
1166
      begin
 
1167
        current_settings.packenum:=4;
 
1168
      end;
 
1169
 
 
1170
    procedure dir_externalsym;
 
1171
      begin
 
1172
      end;
 
1173
 
 
1174
    procedure dir_nodefine;
 
1175
      begin
 
1176
      end;
 
1177
 
 
1178
    procedure dir_hppemit;
 
1179
      begin
 
1180
      end;
 
1181
 
 
1182
    procedure dir_weakpackageunit;
 
1183
      begin
 
1184
      end;
 
1185
 
 
1186
    procedure dir_codealign;
 
1187
      var
 
1188
        s : string;
 
1189
      begin
 
1190
        current_scanner.skipspace;
 
1191
        s:=current_scanner.readcomment;
 
1192
        UpdateAlignmentStr(s,current_settings.alignment);
 
1193
      end;
 
1194
 
 
1195
    procedure dir_codepage;
 
1196
      var
 
1197
         s : string;
 
1198
      begin
 
1199
        if not current_module.in_global then
 
1200
          Message(scan_w_switch_is_global)
 
1201
        else
 
1202
          begin
 
1203
             current_scanner.skipspace;
 
1204
             s:=current_scanner.readcomment;
 
1205
             if (upper(s)='UTF8') or (upper(s)='UTF-8') then
 
1206
               current_settings.sourcecodepage:='utf8'
 
1207
             else if not(cpavailable(s)) then
 
1208
               Message1(option_code_page_not_available,s)
 
1209
             else
 
1210
               current_settings.sourcecodepage:=s;
 
1211
          end;
 
1212
      end;
 
1213
 
 
1214
    procedure dir_coperators;
 
1215
      begin
 
1216
        do_moduleswitch(cs_support_c_operators);
 
1217
      end;
 
1218
 
 
1219
 
 
1220
    procedure dir_bitpacking;
 
1221
      begin
 
1222
        do_localswitch(cs_bitpacking);
 
1223
      end;
 
1224
 
 
1225
 
 
1226
{****************************************************************************
 
1227
                         Initialize Directives
 
1228
****************************************************************************}
 
1229
 
 
1230
    procedure InitScannerDirectives;
 
1231
      begin
 
1232
        AddDirective('A1',directive_all, @dir_a1);
 
1233
        AddDirective('A2',directive_all, @dir_a2);
 
1234
        AddDirective('A4',directive_all, @dir_a4);
 
1235
        AddDirective('A8',directive_all, @dir_a8);
 
1236
        AddDirective('ALIGN',directive_all, @dir_align);
 
1237
{$ifdef m68k}
 
1238
        AddDirective('APPID',directive_all, @dir_appid);
 
1239
        AddDirective('APPNAME',directive_all, @dir_appname);
 
1240
{$endif m68k}
 
1241
        AddDirective('APPTYPE',directive_all, @dir_apptype);
 
1242
        AddDirective('ASMMODE',directive_all, @dir_asmmode);
 
1243
        AddDirective('ASSERTIONS',directive_all, @dir_assertions);
 
1244
        AddDirective('BOOLEVAL',directive_all, @dir_booleval);
 
1245
        AddDirective('BITPACKING',directive_all, @dir_bitpacking);
 
1246
        AddDirective('CALLING',directive_all, @dir_calling);
 
1247
        AddDirective('CHECKPOINTER',directive_all, @dir_checkpointer);
 
1248
        AddDirective('CODEALIGN',directive_all, @dir_codealign);
 
1249
        AddDirective('CODEPAGE',directive_all, @dir_codepage);
 
1250
        AddDirective('COPERATORS',directive_all, @dir_coperators);
 
1251
        AddDirective('COPYRIGHT',directive_all, @dir_copyright);
 
1252
        AddDirective('D',directive_all, @dir_description);
 
1253
        AddDirective('DEBUGINFO',directive_all, @dir_debuginfo);
 
1254
        AddDirective('DESCRIPTION',directive_all, @dir_description);
 
1255
        AddDirective('ERROR',directive_all, @dir_error);
 
1256
        AddDirective('ERRORC',directive_mac, @dir_error);
 
1257
        AddDirective('EXTENDEDSYNTAX',directive_all, @dir_extendedsyntax);
 
1258
        AddDirective('EXTERNALSYM',directive_all, @dir_externalsym);
 
1259
        AddDirective('FATAL',directive_all, @dir_fatal);
 
1260
        AddDirective('FPUTYPE',directive_all, @dir_fputype);
 
1261
        AddDirective('GOTO',directive_all, @dir_goto);
 
1262
        AddDirective('HINT',directive_all, @dir_hint);
 
1263
        AddDirective('HINTS',directive_all, @dir_hints);
 
1264
        AddDirective('HPPEMIT',directive_all, @dir_hppemit);
 
1265
        AddDirective('IOCHECKS',directive_all, @dir_iochecks);
 
1266
        AddDirective('IMAGEBASE',directive_all, @dir_imagebase);
 
1267
        AddDirective('IMPLICITEXCEPTIONS',directive_all, @dir_implicitexceptions);
 
1268
        AddDirective('INCLUDEPATH',directive_all, @dir_includepath);
 
1269
        AddDirective('INFO',directive_all, @dir_info);
 
1270
        AddDirective('INLINE',directive_all, @dir_inline);
 
1271
        AddDirective('INTERFACES',directive_all, @dir_interfaces);
 
1272
        AddDirective('L',directive_all, @dir_link);
 
1273
        AddDirective('LIBEXPORT',directive_mac, @dir_libexport);
 
1274
        AddDirective('LIBRARYPATH',directive_all, @dir_librarypath);
 
1275
        AddDirective('LINK',directive_all, @dir_link);
 
1276
        AddDirective('LINKLIB',directive_all, @dir_linklib);
 
1277
        AddDirective('LOCALSYMBOLS',directive_all, @dir_localsymbols);
 
1278
        AddDirective('LONGSTRINGS',directive_all, @dir_longstrings);
 
1279
        AddDirective('M',directive_all, @dir_memory);
 
1280
        AddDirective('MACRO',directive_all, @dir_macro);
 
1281
        AddDirective('MAXFPUREGISTERS',directive_all, @dir_maxfpuregisters);
 
1282
        AddDirective('MAXSTACKSIZE',directive_all, @dir_maxstacksize);
 
1283
        AddDirective('MEMORY',directive_all, @dir_memory);
 
1284
        AddDirective('MESSAGE',directive_all, @dir_message);
 
1285
        AddDirective('MINENUMSIZE',directive_all, @dir_packenum);
 
1286
        AddDirective('MINSTACKSIZE',directive_all, @dir_minstacksize);
 
1287
        AddDirective('MMX',directive_all, @dir_mmx);
 
1288
        AddDirective('MODE',directive_all, @dir_mode);
 
1289
        AddDirective('NODEFINE',directive_all, @dir_nodefine);
 
1290
        AddDirective('NOTE',directive_all, @dir_note);
 
1291
        AddDirective('NOTES',directive_all, @dir_notes);
 
1292
        AddDirective('OBJECTCHECKS',directive_all, @dir_objectchecks);
 
1293
        AddDirective('OBJECTPATH',directive_all, @dir_objectpath);
 
1294
        AddDirective('OPENSTRINGS',directive_all, @dir_openstrings);
 
1295
        AddDirective('OPTIMIZATION',directive_all, @dir_optimization);
 
1296
        AddDirective('OVERFLOWCHECKS',directive_all, @dir_overflowchecks);
 
1297
        AddDirective('PACKENUM',directive_all, @dir_packenum);
 
1298
        AddDirective('PACKRECORDS',directive_all, @dir_packrecords);
 
1299
        AddDirective('PACKSET',directive_all, @dir_packset);
 
1300
        AddDirective('PIC',directive_all, @dir_pic);
 
1301
        AddDirective('POP',directive_mac, @dir_pop);
 
1302
        AddDirective('PROFILE',directive_all, @dir_profile);
 
1303
        AddDirective('PUSH',directive_mac, @dir_push);
 
1304
        AddDirective('R',directive_all, @dir_resource);
 
1305
        AddDirective('RANGECHECKS',directive_all, @dir_rangechecks);
 
1306
        AddDirective('REFERENCEINFO',directive_all, @dir_referenceinfo);
 
1307
        AddDirective('RESOURCE',directive_all, @dir_resource);
 
1308
        AddDirective('SATURATION',directive_all, @dir_saturation);
 
1309
        AddDirective('SAFEFPUEXCEPTIONS',directive_all, @dir_safefpuexceptions);
 
1310
        AddDirective('SETPEFLAGS', directive_all, @dir_setpeflags);
 
1311
        AddDirective('SCREENNAME',directive_all, @dir_screenname);
 
1312
        AddDirective('SMARTLINK',directive_all, @dir_smartlink);
 
1313
        AddDirective('STACKFRAMES',directive_all, @dir_stackframes);
 
1314
        AddDirective('STATIC',directive_all, @dir_static);
 
1315
        AddDirective('STOP',directive_all, @dir_stop);
 
1316
{$ifdef powerpc}
 
1317
        AddDirective('SYSCALL',directive_all, @dir_syscall);
 
1318
{$endif powerpc}
 
1319
        AddDirective('THREADNAME',directive_all, @dir_threadname);
 
1320
        AddDirective('TYPEDADDRESS',directive_all, @dir_typedaddress);
 
1321
        AddDirective('TYPEINFO',directive_all, @dir_typeinfo);
 
1322
        AddDirective('UNITPATH',directive_all, @dir_unitpath);
 
1323
        AddDirective('VARSTRINGCHECKS',directive_all, @dir_varstringchecks);
 
1324
        AddDirective('VERSION',directive_all, @dir_version);
 
1325
        AddDirective('WAIT',directive_all, @dir_wait);
 
1326
        AddDirective('WARN',directive_all, @dir_warn);
 
1327
        AddDirective('WARNING',directive_all, @dir_warning);
 
1328
        AddDirective('WARNINGS',directive_all, @dir_warnings);
 
1329
        AddDirective('WEAKPACKAGEUNIT',directive_all, @dir_weakpackageunit);
 
1330
        AddDirective('WRITEABLECONST',directive_all, @dir_writeableconst);
 
1331
        AddDirective('Z1',directive_all, @dir_z1);
 
1332
        AddDirective('Z2',directive_all, @dir_z2);
 
1333
        AddDirective('Z4',directive_all, @dir_z4);
 
1334
      end;
 
1335
 
 
1336
begin
 
1337
  localswitchesstackpos:= 0;
 
1338
end.