scandir.pas 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091
  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:tmoduleflag;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. exclude(current_module.moduleflags,flag)
  111. else
  112. include(current_module.moduleflags,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_macosclassic,
  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_macosclassic]) 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_checkcasecoverage;
  388. begin
  389. do_localswitch(cs_check_all_case_coverage);
  390. end;
  391. procedure dir_checkfpuexceptions;
  392. begin
  393. do_localswitch(cs_check_fpu_exceptions);
  394. end;
  395. procedure dir_objectchecks;
  396. begin
  397. do_localswitch(cs_check_object);
  398. end;
  399. procedure dir_ieeeerrors;
  400. begin
  401. do_localswitch(cs_ieee_errors);
  402. end;
  403. procedure dir_assertions;
  404. begin
  405. do_delphiswitch('C');
  406. end;
  407. procedure dir_booleval;
  408. begin
  409. do_delphiswitch('B');
  410. end;
  411. procedure dir_debuginfo;
  412. begin
  413. do_delphiswitch('D');
  414. end;
  415. procedure dir_denypackageunit;
  416. begin
  417. do_moduleflagswitch(mf_package_deny,true);
  418. end;
  419. procedure dir_description;
  420. begin
  421. if not (target_info.system in systems_all_windows+[system_i386_os2,system_i386_emx,
  422. system_i386_netware,system_i386_wdosx,system_i386_netwlibc,system_i8086_win16]) then
  423. Message(scan_w_description_not_support);
  424. { change description global var in all cases }
  425. { it not used but in win32, os2 and netware }
  426. current_scanner.skipspace;
  427. description:=current_scanner.readcomment;
  428. DescriptionSetExplicity:=true;
  429. end;
  430. procedure dir_screenname; {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,'Screenname only supported for target netware');
  435. current_scanner.skipspace;
  436. nwscreenname:=current_scanner.readcomment;
  437. end;
  438. procedure dir_threadname; {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,'Threadname only supported for target netware');
  443. current_scanner.skipspace;
  444. nwthreadname:=current_scanner.readcomment;
  445. end;
  446. procedure dir_copyright; {ad}
  447. begin
  448. if not (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  449. {Message(scan_w_decription_not_support);}
  450. comment (V_Warning,'Copyright only supported for target netware');
  451. current_scanner.skipspace;
  452. nwcopyright:=current_scanner.readcomment;
  453. end;
  454. procedure dir_error;
  455. begin
  456. do_message(scan_e_user_defined);
  457. end;
  458. procedure dir_extendedsyntax;
  459. begin
  460. do_delphiswitch('X');
  461. end;
  462. procedure dir_forcefarcalls;
  463. begin
  464. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded])
  465. {$ifdef i8086}
  466. or (current_settings.x86memorymodel in x86_near_code_models)
  467. {$endif i8086}
  468. then
  469. begin
  470. Message1(scan_n_ignored_switch,pattern);
  471. exit;
  472. end;
  473. do_localswitch(cs_force_far_calls);
  474. end;
  475. procedure dir_fatal;
  476. begin
  477. do_message(scan_f_user_defined);
  478. end;
  479. procedure dir_floatingpointemulation;
  480. begin
  481. do_delphiswitch('E');
  482. end;
  483. procedure dir_stackchecking;
  484. begin
  485. do_delphiswitch('T');
  486. end;
  487. procedure dir_fputype;
  488. begin
  489. current_scanner.skipspace;
  490. undef_system_macro('FPU'+fputypestr[current_settings.fputype]);
  491. if not(SetFPUType(upper(current_scanner.readcomment),current_settings.fputype)) then
  492. comment(V_Error,'Illegal FPU type');
  493. def_system_macro('FPU'+fputypestr[current_settings.fputype]);
  494. end;
  495. procedure dir_frameworkpath;
  496. begin
  497. if not current_module.in_global then
  498. Message(scan_w_switch_is_global)
  499. else if not(target_info.system in systems_darwin) then
  500. begin
  501. Message(scan_w_frameworks_darwin_only);
  502. current_scanner.skipspace;
  503. current_scanner.readcomment
  504. end
  505. else
  506. begin
  507. current_scanner.skipspace;
  508. current_module.localframeworksearchpath.AddPath(current_scanner.readcomment,false);
  509. end;
  510. end;
  511. procedure dir_goto;
  512. begin
  513. do_moduleswitch(cs_support_goto);
  514. end;
  515. procedure dir_hint;
  516. begin
  517. do_message(scan_h_user_defined);
  518. end;
  519. procedure dir_hints;
  520. begin
  521. do_setverbose('H');
  522. end;
  523. procedure dir_imagebase;
  524. begin
  525. if not (target_info.system in (systems_windows+systems_wince)) then
  526. Message(scan_w_imagebase_not_support);
  527. current_scanner.skipspace;
  528. imagebase:=current_scanner.readval;
  529. ImageBaseSetExplicity:=true
  530. end;
  531. procedure dir_implicitexceptions;
  532. begin
  533. do_moduleswitch(cs_implicit_exceptions);
  534. end;
  535. procedure dir_importeddata;
  536. begin
  537. do_delphiswitch('G');
  538. end;
  539. procedure dir_includepath;
  540. begin
  541. if not current_module.in_global then
  542. Message(scan_w_switch_is_global)
  543. else
  544. begin
  545. current_scanner.skipspace;
  546. current_module.localincludesearchpath.AddPath(current_scanner.readcomment,false);
  547. end;
  548. end;
  549. procedure dir_info;
  550. begin
  551. do_message(scan_i_user_defined);
  552. end;
  553. procedure dir_inline;
  554. begin
  555. do_localswitch(cs_do_inline);
  556. end;
  557. procedure dir_interfaces;
  558. var
  559. hs : string;
  560. begin
  561. {corba/com/default}
  562. current_scanner.skipspace;
  563. hs:=current_scanner.readid;
  564. {$ifndef jvm}
  565. if (hs='CORBA') then
  566. current_settings.interfacetype:=it_interfacecorba
  567. else if (hs='COM') then
  568. current_settings.interfacetype:=it_interfacecom
  569. else
  570. {$endif jvm}
  571. if (hs='DEFAULT') then
  572. current_settings.interfacetype:=init_settings.interfacetype
  573. else
  574. Message(scan_e_invalid_interface_type);
  575. end;
  576. procedure dir_iochecks;
  577. begin
  578. do_delphiswitch('I');
  579. end;
  580. procedure dir_libexport;
  581. begin
  582. {not implemented}
  583. end;
  584. procedure dir_librarypath;
  585. begin
  586. if not current_module.in_global then
  587. Message(scan_w_switch_is_global)
  588. else
  589. begin
  590. current_scanner.skipspace;
  591. current_module.locallibrarysearchpath.AddPath(current_scanner.readcomment,false);
  592. end;
  593. end;
  594. procedure dir_link;
  595. var
  596. s : string;
  597. begin
  598. current_scanner.skipspace;
  599. if scanner.c = '''' then
  600. begin
  601. s:= current_scanner.readquotedstring;
  602. current_scanner.readcomment
  603. end
  604. else
  605. s:= trimspace(current_scanner.readcomment);
  606. s:=FixFileName(s);
  607. if ExtractFileExt(s)='' then
  608. s:=ChangeFileExt(s,target_info.objext);
  609. current_module.linkotherofiles.add(s,link_always);
  610. end;
  611. procedure dir_linkframework;
  612. var
  613. s : string;
  614. begin
  615. current_scanner.skipspace;
  616. if scanner.c = '''' then
  617. begin
  618. s:= current_scanner.readquotedstring;
  619. current_scanner.readcomment
  620. end
  621. else
  622. s:= trimspace(current_scanner.readcomment);
  623. s:=FixFileName(s);
  624. if (target_info.system in systems_darwin) then
  625. current_module.linkotherframeworks.add(s,link_always)
  626. else
  627. Message(scan_w_frameworks_darwin_only);
  628. end;
  629. procedure dir_linklib;
  630. type
  631. tLinkMode=(lm_shared,lm_static);
  632. var
  633. s : string;
  634. quote : char;
  635. libext,
  636. libname,
  637. linkmodestr : string;
  638. p : longint;
  639. linkMode : tLinkMode;
  640. begin
  641. current_scanner.skipspace;
  642. if scanner.c = '''' then
  643. begin
  644. libname:= current_scanner.readquotedstring;
  645. s:= current_scanner.readcomment;
  646. p:=pos(',',s);
  647. end
  648. else
  649. begin
  650. s:= current_scanner.readcomment;
  651. p:=pos(',',s);
  652. if p=0 then
  653. libname:=TrimSpace(s)
  654. else
  655. libname:=TrimSpace(copy(s,1,p-1));
  656. end;
  657. if p=0 then
  658. linkmodeStr:=''
  659. else
  660. linkmodeStr:=Upper(TrimSpace(copy(s,p+1,255)));
  661. if (libname='') or (libname='''''') or (libname='""') then
  662. exit;
  663. { create library name }
  664. if libname[1] in ['''','"'] then
  665. begin
  666. quote:=libname[1];
  667. Delete(libname,1,1);
  668. p:=pos(quote,libname);
  669. if p>0 then
  670. Delete(libname,p,1);
  671. end;
  672. libname:=FixFileName(libname);
  673. { get linkmode, default is to check the extension for
  674. the static library, otherwise shared linking is assumed }
  675. linkmode:=lm_shared;
  676. if linkModeStr='' then
  677. begin
  678. libext:=ExtractFileExt(libname);
  679. if libext=target_info.staticClibext then
  680. linkMode:=lm_static;
  681. end
  682. else if linkModeStr='STATIC' then
  683. linkmode:=lm_static
  684. else if (LinkModeStr='SHARED') or (LinkModeStr='') then
  685. linkmode:=lm_shared
  686. else
  687. Comment(V_Error,'Wrong link mode specified: "'+Linkmodestr+'"');
  688. { add to the list of other libraries }
  689. if linkMode=lm_static then
  690. current_module.linkOtherStaticLibs.add(libname,link_always)
  691. else
  692. current_module.linkOtherSharedLibs.add(libname,link_always);
  693. end;
  694. procedure dir_localsymbols;
  695. begin
  696. do_delphiswitch('L');
  697. end;
  698. procedure dir_longstrings;
  699. begin
  700. do_delphiswitch('H');
  701. end;
  702. procedure dir_macro;
  703. begin
  704. do_moduleswitch(cs_support_macro);
  705. end;
  706. procedure dir_pascalmainname;
  707. var
  708. s: string;
  709. begin
  710. current_scanner.skipspace;
  711. s:=trimspace(current_scanner.readcomment);
  712. if assigned(current_module.mainname) and
  713. (s<>current_module.mainname^) then
  714. begin
  715. Message1(scan_w_multiple_main_name_overrides,current_module.mainname^);
  716. stringdispose(current_module.mainname)
  717. end
  718. else if (mainaliasname<>defaultmainaliasname) and
  719. (mainaliasname<>s) then
  720. Message1(scan_w_multiple_main_name_overrides,mainaliasname);
  721. mainaliasname:=s;
  722. if (mainaliasname<>defaultmainaliasname) then
  723. current_module.mainname:=stringdup(mainaliasname);
  724. end;
  725. procedure dir_maxfpuregisters;
  726. var
  727. l : integer;
  728. hs : string;
  729. begin
  730. current_scanner.skipspace;
  731. if not(c in ['0'..'9']) then
  732. begin
  733. hs:=current_scanner.readid;
  734. if (hs='NORMAL') or (hs='DEFAULT') then
  735. current_settings.maxfpuregisters:=-1
  736. else
  737. Message(scan_e_invalid_maxfpureg_value);
  738. end
  739. else
  740. begin
  741. l:=current_scanner.readval;
  742. case l of
  743. 0..8:
  744. current_settings.maxfpuregisters:=l;
  745. else
  746. Message(scan_e_invalid_maxfpureg_value);
  747. end;
  748. end;
  749. end;
  750. procedure dir_maxstacksize;
  751. begin
  752. if not (target_info.system in (systems_windows+systems_wince)) then
  753. Message(scan_w_maxstacksize_not_support);
  754. current_scanner.skipspace;
  755. maxstacksize:=current_scanner.readval;
  756. MaxStackSizeSetExplicity:=true;
  757. end;
  758. procedure dir_memory;
  759. var
  760. l : longint;
  761. heapsize_limit: longint;
  762. maxheapsize_limit: longint;
  763. begin
  764. {$if defined(i8086)}
  765. if target_info.system=system_i8086_win16 then
  766. begin
  767. heapsize_limit:=65520;
  768. maxheapsize_limit:=65520;
  769. end
  770. else if current_settings.x86memorymodel in x86_far_data_models then
  771. begin
  772. heapsize_limit:=655360;
  773. maxheapsize_limit:=655360;
  774. end
  775. else
  776. begin
  777. heapsize_limit:=65520;
  778. maxheapsize_limit:=65520;
  779. end;
  780. {$elseif defined(cpu16bitaddr)}
  781. heapsize_limit:=65520;
  782. maxheapsize_limit:=65520;
  783. {$else}
  784. heapsize_limit:=high(heapsize);
  785. maxheapsize_limit:=high(maxheapsize);
  786. {$endif}
  787. current_scanner.skipspace;
  788. l:=current_scanner.readval;
  789. if (l>=1024)
  790. {$ifdef cpu16bitaddr}
  791. and (l<=65521) { TP7's $M directive allows specifying a stack size of
  792. 65521, but it actually sets the stack size to 65520 }
  793. {$else cpu16bitaddr}
  794. and (l<67107840)
  795. {$endif cpu16bitaddr}
  796. then
  797. stacksize:=min(l,{$ifdef cpu16bitaddr}65520{$else}67107839{$endif})
  798. else
  799. Message(scan_w_invalid_stacksize);
  800. if c=',' then
  801. begin
  802. current_scanner.readchar;
  803. current_scanner.skipspace;
  804. l:=current_scanner.readval;
  805. if l>=1024 then
  806. heapsize:=min(l,heapsize_limit);
  807. if c=',' then
  808. begin
  809. current_scanner.readchar;
  810. current_scanner.skipspace;
  811. l:=current_scanner.readval;
  812. if l>=heapsize then
  813. maxheapsize:=min(l,maxheapsize_limit)
  814. else
  815. Message(scan_w_heapmax_lessthan_heapmin);
  816. end;
  817. end;
  818. end;
  819. procedure dir_message;
  820. var
  821. hs : string;
  822. w : longint;
  823. begin
  824. w:=0;
  825. current_scanner.skipspace;
  826. { Message level specified? }
  827. if c='''' then
  828. w:=scan_n_user_defined
  829. else
  830. begin
  831. hs:=current_scanner.readid;
  832. if (hs='WARN') or (hs='WARNING') then
  833. w:=scan_w_user_defined
  834. else
  835. if (hs='ERROR') then
  836. w:=scan_e_user_defined
  837. else
  838. if (hs='FATAL') then
  839. w:=scan_f_user_defined
  840. else
  841. if (hs='HINT') then
  842. w:=scan_h_user_defined
  843. else
  844. if (hs='NOTE') then
  845. w:=scan_n_user_defined
  846. else
  847. if (hs='INFO') then
  848. w:=scan_i_user_defined
  849. else
  850. Message1(scan_w_illegal_directive,hs);
  851. end;
  852. { Only print message when there was no error }
  853. if w<>0 then
  854. begin
  855. current_scanner.skipspace;
  856. if c='''' then
  857. hs:=current_scanner.readquotedstring
  858. else
  859. hs:=current_scanner.readcomment;
  860. Message1(w,hs);
  861. end
  862. else
  863. current_scanner.readcomment;
  864. end;
  865. procedure dir_minstacksize;
  866. begin
  867. if not (target_info.system in (systems_windows+systems_wince)) then
  868. Message(scan_w_minstacksize_not_support);
  869. current_scanner.skipspace;
  870. minstacksize:=current_scanner.readval;
  871. MinStackSizeSetExplicity:=true;
  872. end;
  873. procedure dir_mode;
  874. begin
  875. if not current_module.in_global then
  876. Message(scan_w_switch_is_global)
  877. else
  878. begin
  879. current_scanner.skipspace;
  880. current_scanner.readstring;
  881. if not current_module.mode_switch_allowed and
  882. not ((m_mac in current_settings.modeswitches) and (pattern='MACPAS')) then
  883. Message1(scan_e_mode_switch_not_allowed,pattern)
  884. else if not SetCompileMode(pattern,false) then
  885. Message1(scan_w_illegal_switch,pattern)
  886. end;
  887. current_module.mode_switch_allowed:= false;
  888. end;
  889. procedure dir_modeswitch;
  890. var
  891. s : string;
  892. begin
  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:=pattern;
  900. { don't combine the assignments to s as the method call will be
  901. done before "pattern" is assigned to s and the method changes
  902. "pattern" }
  903. s:=s+current_scanner.readoptionalstate('+');
  904. if not SetCompileModeSwitch(s,false) then
  905. Message1(scan_w_illegal_switch,s)
  906. end;
  907. end;
  908. procedure dir_namespace;
  909. var
  910. s : string;
  911. begin
  912. { used to define Java package names for all types declared in the
  913. current unit }
  914. if not current_module.in_global then
  915. Message(scan_w_switch_is_global)
  916. else
  917. begin
  918. current_scanner.skipspace;
  919. current_scanner.readstring;
  920. s:=orgpattern;
  921. while c='.' do
  922. begin
  923. current_scanner.readchar;
  924. current_scanner.readstring;
  925. s:=s+'.'+orgpattern;
  926. end;
  927. disposestr(current_module.namespace);
  928. current_module.namespace:=stringdup(s);
  929. end;
  930. end;
  931. procedure dir_legacyifend;
  932. begin
  933. do_localswitch(cs_legacyifend);
  934. end;
  935. procedure dir_mmx;
  936. begin
  937. do_localswitch(cs_mmx);
  938. end;
  939. procedure dir_note;
  940. begin
  941. do_message(scan_n_user_defined);
  942. end;
  943. procedure dir_notes;
  944. begin
  945. do_setverbose('N');
  946. end;
  947. procedure dir_objectpath;
  948. begin
  949. if not current_module.in_global then
  950. Message(scan_w_switch_is_global)
  951. else
  952. begin
  953. current_scanner.skipspace;
  954. current_module.localobjectsearchpath.AddPath(current_scanner.readcomment,false);
  955. end;
  956. end;
  957. procedure dir_openstrings;
  958. begin
  959. do_delphiswitch('P');
  960. end;
  961. procedure dir_optimization;
  962. var
  963. hs : string;
  964. begin
  965. current_scanner.skipspace;
  966. { Support also the ON and OFF as switch }
  967. hs:=current_scanner.readid;
  968. if (hs='ON') then
  969. current_settings.optimizerswitches:=level2optimizerswitches
  970. else if (hs='OFF') then
  971. current_settings.optimizerswitches:=[]
  972. else if (hs='DEFAULT') then
  973. current_settings.optimizerswitches:=init_settings.optimizerswitches
  974. else
  975. begin
  976. if not UpdateOptimizerStr(hs,current_settings.optimizerswitches) then
  977. Message1(scan_e_illegal_optimization_specifier,hs);
  978. end;
  979. end;
  980. procedure dir_overflowchecks;
  981. begin
  982. do_delphiswitch('Q');
  983. end;
  984. procedure dir_packenum;
  985. var
  986. hs : string;
  987. begin
  988. current_scanner.skipspace;
  989. if not(c in ['0'..'9']) then
  990. begin
  991. hs:=current_scanner.readid;
  992. if (hs='NORMAL') or (hs='DEFAULT') then
  993. current_settings.packenum:=4
  994. else
  995. Message1(scan_e_illegal_pack_enum, hs);
  996. end
  997. else
  998. begin
  999. case current_scanner.readval of
  1000. 1 : current_settings.packenum:=1;
  1001. 2 : current_settings.packenum:=2;
  1002. 4 : current_settings.packenum:=4;
  1003. else
  1004. Message1(scan_e_illegal_pack_enum, pattern);
  1005. end;
  1006. end;
  1007. end;
  1008. procedure dir_minfpconstprec;
  1009. begin
  1010. current_scanner.skipspace;
  1011. if not SetMinFPConstPrec(current_scanner.readid,current_settings.minfpconstprec) then
  1012. Message1(scan_e_illegal_minfpconstprec, pattern);
  1013. end;
  1014. procedure dir_packrecords;
  1015. var
  1016. hs : string;
  1017. begin
  1018. { can't change packrecords setting on managed vm targets }
  1019. if target_info.system in systems_managed_vm then
  1020. Message1(scanner_w_directive_ignored_on_target, 'PACKRECORDS');
  1021. current_scanner.skipspace;
  1022. if not(c in ['0'..'9']) then
  1023. begin
  1024. hs:=current_scanner.readid;
  1025. { C has the special recordalignmax of C_alignment }
  1026. if (hs='C') then
  1027. current_settings.packrecords:=C_alignment
  1028. else
  1029. if (hs='NORMAL') or (hs='DEFAULT') then
  1030. current_settings.packrecords:=default_settings.packrecords
  1031. else
  1032. Message1(scan_e_illegal_pack_records,hs);
  1033. end
  1034. else
  1035. begin
  1036. case current_scanner.readval of
  1037. 1 : current_settings.packrecords:=1;
  1038. 2 : current_settings.packrecords:=2;
  1039. 4 : current_settings.packrecords:=4;
  1040. 8 : current_settings.packrecords:=8;
  1041. 16 : current_settings.packrecords:=16;
  1042. 32 : current_settings.packrecords:=32;
  1043. else
  1044. Message1(scan_e_illegal_pack_records,pattern);
  1045. end;
  1046. end;
  1047. end;
  1048. procedure dir_packset;
  1049. var
  1050. hs : string;
  1051. begin
  1052. current_scanner.skipspace;
  1053. if not(c in ['1','2','4','8']) then
  1054. begin
  1055. hs:=current_scanner.readid;
  1056. if (hs='FIXED') or (hs='DEFAULT') OR (hs='NORMAL') then
  1057. current_settings.setalloc:=0 {Fixed mode, sets are 4 or 32 bytes}
  1058. else
  1059. Message(scan_e_only_packset);
  1060. end
  1061. else
  1062. begin
  1063. case current_scanner.readval of
  1064. 1 : current_settings.setalloc:=1;
  1065. 2 : current_settings.setalloc:=2;
  1066. 4 : current_settings.setalloc:=4;
  1067. 8 : current_settings.setalloc:=8;
  1068. else
  1069. Message(scan_e_only_packset);
  1070. end;
  1071. end;
  1072. end;
  1073. procedure dir_pic;
  1074. begin
  1075. { windows doesn't need/support pic }
  1076. if tf_no_pic_supported in target_info.flags then
  1077. message(scan_w_pic_ignored)
  1078. else
  1079. do_moduleswitch(cs_create_pic);
  1080. end;
  1081. procedure dir_pop;
  1082. begin
  1083. if switchesstatestackpos < 1 then
  1084. Message(scan_e_too_many_pop)
  1085. else
  1086. begin
  1087. Dec(switchesstatestackpos);
  1088. recordpendinglocalfullswitch(switchesstatestack[switchesstatestackpos].localsw);
  1089. recordpendingverbosityfullswitch(switchesstatestack[switchesstatestackpos].verbosity);
  1090. recordpendingalignmentfullswitch(switchesstatestack[switchesstatestackpos].alignment);
  1091. recordpendingpackenum(switchesstatestack[switchesstatestackpos].packenum);
  1092. recordpendingpackrecords(switchesstatestack[switchesstatestackpos].packrecords);
  1093. recordpendingsetalloc(switchesstatestack[switchesstatestackpos].setalloc);
  1094. pendingstate.nextmessagerecord:=switchesstatestack[switchesstatestackpos].pmessage;
  1095. { Reset verbosity and forget previous pmeesage }
  1096. RestoreLocalVerbosity(nil);
  1097. current_settings.pmessage:=nil;
  1098. { Do not yet activate these changes, as otherwise
  1099. you get problem idf you put a $pop just right after
  1100. a addition for instance fro which you explicitly truned the overflow check
  1101. out by using $Q- after a $push PM 2012-08-29 }
  1102. // flushpendingswitchesstate;
  1103. end;
  1104. end;
  1105. procedure dir_pointermath;
  1106. begin
  1107. do_localswitch(cs_pointermath);
  1108. end;
  1109. procedure dir_profile;
  1110. begin
  1111. do_moduleswitch(cs_profile);
  1112. { defined/undefine FPC_PROFILE }
  1113. if cs_profile in current_settings.moduleswitches then
  1114. def_system_macro('FPC_PROFILE')
  1115. else
  1116. undef_system_macro('FPC_PROFILE');
  1117. end;
  1118. procedure dir_push;
  1119. begin
  1120. if switchesstatestackpos > switchesstatestackmax then
  1121. Message(scan_e_too_many_push);
  1122. { do not flush here as we might have read directives which shall not be active yet,
  1123. see e.g. tests/webtbs/tw22744b.pp }
  1124. if psf_alignment_changed in pendingstate.flags then
  1125. switchesstatestack[switchesstatestackpos].alignment:=pendingstate.nextalignment
  1126. else
  1127. switchesstatestack[switchesstatestackpos].alignment:=current_settings.alignment;
  1128. if psf_verbosity_full_switched in pendingstate.flags then
  1129. switchesstatestack[switchesstatestackpos].verbosity:=pendingstate.nextverbosityfullswitch
  1130. else
  1131. switchesstatestack[switchesstatestackpos].verbosity:=status.verbosity;
  1132. if psf_local_switches_changed in pendingstate.flags then
  1133. switchesstatestack[switchesstatestackpos].localsw:=pendingstate.nextlocalswitches
  1134. else
  1135. switchesstatestack[switchesstatestackpos].localsw:=current_settings.localswitches;
  1136. if psf_packenum_changed in pendingstate.flags then
  1137. switchesstatestack[switchesstatestackpos].packenum:=pendingstate.nextpackenum
  1138. else
  1139. switchesstatestack[switchesstatestackpos].packenum:=current_settings.packenum;
  1140. if psf_packrecords_changed in pendingstate.flags then
  1141. switchesstatestack[switchesstatestackpos].packrecords:=pendingstate.nextpackrecords
  1142. else
  1143. switchesstatestack[switchesstatestackpos].packrecords:=current_settings.packrecords;
  1144. if psf_setalloc_changed in pendingstate.flags then
  1145. switchesstatestack[switchesstatestackpos].setalloc:=pendingstate.nextsetalloc
  1146. else
  1147. switchesstatestack[switchesstatestackpos].setalloc:=current_settings.setalloc;
  1148. switchesstatestack[switchesstatestackpos].pmessage:=pendingstate.nextmessagerecord;
  1149. Inc(switchesstatestackpos);
  1150. end;
  1151. procedure dir_rangechecks;
  1152. begin
  1153. do_delphiswitch('R');
  1154. end;
  1155. procedure dir_referenceinfo;
  1156. begin
  1157. do_delphiswitch('Y');
  1158. end;
  1159. procedure dir_resource;
  1160. var
  1161. s : string;
  1162. begin
  1163. current_scanner.skipspace;
  1164. if scanner.c = '''' then
  1165. begin
  1166. s:= current_scanner.readquotedstring;
  1167. current_scanner.readcomment
  1168. end
  1169. else
  1170. s:= trimspace(current_scanner.readcomment);
  1171. { replace * with the name of the main source.
  1172. This should always be defined. }
  1173. if s[1]='*' then
  1174. if Assigned(Current_Module) then
  1175. begin
  1176. delete(S,1,1);
  1177. insert(ChangeFileExt(ExtractFileName(current_module.mainsource),''),S,1 );
  1178. end;
  1179. s:=FixFileName(s);
  1180. if ExtractFileExt(s)='' then
  1181. s:=ChangeFileExt(s,target_info.resext);
  1182. if target_info.res<>res_none then
  1183. begin
  1184. include(current_module.moduleflags,mf_has_resourcefiles);
  1185. if (res_single_file in target_res.resflags) and
  1186. not (Current_module.ResourceFiles.Empty) then
  1187. Message(scan_w_only_one_resourcefile_supported)
  1188. else
  1189. current_module.resourcefiles.insert(FixFileName(s));
  1190. end
  1191. else
  1192. Message(scan_e_resourcefiles_not_supported);
  1193. end;
  1194. procedure dir_saturation;
  1195. begin
  1196. do_localswitch(cs_mmx_saturation);
  1197. end;
  1198. procedure dir_safefpuexceptions;
  1199. begin
  1200. do_localswitch(cs_fpu_fwait);
  1201. end;
  1202. procedure dir_scopedenums;
  1203. begin
  1204. do_localswitch(cs_scopedenums);
  1205. end;
  1206. function get_peflag_const(const ident:string;error:longint):longint;
  1207. var
  1208. srsym : tsym;
  1209. srsymtable : tsymtable;
  1210. begin
  1211. result:=0;
  1212. if searchsym(ident,srsym,srsymtable) then
  1213. if (srsym.typ=constsym) and
  1214. (tconstsym(srsym).consttyp=constord) and
  1215. is_integer(tconstsym(srsym).constdef) then
  1216. with tconstsym(srsym).value.valueord do
  1217. if signed then
  1218. result:=tconstsym(srsym).value.valueord.svalue
  1219. else
  1220. result:=tconstsym(srsym).value.valueord.uvalue
  1221. else
  1222. message(error)
  1223. else
  1224. message1(sym_e_id_not_found,ident);
  1225. end;
  1226. procedure dir_setpeflags;
  1227. var
  1228. flags : int64;
  1229. begin
  1230. if not (target_info.system in (systems_all_windows)) then
  1231. Message(scan_w_setpeflags_not_support);
  1232. if current_scanner.readpreprocint(flags,'SETPEFLAGS') then
  1233. begin
  1234. if flags>$ffff then
  1235. message(scan_e_illegal_peflag);
  1236. peflags:=peflags or uint16(flags);
  1237. end;
  1238. SetPEFlagsSetExplicity:=true;
  1239. end;
  1240. procedure dir_setpeoptflags;
  1241. var
  1242. flags : int64;
  1243. begin
  1244. if not (target_info.system in (systems_all_windows)) then
  1245. Message(scan_w_setpeoptflags_not_support);
  1246. if current_scanner.readpreprocint(flags,'SETPEOPTFLAGS') then
  1247. begin
  1248. if flags>$ffff then
  1249. message(scan_e_illegal_peoptflag);
  1250. peoptflags:=peoptflags or uint16(flags);
  1251. end;
  1252. SetPEOptFlagsSetExplicity:=true;
  1253. end;
  1254. procedure dir_setpeuserversion;
  1255. var
  1256. dummystr : string;
  1257. dummyrev : word;
  1258. begin
  1259. if not (target_info.system in systems_all_windows) then
  1260. Message(scan_w_setpeuserversion_not_support);
  1261. if (compile_level<>1) then
  1262. Message(scan_n_only_exe_version)
  1263. else
  1264. do_version(peuserversionmajor,peuserversionminor,dummyrev,dummystr,false,SetPEUserVersionSetExplicitely);
  1265. end;
  1266. procedure dir_setpeosversion;
  1267. var
  1268. dummystr : string;
  1269. dummyrev : word;
  1270. begin
  1271. if not (target_info.system in systems_all_windows) then
  1272. Message(scan_w_setpeosversion_not_support);
  1273. if (compile_level<>1) then
  1274. Message(scan_n_only_exe_version)
  1275. else
  1276. do_version(peosversionmajor,peosversionminor,dummyrev,dummystr,false,SetPEOSVersionSetExplicitely);
  1277. end;
  1278. procedure dir_setpesubsysversion;
  1279. var
  1280. dummystr : string;
  1281. dummyrev : word;
  1282. begin
  1283. if not (target_info.system in systems_all_windows) then
  1284. Message(scan_w_setpesubsysversion_not_support);
  1285. if (compile_level<>1) then
  1286. Message(scan_n_only_exe_version)
  1287. else
  1288. do_version(pesubsysversionmajor,pesubsysversionminor,dummyrev,dummystr,false,SetPESubSysVersionSetExplicitely);
  1289. end;
  1290. procedure dir_smartlink;
  1291. begin
  1292. do_moduleswitch(cs_create_smart);
  1293. if (target_dbg.id in [dbg_dwarf2,dbg_dwarf3]) and
  1294. not(target_info.system in (systems_darwin+[system_i8086_msdos,system_i8086_embedded])) and
  1295. { smart linking does not yet work with DWARF debug info on most targets }
  1296. (cs_create_smart in current_settings.moduleswitches) and
  1297. not (af_outputbinary in target_asm.flags) then
  1298. begin
  1299. Message(option_dwarf_smart_linking);
  1300. Exclude(current_settings.moduleswitches,cs_create_smart);
  1301. end;
  1302. { Also create a smartlinked version, on an assembler that
  1303. does not support smartlink sections like nasm?
  1304. This is not compatible with using internal linker. }
  1305. if ((cs_link_smart in current_settings.globalswitches) or
  1306. (cs_create_smart in current_settings.moduleswitches)) and
  1307. (af_needar in target_asm.flags) and
  1308. not (af_smartlink_sections in target_asm.flags) and
  1309. not (cs_link_extern in current_settings.globalswitches) then
  1310. begin
  1311. DoneLinker;
  1312. Message(option_smart_link_requires_external_linker);
  1313. include(current_settings.globalswitches,cs_link_extern);
  1314. InitLinker;
  1315. end
  1316. end;
  1317. procedure dir_stackframes;
  1318. begin
  1319. do_delphiswitch('W');
  1320. end;
  1321. procedure dir_stop;
  1322. begin
  1323. do_message(scan_f_user_defined);
  1324. end;
  1325. procedure dir_stringchecks;
  1326. begin
  1327. // Delphi adds checks that ansistring and unicodestring are correct in
  1328. // different places. Skip it for now.
  1329. end;
  1330. procedure dir_syscall;
  1331. var
  1332. sctype : string;
  1333. syscall : psyscallinfo;
  1334. begin
  1335. current_scanner.skipspace;
  1336. sctype:=current_scanner.readid;
  1337. syscall:=get_syscall_by_name(sctype);
  1338. if assigned(syscall) then
  1339. begin
  1340. if not (target_info.system in syscall^.validon) then
  1341. Message(scan_w_syscall_convention_not_useable_on_target)
  1342. else
  1343. set_default_syscall(syscall^.procoption);
  1344. exit;
  1345. end;
  1346. Message(scan_w_syscall_convention_invalid);
  1347. end;
  1348. procedure dir_targetswitch;
  1349. var
  1350. name, value: string;
  1351. begin
  1352. { note: *not* recorded in the tokenstream, so not replayed for generics }
  1353. current_scanner.skipspace;
  1354. name:=current_scanner.readid;
  1355. if c='=' then
  1356. begin
  1357. current_scanner.readchar;
  1358. current_scanner.readid;
  1359. value:=orgpattern;
  1360. UpdateTargetSwitchStr(name+'='+value,current_settings.targetswitches,current_module.in_global);
  1361. end
  1362. else if c='-' then
  1363. begin
  1364. current_scanner.readchar;
  1365. UpdateTargetSwitchStr(name+'-',current_settings.targetswitches,current_module.in_global);
  1366. end
  1367. else
  1368. UpdateTargetSwitchStr(name,current_settings.targetswitches,current_module.in_global);
  1369. end;
  1370. procedure dir_typedaddress;
  1371. begin
  1372. do_delphiswitch('T');
  1373. end;
  1374. procedure dir_typeinfo;
  1375. begin
  1376. do_delphiswitch('M');
  1377. end;
  1378. procedure dir_unitpath;
  1379. var
  1380. unitpath: TPathStr;
  1381. begin
  1382. if not current_module.in_global then
  1383. Message(scan_w_switch_is_global)
  1384. else
  1385. begin
  1386. current_scanner.skipspace;
  1387. unitpath:=current_scanner.readcomment;
  1388. if (current_module.path<>'') and
  1389. not path_absolute(unitpath) then
  1390. unitpath:=current_module.path+source_info.DirSep+unitpath;
  1391. current_module.localunitsearchpath.AddPath(unitpath,false);
  1392. end;
  1393. end;
  1394. procedure dir_varparacopyoutcheck;
  1395. begin
  1396. if not(target_info.system in systems_jvm) then
  1397. begin
  1398. Message1(scan_w_illegal_switch,pattern);
  1399. exit;
  1400. end;
  1401. do_localswitch(cs_check_var_copyout);
  1402. end;
  1403. procedure dir_varpropsetter;
  1404. begin
  1405. do_localswitch(cs_varpropsetter);
  1406. end;
  1407. procedure dir_varstringchecks;
  1408. begin
  1409. do_delphiswitch('V');
  1410. end;
  1411. procedure dir_version;
  1412. var
  1413. major, minor, revision : longint;
  1414. error : integer;
  1415. begin
  1416. if not (target_info.system in systems_all_windows+[system_i386_os2,system_i386_emx,
  1417. system_i386_netware,system_i386_wdosx,
  1418. system_i386_netwlibc]) then
  1419. begin
  1420. Message(scan_n_version_not_support);
  1421. exit;
  1422. end;
  1423. if (compile_level<>1) then
  1424. Message(scan_n_only_exe_version)
  1425. else
  1426. begin
  1427. { change description global var in all cases }
  1428. { it not used but in win32, os2 and netware }
  1429. current_scanner.skipspace;
  1430. { we should only accept Major.Minor format for win32 and os2 }
  1431. current_scanner.readnumber;
  1432. major:=0;
  1433. minor:=0;
  1434. revision:=0;
  1435. val(pattern,major,error);
  1436. if (error<>0) or (major > high(word)) or (major < 0) then
  1437. begin
  1438. Message1(scan_w_wrong_version_ignored,pattern);
  1439. exit;
  1440. end;
  1441. if c='.' then
  1442. begin
  1443. current_scanner.readchar;
  1444. current_scanner.readnumber;
  1445. val(pattern,minor,error);
  1446. if (error<>0) or (minor > high(word)) or (minor < 0) then
  1447. begin
  1448. Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
  1449. exit;
  1450. end;
  1451. if (c='.') and
  1452. (target_info.system in [system_i386_netware,system_i386_netwlibc]) then
  1453. begin
  1454. current_scanner.readchar;
  1455. current_scanner.readnumber;
  1456. val(pattern,revision,error);
  1457. if (error<>0) or (revision > high(word)) or (revision < 0) then
  1458. begin
  1459. Message1(scan_w_wrong_version_ignored,tostr(revision)+'.'+pattern);
  1460. exit;
  1461. end;
  1462. dllmajor:=word(major);
  1463. dllminor:=word(minor);
  1464. dllrevision:=word(revision);
  1465. dllversion:=tostr(major)+','+tostr(minor)+','+tostr(revision);
  1466. end
  1467. else
  1468. begin
  1469. dllmajor:=word(major);
  1470. dllminor:=word(minor);
  1471. dllversion:=tostr(major)+'.'+tostr(minor);
  1472. end;
  1473. end
  1474. else
  1475. dllversion:=tostr(major);
  1476. end;
  1477. end;
  1478. procedure dir_wait;
  1479. var
  1480. had_info : boolean;
  1481. begin
  1482. had_info:=(status.verbosity and V_Info)<>0;
  1483. { this message should allways appear !! }
  1484. status.verbosity:=status.verbosity or V_Info;
  1485. Message(scan_i_press_enter);
  1486. readln;
  1487. If not(had_info) then
  1488. status.verbosity:=status.verbosity and (not V_Info);
  1489. end;
  1490. { delphi compatible warn directive:
  1491. $warn <identifier> on
  1492. $warn <identifier> off
  1493. $warn <identifier> error
  1494. }
  1495. procedure dir_warn;
  1496. var
  1497. ident : string;
  1498. state : string;
  1499. msgstate : tmsgstate;
  1500. i : integer;
  1501. begin
  1502. current_scanner.skipspace;
  1503. ident:=current_scanner.readid;
  1504. current_scanner.skipspace;
  1505. state:=current_scanner.readid;
  1506. { support both delphi and fpc switches }
  1507. { use local ms_on/off/error tmsgstate values }
  1508. if (state='ON') or (state='+') then
  1509. msgstate:=ms_on
  1510. else
  1511. if (state='OFF') or (state='-') then
  1512. msgstate:=ms_off
  1513. else
  1514. if (state='ERROR') then
  1515. msgstate:=ms_error
  1516. else
  1517. begin
  1518. Message1(scanner_e_illegal_warn_state,state);
  1519. exit;
  1520. end;
  1521. if ident='CONSTRUCTING_ABSTRACT' then
  1522. begin
  1523. recordpendingmessagestate(type_w_instance_with_abstract, msgstate);
  1524. recordpendingmessagestate(type_w_instance_abstract_class, msgstate);
  1525. end
  1526. else
  1527. if ident='IMPLICIT_VARIANTS' then
  1528. recordpendingmessagestate(parser_w_implicit_uses_of_variants_unit, msgstate)
  1529. else
  1530. if ident='NO_RETVAL' then
  1531. recordpendingmessagestate(sym_w_function_result_not_set, msgstate)
  1532. else
  1533. if ident='SYMBOL_DEPRECATED' then
  1534. begin
  1535. recordpendingmessagestate(sym_w_deprecated_symbol, msgstate);
  1536. recordpendingmessagestate(sym_w_deprecated_symbol_with_msg, msgstate);
  1537. end
  1538. else
  1539. if ident='SYMBOL_EXPERIMENTAL' then
  1540. recordpendingmessagestate(sym_w_experimental_symbol, msgstate)
  1541. else
  1542. if ident='SYMBOL_LIBRARY' then
  1543. recordpendingmessagestate(sym_w_library_symbol, msgstate)
  1544. else
  1545. if ident='SYMBOL_PLATFORM' then
  1546. recordpendingmessagestate(sym_w_non_portable_symbol, msgstate)
  1547. else
  1548. if ident='SYMBOL_UNIMPLEMENTED' then
  1549. recordpendingmessagestate(sym_w_non_implemented_symbol, msgstate)
  1550. else
  1551. if ident='UNIT_DEPRECATED' then
  1552. begin
  1553. recordpendingmessagestate(sym_w_deprecated_unit, msgstate);
  1554. recordpendingmessagestate(sym_w_deprecated_unit_with_msg, msgstate);
  1555. end
  1556. else
  1557. if ident='UNIT_EXPERIMENTAL' then
  1558. recordpendingmessagestate(sym_w_experimental_unit, msgstate)
  1559. else
  1560. if ident='UNIT_LIBRARY' then
  1561. recordpendingmessagestate(sym_w_library_unit, msgstate)
  1562. else
  1563. if ident='UNIT_PLATFORM' then
  1564. recordpendingmessagestate(sym_w_non_portable_unit, msgstate)
  1565. else
  1566. if ident='UNIT_UNIMPLEMENTED' then
  1567. recordpendingmessagestate(sym_w_non_implemented_unit, msgstate)
  1568. else
  1569. if ident='ZERO_NIL_COMPAT' then
  1570. recordpendingmessagestate(type_w_zero_to_nil, msgstate)
  1571. else
  1572. if ident='IMPLICIT_STRING_CAST' then
  1573. recordpendingmessagestate(type_w_implicit_string_cast, msgstate)
  1574. else
  1575. if ident='IMPLICIT_STRING_CAST_LOSS' then
  1576. recordpendingmessagestate(type_w_implicit_string_cast_loss, msgstate)
  1577. else
  1578. if ident='EXPLICIT_STRING_CAST' then
  1579. recordpendingmessagestate(type_w_explicit_string_cast, msgstate)
  1580. else
  1581. if ident='EXPLICIT_STRING_CAST_LOSS' then
  1582. recordpendingmessagestate(type_w_explicit_string_cast_loss, msgstate)
  1583. else
  1584. if ident='CVT_NARROWING_STRING_LOST' then
  1585. recordpendingmessagestate(type_w_unicode_data_loss, msgstate)
  1586. else
  1587. if ident='INTF_RAISE_VISIBILITY' then
  1588. recordpendingmessagestate(type_w_interface_lower_visibility, msgstate)
  1589. else
  1590. begin
  1591. i:=0;
  1592. if not ChangeMessageVerbosity(ident,i,msgstate) then
  1593. Message1(scanner_w_illegal_warn_identifier,ident);
  1594. end;
  1595. end;
  1596. procedure dir_warning;
  1597. begin
  1598. do_message(scan_w_user_defined);
  1599. end;
  1600. procedure dir_warnings;
  1601. begin
  1602. do_setverbose('W');
  1603. end;
  1604. procedure dir_weakpackageunit;
  1605. begin
  1606. { old Delphi versions seem to use merely $WEAKPACKAGEUNIT while newer
  1607. Delphis have $WEAPACKAGEUNIT ON... :/ }
  1608. do_moduleflagswitch(mf_package_weak, true);
  1609. end;
  1610. procedure dir_writeableconst;
  1611. begin
  1612. do_delphiswitch('J');
  1613. end;
  1614. procedure dir_z1;
  1615. begin
  1616. current_settings.packenum:=1;
  1617. end;
  1618. procedure dir_z2;
  1619. begin
  1620. current_settings.packenum:=2;
  1621. end;
  1622. procedure dir_z4;
  1623. begin
  1624. current_settings.packenum:=4;
  1625. end;
  1626. procedure dir_externalsym;
  1627. begin
  1628. end;
  1629. procedure dir_nodefine;
  1630. begin
  1631. end;
  1632. procedure dir_hppemit;
  1633. begin
  1634. end;
  1635. procedure dir_hugecode;
  1636. begin
  1637. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded])
  1638. {$ifdef i8086}
  1639. or (current_settings.x86memorymodel in x86_near_code_models)
  1640. {$endif i8086}
  1641. then
  1642. begin
  1643. Message1(scan_n_ignored_switch,pattern);
  1644. exit;
  1645. end;
  1646. do_moduleswitch(cs_huge_code);
  1647. end;
  1648. procedure dir_hugepointernormalization;
  1649. var
  1650. hs : string;
  1651. begin
  1652. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  1653. begin
  1654. Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERNORMALIZATION');
  1655. exit;
  1656. end;
  1657. current_scanner.skipspace;
  1658. hs:=current_scanner.readid;
  1659. case hs of
  1660. 'BORLANDC':
  1661. begin
  1662. recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'+');
  1663. recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'+');
  1664. end;
  1665. 'MICROSOFTC':
  1666. begin
  1667. recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'-');
  1668. recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'-');
  1669. end;
  1670. 'WATCOMC':
  1671. begin
  1672. recordpendinglocalswitch(cs_hugeptr_arithmetic_normalization,'-');
  1673. recordpendinglocalswitch(cs_hugeptr_comparison_normalization,'+');
  1674. end;
  1675. else
  1676. Message(scan_e_illegal_hugepointernormalization);
  1677. end;
  1678. end;
  1679. procedure dir_hugepointerarithmeticnormalization;
  1680. begin
  1681. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  1682. begin
  1683. Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERARITHMETICNORMALIZATION');
  1684. exit;
  1685. end;
  1686. do_localswitch(cs_hugeptr_arithmetic_normalization);
  1687. end;
  1688. procedure dir_hugepointercomparisonnormalization;
  1689. begin
  1690. if not (target_info.system in [system_i8086_msdos,system_i8086_embedded]) then
  1691. begin
  1692. Message1(scanner_w_directive_ignored_on_target, 'HUGEPOINTERCOMPARISONNORMALIZATION');
  1693. exit;
  1694. end;
  1695. do_localswitch(cs_hugeptr_comparison_normalization);
  1696. end;
  1697. procedure dir_codealign;
  1698. var
  1699. s : string;
  1700. begin
  1701. current_scanner.skipspace;
  1702. s:=current_scanner.readcomment;
  1703. if not(UpdateAlignmentStr(s,current_settings.alignment)) then
  1704. message(scanner_e_illegal_alignment_directive);
  1705. end;
  1706. procedure dir_codepage;
  1707. var
  1708. s : string;
  1709. begin
  1710. if not current_module.in_global then
  1711. Message(scan_w_switch_is_global)
  1712. else
  1713. begin
  1714. current_scanner.skipspace;
  1715. s:=current_scanner.readcomment;
  1716. if (upper(s)='UTF8') or (upper(s)='UTF-8') then
  1717. current_settings.sourcecodepage:=CP_UTF8
  1718. else if not cpavailable(s) then
  1719. Message1(option_code_page_not_available,s)
  1720. else
  1721. current_settings.sourcecodepage:=codepagebyname(s);
  1722. { we're not using the system code page now }
  1723. exclude(current_settings.modeswitches,m_systemcodepage);
  1724. exclude(current_settings.moduleswitches,cs_system_codepage);
  1725. include(current_settings.moduleswitches,cs_explicit_codepage);
  1726. end;
  1727. end;
  1728. procedure dir_coperators;
  1729. begin
  1730. do_moduleswitch(cs_support_c_operators);
  1731. end;
  1732. procedure dir_bitpacking;
  1733. begin
  1734. do_localswitch(cs_bitpacking);
  1735. end;
  1736. procedure dir_region;
  1737. begin
  1738. current_scanner.skipspace;
  1739. current_scanner.readquotedstring;
  1740. end;
  1741. procedure dir_endregion;
  1742. begin
  1743. end;
  1744. procedure dir_zerobasesstrings;
  1745. begin
  1746. do_localswitch(cs_zerobasedstrings);
  1747. end;
  1748. {****************************************************************************
  1749. Initialize Directives
  1750. ****************************************************************************}
  1751. procedure InitScannerDirectives;
  1752. begin
  1753. AddDirective('A1',directive_all, @dir_a1);
  1754. AddDirective('A2',directive_all, @dir_a2);
  1755. AddDirective('A4',directive_all, @dir_a4);
  1756. AddDirective('A8',directive_all, @dir_a8);
  1757. AddDirective('ALIGN',directive_all, @dir_align);
  1758. {$ifdef m68k}
  1759. AddDirective('APPID',directive_all, @dir_appid);
  1760. AddDirective('APPNAME',directive_all, @dir_appname);
  1761. {$endif m68k}
  1762. AddDirective('APPTYPE',directive_all, @dir_apptype);
  1763. AddDirective('ASMCPU',directive_all, @dir_asmcpu);
  1764. AddDirective('ASMMODE',directive_all, @dir_asmmode);
  1765. AddDirective('ASSERTIONS',directive_all, @dir_assertions);
  1766. AddDirective('BOOLEVAL',directive_all, @dir_booleval);
  1767. AddDirective('BITPACKING',directive_all, @dir_bitpacking);
  1768. AddDirective('CALLING',directive_all, @dir_calling);
  1769. AddDirective('CHECKCASECOVERAGE',directive_all, @dir_checkcasecoverage);
  1770. AddDirective('CHECKFPUEXCEPTIONS',directive_all, @dir_checkfpuexceptions);
  1771. AddDirective('CHECKLOWADDRLOADS',directive_all, @dir_checklowaddrloads);
  1772. AddDirective('CHECKPOINTER',directive_all, @dir_checkpointer);
  1773. AddDirective('CODEALIGN',directive_all, @dir_codealign);
  1774. AddDirective('CODEPAGE',directive_all, @dir_codepage);
  1775. AddDirective('COPERATORS',directive_all, @dir_coperators);
  1776. AddDirective('COPYRIGHT',directive_all, @dir_copyright);
  1777. AddDirective('D',directive_all, @dir_description);
  1778. AddDirective('DEBUGINFO',directive_all, @dir_debuginfo);
  1779. AddDirective('DENYPACKAGEUNIT',directive_all,@dir_denypackageunit);
  1780. AddDirective('DESCRIPTION',directive_all, @dir_description);
  1781. AddDirective('ENDREGION',directive_all, @dir_endregion);
  1782. AddDirective('ERROR',directive_all, @dir_error);
  1783. AddDirective('ERRORC',directive_mac, @dir_error);
  1784. AddDirective('EXCESSPRECISION',directive_all, @dir_excessprecision);
  1785. AddDirective('EXTENDEDSYNTAX',directive_all, @dir_extendedsyntax);
  1786. AddDirective('EXTERNALSYM',directive_all, @dir_externalsym);
  1787. AddDirective('F',directive_all, @dir_forcefarcalls);
  1788. AddDirective('FARCALLS',directive_all, @dir_forcefarcalls);
  1789. AddDirective('FATAL',directive_all, @dir_fatal);
  1790. AddDirective('FLOATINGPOINTEMULATION',directive_all,@dir_floatingpointemulation);
  1791. AddDirective('FPUTYPE',directive_all, @dir_fputype);
  1792. AddDirective('FRAMEWORKPATH',directive_all, @dir_frameworkpath);
  1793. AddDirective('GOTO',directive_all, @dir_goto);
  1794. AddDirective('HINT',directive_all, @dir_hint);
  1795. AddDirective('HINTS',directive_all, @dir_hints);
  1796. AddDirective('HPPEMIT',directive_all, @dir_hppemit);
  1797. AddDirective('HUGECODE',directive_all, @dir_hugecode);
  1798. AddDirective('HUGEPOINTERNORMALIZATION',directive_all,@dir_hugepointernormalization);
  1799. AddDirective('HUGEPOINTERARITHMETICNORMALIZATION',directive_all,@dir_hugepointerarithmeticnormalization);
  1800. AddDirective('HUGEPOINTERCOMPARISONNORMALIZATION',directive_all,@dir_hugepointercomparisonnormalization);
  1801. AddDirective('IEEEERRORS',directive_all,@dir_ieeeerrors);
  1802. AddDirective('IOCHECKS',directive_all, @dir_iochecks);
  1803. AddDirective('IMAGEBASE',directive_all, @dir_imagebase);
  1804. AddDirective('IMPLICITEXCEPTIONS',directive_all, @dir_implicitexceptions);
  1805. AddDirective('IMPORTEDDATA',directive_all, @dir_importeddata);
  1806. AddDirective('INCLUDEPATH',directive_all, @dir_includepath);
  1807. AddDirective('INFO',directive_all, @dir_info);
  1808. AddDirective('INLINE',directive_all, @dir_inline);
  1809. AddDirective('INTERFACES',directive_all, @dir_interfaces);
  1810. AddDirective('L',directive_all, @dir_link);
  1811. AddDirective('LEGACYIFEND',directive_all, @dir_legacyifend);
  1812. AddDirective('LIBEXPORT',directive_mac, @dir_libexport);
  1813. AddDirective('LIBRARYPATH',directive_all, @dir_librarypath);
  1814. AddDirective('LINK',directive_all, @dir_link);
  1815. AddDirective('LINKFRAMEWORK',directive_all, @dir_linkframework);
  1816. AddDirective('LINKLIB',directive_all, @dir_linklib);
  1817. AddDirective('LOCALSYMBOLS',directive_all, @dir_localsymbols);
  1818. AddDirective('LONGSTRINGS',directive_all, @dir_longstrings);
  1819. AddDirective('M',directive_all, @dir_memory);
  1820. AddDirective('MACRO',directive_all, @dir_macro);
  1821. AddDirective('MAXFPUREGISTERS',directive_all, @dir_maxfpuregisters);
  1822. AddDirective('MAXSTACKSIZE',directive_all, @dir_maxstacksize);
  1823. AddDirective('MEMORY',directive_all, @dir_memory);
  1824. AddDirective('MESSAGE',directive_all, @dir_message);
  1825. AddDirective('MINENUMSIZE',directive_all, @dir_packenum);
  1826. AddDirective('MINFPCONSTPREC',directive_all, @dir_minfpconstprec);
  1827. AddDirective('MINSTACKSIZE',directive_all, @dir_minstacksize);
  1828. AddDirective('MMX',directive_all, @dir_mmx);
  1829. AddDirective('MODE',directive_all, @dir_mode);
  1830. AddDirective('MODESWITCH',directive_all, @dir_modeswitch);
  1831. AddDirective('NAMESPACE',directive_all, @dir_namespace);
  1832. AddDirective('NODEFINE',directive_all, @dir_nodefine);
  1833. AddDirective('NOTE',directive_all, @dir_note);
  1834. AddDirective('NOTES',directive_all, @dir_notes);
  1835. AddDirective('OBJECTCHECKS',directive_all, @dir_objectchecks);
  1836. AddDirective('OBJECTPATH',directive_all, @dir_objectpath);
  1837. AddDirective('OPENSTRINGS',directive_all, @dir_openstrings);
  1838. AddDirective('OPTIMIZATION',directive_all, @dir_optimization);
  1839. AddDirective('OV',directive_mac, @dir_overflowchecks);
  1840. AddDirective('OVERFLOWCHECKS',directive_all, @dir_overflowchecks);
  1841. AddDirective('PACKENUM',directive_all, @dir_packenum);
  1842. AddDirective('PACKRECORDS',directive_all, @dir_packrecords);
  1843. AddDirective('PACKSET',directive_all, @dir_packset);
  1844. AddDirective('PASCALMAINNAME',directive_all, @dir_pascalmainname);
  1845. AddDirective('PIC',directive_all, @dir_pic);
  1846. AddDirective('POINTERMATH',directive_all, @dir_pointermath);
  1847. AddDirective('POP',directive_all, @dir_pop);
  1848. AddDirective('PROFILE',directive_all, @dir_profile);
  1849. AddDirective('PUSH',directive_all, @dir_push);
  1850. AddDirective('R',directive_all, @dir_resource);
  1851. AddDirective('RANGECHECKS',directive_all, @dir_rangechecks);
  1852. AddDirective('REFERENCEINFO',directive_all, @dir_referenceinfo);
  1853. AddDirective('REGION',directive_all, @dir_region);
  1854. AddDirective('RESOURCE',directive_all, @dir_resource);
  1855. AddDirective('SATURATION',directive_all, @dir_saturation);
  1856. AddDirective('SAFEFPUEXCEPTIONS',directive_all, @dir_safefpuexceptions);
  1857. AddDirective('SCOPEDENUMS',directive_all, @dir_scopedenums);
  1858. AddDirective('SETPEFLAGS', directive_all, @dir_setpeflags);
  1859. AddDirective('SETPEOPTFLAGS', directive_all, @dir_setpeoptflags);
  1860. AddDirective('SETPEOSVERSION', directive_all, @dir_setpeosversion);
  1861. AddDirective('SETPEUSERVERSION', directive_all, @dir_setpeuserversion);
  1862. AddDirective('SETPESUBSYSVERSION', directive_all, @dir_setpesubsysversion);
  1863. AddDirective('SCREENNAME',directive_all, @dir_screenname);
  1864. AddDirective('SMARTLINK',directive_all, @dir_smartlink);
  1865. AddDirective('STACKCHECKING',directive_all,@dir_stackchecking);
  1866. AddDirective('STACKFRAMES',directive_all, @dir_stackframes);
  1867. AddDirective('STOP',directive_all, @dir_stop);
  1868. AddDirective('STRINGCHECKS', directive_all, @dir_stringchecks);
  1869. AddDirective('SYSCALL',directive_all, @dir_syscall);
  1870. AddDirective('TARGETSWITCH',directive_all, @dir_targetswitch);
  1871. AddDirective('THREADNAME',directive_all, @dir_threadname);
  1872. AddDirective('TYPEDADDRESS',directive_all, @dir_typedaddress);
  1873. AddDirective('TYPEINFO',directive_all, @dir_typeinfo);
  1874. AddDirective('UNITPATH',directive_all, @dir_unitpath);
  1875. AddDirective('VARPARACOPYOUTCHECK',directive_all, @dir_varparacopyoutcheck);
  1876. AddDirective('VARPROPSETTER',directive_all, @dir_varpropsetter);
  1877. AddDirective('VARSTRINGCHECKS',directive_all, @dir_varstringchecks);
  1878. AddDirective('VERSION',directive_all, @dir_version);
  1879. AddDirective('WAIT',directive_all, @dir_wait);
  1880. AddDirective('WARN',directive_all, @dir_warn);
  1881. AddDirective('WARNING',directive_all, @dir_warning);
  1882. AddDirective('WARNINGS',directive_all, @dir_warnings);
  1883. AddDirective('WEAKPACKAGEUNIT',directive_all, @dir_weakpackageunit);
  1884. AddDirective('WRITEABLECONST',directive_all, @dir_writeableconst);
  1885. AddDirective('Z1',directive_all, @dir_z1);
  1886. AddDirective('Z2',directive_all, @dir_z2);
  1887. AddDirective('Z4',directive_all, @dir_z4);
  1888. AddDirective('ZEROBASEDSTRINGS',directive_all, @dir_zerobasesstrings);
  1889. end;
  1890. end.