scandir.pas 43 KB

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