pmodules.pas 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  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. 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. { save default symtablestack }
  458. defaultsymtablestack:=symtablestack;
  459. end;
  460. procedure loadunits;
  461. var
  462. s : stringid;
  463. hp : pused_unit;
  464. hp2 : pmodule;
  465. hp3 : psymtable;
  466. oldprocsym:Pprocsym;
  467. begin
  468. oldprocsym:=aktprocsym;
  469. consume(_USES);
  470. {$ifdef DEBUG}
  471. test_symtablestack;
  472. {$endif DEBUG}
  473. repeat
  474. s:=pattern;
  475. consume(ID);
  476. { avoid uses of itself }
  477. if s<>current_module^.modulename^ then
  478. begin
  479. { load the unit }
  480. hp2:=loadunit(s,false);
  481. { the current module uses the unit hp2 }
  482. current_module^.used_units.concat(new(pused_unit,init(hp2,not current_module^.in_implementation)));
  483. pused_unit(current_module^.used_units.last)^.in_uses:=true;
  484. if current_module^.compiled then
  485. exit;
  486. refsymtable^.insert(new(punitsym,init(s,hp2^.globalsymtable)));
  487. end
  488. else
  489. Message1(sym_e_duplicate_id,s);
  490. if token=COMMA then
  491. begin
  492. pattern:='';
  493. consume(COMMA);
  494. end
  495. else
  496. break;
  497. until false;
  498. consume(SEMICOLON);
  499. { set the symtable to systemunit so it gets reorderd correctly }
  500. symtablestack:=defaultsymtablestack;
  501. { now insert the units in the symtablestack }
  502. hp:=pused_unit(current_module^.used_units.first);
  503. while assigned(hp) do
  504. begin
  505. {$IfDef GDB}
  506. if (cs_debuginfo in aktmoduleswitches) and
  507. not hp^.is_stab_written then
  508. begin
  509. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  510. hp^.is_stab_written:=true;
  511. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  512. end;
  513. {$EndIf GDB}
  514. if hp^.in_uses then
  515. begin
  516. hp3:=symtablestack;
  517. while assigned(hp3) do
  518. begin
  519. { insert units only once ! }
  520. if hp^.u^.globalsymtable=hp3 then
  521. break;
  522. hp3:=hp3^.next;
  523. { unit isn't inserted }
  524. if hp3=nil then
  525. begin
  526. psymtable(hp^.u^.globalsymtable)^.next:=symtablestack;
  527. symtablestack:=psymtable(hp^.u^.globalsymtable);
  528. {$ifdef CHAINPROCSYMS}
  529. symtablestack^.chainprocsyms;
  530. {$endif CHAINPROCSYMS}
  531. {$ifdef DEBUG}
  532. test_symtablestack;
  533. {$endif DEBUG}
  534. end;
  535. end;
  536. end;
  537. hp:=pused_unit(hp^.next);
  538. end;
  539. aktprocsym:=oldprocsym;
  540. end;
  541. procedure parse_implementation_uses(symt:Psymtable);
  542. begin
  543. if token=_USES then
  544. begin
  545. symt^.symtabletype:=unitsymtable;
  546. loadunits;
  547. symt^.symtabletype:=globalsymtable;
  548. {$ifdef DEBUG}
  549. test_symtablestack;
  550. {$endif DEBUG}
  551. end;
  552. end;
  553. procedure gen_main_procsym(const name:string;options:longint;st:psymtable);
  554. begin
  555. {Generate a procsym for main}
  556. make_ref:=false;
  557. aktprocsym:=new(Pprocsym,init(name));
  558. aktprocsym^.definition:=new(Pprocdef,init);
  559. aktprocsym^.definition^.options:=aktprocsym^.definition^.options or options;
  560. aktprocsym^.definition^.setmangledname(target_os.cprefix+name);
  561. aktprocsym^.definition^.forwarddef:=false;
  562. make_ref:=true;
  563. { The localst is a local symtable. Change it into the static
  564. symtable }
  565. dispose(aktprocsym^.definition^.localst,done);
  566. aktprocsym^.definition^.localst:=st;
  567. { and insert the procsym in symtable }
  568. st^.insert(aktprocsym);
  569. { set some informations about the main program }
  570. with procinfo do
  571. begin
  572. retdef:=voiddef;
  573. _class:=nil;
  574. call_offset:=8;
  575. framepointer:=frame_pointer;
  576. flags:=0;
  577. end;
  578. end;
  579. procedure proc_unit;
  580. function is_assembler_generated:boolean;
  581. begin
  582. is_assembler_generated:=(status.errorcount=0) and
  583. not(
  584. codesegment^.empty and
  585. datasegment^.empty and
  586. bsssegment^.empty and
  587. ((importssection=nil) or importssection^.empty) and
  588. ((resourcesection=nil) or resourcesection^.empty)
  589. );
  590. end;
  591. var
  592. names : Tstringcontainer;
  593. st : psymtable;
  594. unitst : punitsymtable;
  595. {$ifdef GDB}
  596. pu : pused_unit;
  597. {$endif GDB}
  598. s1,s2 : ^string; {Saves stack space}
  599. begin
  600. consume(_UNIT);
  601. if token=ID then
  602. begin
  603. { create filenames and unit name }
  604. current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^,true);
  605. stringdispose(current_module^.modulename);
  606. current_module^.modulename:=stringdup(upper(pattern));
  607. { check for system unit }
  608. new(s1);
  609. new(s2);
  610. s1^:=upper(target_info.system_unit);
  611. s2^:=upper(SplitName(current_scanner^.inputfile^.name^));
  612. if (cs_compilesystem in aktmoduleswitches) then
  613. begin
  614. if ((length(current_module^.modulename^)>8) or
  615. (current_module^.modulename^<>s1^) or
  616. (current_module^.modulename^<>s2^)) then
  617. Message1(unit_e_illegal_unit_name,current_module^.modulename^);
  618. end
  619. else
  620. begin
  621. if (cs_check_unit_name in aktglobalswitches) and
  622. not((current_module^.modulename^=s2^) or
  623. ((length(current_module^.modulename^)>8) and
  624. (copy(current_module^.modulename^,1,8)=s2^))) then
  625. Message1(unit_e_illegal_unit_name,current_module^.modulename^);
  626. if (current_module^.modulename^=s1^) then
  627. Message(unit_w_switch_us_missed);
  628. end;
  629. dispose(s2);
  630. dispose(s1);
  631. end;
  632. consume(ID);
  633. consume(SEMICOLON);
  634. consume(_INTERFACE);
  635. { global switches are read, so further changes aren't allowed }
  636. current_module^.in_global:=false;
  637. Message1(unit_u_start_parse_interface,current_module^.modulename^);
  638. { update status }
  639. status.currentmodule:=current_module^.modulename^;
  640. { maybe turn off m_objpas if we are compiling objpas }
  641. if (current_module^.modulename^='OBJPAS') then
  642. aktmodeswitches:=aktmodeswitches-[m_objpas];
  643. { this should be placed after uses !!}
  644. {$ifndef UseNiceNames}
  645. procprefix:='_'+current_module^.modulename^+'$$';
  646. {$else UseNiceNames}
  647. procprefix:='_'+tostr(length(current_module^.modulename^))+lowercase(current_module^.modulename^)+'_';
  648. {$endif UseNiceNames}
  649. parse_only:=true;
  650. { generate now the global symboltable }
  651. st:=new(punitsymtable,init(globalsymtable,current_module^.modulename^));
  652. refsymtable:=st;
  653. unitst:=punitsymtable(st);
  654. { define first as local to overcome dependency conflicts }
  655. current_module^.localsymtable:=st;
  656. { the unit name must be usable as a unit specifier }
  657. { inside the unit itself (PM) }
  658. { this also forbids to have another symbol }
  659. { with the same name as the unit }
  660. refsymtable^.insert(new(punitsym,init(current_module^.modulename^,unitst)));
  661. { a unit compiled at command line must be inside the loaded_unit list }
  662. if (compile_level=1) then
  663. loaded_units.insert(current_module);
  664. { load default units, like the system unit }
  665. loaddefaultunits;
  666. { reset }
  667. make_ref:=true;
  668. lexlevel:=0;
  669. { insert qualifier for the system unit (allows system.writeln) }
  670. if not(cs_compilesystem in aktmoduleswitches) then
  671. begin
  672. if token=_USES then
  673. begin
  674. unitst^.symtabletype:=unitsymtable;
  675. loadunits;
  676. { has it been compiled at a higher level ?}
  677. if current_module^.compiled then
  678. begin
  679. { this unit symtable is obsolete }
  680. { dispose(unitst,done);
  681. disposed as localsymtable !! }
  682. exit;
  683. end;
  684. unitst^.symtabletype:=globalsymtable;
  685. end;
  686. { ... but insert the symbol table later }
  687. st^.next:=symtablestack;
  688. symtablestack:=st;
  689. end
  690. else
  691. { while compiling a system unit, some types are directly inserted }
  692. begin
  693. st^.next:=symtablestack;
  694. symtablestack:=st;
  695. insert_intern_types(st);
  696. end;
  697. { now we know the place to insert the constants }
  698. constsymtable:=symtablestack;
  699. { move the global symtab from the temporary local to global }
  700. current_module^.globalsymtable:=current_module^.localsymtable;
  701. current_module^.localsymtable:=nil;
  702. reset_global_defs;
  703. { ... parse the declarations }
  704. read_interface_declarations;
  705. { leave when we got an error }
  706. if (status.errorcount>0) and not status.skip_error then
  707. begin
  708. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  709. status.skip_error:=true;
  710. exit;
  711. end;
  712. { Parse the implementation section }
  713. consume(_IMPLEMENTATION);
  714. current_module^.in_implementation:=true;
  715. Message1(unit_u_start_parse_implementation,current_module^.modulename^);
  716. parse_only:=false;
  717. { generates static symbol table }
  718. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  719. current_module^.localsymtable:=st;
  720. { remove the globalsymtable from the symtable stack }
  721. { to reinsert it after loading the implementation units }
  722. symtablestack:=unitst^.next;
  723. { number the definitions, so a deref from other units works }
  724. refsymtable^.number_defs;
  725. {$ifdef UseBrowser}
  726. refsymtable^.number_symbols;
  727. { we don't want implementation units symbols in unitsymtable !! PM }
  728. refsymtable:=st;
  729. {$endif UseBrowser}
  730. { Read the implementation units }
  731. parse_implementation_uses(unitst);
  732. if current_module^.compiled then
  733. begin
  734. exit;
  735. end;
  736. { reset ranges/stabs in exported definitions }
  737. { If I find who removed this line !!!!!!!
  738. I AM TIRED OF THIS !!!!!!!!!!!
  739. DONT TOUCH WITHOUT ASKING ME Pierre Muller }
  740. reset_global_defs;
  741. { All units are read, now give them a number }
  742. numberunits;
  743. { now we can change refsymtable }
  744. refsymtable:=st;
  745. { but reinsert the global symtable as lasts }
  746. unitst^.next:=symtablestack;
  747. symtablestack:=unitst;
  748. {$ifdef DEBUG}
  749. test_symtablestack;
  750. {$endif DEBUG}
  751. constsymtable:=symtablestack;
  752. {$ifdef Splitheap}
  753. if testsplit then
  754. begin
  755. Split_Heap;
  756. allow_special:=true;
  757. Switch_to_temp_heap;
  758. end;
  759. { it will report all crossings }
  760. allow_special:=false;
  761. {$endif Splitheap}
  762. { Generate a procsym }
  763. gen_main_procsym(current_module^.modulename^+'_init',pounitinit,st);
  764. { Compile the unit }
  765. codegen_newprocedure;
  766. names.init;
  767. names.insert('INIT$$'+current_module^.modulename^);
  768. names.insert(target_os.cprefix+current_module^.modulename^+'_init');
  769. compile_proc_body(names,true,false);
  770. names.done;
  771. codegen_doneprocedure;
  772. { avoid self recursive destructor call !! PM }
  773. aktprocsym^.definition^.localst:=nil;
  774. { finalize? }
  775. if token=_FINALIZATION then
  776. begin
  777. { set module options }
  778. current_module^.flags:=current_module^.flags or uf_finalize;
  779. { Generate a procsym }
  780. gen_main_procsym(current_module^.modulename^+'_finalize',pounitfinalize,st);
  781. { Compile the finalize }
  782. codegen_newprocedure;
  783. names.init;
  784. names.insert('FINALIZE$$'+current_module^.modulename^);
  785. names.insert(target_os.cprefix+current_module^.modulename^+'_finalize');
  786. compile_proc_body(names,true,false);
  787. names.done;
  788. codegen_doneprocedure;
  789. { avoid self recursive destructor call !! PM }
  790. aktprocsym^.definition^.localst:=nil;
  791. end;
  792. { the last char should always be a point }
  793. consume(POINT);
  794. { avoid self recursive destructor call !! PM }
  795. aktprocsym^.definition^.localst:=nil;
  796. { absence does not matter here !! }
  797. aktprocsym^.definition^.forwarddef:=false;
  798. { test static symtable }
  799. if (status.errorcount=0) then
  800. st^.allsymbolsused;
  801. { size of the static data }
  802. datasize:=st^.datasize;
  803. {$ifdef GDB}
  804. { add all used definitions even for implementation}
  805. if (cs_debuginfo in aktmoduleswitches) then
  806. begin
  807. if assigned(current_module^.globalsymtable) then
  808. begin
  809. { all types }
  810. punitsymtable(current_module^.globalsymtable)^.concattypestabto(debuglist);
  811. { and all local symbols}
  812. punitsymtable(current_module^.globalsymtable)^.concatstabto(debuglist);
  813. end;
  814. { all types }
  815. punitsymtable(st)^.concattypestabto(debuglist);
  816. { and all local symbols}
  817. st^.concatstabto(debuglist);
  818. end;
  819. {$endif GDB}
  820. reset_global_defs;
  821. { tests, if all (interface) forwards are resolved }
  822. if (status.errorcount=0) then
  823. symtablestack^.check_forwards;
  824. { now we have a correct unit, change the symtable type }
  825. current_module^.in_implementation:=false;
  826. symtablestack^.symtabletype:=unitsymtable;
  827. {$ifdef GDB}
  828. punitsymtable(symtablestack)^.is_stab_written:=false;
  829. {$endif GDB}
  830. { leave when we got an error }
  831. if (status.errorcount>0) and not status.skip_error then
  832. begin
  833. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  834. status.skip_error:=true;
  835. exit;
  836. end;
  837. { generate imports }
  838. if current_module^.uses_imports then
  839. importlib^.generatelib;
  840. { insert own objectfile, or say that it's in a library
  841. (no check for an .o when loading) }
  842. if is_assembler_generated then
  843. insertobjectfile
  844. else
  845. current_module^.flags:=current_module^.flags or uf_in_library;
  846. { Write out the ppufile }
  847. if (status.errorcount=0) then
  848. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack));
  849. { write local browser }
  850. {$ifdef UseBrowser}
  851. if cs_local_browser in aktmoduleswitches then
  852. begin
  853. current_module^.localsymtable:=refsymtable;
  854. refsymtable^.write;
  855. refsymtable^.write_browser;
  856. end;
  857. {$endif UseBrowser}
  858. {$ifdef GDB}
  859. pu:=pused_unit(usedunits.first);
  860. while assigned(pu) do
  861. begin
  862. punitsymtable(pu^.u^.globalsymtable)^.is_stab_written:=false;
  863. pu:=pused_unit(pu^.next);
  864. end;
  865. {$endif GDB}
  866. { remove static symtable (=refsymtable) here to save some mem }
  867. {$ifndef UseBrowser}
  868. dispose(st,done);
  869. current_module^.localsymtable:=nil;
  870. {$endif UseBrowser}
  871. if is_assembler_generated then
  872. begin
  873. { finish asmlist by adding segment starts }
  874. insertsegment;
  875. { assemble }
  876. create_objectfile;
  877. end;
  878. { add the files for the linker from current_module }
  879. Linker.AddModuleFiles(current_module);
  880. end;
  881. procedure proc_program(islibrary : boolean);
  882. var
  883. st : psymtable;
  884. names : Tstringcontainer;
  885. begin
  886. parse_only:=false;
  887. if islibrary then
  888. begin
  889. consume(_LIBRARY);
  890. stringdispose(current_module^.modulename);
  891. current_module^.modulename:=stringdup(pattern);
  892. current_module^.islibrary:=true;
  893. consume(ID);
  894. consume(SEMICOLON);
  895. end
  896. else
  897. { is there an program head ? }
  898. if token=_PROGRAM then
  899. begin
  900. consume(_PROGRAM);
  901. stringdispose(current_module^.modulename);
  902. current_module^.modulename:=stringdup(pattern);
  903. consume(ID);
  904. if token=LKLAMMER then
  905. begin
  906. consume(LKLAMMER);
  907. idlist;
  908. consume(RKLAMMER);
  909. end;
  910. consume(SEMICOLON);
  911. end;
  912. { global switches are read, so further changes aren't allowed }
  913. current_module^.in_global:=false;
  914. { set implementation flag }
  915. current_module^.in_implementation:=true;
  916. { insert after the unit symbol tables the static symbol table }
  917. { of the program }
  918. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  919. current_module^.localsymtable:=st;
  920. symtablestack:=st;
  921. refsymtable:=st;
  922. { necessary for browser }
  923. loaded_units.insert(current_module);
  924. { load standard units (system,objpas unit) }
  925. loaddefaultunits;
  926. { reset }
  927. lexlevel:=0;
  928. {Load the units used by the program we compile.}
  929. if token=_USES then
  930. loadunits;
  931. reset_global_defs;
  932. {Insert the name of the main program into the symbol table.}
  933. if current_module^.modulename^<>'' then
  934. {st^.insert(new(pprogramsym,init(current_module^.modulename^)));}
  935. st^.insert(new(punitsym,init(current_module^.modulename^,punitsymtable(st))));
  936. { ...is also constsymtable, this is the symtable where }
  937. { the elements of enumeration types are inserted }
  938. constsymtable:=st;
  939. { Generate a procsym for main }
  940. gen_main_procsym('main',poproginit,st);
  941. { reset }
  942. procprefix:='';
  943. in_except_block:=false;
  944. {The program intialization needs an alias, so it can be called
  945. from the bootstrap code.}
  946. codegen_newprocedure;
  947. names.init;
  948. names.insert('program_init');
  949. names.insert('PASCALMAIN');
  950. names.insert(target_os.cprefix+'main');
  951. {$ifdef m68k}
  952. if target_info.target=target_m68k_PalmOS then
  953. names.insert('PilotMain');
  954. {$endif}
  955. compile_proc_body(names,true,false);
  956. names.done;
  957. { avoid self recursive destructor call !! PM }
  958. aktprocsym^.definition^.localst:=nil;
  959. codegen_doneprocedure;
  960. { consume the last point }
  961. consume(POINT);
  962. { leave when we got an error }
  963. if (status.errorcount>0) and not status.skip_error then
  964. begin
  965. Message1(unit_f_errors_in_unit,tostr(status.errorcount));
  966. status.skip_error:=true;
  967. exit;
  968. end;
  969. { generate imports }
  970. if current_module^.uses_imports then
  971. importlib^.generatelib;
  972. { insert heap }
  973. insertheap;
  974. inserttargetspecific;
  975. datasize:=symtablestack^.datasize;
  976. { finish asmlist by adding segment starts }
  977. insertsegment;
  978. { insert own objectfile }
  979. insertobjectfile;
  980. { assemble and link }
  981. create_objectfile;
  982. { add the files for the linker from current_module }
  983. Linker.AddModuleFiles(current_module);
  984. { create the executable when we are at level 1 }
  985. if (compile_level=1) then
  986. begin
  987. if (cs_link_deffile in aktglobalswitches) then
  988. deffile.writefile;
  989. if (not current_module^.is_unit) then
  990. Linker.MakeExecutable;
  991. end;
  992. end;
  993. end.
  994. {
  995. $Log$
  996. Revision 1.82 1998-11-12 12:55:16 pierre
  997. * fix for bug0176 and bug0177
  998. Revision 1.81 1998/11/12 11:34:58 peter
  999. * fix for empty .o files and linking of libs
  1000. Revision 1.80 1998/11/06 09:48:14 pierre
  1001. * double initialization code calling bug fixed
  1002. Revision 1.79 1998/11/03 11:33:11 peter
  1003. + search_unit arg to only search for sources
  1004. Revision 1.78 1998/10/30 12:23:41 peter
  1005. * fix for lognunitname and longunit.pas
  1006. Revision 1.77 1998/10/29 11:35:52 florian
  1007. * some dll support for win32
  1008. * fixed assembler writing for PalmOS
  1009. Revision 1.76 1998/10/28 18:26:15 pierre
  1010. * removed some erros after other errors (introduced by useexcept)
  1011. * stabs works again correctly (for how long !)
  1012. Revision 1.75 1998/10/27 13:45:35 pierre
  1013. * classes get a vmt allways
  1014. * better error info (tried to remove
  1015. several error strings introduced by the tpexcept handling)
  1016. Revision 1.74 1998/10/26 09:34:50 peter
  1017. * unit check name works now for all units, not only systemunit
  1018. Revision 1.73 1998/10/22 23:53:27 peter
  1019. * leave when an error has been in the interface (else other units could
  1020. be compiled with the implementation uses!)
  1021. * don't always compile when not in implementation with a second_load
  1022. Revision 1.72 1998/10/22 11:36:34 peter
  1023. * fixed imports generation at the wrong place
  1024. Revision 1.71 1998/10/21 20:13:10 peter
  1025. * check for importsection for empty asm file
  1026. Revision 1.70 1998/10/20 09:30:05 peter
  1027. * set also in_library flag when no .o is generated
  1028. Revision 1.68 1998/10/19 08:54:59 pierre
  1029. * wrong stabs info corrected once again !!
  1030. + variable vmt offset with vmt field only if required
  1031. implemented now !!!
  1032. Revision 1.67 1998/10/13 13:10:25 peter
  1033. * new style for m68k/i386 infos and enums
  1034. Revision 1.66 1998/10/09 16:36:05 pierre
  1035. * some memory leaks specific to usebrowser define fixed
  1036. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  1037. Revision 1.65 1998/10/09 14:38:55 pierre
  1038. * add a second load for PPU file
  1039. Revision 1.64 1998/10/09 08:56:28 pierre
  1040. * several memory leaks fixed
  1041. Revision 1.63 1998/10/08 23:29:01 peter
  1042. * -vu shows unit info, -vt shows tried/used files
  1043. Revision 1.62 1998/10/08 17:17:25 pierre
  1044. * current_module old scanner tagged as invalid if unit is recompiled
  1045. + added ppheap for better info on tracegetmem of heaptrc
  1046. (adds line column and file index)
  1047. * several memory leaks removed ith help of heaptrc !!
  1048. Revision 1.61 1998/10/08 13:48:47 peter
  1049. * fixed memory leaks for do nothing source
  1050. * fixed unit interdependency
  1051. Revision 1.60 1998/10/06 17:16:54 pierre
  1052. * some memory leaks fixed (thanks to Peter for heaptrc !)
  1053. Revision 1.59 1998/10/05 21:33:26 peter
  1054. * fixed 161,165,166,167,168
  1055. Revision 1.58 1998/09/30 16:43:37 peter
  1056. * fixed unit interdependency with circular uses
  1057. Revision 1.57 1998/09/30 12:11:52 peter
  1058. * fixed circular uses which looped forever
  1059. Revision 1.56 1998/09/28 11:22:15 pierre
  1060. * did not compile for browser
  1061. * merge from fixes
  1062. Revision 1.48.2.1 1998/09/28 10:55:16 pierre
  1063. fix for current_module dispose bug
  1064. Revision 1.55 1998/09/28 11:04:03 peter
  1065. * fixed loaddefaultunits which was at the wrong place for programs, so
  1066. the default defs were not loaded when main was initialized
  1067. Revision 1.54 1998/09/24 23:49:12 peter
  1068. + aktmodeswitches
  1069. Revision 1.53 1998/09/23 12:20:50 pierre
  1070. * main program tmodule had no symtable (crashed browser)
  1071. * unit symbols problem fixed !!
  1072. Revision 1.52 1998/09/22 17:13:49 pierre
  1073. + browsing updated and developed
  1074. records and objects fields are also stored
  1075. Revision 1.51 1998/09/22 15:40:55 peter
  1076. * some extra ifdef GDB
  1077. Revision 1.50 1998/09/21 08:45:17 pierre
  1078. + added vmt_offset in tobjectdef.write for fututre use
  1079. (first steps to have objects without vmt if no virtual !!)
  1080. + added fpu_used field for tabstractprocdef :
  1081. sets this level to 2 if the functions return with value in FPU
  1082. (is then set to correct value at parsing of implementation)
  1083. THIS MIGHT refuse some code with FPU expression too complex
  1084. that were accepted before and even in some cases
  1085. that don't overflow in fact
  1086. ( like if f : float; is a forward that finally in implementation
  1087. only uses one fpu register !!)
  1088. Nevertheless I think that it will improve security on
  1089. FPU operations !!
  1090. * most other changes only for UseBrowser code
  1091. (added symtable references for record and objects)
  1092. local switch for refs to args and local of each function
  1093. (static symtable still missing)
  1094. UseBrowser still not stable and probably broken by
  1095. the definition hash array !!
  1096. Revision 1.49 1998/09/18 08:01:36 pierre
  1097. + improvement on the usebrowser part
  1098. (does not work correctly for now)
  1099. Revision 1.48 1998/09/09 15:33:07 peter
  1100. * fixed in_global to allow directives also after interface token
  1101. Revision 1.47 1998/09/09 11:50:55 pierre
  1102. * forward def are not put in record or objects
  1103. + added check for forwards also in record and objects
  1104. * dummy parasymtable for unit initialization removed from
  1105. symtable stack
  1106. Revision 1.46 1998/09/03 11:24:01 peter
  1107. * moved more inputfile things from tscannerfile to tinputfile
  1108. * changed ifdef Sourceline to cs_asm_source
  1109. Revision 1.45 1998/08/31 12:26:28 peter
  1110. * m68k and palmos updates from surebugfixes
  1111. Revision 1.44 1998/08/26 15:35:33 peter
  1112. * fixed scannerfiles for macros
  1113. + $I %<environment>%
  1114. Revision 1.43 1998/08/26 10:08:47 peter
  1115. * fixed problem with libprefix at the wrong place
  1116. * fixed lib generation with smartlinking and no -CS used
  1117. Revision 1.42 1998/08/19 18:04:54 peter
  1118. * fixed current_module^.in_implementation flag
  1119. Revision 1.41 1998/08/17 10:10:08 peter
  1120. - removed OLDPPU
  1121. Revision 1.40 1998/08/17 09:17:50 peter
  1122. * static/shared linking updates
  1123. Revision 1.39 1998/08/14 21:56:37 peter
  1124. * setting the outputfile using -o works now to create static libs
  1125. Revision 1.38 1998/08/10 14:50:13 peter
  1126. + localswitches, moduleswitches, globalswitches splitting
  1127. Revision 1.37 1998/08/10 10:18:31 peter
  1128. + Compiler,Comphook unit which are the new interface units to the
  1129. compiler
  1130. Revision 1.36 1998/07/14 14:46:54 peter
  1131. * released NEWINPUT
  1132. Revision 1.35 1998/07/08 12:39:38 peter
  1133. * heap_size for m68k
  1134. Revision 1.34 1998/07/07 11:20:03 peter
  1135. + NEWINPUT for a better inputfile and scanner object
  1136. Revision 1.33 1998/06/25 11:15:34 pierre
  1137. * ppu files where not closed in newppu !!
  1138. second compilation was impossible due to too many opened files
  1139. (not visible in 'make cycle' as we remove all the ppu files)
  1140. Revision 1.32 1998/06/25 08:48:16 florian
  1141. * first version of rtti support
  1142. Revision 1.31 1998/06/24 14:48:35 peter
  1143. * ifdef newppu -> ifndef oldppu
  1144. Revision 1.30 1998/06/17 14:10:16 peter
  1145. * small os2 fixes
  1146. * fixed interdependent units with newppu (remake3 under linux works now)
  1147. Revision 1.29 1998/06/16 08:56:25 peter
  1148. + targetcpu
  1149. * cleaner pmodules for newppu
  1150. Revision 1.28 1998/06/13 00:10:10 peter
  1151. * working browser and newppu
  1152. * some small fixes against crashes which occured in bp7 (but not in
  1153. fpc?!)
  1154. Revision 1.27 1998/06/11 13:58:08 peter
  1155. * small fix to let newppu compile
  1156. Revision 1.26 1998/06/09 16:01:47 pierre
  1157. + added procedure directive parsing for procvars
  1158. (accepted are popstack cdecl and pascal)
  1159. + added C vars with the following syntax
  1160. var C calias 'true_c_name';(can be followed by external)
  1161. reason is that you must add the Cprefix
  1162. which is target dependent
  1163. Revision 1.25 1998/06/08 22:59:49 peter
  1164. * smartlinking works for win32
  1165. * some defines to exclude some compiler parts
  1166. Revision 1.24 1998/06/08 13:13:44 pierre
  1167. + temporary variables now in temp_gen.pas unit
  1168. because it is processor independent
  1169. * mppc68k.bat modified to undefine i386 and support_mmx
  1170. (which are defaults for i386)
  1171. Revision 1.23 1998/06/05 17:47:29 peter
  1172. * some better uses clauses
  1173. Revision 1.22 1998/06/05 14:37:34 pierre
  1174. * fixes for inline for operators
  1175. * inline procedure more correctly restricted
  1176. Revision 1.21 1998/06/04 23:51:53 peter
  1177. * m68k compiles
  1178. + .def file creation moved to gendef.pas so it could also be used
  1179. for win32
  1180. Revision 1.20 1998/06/04 09:55:42 pierre
  1181. * demangled name of procsym reworked to become independant of the mangling scheme
  1182. Revision 1.19 1998/06/03 23:40:38 peter
  1183. + unlimited file support, release tempclose
  1184. Revision 1.18 1998/06/03 22:49:00 peter
  1185. + wordbool,longbool
  1186. * rename bis,von -> high,low
  1187. * moved some systemunit loading/creating to psystem.pas
  1188. Revision 1.17 1998/05/28 14:40:25 peter
  1189. * fixes for newppu, remake3 works now with it
  1190. Revision 1.16 1998/05/27 19:45:06 peter
  1191. * symtable.pas splitted into includefiles
  1192. * symtable adapted for $ifdef NEWPPU
  1193. Revision 1.15 1998/05/23 01:21:22 peter
  1194. + aktasmmode, aktoptprocessor, aktoutputformat
  1195. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1196. + $LIBNAME to set the library name where the unit will be put in
  1197. * splitted cgi386 a bit (codeseg to large for bp7)
  1198. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1199. Revision 1.14 1998/05/20 09:42:35 pierre
  1200. + UseTokenInfo now default
  1201. * unit in interface uses and implementation uses gives error now
  1202. * only one error for unknown symbol (uses lastsymknown boolean)
  1203. the problem came from the label code !
  1204. + first inlined procedures and function work
  1205. (warning there might be allowed cases were the result is still wrong !!)
  1206. * UseBrower updated gives a global list of all position of all used symbols
  1207. with switch -gb
  1208. Revision 1.13 1998/05/12 10:47:00 peter
  1209. * moved printstatus to verb_def
  1210. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1211. prefix like error: warning: and is included in V_Default
  1212. * fixed some messages
  1213. * first time parameter scan is only for -v and -T
  1214. - removed old style messages
  1215. Revision 1.12 1998/05/11 13:07:56 peter
  1216. + $ifdef NEWPPU for the new ppuformat
  1217. + $define GDB not longer required
  1218. * removed all warnings and stripped some log comments
  1219. * no findfirst/findnext anymore to remove smartlink *.o files
  1220. Revision 1.11 1998/05/06 18:36:53 peter
  1221. * tai_section extended with code,data,bss sections and enumerated type
  1222. * ident 'compiled by FPC' moved to pmodules
  1223. * small fix for smartlink
  1224. Revision 1.10 1998/05/04 17:54:28 peter
  1225. + smartlinking works (only case jumptable left todo)
  1226. * redesign of systems.pas to support assemblers and linkers
  1227. + Unitname is now also in the PPU-file, increased version to 14
  1228. Revision 1.9 1998/05/01 16:38:45 florian
  1229. * handling of private and protected fixed
  1230. + change_keywords_to_tp implemented to remove
  1231. keywords which aren't supported by tp
  1232. * break and continue are now symbols of the system unit
  1233. + widestring, longstring and ansistring type released
  1234. Revision 1.8 1998/04/30 15:59:41 pierre
  1235. * GDB works again better :
  1236. correct type info in one pass
  1237. + UseTokenInfo for better source position
  1238. * fixed one remaining bug in scanner for line counts
  1239. * several little fixes
  1240. Revision 1.7 1998/04/29 10:33:59 pierre
  1241. + added some code for ansistring (not complete nor working yet)
  1242. * corrected operator overloading
  1243. * corrected nasm output
  1244. + started inline procedures
  1245. + added starstarn : use ** for exponentiation (^ gave problems)
  1246. + started UseTokenInfo cond to get accurate positions
  1247. Revision 1.6 1998/04/27 23:10:28 peter
  1248. + new scanner
  1249. * $makelib -> if smartlink
  1250. * small filename fixes pmodule.setfilename
  1251. * moved import from files.pas -> import.pas
  1252. Revision 1.5 1998/04/14 23:27:03 florian
  1253. + exclude/include with constant second parameter added
  1254. Revision 1.4 1998/04/10 14:41:43 peter
  1255. * removed some Hints
  1256. * small speed optimization for AsmLn
  1257. Revision 1.3 1998/04/03 09:51:00 daniel
  1258. * Fixed heap allocation for OS/2.
  1259. }