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