scandir.pas 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Peter Vreman
  4. This unit implements directive parsing for the scanner
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit scandir;
  19. {$i defines.inc}
  20. interface
  21. procedure InitScannerDirectives;
  22. implementation
  23. uses
  24. {$ifdef delphi}
  25. dmisc,
  26. {$else}
  27. dos,
  28. {$endif}
  29. cutils,
  30. version,globtype,globals,systems,
  31. verbose,comphook,
  32. scanner,switches,
  33. finput,fmodule;
  34. {*****************************************************************************
  35. Helpers
  36. *****************************************************************************}
  37. procedure do_delphiswitch(sw:char);
  38. var
  39. state : char;
  40. begin
  41. { c contains the next char, a + or - would be fine }
  42. state:=current_scanner.readstate;
  43. if state in ['-','+'] then
  44. HandleSwitch(sw,state);
  45. end;
  46. procedure do_setverbose(flag:char);
  47. var
  48. state : char;
  49. begin
  50. { support ON/OFF }
  51. state:=current_scanner.ReadState;
  52. SetVerbosity(flag+state);
  53. end;
  54. procedure do_moduleswitch(sw:tmoduleswitch);
  55. var
  56. state : char;
  57. begin
  58. state:=current_scanner.readstate;
  59. if (sw<>cs_modulenone) and (state in ['-','+']) then
  60. begin
  61. if state='-' then
  62. exclude(aktmoduleswitches,sw)
  63. else
  64. include(aktmoduleswitches,sw);
  65. end;
  66. end;
  67. procedure do_localswitch(sw:tlocalswitch);
  68. var
  69. state : char;
  70. begin
  71. state:=current_scanner.readstate;
  72. if (sw<>cs_localnone) and (state in ['-','+']) then
  73. begin
  74. if not localswitcheschanged then
  75. nextaktlocalswitches:=aktlocalswitches;
  76. if state='-' then
  77. exclude(nextaktlocalswitches,sw)
  78. else
  79. include(nextaktlocalswitches,sw);
  80. localswitcheschanged:=true;
  81. end;
  82. end;
  83. procedure do_message(w:integer);
  84. begin
  85. current_scanner.skipspace;
  86. Message1(w,current_scanner.readcomment);
  87. end;
  88. {*****************************************************************************
  89. Directive Callbacks
  90. *****************************************************************************}
  91. procedure dir_align;
  92. var
  93. hs : string;
  94. begin
  95. current_scanner.skipspace;
  96. if not(c in ['0'..'9']) then
  97. begin
  98. { Support also the ON and OFF as switch }
  99. hs:=current_scanner.readid;
  100. if (hs='ON') then
  101. aktalignment.recordalignmax:=4
  102. else
  103. if (hs='OFF') then
  104. aktalignment.recordalignmax:=1
  105. else
  106. Message(scan_w_only_pack_records);
  107. end
  108. else
  109. begin
  110. case current_scanner.readval of
  111. 1 : aktalignment.recordalignmax:=1;
  112. 2 : aktalignment.recordalignmax:=2;
  113. 4 : aktalignment.recordalignmax:=4;
  114. 8 : aktalignment.recordalignmax:=8;
  115. 16 : aktalignment.recordalignmax:=16;
  116. 32 : aktalignment.recordalignmax:=32;
  117. else
  118. Message(scan_w_only_pack_records);
  119. end;
  120. end;
  121. end;
  122. procedure dir_asmmode;
  123. var
  124. s : string;
  125. begin
  126. current_scanner.skipspace;
  127. s:=current_scanner.readid;
  128. If Inside_asm_statement then
  129. Message1(scan_w_no_asm_reader_switch_inside_asm,s);
  130. if s='DEFAULT' then
  131. aktasmmode:=initasmmode
  132. else
  133. if not set_asmmode_by_string(s,aktasmmode) then
  134. Message1(scan_w_unsupported_asmmode_specifier,s);
  135. end;
  136. {$ifdef m68k}
  137. procedure dir_appid;
  138. begin
  139. if target_info.target<>target_m68k_palmos then
  140. Message(scan_w_appid_not_support);
  141. { change description global var in all cases }
  142. { it not used but in win32 and os2 }
  143. current_scanner^.skipspace;
  144. palmos_applicationid:=current_scanner^.readcomment;
  145. end;
  146. procedure dir_appname;
  147. begin
  148. if target_info.target<>target_m68k_palmos then
  149. Message(scan_w_appname_not_support);
  150. { change description global var in all cases }
  151. { it not used but in win32 and os2 }
  152. current_scanner^.skipspace;
  153. palmos_applicationname:=current_scanner^.readcomment;
  154. end;
  155. {$endif m68k}
  156. procedure dir_apptype;
  157. var
  158. hs : string;
  159. begin
  160. if (target_info.target<>target_i386_win32)
  161. and (target_info.target<>target_i386_os2) then
  162. Message(scan_w_app_type_not_support);
  163. if not current_module.in_global then
  164. Message(scan_w_switch_is_global)
  165. else
  166. begin
  167. current_scanner.skipspace;
  168. hs:=current_scanner.readid;
  169. if hs='GUI' then
  170. apptype:=app_gui
  171. else if hs='CONSOLE' then
  172. apptype:=app_cui
  173. else if (hs='FS') and (target_info.target=target_i386_os2) then
  174. apptype:=app_fs
  175. else
  176. Message1(scan_w_unsupported_app_type,hs);
  177. end;
  178. end;
  179. procedure dir_assertions;
  180. begin
  181. do_delphiswitch('C');
  182. end;
  183. procedure dir_booleval;
  184. begin
  185. do_delphiswitch('B');
  186. end;
  187. procedure dir_debuginfo;
  188. begin
  189. do_delphiswitch('D');
  190. end;
  191. procedure dir_description;
  192. begin
  193. if not (target_info.target in [target_i386_os2,target_i386_win32,target_i386_netware]) then
  194. Message(scan_w_description_not_support);
  195. { change description global var in all cases }
  196. { it not used but in win32, os2 and netware }
  197. current_scanner.skipspace;
  198. description:=current_scanner.readcomment;
  199. end;
  200. procedure dir_screenname; {ad}
  201. begin
  202. if target_info.target <> target_i386_netware then
  203. {Message(scan_w_decription_not_support);}
  204. comment (V_Warning,'Screenname only supported for target netware');
  205. current_scanner.skipspace;
  206. nwscreenname:=current_scanner.readcomment;
  207. end;
  208. procedure dir_threadname; {ad}
  209. begin
  210. if target_info.target <> target_i386_netware then
  211. {Message(scan_w_decription_not_support);}
  212. comment (V_Warning,'Threadname only supported for target netware');
  213. current_scanner.skipspace;
  214. nwthreadname:=current_scanner.readcomment;
  215. end;
  216. procedure dir_copyright; {ad}
  217. begin
  218. if target_info.target <> target_i386_netware then
  219. {Message(scan_w_decription_not_support);}
  220. comment (V_Warning,'Copyright only supported for target netware');
  221. current_scanner.skipspace;
  222. nwcopyright:=current_scanner.readcomment;
  223. end;
  224. procedure dir_error;
  225. begin
  226. do_message(scan_e_user_defined);
  227. end;
  228. procedure dir_extendedsyntax;
  229. begin
  230. do_delphiswitch('X');
  231. end;
  232. procedure dir_fatal;
  233. begin
  234. do_message(scan_f_user_defined);
  235. end;
  236. procedure dir_goto;
  237. begin
  238. do_moduleswitch(cs_support_goto);
  239. end;
  240. procedure dir_hint;
  241. begin
  242. do_message(scan_h_user_defined);
  243. end;
  244. procedure dir_hints;
  245. begin
  246. do_setverbose('H');
  247. end;
  248. procedure dir_includepath;
  249. begin
  250. if not current_module.in_global then
  251. Message(scan_w_switch_is_global)
  252. else
  253. begin
  254. current_scanner.skipspace;
  255. current_module.localincludesearchpath.AddPath(current_scanner.readcomment,false);
  256. end;
  257. end;
  258. procedure dir_info;
  259. begin
  260. do_message(scan_i_user_defined);
  261. end;
  262. procedure dir_inline;
  263. begin
  264. do_moduleswitch(cs_support_inline);
  265. end;
  266. procedure dir_interfaces;
  267. var
  268. hs : string;
  269. begin
  270. {corba/com/default}
  271. current_scanner.skipspace;
  272. hs:=current_scanner.readid;
  273. if (hs='CORBA') then
  274. aktinterfacetype:=it_interfacecorba
  275. else if (hs='COM') then
  276. aktinterfacetype:=it_interfacecom
  277. else if (hs='DEFAULT') then
  278. aktinterfacetype:=initinterfacetype
  279. else
  280. Message(scan_e_invalid_interface_type);
  281. end;
  282. procedure dir_iochecks;
  283. begin
  284. do_delphiswitch('I');
  285. end;
  286. procedure dir_librarypath;
  287. begin
  288. if not current_module.in_global then
  289. Message(scan_w_switch_is_global)
  290. else
  291. begin
  292. current_scanner.skipspace;
  293. current_module.locallibrarysearchpath.AddPath(current_scanner.readcomment,false);
  294. end;
  295. end;
  296. procedure dir_link;
  297. var
  298. s : string;
  299. begin
  300. current_scanner.skipspace;
  301. s:=AddExtension(FixFileName(current_scanner.readcomment),target_info.objext);
  302. current_module.linkotherofiles.add(s,link_allways);
  303. end;
  304. procedure dir_linklib;
  305. type
  306. tLinkMode=(lm_shared,lm_static);
  307. var
  308. s : string;
  309. quote : char;
  310. libname,
  311. linkmodestr : string;
  312. p : longint;
  313. linkMode : tLinkMode;
  314. begin
  315. current_scanner.skipspace;
  316. s:=current_scanner.readcomment;
  317. p:=pos(',',s);
  318. if p=0 then
  319. begin
  320. libname:=TrimSpace(s);
  321. linkmodeStr:='';
  322. end
  323. else
  324. begin
  325. libname:=TrimSpace(copy(s,1,p-1));
  326. linkmodeStr:=Upper(TrimSpace(copy(s,p+1,255)));
  327. end;
  328. if (libname='') or (libname='''''') or (libname='""') then
  329. exit;
  330. { get linkmode, default is shared linking }
  331. if linkModeStr='STATIC' then
  332. linkmode:=lm_static
  333. else if (LinkModeStr='SHARED') or (LinkModeStr='') then
  334. linkmode:=lm_shared
  335. else
  336. begin
  337. Comment(V_Error,'Wrong link mode specified: "'+Linkmodestr+'"');
  338. exit;
  339. end;
  340. { create library name }
  341. if libname[1] in ['''','"'] then
  342. begin
  343. quote:=libname[1];
  344. Delete(libname,1,1);
  345. p:=pos(quote,libname);
  346. if p>0 then
  347. Delete(libname,p,1);
  348. end;
  349. { add to the list of libraries to link }
  350. if linkMode=lm_static then
  351. current_module.linkOtherStaticLibs.add(FixFileName(libname),link_allways)
  352. else
  353. current_module.linkOtherSharedLibs.add(FixFileName(libname),link_allways);
  354. end;
  355. procedure dir_localsymbols;
  356. begin
  357. do_delphiswitch('L');
  358. end;
  359. procedure dir_longstrings;
  360. begin
  361. do_delphiswitch('H');
  362. end;
  363. procedure dir_macro;
  364. begin
  365. do_moduleswitch(cs_support_macro);
  366. end;
  367. procedure dir_maxfpuregisters;
  368. var
  369. l : integer;
  370. hs : string;
  371. begin
  372. current_scanner.skipspace;
  373. if not(c in ['0'..'9']) then
  374. begin
  375. hs:=current_scanner.readid;
  376. if (hs='NORMAL') or (hs='DEFAULT') then
  377. aktmaxfpuregisters:=-1
  378. else
  379. Message(scan_e_invalid_maxfpureg_value);
  380. end
  381. else
  382. begin
  383. l:=current_scanner.readval;
  384. case l of
  385. 0..8:
  386. aktmaxfpuregisters:=l;
  387. else
  388. Message(scan_e_invalid_maxfpureg_value);
  389. end;
  390. end;
  391. end;
  392. procedure dir_memory;
  393. var
  394. l : longint;
  395. begin
  396. current_scanner.skipspace;
  397. l:=current_scanner.readval;
  398. if l>1024 then
  399. stacksize:=l;
  400. current_scanner.skipspace;
  401. if c=',' then
  402. begin
  403. current_scanner.readchar;
  404. current_scanner.skipspace;
  405. l:=current_scanner.readval;
  406. if l>1024 then
  407. heapsize:=l;
  408. end;
  409. if c=',' then
  410. begin
  411. current_scanner.readchar;
  412. current_scanner.skipspace;
  413. l:=current_scanner.readval;
  414. { Ignore this value, because the limit is set by the OS
  415. info and shouldn't be changed by the user (PFV) }
  416. end;
  417. end;
  418. procedure dir_message;
  419. begin
  420. do_message(scan_i_user_defined);
  421. end;
  422. procedure dir_mode;
  423. begin
  424. if not current_module.in_global then
  425. Message(scan_w_switch_is_global)
  426. else
  427. begin
  428. current_scanner.skipspace;
  429. current_scanner.readstring;
  430. if not SetCompileMode(pattern,false) then
  431. Message1(scan_w_illegal_switch,pattern);
  432. end;
  433. end;
  434. procedure dir_mmx;
  435. begin
  436. do_localswitch(cs_mmx);
  437. end;
  438. procedure dir_note;
  439. begin
  440. do_message(scan_n_user_defined);
  441. end;
  442. procedure dir_notes;
  443. begin
  444. do_setverbose('N');
  445. end;
  446. procedure dir_objectpath;
  447. begin
  448. if not current_module.in_global then
  449. Message(scan_w_switch_is_global)
  450. else
  451. begin
  452. current_scanner.skipspace;
  453. current_module.localobjectsearchpath.AddPath(current_scanner.readcomment,false);
  454. end;
  455. end;
  456. procedure dir_openstrings;
  457. begin
  458. do_delphiswitch('P');
  459. end;
  460. procedure dir_output_format;
  461. begin
  462. if not current_module.in_global then
  463. Message(scan_w_switch_is_global)
  464. else
  465. begin
  466. current_scanner.skipspace;
  467. if set_target_asm_by_string(current_scanner.readid) then
  468. aktoutputformat:=target_asm.id
  469. else
  470. Message1(scan_w_illegal_switch,pattern);
  471. end;
  472. end;
  473. procedure dir_overflowchecks;
  474. begin
  475. do_delphiswitch('Q');
  476. end;
  477. procedure dir_packenum;
  478. var
  479. hs : string;
  480. begin
  481. current_scanner.skipspace;
  482. if not(c in ['0'..'9']) then
  483. begin
  484. hs:=current_scanner.readid;
  485. if (hs='NORMAL') or (hs='DEFAULT') then
  486. aktpackenum:=4
  487. else
  488. Message(scan_w_only_pack_enum);
  489. end
  490. else
  491. begin
  492. case current_scanner.readval of
  493. 1 : aktpackenum:=1;
  494. 2 : aktpackenum:=2;
  495. 4 : aktpackenum:=4;
  496. else
  497. Message(scan_w_only_pack_enum);
  498. end;
  499. end;
  500. end;
  501. procedure dir_packrecords;
  502. var
  503. hs : string;
  504. begin
  505. current_scanner.skipspace;
  506. if not(c in ['0'..'9']) then
  507. begin
  508. hs:=current_scanner.readid;
  509. { C has the special recordalignmax of -1 }
  510. if (hs='C') then
  511. aktalignment.recordalignmax:=-1
  512. else
  513. if (hs='NORMAL') or (hs='DEFAULT') then
  514. aktalignment.recordalignmax:=2
  515. else
  516. Message(scan_w_only_pack_records);
  517. end
  518. else
  519. begin
  520. case current_scanner.readval of
  521. 1 : aktalignment.recordalignmax:=1;
  522. 2 : aktalignment.recordalignmax:=2;
  523. 4 : aktalignment.recordalignmax:=4;
  524. 8 : aktalignment.recordalignmax:=8;
  525. 16 : aktalignment.recordalignmax:=16;
  526. 32 : aktalignment.recordalignmax:=32;
  527. else
  528. Message(scan_w_only_pack_records);
  529. end;
  530. end;
  531. end;
  532. {$ifdef testvarsets}
  533. procedure dir_packset;
  534. var
  535. hs : string;
  536. begin
  537. current_scanner.skipspace;
  538. if not(c in ['1','2','4']) then
  539. begin
  540. hs:=current_scanner.readid;
  541. if (hs='FIXED') or ((hs='DEFAULT') OR (hs='NORMAL')) then
  542. aktsetalloc:=0 {Fixed mode, sets are 4 or 32 bytes}
  543. else
  544. Message(scan_w_only_packset);
  545. end
  546. else
  547. begin
  548. case current_scanner.readval of
  549. 1 : aktsetalloc:=1;
  550. 2 : aktsetalloc:=2;
  551. 4 : aktsetalloc:=4;
  552. else
  553. Message(scan_w_only_packset);
  554. end;
  555. end;
  556. end;
  557. {$ENDIF}
  558. procedure dir_profile;
  559. var
  560. mac : tmacro;
  561. begin
  562. do_moduleswitch(cs_profile);
  563. { defined/undefine FPC_PROFILE }
  564. mac:=tmacro(current_scanner.macros.search('FPC_PROFILE'));
  565. if not assigned(mac) then
  566. begin
  567. mac:=tmacro.create('FPC_PROFILE');
  568. current_scanner.macros.insert(mac);
  569. end;
  570. mac.defined:=(cs_profile in aktmoduleswitches);
  571. end;
  572. procedure dir_rangechecks;
  573. begin
  574. do_delphiswitch('R');
  575. end;
  576. procedure dir_referenceinfo;
  577. begin
  578. do_delphiswitch('Y');
  579. end;
  580. procedure dir_resource;
  581. var
  582. s : string;
  583. begin
  584. current_scanner.skipspace;
  585. s:=current_scanner.readcomment;
  586. { replace * with current module name.
  587. This should always be defined. }
  588. if s[1]='*' then
  589. if Assigned(Current_Module) then
  590. begin
  591. delete(S,1,1);
  592. insert(lower(current_module.modulename^),S,1);
  593. end;
  594. s:=AddExtension(FixFileName(s),target_info.resext);
  595. if target_info.res<>res_none then
  596. if (target_info.res = res_emxbind) and
  597. not (Current_module.ResourceFiles.Empty) then
  598. Message(scan_w_only_one_resourcefile_supported)
  599. else
  600. current_module.resourcefiles.insert(FixFileName(s))
  601. else
  602. Message(scan_e_resourcefiles_not_supported);
  603. end;
  604. procedure dir_saturation;
  605. begin
  606. do_localswitch(cs_mmx_saturation);
  607. end;
  608. procedure dir_smartlink;
  609. begin
  610. do_moduleswitch(cs_create_smart);
  611. end;
  612. procedure dir_stackframes;
  613. begin
  614. do_delphiswitch('W');
  615. end;
  616. procedure dir_static;
  617. begin
  618. do_moduleswitch(cs_static_keyword);
  619. end;
  620. procedure dir_stop;
  621. begin
  622. do_message(scan_f_user_defined);
  623. end;
  624. procedure dir_typedaddress;
  625. begin
  626. do_delphiswitch('T');
  627. end;
  628. procedure dir_typeinfo;
  629. begin
  630. do_delphiswitch('M');
  631. end;
  632. procedure dir_unitpath;
  633. begin
  634. if not current_module.in_global then
  635. Message(scan_w_switch_is_global)
  636. else
  637. begin
  638. current_scanner.skipspace;
  639. current_module.localunitsearchpath.AddPath(current_scanner.readcomment,false);
  640. end;
  641. end;
  642. procedure dir_varstringchecks;
  643. begin
  644. do_delphiswitch('V');
  645. end;
  646. procedure dir_version;
  647. var
  648. major, minor, revision : longint;
  649. error : integer;
  650. begin
  651. if not (target_info.target in [target_i386_os2,target_i386_win32,target_i386_netware]) then // AD
  652. begin
  653. Message(scan_n_version_not_support);
  654. exit;
  655. end;
  656. if (compile_level<>1) then
  657. Message(scan_n_only_exe_version)
  658. else
  659. begin
  660. { change description global var in all cases }
  661. { it not used but in win32, os2 and netware }
  662. current_scanner.skipspace;
  663. { we should only accept Major.Minor format for win32 and os2 }
  664. current_scanner.readnumber;
  665. major:=0;
  666. minor:=0;
  667. revision:=0;
  668. valint(pattern,major,error);
  669. if error<>0 then
  670. begin
  671. Message1(scan_w_wrong_version_ignored,pattern);
  672. exit;
  673. end;
  674. if c='.' then
  675. begin
  676. current_scanner.readchar;
  677. current_scanner.readnumber;
  678. valint(pattern,minor,error);
  679. if error<>0 then
  680. begin
  681. Message1(scan_w_wrong_version_ignored,tostr(major)+'.'+pattern);
  682. exit;
  683. end;
  684. if (c='.') and
  685. (target_info.target = target_i386_netware) then // AD
  686. begin
  687. current_scanner.readchar;
  688. current_scanner.readnumber;
  689. valint(pattern,revision,error);
  690. if error<>0 then
  691. begin
  692. Message1(scan_w_wrong_version_ignored,tostr(revision)+'.'+pattern);
  693. exit;
  694. end;
  695. dllmajor:=major;
  696. dllminor:=minor;
  697. dllrevision:=revision;
  698. dllversion:=tostr(major)+','+tostr(minor)+','+tostr(revision);
  699. end
  700. else
  701. begin
  702. dllmajor:=major;
  703. dllminor:=minor;
  704. dllversion:=tostr(major)+'.'+tostr(minor);
  705. end;
  706. end
  707. else
  708. dllversion:=tostr(major);
  709. end;
  710. end;
  711. procedure dir_wait;
  712. var
  713. had_info : boolean;
  714. begin
  715. had_info:=(status.verbosity and V_Info)<>0;
  716. { this message should allways appear !! }
  717. status.verbosity:=status.verbosity or V_Info;
  718. Message(scan_i_press_enter);
  719. readln;
  720. If not(had_info) then
  721. status.verbosity:=status.verbosity and (not V_Info);
  722. end;
  723. procedure dir_warning;
  724. begin
  725. do_message(scan_w_user_defined);
  726. end;
  727. procedure dir_warnings;
  728. begin
  729. do_setverbose('W');
  730. end;
  731. procedure dir_z1;
  732. begin
  733. aktpackenum:=1;
  734. end;
  735. procedure dir_z2;
  736. begin
  737. aktpackenum:=2;
  738. end;
  739. procedure dir_z4;
  740. begin
  741. aktpackenum:=4;
  742. end;
  743. {****************************************************************************
  744. Initialize Directives
  745. ****************************************************************************}
  746. procedure InitScannerDirectives;
  747. begin
  748. AddDirective('ALIGN',{$ifdef FPCPROCVAR}@{$endif}dir_align);
  749. {$ifdef m68k}
  750. AddDirective('APPID',{$ifdef FPCPROCVAR}@{$endif}dir_appid);
  751. AddDirective('APPNAME',{$ifdef FPCPROCVAR}@{$endif}dir_appname);
  752. {$endif m68k}
  753. AddDirective('APPTYPE',{$ifdef FPCPROCVAR}@{$endif}dir_apptype);
  754. AddDirective('ASMMODE',{$ifdef FPCPROCVAR}@{$endif}dir_asmmode);
  755. AddDirective('ASSERTIONS',{$ifdef FPCPROCVAR}@{$endif}dir_assertions);
  756. AddDirective('BOOLEVAL',{$ifdef FPCPROCVAR}@{$endif}dir_booleval);
  757. AddDirective('COPYRIGHT',{$ifdef FPCPROCVAR}@{$endif}dir_copyright);
  758. AddDirective('D',{$ifdef FPCPROCVAR}@{$endif}dir_description);
  759. AddDirective('DEBUGINFO',{$ifdef FPCPROCVAR}@{$endif}dir_debuginfo);
  760. AddDirective('DESCRIPTION',{$ifdef FPCPROCVAR}@{$endif}dir_description);
  761. AddDirective('ERROR',{$ifdef FPCPROCVAR}@{$endif}dir_error);
  762. AddDirective('EXTENDEDSYNTAX',{$ifdef FPCPROCVAR}@{$endif}dir_extendedsyntax);
  763. AddDirective('FATAL',{$ifdef FPCPROCVAR}@{$endif}dir_fatal);
  764. AddDirective('GOTO',{$ifdef FPCPROCVAR}@{$endif}dir_goto);
  765. AddDirective('HINT',{$ifdef FPCPROCVAR}@{$endif}dir_hint);
  766. AddDirective('HINTS',{$ifdef FPCPROCVAR}@{$endif}dir_hints);
  767. AddDirective('IOCHECKS',{$ifdef FPCPROCVAR}@{$endif}dir_iochecks);
  768. AddDirective('INCLUDEPATH',{$ifdef FPCPROCVAR}@{$endif}dir_includepath);
  769. AddDirective('INFO',{$ifdef FPCPROCVAR}@{$endif}dir_info);
  770. AddDirective('INLINE',{$ifdef FPCPROCVAR}@{$endif}dir_inline);
  771. AddDirective('INTERFACES',{$ifdef FPCPROCVAR}@{$endif}dir_interfaces);
  772. AddDirective('L',{$ifdef FPCPROCVAR}@{$endif}dir_link);
  773. AddDirective('LIBRARYPATH',{$ifdef FPCPROCVAR}@{$endif}dir_librarypath);
  774. AddDirective('LINK',{$ifdef FPCPROCVAR}@{$endif}dir_link);
  775. AddDirective('LINKLIB',{$ifdef FPCPROCVAR}@{$endif}dir_linklib);
  776. AddDirective('LOCALSYMBOLS',{$ifdef FPCPROCVAR}@{$endif}dir_localsymbols);
  777. AddDirective('LONGSTRINGS',{$ifdef FPCPROCVAR}@{$endif}dir_longstrings);
  778. AddDirective('M',{$ifdef FPCPROCVAR}@{$endif}dir_memory);
  779. AddDirective('MACRO',{$ifdef FPCPROCVAR}@{$endif}dir_macro);
  780. AddDirective('MAXFPUREGISTERS',{$ifdef FPCPROCVAR}@{$endif}dir_maxfpuregisters);
  781. AddDirective('MEMORY',{$ifdef FPCPROCVAR}@{$endif}dir_memory);
  782. AddDirective('MESSAGE',{$ifdef FPCPROCVAR}@{$endif}dir_message);
  783. AddDirective('MINENUMSIZE',{$ifdef FPCPROCVAR}@{$endif}dir_packenum);
  784. AddDirective('MMX',{$ifdef FPCPROCVAR}@{$endif}dir_mmx);
  785. AddDirective('MODE',{$ifdef FPCPROCVAR}@{$endif}dir_mode);
  786. AddDirective('NOTE',{$ifdef FPCPROCVAR}@{$endif}dir_note);
  787. AddDirective('NOTES',{$ifdef FPCPROCVAR}@{$endif}dir_notes);
  788. AddDirective('OBJECTPATH',{$ifdef FPCPROCVAR}@{$endif}dir_objectpath);
  789. AddDirective('OPENSTRINGS',{$ifdef FPCPROCVAR}@{$endif}dir_openstrings);
  790. AddDirective('OUTPUT_FORMAT',{$ifdef FPCPROCVAR}@{$endif}dir_output_format);
  791. AddDirective('OVERFLOWCHECKS',{$ifdef FPCPROCVAR}@{$endif}dir_overflowchecks);
  792. AddDirective('PACKENUM',{$ifdef FPCPROCVAR}@{$endif}dir_packenum);
  793. AddDirective('PACKRECORDS',{$ifdef FPCPROCVAR}@{$endif}dir_packrecords);
  794. {$IFDEF TestVarsets}
  795. AddDirective('PACKSET',{$ifdef FPCPROCVAR}@{$endif}dir_packset);
  796. {$ENDIF}
  797. AddDirective('PROFILE',{$ifdef FPCPROCVAR}@{$endif}dir_profile);
  798. AddDirective('R',{$ifdef FPCPROCVAR}@{$endif}dir_resource);
  799. AddDirective('RANGECHECKS',{$ifdef FPCPROCVAR}@{$endif}dir_rangechecks);
  800. AddDirective('REFERENCEINFO',{$ifdef FPCPROCVAR}@{$endif}dir_referenceinfo);
  801. AddDirective('SATURATION',{$ifdef FPCPROCVAR}@{$endif}dir_saturation);
  802. {ad 18.05.2001: Screen and Threadname for Netware}
  803. AddDirective('SCREENNAME',{$ifdef FPCPROCVAR}@{$endif}dir_screenname);
  804. AddDirective('SMARTLINK',{$ifdef FPCPROCVAR}@{$endif}dir_smartlink);
  805. AddDirective('STACKFRAMES',{$ifdef FPCPROCVAR}@{$endif}dir_stackframes);
  806. AddDirective('STATIC',{$ifdef FPCPROCVAR}@{$endif}dir_static);
  807. AddDirective('STOP',{$ifdef FPCPROCVAR}@{$endif}dir_stop);
  808. {ad 18.05.2001: Screen and Threadname for Netware}
  809. AddDirective('THREADNAME',{$ifdef FPCPROCVAR}@{$endif}dir_threadname);
  810. AddDirective('TYPEDADDRESS',{$ifdef FPCPROCVAR}@{$endif}dir_typedaddress);
  811. AddDirective('TYPEINFO',{$ifdef FPCPROCVAR}@{$endif}dir_typeinfo);
  812. AddDirective('UNITPATH',{$ifdef FPCPROCVAR}@{$endif}dir_unitpath);
  813. AddDirective('VARSTRINGCHECKS',{$ifdef FPCPROCVAR}@{$endif}dir_varstringchecks);
  814. AddDirective('VERSION',{$ifdef FPCPROCVAR}@{$endif}dir_version);
  815. AddDirective('WAIT',{$ifdef FPCPROCVAR}@{$endif}dir_wait);
  816. AddDirective('WARNING',{$ifdef FPCPROCVAR}@{$endif}dir_warning);
  817. AddDirective('WARNINGS',{$ifdef FPCPROCVAR}@{$endif}dir_warnings);
  818. AddDirective('Z1',{$ifdef FPCPROCVAR}@{$endif}dir_z1);
  819. AddDirective('Z2',{$ifdef FPCPROCVAR}@{$endif}dir_z2);
  820. AddDirective('Z4',{$ifdef FPCPROCVAR}@{$endif}dir_z4);
  821. end;
  822. end.
  823. {
  824. $Log$
  825. Revision 1.8 2001-09-02 21:18:28 peter
  826. * split constsym.value in valueord,valueordptr,valueptr. The valueordptr
  827. is used for holding target platform pointer values. As those can be
  828. bigger than the source platform.
  829. Revision 1.7 2001/08/19 11:22:24 peter
  830. * palmos support from v10 merged
  831. Revision 1.6 2001/08/07 18:47:13 peter
  832. * merged netbsd start
  833. * profile for win32
  834. Revision 1.5 2001/07/01 20:16:16 peter
  835. * alignmentinfo record added
  836. * -Oa argument supports more alignment settings that can be specified
  837. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  838. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  839. required alignment and the maximum usefull alignment. The final
  840. alignment will be choosen per variable size dependent on these
  841. settings
  842. Revision 1.4 2001/06/03 20:20:27 peter
  843. * Align directive supports also values to be Kylix compatible. It's
  844. strange because the help of kylix still shows only On and Off as
  845. possible values, so still support those. On means 4 bytes and Off
  846. means 1 byte alignment.
  847. Revision 1.3 2001/05/30 21:35:49 peter
  848. * netware patches for copyright, screenname, threadname directives
  849. Revision 1.2 2001/04/18 22:01:58 peter
  850. * registration of targets and assemblers
  851. Revision 1.1 2001/04/13 18:00:36 peter
  852. * easier registration of directives
  853. Revision 1.20 2001/04/13 01:22:13 peter
  854. * symtable change to classes
  855. * range check generation and errors fixed, make cycle DEBUG=1 works
  856. * memory leaks fixed
  857. Revision 1.19 2001/03/13 18:45:07 peter
  858. * fixed some memory leaks
  859. Revision 1.18 2001/02/20 21:41:18 peter
  860. * new fixfilename, findfile for unix. Look first for lowercase, then
  861. NormalCase and last for UPPERCASE names.
  862. Revision 1.17 2001/01/20 18:32:52 hajny
  863. + APPTYPE support under OS/2, app_fs, GetEnvPChar for OS/2
  864. Revision 1.16 2001/01/13 00:09:21 peter
  865. * made Pavel O. happy ;)
  866. Revision 1.15 2000/12/25 00:07:28 peter
  867. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  868. tlinkedlist objects)
  869. Revision 1.14 2000/12/24 12:24:38 peter
  870. * moved preprocessfile into a conditional
  871. Revision 1.13 2000/12/12 19:48:52 peter
  872. * fixed lost char after $I directive (merged)
  873. Revision 1.12 2000/11/12 22:17:47 peter
  874. * some realname updates for messages
  875. Revision 1.11 2000/11/04 14:25:21 florian
  876. + merged Attila's changes for interfaces, not tested yet
  877. Revision 1.10 2000/10/31 22:02:51 peter
  878. * symtable splitted, no real code changes
  879. Revision 1.9 2000/09/26 10:50:41 jonas
  880. * initmodeswitches is changed is you change the compiler mode from the
  881. command line (the -S<x> switches didn't work anymore for changing the
  882. compiler mode) (merged from fixes branch)
  883. Revision 1.8 2000/09/24 21:33:47 peter
  884. * message updates merges
  885. Revision 1.7 2000/09/24 15:06:27 peter
  886. * use defines.inc
  887. Revision 1.6 2000/09/11 17:00:23 florian
  888. + first implementation of Netware Module support, thanks to
  889. Armin Diehl ([email protected]) for providing the patches
  890. Revision 1.5 2000/09/10 21:18:15 peter
  891. * macro warning (merged)
  892. Revision 1.4 2000/08/12 15:30:44 peter
  893. * IDE patch for stream reading (merged)
  894. Revision 1.3 2000/08/08 19:28:57 peter
  895. * memdebug/memory patches (merged)
  896. * only once illegal directive (merged)
  897. Revision 1.2 2000/07/13 11:32:49 michael
  898. + removed logs
  899. }