pmodules.pas 51 KB

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