scandir.pas 46 KB

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