2
Copyright (c) 1998-2002 by Peter Vreman
4
This unit implements directive parsing for the scanner
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.
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.
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.
20
****************************************************************************
29
procedure InitScannerDirectives;
36
globtype,globals,systems,widestr,cpuinfo,
44
localswitchesstackmax = 20;
47
localswitchesstack: array[0..localswitchesstackmax] of tlocalswitches;
48
localswitchesstackpos: Integer;
50
{*****************************************************************************
52
*****************************************************************************}
54
procedure do_delphiswitch(sw:char);
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);
65
procedure do_setverbose(flag:char);
70
state:=current_scanner.ReadState;
71
SetVerbosity(flag+state);
75
procedure do_moduleswitch(sw:tmoduleswitch);
79
state:=current_scanner.readstate;
80
if (sw<>cs_modulenone) and (state in ['-','+']) then
83
exclude(current_settings.moduleswitches,sw)
85
include(current_settings.moduleswitches,sw);
90
procedure do_localswitch(sw:tlocalswitch);
94
state:=current_scanner.readstate;
95
if (sw<>cs_localnone) and (state in ['-','+']) then
97
if not localswitcheschanged then
98
nextlocalswitches:=current_settings.localswitches;
100
exclude(nextlocalswitches,sw)
102
include(nextlocalswitches,sw);
103
localswitcheschanged:=true;
107
procedure do_localswitchdefault(sw:tlocalswitch);
111
state:=current_scanner.readstatedefault;
112
if (sw<>cs_localnone) and (state in ['-','+','*']) then
114
if not localswitcheschanged then
115
nextlocalswitches:=current_settings.localswitches;
117
exclude(nextlocalswitches,sw)
120
include(nextlocalswitches,sw)
123
if sw in init_settings.localswitches then
124
include(nextlocalswitches,sw)
126
exclude(nextlocalswitches,sw);
128
localswitcheschanged:=true;
133
procedure do_message(w:integer);
135
current_scanner.skipspace;
136
Message1(w,current_scanner.readcomment);
139
{*****************************************************************************
141
*****************************************************************************}
147
current_scanner.skipspace;
148
if not(c in ['0'..'9']) then
150
{ Support also the ON and OFF as switch }
151
hs:=current_scanner.readid;
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
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
166
Message1(scan_e_illegal_pack_records,hs);
169
Message1(scan_e_illegal_pack_records,hs);
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;
181
Message1(scan_e_illegal_pack_records,hs);
188
current_settings.packrecords:=1;
193
current_settings.packrecords:=2;
198
current_settings.packrecords:=4;
203
current_settings.packrecords:=8;
206
procedure dir_asmmode;
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);
215
current_settings.asmmode:=init_settings.asmmode
217
if not SetAsmReadMode(s,current_settings.asmmode) then
218
Message1(scan_e_illegal_asmmode_specifier,s);
221
{$if defined(m68k) or defined(arm)}
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;
232
procedure dir_appname;
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;
241
{$endif defined(m68k) or defined(arm)}
243
procedure dir_apptype;
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
251
if m_delphi in current_settings.modeswitches then
252
Message(scan_n_app_type_not_support)
254
Message(scan_w_app_type_not_support);
258
if not current_module.in_global then
259
Message(scan_w_switch_is_global)
262
current_scanner.skipspace;
263
hs:=current_scanner.readid;
266
else if hs='CONSOLE' then
268
else if (hs='NATIVE') and (target_info.system in system_windows) then
270
else if (hs='FS') and (target_info.system in [system_i386_os2,
271
system_i386_emx]) then
273
else if (hs='TOOL') and (target_info.system in [system_powerpc_macos]) then
275
else if (hs='ARM9') and (target_info.system in [system_arm_nds]) then
277
else if (hs='ARM7') and (target_info.system in [system_arm_nds]) then
280
Message1(scan_w_unsupported_app_type,hs);
286
procedure dir_calling;
290
current_scanner.skipspace;
291
hs:=current_scanner.readid;
292
if not SetAktProcCall(hs,current_settings.defproccall) then
295
Message1(parser_w_unknown_proc_directive_ignored,hs)
297
Message(parser_e_proc_directive_expected);
302
procedure dir_checkpointer;
304
do_localswitchdefault(cs_checkpointer);
308
procedure dir_objectchecks;
310
do_localswitch(cs_check_object);
314
procedure dir_assertions;
316
do_delphiswitch('C');
319
procedure dir_booleval;
321
do_delphiswitch('B');
324
procedure dir_debuginfo;
326
do_delphiswitch('D');
329
procedure dir_description;
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;
341
procedure dir_screenname; {ad}
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;
350
procedure dir_threadname; {ad}
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;
359
procedure dir_copyright; {ad}
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;
370
do_message(scan_e_user_defined);
373
procedure dir_extendedsyntax;
375
do_delphiswitch('X');
380
do_message(scan_f_user_defined);
383
procedure dir_fputype;
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]);
394
do_moduleswitch(cs_support_goto);
399
do_message(scan_h_user_defined);
407
procedure dir_imagebase;
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
416
procedure dir_implicitexceptions;
418
do_moduleswitch(cs_implicit_exceptions);
421
procedure dir_includepath;
423
if not current_module.in_global then
424
Message(scan_w_switch_is_global)
427
current_scanner.skipspace;
428
current_module.localincludesearchpath.AddPath(current_scanner.readcomment,false);
434
do_message(scan_i_user_defined);
437
procedure dir_inline;
439
do_localswitch(cs_do_inline);
442
procedure dir_interfaces;
447
current_scanner.skipspace;
448
hs:=current_scanner.readid;
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
456
Message(scan_e_invalid_interface_type);
459
procedure dir_iochecks;
461
do_delphiswitch('I');
464
procedure dir_libexport;
469
procedure dir_librarypath;
471
if not current_module.in_global then
472
Message(scan_w_switch_is_global)
475
current_scanner.skipspace;
476
current_module.locallibrarysearchpath.AddPath(current_scanner.readcomment,false);
484
current_scanner.skipspace;
485
if scanner.c = '''' then
487
s:= current_scanner.readquotedstring;
488
current_scanner.readcomment
491
s:= trimspace(current_scanner.readcomment);
493
if ExtractFileExt(s)='' then
494
s:=ChangeFileExt(s,target_info.objext);
495
current_module.linkotherofiles.add(s,link_always);
498
procedure dir_linklib;
500
tLinkMode=(lm_shared,lm_static);
506
linkmodestr : string;
508
linkMode : tLinkMode;
510
current_scanner.skipspace;
511
if scanner.c = '''' then
513
libname:= current_scanner.readquotedstring;
514
s:= current_scanner.readcomment;
519
s:= current_scanner.readcomment;
522
libname:=TrimSpace(s)
524
libname:=TrimSpace(copy(s,1,p-1));
529
linkmodeStr:=Upper(TrimSpace(copy(s,p+1,255)));
532
if (libname='') or (libname='''''') or (libname='""') then
534
{ create library name }
535
if libname[1] in ['''','"'] then
539
p:=pos(quote,libname);
543
libname:=FixFileName(libname);
545
{ get linkmode, default is to check the extension for
546
the static library, otherwise shared linking is assumed }
548
if linkModeStr='' then
550
libext:=ExtractFileExt(libname);
551
if libext=target_info.staticClibext then
554
else if linkModeStr='STATIC' then
556
else if (LinkModeStr='SHARED') or (LinkModeStr='') then
559
Comment(V_Error,'Wrong link mode specified: "'+Linkmodestr+'"');
561
{ add to the list of other libraries }
562
if linkMode=lm_static then
563
current_module.linkOtherStaticLibs.add(libname,link_always)
565
current_module.linkOtherSharedLibs.add(libname,link_always);
568
procedure dir_localsymbols;
570
do_delphiswitch('L');
573
procedure dir_longstrings;
575
do_delphiswitch('H');
580
do_moduleswitch(cs_support_macro);
583
procedure dir_maxfpuregisters;
588
current_scanner.skipspace;
589
if not(c in ['0'..'9']) then
591
hs:=current_scanner.readid;
592
if (hs='NORMAL') or (hs='DEFAULT') then
593
current_settings.maxfpuregisters:=-1
595
Message(scan_e_invalid_maxfpureg_value);
599
l:=current_scanner.readval;
602
current_settings.maxfpuregisters:=l;
604
Message(scan_e_invalid_maxfpureg_value);
609
procedure dir_maxstacksize;
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;
618
procedure dir_memory;
622
current_scanner.skipspace;
623
l:=current_scanner.readval;
628
current_scanner.readchar;
629
current_scanner.skipspace;
630
l:=current_scanner.readval;
637
procedure dir_message;
643
current_scanner.skipspace;
644
{ Message level specified? }
646
w:=scan_n_user_defined
649
hs:=current_scanner.readid;
650
if (hs='WARN') or (hs='WARNING') then
651
w:=scan_w_user_defined
654
w:=scan_e_user_defined
657
w:=scan_f_user_defined
660
w:=scan_h_user_defined
663
w:=scan_n_user_defined
665
Message1(scan_w_illegal_directive,hs);
667
{ Only print message when there was no error }
670
current_scanner.skipspace;
672
hs:=current_scanner.readquotedstring
674
hs:=current_scanner.readcomment;
678
current_scanner.readcomment;
682
procedure dir_minstacksize;
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;
695
if not current_module.in_global then
696
Message(scan_w_switch_is_global)
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)
707
current_module.mode_switch_allowed:= false;
712
do_localswitch(cs_mmx);
717
do_message(scan_n_user_defined);
725
procedure dir_objectpath;
727
if not current_module.in_global then
728
Message(scan_w_switch_is_global)
731
current_scanner.skipspace;
732
current_module.localobjectsearchpath.AddPath(current_scanner.readcomment,false);
736
procedure dir_openstrings;
738
do_delphiswitch('P');
741
procedure dir_optimization;
745
current_scanner.skipspace;
746
{ Support also the ON and OFF as switch }
747
hs:=current_scanner.readid;
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
756
if not UpdateOptimizerStr(hs,current_settings.optimizerswitches) then
757
Message1(scan_e_illegal_optimization_specifier,hs);
761
procedure dir_overflowchecks;
763
do_delphiswitch('Q');
766
procedure dir_packenum;
770
current_scanner.skipspace;
771
if not(c in ['0'..'9']) then
773
hs:=current_scanner.readid;
774
if (hs='NORMAL') or (hs='DEFAULT') then
775
current_settings.packenum:=4
777
Message1(scan_e_illegal_pack_enum, hs);
781
case current_scanner.readval of
782
1 : current_settings.packenum:=1;
783
2 : current_settings.packenum:=2;
784
4 : current_settings.packenum:=4;
786
Message1(scan_e_illegal_pack_enum, pattern);
791
procedure dir_packrecords;
795
current_scanner.skipspace;
796
if not(c in ['0'..'9']) then
798
hs:=current_scanner.readid;
799
{ C has the special recordalignmax of C_alignment }
801
current_settings.packrecords:=C_alignment
803
if (hs='NORMAL') or (hs='DEFAULT') then
804
current_settings.packrecords:=0
806
Message1(scan_e_illegal_pack_records,hs);
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;
818
Message1(scan_e_illegal_pack_records,pattern);
824
procedure dir_packset;
828
current_scanner.skipspace;
829
if not(c in ['1','2','4','8']) then
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}
835
Message(scan_e_only_packset);
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;
845
Message(scan_e_only_packset);
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)
857
message(scan_w_pic_ignored);
863
if localswitchesstackpos < 1 then
864
Message(scan_e_too_many_pop);
866
if not localswitcheschanged then
867
nextlocalswitches:=current_settings.localswitches;
869
Dec(localswitchesstackpos);
870
nextlocalswitches:= localswitchesstack[localswitchesstackpos];
872
localswitcheschanged:=true;
875
procedure dir_profile;
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')
882
undef_system_macro('FPC_PROFILE');
888
if localswitchesstackpos > localswitchesstackmax then
889
Message(scan_e_too_many_push);
891
if localswitcheschanged then
893
current_settings.localswitches:=nextlocalswitches;
894
localswitcheschanged:=false;
897
localswitchesstack[localswitchesstackpos]:= current_settings.localswitches;
898
Inc(localswitchesstackpos);
901
procedure dir_rangechecks;
903
do_delphiswitch('R');
906
procedure dir_referenceinfo;
908
do_delphiswitch('Y');
911
procedure dir_resource;
915
current_scanner.skipspace;
916
if scanner.c = '''' then
918
s:= current_scanner.readquotedstring;
919
current_scanner.readcomment
922
s:= trimspace(current_scanner.readcomment);
924
{ replace * with the name of the main source.
925
This should always be defined. }
927
if Assigned(Current_Module) then
930
insert(ChangeFileExt(ExtractFileName(current_module.mainsource^),''),S,1 );
933
if ExtractFileExt(s)='' then
934
s:=ChangeFileExt(s,target_info.resext);
935
if target_info.res<>res_none then
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)
942
current_module.resourcefiles.insert(FixFileName(s));
945
Message(scan_e_resourcefiles_not_supported);
948
procedure dir_saturation;
950
do_localswitch(cs_mmx_saturation);
953
procedure dir_safefpuexceptions;
955
do_localswitch(cs_fpu_fwait);
958
procedure dir_setpeflags;
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;
967
procedure dir_smartlink;
969
do_moduleswitch(cs_create_smart);
972
procedure dir_stackframes;
974
do_delphiswitch('W');
977
procedure dir_static;
979
do_moduleswitch(cs_static_keyword);
984
do_message(scan_f_user_defined);
988
procedure dir_syscall;
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;
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
1005
comment (V_Warning,'Invalid Syscall directive ignored.');
1009
procedure dir_typedaddress;
1011
do_delphiswitch('T');
1014
procedure dir_typeinfo;
1016
do_delphiswitch('M');
1019
procedure dir_unitpath;
1021
if not current_module.in_global then
1022
Message(scan_w_switch_is_global)
1024
with current_scanner,current_module,localunitsearchpath do
1027
AddPath(path^,readcomment,false);
1031
procedure dir_varstringchecks;
1033
do_delphiswitch('V');
1036
procedure dir_version;
1038
major, minor, revision : longint;
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
1045
Message(scan_n_version_not_support);
1048
if (compile_level<>1) then
1049
Message(scan_n_only_exe_version)
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;
1060
val(pattern,major,error);
1061
if (error<>0) or (major > high(word)) or (major < 0) then
1063
Message1(scan_w_wrong_version_ignored,pattern);
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
1073
Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
1077
(target_info.system in [system_i386_netware,system_i386_netwlibc]) then
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
1084
Message1(scan_w_wrong_version_ignored,tostr(revision)+'.'+pattern);
1087
dllmajor:=word(major);
1088
dllminor:=word(minor);
1089
dllrevision:=word(revision);
1090
dllversion:=tostr(major)+','+tostr(minor)+','+tostr(revision);
1094
dllmajor:=word(major);
1095
dllminor:=word(minor);
1096
dllversion:=tostr(major)+'.'+tostr(minor);
1100
dllversion:=tostr(major);
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);
1113
If not(had_info) then
1114
status.verbosity:=status.verbosity and (not V_Info);
1117
{ delphi compatible warn directive:
1118
$warn <identifier> on
1119
$warn <identifier> off
1124
warning_string,state : string;
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
1133
else if (upper(state)='OFF') then
1137
Message1(scanner_e_illegal_warn_state,state);
1140
procedure dir_warning;
1142
do_message(scan_w_user_defined);
1145
procedure dir_warnings;
1150
procedure dir_writeableconst;
1152
do_delphiswitch('J');
1157
current_settings.packenum:=1;
1162
current_settings.packenum:=2;
1167
current_settings.packenum:=4;
1170
procedure dir_externalsym;
1174
procedure dir_nodefine;
1178
procedure dir_hppemit;
1182
procedure dir_weakpackageunit;
1186
procedure dir_codealign;
1190
current_scanner.skipspace;
1191
s:=current_scanner.readcomment;
1192
UpdateAlignmentStr(s,current_settings.alignment);
1195
procedure dir_codepage;
1199
if not current_module.in_global then
1200
Message(scan_w_switch_is_global)
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)
1210
current_settings.sourcecodepage:=s;
1214
procedure dir_coperators;
1216
do_moduleswitch(cs_support_c_operators);
1220
procedure dir_bitpacking;
1222
do_localswitch(cs_bitpacking);
1226
{****************************************************************************
1227
Initialize Directives
1228
****************************************************************************}
1230
procedure InitScannerDirectives;
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);
1238
AddDirective('APPID',directive_all, @dir_appid);
1239
AddDirective('APPNAME',directive_all, @dir_appname);
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);
1317
AddDirective('SYSCALL',directive_all, @dir_syscall);
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);
1337
localswitchesstackpos:= 0;