scandir.pas 43 KB

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