scandir.pas 46 KB

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