pmodules.pas 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325
  1. {
  2. $Id$
  3. Copyright (c) 1998 by Florian Klaempfl
  4. Handles the parsing and loading of the modules (ppufiles)
  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 pmodules;
  19. {define TEST_IMPL does not work well }
  20. interface
  21. uses
  22. files;
  23. procedure addlinkerfiles(hp:pmodule);
  24. procedure loadsystemunit;
  25. procedure proc_unit;
  26. procedure proc_program(islibrary : boolean);
  27. implementation
  28. uses
  29. cobjects,verbose,comphook,systems,globals,
  30. symtable,aasm,hcodegen,
  31. link,assemble,import
  32. {$ifndef OLDPPU}
  33. ,ppu
  34. {$endif OLDPPU}
  35. {$ifdef i386}
  36. ,i386
  37. {$endif}
  38. {$ifdef m68k}
  39. ,m68k
  40. {$endif}
  41. ,scanner,pbase,psystem,pdecl,psub,parser;
  42. procedure addlinkerfiles(hp:pmodule);
  43. begin
  44. with hp^ do
  45. begin
  46. while not linkofiles.empty do
  47. Linker.AddObject(linkofiles.Get);
  48. while not linksharedlibs.empty do
  49. Linker.AddSharedLibrary(linksharedlibs.Get);
  50. while not linkstaticlibs.empty do
  51. Linker.AddStaticLibrary(linkstaticlibs.Get);
  52. end;
  53. end;
  54. procedure insertsegment;
  55. procedure fixseg(p:paasmoutput;sec:tsection);
  56. begin
  57. p^.insert(new(pai_section,init(sec)));
  58. if (cs_smartlink in aktmoduleswitches) then
  59. p^.insert(new(pai_cut,init));
  60. p^.concat(new(pai_section,init(sec_none)));
  61. end;
  62. begin
  63. {Insert Ident of the compiler}
  64. if (not (cs_smartlink in aktmoduleswitches))
  65. {$ifndef EXTDEBUG}
  66. and (not current_module^.is_unit)
  67. {$endif}
  68. then
  69. begin
  70. datasegment^.insert(new(pai_align,init(4)));
  71. datasegment^.insert(new(pai_string,init('FPC '+version_string+' for '+target_string+' - '+target_info.short_name)));
  72. end;
  73. { Insert start and end of sections }
  74. fixseg(codesegment,sec_code);
  75. fixseg(datasegment,sec_data);
  76. fixseg(bsssegment,sec_bss);
  77. fixseg(consts,sec_data);
  78. end;
  79. procedure insertheap;
  80. begin
  81. if (cs_smartlink in aktmoduleswitches) then
  82. begin
  83. bsssegment^.concat(new(pai_cut,init));
  84. datasegment^.concat(new(pai_cut,init));
  85. end;
  86. { On the Macintosh Classic M68k Architecture
  87. The Heap variable is simply a POINTER to the
  88. real HEAP. The HEAP must be set up by the RTL
  89. and must store the pointer in this value.
  90. On OS/2 the heap is also intialized by the RTL. We do
  91. not output a pointer }
  92. case target_info.target of
  93. {$ifdef i386}
  94. target_OS2 : ;
  95. {$endif i386}
  96. {$ifdef m68k}
  97. target_Mac68K : bsssegment^.concat(new(pai_datablock,init_global('HEAP',4)));
  98. {$endif m68k}
  99. else
  100. bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize)));
  101. end;
  102. {$ifdef i386}
  103. datasegment^.concat(new(pai_symbol,init_global('HEAPSIZE')));
  104. {$endif i386}
  105. {$ifdef m68k}
  106. datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
  107. {$endif m68k}
  108. datasegment^.concat(new(pai_const,init_32bit(heapsize)));
  109. end;
  110. procedure inserttargetspecific;
  111. begin
  112. {$ifdef i386}
  113. case target_info.target of
  114. target_GO32V2 : begin
  115. { stacksize can be specified }
  116. datasegment^.concat(new(pai_symbol,init_global('__stklen')));
  117. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  118. end;
  119. target_WIN32 : begin
  120. { Generate an external entry to be sure that _mainCRTStarup will be
  121. linked, can't use concat_external because those aren't written for
  122. asw (PFV) }
  123. datasegment^.concat(new(pai_const,init_symbol('_mainCRTStartup')));
  124. end;
  125. end;
  126. {$endif i386}
  127. end;
  128. {$ifndef OLDPPU}
  129. function loadunit(const s : string;compile_system:boolean) : pmodule;forward;
  130. procedure load_usedunits(compile_system:boolean);
  131. var
  132. pu : pused_unit;
  133. loaded_unit : pmodule;
  134. nextmapentry : longint;
  135. begin
  136. { init the map }
  137. new(current_module^.map);
  138. nextmapentry:=1;
  139. { load the used units from interface }
  140. pu:=pused_unit(current_module^.used_units.first);
  141. while assigned(pu) do
  142. begin
  143. if (not pu^.loaded) and (pu^.in_interface) then
  144. begin
  145. loaded_unit:=loadunit(pu^.name^,false);
  146. if current_module^.compiled then
  147. exit;
  148. { register unit in used units }
  149. pu^.u:=loaded_unit;
  150. pu^.loaded:=true;
  151. { need to recompile the current unit ? }
  152. if loaded_unit^.crc<>pu^.checksum then
  153. begin
  154. current_module^.do_compile:=true;
  155. exit;
  156. end;
  157. { setup the map entry for deref }
  158. current_module^.map^[nextmapentry]:=loaded_unit^.symtable;
  159. inc(nextmapentry);
  160. if nextmapentry>maxunits then
  161. Message(unit_f_too_much_units);
  162. end;
  163. pu:=pused_unit(pu^.next);
  164. end;
  165. { ok, now load the unit }
  166. current_module^.symtable:=new(punitsymtable,loadasunit);
  167. { if this is the system unit insert the intern symbols }
  168. if compile_system then
  169. begin
  170. make_ref:=false;
  171. insertinternsyms(psymtable(current_module^.symtable));
  172. make_ref:=true;
  173. end;
  174. { now only read the implementation part }
  175. current_module^.in_implementation:=true;
  176. { load the used units from implementation }
  177. pu:=pused_unit(current_module^.used_units.first);
  178. while assigned(pu) do
  179. begin
  180. if (not pu^.loaded) and (not pu^.in_interface) then
  181. begin
  182. loaded_unit:=loadunit(pu^.name^,false);
  183. if current_module^.compiled then
  184. exit;
  185. { register unit in used units }
  186. pu^.u:=loaded_unit;
  187. pu^.loaded:=true;
  188. {$ifdef TEST_IMPL}
  189. { need to recompile the current unit ? }
  190. if loaded_unit^.crc<>pu^.checksum then
  191. begin
  192. current_module^.do_compile:=true;
  193. exit;
  194. end;
  195. { setup the map entry for deref }
  196. current_module^.map^[nextmapentry]:=loaded_unit^.symtable;
  197. inc(nextmapentry);
  198. if nextmapentry>maxunits then
  199. Message(unit_f_too_much_units);
  200. {$endif TEST_IMPL}
  201. end;
  202. pu:=pused_unit(pu^.next);
  203. end;
  204. { remove the map, it's not needed anymore }
  205. dispose(current_module^.map);
  206. current_module^.map:=nil;
  207. end;
  208. function loadunit(const s : string;compile_system:boolean) : pmodule;
  209. var
  210. st : punitsymtable;
  211. old_current_ppu : pppufile;
  212. old_current_module,hp : pmodule;
  213. procedure loadppufile;
  214. begin
  215. { load interface section }
  216. if not current_module^.do_compile then
  217. load_interface;
  218. { only load units when we don't recompile }
  219. if not current_module^.do_compile then
  220. load_usedunits(compile_system);
  221. { recompile if set }
  222. if current_module^.do_compile then
  223. begin
  224. { we needn't the ppufile }
  225. if assigned(current_module^.ppufile) then
  226. begin
  227. dispose(current_module^.ppufile,done);
  228. current_module^.ppufile:=nil;
  229. end;
  230. { recompile the unit or give a fatal error if sources not available }
  231. if not(current_module^.sources_avail) then
  232. Message1(unit_f_cant_compile_unit,current_module^.modulename^)
  233. else
  234. begin
  235. current_scanner^.close;
  236. compile(current_module^.mainsource^,compile_system);
  237. if (not old_current_module^.compiled) then
  238. current_scanner^.reopen;
  239. end;
  240. end
  241. else
  242. begin
  243. { only reassemble ? }
  244. if (current_module^.do_assemble) then
  245. OnlyAsm(current_module^.asmfilename^);
  246. { add the files for the linker }
  247. addlinkerfiles(current_module);
  248. end;
  249. if assigned(current_module^.ppufile) then
  250. begin
  251. dispose(current_module^.ppufile,done);
  252. current_module^.ppufile:=nil;
  253. end;
  254. end;
  255. begin
  256. old_current_module:=current_module;
  257. old_current_ppu:=current_ppu;
  258. { be sure not to mix lines from different files }
  259. { update_line; }
  260. { unit not found }
  261. st:=nil;
  262. { search all loaded units }
  263. hp:=pmodule(loaded_units.first);
  264. while assigned(hp) do
  265. begin
  266. if hp^.modulename^=s then
  267. begin
  268. { the unit is already registered }
  269. { and this means that the unit }
  270. { is already compiled }
  271. { else there is a cyclic unit use }
  272. if assigned(hp^.symtable) then
  273. st:=punitsymtable(hp^.symtable)
  274. else
  275. begin
  276. { recompile the unit ? }
  277. if (not current_module^.in_implementation) and (hp^.in_implementation) then
  278. Message(unit_f_circular_unit_reference);
  279. end;
  280. break;
  281. end;
  282. { the next unit }
  283. hp:=pmodule(hp^.next);
  284. end;
  285. { the unit is not in the symtable stack }
  286. if (not assigned(st)) then
  287. begin
  288. { if the unit is loaded remove it first }
  289. if assigned(hp) then
  290. begin
  291. { remove the old unit }
  292. loaded_units.remove(hp);
  293. dispose(hp,done);
  294. end;
  295. { generates a new unit info record }
  296. current_module:=new(pmodule,init(s,true));
  297. current_ppu:=current_module^.ppufile;
  298. { now we can register the unit }
  299. loaded_units.insert(current_module);
  300. { now realy load the ppu }
  301. loadppufile;
  302. { set compiled flag }
  303. current_module^.compiled:=true;
  304. { register the unit _once_ }
  305. usedunits.concat(new(pused_unit,init(current_module,true)));
  306. { load return pointer }
  307. hp:=current_module;
  308. end;
  309. { set the old module }
  310. current_ppu:=old_current_ppu;
  311. current_module:=old_current_module;
  312. loadunit:=hp;
  313. end;
  314. {$else OLDPPU}
  315. {*****************************************************************************
  316. Old PPU
  317. *****************************************************************************}
  318. function loadunit(const s : string;compile_system, in_uses : boolean) : pmodule;forward;
  319. procedure load_ppu(oldhp,hp : pmodule;compile_system : boolean);
  320. var
  321. loaded_unit : pmodule;
  322. b : byte;
  323. checksum,
  324. count,
  325. nextmapentry : longint;
  326. hs : string;
  327. begin
  328. { init the map }
  329. new(hp^.map);
  330. nextmapentry:=1;
  331. { load the used units from interface }
  332. hp^.ppufile^.read_data(b,1,count);
  333. while (b=ibloadunit) do
  334. begin
  335. { read unit name }
  336. hp^.ppufile^.read_data(hs[0],1,count);
  337. hp^.ppufile^.read_data(hs[1],byte(hs[0]),count);
  338. hp^.ppufile^.read_data(checksum,4,count);
  339. loaded_unit:=loadunit(hs,false,false);
  340. if hp^.compiled then
  341. exit;
  342. { if the crc of a used unit is the same as }
  343. { written to the PPU file, we needn't to }
  344. { recompile the current unit }
  345. if (loaded_unit^.crc<>checksum) then
  346. begin
  347. { we have to compile the current unit }
  348. { remove stuff which isn't needed }
  349. { forget the map }
  350. dispose(hp^.map);
  351. hp^.map:=nil;
  352. hp^.ppufile^.close;
  353. dispose(hp^.ppufile,done);
  354. hp^.ppufile:=nil;
  355. if not(hp^.sources_avail) then
  356. Message1(unit_f_cant_compile_unit,hp^.modulename^)
  357. else
  358. begin
  359. if assigned(oldhp^.current_inputfile) then
  360. oldhp^.current_inputfile^.tempclose;
  361. compile(hp^.mainsource^,compile_system);
  362. if (not oldhp^.compiled) and assigned(oldhp^.current_inputfile) then
  363. oldhp^.current_inputfile^.tempreopen;
  364. end;
  365. exit;
  366. end;
  367. { setup the map entry for deref }
  368. hp^.map^[nextmapentry]:=loaded_unit^.symtable;
  369. inc(nextmapentry);
  370. if nextmapentry>maxunits then
  371. Message(unit_f_too_much_units);
  372. { read until ibend }
  373. hp^.ppufile^.read_data(b,1,count);
  374. end;
  375. { ok, now load the unit }
  376. hp^.symtable:=new(punitsymtable,load(hp^.modulename^));
  377. { if this is the system unit insert the intern }
  378. { symbols }
  379. make_ref:=false;
  380. if compile_system then
  381. insertinternsyms(psymtable(hp^.symtable));
  382. make_ref:=true;
  383. { now only read the implementation part }
  384. hp^.in_implementation:=true;
  385. { load the used units from implementation }
  386. hp^.ppufile^.read_data(b,1,count);
  387. while (b<>ibend) and (b=ibloadunit) do
  388. begin
  389. { read unit name }
  390. hp^.ppufile^.read_data(hs[0],1,count);
  391. hp^.ppufile^.read_data(hs[1],byte(hs[0]),count);
  392. hp^.ppufile^.read_data(checksum,4,count);
  393. loaded_unit:=loadunit(hs,false,false);
  394. if hp^.compiled then exit;
  395. { if the crc of a used unit is the same as }
  396. { written to the PPU file, we needn't to }
  397. { recompile the current unit }
  398. { but for the implementation part }
  399. { the written crc is false, because }
  400. { not defined when writing the ppufile !! }
  401. {$ifdef TEST_IMPL}
  402. if (checksum<>0) and (loaded_unit^.crc<>checksum) then
  403. begin
  404. { we have to compile the current unit }
  405. { remove stuff which isn't needed }
  406. { forget the map }
  407. dispose(hp^.map);
  408. hp^.map:=nil;
  409. hp^.ppufile^.close;
  410. dispose(hp^.ppufile,done);
  411. hp^.ppufile:=nil;
  412. if not(hp^.sources_avail) then
  413. Message1(unit_f_cant_compile_unit,hp^.modulename^)
  414. else
  415. begin
  416. oldhp^.current_inputfile^.tempclose;
  417. compile(hp^.mainsource^,compile_system);
  418. oldhp^.current_inputfile^.tempclose;
  419. end;
  420. exit;
  421. end;
  422. {$endif TEST_IMPL}
  423. { read until ibend }
  424. hp^.ppufile^.read_data(b,1,count);
  425. end;
  426. hp^.ppufile^.close;
  427. dispose(hp^.map);
  428. hp^.map:=nil;
  429. end;
  430. function loadunit(const s : string;compile_system, in_uses : boolean) : pmodule;
  431. var
  432. st : punitsymtable;
  433. old_current_module,hp,nextmodule : pmodule;
  434. pu : pused_unit;
  435. hs : pstring;
  436. begin
  437. old_current_module:=current_module;
  438. { be sure not to mix lines from different files }
  439. { update_line; }
  440. { unit not found }
  441. st:=nil;
  442. { search all loaded units }
  443. hp:=pmodule(loaded_units.first);
  444. while assigned(hp) do
  445. begin
  446. if hp^.modulename^=s then
  447. begin
  448. { the unit is already registered }
  449. { and this means that the unit }
  450. { is already compiled }
  451. { else there is a cyclic unit use }
  452. if assigned(hp^.symtable) then
  453. st:=punitsymtable(hp^.symtable)
  454. else
  455. begin
  456. { recompile the unit ? }
  457. if (not current_module^.in_implementation) and (hp^.in_implementation) then
  458. Message(unit_f_circular_unit_reference);
  459. end;
  460. break;
  461. end;
  462. { the next unit }
  463. hp:=pmodule(hp^.next);
  464. end;
  465. { no error and the unit isn't loaded }
  466. if not(assigned(hp)) and (st=nil) then
  467. begin
  468. { generates a new unit info record }
  469. hp:=new(pmodule,init(s,true));
  470. { now we can register the unit }
  471. loaded_units.insert(hp);
  472. current_module:=hp;
  473. { force build ? }
  474. if (hp^.do_compile) or (hp^.sources_avail and do_build) then
  475. begin
  476. { we needn't the ppufile }
  477. if assigned(hp^.ppufile) then
  478. begin
  479. dispose(hp^.ppufile,done);
  480. hp^.ppufile:=nil;
  481. end;
  482. if not(hp^.sources_avail) then
  483. Message1(unit_f_cant_compile_unit,hp^.modulename^)
  484. else
  485. begin
  486. if assigned(old_current_module^.current_inputfile) then
  487. old_current_module^.current_inputfile^.tempclose;
  488. compile(hp^.mainsource^,compile_system);
  489. if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
  490. old_current_module^.current_inputfile^.tempreopen;
  491. end;
  492. end
  493. else
  494. begin
  495. { only reassemble ? }
  496. if (hp^.do_assemble) then
  497. OnlyAsm(hp^.asmfilename^);
  498. { we should know there the PPU file else it's an error and
  499. we can't load the unit }
  500. if hp^.ppufile^.name^<>'' then
  501. load_ppu(old_current_module,hp,compile_system);
  502. { add the files for the linker }
  503. addlinkerfiles(hp);
  504. end;
  505. { register the unit _once_ }
  506. usedunits.concat(new(pused_unit,init(hp,0)));
  507. { the unit is written, so we can set the symtable type }
  508. { to unitsymtable, else we get some dupid errors }
  509. { this is not the right place because of the }
  510. { ready label }
  511. { psymtable(hp^.symtable)^.symtabletype:=unitsymtable; }
  512. { placed at this end of proc_unit }
  513. psymtable(hp^.symtable)^.unitid:=0;
  514. { reset the unitnumbers for the other units }
  515. pu:=pused_unit(old_current_module^.used_units.first);
  516. while assigned(pu) do
  517. begin
  518. psymtable(pu^.u^.symtable)^.unitid:=pu^.unitid;
  519. pu:=pused_unit(pu^.next);
  520. end;
  521. end
  522. else
  523. if assigned(hp) and (st=nil) then
  524. begin
  525. { we have to compile the unit again, but it is already inserted !!}
  526. { we may have problem with the lost symtable !! }
  527. current_module:=hp;
  528. { we must preserve the unit chain }
  529. nextmodule:=pmodule(hp^.next);
  530. { we have to cleanup a little }
  531. hp^.special_done;
  532. new(hs);
  533. hs^:=hp^.mainsource^;
  534. hp^.init(hs^,true);
  535. dispose(hs);
  536. { we must preserve the unit chain }
  537. hp^.next:=nextmodule;
  538. if assigned(hp^.ppufile) then
  539. load_ppu(old_current_module,hp,compile_system)
  540. else
  541. begin
  542. {$ifdef UseBrowser}
  543. { here we need to remove the names ! }
  544. hp^.sourcefiles.done;
  545. hp^.sourcefiles.init;
  546. {$endif UseBrowser}
  547. if assigned(old_current_module^.current_inputfile) then
  548. old_current_module^.current_inputfile^.tempclose;
  549. Message1(parser_d_compiling_second_time,hp^.mainsource^);
  550. compile(hp^.mainsource^,compile_system);
  551. if (not old_current_module^.compiled) and assigned(old_current_module^.current_inputfile) then
  552. old_current_module^.current_inputfile^.tempreopen;
  553. end;
  554. current_module^.compiled:=true;
  555. end;
  556. { set the old module }
  557. current_module:=old_current_module;
  558. { the current module uses the unit hp }
  559. current_module^.used_units.concat(new(pused_unit,init(hp,0)));
  560. pused_unit(current_module^.used_units.last)^.in_uses:=in_uses;
  561. if in_uses and not current_module^.in_implementation then
  562. pused_unit(current_module^.used_units.last)^.in_interface:=true;
  563. loadunit:=hp;
  564. end;
  565. {$endif OLDPPU}
  566. procedure loadsystemunit;
  567. var
  568. hp : pmodule;
  569. begin
  570. { if the current file isn't a system unit the the system unit
  571. will be loaded }
  572. if not(cs_compilesystem in aktmoduleswitches) then
  573. begin
  574. {$ifndef OLDPPU}
  575. hp:=loadunit(upper(target_info.system_unit),true);
  576. systemunit:=hp^.symtable;
  577. { add to the used units }
  578. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  579. {$else OLDPPU}
  580. hp:=loadunit(upper(target_info.system_unit),true,true);
  581. systemunit:=hp^.symtable;
  582. { add to the used units }
  583. current_module^.used_units.concat(new(pused_unit,init(hp,0)));
  584. {$endif OLDPPU}
  585. { read default constant definitions }
  586. make_ref:=false;
  587. readconstdefs;
  588. { we could try to overload caret by default }
  589. symtablestack:=systemunit;
  590. { if POWER is defined in the RTL then use it for starstar overloading }
  591. getsym('POWER',false);
  592. if assigned(srsym) and (srsym^.typ=procsym) and
  593. (overloaded_operators[STARSTAR]=nil) then
  594. overloaded_operators[STARSTAR]:=pprocsym(srsym);
  595. make_ref:=true;
  596. end
  597. else
  598. begin
  599. createconstdefs;
  600. systemunit:=nil;
  601. end;
  602. end;
  603. procedure loadunits;
  604. var
  605. s : stringid;
  606. hp : pused_unit;
  607. hp2 : pmodule;
  608. hp3 : psymtable;
  609. oldprocsym:Pprocsym;
  610. begin
  611. oldprocsym:=aktprocsym;
  612. consume(_USES);
  613. {$ifdef DEBUG}
  614. test_symtablestack;
  615. {$endif DEBUG}
  616. repeat
  617. s:=pattern;
  618. consume(ID);
  619. {$ifndef OLDPPU}
  620. hp2:=loadunit(s,false);
  621. { the current module uses the unit hp2 }
  622. current_module^.used_units.concat(new(pused_unit,init(hp2,not current_module^.in_implementation)));
  623. pused_unit(current_module^.used_units.last)^.in_uses:=true;
  624. {$else OLDPPU}
  625. hp2:=loadunit(s,false,true);
  626. {$endif OLDPPU}
  627. if current_module^.compiled then
  628. exit;
  629. refsymtable^.insert(new(punitsym,init(s,hp2^.symtable)));
  630. if token=COMMA then
  631. begin
  632. pattern:='';
  633. consume(COMMA);
  634. end
  635. else
  636. break;
  637. until false;
  638. consume(SEMICOLON);
  639. { set the symtable to systemunit so it gets reorderd correctly }
  640. symtablestack:=systemunit;
  641. { now insert the units in the symtablestack }
  642. hp:=pused_unit(current_module^.used_units.first);
  643. while assigned(hp) do
  644. begin
  645. {$IfDef GDB}
  646. if (cs_debuginfo in aktmoduleswitches) and
  647. not hp^.is_stab_written then
  648. begin
  649. punitsymtable(hp^.u^.symtable)^.concattypestabto(debuglist);
  650. hp^.is_stab_written:=true;
  651. hp^.unitid:=psymtable(hp^.u^.symtable)^.unitid;
  652. end;
  653. {$EndIf GDB}
  654. if hp^.in_uses then
  655. begin
  656. hp3:=symtablestack;
  657. while assigned(hp3) do
  658. begin
  659. { insert units only once ! }
  660. if hp^.u^.symtable=hp3 then
  661. break;
  662. hp3:=hp3^.next;
  663. { unit isn't inserted }
  664. if hp3=nil then
  665. begin
  666. psymtable(hp^.u^.symtable)^.next:=symtablestack;
  667. symtablestack:=psymtable(hp^.u^.symtable);
  668. {$ifdef CHAINPROCSYMS}
  669. symtablestack^.chainprocsyms;
  670. {$endif CHAINPROCSYMS}
  671. {$ifdef DEBUG}
  672. test_symtablestack;
  673. {$endif DEBUG}
  674. end;
  675. end;
  676. end;
  677. hp:=pused_unit(hp^.next);
  678. end;
  679. aktprocsym:=oldprocsym;
  680. end;
  681. procedure parse_implementation_uses(symt:Psymtable);
  682. var
  683. old_module_in_implementation : boolean;
  684. begin
  685. if token=_USES then
  686. begin
  687. old_module_in_implementation:=module_in_implementation;
  688. module_in_implementation:=true;
  689. current_module^.in_implementation:=true;
  690. symt^.symtabletype:=unitsymtable;
  691. loadunits;
  692. symt^.symtabletype:=globalsymtable;
  693. {$ifdef DEBUG}
  694. test_symtablestack;
  695. {$endif DEBUG}
  696. module_in_implementation:=old_module_in_implementation;
  697. end;
  698. end;
  699. procedure proc_unit;
  700. var
  701. { unitname : stringid; }
  702. names : Tstringcontainer;
  703. p : psymtable;
  704. unitst : punitsymtable;
  705. pu : pused_unit;
  706. i : longint;
  707. s1,s2 : ^string; {Saves stack space}
  708. begin
  709. consume(_UNIT);
  710. if token=ID then
  711. begin
  712. { create filenames and unit name }
  713. current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^);
  714. stringdispose(current_module^.modulename);
  715. current_module^.modulename:=stringdup(upper(pattern));
  716. { check for system unit }
  717. new(s1);
  718. new(s2);
  719. s1^:=upper(target_info.system_unit);
  720. s2^:=upper(current_scanner^.inputfile^.name^);
  721. { strip extension, there could only be one dot }
  722. i:=pos('.',s2^);
  723. if i>0 then
  724. s2^:=Copy(s2^,1,i-1);
  725. if (cs_compilesystem in aktmoduleswitches) then
  726. begin
  727. if (cs_check_unit_name in aktglobalswitches) and
  728. ((length(current_module^.modulename^)>8) or
  729. (current_module^.modulename^<>s1^) or
  730. (current_module^.modulename^<>s2^)) then
  731. Message1(unit_e_illegal_unit_name,s1^);
  732. end
  733. else
  734. if (current_module^.modulename^=s1^) then
  735. Message(unit_w_switch_us_missed);
  736. dispose(s2);
  737. dispose(s1);
  738. { Add Object File }
  739. if (cs_smartlink in aktmoduleswitches) then
  740. current_module^.linkstaticlibs.insert(current_module^.libfilename^)
  741. else
  742. current_module^.linkofiles.insert(current_module^.objfilename^);
  743. end;
  744. consume(ID);
  745. consume(SEMICOLON);
  746. consume(_INTERFACE);
  747. { update status }
  748. status.currentmodule:=current_module^.modulename^;
  749. { this should be placed after uses !!}
  750. {$ifndef UseNiceNames}
  751. procprefix:='_'+current_module^.modulename^+'$$';
  752. {$else UseNiceNames}
  753. procprefix:='_'+tostr(length(current_module^.unitname^))+lowercase(current_module^.unitname^)+'_';
  754. {$endif UseNiceNames}
  755. parse_only:=true;
  756. { generate now the global symboltable }
  757. p:=new(punitsymtable,init(globalsymtable,current_module^.modulename^));
  758. refsymtable:=p;
  759. unitst:=punitsymtable(p);
  760. { the unit name must be usable as a unit specifier }
  761. { inside the unit itself (PM) }
  762. { this also forbids to have another symbol }
  763. { with the same name as the unit }
  764. refsymtable^.insert(new(punitsym,init(current_module^.modulename^,unitst)));
  765. { set the symbol table for the current unit }
  766. { this must be set later for interdependency }
  767. { current_module^.symtable:=psymtable(p); }
  768. { a unit compiled at command line must be inside the loaded_unit list }
  769. if (compile_level=1) then
  770. begin
  771. loaded_units.insert(current_module);
  772. if cs_createlib in initmoduleswitches then
  773. begin
  774. current_module^.flags:=current_module^.flags or uf_in_library;
  775. if cs_shared_lib in initmoduleswitches then
  776. current_module^.flags:=current_module^.flags or uf_shared_library;
  777. end;
  778. end;
  779. { insert qualifier for the system unit (allows system.writeln) }
  780. if not(cs_compilesystem in aktmoduleswitches) then
  781. begin
  782. { insert the system unit }
  783. { it is allways the first }
  784. systemunit^.next:=nil;
  785. symtablestack:=systemunit;
  786. refsymtable^.insert(new(punitsym,init('SYSTEM',systemunit)));
  787. if token=_USES then
  788. begin
  789. unitst^.symtabletype:=unitsymtable;
  790. loadunits;
  791. { has it been compiled at a higher level ?}
  792. if current_module^.compiled then
  793. exit;
  794. unitst^.symtabletype:=globalsymtable;
  795. end;
  796. { ... but insert the symbol table later }
  797. p^.next:=symtablestack;
  798. symtablestack:=p;
  799. end
  800. else
  801. { while compiling a system unit, some types are directly inserted }
  802. begin
  803. p^.next:=symtablestack;
  804. symtablestack:=p;
  805. insert_intern_types(p);
  806. end;
  807. { displaced for inter-dependency considerations }
  808. current_module^.symtable:=psymtable(p);
  809. constsymtable:=symtablestack;
  810. { ... parse the declarations }
  811. read_interface_declarations;
  812. consume(_IMPLEMENTATION);
  813. parse_only:=false;
  814. {$ifdef GDB}
  815. { add all used definitions even for implementation}
  816. if (cs_debuginfo in aktmoduleswitches) then
  817. begin
  818. { all types }
  819. punitsymtable(refsymtable)^.concattypestabto(debuglist);
  820. { and all local symbols}
  821. refsymtable^.concatstabto(debuglist);
  822. end;
  823. {$endif GDB}
  824. { generates static symbol table }
  825. p:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  826. {Generate a procsym.}
  827. make_ref:=false;
  828. aktprocsym:=new(Pprocsym,init(current_module^.modulename^+'_init'));
  829. aktprocsym^.definition:=new(Pprocdef,init);
  830. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or pounitinit;
  831. aktprocsym^.definition^.setmangledname(current_module^.modulename^+'_init');
  832. make_ref:=true;
  833. {The generated procsym has a local symtable. Discard it and turn
  834. it into the static one.}
  835. dispose(aktprocsym^.definition^.localst,done);
  836. aktprocsym^.definition^.localst:=p;
  837. { remove the globalsymtable from the symtable stack }
  838. { to reinsert it after loading the implementation units }
  839. symtablestack:=unitst^.next;
  840. { number the definitions, so a deref from other units works }
  841. refsymtable^.number_defs;
  842. { Read the implementation units }
  843. parse_implementation_uses(unitst);
  844. numberunits;
  845. { now we can change refsymtable }
  846. refsymtable:=p;
  847. { but reinsert the global symtable as lasts }
  848. unitst^.next:=symtablestack;
  849. symtablestack:=unitst;
  850. {$ifdef DEBUG}
  851. test_symtablestack;
  852. {$endif DEBUG}
  853. constsymtable:=symtablestack;
  854. {$ifdef Splitheap}
  855. if testsplit then
  856. begin
  857. Split_Heap;
  858. allow_special:=true;
  859. Switch_to_temp_heap;
  860. end;
  861. { it will report all crossings }
  862. allow_special:=false;
  863. {$endif Splitheap}
  864. { set some informations }
  865. procinfo.retdef:=voiddef;
  866. procinfo._class:=nil;
  867. procinfo.call_offset:=8;
  868. { for temporary values }
  869. procinfo.framepointer:=frame_pointer;
  870. { clear flags }
  871. procinfo.flags:=0;
  872. { Create a new procedure }
  873. codegen_newprocedure;
  874. { Compile the unit }
  875. names.init;
  876. names.insert(current_module^.modulename^+'_init');
  877. names.insert('INIT$$'+current_module^.modulename^);
  878. compile_proc_body(names,true,false);
  879. names.done;
  880. { Shutdown the codegen for this procedure }
  881. codegen_doneprocedure;
  882. {$ifdef dummy}
  883. if token=_FINALIZATION then
  884. begin
  885. current_module^.flags:=current_module^.flags or uf_finalize;
  886. { clear flags }
  887. procinfo.flags:=0;
  888. {Reset the codegenerator.}
  889. codegen_newprocedure;
  890. names.init;
  891. names.insert(current_module^.modulename^+'_finalize');
  892. names.insert('FINALIZE$$'+current_module^.modulename^);
  893. compile_proc_body(names,true,false);
  894. names.done;
  895. codegen_doneprocedure;
  896. end;
  897. {$endif dummy}
  898. consume(POINT);
  899. { size of the static data }
  900. datasize:=symtablestack^.datasize;
  901. { unsed static symbols ? }
  902. symtablestack^.allsymbolsused;
  903. {$ifdef GDB}
  904. { add all used definitions even for implementation}
  905. if (cs_debuginfo in aktmoduleswitches) then
  906. begin
  907. { all types }
  908. punitsymtable(symtablestack)^.concattypestabto(debuglist);
  909. { and all local symbols}
  910. symtablestack^.concatstabto(debuglist);
  911. end;
  912. {$endif GDB}
  913. current_module^.in_implementation:=false;
  914. { deletes all symtables generated in the implementation part }
  915. while symtablestack^.symtabletype<>globalsymtable do
  916. dellexlevel;
  917. { tests, if all forwards are resolved }
  918. symtablestack^.check_forwards;
  919. symtablestack^.symtabletype:=unitsymtable;
  920. punitsymtable(symtablestack)^.is_stab_written:=false;
  921. {Write out the unit if the compile was succesfull.}
  922. if status.errorcount=0 then
  923. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack));
  924. pu:=pused_unit(usedunits.first);
  925. while assigned(pu) do
  926. begin
  927. punitsymtable(pu^.u^.symtable)^.is_stab_written:=false;
  928. pu:=pused_unit(pu^.next);
  929. end;
  930. inc(datasize,symtablestack^.datasize);
  931. { generate imports }
  932. if current_module^.uses_imports then
  933. importlib^.generatelib;
  934. { finish asmlist by adding segment starts }
  935. insertsegment;
  936. end;
  937. procedure proc_program(islibrary : boolean);
  938. var
  939. st : psymtable;
  940. names : Tstringcontainer;
  941. begin
  942. parse_only:=false;
  943. if islibrary then
  944. begin
  945. consume(_LIBRARY);
  946. stringdispose(current_module^.modulename);
  947. current_module^.modulename:=stringdup(pattern);
  948. consume(ID);
  949. consume(SEMICOLON);
  950. end
  951. else
  952. { is there an program head ? }
  953. if token=_PROGRAM then
  954. begin
  955. consume(_PROGRAM);
  956. stringdispose(current_module^.modulename);
  957. current_module^.modulename:=stringdup(pattern);
  958. consume(ID);
  959. if token=LKLAMMER then
  960. begin
  961. consume(LKLAMMER);
  962. idlist;
  963. consume(RKLAMMER);
  964. end;
  965. consume(SEMICOLON);
  966. end;
  967. { insert after the unit symbol tables the static symbol table }
  968. { of the program }
  969. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  970. {Generate a procsym.}
  971. make_ref:=false;
  972. aktprocsym:=new(Pprocsym,init('main'));
  973. aktprocsym^.definition:=new(Pprocdef,init);
  974. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or poproginit;
  975. aktprocsym^.definition^.setmangledname(target_os.Cprefix+'main');
  976. make_ref:=true;
  977. {The localst is a local symtable. Change it into the static
  978. symtable.}
  979. dispose(aktprocsym^.definition^.localst,done);
  980. aktprocsym^.definition^.localst:=st;
  981. refsymtable:=st;
  982. { necessary for browser }
  983. loaded_units.insert(current_module);
  984. {Insert the symbols of the system unit into the stack of symbol
  985. tables.}
  986. symtablestack:=systemunit;
  987. systemunit^.next:=nil;
  988. refsymtable^.insert(new(punitsym,init('SYSTEM',systemunit)));
  989. {Load the units used by the program we compile.}
  990. if token=_USES then
  991. loadunits;
  992. {Insert the name of the main program into the symbol table.}
  993. if current_module^.modulename^<>'' then
  994. st^.insert(new(pprogramsym,init(current_module^.modulename^)));
  995. { ...is also constsymtable, this is the symtable where }
  996. { the elements of enumeration types are inserted }
  997. constsymtable:=st;
  998. { set some informations about the main program }
  999. with procinfo do
  1000. begin
  1001. retdef:=voiddef;
  1002. _class:=nil;
  1003. call_offset:=8;
  1004. framepointer:=frame_pointer;
  1005. flags:=0;
  1006. end;
  1007. procprefix:='';
  1008. in_except_block:=false;
  1009. codegen_newprocedure;
  1010. {The program intialization needs an alias, so it can be called
  1011. from the bootstrap code.}
  1012. names.init;
  1013. names.insert('program_init');
  1014. names.insert('PASCALMAIN');
  1015. names.insert(target_os.cprefix+'main');
  1016. compile_proc_body(names,true,false);
  1017. names.done;
  1018. codegen_doneprocedure;
  1019. consume(POINT);
  1020. if (cs_smartlink in aktmoduleswitches) then
  1021. current_module^.linkstaticlibs.insert(current_module^.libfilename^)
  1022. else
  1023. current_module^.linkofiles.insert(current_module^.objfilename^);
  1024. { insert heap }
  1025. insertheap;
  1026. { generate imports }
  1027. if current_module^.uses_imports then
  1028. importlib^.generatelib;
  1029. inserttargetspecific;
  1030. datasize:=symtablestack^.datasize;
  1031. { finish asmlist by adding segment starts }
  1032. insertsegment;
  1033. end;
  1034. end.
  1035. {
  1036. $Log$
  1037. Revision 1.38 1998-08-10 14:50:13 peter
  1038. + localswitches, moduleswitches, globalswitches splitting
  1039. Revision 1.37 1998/08/10 10:18:31 peter
  1040. + Compiler,Comphook unit which are the new interface units to the
  1041. compiler
  1042. Revision 1.36 1998/07/14 14:46:54 peter
  1043. * released NEWINPUT
  1044. Revision 1.35 1998/07/08 12:39:38 peter
  1045. * heap_size for m68k
  1046. Revision 1.34 1998/07/07 11:20:03 peter
  1047. + NEWINPUT for a better inputfile and scanner object
  1048. Revision 1.33 1998/06/25 11:15:34 pierre
  1049. * ppu files where not closed in newppu !!
  1050. second compilation was impossible due to too many opened files
  1051. (not visible in 'make cycle' as we remove all the ppu files)
  1052. Revision 1.32 1998/06/25 08:48:16 florian
  1053. * first version of rtti support
  1054. Revision 1.31 1998/06/24 14:48:35 peter
  1055. * ifdef newppu -> ifndef oldppu
  1056. Revision 1.30 1998/06/17 14:10:16 peter
  1057. * small os2 fixes
  1058. * fixed interdependent units with newppu (remake3 under linux works now)
  1059. Revision 1.29 1998/06/16 08:56:25 peter
  1060. + targetcpu
  1061. * cleaner pmodules for newppu
  1062. Revision 1.28 1998/06/13 00:10:10 peter
  1063. * working browser and newppu
  1064. * some small fixes against crashes which occured in bp7 (but not in
  1065. fpc?!)
  1066. Revision 1.27 1998/06/11 13:58:08 peter
  1067. * small fix to let newppu compile
  1068. Revision 1.26 1998/06/09 16:01:47 pierre
  1069. + added procedure directive parsing for procvars
  1070. (accepted are popstack cdecl and pascal)
  1071. + added C vars with the following syntax
  1072. var C calias 'true_c_name';(can be followed by external)
  1073. reason is that you must add the Cprefix
  1074. which is target dependent
  1075. Revision 1.25 1998/06/08 22:59:49 peter
  1076. * smartlinking works for win32
  1077. * some defines to exclude some compiler parts
  1078. Revision 1.24 1998/06/08 13:13:44 pierre
  1079. + temporary variables now in temp_gen.pas unit
  1080. because it is processor independent
  1081. * mppc68k.bat modified to undefine i386 and support_mmx
  1082. (which are defaults for i386)
  1083. Revision 1.23 1998/06/05 17:47:29 peter
  1084. * some better uses clauses
  1085. Revision 1.22 1998/06/05 14:37:34 pierre
  1086. * fixes for inline for operators
  1087. * inline procedure more correctly restricted
  1088. Revision 1.21 1998/06/04 23:51:53 peter
  1089. * m68k compiles
  1090. + .def file creation moved to gendef.pas so it could also be used
  1091. for win32
  1092. Revision 1.20 1998/06/04 09:55:42 pierre
  1093. * demangled name of procsym reworked to become independant of the mangling scheme
  1094. Revision 1.19 1998/06/03 23:40:38 peter
  1095. + unlimited file support, release tempclose
  1096. Revision 1.18 1998/06/03 22:49:00 peter
  1097. + wordbool,longbool
  1098. * rename bis,von -> high,low
  1099. * moved some systemunit loading/creating to psystem.pas
  1100. Revision 1.17 1998/05/28 14:40:25 peter
  1101. * fixes for newppu, remake3 works now with it
  1102. Revision 1.16 1998/05/27 19:45:06 peter
  1103. * symtable.pas splitted into includefiles
  1104. * symtable adapted for $ifdef NEWPPU
  1105. Revision 1.15 1998/05/23 01:21:22 peter
  1106. + aktasmmode, aktoptprocessor, aktoutputformat
  1107. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1108. + $LIBNAME to set the library name where the unit will be put in
  1109. * splitted cgi386 a bit (codeseg to large for bp7)
  1110. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1111. Revision 1.14 1998/05/20 09:42:35 pierre
  1112. + UseTokenInfo now default
  1113. * unit in interface uses and implementation uses gives error now
  1114. * only one error for unknown symbol (uses lastsymknown boolean)
  1115. the problem came from the label code !
  1116. + first inlined procedures and function work
  1117. (warning there might be allowed cases were the result is still wrong !!)
  1118. * UseBrower updated gives a global list of all position of all used symbols
  1119. with switch -gb
  1120. Revision 1.13 1998/05/12 10:47:00 peter
  1121. * moved printstatus to verb_def
  1122. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1123. prefix like error: warning: and is included in V_Default
  1124. * fixed some messages
  1125. * first time parameter scan is only for -v and -T
  1126. - removed old style messages
  1127. Revision 1.12 1998/05/11 13:07:56 peter
  1128. + $ifdef NEWPPU for the new ppuformat
  1129. + $define GDB not longer required
  1130. * removed all warnings and stripped some log comments
  1131. * no findfirst/findnext anymore to remove smartlink *.o files
  1132. Revision 1.11 1998/05/06 18:36:53 peter
  1133. * tai_section extended with code,data,bss sections and enumerated type
  1134. * ident 'compiled by FPC' moved to pmodules
  1135. * small fix for smartlink
  1136. Revision 1.10 1998/05/04 17:54:28 peter
  1137. + smartlinking works (only case jumptable left todo)
  1138. * redesign of systems.pas to support assemblers and linkers
  1139. + Unitname is now also in the PPU-file, increased version to 14
  1140. Revision 1.9 1998/05/01 16:38:45 florian
  1141. * handling of private and protected fixed
  1142. + change_keywords_to_tp implemented to remove
  1143. keywords which aren't supported by tp
  1144. * break and continue are now symbols of the system unit
  1145. + widestring, longstring and ansistring type released
  1146. Revision 1.8 1998/04/30 15:59:41 pierre
  1147. * GDB works again better :
  1148. correct type info in one pass
  1149. + UseTokenInfo for better source position
  1150. * fixed one remaining bug in scanner for line counts
  1151. * several little fixes
  1152. Revision 1.7 1998/04/29 10:33:59 pierre
  1153. + added some code for ansistring (not complete nor working yet)
  1154. * corrected operator overloading
  1155. * corrected nasm output
  1156. + started inline procedures
  1157. + added starstarn : use ** for exponentiation (^ gave problems)
  1158. + started UseTokenInfo cond to get accurate positions
  1159. Revision 1.6 1998/04/27 23:10:28 peter
  1160. + new scanner
  1161. * $makelib -> if smartlink
  1162. * small filename fixes pmodule.setfilename
  1163. * moved import from files.pas -> import.pas
  1164. Revision 1.5 1998/04/14 23:27:03 florian
  1165. + exclude/include with constant second parameter added
  1166. Revision 1.4 1998/04/10 14:41:43 peter
  1167. * removed some Hints
  1168. * small speed optimization for AsmLn
  1169. Revision 1.3 1998/04/03 09:51:00 daniel
  1170. * Fixed heap allocation for OS/2.
  1171. }