scandir.pas 47 KB

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