pmodules.pas 47 KB

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