scandir.pas 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021
  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. systems;
  23. const
  24. switchesstatestackmax = 20;
  25. type
  26. tsavedswitchesstate = record
  27. localsw: tlocalswitches;
  28. verbosity: longint;
  29. pmessage : pmessagestaterecord;
  30. alignment : talignmentinfo;
  31. setalloc,
  32. packenum,
  33. packrecords : shortint;
  34. end;
  35. type
  36. tswitchesstatestack = array[0..switchesstatestackmax] of tsavedswitchesstate;
  37. var
  38. switchesstatestack:tswitchesstatestack;
  39. switchesstatestackpos: Integer;
  40. procedure InitScannerDirectives;
  41. implementation
  42. uses
  43. SysUtils,
  44. cutils,cfileutl,
  45. globals,widestr,cpuinfo,
  46. verbose,comphook,ppu,
  47. scanner,switches,
  48. fmodule,
  49. defutil,
  50. dirparse,link,
  51. syscinfo,
  52. symconst,symtable,symbase,symtype,symsym,
  53. rabase;
  54. {*****************************************************************************
  55. Helpers
  56. *****************************************************************************}
  57. procedure do_delphiswitch(sw:char);
  58. var
  59. state : char;
  60. begin
  61. { c contains the next char, a + or - would be fine }
  62. state:=current_scanner.readstate;
  63. if state in ['-','+'] then
  64. HandleSwitch(sw,state);
  65. end;
  66. procedure do_setverbose(flag:char);
  67. var
  68. state : char;
  69. begin
  70. { support ON/OFF }
  71. state:=current_scanner.ReadState;
  72. recordpendingverbosityswitch(flag,state);
  73. end;
  74. procedure do_moduleswitch(sw:tmoduleswitch);
  75. var
  76. state : char;
  77. begin
  78. state:=current_scanner.readstate;
  79. if (sw<>cs_modulenone) and (state in ['-','+']) then
  80. begin
  81. if state='-' then
  82. exclude(current_settings.moduleswitches,sw)
  83. else
  84. include(current_settings.moduleswitches,sw);
  85. end;
  86. end;
  87. procedure do_localswitch(sw:tlocalswitch);
  88. var
  89. state : char;
  90. begin
  91. state:=current_scanner.readstate;
  92. if (sw<>cs_localnone) and (state in ['-','+']) then
  93. recordpendinglocalswitch(sw,state);
  94. end;
  95. function do_localswitchdefault(sw:tlocalswitch): char;
  96. begin
  97. result:=current_scanner.readstatedefault;
  98. if (sw<>cs_localnone) and (result in ['-','+','*']) then
  99. recordpendinglocalswitch(sw,result);
  100. end;
  101. procedure do_moduleflagswitch(flag:cardinal;optional:boolean);
  102. var
  103. state : char;
  104. begin
  105. if optional then
  106. state:=current_scanner.readoptionalstate('+')
  107. else
  108. state:=current_scanner.readstate;
  109. if state='-' then
  110. current_module.flags:=current_module.flags and not flag
  111. else
  112. current_module.flags:=current_module.flags or flag;
  113. end;
  114. procedure do_message(w:integer);
  115. begin
  116. current_scanner.skipspace;
  117. Message1(w,current_scanner.readcomment);
  118. end;
  119. procedure do_version(out major, minor, revision: word; out verstr: string; allowrevision: boolean; out isset: boolean);
  120. var
  121. majorl,
  122. minorl,
  123. revisionl,
  124. error : longint;
  125. begin
  126. { change description global var in all cases }
  127. { it not used but in win32, os2 and netware }
  128. current_scanner.skipspace;
  129. { we should only accept Major.Minor format for win32 and os2 }
  130. current_scanner.readnumber;
  131. major:=0;
  132. minor:=0;
  133. revision:=0;
  134. verstr:='';
  135. isset:=false;
  136. majorl:=0;
  137. minorl:=0;
  138. revisionl:=0;
  139. val(pattern,majorl,error);
  140. if (error<>0) or (majorl > high(word)) or (majorl < 0) then
  141. begin
  142. Message1(scan_w_wrong_version_ignored,pattern);
  143. exit;
  144. end;
  145. isset:=true;
  146. if c='.' then
  147. begin
  148. current_scanner.readchar;
  149. current_scanner.readnumber;
  150. val(pattern,minorl,error);
  151. if (error<>0) or (minorl > high(word)) or (minorl < 0) then
  152. begin
  153. Message1(scan_w_wrong_version_ignored,tostr(majorl)+'.'+pattern);
  154. exit;
  155. end;
  156. if (c='.') and
  157. allowrevision then
  158. begin
  159. current_scanner.readchar;
  160. current_scanner.readnumber;
  161. val(pattern,revisionl,error);
  162. if (error<>0) or (revisionl > high(word)) or (revisionl < 0) then
  163. begin
  164. Message1(scan_w_wrong_version_ignored,tostr(majorl)+'.'+tostr(minorl)+'.'+pattern);
  165. exit;
  166. end;
  167. major:=word(majorl);
  168. minor:=word(minorl);
  169. revision:=word(revisionl);
  170. verstr:=tostr(major)+','+tostr(minor)+','+tostr(revision);
  171. end
  172. else
  173. begin
  174. major:=word(majorl);
  175. minor:=word(minorl);
  176. verstr:=tostr(major)+'.'+tostr(minor);
  177. end;
  178. end
  179. else
  180. begin
  181. major:=word(majorl);
  182. verstr:=tostr(major);
  183. end;
  184. end;
  185. {*****************************************************************************
  186. Directive Callbacks
  187. *****************************************************************************}
  188. procedure dir_align;
  189. var
  190. hs : string;
  191. b : byte;
  192. begin
  193. current_scanner.skipspace;
  194. if not(c in ['0'..'9']) then
  195. begin
  196. { Support also the ON and OFF as switch }
  197. hs:=current_scanner.readid;
  198. if (hs='ON') then
  199. current_settings.packrecords:=4
  200. else if (hs='OFF') then
  201. current_settings.packrecords:=1
  202. else if m_mac in current_settings.modeswitches then
  203. begin
  204. { Support switches used in Apples Universal Interfaces}
  205. if (hs='MAC68K') then
  206. current_settings.packrecords:=mac68k_alignment
  207. { "power" alignment is the default C packrecords setting on
  208. Mac OS X }
  209. else if (hs='POWER') or (hs='POWERPC') then
  210. current_settings.packrecords:=C_alignment
  211. else if (hs='RESET') then
  212. current_settings.packrecords:=default_settings.packrecords
  213. else
  214. Message1(scan_e_illegal_pack_records,hs);
  215. end
  216. else
  217. Message1(scan_e_illegal_pack_records,hs);
  218. end
  219. else
  220. begin
  221. b:=current_scanner.readval;
  222. case b of
  223. 1 : current_settings.packrecords:=1;
  224. 2 : current_settings.packrecords:=2;
  225. 4 : current_settings.packrecords:=4;
  226. 8 : current_settings.packrecords:=8;
  227. 16 : current_settings.packrecords:=16;
  228. 32 : current_settings.packrecords:=32;
  229. else
  230. Message1(scan_e_illegal_pack_records,tostr(b));
  231. end;
  232. end;
  233. end;
  234. procedure dir_a1;
  235. begin
  236. current_settings.packrecords:=1;
  237. end;
  238. procedure dir_a2;
  239. begin
  240. current_settings.packrecords:=2;
  241. end;
  242. procedure dir_a4;
  243. begin
  244. current_settings.packrecords:=4;
  245. end;
  246. procedure dir_a8;
  247. begin
  248. current_settings.packrecords:=8;
  249. end;
  250. procedure dir_asmcpu;
  251. var
  252. s : string;
  253. cpu: tcputype;
  254. found: Boolean;
  255. begin
  256. current_scanner.skipspace;
  257. s:=current_scanner.readid;
  258. If Inside_asm_statement then
  259. Message1(scan_w_no_asm_reader_switch_inside_asm,s);
  260. if s='ANY' then
  261. current_settings.asmcputype:=cpu_none
  262. else if s='CURRENT' then
  263. current_settings.asmcputype:=current_settings.cputype
  264. else
  265. begin
  266. found:=false;
  267. for cpu:=succ(low(tcputype)) to high(tcputype) do
  268. if s=cputypestr[cpu] then
  269. begin
  270. found:=true;
  271. current_settings.asmcputype:=cpu;
  272. break;
  273. end;
  274. if not found then
  275. Message1(scan_e_illegal_asmcpu_specifier,s);
  276. end;
  277. end;
  278. procedure dir_asmmode;
  279. var
  280. s : string;
  281. begin
  282. current_scanner.skipspace;
  283. s:=current_scanner.readid;
  284. If Inside_asm_statement then
  285. Message1(scan_w_no_asm_reader_switch_inside_asm,s);
  286. if s='DEFAULT' then
  287. current_settings.asmmode:=init_settings.asmmode
  288. else
  289. if not SetAsmReadMode(s,current_settings.asmmode) then
  290. Message1(scan_e_illegal_asmmode_specifier,s);
  291. end;
  292. {$if defined(m68k) or defined(arm)}
  293. procedure dir_appid;
  294. begin
  295. if target_info.system<>system_m68k_palmos then
  296. Message(scan_w_appid_not_support);
  297. { change description global var in all cases }
  298. { it not used but in win32 and os2 }
  299. current_scanner.skipspace;
  300. palmos_applicationid:=current_scanner.readcomment;
  301. end;
  302. procedure dir_appname;
  303. begin
  304. if target_info.system<>system_m68k_palmos then
  305. Message(scan_w_appname_not_support);
  306. { change description global var in all cases }
  307. { it not used but in win32 and os2 }
  308. current_scanner.skipspace;
  309. palmos_applicationname:=current_scanner.readcomment;
  310. end;
  311. {$endif defined(m68k) or defined(arm)}
  312. procedure dir_apptype;
  313. var
  314. hs : string;
  315. begin
  316. if not (target_info.system in systems_all_windows + [system_i386_os2,
  317. system_i386_emx, system_powerpc_macos,
  318. system_arm_nds, system_i8086_msdos,
  319. system_i8086_embedded, system_m68k_atari] +
  320. systems_nativent) then
  321. begin
  322. if m_delphi in current_settings.modeswitches then
  323. Message(scan_n_app_type_not_support)
  324. else
  325. Message(scan_w_app_type_not_support);
  326. end
  327. else
  328. begin
  329. if not current_module.in_global then
  330. Message(scan_w_switch_is_global)
  331. else
  332. begin
  333. current_scanner.skipspace;
  334. hs:=current_scanner.readid;
  335. if (hs='GUI') and not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  336. SetApptype(app_gui)
  337. else if (hs='CONSOLE') and not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  338. SetApptype(app_cui)
  339. else if (hs='NATIVE') and (target_info.system in systems_windows + systems_nativent) then
  340. SetApptype(app_native)
  341. else if (hs='FS') and (target_info.system in [system_i386_os2,
  342. system_i386_emx]) then
  343. SetApptype(app_fs)
  344. else if (hs='TOOL') and (target_info.system in [system_powerpc_macos]) then
  345. SetApptype(app_tool)
  346. else if (hs='ARM9') and (target_info.system in [system_arm_nds]) then
  347. SetApptype(app_arm9)
  348. else if (hs='ARM7') and (target_info.system in [system_arm_nds]) then
  349. SetApptype(app_arm7)
  350. else if (hs='COM') and (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  351. SetApptype(app_com)
  352. else if (hs='EXE') and (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  353. SetApptype(app_cui)
  354. else
  355. Message1(scan_w_unsupported_app_type,hs);
  356. end;
  357. end;
  358. end;
  359. procedure dir_calling;
  360. var
  361. hs : string;
  362. begin
  363. current_scanner.skipspace;
  364. hs:=current_scanner.readid;
  365. if (hs='') then
  366. Message(parser_e_proc_directive_expected)
  367. else
  368. recordpendingcallingswitch(hs);
  369. end;
  370. procedure dir_checklowaddrloads;
  371. begin
  372. do_localswitchdefault(cs_check_low_addr_load);
  373. end;
  374. procedure dir_checkpointer;
  375. var
  376. switch: char;
  377. begin
  378. switch:=do_localswitchdefault(cs_checkpointer);
  379. if (switch='+') and
  380. not(target_info.system in systems_support_checkpointer) then
  381. Message1(scan_e_unsupported_switch,'CHECKPOINTER+');
  382. end;
  383. procedure dir_excessprecision;
  384. begin
  385. do_localswitch(cs_excessprecision);
  386. end;
  387. procedure dir_objectchecks;
  388. begin
  389. do_localswitch(cs_check_object);
  390. end;
  391. procedure dir_ieeeerrors;
  392. begin
  393. do_localswitch(cs_ieee_errors);
  394. end;
  395. procedure dir_assertions;
  396. begin
  397. do_delphiswitch('C');
  398. end;
  399. procedure dir_booleval;
  400. begin
  401. do_delphiswitch('B');
  402. end;
  403. procedure dir_debuginfo;
  404. begin
  405. do_delphiswitch('D');
  406. end;
  407. procedure dir_denypackageunit;
  408. begin
  409. do_moduleflagswitch(uf_package_deny,true);
  410. end;
  411. procedure dir_description;
  412. begin
  413. if not (target_info.system in systems_all_windows+[system_i386_os2,system_i386_emx,
  414. system_i386_netware,system_i386_wdosx,system_i386_netwlibc]) then
  415. Message(scan_w_description_not_support);
  416. { change description global var in all cases }
  417. { it not used but in win32, os2 and netware }
  418. current_scanner.skipspace;
  419. description:=current_scanner.readcomment;
  420. DescriptionSetExplicity:=true;
  421. end;
  422. procedure dir_screenname; {ad}
  423. begin
  424. if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  425. {Message(scan_w_decription_not_support);}
  426. comment (V_Warning,'Screenname only supported for target netware');
  427. current_scanner.skipspace;
  428. nwscreenname:=current_scanner.readcomment;
  429. end;
  430. procedure dir_threadname; {ad}
  431. begin
  432. if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  433. {Message(scan_w_decription_not_support);}
  434. comment (V_Warning,'Threadname only supported for target netware');
  435. current_scanner.skipspace;
  436. nwthreadname:=current_scanner.readcomment;
  437. end;
  438. procedure dir_copyright; {ad}
  439. begin
  440. if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  441. {Message(scan_w_decription_not_support);}
  442. comment (V_Warning,'Copyright only supported for target netware');
  443. current_scanner.skipspace;
  444. nwcopyright:=current_scanner.readcomment;
  445. end;
  446. procedure dir_error;
  447. begin
  448. do_message(scan_e_user_defined);
  449. end;
  450. procedure dir_extendedsyntax;
  451. begin
  452. do_delphiswitch('X');
  453. end;
  454. procedure dir_forcefarcalls;
  455. begin
  456. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded])
  457. {$ifdef i8086}
  458. or (current_settings.x86memorymodel in x86_near_code_models)
  459. {$endif i8086}
  460. then
  461. begin
  462. Message1(scan_n_ignored_switch,pattern);
  463. exit;
  464. end;
  465. do_localswitch(cs_force_far_calls);
  466. end;
  467. procedure dir_fatal;
  468. begin
  469. do_message(scan_f_user_defined);
  470. end;
  471. procedure dir_fputype;
  472. begin
  473. current_scanner.skipspace;
  474. undef_system_macro('FPU'+fputypestr[current_settings.fputype]);
  475. if not(SetFPUType(upper(current_scanner.readcomment),current_settings.fputype)) then
  476. comment(V_Error,'Illegal FPU type');
  477. def_system_macro('FPU'+fputypestr[current_settings.fputype]);
  478. end;
  479. procedure dir_frameworkpath;
  480. begin
  481. if not current_module.in_global then
  482. Message(scan_w_switch_is_global)
  483. else if not(target_info.system in systems_darwin) then
  484. begin
  485. Message(scan_w_frameworks_darwin_only);
  486. current_scanner.skipspace;
  487. current_scanner.readcomment
  488. end
  489. else
  490. begin
  491. current_scanner.skipspace;
  492. current_module.localframeworksearchpath.AddPath(current_scanner.readcomment,false);
  493. end;
  494. end;
  495. procedure dir_goto;
  496. begin
  497. do_moduleswitch(cs_support_goto);
  498. end;
  499. procedure dir_hint;
  500. begin
  501. do_message(scan_h_user_defined);
  502. end;
  503. procedure dir_hints;
  504. begin
  505. do_setverbose('H');
  506. end;
  507. procedure dir_imagebase;
  508. begin
  509. if not (target_info.system in (systems_windows+systems_wince)) then
  510. Message(scan_w_imagebase_not_support);
  511. current_scanner.skipspace;
  512. imagebase:=current_scanner.readval;
  513. ImageBaseSetExplicity:=true
  514. end;
  515. procedure dir_implicitexceptions;
  516. begin
  517. do_moduleswitch(cs_implicit_exceptions);
  518. end;
  519. procedure dir_importeddata;
  520. begin
  521. do_delphiswitch('G');
  522. end;
  523. procedure dir_includepath;
  524. begin
  525. if not current_module.in_global then
  526. Message(scan_w_switch_is_global)
  527. else
  528. begin
  529. current_scanner.skipspace;
  530. current_module.localincludesearchpath.AddPath(current_scanner.readcomment,false);
  531. end;
  532. end;
  533. procedure dir_info;
  534. begin
  535. do_message(scan_i_user_defined);
  536. end;
  537. procedure dir_inline;
  538. begin
  539. do_localswitch(cs_do_inline);
  540. end;
  541. procedure dir_interfaces;
  542. var
  543. hs : string;
  544. begin
  545. {corba/com/default}
  546. current_scanner.skipspace;
  547. hs:=current_scanner.readid;
  548. {$ifndef jvm}
  549. if (hs='CORBA') then
  550. current_settings.interfacetype:=it_interfacecorba
  551. else if (hs='COM') then
  552. current_settings.interfacetype:=it_interfacecom
  553. else
  554. {$endif jvm}
  555. if (hs='DEFAULT') then
  556. current_settings.interfacetype:=init_settings.interfacetype
  557. else
  558. Message(scan_e_invalid_interface_type);
  559. end;
  560. procedure dir_iochecks;
  561. begin
  562. do_delphiswitch('I');
  563. end;
  564. procedure dir_libexport;
  565. begin
  566. {not implemented}
  567. end;
  568. procedure dir_librarypath;
  569. begin
  570. if not current_module.in_global then
  571. Message(scan_w_switch_is_global)
  572. else
  573. begin
  574. current_scanner.skipspace;
  575. current_module.locallibrarysearchpath.AddPath(current_scanner.readcomment,false);
  576. end;
  577. end;
  578. procedure dir_link;
  579. var
  580. s : string;
  581. begin
  582. current_scanner.skipspace;
  583. if scanner.c = '''' then
  584. begin
  585. s:= current_scanner.readquotedstring;
  586. current_scanner.readcomment
  587. end
  588. else
  589. s:= trimspace(current_scanner.readcomment);
  590. s:=FixFileName(s);
  591. if ExtractFileExt(s)='' then
  592. s:=ChangeFileExt(s,target_info.objext);
  593. current_module.linkotherofiles.add(s,link_always);
  594. end;
  595. procedure dir_linkframework;
  596. var
  597. s : string;
  598. begin
  599. current_scanner.skipspace;
  600. if scanner.c = '''' then
  601. begin
  602. s:= current_scanner.readquotedstring;
  603. current_scanner.readcomment
  604. end
  605. else
  606. s:= trimspace(current_scanner.readcomment);
  607. s:=FixFileName(s);
  608. if (target_info.system in systems_darwin) then
  609. current_module.linkotherframeworks.add(s,link_always)
  610. else
  611. Message(scan_w_frameworks_darwin_only);
  612. end;
  613. procedure dir_linklib;
  614. type
  615. tLinkMode=(lm_shared,lm_static);
  616. var
  617. s : string;
  618. quote : char;
  619. libext,
  620. libname,
  621. linkmodestr : string;
  622. p : longint;
  623. linkMode : tLinkMode;
  624. begin
  625. current_scanner.skipspace;
  626. if scanner.c = '''' then
  627. begin
  628. libname:= current_scanner.readquotedstring;
  629. s:= current_scanner.readcomment;
  630. p:=pos(',',s);
  631. end
  632. else
  633. begin
  634. s:= current_scanner.readcomment;
  635. p:=pos(',',s);
  636. if p=0 then
  637. libname:=TrimSpace(s)
  638. else
  639. libname:=TrimSpace(copy(s,1,p-1));
  640. end;
  641. if p=0 then
  642. linkmodeStr:=''
  643. else
  644. linkmodeStr:=Upper(TrimSpace(copy(s,p+1,255)));
  645. if (libname='') or (libname='''''') or (libname='""') then
  646. exit;
  647. { create library name }
  648. if libname[1] in ['''','"'] then
  649. begin
  650. quote:=libname[1];
  651. Delete(libname,1,1);
  652. p:=pos(quote,libname);
  653. if p>0 then
  654. Delete(libname,p,1);
  655. end;
  656. libname:=FixFileName(libname);
  657. { get linkmode, default is to check the extension for
  658. the static library, otherwise shared linking is assumed }
  659. linkmode:=lm_shared;
  660. if linkModeStr='' then
  661. begin
  662. libext:=ExtractFileExt(libname);
  663. if libext=target_info.staticClibext then
  664. linkMode:=lm_static;
  665. end
  666. else if linkModeStr='STATIC' then
  667. linkmode:=lm_static
  668. else if (LinkModeStr='SHARED') or (LinkModeStr='') then
  669. linkmode:=lm_shared
  670. else
  671. Comment(V_Error,'Wrong link mode specified: "'+Linkmodestr+'"');
  672. { add to the list of other libraries }
  673. if linkMode=lm_static then
  674. current_module.linkOtherStaticLibs.add(libname,link_always)
  675. else
  676. current_module.linkOtherSharedLibs.add(libname,link_always);
  677. end;
  678. procedure dir_localsymbols;
  679. begin
  680. do_delphiswitch('L');
  681. end;
  682. procedure dir_longstrings;
  683. begin
  684. do_delphiswitch('H');
  685. end;
  686. procedure dir_macro;
  687. begin
  688. do_moduleswitch(cs_support_macro);
  689. end;
  690. procedure dir_pascalmainname;
  691. var
  692. s: string;
  693. begin
  694. current_scanner.skipspace;
  695. s:=trimspace(current_scanner.readcomment);
  696. if assigned(current_module.mainname) and
  697. (s<>current_module.mainname^) then
  698. begin
  699. Message1(scan_w_multiple_main_name_overrides,current_module.mainname^);
  700. stringdispose(current_module.mainname)
  701. end
  702. else if (mainaliasname<>defaultmainaliasname) and
  703. (mainaliasname<>s) then
  704. Message1(scan_w_multiple_main_name_overrides,mainaliasname);
  705. mainaliasname:=s;
  706. if (mainaliasname<>defaultmainaliasname) then
  707. current_module.mainname:=stringdup(mainaliasname);
  708. end;
  709. procedure dir_maxfpuregisters;
  710. var
  711. l : integer;
  712. hs : string;
  713. begin
  714. current_scanner.skipspace;
  715. if not(c in ['0'..'9']) then
  716. begin
  717. hs:=current_scanner.readid;
  718. if (hs='NORMAL') or (hs='DEFAULT') then
  719. current_settings.maxfpuregisters:=-1
  720. else
  721. Message(scan_e_invalid_maxfpureg_value);
  722. end
  723. else
  724. begin
  725. l:=current_scanner.readval;
  726. case l of
  727. 0..8:
  728. current_settings.maxfpuregisters:=l;
  729. else
  730. Message(scan_e_invalid_maxfpureg_value);
  731. end;
  732. end;
  733. end;
  734. procedure dir_maxstacksize;
  735. begin
  736. if not (target_info.system in (systems_windows+systems_wince)) then
  737. Message(scan_w_maxstacksize_not_support);
  738. current_scanner.skipspace;
  739. maxstacksize:=current_scanner.readval;
  740. MaxStackSizeSetExplicity:=true;
  741. end;
  742. procedure dir_memory;
  743. var
  744. l : longint;
  745. heapsize_limit: longint;
  746. maxheapsize_limit: longint;
  747. begin
  748. {$if defined(i8086)}
  749. if current_settings.x86memorymodel in x86_far_data_models then
  750. begin
  751. heapsize_limit:=655360;
  752. maxheapsize_limit:=655360;
  753. end
  754. else
  755. begin
  756. heapsize_limit:=65520;
  757. maxheapsize_limit:=65520;
  758. end;
  759. {$elseif defined(cpu16bitaddr)}
  760. heapsize_limit:=65520;
  761. maxheapsize_limit:=65520;
  762. {$else}
  763. heapsize_limit:=high(heapsize);
  764. maxheapsize_limit:=high(maxheapsize);
  765. {$endif}
  766. current_scanner.skipspace;
  767. l:=current_scanner.readval;
  768. if (l>=1024)
  769. {$ifdef cpu16bitaddr}
  770. and (l<=65521) { TP7's $M directive allows specifying a stack size of
  771. 65521, but it actually sets the stack size to 65520 }
  772. {$else cpu16bitaddr}
  773. and (l<67107840)
  774. {$endif cpu16bitaddr}
  775. then
  776. stacksize:=min(l,{$ifdef cpu16bitaddr}65520{$else}67107839{$endif})
  777. else
  778. Message(scan_w_invalid_stacksize);
  779. if c=',' then
  780. begin
  781. current_scanner.readchar;
  782. current_scanner.skipspace;
  783. l:=current_scanner.readval;
  784. if l>=1024 then
  785. heapsize:=min(l,heapsize_limit);
  786. if c=',' then
  787. begin
  788. current_scanner.readchar;
  789. current_scanner.skipspace;
  790. l:=current_scanner.readval;
  791. if l>=heapsize then
  792. maxheapsize:=min(l,maxheapsize_limit)
  793. else
  794. Message(scan_w_heapmax_lessthan_heapmin);
  795. end;
  796. end;
  797. end;
  798. procedure dir_message;
  799. var
  800. hs : string;
  801. w : longint;
  802. begin
  803. w:=0;
  804. current_scanner.skipspace;
  805. { Message level specified? }
  806. if c='''' then
  807. w:=scan_n_user_defined
  808. else
  809. begin
  810. hs:=current_scanner.readid;
  811. if (hs='WARN') or (hs='WARNING') then
  812. w:=scan_w_user_defined
  813. else
  814. if (hs='ERROR') then
  815. w:=scan_e_user_defined
  816. else
  817. if (hs='FATAL') then
  818. w:=scan_f_user_defined
  819. else
  820. if (hs='HINT') then
  821. w:=scan_h_user_defined
  822. else
  823. if (hs='NOTE') then
  824. w:=scan_n_user_defined
  825. else
  826. if (hs='INFO') then
  827. w:=scan_i_user_defined
  828. else
  829. Message1(scan_w_illegal_directive,hs);
  830. end;
  831. { Only print message when there was no error }
  832. if w<>0 then
  833. begin
  834. current_scanner.skipspace;
  835. if c='''' then
  836. hs:=current_scanner.readquotedstring
  837. else
  838. hs:=current_scanner.readcomment;
  839. Message1(w,hs);
  840. end
  841. else
  842. current_scanner.readcomment;
  843. end;
  844. procedure dir_minstacksize;
  845. begin
  846. if not (target_info.system in (systems_windows+systems_wince)) then
  847. Message(scan_w_minstacksize_not_support);
  848. current_scanner.skipspace;
  849. minstacksize:=current_scanner.readval;
  850. MinStackSizeSetExplicity:=true;
  851. end;
  852. procedure dir_mode;
  853. begin
  854. if not current_module.in_global then
  855. Message(scan_w_switch_is_global)
  856. else
  857. begin
  858. current_scanner.skipspace;
  859. current_scanner.readstring;
  860. if not current_module.mode_switch_allowed and
  861. not ((m_mac in current_settings.modeswitches) and (pattern='MACPAS')) then
  862. Message1(scan_e_mode_switch_not_allowed,pattern)
  863. else if not SetCompileMode(pattern,false) then
  864. Message1(scan_w_illegal_switch,pattern)
  865. end;
  866. current_module.mode_switch_allowed:= false;
  867. end;
  868. procedure dir_modeswitch;
  869. var
  870. s : string;
  871. begin
  872. if not current_module.in_global then
  873. Message(scan_w_switch_is_global)
  874. else
  875. begin
  876. current_scanner.skipspace;
  877. current_scanner.readstring;
  878. s:=pattern;
  879. { don't combine the assignments to s as the method call will be
  880. done before "pattern" is assigned to s and the method changes
  881. "pattern" }
  882. s:=s+current_scanner.readoptionalstate('+');
  883. if not SetCompileModeSwitch(s,false) then
  884. Message1(scan_w_illegal_switch,s)
  885. end;
  886. end;
  887. procedure dir_namespace;
  888. var
  889. s : string;
  890. begin
  891. { used to define Java package names for all types declared in the
  892. current unit }
  893. if not current_module.in_global then
  894. Message(scan_w_switch_is_global)
  895. else
  896. begin
  897. current_scanner.skipspace;
  898. current_scanner.readstring;
  899. s:=orgpattern;
  900. while c='.' do
  901. begin
  902. current_scanner.readchar;
  903. current_scanner.readstring;
  904. s:=s+'.'+orgpattern;
  905. end;
  906. disposestr(current_module.namespace);
  907. current_module.namespace:=stringdup(s);
  908. end;
  909. end;
  910. procedure dir_mmx;
  911. begin
  912. do_localswitch(cs_mmx);
  913. end;
  914. procedure dir_note;
  915. begin
  916. do_message(scan_n_user_defined);
  917. end;
  918. procedure dir_notes;
  919. begin
  920. do_setverbose('N');
  921. end;
  922. procedure dir_objectpath;
  923. begin
  924. if not current_module.in_global then
  925. Message(scan_w_switch_is_global)
  926. else
  927. begin
  928. current_scanner.skipspace;
  929. current_module.localobjectsearchpath.AddPath(current_scanner.readcomment,false);
  930. end;
  931. end;
  932. procedure dir_openstrings;
  933. begin
  934. do_delphiswitch('P');
  935. end;
  936. procedure dir_optimization;
  937. var
  938. hs : string;
  939. begin
  940. current_scanner.skipspace;
  941. { Support also the ON and OFF as switch }
  942. hs:=current_scanner.readid;
  943. if (hs='ON') then
  944. current_settings.optimizerswitches:=level2optimizerswitches
  945. else if (hs='OFF') then
  946. current_settings.optimizerswitches:=[]
  947. else if (hs='DEFAULT') then
  948. current_settings.optimizerswitches:=init_settings.optimizerswitches
  949. else
  950. begin
  951. if not UpdateOptimizerStr(hs,current_settings.optimizerswitches) then
  952. Message1(scan_e_illegal_optimization_specifier,hs);
  953. end;
  954. end;
  955. procedure dir_overflowchecks;
  956. begin
  957. do_delphiswitch('Q');
  958. end;
  959. procedure dir_packenum;
  960. var
  961. hs : string;
  962. begin
  963. current_scanner.skipspace;
  964. if not(c in ['0'..'9']) then
  965. begin
  966. hs:=current_scanner.readid;
  967. if (hs='NORMAL') or (hs='DEFAULT') then
  968. current_settings.packenum:=4
  969. else
  970. Message1(scan_e_illegal_pack_enum, hs);
  971. end
  972. else
  973. begin
  974. case current_scanner.readval of
  975. 1 : current_settings.packenum:=1;
  976. 2 : current_settings.packenum:=2;
  977. 4 : current_settings.packenum:=4;
  978. else
  979. Message1(scan_e_illegal_pack_enum, pattern);
  980. end;
  981. end;
  982. end;
  983. procedure dir_minfpconstprec;
  984. begin
  985. current_scanner.skipspace;
  986. if not SetMinFPConstPrec(current_scanner.readid,current_settings.minfpconstprec) then
  987. Message1(scan_e_illegal_minfpconstprec, pattern);
  988. end;
  989. procedure dir_packrecords;
  990. var
  991. hs : string;
  992. begin
  993. { can't change packrecords setting on managed vm targets }
  994. if target_info.system in systems_managed_vm then
  995. Message1(scanner_w_directive_ignored_on_target, 'PACKRECORDS');
  996. current_scanner.skipspace;
  997. if not(c in ['0'..'9']) then
  998. begin
  999. hs:=current_scanner.readid;
  1000. { C has the special recordalignmax of C_alignment }
  1001. if (hs='C') then
  1002. current_settings.packrecords:=C_alignment
  1003. else
  1004. if (hs='NORMAL') or (hs='DEFAULT') then
  1005. current_settings.packrecords:=default_settings.packrecords
  1006. else
  1007. Message1(scan_e_illegal_pack_records,hs);
  1008. end
  1009. else
  1010. begin
  1011. case current_scanner.readval of
  1012. 1 : current_settings.packrecords:=1;
  1013. 2 : current_settings.packrecords:=2;
  1014. 4 : current_settings.packrecords:=4;
  1015. 8 : current_settings.packrecords:=8;
  1016. 16 : current_settings.packrecords:=16;
  1017. 32 : current_settings.packrecords:=32;
  1018. else
  1019. Message1(scan_e_illegal_pack_records,pattern);
  1020. end;
  1021. end;
  1022. end;
  1023. procedure dir_packset;
  1024. var
  1025. hs : string;
  1026. begin
  1027. current_scanner.skipspace;
  1028. if not(c in ['1','2','4','8']) then
  1029. begin
  1030. hs:=current_scanner.readid;
  1031. if (hs='FIXED') or (hs='DEFAULT') OR (hs='NORMAL') then
  1032. current_settings.setalloc:=0 {Fixed mode, sets are 4 or 32 bytes}
  1033. else
  1034. Message(scan_e_only_packset);
  1035. end
  1036. else
  1037. begin
  1038. case current_scanner.readval of
  1039. 1 : current_settings.setalloc:=1;
  1040. 2 : current_settings.setalloc:=2;
  1041. 4 : current_settings.setalloc:=4;
  1042. 8 : current_settings.setalloc:=8;
  1043. else
  1044. Message(scan_e_only_packset);
  1045. end;
  1046. end;
  1047. end;
  1048. procedure dir_pic;
  1049. begin
  1050. { windows doesn't need/support pic }
  1051. if tf_no_pic_supported in target_info.flags then
  1052. message(scan_w_pic_ignored)
  1053. else
  1054. do_moduleswitch(cs_create_pic);
  1055. end;
  1056. procedure dir_pop;
  1057. begin
  1058. if switchesstatestackpos < 1 then
  1059. Message(scan_e_too_many_pop);
  1060. Dec(switchesstatestackpos);
  1061. recordpendinglocalfullswitch(switchesstatestack[switchesstatestackpos].localsw);
  1062. recordpendingverbosityfullswitch(switchesstatestack[switchesstatestackpos].verbosity);
  1063. recordpendingalignmentfullswitch(switchesstatestack[switchesstatestackpos].alignment);
  1064. recordpendingpackenum(switchesstatestack[switchesstatestackpos].packenum);
  1065. recordpendingpackrecords(switchesstatestack[switchesstatestackpos].packrecords);
  1066. recordpendingsetalloc(switchesstatestack[switchesstatestackpos].setalloc);
  1067. pendingstate.nextmessagerecord:=switchesstatestack[switchesstatestackpos].pmessage;
  1068. { Reset verbosity and forget previous pmeesage }
  1069. RestoreLocalVerbosity(nil);
  1070. current_settings.pmessage:=nil;
  1071. { Do not yet activate these changes, as otherwise
  1072. you get problem idf you put a $pop just right after
  1073. a addition for instance fro which you explicitly truned the overflow check
  1074. out by using $Q- after a $push PM 2012-08-29 }
  1075. // flushpendingswitchesstate;
  1076. end;
  1077. procedure dir_pointermath;
  1078. begin
  1079. do_localswitch(cs_pointermath);
  1080. end;
  1081. procedure dir_profile;
  1082. begin
  1083. do_moduleswitch(cs_profile);
  1084. { defined/undefine FPC_PROFILE }
  1085. if cs_profile in current_settings.moduleswitches then
  1086. def_system_macro('FPC_PROFILE')
  1087. else
  1088. undef_system_macro('FPC_PROFILE');
  1089. end;
  1090. procedure dir_push;
  1091. begin
  1092. if switchesstatestackpos > switchesstatestackmax then
  1093. Message(scan_e_too_many_push);
  1094. flushpendingswitchesstate;
  1095. switchesstatestack[switchesstatestackpos].localsw:= current_settings.localswitches;
  1096. switchesstatestack[switchesstatestackpos].pmessage:= current_settings.pmessage;
  1097. switchesstatestack[switchesstatestackpos].verbosity:=status.verbosity;
  1098. switchesstatestack[switchesstatestackpos].alignment:=current_settings.alignment;
  1099. switchesstatestack[switchesstatestackpos].setalloc:=current_settings.setalloc;
  1100. switchesstatestack[switchesstatestackpos].packenum:=current_settings.packenum;
  1101. switchesstatestack[switchesstatestackpos].packrecords:=current_settings.packrecords;
  1102. Inc(switchesstatestackpos);
  1103. end;
  1104. procedure dir_rangechecks;
  1105. begin
  1106. do_delphiswitch('R');
  1107. end;
  1108. procedure dir_referenceinfo;
  1109. begin
  1110. do_delphiswitch('Y');
  1111. end;
  1112. procedure dir_resource;
  1113. var
  1114. s : string;
  1115. begin
  1116. current_scanner.skipspace;
  1117. if scanner.c = '''' then
  1118. begin
  1119. s:= current_scanner.readquotedstring;
  1120. current_scanner.readcomment
  1121. end
  1122. else
  1123. s:= trimspace(current_scanner.readcomment);
  1124. { replace * with the name of the main source.
  1125. This should always be defined. }
  1126. if s[1]='*' then
  1127. if Assigned(Current_Module) then
  1128. begin
  1129. delete(S,1,1);
  1130. insert(ChangeFileExt(ExtractFileName(current_module.mainsource),''),S,1 );
  1131. end;
  1132. s:=FixFileName(s);
  1133. if ExtractFileExt(s)='' then
  1134. s:=ChangeFileExt(s,target_info.resext);
  1135. if target_info.res<>res_none then
  1136. begin
  1137. current_module.flags:=current_module.flags or uf_has_resourcefiles;
  1138. if (res_single_file in target_res.resflags) and
  1139. not (Current_module.ResourceFiles.Empty) then
  1140. Message(scan_w_only_one_resourcefile_supported)
  1141. else
  1142. current_module.resourcefiles.insert(FixFileName(s));
  1143. end
  1144. else
  1145. Message(scan_e_resourcefiles_not_supported);
  1146. end;
  1147. procedure dir_saturation;
  1148. begin
  1149. do_localswitch(cs_mmx_saturation);
  1150. end;
  1151. procedure dir_safefpuexceptions;
  1152. begin
  1153. do_localswitch(cs_fpu_fwait);
  1154. end;
  1155. procedure dir_scopedenums;
  1156. begin
  1157. do_localswitch(cs_scopedenums);
  1158. end;
  1159. function get_peflag_const(const ident:string;error:longint):longint;
  1160. var
  1161. srsym : tsym;
  1162. srsymtable : tsymtable;
  1163. begin
  1164. result:=0;
  1165. if searchsym(ident,srsym,srsymtable) then
  1166. if (srsym.typ=constsym) and
  1167. (tconstsym(srsym).consttyp=constord) and
  1168. is_integer(tconstsym(srsym).constdef) then
  1169. with tconstsym(srsym).value.valueord do
  1170. if signed then
  1171. result:=tconstsym(srsym).value.valueord.svalue
  1172. else
  1173. result:=tconstsym(srsym).value.valueord.uvalue
  1174. else
  1175. message(error)
  1176. else
  1177. message1(sym_e_id_not_found,ident);
  1178. end;
  1179. procedure dir_setpeflags;
  1180. var
  1181. ident : string;
  1182. begin
  1183. if not (target_info.system in (systems_all_windows)) then
  1184. Message(scan_w_setpeflags_not_support);
  1185. current_scanner.skipspace;
  1186. ident:=current_scanner.readid;
  1187. if ident<>'' then
  1188. peflags:=peflags or get_peflag_const(ident,scan_e_illegal_peflag)
  1189. else
  1190. peflags:=peflags or current_scanner.readval;
  1191. SetPEFlagsSetExplicity:=true;
  1192. end;
  1193. procedure dir_setpeoptflags;
  1194. var
  1195. ident : string;
  1196. begin
  1197. if not (target_info.system in (systems_all_windows)) then
  1198. Message(scan_w_setpeoptflags_not_support);
  1199. current_scanner.skipspace;
  1200. ident:=current_scanner.readid;
  1201. if ident<>'' then
  1202. peoptflags:=peoptflags or get_peflag_const(ident,scan_e_illegal_peoptflag)
  1203. else
  1204. peoptflags:=peoptflags or current_scanner.readval;
  1205. SetPEOptFlagsSetExplicity:=true;
  1206. end;
  1207. procedure dir_setpeuserversion;
  1208. var
  1209. dummystr : string;
  1210. dummyrev : word;
  1211. begin
  1212. if not (target_info.system in systems_all_windows) then
  1213. Message(scan_w_setpeuserversion_not_support);
  1214. if (compile_level<>1) then
  1215. Message(scan_n_only_exe_version)
  1216. else
  1217. do_version(peuserversionmajor,peuserversionminor,dummyrev,dummystr,false,SetPEUserVersionSetExplicitely);
  1218. end;
  1219. procedure dir_setpeosversion;
  1220. var
  1221. dummystr : string;
  1222. dummyrev : word;
  1223. begin
  1224. if not (target_info.system in systems_all_windows) then
  1225. Message(scan_w_setpeosversion_not_support);
  1226. if (compile_level<>1) then
  1227. Message(scan_n_only_exe_version)
  1228. else
  1229. do_version(peosversionmajor,peosversionminor,dummyrev,dummystr,false,SetPEOSVersionSetExplicitely);
  1230. end;
  1231. procedure dir_setpesubsysversion;
  1232. var
  1233. dummystr : string;
  1234. dummyrev : word;
  1235. begin
  1236. if not (target_info.system in systems_all_windows) then
  1237. Message(scan_w_setpesubsysversion_not_support);
  1238. if (compile_level<>1) then
  1239. Message(scan_n_only_exe_version)
  1240. else
  1241. do_version(pesubsysversionmajor,pesubsysversionminor,dummyrev,dummystr,false,SetPESubSysVersionSetExplicitely);
  1242. end;
  1243. procedure dir_smartlink;
  1244. begin
  1245. do_moduleswitch(cs_create_smart);
  1246. if (target_dbg.id in [dbg_dwarf2,dbg_dwarf3]) and
  1247. not(target_info.system in (systems_darwin+[system_i8086_msdos,system_i8086_embedded])) and
  1248. { smart linking does not yet work with DWARF debug info on most targets }
  1249. (cs_create_smart in current_settings.moduleswitches) and
  1250. not (af_outputbinary in target_asm.flags) then
  1251. begin
  1252. Message(option_dwarf_smart_linking);
  1253. Exclude(current_settings.moduleswitches,cs_create_smart);
  1254. end;
  1255. { Also create a smartlinked version, on an assembler that
  1256. does not support smartlink sections like nasm?
  1257. This is not compatible with using internal linker. }
  1258. if ((cs_link_smart in current_settings.globalswitches) or
  1259. (cs_create_smart in current_settings.moduleswitches)) and
  1260. (af_needar in target_asm.flags) and
  1261. not (af_smartlink_sections in target_asm.flags) and
  1262. not (cs_link_extern in current_settings.globalswitches) then
  1263. begin
  1264. DoneLinker;
  1265. Message(option_smart_link_requires_external_linker);
  1266. include(current_settings.globalswitches,cs_link_extern);
  1267. InitLinker;
  1268. end
  1269. end;
  1270. procedure dir_stackframes;
  1271. begin
  1272. do_delphiswitch('W');
  1273. end;
  1274. procedure dir_stop;
  1275. begin
  1276. do_message(scan_f_user_defined);
  1277. end;
  1278. procedure dir_stringchecks;
  1279. begin
  1280. // Delphi adds checks that ansistring and unicodestring are correct in
  1281. // different places. Skip it for now.
  1282. end;
  1283. procedure dir_syscall;
  1284. var
  1285. sctype : string;
  1286. syscall : psyscallinfo;
  1287. begin
  1288. current_scanner.skipspace;
  1289. sctype:=current_scanner.readid;
  1290. syscall:=get_syscall_by_name(sctype);
  1291. if assigned(syscall) then
  1292. begin
  1293. if not (target_info.system in syscall^.validon) then
  1294. Message(scan_w_syscall_convention_not_useable_on_target)
  1295. else
  1296. set_default_syscall(syscall^.procoption);
  1297. exit;
  1298. end;
  1299. Message(scan_w_syscall_convention_invalid);
  1300. end;
  1301. procedure dir_targetswitch;
  1302. var
  1303. name, value: string;
  1304. begin
  1305. { note: *not* recorded in the tokenstream, so not replayed for generics }
  1306. current_scanner.skipspace;
  1307. name:=current_scanner.readid;
  1308. if c='=' then
  1309. begin
  1310. current_scanner.readchar;
  1311. current_scanner.readid;
  1312. value:=orgpattern;
  1313. UpdateTargetSwitchStr(name+'='+value,current_settings.targetswitches,current_module.in_global);
  1314. end
  1315. else if c='-' then
  1316. begin
  1317. current_scanner.readchar;
  1318. UpdateTargetSwitchStr(name+'-',current_settings.targetswitches,current_module.in_global);
  1319. end
  1320. else
  1321. UpdateTargetSwitchStr(name,current_settings.targetswitches,current_module.in_global);
  1322. end;
  1323. procedure dir_typedaddress;
  1324. begin
  1325. do_delphiswitch('T');
  1326. end;
  1327. procedure dir_typeinfo;
  1328. begin
  1329. do_delphiswitch('M');
  1330. end;
  1331. procedure dir_unitpath;
  1332. begin
  1333. if not current_module.in_global then
  1334. Message(scan_w_switch_is_global)
  1335. else
  1336. with current_scanner,current_module,localunitsearchpath do
  1337. begin
  1338. skipspace;
  1339. AddPath(path+source_info.DirSep+readcomment,false);
  1340. end;
  1341. end;
  1342. procedure dir_varparacopyoutcheck;
  1343. begin
  1344. if not(target_info.system in systems_jvm) then
  1345. begin
  1346. Message1(scan_w_illegal_switch,pattern);
  1347. exit;
  1348. end;
  1349. do_localswitch(cs_check_var_copyout);
  1350. end;
  1351. procedure dir_varpropsetter;
  1352. begin
  1353. do_localswitch(cs_varpropsetter);
  1354. end;
  1355. procedure dir_varstringchecks;
  1356. begin
  1357. do_delphiswitch('V');
  1358. end;
  1359. procedure dir_version;
  1360. var
  1361. major, minor, revision : longint;
  1362. error : integer;
  1363. begin
  1364. if not (target_info.system in systems_all_windows+[system_i386_os2,system_i386_emx,
  1365. system_i386_netware,system_i386_wdosx,
  1366. system_i386_netwlibc]) then
  1367. begin
  1368. Message(scan_n_version_not_support);
  1369. exit;
  1370. end;
  1371. if (compile_level<>1) then
  1372. Message(scan_n_only_exe_version)
  1373. else
  1374. begin
  1375. { change description global var in all cases }
  1376. { it not used but in win32, os2 and netware }
  1377. current_scanner.skipspace;
  1378. { we should only accept Major.Minor format for win32 and os2 }
  1379. current_scanner.readnumber;
  1380. major:=0;
  1381. minor:=0;
  1382. revision:=0;
  1383. val(pattern,major,error);
  1384. if (error<>0) or (major > high(word)) or (major < 0) then
  1385. begin
  1386. Message1(scan_w_wrong_version_ignored,pattern);
  1387. exit;
  1388. end;
  1389. if c='.' then
  1390. begin
  1391. current_scanner.readchar;
  1392. current_scanner.readnumber;
  1393. val(pattern,minor,error);
  1394. if (error<>0) or (minor > high(word)) or (minor < 0) then
  1395. begin
  1396. Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
  1397. exit;
  1398. end;
  1399. if (c='.') and
  1400. (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  1401. begin
  1402. current_scanner.readchar;
  1403. current_scanner.readnumber;
  1404. val(pattern,revision,error);
  1405. if (error<>0) or (revision > high(word)) or (revision < 0) then
  1406. begin
  1407. Message1(scan_w_wrong_version_ignored,tostr(revision)+'.'+pattern);
  1408. exit;
  1409. end;
  1410. dllmajor:=word(major);
  1411. dllminor:=word(minor);
  1412. dllrevision:=word(revision);
  1413. dllversion:=tostr(major)+','+tostr(minor)+','+tostr(revision);
  1414. end
  1415. else
  1416. begin
  1417. dllmajor:=word(major);
  1418. dllminor:=word(minor);
  1419. dllversion:=tostr(major)+'.'+tostr(minor);
  1420. end;
  1421. end
  1422. else
  1423. dllversion:=tostr(major);
  1424. end;
  1425. end;
  1426. procedure dir_wait;
  1427. var
  1428. had_info : boolean;
  1429. begin
  1430. had_info:=(status.verbosity and V_Info)<>0;
  1431. { this message should allways appear !! }
  1432. status.verbosity:=status.verbosity or V_Info;
  1433. Message(scan_i_press_enter);
  1434. readln;
  1435. If not(had_info) then
  1436. status.verbosity:=status.verbosity and (not V_Info);
  1437. end;
  1438. { delphi compatible warn directive:
  1439. $warn <identifier> on
  1440. $warn <identifier> off
  1441. $warn <identifier> error
  1442. }
  1443. procedure dir_warn;
  1444. var
  1445. ident : string;
  1446. state : string;
  1447. msgstate : tmsgstate;
  1448. i : integer;
  1449. begin
  1450. current_scanner.skipspace;
  1451. ident:=current_scanner.readid;
  1452. current_scanner.skipspace;
  1453. state:=current_scanner.readid;
  1454. { support both delphi and fpc switches }
  1455. { use local ms_on/off/error tmsgstate values }
  1456. if (state='ON') or (state='+') then
  1457. msgstate:=ms_on
  1458. else
  1459. if (state='OFF') or (state='-') then
  1460. msgstate:=ms_off
  1461. else
  1462. if (state='ERROR') then
  1463. msgstate:=ms_error
  1464. else
  1465. begin
  1466. Message1(scanner_e_illegal_warn_state,state);
  1467. exit;
  1468. end;
  1469. if ident='CONSTRUCTING_ABSTRACT' then
  1470. begin
  1471. recordpendingmessagestate(type_w_instance_with_abstract, msgstate);
  1472. recordpendingmessagestate(type_w_instance_abstract_class, msgstate);
  1473. end
  1474. else
  1475. if ident='IMPLICIT_VARIANTS' then
  1476. recordpendingmessagestate(parser_w_implicit_uses_of_variants_unit, msgstate)
  1477. else
  1478. if ident='NO_RETVAL' then
  1479. recordpendingmessagestate(sym_w_function_result_not_set, msgstate)
  1480. else
  1481. if ident='SYMBOL_DEPRECATED' then
  1482. begin
  1483. recordpendingmessagestate(sym_w_deprecated_symbol, msgstate);
  1484. recordpendingmessagestate(sym_w_deprecated_symbol_with_msg, msgstate);
  1485. end
  1486. else
  1487. if ident='SYMBOL_EXPERIMENTAL' then
  1488. recordpendingmessagestate(sym_w_experimental_symbol, msgstate)
  1489. else
  1490. if ident='SYMBOL_LIBRARY' then
  1491. recordpendingmessagestate(sym_w_library_symbol, msgstate)
  1492. else
  1493. if ident='SYMBOL_PLATFORM' then
  1494. recordpendingmessagestate(sym_w_non_portable_symbol, msgstate)
  1495. else
  1496. if ident='SYMBOL_UNIMPLEMENTED' then
  1497. recordpendingmessagestate(sym_w_non_implemented_symbol, msgstate)
  1498. else
  1499. if ident='UNIT_DEPRECATED' then
  1500. begin
  1501. recordpendingmessagestate(sym_w_deprecated_unit, msgstate);
  1502. recordpendingmessagestate(sym_w_deprecated_unit_with_msg, msgstate);
  1503. end
  1504. else
  1505. if ident='UNIT_EXPERIMENTAL' then
  1506. recordpendingmessagestate(sym_w_experimental_unit, msgstate)
  1507. else
  1508. if ident='UNIT_LIBRARY' then
  1509. recordpendingmessagestate(sym_w_library_unit, msgstate)
  1510. else
  1511. if ident='UNIT_PLATFORM' then
  1512. recordpendingmessagestate(sym_w_non_portable_unit, msgstate)
  1513. else
  1514. if ident='UNIT_UNIMPLEMENTED' then
  1515. recordpendingmessagestate(sym_w_non_implemented_unit, msgstate)
  1516. else
  1517. if ident='ZERO_NIL_COMPAT' then
  1518. recordpendingmessagestate(type_w_zero_to_nil, msgstate)
  1519. else
  1520. if ident='IMPLICIT_STRING_CAST' then
  1521. recordpendingmessagestate(type_w_implicit_string_cast, msgstate)
  1522. else
  1523. if ident='IMPLICIT_STRING_CAST_LOSS' then
  1524. recordpendingmessagestate(type_w_implicit_string_cast_loss, msgstate)
  1525. else
  1526. if ident='EXPLICIT_STRING_CAST' then
  1527. recordpendingmessagestate(type_w_explicit_string_cast, msgstate)
  1528. else
  1529. if ident='EXPLICIT_STRING_CAST_LOSS' then
  1530. recordpendingmessagestate(type_w_explicit_string_cast_loss, msgstate)
  1531. else
  1532. if ident='CVT_NARROWING_STRING_LOST' then
  1533. recordpendingmessagestate(type_w_unicode_data_loss, msgstate)
  1534. else
  1535. if ident='INTF_RAISE_VISIBILITY' then
  1536. recordpendingmessagestate(type_w_interface_lower_visibility, msgstate)
  1537. else
  1538. begin
  1539. i:=0;
  1540. if not ChangeMessageVerbosity(ident,i,msgstate) then
  1541. Message1(scanner_w_illegal_warn_identifier,ident);
  1542. end;
  1543. end;
  1544. procedure dir_warning;
  1545. begin
  1546. do_message(scan_w_user_defined);
  1547. end;
  1548. procedure dir_warnings;
  1549. begin
  1550. do_setverbose('W');
  1551. end;
  1552. procedure dir_weakpackageunit;
  1553. begin
  1554. { old Delphi versions seem to use merely $WEAKPACKAGEUNIT while newer
  1555. Delphis have $WEAPACKAGEUNIT ON... :/ }
  1556. do_moduleflagswitch(uf_package_weak, true);
  1557. end;
  1558. procedure dir_writeableconst;
  1559. begin
  1560. do_delphiswitch('J');
  1561. end;
  1562. procedure dir_z1;
  1563. begin
  1564. current_settings.packenum:=1;
  1565. end;
  1566. procedure dir_z2;
  1567. begin
  1568. current_settings.packenum:=2;
  1569. end;
  1570. procedure dir_z4;
  1571. begin
  1572. current_settings.packenum:=4;
  1573. end;
  1574. procedure dir_externalsym;
  1575. begin
  1576. end;
  1577. procedure dir_nodefine;
  1578. begin
  1579. end;
  1580. procedure dir_hppemit;
  1581. begin
  1582. end;
  1583. procedure dir_hugecode;
  1584. begin
  1585. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded])
  1586. {$ifdef i8086}
  1587. or (current_settings.x86memorymodel in x86_near_code_models)
  1588. {$endif i8086}
  1589. then
  1590. begin
  1591. Message1(scan_n_ignored_switch,pattern);
  1592. exit;
  1593. end;
  1594. do_moduleswitch(cs_huge_code);
  1595. end;
  1596. procedure dir_hugepointernormalization;
  1597. var
  1598. hs : string;
  1599. begin
  1600. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  1601. begin
  1602. Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERNORMALIZATION');
  1603. exit;
  1604. end;
  1605. current_scanner.skipspace;
  1606. hs:=current_scanner.readid;
  1607. case hs of
  1608. 'BORLANDC':
  1609. begin
  1610. recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'+');
  1611. recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'+');
  1612. end;
  1613. 'MICROSOFTC':
  1614. begin
  1615. recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'-');
  1616. recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'-');
  1617. end;
  1618. 'WATCOMC':
  1619. begin
  1620. recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'-');
  1621. recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'+');
  1622. end;
  1623. else
  1624. Message(scan_e_illegal_hugepointernormalization);
  1625. end;
  1626. end;
  1627. procedure dir_hugepointerarithmeticnormalization;
  1628. begin
  1629. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  1630. begin
  1631. Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERARITHMETICNORMALIZATION');
  1632. exit;
  1633. end;
  1634. do_localswitch(cs_hugeptr_arithmetic_normalization);
  1635. end;
  1636. procedure dir_hugepointercomparisonnormalization;
  1637. begin
  1638. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  1639. begin
  1640. Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERCOMPARISONNORMALIZATION');
  1641. exit;
  1642. end;
  1643. do_localswitch(cs_hugeptr_comparison_normalization);
  1644. end;
  1645. procedure dir_codealign;
  1646. var
  1647. s : string;
  1648. begin
  1649. current_scanner.skipspace;
  1650. s:=current_scanner.readcomment;
  1651. if not(UpdateAlignmentStr(s,current_settings.alignment)) then
  1652. message(scanner_e_illegal_alignment_directive);
  1653. end;
  1654. procedure dir_codepage;
  1655. var
  1656. s : string;
  1657. begin
  1658. if not current_module.in_global then
  1659. Message(scan_w_switch_is_global)
  1660. else
  1661. begin
  1662. current_scanner.skipspace;
  1663. s:=current_scanner.readcomment;
  1664. if (upper(s)='UTF8') or (upper(s)='UTF-8') then
  1665. current_settings.sourcecodepage:=CP_UTF8
  1666. else if not cpavailable(s) then
  1667. Message1(option_code_page_not_available,s)
  1668. else
  1669. current_settings.sourcecodepage:=codepagebyname(s);
  1670. { we're not using the system code page now }
  1671. exclude(current_settings.modeswitches,m_systemcodepage);
  1672. exclude(current_settings.moduleswitches,cs_system_codepage);
  1673. include(current_settings.moduleswitches,cs_explicit_codepage);
  1674. end;
  1675. end;
  1676. procedure dir_coperators;
  1677. begin
  1678. do_moduleswitch(cs_support_c_operators);
  1679. end;
  1680. procedure dir_bitpacking;
  1681. begin
  1682. do_localswitch(cs_bitpacking);
  1683. end;
  1684. procedure dir_region;
  1685. begin
  1686. end;
  1687. procedure dir_endregion;
  1688. begin
  1689. end;
  1690. procedure dir_zerobasesstrings;
  1691. begin
  1692. do_localswitch(cs_zerobasedstrings);
  1693. end;
  1694. {****************************************************************************
  1695. Initialize Directives
  1696. ****************************************************************************}
  1697. procedure InitScannerDirectives;
  1698. begin
  1699. AddDirective('A1',directive_all, @dir_a1);
  1700. AddDirective('A2',directive_all, @dir_a2);
  1701. AddDirective('A4',directive_all, @dir_a4);
  1702. AddDirective('A8',directive_all, @dir_a8);
  1703. AddDirective('ALIGN',directive_all, @dir_align);
  1704. {$ifdef m68k}
  1705. AddDirective('APPID',directive_all, @dir_appid);
  1706. AddDirective('APPNAME',directive_all, @dir_appname);
  1707. {$endif m68k}
  1708. AddDirective('APPTYPE',directive_all, @dir_apptype);
  1709. AddDirective('ASMCPU',directive_all, @dir_asmcpu);
  1710. AddDirective('ASMMODE',directive_all, @dir_asmmode);
  1711. AddDirective('ASSERTIONS',directive_all, @dir_assertions);
  1712. AddDirective('BOOLEVAL',directive_all, @dir_booleval);
  1713. AddDirective('BITPACKING',directive_all, @dir_bitpacking);
  1714. AddDirective('CALLING',directive_all, @dir_calling);
  1715. AddDirective('CHECKLOWADDRLOADS',directive_all, @dir_checklowaddrloads);
  1716. AddDirective('CHECKPOINTER',directive_all, @dir_checkpointer);
  1717. AddDirective('CODEALIGN',directive_all, @dir_codealign);
  1718. AddDirective('CODEPAGE',directive_all, @dir_codepage);
  1719. AddDirective('COPERATORS',directive_all, @dir_coperators);
  1720. AddDirective('COPYRIGHT',directive_all, @dir_copyright);
  1721. AddDirective('D',directive_all, @dir_description);
  1722. AddDirective('DEBUGINFO',directive_all, @dir_debuginfo);
  1723. AddDirective('DENYPACKAGEUNIT',directive_all,@dir_denypackageunit);
  1724. AddDirective('DESCRIPTION',directive_all, @dir_description);
  1725. AddDirective('ENDREGION',directive_all, @dir_endregion);
  1726. AddDirective('ERROR',directive_all, @dir_error);
  1727. AddDirective('ERRORC',directive_mac, @dir_error);
  1728. AddDirective('EXCESSPRECISION',directive_all, @dir_excessprecision);
  1729. AddDirective('EXTENDEDSYNTAX',directive_all, @dir_extendedsyntax);
  1730. AddDirective('EXTERNALSYM',directive_all, @dir_externalsym);
  1731. AddDirective('F',directive_all, @dir_forcefarcalls);
  1732. AddDirective('FATAL',directive_all, @dir_fatal);
  1733. AddDirective('FPUTYPE',directive_all, @dir_fputype);
  1734. AddDirective('FRAMEWORKPATH',directive_all, @dir_frameworkpath);
  1735. AddDirective('GOTO',directive_all, @dir_goto);
  1736. AddDirective('HINT',directive_all, @dir_hint);
  1737. AddDirective('HINTS',directive_all, @dir_hints);
  1738. AddDirective('HPPEMIT',directive_all, @dir_hppemit);
  1739. AddDirective('HUGECODE',directive_all, @dir_hugecode);
  1740. AddDirective('HUGEPOINTERNORMALIZATION',directive_all,@dir_hugepointernormalization);
  1741. AddDirective('HUGEPOINTERARITHMETICNORMALIZATION',directive_all,@dir_hugepointerarithmeticnormalization);
  1742. AddDirective('HUGEPOINTERCOMPARISONNORMALIZATION',directive_all,@dir_hugepointercomparisonnormalization);
  1743. AddDirective('IEEEERRORS',directive_all,@dir_ieeeerrors);
  1744. AddDirective('IOCHECKS',directive_all, @dir_iochecks);
  1745. AddDirective('IMAGEBASE',directive_all, @dir_imagebase);
  1746. AddDirective('IMPLICITEXCEPTIONS',directive_all, @dir_implicitexceptions);
  1747. AddDirective('IMPORTEDDATA',directive_all, @dir_importeddata);
  1748. AddDirective('INCLUDEPATH',directive_all, @dir_includepath);
  1749. AddDirective('INFO',directive_all, @dir_info);
  1750. AddDirective('INLINE',directive_all, @dir_inline);
  1751. AddDirective('INTERFACES',directive_all, @dir_interfaces);
  1752. AddDirective('L',directive_all, @dir_link);
  1753. AddDirective('LIBEXPORT',directive_mac, @dir_libexport);
  1754. AddDirective('LIBRARYPATH',directive_all, @dir_librarypath);
  1755. AddDirective('LINK',directive_all, @dir_link);
  1756. AddDirective('LINKFRAMEWORK',directive_all, @dir_linkframework);
  1757. AddDirective('LINKLIB',directive_all, @dir_linklib);
  1758. AddDirective('LOCALSYMBOLS',directive_all, @dir_localsymbols);
  1759. AddDirective('LONGSTRINGS',directive_all, @dir_longstrings);
  1760. AddDirective('M',directive_all, @dir_memory);
  1761. AddDirective('MACRO',directive_all, @dir_macro);
  1762. AddDirective('MAXFPUREGISTERS',directive_all, @dir_maxfpuregisters);
  1763. AddDirective('MAXSTACKSIZE',directive_all, @dir_maxstacksize);
  1764. AddDirective('MEMORY',directive_all, @dir_memory);
  1765. AddDirective('MESSAGE',directive_all, @dir_message);
  1766. AddDirective('MINENUMSIZE',directive_all, @dir_packenum);
  1767. AddDirective('MINFPCONSTPREC',directive_all, @dir_minfpconstprec);
  1768. AddDirective('MINSTACKSIZE',directive_all, @dir_minstacksize);
  1769. AddDirective('MMX',directive_all, @dir_mmx);
  1770. AddDirective('MODE',directive_all, @dir_mode);
  1771. AddDirective('MODESWITCH',directive_all, @dir_modeswitch);
  1772. AddDirective('NAMESPACE',directive_all, @dir_namespace);
  1773. AddDirective('NODEFINE',directive_all, @dir_nodefine);
  1774. AddDirective('NOTE',directive_all, @dir_note);
  1775. AddDirective('NOTES',directive_all, @dir_notes);
  1776. AddDirective('OBJECTCHECKS',directive_all, @dir_objectchecks);
  1777. AddDirective('OBJECTPATH',directive_all, @dir_objectpath);
  1778. AddDirective('OPENSTRINGS',directive_all, @dir_openstrings);
  1779. AddDirective('OPTIMIZATION',directive_all, @dir_optimization);
  1780. AddDirective('OV',directive_mac, @dir_overflowchecks);
  1781. AddDirective('OVERFLOWCHECKS',directive_all, @dir_overflowchecks);
  1782. AddDirective('PACKENUM',directive_all, @dir_packenum);
  1783. AddDirective('PACKRECORDS',directive_all, @dir_packrecords);
  1784. AddDirective('PACKSET',directive_all, @dir_packset);
  1785. AddDirective('PASCALMAINNAME',directive_all, @dir_pascalmainname);
  1786. AddDirective('PIC',directive_all, @dir_pic);
  1787. AddDirective('POINTERMATH',directive_all, @dir_pointermath);
  1788. AddDirective('POP',directive_all, @dir_pop);
  1789. AddDirective('PROFILE',directive_all, @dir_profile);
  1790. AddDirective('PUSH',directive_all, @dir_push);
  1791. AddDirective('R',directive_all, @dir_resource);
  1792. AddDirective('RANGECHECKS',directive_all, @dir_rangechecks);
  1793. AddDirective('REFERENCEINFO',directive_all, @dir_referenceinfo);
  1794. AddDirective('REGION',directive_all, @dir_region);
  1795. AddDirective('RESOURCE',directive_all, @dir_resource);
  1796. AddDirective('SATURATION',directive_all, @dir_saturation);
  1797. AddDirective('SAFEFPUEXCEPTIONS',directive_all, @dir_safefpuexceptions);
  1798. AddDirective('SCOPEDENUMS',directive_all, @dir_scopedenums);
  1799. AddDirective('SETPEFLAGS', directive_all, @dir_setpeflags);
  1800. AddDirective('SETPEOPTFLAGS', directive_all, @dir_setpeoptflags);
  1801. AddDirective('SETPEOSVERSION', directive_all, @dir_setpeosversion);
  1802. AddDirective('SETPEUSERVERSION', directive_all, @dir_setpeuserversion);
  1803. AddDirective('SETPESUBSYSVERSION', directive_all, @dir_setpesubsysversion);
  1804. AddDirective('SCREENNAME',directive_all, @dir_screenname);
  1805. AddDirective('SMARTLINK',directive_all, @dir_smartlink);
  1806. AddDirective('STACKFRAMES',directive_all, @dir_stackframes);
  1807. AddDirective('STOP',directive_all, @dir_stop);
  1808. AddDirective('STRINGCHECKS', directive_all, @dir_stringchecks);
  1809. AddDirective('SYSCALL',directive_all, @dir_syscall);
  1810. AddDirective('TARGETSWITCH',directive_all, @dir_targetswitch);
  1811. AddDirective('THREADNAME',directive_all, @dir_threadname);
  1812. AddDirective('TYPEDADDRESS',directive_all, @dir_typedaddress);
  1813. AddDirective('TYPEINFO',directive_all, @dir_typeinfo);
  1814. AddDirective('UNITPATH',directive_all, @dir_unitpath);
  1815. AddDirective('VARPARACOPYOUTCHECK',directive_all, @dir_varparacopyoutcheck);
  1816. AddDirective('VARPROPSETTER',directive_all, @dir_varpropsetter);
  1817. AddDirective('VARSTRINGCHECKS',directive_all, @dir_varstringchecks);
  1818. AddDirective('VERSION',directive_all, @dir_version);
  1819. AddDirective('WAIT',directive_all, @dir_wait);
  1820. AddDirective('WARN',directive_all, @dir_warn);
  1821. AddDirective('WARNING',directive_all, @dir_warning);
  1822. AddDirective('WARNINGS',directive_all, @dir_warnings);
  1823. AddDirective('WEAKPACKAGEUNIT',directive_all, @dir_weakpackageunit);
  1824. AddDirective('WRITEABLECONST',directive_all, @dir_writeableconst);
  1825. AddDirective('Z1',directive_all, @dir_z1);
  1826. AddDirective('Z2',directive_all, @dir_z2);
  1827. AddDirective('Z4',directive_all, @dir_z4);
  1828. AddDirective('ZEROBASEDSTRINGS',directive_all, @dir_zerobasesstrings);
  1829. end;
  1830. end.