scandir.pas 45 KB

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