scandir.pas 64 KB

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