pmodules.pas 49 KB

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