pmodules.pas 49 KB

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