scandir.pas 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  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_modeswitch;
  680. var
  681. s : string;
  682. begin
  683. if not current_module.in_global then
  684. Message(scan_w_switch_is_global)
  685. else
  686. begin
  687. current_scanner.skipspace;
  688. current_scanner.readstring;
  689. s:=pattern;
  690. if c in ['+','-'] then
  691. s:=s+current_scanner.readstate;
  692. if not SetCompileModeSwitch(s,false) then
  693. Message1(scan_w_illegal_switch,s)
  694. end;
  695. end;
  696. procedure dir_mmx;
  697. begin
  698. do_localswitch(cs_mmx);
  699. end;
  700. procedure dir_note;
  701. begin
  702. do_message(scan_n_user_defined);
  703. end;
  704. procedure dir_notes;
  705. begin
  706. do_setverbose('N');
  707. end;
  708. procedure dir_objectpath;
  709. begin
  710. if not current_module.in_global then
  711. Message(scan_w_switch_is_global)
  712. else
  713. begin
  714. current_scanner.skipspace;
  715. current_module.localobjectsearchpath.AddPath(current_scanner.readcomment,false);
  716. end;
  717. end;
  718. procedure dir_openstrings;
  719. begin
  720. do_delphiswitch('P');
  721. end;
  722. procedure dir_optimization;
  723. var
  724. hs : string;
  725. begin
  726. current_scanner.skipspace;
  727. { Support also the ON and OFF as switch }
  728. hs:=current_scanner.readid;
  729. if (hs='ON') then
  730. current_settings.optimizerswitches:=level2optimizerswitches
  731. else if (hs='OFF') then
  732. current_settings.optimizerswitches:=[]
  733. else if (hs='DEFAULT') then
  734. current_settings.optimizerswitches:=init_settings.optimizerswitches
  735. else
  736. begin
  737. if not UpdateOptimizerStr(hs,current_settings.optimizerswitches) then
  738. Message1(scan_e_illegal_optimization_specifier,hs);
  739. end;
  740. end;
  741. procedure dir_overflowchecks;
  742. begin
  743. do_delphiswitch('Q');
  744. end;
  745. procedure dir_packenum;
  746. var
  747. hs : string;
  748. begin
  749. current_scanner.skipspace;
  750. if not(c in ['0'..'9']) then
  751. begin
  752. hs:=current_scanner.readid;
  753. if (hs='NORMAL') or (hs='DEFAULT') then
  754. current_settings.packenum:=4
  755. else
  756. Message1(scan_e_illegal_pack_enum, hs);
  757. end
  758. else
  759. begin
  760. case current_scanner.readval of
  761. 1 : current_settings.packenum:=1;
  762. 2 : current_settings.packenum:=2;
  763. 4 : current_settings.packenum:=4;
  764. else
  765. Message1(scan_e_illegal_pack_enum, pattern);
  766. end;
  767. end;
  768. end;
  769. procedure dir_minfpconstprec;
  770. begin
  771. current_scanner.skipspace;
  772. if not SetMinFPConstPrec(current_scanner.readid,current_settings.minfpconstprec) then
  773. Message1(scan_e_illegal_minfpconstprec, pattern);
  774. end;
  775. procedure dir_packrecords;
  776. var
  777. hs : string;
  778. begin
  779. current_scanner.skipspace;
  780. if not(c in ['0'..'9']) then
  781. begin
  782. hs:=current_scanner.readid;
  783. { C has the special recordalignmax of C_alignment }
  784. if (hs='C') then
  785. current_settings.packrecords:=C_alignment
  786. else
  787. if (hs='NORMAL') or (hs='DEFAULT') then
  788. current_settings.packrecords:=0
  789. else
  790. Message1(scan_e_illegal_pack_records,hs);
  791. end
  792. else
  793. begin
  794. case current_scanner.readval of
  795. 1 : current_settings.packrecords:=1;
  796. 2 : current_settings.packrecords:=2;
  797. 4 : current_settings.packrecords:=4;
  798. 8 : current_settings.packrecords:=8;
  799. 16 : current_settings.packrecords:=16;
  800. 32 : current_settings.packrecords:=32;
  801. else
  802. Message1(scan_e_illegal_pack_records,pattern);
  803. end;
  804. end;
  805. end;
  806. procedure dir_packset;
  807. var
  808. hs : string;
  809. begin
  810. current_scanner.skipspace;
  811. if not(c in ['1','2','4','8']) then
  812. begin
  813. hs:=current_scanner.readid;
  814. if (hs='FIXED') or ((hs='DEFAULT') OR (hs='NORMAL')) then
  815. current_settings.setalloc:=0 {Fixed mode, sets are 4 or 32 bytes}
  816. else
  817. Message(scan_e_only_packset);
  818. end
  819. else
  820. begin
  821. case current_scanner.readval of
  822. 1 : current_settings.setalloc:=1;
  823. 2 : current_settings.setalloc:=2;
  824. 4 : current_settings.setalloc:=4;
  825. 8 : current_settings.setalloc:=8;
  826. else
  827. Message(scan_e_only_packset);
  828. end;
  829. end;
  830. end;
  831. procedure dir_pic;
  832. begin
  833. { windows doesn't need/support pic }
  834. if tf_no_pic_supported in target_info.flags then
  835. message(scan_w_pic_ignored)
  836. else
  837. do_moduleswitch(cs_create_pic);
  838. end;
  839. procedure dir_pop;
  840. begin
  841. if localswitchesstackpos < 1 then
  842. Message(scan_e_too_many_pop);
  843. if not localswitcheschanged then
  844. nextlocalswitches:=current_settings.localswitches;
  845. Dec(localswitchesstackpos);
  846. nextlocalswitches:= localswitchesstack[localswitchesstackpos];
  847. localswitcheschanged:=true;
  848. end;
  849. procedure dir_profile;
  850. begin
  851. do_moduleswitch(cs_profile);
  852. { defined/undefine FPC_PROFILE }
  853. if cs_profile in current_settings.moduleswitches then
  854. def_system_macro('FPC_PROFILE')
  855. else
  856. undef_system_macro('FPC_PROFILE');
  857. end;
  858. procedure dir_push;
  859. begin
  860. if localswitchesstackpos > localswitchesstackmax then
  861. Message(scan_e_too_many_push);
  862. if localswitcheschanged then
  863. begin
  864. current_settings.localswitches:=nextlocalswitches;
  865. localswitcheschanged:=false;
  866. end;
  867. localswitchesstack[localswitchesstackpos]:= current_settings.localswitches;
  868. Inc(localswitchesstackpos);
  869. end;
  870. procedure dir_rangechecks;
  871. begin
  872. do_delphiswitch('R');
  873. end;
  874. procedure dir_referenceinfo;
  875. begin
  876. do_delphiswitch('Y');
  877. end;
  878. procedure dir_resource;
  879. var
  880. s : string;
  881. begin
  882. current_scanner.skipspace;
  883. if scanner.c = '''' then
  884. begin
  885. s:= current_scanner.readquotedstring;
  886. current_scanner.readcomment
  887. end
  888. else
  889. s:= trimspace(current_scanner.readcomment);
  890. { replace * with the name of the main source.
  891. This should always be defined. }
  892. if s[1]='*' then
  893. if Assigned(Current_Module) then
  894. begin
  895. delete(S,1,1);
  896. insert(ChangeFileExt(ExtractFileName(current_module.mainsource^),''),S,1 );
  897. end;
  898. s:=FixFileName(s);
  899. if ExtractFileExt(s)='' then
  900. s:=ChangeFileExt(s,target_info.resext);
  901. if target_info.res<>res_none then
  902. begin
  903. current_module.flags:=current_module.flags or uf_has_resourcefiles;
  904. if (res_single_file in target_res.resflags) and
  905. not (Current_module.ResourceFiles.Empty) then
  906. Message(scan_w_only_one_resourcefile_supported)
  907. else
  908. current_module.resourcefiles.insert(FixFileName(s));
  909. end
  910. else
  911. Message(scan_e_resourcefiles_not_supported);
  912. end;
  913. procedure dir_saturation;
  914. begin
  915. do_localswitch(cs_mmx_saturation);
  916. end;
  917. procedure dir_safefpuexceptions;
  918. begin
  919. do_localswitch(cs_fpu_fwait);
  920. end;
  921. procedure dir_setpeflags;
  922. begin
  923. if not (target_info.system in (system_all_windows)) then
  924. Message(scan_w_setpeflags_not_support);
  925. current_scanner.skipspace;
  926. peflags:=current_scanner.readval;
  927. SetPEFlagsSetExplicity:=true;
  928. end;
  929. procedure dir_smartlink;
  930. begin
  931. do_moduleswitch(cs_create_smart);
  932. end;
  933. procedure dir_stackframes;
  934. begin
  935. do_delphiswitch('W');
  936. end;
  937. procedure dir_static;
  938. begin
  939. do_moduleswitch(cs_static_keyword);
  940. end;
  941. procedure dir_stop;
  942. begin
  943. do_message(scan_f_user_defined);
  944. end;
  945. {$ifdef powerpc}
  946. procedure dir_syscall;
  947. var
  948. sctype : string;
  949. begin
  950. { not needed on amiga/m68k for now, because there's only one }
  951. { syscall convention (legacy) (KB) }
  952. { not needed on amiga/powerpc because there's only one }
  953. { syscall convention (sysv) (KB) }
  954. if not (target_info.system in [system_powerpc_morphos]) then
  955. comment (V_Warning,'Syscall directive is useless on this target.');
  956. current_scanner.skipspace;
  957. sctype:=current_scanner.readid;
  958. if (sctype='LEGACY') or (sctype='SYSV') or (sctype='SYSVBASE') or
  959. (sctype='BASESYSV') or (sctype='R12BASE') then
  960. syscall_convention:=sctype
  961. else
  962. comment (V_Warning,'Invalid Syscall directive ignored.');
  963. end;
  964. {$endif}
  965. procedure dir_typedaddress;
  966. begin
  967. do_delphiswitch('T');
  968. end;
  969. procedure dir_typeinfo;
  970. begin
  971. do_delphiswitch('M');
  972. end;
  973. procedure dir_unitpath;
  974. begin
  975. if not current_module.in_global then
  976. Message(scan_w_switch_is_global)
  977. else
  978. with current_scanner,current_module,localunitsearchpath do
  979. begin
  980. skipspace;
  981. AddPath(path^,readcomment,false);
  982. end;
  983. end;
  984. procedure dir_varstringchecks;
  985. begin
  986. do_delphiswitch('V');
  987. end;
  988. procedure dir_version;
  989. var
  990. major, minor, revision : longint;
  991. error : integer;
  992. begin
  993. if not (target_info.system in [system_i386_os2,system_i386_emx,
  994. system_i386_win32,system_i386_netware,system_i386_wdosx,
  995. system_i386_netwlibc]) then
  996. begin
  997. Message(scan_n_version_not_support);
  998. exit;
  999. end;
  1000. if (compile_level<>1) then
  1001. Message(scan_n_only_exe_version)
  1002. else
  1003. begin
  1004. { change description global var in all cases }
  1005. { it not used but in win32, os2 and netware }
  1006. current_scanner.skipspace;
  1007. { we should only accept Major.Minor format for win32 and os2 }
  1008. current_scanner.readnumber;
  1009. major:=0;
  1010. minor:=0;
  1011. revision:=0;
  1012. val(pattern,major,error);
  1013. if (error<>0) or (major > high(word)) or (major < 0) then
  1014. begin
  1015. Message1(scan_w_wrong_version_ignored,pattern);
  1016. exit;
  1017. end;
  1018. if c='.' then
  1019. begin
  1020. current_scanner.readchar;
  1021. current_scanner.readnumber;
  1022. val(pattern,minor,error);
  1023. if (error<>0) or (minor > high(word)) or (minor < 0) then
  1024. begin
  1025. Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
  1026. exit;
  1027. end;
  1028. if (c='.') and
  1029. (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  1030. begin
  1031. current_scanner.readchar;
  1032. current_scanner.readnumber;
  1033. val(pattern,revision,error);
  1034. if (error<>0) or (revision > high(word)) or (revision < 0) then
  1035. begin
  1036. Message1(scan_w_wrong_version_ignored,tostr(revision)+'.'+pattern);
  1037. exit;
  1038. end;
  1039. dllmajor:=word(major);
  1040. dllminor:=word(minor);
  1041. dllrevision:=word(revision);
  1042. dllversion:=tostr(major)+','+tostr(minor)+','+tostr(revision);
  1043. end
  1044. else
  1045. begin
  1046. dllmajor:=word(major);
  1047. dllminor:=word(minor);
  1048. dllversion:=tostr(major)+'.'+tostr(minor);
  1049. end;
  1050. end
  1051. else
  1052. dllversion:=tostr(major);
  1053. end;
  1054. end;
  1055. procedure dir_wait;
  1056. var
  1057. had_info : boolean;
  1058. begin
  1059. had_info:=(status.verbosity and V_Info)<>0;
  1060. { this message should allways appear !! }
  1061. status.verbosity:=status.verbosity or V_Info;
  1062. Message(scan_i_press_enter);
  1063. readln;
  1064. If not(had_info) then
  1065. status.verbosity:=status.verbosity and (not V_Info);
  1066. end;
  1067. { delphi compatible warn directive:
  1068. $warn <identifier> on
  1069. $warn <identifier> off
  1070. not implemented yet
  1071. }
  1072. procedure dir_warn;
  1073. var
  1074. state : string;
  1075. begin
  1076. current_scanner.skipspace;
  1077. current_scanner.readid;
  1078. current_scanner.skipspace;
  1079. state:=current_scanner.readid;
  1080. if (upper(state)='ON') then
  1081. begin
  1082. end
  1083. else if (upper(state)='OFF') then
  1084. begin
  1085. end
  1086. else
  1087. Message1(scanner_e_illegal_warn_state,state);
  1088. end;
  1089. procedure dir_warning;
  1090. begin
  1091. do_message(scan_w_user_defined);
  1092. end;
  1093. procedure dir_warnings;
  1094. begin
  1095. do_setverbose('W');
  1096. end;
  1097. procedure dir_writeableconst;
  1098. begin
  1099. do_delphiswitch('J');
  1100. end;
  1101. procedure dir_z1;
  1102. begin
  1103. current_settings.packenum:=1;
  1104. end;
  1105. procedure dir_z2;
  1106. begin
  1107. current_settings.packenum:=2;
  1108. end;
  1109. procedure dir_z4;
  1110. begin
  1111. current_settings.packenum:=4;
  1112. end;
  1113. procedure dir_externalsym;
  1114. begin
  1115. end;
  1116. procedure dir_nodefine;
  1117. begin
  1118. end;
  1119. procedure dir_hppemit;
  1120. begin
  1121. end;
  1122. procedure dir_weakpackageunit;
  1123. begin
  1124. end;
  1125. procedure dir_codealign;
  1126. var
  1127. s : string;
  1128. begin
  1129. current_scanner.skipspace;
  1130. s:=current_scanner.readcomment;
  1131. UpdateAlignmentStr(s,current_settings.alignment);
  1132. end;
  1133. procedure dir_codepage;
  1134. var
  1135. s : string;
  1136. begin
  1137. if not current_module.in_global then
  1138. Message(scan_w_switch_is_global)
  1139. else
  1140. begin
  1141. current_scanner.skipspace;
  1142. s:=current_scanner.readcomment;
  1143. if (upper(s)='UTF8') or (upper(s)='UTF-8') then
  1144. current_settings.sourcecodepage:='utf8'
  1145. else if not(cpavailable(s)) then
  1146. Message1(option_code_page_not_available,s)
  1147. else
  1148. current_settings.sourcecodepage:=s;
  1149. end;
  1150. end;
  1151. procedure dir_coperators;
  1152. begin
  1153. do_moduleswitch(cs_support_c_operators);
  1154. end;
  1155. procedure dir_bitpacking;
  1156. begin
  1157. do_localswitch(cs_bitpacking);
  1158. end;
  1159. procedure dir_region;
  1160. begin
  1161. end;
  1162. procedure dir_endregion;
  1163. begin
  1164. end;
  1165. {****************************************************************************
  1166. Initialize Directives
  1167. ****************************************************************************}
  1168. procedure InitScannerDirectives;
  1169. begin
  1170. AddDirective('A1',directive_all, @dir_a1);
  1171. AddDirective('A2',directive_all, @dir_a2);
  1172. AddDirective('A4',directive_all, @dir_a4);
  1173. AddDirective('A8',directive_all, @dir_a8);
  1174. AddDirective('ALIGN',directive_all, @dir_align);
  1175. {$ifdef m68k}
  1176. AddDirective('APPID',directive_all, @dir_appid);
  1177. AddDirective('APPNAME',directive_all, @dir_appname);
  1178. {$endif m68k}
  1179. AddDirective('APPTYPE',directive_all, @dir_apptype);
  1180. AddDirective('ASMMODE',directive_all, @dir_asmmode);
  1181. AddDirective('ASSERTIONS',directive_all, @dir_assertions);
  1182. AddDirective('BOOLEVAL',directive_all, @dir_booleval);
  1183. AddDirective('BITPACKING',directive_all, @dir_bitpacking);
  1184. AddDirective('CALLING',directive_all, @dir_calling);
  1185. AddDirective('CHECKPOINTER',directive_all, @dir_checkpointer);
  1186. AddDirective('CODEALIGN',directive_all, @dir_codealign);
  1187. AddDirective('CODEPAGE',directive_all, @dir_codepage);
  1188. AddDirective('COPERATORS',directive_all, @dir_coperators);
  1189. AddDirective('COPYRIGHT',directive_all, @dir_copyright);
  1190. AddDirective('D',directive_all, @dir_description);
  1191. AddDirective('DEBUGINFO',directive_all, @dir_debuginfo);
  1192. AddDirective('DESCRIPTION',directive_all, @dir_description);
  1193. AddDirective('ENDREGION',directive_all, @dir_endregion);
  1194. AddDirective('ERROR',directive_all, @dir_error);
  1195. AddDirective('ERRORC',directive_mac, @dir_error);
  1196. AddDirective('EXTENDEDSYNTAX',directive_all, @dir_extendedsyntax);
  1197. AddDirective('EXTERNALSYM',directive_all, @dir_externalsym);
  1198. AddDirective('FATAL',directive_all, @dir_fatal);
  1199. AddDirective('FPUTYPE',directive_all, @dir_fputype);
  1200. AddDirective('FRAMEWORKPATH',directive_all, @dir_frameworkpath);
  1201. AddDirective('GOTO',directive_all, @dir_goto);
  1202. AddDirective('HINT',directive_all, @dir_hint);
  1203. AddDirective('HINTS',directive_all, @dir_hints);
  1204. AddDirective('HPPEMIT',directive_all, @dir_hppemit);
  1205. AddDirective('IOCHECKS',directive_all, @dir_iochecks);
  1206. AddDirective('IMAGEBASE',directive_all, @dir_imagebase);
  1207. AddDirective('IMPLICITEXCEPTIONS',directive_all, @dir_implicitexceptions);
  1208. AddDirective('INCLUDEPATH',directive_all, @dir_includepath);
  1209. AddDirective('INFO',directive_all, @dir_info);
  1210. AddDirective('INLINE',directive_all, @dir_inline);
  1211. AddDirective('INTERFACES',directive_all, @dir_interfaces);
  1212. AddDirective('L',directive_all, @dir_link);
  1213. AddDirective('LIBEXPORT',directive_mac, @dir_libexport);
  1214. AddDirective('LIBRARYPATH',directive_all, @dir_librarypath);
  1215. AddDirective('LINK',directive_all, @dir_link);
  1216. AddDirective('LINKFRAMEWORK',directive_all, @dir_linkframework);
  1217. AddDirective('LINKLIB',directive_all, @dir_linklib);
  1218. AddDirective('LOCALSYMBOLS',directive_all, @dir_localsymbols);
  1219. AddDirective('LONGSTRINGS',directive_all, @dir_longstrings);
  1220. AddDirective('M',directive_all, @dir_memory);
  1221. AddDirective('MACRO',directive_all, @dir_macro);
  1222. AddDirective('MAXFPUREGISTERS',directive_all, @dir_maxfpuregisters);
  1223. AddDirective('MAXSTACKSIZE',directive_all, @dir_maxstacksize);
  1224. AddDirective('MEMORY',directive_all, @dir_memory);
  1225. AddDirective('MESSAGE',directive_all, @dir_message);
  1226. AddDirective('MINENUMSIZE',directive_all, @dir_packenum);
  1227. AddDirective('MINFPCONSTPREC',directive_all, @dir_minfpconstprec);
  1228. AddDirective('MINSTACKSIZE',directive_all, @dir_minstacksize);
  1229. AddDirective('MMX',directive_all, @dir_mmx);
  1230. AddDirective('MODE',directive_all, @dir_mode);
  1231. AddDirective('MODESWITCH',directive_all, @dir_modeswitch);
  1232. AddDirective('NODEFINE',directive_all, @dir_nodefine);
  1233. AddDirective('NOTE',directive_all, @dir_note);
  1234. AddDirective('NOTES',directive_all, @dir_notes);
  1235. AddDirective('OBJECTCHECKS',directive_all, @dir_objectchecks);
  1236. AddDirective('OBJECTPATH',directive_all, @dir_objectpath);
  1237. AddDirective('OPENSTRINGS',directive_all, @dir_openstrings);
  1238. AddDirective('OPTIMIZATION',directive_all, @dir_optimization);
  1239. AddDirective('OVERFLOWCHECKS',directive_all, @dir_overflowchecks);
  1240. AddDirective('PACKENUM',directive_all, @dir_packenum);
  1241. AddDirective('PACKRECORDS',directive_all, @dir_packrecords);
  1242. AddDirective('PACKSET',directive_all, @dir_packset);
  1243. AddDirective('PASCALMAINNAME',directive_all, @dir_pascalmainname);
  1244. AddDirective('PIC',directive_all, @dir_pic);
  1245. AddDirective('POP',directive_all, @dir_pop);
  1246. AddDirective('PROFILE',directive_all, @dir_profile);
  1247. AddDirective('PUSH',directive_all, @dir_push);
  1248. AddDirective('R',directive_all, @dir_resource);
  1249. AddDirective('RANGECHECKS',directive_all, @dir_rangechecks);
  1250. AddDirective('REFERENCEINFO',directive_all, @dir_referenceinfo);
  1251. AddDirective('REGION',directive_all, @dir_region);
  1252. AddDirective('RESOURCE',directive_all, @dir_resource);
  1253. AddDirective('SATURATION',directive_all, @dir_saturation);
  1254. AddDirective('SAFEFPUEXCEPTIONS',directive_all, @dir_safefpuexceptions);
  1255. AddDirective('SETPEFLAGS', directive_all, @dir_setpeflags);
  1256. AddDirective('SCREENNAME',directive_all, @dir_screenname);
  1257. AddDirective('SMARTLINK',directive_all, @dir_smartlink);
  1258. AddDirective('STACKFRAMES',directive_all, @dir_stackframes);
  1259. AddDirective('STATIC',directive_all, @dir_static);
  1260. AddDirective('STOP',directive_all, @dir_stop);
  1261. {$ifdef powerpc}
  1262. AddDirective('SYSCALL',directive_all, @dir_syscall);
  1263. {$endif powerpc}
  1264. AddDirective('THREADNAME',directive_all, @dir_threadname);
  1265. AddDirective('TYPEDADDRESS',directive_all, @dir_typedaddress);
  1266. AddDirective('TYPEINFO',directive_all, @dir_typeinfo);
  1267. AddDirective('UNITPATH',directive_all, @dir_unitpath);
  1268. AddDirective('VARSTRINGCHECKS',directive_all, @dir_varstringchecks);
  1269. AddDirective('VERSION',directive_all, @dir_version);
  1270. AddDirective('WAIT',directive_all, @dir_wait);
  1271. AddDirective('WARN',directive_all, @dir_warn);
  1272. AddDirective('WARNING',directive_all, @dir_warning);
  1273. AddDirective('WARNINGS',directive_all, @dir_warnings);
  1274. AddDirective('WEAKPACKAGEUNIT',directive_all, @dir_weakpackageunit);
  1275. AddDirective('WRITEABLECONST',directive_all, @dir_writeableconst);
  1276. AddDirective('Z1',directive_all, @dir_z1);
  1277. AddDirective('Z2',directive_all, @dir_z2);
  1278. AddDirective('Z4',directive_all, @dir_z4);
  1279. end;
  1280. begin
  1281. localswitchesstackpos:= 0;
  1282. end.