scandir.pas 46 KB

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