scandir.pas 43 KB

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