pmodules.pas 50 KB

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