scandir.pas 48 KB

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