scandir.pas 48 KB

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