pmodules.pas 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933
  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 New_GDB}
  20. interface
  21. procedure proc_unit;
  22. procedure proc_program(islibrary : boolean);
  23. implementation
  24. uses
  25. globtype,version,systems,tokens,
  26. cobjects,comphook,globals,verbose,files,
  27. symconst,symtable,aasm,hcodegen,
  28. link,assemble,import,export,gendef,ppu,comprsrc,
  29. cresstr,cpubase,cpuasm,
  30. scanner,pbase,psystem,pdecl,psub,parser;
  31. procedure create_objectfile;
  32. begin
  33. { create the .s file and assemble it }
  34. GenerateAsm(false);
  35. { Also create a smartlinked version ? }
  36. if (cs_smartlink in aktmoduleswitches) then
  37. begin
  38. GenerateAsm(true);
  39. if target_asm.needar then
  40. Linker^.MakeStaticLibrary(SmartLinkFilesCnt);
  41. end;
  42. { resource files }
  43. CompileResourceFiles;
  44. end;
  45. procedure insertobjectfile;
  46. { Insert the used object file for this unit in the used list for this unit }
  47. begin
  48. current_module^.linkunitofiles.insert(current_module^.objfilename^,link_static);
  49. current_module^.flags:=current_module^.flags or uf_static_linked;
  50. if (cs_smartlink in aktmoduleswitches) then
  51. begin
  52. current_module^.linkunitstaticlibs.insert(current_module^.staticlibfilename^,link_smart);
  53. current_module^.flags:=current_module^.flags or uf_smart_linked;
  54. end;
  55. end;
  56. procedure insertsegment;
  57. procedure fixseg(p:paasmoutput;sec:tsection);
  58. begin
  59. p^.insert(new(pai_section,init(sec)));
  60. if (cs_smartlink in aktmoduleswitches) then
  61. p^.insert(new(pai_cut,init));
  62. p^.concat(new(pai_section,init(sec_none)));
  63. end;
  64. begin
  65. {Insert Ident of the compiler}
  66. if (not (cs_smartlink in aktmoduleswitches))
  67. {$ifndef EXTDEBUG}
  68. and (not current_module^.is_unit)
  69. {$endif}
  70. then
  71. begin
  72. datasegment^.insert(new(pai_align,init(4)));
  73. datasegment^.insert(new(pai_string,init('FPC '+full_version_string+
  74. ' for '+target_cpu_string+' - '+target_info.short_name)));
  75. end;
  76. { Insert start and end of sections }
  77. fixseg(codesegment,sec_code);
  78. fixseg(datasegment,sec_data);
  79. fixseg(bsssegment,sec_bss);
  80. { we should use .rdata section for these two no ? }
  81. { .rdata is a read only data section (PM) }
  82. fixseg(rttilist,sec_data);
  83. fixseg(consts,sec_data);
  84. if assigned(resourcestringlist) then
  85. fixseg(resourcestringlist,sec_data);
  86. {$ifdef GDB}
  87. if assigned(debuglist) then
  88. fixseg(debuglist,sec_code);
  89. {$endif GDB}
  90. end;
  91. procedure InsertInitFinalTable;
  92. var
  93. hp : pused_unit;
  94. unitinits : taasmoutput;
  95. count : longint;
  96. begin
  97. unitinits.init;
  98. count:=0;
  99. hp:=pused_unit(usedunits.first);
  100. while assigned(hp) do
  101. begin
  102. { call the unit init code and make it external }
  103. if (hp^.u^.flags and (uf_init or uf_finalize))<>0 then
  104. begin
  105. if (hp^.u^.flags and uf_init)<>0 then
  106. begin
  107. unitinits.concat(new(pai_const_symbol,initname('INIT$$'+hp^.u^.modulename^)));
  108. end
  109. else
  110. unitinits.concat(new(pai_const,init_32bit(0)));
  111. if (hp^.u^.flags and uf_finalize)<>0 then
  112. begin
  113. unitinits.concat(new(pai_const_symbol,initname('FINALIZE$$'+hp^.u^.modulename^)));
  114. end
  115. else
  116. unitinits.concat(new(pai_const,init_32bit(0)));
  117. inc(count);
  118. end;
  119. hp:=Pused_unit(hp^.next);
  120. end;
  121. { TableCount,InitCount }
  122. unitinits.insert(new(pai_const,init_32bit(0)));
  123. unitinits.insert(new(pai_const,init_32bit(count)));
  124. unitinits.insert(new(pai_symbol,initname_global('INITFINAL',0)));
  125. unitinits.concat(new(pai_symbol_end,initname('INITFINAL')));
  126. { insert in data segment }
  127. if (cs_smartlink in aktmoduleswitches) then
  128. datasegment^.concat(new(pai_cut,init));
  129. datasegment^.concatlist(@unitinits);
  130. unitinits.done;
  131. end;
  132. procedure insertheap;
  133. begin
  134. if (cs_smartlink in aktmoduleswitches) then
  135. begin
  136. bsssegment^.concat(new(pai_cut,init));
  137. datasegment^.concat(new(pai_cut,init));
  138. end;
  139. { On the Macintosh Classic M68k Architecture
  140. The Heap variable is simply a POINTER to the
  141. real HEAP. The HEAP must be set up by the RTL
  142. and must store the pointer in this value.
  143. On OS/2 the heap is also intialized by the RTL. We do
  144. not output a pointer }
  145. case target_info.target of
  146. {$ifdef i386}
  147. target_i386_OS2:
  148. ;
  149. {$endif i386}
  150. {$ifdef alpha}
  151. target_alpha_linux:
  152. ;
  153. {$endif alpha}
  154. {$ifdef powerpc}
  155. target_powerpc_linux:
  156. ;
  157. {$endif powerpc}
  158. {$ifdef m68k}
  159. target_m68k_Mac:
  160. bsssegment^.concat(new(pai_datablock,init_global('HEAP',4)));
  161. target_m68k_PalmOS:
  162. ;
  163. {$endif m68k}
  164. else
  165. bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize)));
  166. end;
  167. {$ifdef m68k}
  168. if target_info.target<>target_m68k_PalmOS then
  169. begin
  170. datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
  171. datasegment^.concat(new(pai_const,init_32bit(heapsize)));
  172. end;
  173. {$else m68k}
  174. datasegment^.concat(new(pai_symbol,initname_global('HEAPSIZE',4)));
  175. datasegment^.concat(new(pai_const,init_32bit(heapsize)));
  176. {$endif m68k}
  177. end;
  178. procedure inserttargetspecific;
  179. begin
  180. case target_info.target of
  181. {$ifdef alpha}
  182. target_alpha_linux:
  183. ;
  184. {$endif alpha}
  185. {$ifdef powerpc}
  186. target_powerpc_linux:
  187. ;
  188. {$endif powerpc}
  189. {$ifdef i386}
  190. target_i386_GO32V2 :
  191. begin
  192. { stacksize can be specified }
  193. datasegment^.concat(new(pai_symbol,initname_global('__stklen',4)));
  194. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  195. end;
  196. target_i386_WIN32 :
  197. begin
  198. target_link.bindcmd[1]:=target_link.bindcmd[1]+' -d '+deffile.fname;
  199. if DLLsource then
  200. begin
  201. target_link.binders:=2;
  202. target_link.linkcmd:='--dll '+target_link.linkcmd;
  203. target_link.bindcmd[2]:='--dll '+target_link.bindcmd[2];
  204. if RelocSection then
  205. begin
  206. target_link.linkcmd:=target_link.linkcmd+' --base-file base.$$$';
  207. target_link.bindcmd[1]:=target_link.bindcmd[1]+' --base-file base.$$$';
  208. end;
  209. end;
  210. if apptype=at_gui then
  211. begin
  212. target_link.linkcmd:='--subsystem windows '+target_link.linkcmd;
  213. target_link.bindcmd[2]:='--subsystem windows '+target_link.bindcmd[2];
  214. end;
  215. end;
  216. {$endif i386}
  217. {$ifdef m68k}
  218. target_m68k_Atari :
  219. begin
  220. { stacksize can be specified }
  221. datasegment^.concat(new(pai_symbol,init_global('__stklen',4)));
  222. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  223. end;
  224. {$endif m68k}
  225. end;
  226. end;
  227. function loadunit(const s : string;compile_system:boolean) : pmodule;forward;
  228. procedure load_usedunits(compile_system:boolean);
  229. var
  230. pu : pused_unit;
  231. loaded_unit : pmodule;
  232. load_refs : boolean;
  233. nextmapentry : longint;
  234. begin
  235. load_refs:=true;
  236. { init the map }
  237. new(current_module^.map);
  238. fillchar(current_module^.map^,sizeof(tunitmap),#0);
  239. {$ifdef NEWMAP}
  240. current_module^.map^[0]:=current_module;
  241. {$endif NEWMAP}
  242. nextmapentry:=1;
  243. { load the used units from interface }
  244. current_module^.in_implementation:=false;
  245. pu:=pused_unit(current_module^.used_units.first);
  246. while assigned(pu) do
  247. begin
  248. if (not pu^.loaded) and (pu^.in_interface) then
  249. begin
  250. loaded_unit:=loadunit(pu^.name^,false);
  251. if current_module^.compiled then
  252. exit;
  253. { register unit in used units }
  254. pu^.u:=loaded_unit;
  255. pu^.loaded:=true;
  256. { doubles are not important for that list PM }
  257. pu^.u^.dependent_units.concat(new(pdependent_unit,init(current_module)));
  258. { need to recompile the current unit ? }
  259. if loaded_unit^.crc<>pu^.checksum then
  260. begin
  261. Message2(unit_u_recompile_crc_change,current_module^.modulename^,pu^.name^);
  262. current_module^.recompile_reason:=rr_crcchanged;
  263. current_module^.do_compile:=true;
  264. dispose(current_module^.map);
  265. current_module^.map:=nil;
  266. exit;
  267. end;
  268. { setup the map entry for deref }
  269. {$ifndef NEWMAP}
  270. current_module^.map^[nextmapentry]:=loaded_unit^.globalsymtable;
  271. {$else NEWMAP}
  272. current_module^.map^[nextmapentry]:=loaded_unit;
  273. {$endif NEWMAP}
  274. inc(nextmapentry);
  275. if nextmapentry>maxunits then
  276. Message(unit_f_too_much_units);
  277. end;
  278. pu:=pused_unit(pu^.next);
  279. end;
  280. { ok, now load the unit }
  281. current_module^.globalsymtable:=new(punitsymtable,loadasunit);
  282. { now only read the implementation part }
  283. current_module^.in_implementation:=true;
  284. { load the used units from implementation }
  285. pu:=pused_unit(current_module^.used_units.first);
  286. while assigned(pu) do
  287. begin
  288. if (not pu^.loaded) and (not pu^.in_interface) then
  289. begin
  290. loaded_unit:=loadunit(pu^.name^,false);
  291. if current_module^.compiled then
  292. exit;
  293. { register unit in used units }
  294. pu^.u:=loaded_unit;
  295. pu^.loaded:=true;
  296. { need to recompile the current unit ? }
  297. if (loaded_unit^.interface_crc<>pu^.interface_checksum) and
  298. not(current_module^.in_second_compile) then
  299. begin
  300. Message2(unit_u_recompile_crc_change,current_module^.modulename^,pu^.name^+' {impl}');
  301. current_module^.recompile_reason:=rr_crcchanged;
  302. current_module^.do_compile:=true;
  303. dispose(current_module^.map);
  304. current_module^.map:=nil;
  305. exit;
  306. end;
  307. { setup the map entry for deref }
  308. {$ifndef NEWMAP}
  309. current_module^.map^[nextmapentry]:=loaded_unit^.globalsymtable;
  310. {$else NEWMAP}
  311. current_module^.map^[nextmapentry]:=loaded_unit;
  312. {$endif NEWMAP}
  313. inc(nextmapentry);
  314. if nextmapentry>maxunits then
  315. Message(unit_f_too_much_units);
  316. end;
  317. pu:=pused_unit(pu^.next);
  318. end;
  319. { load browser info if stored }
  320. if ((current_module^.flags and uf_has_browser)<>0) and load_refs then
  321. punitsymtable(current_module^.globalsymtable)^.load_symtable_refs;
  322. { remove the map, it's not needed anymore }
  323. dispose(current_module^.map);
  324. current_module^.map:=nil;
  325. end;
  326. function loadunit(const s : string;compile_system:boolean) : pmodule;
  327. const
  328. ImplIntf : array[boolean] of string[15]=('interface','implementation');
  329. var
  330. st : punitsymtable;
  331. second_time : boolean;
  332. old_current_ppu : pppufile;
  333. old_current_module,hp,hp2 : pmodule;
  334. name : string;{ necessary because current_module^.mainsource^ is reset in compile !! }
  335. scanner : pscannerfile;
  336. procedure loadppufile;
  337. begin
  338. { load interface section }
  339. if not current_module^.do_compile then
  340. load_interface;
  341. { only load units when we don't recompile }
  342. if not current_module^.do_compile then
  343. load_usedunits(compile_system);
  344. { recompile if set }
  345. if current_module^.do_compile then
  346. begin
  347. { we don't need the ppufile anymore }
  348. if assigned(current_module^.ppufile) then
  349. begin
  350. dispose(current_module^.ppufile,done);
  351. current_module^.ppufile:=nil;
  352. current_ppu:=nil;
  353. end;
  354. { recompile the unit or give a fatal error if sources not available }
  355. if not(current_module^.sources_avail) then
  356. if (not current_module^.search_unit(current_module^.modulename^,true))
  357. and (length(current_module^.modulename^)>8) then
  358. current_module^.search_unit(copy(current_module^.modulename^,1,8),true);
  359. if not(current_module^.sources_avail) then
  360. begin
  361. if current_module^.recompile_reason=rr_noppu then
  362. Message1(unit_f_cant_find_ppu,current_module^.modulename^)
  363. else
  364. Message1(unit_f_cant_compile_unit,current_module^.modulename^);
  365. end
  366. else
  367. begin
  368. if current_module^.in_second_compile then
  369. Message1(parser_d_compiling_second_time,current_module^.modulename^);
  370. current_scanner^.tempcloseinputfile;
  371. name:=current_module^.mainsource^;
  372. if assigned(scanner) then
  373. scanner^.invalid:=true;
  374. compile(name,compile_system);
  375. if (not current_scanner^.invalid) then
  376. current_scanner^.tempopeninputfile;
  377. end;
  378. end
  379. else
  380. begin
  381. { only reassemble ? }
  382. if (current_module^.do_assemble) then
  383. OnlyAsm;
  384. end;
  385. if assigned(current_module^.ppufile) then
  386. begin
  387. dispose(current_module^.ppufile,done);
  388. current_module^.ppufile:=nil;
  389. current_ppu:=nil;
  390. end;
  391. end;
  392. var
  393. dummy : pmodule;
  394. begin
  395. old_current_module:=current_module;
  396. old_current_ppu:=current_ppu;
  397. { Info }
  398. Message3(unit_u_load_unit,current_module^.modulename^,ImplIntf[current_module^.in_implementation],s);
  399. { unit not found }
  400. st:=nil;
  401. { search all loaded units }
  402. hp:=pmodule(loaded_units.first);
  403. while assigned(hp) do
  404. begin
  405. if hp^.modulename^=s then
  406. begin
  407. { forced to reload ? }
  408. if hp^.do_reload then
  409. begin
  410. hp^.do_reload:=false;
  411. break;
  412. end;
  413. { the unit is already registered }
  414. { and this means that the unit }
  415. { is already compiled }
  416. { else there is a cyclic unit use }
  417. if assigned(hp^.globalsymtable) then
  418. st:=punitsymtable(hp^.globalsymtable)
  419. else
  420. begin
  421. { both units in interface ? }
  422. if (not current_module^.in_implementation) and (not hp^.in_implementation) then
  423. begin
  424. { check for a cycle }
  425. hp2:=current_module^.loaded_from;
  426. while assigned(hp2) and (hp2<>hp) do
  427. begin
  428. if hp2^.in_implementation then
  429. hp2:=nil
  430. else
  431. hp2:=hp2^.loaded_from;
  432. end;
  433. if assigned(hp2) then
  434. Message2(unit_f_circular_unit_reference,current_module^.modulename^,hp^.modulename^);
  435. end;
  436. end;
  437. break;
  438. end;
  439. { the next unit }
  440. hp:=pmodule(hp^.next);
  441. end;
  442. { the unit is not in the symtable stack }
  443. if (not assigned(st)) then
  444. begin
  445. if assigned(hp) then
  446. begin
  447. { remove the old unit }
  448. loaded_units.remove(hp);
  449. scanner:=hp^.scanner;
  450. hp^.reset;
  451. hp^.scanner:=scanner;
  452. { try to reopen ppu }
  453. hp^.search_unit(s,false);
  454. { try to load the unit a second time first }
  455. current_module:=hp;
  456. current_module^.in_second_compile:=true;
  457. Message1(unit_u_second_load_unit,current_module^.modulename^);
  458. second_time:=true;
  459. end
  460. else
  461. { generates a new unit info record }
  462. begin
  463. current_module:=new(pmodule,init(s,true));
  464. scanner:=nil;
  465. second_time:=false;
  466. end;
  467. current_ppu:=current_module^.ppufile;
  468. { now we can register the unit }
  469. current_module^.loaded_from:=old_current_module;
  470. loaded_units.insert(current_module);
  471. { now realy load the ppu }
  472. loadppufile;
  473. { set compiled flag }
  474. current_module^.compiled:=true;
  475. { load return pointer }
  476. hp:=current_module;
  477. { for a second_time recompile reload all dependent units,
  478. for a first time compile register the unit _once_ }
  479. if second_time then
  480. begin
  481. { now reload all dependent units }
  482. hp2:=pmodule(loaded_units.first);
  483. while assigned(hp2) do
  484. begin
  485. if hp2^.do_reload then
  486. dummy:=loadunit(hp2^.modulename^,false);
  487. hp2:=pmodule(hp2^.next);
  488. end;
  489. end
  490. else
  491. usedunits.concat(new(pused_unit,init(current_module,true)));
  492. end;
  493. { set the old module }
  494. current_ppu:=old_current_ppu;
  495. current_module:=old_current_module;
  496. loadunit:=hp;
  497. end;
  498. procedure loaddefaultunits;
  499. var
  500. hp : pmodule;
  501. begin
  502. { are we compiling the system unit? }
  503. if (cs_compilesystem in aktmoduleswitches) then
  504. begin
  505. { create system defines }
  506. createconstdefs;
  507. { we don't need to reset anything, it's already done in parser.pas }
  508. exit;
  509. end;
  510. { insert the system unit, it is allways the first }
  511. hp:=loadunit(upper(target_info.system_unit),true);
  512. systemunit:=hp^.globalsymtable;
  513. { it's always the first unit }
  514. systemunit^.next:=nil;
  515. symtablestack:=systemunit;
  516. { add to the used units }
  517. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  518. refsymtable^.insert(new(punitsym,init('SYSTEM',systemunit)));
  519. { read default constant definitions }
  520. make_ref:=false;
  521. readconstdefs;
  522. make_ref:=true;
  523. { if POWER is defined in the RTL then use it for starstar overloading }
  524. getsym('POWER',false);
  525. if assigned(srsym) and (srsym^.typ=procsym) and (overloaded_operators[_STARSTAR]=nil) then
  526. overloaded_operators[_STARSTAR]:=pprocsym(srsym);
  527. { Objpas unit? }
  528. if m_objpas in aktmodeswitches then
  529. begin
  530. hp:=loadunit('OBJPAS',false);
  531. objpasunit:=hp^.globalsymtable;
  532. { insert in stack }
  533. objpasunit^.next:=symtablestack;
  534. symtablestack:=objpasunit;
  535. { add to the used units }
  536. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  537. refsymtable^.insert(new(punitsym,init('OBJPAS',objpasunit)));
  538. end
  539. else
  540. objpasunit:=nil;
  541. { Profile unit? Needed for go32v2 only }
  542. if (cs_profile in aktmoduleswitches) and (target_info.target=target_i386_go32v2) then
  543. begin
  544. hp:=loadunit('PROFILE',false);
  545. psymtable(hp^.globalsymtable)^.next:=symtablestack;
  546. symtablestack:=hp^.globalsymtable;
  547. { add to the used units }
  548. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  549. refsymtable^.insert(new(punitsym,init('PROFILE',hp^.globalsymtable)));
  550. end;
  551. { Heaptrc unit? (not needed for units), this is here to be sure that it is really
  552. loaded as first unit }
  553. if (cs_gdb_heaptrc in aktglobalswitches) and not(current_module^.is_unit)then
  554. begin
  555. hp:=loadunit('HEAPTRC',false);
  556. psymtable(hp^.globalsymtable)^.next:=symtablestack;
  557. symtablestack:=hp^.globalsymtable;
  558. { add to the used units }
  559. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  560. refsymtable^.insert(new(punitsym,init('HEAPTRC',hp^.globalsymtable)));
  561. end;
  562. { save default symtablestack }
  563. defaultsymtablestack:=symtablestack;
  564. end;
  565. procedure loadunits;
  566. var
  567. s : stringid;
  568. pu,
  569. hp : pused_unit;
  570. hp2 : pmodule;
  571. hp3 : psymtable;
  572. oldprocsym:Pprocsym;
  573. begin
  574. oldprocsym:=aktprocsym;
  575. consume(_USES);
  576. {$ifdef DEBUG}
  577. test_symtablestack;
  578. {$endif DEBUG}
  579. repeat
  580. s:=pattern;
  581. consume(_ID);
  582. { Give a warning if objpas is loaded }
  583. if s='OBJPAS' then
  584. Message(parser_w_no_objpas_use_mode);
  585. { check if the unit is already used }
  586. pu:=pused_unit(current_module^.used_units.first);
  587. while assigned(pu) do
  588. begin
  589. if (pu^.name^=s) then
  590. break;
  591. pu:=pused_unit(pu^.next);
  592. end;
  593. { avoid uses of itself }
  594. if not assigned(pu) and (s<>current_module^.modulename^) then
  595. begin
  596. { load the unit }
  597. hp2:=loadunit(s,false);
  598. { the current module uses the unit hp2 }
  599. current_module^.used_units.concat(new(pused_unit,init(hp2,not current_module^.in_implementation)));
  600. pused_unit(current_module^.used_units.last)^.in_uses:=true;
  601. if current_module^.compiled then
  602. exit;
  603. refsymtable^.insert(new(punitsym,init(s,hp2^.globalsymtable)));
  604. end
  605. else
  606. Message1(sym_e_duplicate_id,s);
  607. if token=_COMMA then
  608. begin
  609. pattern:='';
  610. consume(_COMMA);
  611. end
  612. else
  613. break;
  614. until false;
  615. consume(_SEMICOLON);
  616. { set the symtable to systemunit so it gets reorderd correctly }
  617. symtablestack:=defaultsymtablestack;
  618. { now insert the units in the symtablestack }
  619. hp:=pused_unit(current_module^.used_units.first);
  620. while assigned(hp) do
  621. begin
  622. {$IfDef GDB}
  623. {$IfnDef New_GDB}
  624. if (cs_debuginfo in aktmoduleswitches) and
  625. not hp^.is_stab_written then
  626. begin
  627. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  628. hp^.is_stab_written:=true;
  629. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  630. end;
  631. {$endIf nDef New_GDB}
  632. {$EndIf GDB}
  633. if hp^.in_uses then
  634. begin
  635. hp3:=symtablestack;
  636. while assigned(hp3) do
  637. begin
  638. { insert units only once ! }
  639. if hp^.u^.globalsymtable=hp3 then
  640. break;
  641. hp3:=hp3^.next;
  642. { unit isn't inserted }
  643. if hp3=nil then
  644. begin
  645. psymtable(hp^.u^.globalsymtable)^.next:=symtablestack;
  646. symtablestack:=psymtable(hp^.u^.globalsymtable);
  647. {$ifdef CHAINPROCSYMS}
  648. symtablestack^.chainprocsyms;
  649. {$endif CHAINPROCSYMS}
  650. {$ifdef DEBUG}
  651. test_symtablestack;
  652. {$endif DEBUG}
  653. end;
  654. end;
  655. end;
  656. hp:=pused_unit(hp^.next);
  657. end;
  658. aktprocsym:=oldprocsym;
  659. end;
  660. procedure write_gdb_info;
  661. {$IfDef GDB}
  662. var
  663. hp : pused_unit;
  664. begin
  665. if not (cs_debuginfo in aktmoduleswitches) then
  666. exit;
  667. { now insert the units in the symtablestack }
  668. hp:=pused_unit(current_module^.used_units.first);
  669. while assigned(hp) do
  670. begin
  671. if (cs_debuginfo in aktmoduleswitches) and
  672. not hp^.is_stab_written then
  673. begin
  674. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  675. hp^.is_stab_written:=true;
  676. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  677. end;
  678. hp:=pused_unit(hp^.next);
  679. end;
  680. if current_module^.in_implementation then
  681. begin
  682. if assigned(current_module^.localsymtable) then
  683. begin
  684. { all types }
  685. punitsymtable(current_module^.localsymtable)^.concattypestabto(debuglist);
  686. { and all local symbols}
  687. punitsymtable(current_module^.localsymtable)^.concatstabto(debuglist);
  688. end;
  689. end
  690. else
  691. begin
  692. if assigned(current_module^.globalsymtable) then
  693. begin
  694. { all types }
  695. punitsymtable(current_module^.globalsymtable)^.concattypestabto(debuglist);
  696. { and all local symbols}
  697. punitsymtable(current_module^.globalsymtable)^.concatstabto(debuglist);
  698. end;
  699. end;
  700. end;
  701. {$Else GDB}
  702. begin
  703. end;
  704. {$EndIf GDB}
  705. procedure parse_implementation_uses(symt:Psymtable);
  706. begin
  707. if token=_USES then
  708. begin
  709. symt^.symtabletype:=unitsymtable;
  710. loadunits;
  711. symt^.symtabletype:=globalsymtable;
  712. {$ifdef DEBUG}
  713. test_symtablestack;
  714. {$endif DEBUG}
  715. end;
  716. end;
  717. procedure gen_main_procsym(const name:string;options:tproctypeoption;st:psymtable);
  718. var
  719. stt : psymtable;
  720. begin
  721. {Generate a procsym for main}
  722. make_ref:=false;
  723. aktprocsym:=new(Pprocsym,init(name));
  724. {Try to insert in in static symtable ! }
  725. stt:=symtablestack;
  726. symtablestack:=st;
  727. aktprocsym^.definition:=new(Pprocdef,init);
  728. symtablestack:=stt;
  729. aktprocsym^.definition^.proctypeoption:=options;
  730. aktprocsym^.definition^.setmangledname(target_os.cprefix+name);
  731. aktprocsym^.definition^.forwarddef:=false;
  732. make_ref:=true;
  733. { The localst is a local symtable. Change it into the static
  734. symtable }
  735. dispose(aktprocsym^.definition^.localst,done);
  736. aktprocsym^.definition^.localst:=st;
  737. { and insert the procsym in symtable }
  738. st^.insert(aktprocsym);
  739. { set some informations about the main program }
  740. with procinfo do
  741. begin
  742. retdef:=voiddef;
  743. _class:=nil;
  744. call_offset:=8;
  745. framepointer:=frame_pointer;
  746. flags:=0;
  747. end;
  748. end;
  749. procedure proc_unit;
  750. function is_assembler_generated:boolean;
  751. begin
  752. is_assembler_generated:=(Errorcount=0) and
  753. not(
  754. codesegment^.empty and
  755. datasegment^.empty and
  756. bsssegment^.empty and
  757. ((importssection=nil) or importssection^.empty) and
  758. ((resourcesection=nil) or resourcesection^.empty) and
  759. ((resourcestringlist=nil) or resourcestringlist^.empty)
  760. );
  761. end;
  762. var
  763. names : Tstringcontainer;
  764. st : psymtable;
  765. unitst : punitsymtable;
  766. {$ifdef GDB}
  767. pu : pused_unit;
  768. {$endif GDB}
  769. {$ifdef Test_Double_checksum}
  770. store_crc : longint;
  771. {$endif}
  772. s1,s2 : ^string; {Saves stack space}
  773. begin
  774. consume(_UNIT);
  775. if token=_ID then
  776. begin
  777. { create filenames and unit name }
  778. current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^,true);
  779. stringdispose(current_module^.modulename);
  780. current_module^.modulename:=stringdup(upper(pattern));
  781. { check for system unit }
  782. new(s1);
  783. new(s2);
  784. s1^:=upper(target_info.system_unit);
  785. s2^:=upper(SplitName(current_scanner^.inputfile^.name^));
  786. if (cs_compilesystem in aktmoduleswitches) then
  787. begin
  788. if ((length(current_module^.modulename^)>8) or
  789. (current_module^.modulename^<>s1^) or
  790. (current_module^.modulename^<>s2^)) then
  791. Message1(unit_e_illegal_unit_name,current_module^.modulename^);
  792. end
  793. else
  794. begin
  795. if (cs_check_unit_name in aktglobalswitches) and
  796. not((current_module^.modulename^=s2^) or
  797. ((length(current_module^.modulename^)>8) and
  798. (copy(current_module^.modulename^,1,8)=s2^))) then
  799. Message1(unit_e_illegal_unit_name,current_module^.modulename^);
  800. if (current_module^.modulename^=s1^) then
  801. Message(unit_w_switch_us_missed);
  802. end;
  803. dispose(s2);
  804. dispose(s1);
  805. end;
  806. consume(_ID);
  807. consume(_SEMICOLON);
  808. consume(_INTERFACE);
  809. { global switches are read, so further changes aren't allowed }
  810. current_module^.in_global:=false;
  811. { can't have local browser when no global browser }
  812. if (cs_local_browser in aktmoduleswitches) and
  813. not(cs_browser in aktmoduleswitches) then
  814. aktmoduleswitches:=aktmoduleswitches-[cs_local_browser];
  815. Message1(unit_u_start_parse_interface,current_module^.modulename^);
  816. { update status }
  817. status.currentmodule:=current_module^.modulename^;
  818. { maybe turn off m_objpas if we are compiling objpas }
  819. if (current_module^.modulename^='OBJPAS') then
  820. aktmodeswitches:=aktmodeswitches-[m_objpas];
  821. { this should be placed after uses !!}
  822. {$ifndef UseNiceNames}
  823. procprefix:='_'+current_module^.modulename^+'$$';
  824. {$else UseNiceNames}
  825. procprefix:='_'+tostr(length(current_module^.modulename^))+lowercase(current_module^.modulename^)+'_';
  826. {$endif UseNiceNames}
  827. parse_only:=true;
  828. { generate now the global symboltable }
  829. st:=new(punitsymtable,init(globalsymtable,current_module^.modulename^));
  830. refsymtable:=st;
  831. unitst:=punitsymtable(st);
  832. { define first as local to overcome dependency conflicts }
  833. current_module^.localsymtable:=st;
  834. { the unit name must be usable as a unit specifier }
  835. { inside the unit itself (PM) }
  836. { this also forbids to have another symbol }
  837. { with the same name as the unit }
  838. refsymtable^.insert(new(punitsym,init(current_module^.modulename^,unitst)));
  839. { a unit compiled at command line must be inside the loaded_unit list }
  840. if (compile_level=1) then
  841. loaded_units.insert(current_module);
  842. { load default units, like the system unit }
  843. loaddefaultunits;
  844. { reset }
  845. make_ref:=true;
  846. lexlevel:=0;
  847. { insert qualifier for the system unit (allows system.writeln) }
  848. if not(cs_compilesystem in aktmoduleswitches) then
  849. begin
  850. if token=_USES then
  851. begin
  852. unitst^.symtabletype:=unitsymtable;
  853. loadunits;
  854. { has it been compiled at a higher level ?}
  855. if current_module^.compiled then
  856. begin
  857. { this unit symtable is obsolete }
  858. { dispose(unitst,done);
  859. disposed as localsymtable !! }
  860. exit;
  861. end;
  862. unitst^.symtabletype:=globalsymtable;
  863. end;
  864. { ... but insert the symbol table later }
  865. st^.next:=symtablestack;
  866. symtablestack:=st;
  867. end
  868. else
  869. { while compiling a system unit, some types are directly inserted }
  870. begin
  871. st^.next:=symtablestack;
  872. symtablestack:=st;
  873. insert_intern_types(st);
  874. end;
  875. { now we know the place to insert the constants }
  876. constsymtable:=symtablestack;
  877. { move the global symtab from the temporary local to global }
  878. current_module^.globalsymtable:=current_module^.localsymtable;
  879. current_module^.localsymtable:=nil;
  880. reset_global_defs;
  881. { number all units, so we know if a unit is used by this unit or
  882. needs to be added implicitly }
  883. numberunits;
  884. { ... parse the declarations }
  885. read_interface_declarations;
  886. { leave when we got an error }
  887. if (Errorcount>0) and not status.skip_error then
  888. begin
  889. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  890. status.skip_error:=true;
  891. exit;
  892. end;
  893. {$ifdef New_GDB}
  894. write_gdb_info;
  895. {$endIf Def New_GDB}
  896. {$ifdef Test_Double_checksum}
  897. if (Errorcount=0) then
  898. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack),true);
  899. {$endif Test_Double_checksum}
  900. { Parse the implementation section }
  901. consume(_IMPLEMENTATION);
  902. current_module^.in_implementation:=true;
  903. Message1(unit_u_start_parse_implementation,current_module^.modulename^);
  904. parse_only:=false;
  905. { generates static symbol table }
  906. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  907. current_module^.localsymtable:=st;
  908. { remove the globalsymtable from the symtable stack }
  909. { to reinsert it after loading the implementation units }
  910. symtablestack:=unitst^.next;
  911. { we don't want implementation units symbols in unitsymtable !! PM }
  912. refsymtable:=st;
  913. { Read the implementation units }
  914. parse_implementation_uses(unitst);
  915. if current_module^.compiled then
  916. begin
  917. exit;
  918. end;
  919. { reset ranges/stabs in exported definitions }
  920. reset_global_defs;
  921. { All units are read, now give them a number }
  922. numberunits;
  923. { now we can change refsymtable }
  924. refsymtable:=st;
  925. { but reinsert the global symtable as lasts }
  926. unitst^.next:=symtablestack;
  927. symtablestack:=unitst;
  928. {$ifdef DEBUG}
  929. test_symtablestack;
  930. {$endif DEBUG}
  931. constsymtable:=symtablestack;
  932. {$ifdef Splitheap}
  933. if testsplit then
  934. begin
  935. Split_Heap;
  936. allow_special:=true;
  937. Switch_to_temp_heap;
  938. end;
  939. { it will report all crossings }
  940. allow_special:=false;
  941. {$endif Splitheap}
  942. { Generate a procsym }
  943. gen_main_procsym(current_module^.modulename^+'_init',potype_unitinit,st);
  944. { Compile the unit }
  945. codegen_newprocedure;
  946. names.init;
  947. names.insert('INIT$$'+current_module^.modulename^);
  948. names.insert(target_os.cprefix+current_module^.modulename^+'_init');
  949. compile_proc_body(names,true,false);
  950. names.done;
  951. codegen_doneprocedure;
  952. { avoid self recursive destructor call !! PM }
  953. aktprocsym^.definition^.localst:=nil;
  954. { finalize? }
  955. if token=_FINALIZATION then
  956. begin
  957. { set module options }
  958. current_module^.flags:=current_module^.flags or uf_finalize;
  959. { Generate a procsym }
  960. gen_main_procsym(current_module^.modulename^+'_finalize',potype_unitfinalize,st);
  961. { Compile the finalize }
  962. codegen_newprocedure;
  963. names.init;
  964. names.insert('FINALIZE$$'+current_module^.modulename^);
  965. names.insert(target_os.cprefix+current_module^.modulename^+'_finalize');
  966. compile_proc_body(names,true,false);
  967. names.done;
  968. codegen_doneprocedure;
  969. end;
  970. { the last char should always be a point }
  971. consume(_POINT);
  972. { avoid self recursive destructor call !! PM }
  973. aktprocsym^.definition^.localst:=nil;
  974. { absence does not matter here !! }
  975. aktprocsym^.definition^.forwarddef:=false;
  976. { test static symtable }
  977. if (Errorcount=0) then
  978. st^.allsymbolsused;
  979. { size of the static data }
  980. datasize:=st^.datasize;
  981. {$ifdef GDB}
  982. { add all used definitions even for implementation}
  983. if (cs_debuginfo in aktmoduleswitches) then
  984. begin
  985. {$IfnDef New_GDB}
  986. if assigned(current_module^.globalsymtable) then
  987. begin
  988. { all types }
  989. punitsymtable(current_module^.globalsymtable)^.concattypestabto(debuglist);
  990. { and all local symbols}
  991. punitsymtable(current_module^.globalsymtable)^.concatstabto(debuglist);
  992. end;
  993. { all local types }
  994. punitsymtable(st)^.concattypestabto(debuglist);
  995. { and all local symbols}
  996. st^.concatstabto(debuglist);
  997. {$else New_GDB}
  998. write_gdb_info;
  999. {$endIf Def New_GDB}
  1000. end;
  1001. {$endif GDB}
  1002. reset_global_defs;
  1003. { tests, if all (interface) forwards are resolved }
  1004. if (Errorcount=0) then
  1005. symtablestack^.check_forwards;
  1006. { now we have a correct unit, change the symtable type }
  1007. current_module^.in_implementation:=false;
  1008. symtablestack^.symtabletype:=unitsymtable;
  1009. {$ifdef GDB}
  1010. punitsymtable(symtablestack)^.is_stab_written:=false;
  1011. {$endif GDB}
  1012. { leave when we got an error }
  1013. if (Errorcount>0) and not status.skip_error then
  1014. begin
  1015. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1016. status.skip_error:=true;
  1017. exit;
  1018. end;
  1019. { generate imports }
  1020. if current_module^.uses_imports then
  1021. importlib^.generatelib;
  1022. { insert own objectfile, or say that it's in a library
  1023. (no check for an .o when loading) }
  1024. if is_assembler_generated then
  1025. insertobjectfile
  1026. else
  1027. current_module^.flags:=current_module^.flags or uf_no_link;
  1028. if cs_local_browser in aktmoduleswitches then
  1029. current_module^.localsymtable:=refsymtable;
  1030. { Write out the ppufile }
  1031. {$ifdef Test_Double_checksum}
  1032. store_crc:=current_module^.interface_crc;
  1033. {$endif Test_Double_checksum}
  1034. if (Errorcount=0) then
  1035. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack),false);
  1036. {$ifdef Test_Double_checksum}
  1037. if store_crc<>current_module^.interface_crc then
  1038. Def_comment(V_Warning,current_module^.ppufilename^+' CRC changed '+
  1039. tostr(store_crc)+'<>'+tostr(current_module^.interface_crc));
  1040. {$endif def Test_Double_checksum}
  1041. { must be done only after local symtable ref stores !! }
  1042. closecurrentppu;
  1043. {$ifdef GDB}
  1044. pu:=pused_unit(usedunits.first);
  1045. while assigned(pu) do
  1046. begin
  1047. if assigned(pu^.u^.globalsymtable) then
  1048. punitsymtable(pu^.u^.globalsymtable)^.is_stab_written:=false;
  1049. pu:=pused_unit(pu^.next);
  1050. end;
  1051. {$endif GDB}
  1052. { remove static symtable (=refsymtable) here to save some mem }
  1053. if not (cs_local_browser in aktmoduleswitches) then
  1054. begin
  1055. dispose(st,done);
  1056. current_module^.localsymtable:=nil;
  1057. end;
  1058. if is_assembler_generated then
  1059. begin
  1060. { finish asmlist by adding segment starts }
  1061. insertsegment;
  1062. { assemble }
  1063. create_objectfile;
  1064. end;
  1065. { leave when we got an error }
  1066. if (Errorcount>0) and not status.skip_error then
  1067. begin
  1068. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1069. status.skip_error:=true;
  1070. exit;
  1071. end;
  1072. end;
  1073. procedure proc_program(islibrary : boolean);
  1074. var
  1075. st : psymtable;
  1076. hp : pmodule;
  1077. names : Tstringcontainer;
  1078. begin
  1079. DLLsource:=islibrary;
  1080. parse_only:=false;
  1081. if islibrary then
  1082. begin
  1083. consume(_LIBRARY);
  1084. stringdispose(current_module^.modulename);
  1085. current_module^.modulename:=stringdup(pattern);
  1086. current_module^.islibrary:=true;
  1087. exportlib^.preparelib(pattern);
  1088. consume(_ID);
  1089. consume(_SEMICOLON);
  1090. end
  1091. else
  1092. { is there an program head ? }
  1093. if token=_PROGRAM then
  1094. begin
  1095. consume(_PROGRAM);
  1096. stringdispose(current_module^.modulename);
  1097. current_module^.modulename:=stringdup(pattern);
  1098. consume(_ID);
  1099. if token=_LKLAMMER then
  1100. begin
  1101. consume(_LKLAMMER);
  1102. idlist;
  1103. consume(_RKLAMMER);
  1104. end;
  1105. consume(_SEMICOLON);
  1106. end;
  1107. { global switches are read, so further changes aren't allowed }
  1108. current_module^.in_global:=false;
  1109. { can't have local browser when no global browser }
  1110. if (cs_local_browser in aktmoduleswitches) and
  1111. not(cs_browser in aktmoduleswitches) then
  1112. aktmoduleswitches:=aktmoduleswitches-[cs_local_browser];
  1113. { set implementation flag }
  1114. current_module^.in_implementation:=true;
  1115. { insert after the unit symbol tables the static symbol table }
  1116. { of the program }
  1117. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  1118. current_module^.localsymtable:=st;
  1119. symtablestack:=st;
  1120. refsymtable:=st;
  1121. { necessary for browser }
  1122. loaded_units.insert(current_module);
  1123. { load standard units (system,objpas,profile unit) }
  1124. loaddefaultunits;
  1125. { reset }
  1126. lexlevel:=0;
  1127. {Load the units used by the program we compile.}
  1128. if token=_USES then
  1129. loadunits;
  1130. { reset ranges/stabs in exported definitions }
  1131. reset_global_defs;
  1132. { All units are read, now give them a number }
  1133. numberunits;
  1134. {Insert the name of the main program into the symbol table.}
  1135. if current_module^.modulename^<>'' then
  1136. {st^.insert(new(pprogramsym,init(current_module^.modulename^)));}
  1137. st^.insert(new(punitsym,init(current_module^.modulename^,punitsymtable(st))));
  1138. { ...is also constsymtable, this is the symtable where }
  1139. { the elements of enumeration types are inserted }
  1140. constsymtable:=st;
  1141. { Generate a procsym for main }
  1142. gen_main_procsym('main',potype_proginit,st);
  1143. { reset }
  1144. procprefix:='';
  1145. {The program intialization needs an alias, so it can be called
  1146. from the bootstrap code.}
  1147. codegen_newprocedure;
  1148. names.init;
  1149. names.insert('program_init');
  1150. names.insert('PASCALMAIN');
  1151. names.insert(target_os.cprefix+'main');
  1152. {$ifdef m68k}
  1153. if target_info.target=target_m68k_PalmOS then
  1154. names.insert('PilotMain');
  1155. {$endif}
  1156. compile_proc_body(names,true,false);
  1157. names.done;
  1158. { avoid self recursive destructor call !! PM }
  1159. aktprocsym^.definition^.localst:=nil;
  1160. { consider these symbols as global ones }
  1161. { for browser }
  1162. current_module^.globalsymtable:=current_module^.localsymtable;
  1163. current_module^.localsymtable:=nil;
  1164. codegen_doneprocedure;
  1165. { consume the last point }
  1166. consume(_POINT);
  1167. {$ifdef New_GDB}
  1168. write_gdb_info;
  1169. {$endIf Def New_GDB}
  1170. { leave when we got an error }
  1171. if (Errorcount>0) and not status.skip_error then
  1172. begin
  1173. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1174. status.skip_error:=true;
  1175. exit;
  1176. end;
  1177. { generate imports }
  1178. if current_module^.uses_imports then
  1179. importlib^.generatelib;
  1180. if islibrary then
  1181. exportlib^.generatelib;
  1182. { insert heap }
  1183. insertresourcestrings;
  1184. insertinitfinaltable;
  1185. insertheap;
  1186. inserttargetspecific;
  1187. datasize:=symtablestack^.datasize;
  1188. { finish asmlist by adding segment starts }
  1189. insertsegment;
  1190. { insert own objectfile }
  1191. insertobjectfile;
  1192. { assemble and link }
  1193. create_objectfile;
  1194. { leave when we got an error }
  1195. if (Errorcount>0) and not status.skip_error then
  1196. begin
  1197. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1198. status.skip_error:=true;
  1199. exit;
  1200. end;
  1201. { create the executable when we are at level 1 }
  1202. if (compile_level=1) then
  1203. begin
  1204. { insert all .o files from all loaded units }
  1205. hp:=pmodule(loaded_units.first);
  1206. while assigned(hp) do
  1207. begin
  1208. Linker^.AddModuleFiles(hp);
  1209. hp:=pmodule(hp^.next);
  1210. end;
  1211. { write .def file }
  1212. if (cs_link_deffile in aktglobalswitches) then
  1213. deffile.writefile;
  1214. { finally we can create a executable }
  1215. if (not current_module^.is_unit) then
  1216. Linker^.MakeExecutable;
  1217. end;
  1218. end;
  1219. end.
  1220. {
  1221. $Log$
  1222. Revision 1.141 1999-08-11 17:26:36 peter
  1223. * tlinker object is now inherited for win32 and dos
  1224. * postprocessexecutable is now a method of tlinker
  1225. Revision 1.140 1999/08/04 13:02:57 jonas
  1226. * all tokens now start with an underscore
  1227. * PowerPC compiles!!
  1228. Revision 1.139 1999/08/04 00:23:15 florian
  1229. * renamed i386asm and i386base to cpuasm and cpubase
  1230. Revision 1.138 1999/08/03 22:03:02 peter
  1231. * moved bitmask constants to sets
  1232. * some other type/const renamings
  1233. Revision 1.137 1999/08/03 17:09:38 florian
  1234. * the alpha compiler can be compiled now
  1235. Revision 1.136 1999/08/02 17:17:10 florian
  1236. * small changes for the new code generator
  1237. Revision 1.135 1999/07/29 20:54:04 peter
  1238. * write .size also
  1239. Revision 1.134 1999/07/26 09:42:11 florian
  1240. * bugs 494-496 fixed
  1241. Revision 1.133 1999/07/24 00:13:25 peter
  1242. * also number units for program
  1243. Revision 1.132 1999/07/23 11:37:48 peter
  1244. * error for illegal type reference, instead of 10998
  1245. Revision 1.131 1999/07/22 09:37:54 florian
  1246. + resourcestring implemented
  1247. + start of longstring support
  1248. Revision 1.130 1999/07/14 21:19:11 florian
  1249. + implemented a better error message if a PPU file isn't found as suggested
  1250. by Lee John
  1251. Revision 1.129 1999/07/06 21:48:24 florian
  1252. * a lot bug fixes:
  1253. - po_external isn't any longer necessary for procedure compatibility
  1254. - m_tp_procvar is in -Sd now available
  1255. - error messages of procedure variables improved
  1256. - return values with init./finalization fixed
  1257. - data types with init./finalization aren't any longer allowed in variant
  1258. record
  1259. Revision 1.128 1999/07/06 00:53:48 peter
  1260. * merged
  1261. Revision 1.127 1999/07/05 16:21:27 peter
  1262. * fixed linking for units without linking necessary
  1263. Revision 1.126 1999/07/03 00:29:56 peter
  1264. * new link writing to the ppu, one .ppu is needed for all link types,
  1265. static (.o) is now always created also when smartlinking is used
  1266. Revision 1.125 1999/06/15 13:57:32 peter
  1267. * merged
  1268. Revision 1.124.2.2 1999/07/06 00:47:52 peter
  1269. * killed recompile bug
  1270. Revision 1.124.2.1 1999/06/15 13:54:26 peter
  1271. * don't run ar anymore for binary writer, also not with -CS
  1272. Revision 1.124 1999/05/27 19:44:48 peter
  1273. * removed oldasm
  1274. * plabel -> pasmlabel
  1275. * -a switches to source writing automaticly
  1276. * assembler readers OOPed
  1277. * asmsymbol automaticly external
  1278. * jumptables and other label fixes for asm readers
  1279. Revision 1.123 1999/05/21 13:55:06 peter
  1280. * NEWLAB for label as symbol
  1281. Revision 1.122 1999/05/18 22:36:29 pierre
  1282. * little redondant code removed
  1283. Revision 1.121 1999/05/17 14:43:54 pierre
  1284. * reset current_ppu to nil when appropriate
  1285. Revision 1.120 1999/05/13 21:59:35 peter
  1286. * removed oldppu code
  1287. * warning if objpas is loaded from uses
  1288. * first things for new deref writing
  1289. Revision 1.119 1999/05/09 11:38:08 peter
  1290. * don't write .o and link if errors occure during assembling
  1291. Revision 1.118 1999/05/03 18:03:28 peter
  1292. * no ar.exe running field in target_asm
  1293. Revision 1.117 1999/05/01 13:24:32 peter
  1294. * merged nasm compiler
  1295. * old asm moved to oldasm/
  1296. Revision 1.116 1999/04/26 23:22:42 peter
  1297. * fixed double .o file insertion
  1298. Revision 1.115 1999/04/26 18:29:58 peter
  1299. * farpointerdef moved into pointerdef.is_far
  1300. Revision 1.114 1999/04/26 13:31:39 peter
  1301. * release storenumber,double_checksum
  1302. Revision 1.113 1999/04/25 17:32:14 peter
  1303. * fixed double_checksum
  1304. Revision 1.112 1999/04/25 15:08:38 peter
  1305. * small fixes for double_checksum
  1306. Revision 1.111 1999/04/21 09:43:46 peter
  1307. * storenumber works
  1308. * fixed some typos in double_checksum
  1309. + incompatible types type1 and type2 message (with storenumber)
  1310. Revision 1.110 1999/04/17 13:14:52 peter
  1311. * concat_external added for new init/final
  1312. Revision 1.109 1999/04/15 12:19:59 peter
  1313. + finalization support
  1314. Revision 1.108 1999/04/14 09:14:52 peter
  1315. * first things to store the symbol/def number in the ppu
  1316. Revision 1.107 1999/04/08 10:53:54 michael
  1317. * Fixed forgotten ;
  1318. Revision 1.106 1999/04/07 15:39:30 pierre
  1319. + double_checksum code added
  1320. Revision 1.105 1999/03/26 00:05:38 peter
  1321. * released valintern
  1322. + deffile is now removed when compiling is finished
  1323. * ^( compiles now correct
  1324. + static directive
  1325. * shrd fixed
  1326. Revision 1.104 1999/03/24 23:17:17 peter
  1327. * fixed bugs 212,222,225,227,229,231,233
  1328. Revision 1.103 1999/03/18 20:30:46 peter
  1329. + .a writer
  1330. Revision 1.102 1999/03/16 21:07:25 peter
  1331. * check for dup uses
  1332. Revision 1.101 1999/02/25 21:02:43 peter
  1333. * ag386bin updates
  1334. + coff writer
  1335. Revision 1.100 1999/02/23 18:29:20 pierre
  1336. * win32 compilation error fix
  1337. + some work for local browser (not cl=omplete yet)
  1338. Revision 1.99 1999/02/22 13:06:58 pierre
  1339. + -b and -bl options work !
  1340. + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
  1341. is not enabled when quitting global section
  1342. * local vars and procedures are not yet stored into PPU
  1343. Revision 1.98 1999/02/22 02:15:29 peter
  1344. * updates for ag386bin
  1345. Revision 1.97 1999/02/16 00:45:31 peter
  1346. * fixed crashes by forgotten strpnew() for init_symbol
  1347. Revision 1.96 1999/02/05 08:54:27 pierre
  1348. + linkofiles splitted inot linkofiles and linkunitfiles
  1349. because linkofiles must be stored with directory
  1350. to enabled linking of different objects with same name
  1351. in a different directory
  1352. Revision 1.95 1999/02/03 09:44:36 pierre
  1353. * symbol nubering begins with 1 in number_symbols
  1354. * program tmodule has globalsymtable for its staticsymtable
  1355. (to get it displayed in IDE globals list)
  1356. + list of symbol (browcol) greatly improved for IDE
  1357. Revision 1.94 1999/01/12 14:25:31 peter
  1358. + BrowserLog for browser.log generation
  1359. + BrowserCol for browser info in TCollections
  1360. * released all other UseBrowser
  1361. Revision 1.93 1999/01/06 12:39:46 peter
  1362. * renamed resource -> comprsrc (conflicted with FV)
  1363. Revision 1.92 1998/12/28 23:26:23 peter
  1364. + resource file handling ($R directive) for Win32
  1365. Revision 1.91 1998/12/15 17:14:17 peter
  1366. * fix for tp7
  1367. Revision 1.90 1998/12/15 10:23:26 peter
  1368. + -iSO, -iSP, -iTO, -iTP
  1369. Revision 1.89 1998/12/11 00:03:34 peter
  1370. + globtype,tokens,version unit splitted from globals
  1371. Revision 1.88 1998/12/08 10:18:11 peter
  1372. + -gh for heaptrc unit
  1373. Revision 1.87 1998/12/01 23:40:53 pierre
  1374. * new try for correct debug info generation
  1375. Revision 1.86 1998/11/30 09:43:22 pierre
  1376. * some range check bugs fixed (still not working !)
  1377. + added DLL writing support for win32 (also accepts variables)
  1378. + TempAnsi for code that could be used for Temporary ansi strings
  1379. handling
  1380. Revision 1.85 1998/11/28 16:20:54 peter
  1381. + support for dll variables
  1382. Revision 1.84 1998/11/18 09:18:03 pierre
  1383. + automatic loading of profile unit with -pg option
  1384. in go32v2 mode (also defines FPC_PROFILE)
  1385. * some memory leaks removed
  1386. * unreleased temp problem with sets solved
  1387. Revision 1.83 1998/11/16 11:29:00 pierre
  1388. * stackcheck removed for i386_win32
  1389. * exportlist does not crash at least !!
  1390. (was need for tests dir !)z
  1391. Revision 1.82 1998/11/12 12:55:16 pierre
  1392. * fix for bug0176 and bug0177
  1393. Revision 1.81 1998/11/12 11:34:58 peter
  1394. * fix for empty .o files and linking of libs
  1395. Revision 1.80 1998/11/06 09:48:14 pierre
  1396. * double initialization code calling bug fixed
  1397. Revision 1.79 1998/11/03 11:33:11 peter
  1398. + search_unit arg to only search for sources
  1399. Revision 1.78 1998/10/30 12:23:41 peter
  1400. * fix for lognunitname and longunit.pas
  1401. Revision 1.77 1998/10/29 11:35:52 florian
  1402. * some dll support for win32
  1403. * fixed assembler writing for PalmOS
  1404. Revision 1.76 1998/10/28 18:26:15 pierre
  1405. * removed some erros after other errors (introduced by useexcept)
  1406. * stabs works again correctly (for how long !)
  1407. Revision 1.75 1998/10/27 13:45:35 pierre
  1408. * classes get a vmt allways
  1409. * better error info (tried to remove
  1410. several error strings introduced by the tpexcept handling)
  1411. Revision 1.74 1998/10/26 09:34:50 peter
  1412. * unit check name works now for all units, not only systemunit
  1413. Revision 1.73 1998/10/22 23:53:27 peter
  1414. * leave when an error has been in the interface (else other units could
  1415. be compiled with the implementation uses!)
  1416. * don't always compile when not in implementation with a second_load
  1417. Revision 1.72 1998/10/22 11:36:34 peter
  1418. * fixed imports generation at the wrong place
  1419. Revision 1.71 1998/10/21 20:13:10 peter
  1420. * check for importsection for empty asm file
  1421. Revision 1.70 1998/10/20 09:30:05 peter
  1422. * set also in_library flag when no .o is generated
  1423. Revision 1.68 1998/10/19 08:54:59 pierre
  1424. * wrong stabs info corrected once again !!
  1425. + variable vmt offset with vmt field only if required
  1426. implemented now !!!
  1427. Revision 1.67 1998/10/13 13:10:25 peter
  1428. * new style for m68k/i386 infos and enums
  1429. Revision 1.66 1998/10/09 16:36:05 pierre
  1430. * some memory leaks specific to usebrowser define fixed
  1431. * removed tmodule.implsymtable (was like tmodule.localsymtable)
  1432. Revision 1.65 1998/10/09 14:38:55 pierre
  1433. * add a second load for PPU file
  1434. Revision 1.64 1998/10/09 08:56:28 pierre
  1435. * several memory leaks fixed
  1436. Revision 1.63 1998/10/08 23:29:01 peter
  1437. * -vu shows unit info, -vt shows tried/used files
  1438. Revision 1.62 1998/10/08 17:17:25 pierre
  1439. * current_module old scanner tagged as invalid if unit is recompiled
  1440. + added ppheap for better info on tracegetmem of heaptrc
  1441. (adds line column and file index)
  1442. * several memory leaks removed ith help of heaptrc !!
  1443. Revision 1.61 1998/10/08 13:48:47 peter
  1444. * fixed memory leaks for do nothing source
  1445. * fixed unit interdependency
  1446. Revision 1.60 1998/10/06 17:16:54 pierre
  1447. * some memory leaks fixed (thanks to Peter for heaptrc !)
  1448. Revision 1.59 1998/10/05 21:33:26 peter
  1449. * fixed 161,165,166,167,168
  1450. Revision 1.58 1998/09/30 16:43:37 peter
  1451. * fixed unit interdependency with circular uses
  1452. Revision 1.57 1998/09/30 12:11:52 peter
  1453. * fixed circular uses which looped forever
  1454. Revision 1.56 1998/09/28 11:22:15 pierre
  1455. * did not compile for browser
  1456. * merge from fixes
  1457. Revision 1.48.2.1 1998/09/28 10:55:16 pierre
  1458. fix for current_module dispose bug
  1459. Revision 1.55 1998/09/28 11:04:03 peter
  1460. * fixed loaddefaultunits which was at the wrong place for programs, so
  1461. the default defs were not loaded when main was initialized
  1462. Revision 1.54 1998/09/24 23:49:12 peter
  1463. + aktmodeswitches
  1464. Revision 1.53 1998/09/23 12:20:50 pierre
  1465. * main program tmodule had no symtable (crashed browser)
  1466. * unit symbols problem fixed !!
  1467. Revision 1.52 1998/09/22 17:13:49 pierre
  1468. + browsing updated and developed
  1469. records and objects fields are also stored
  1470. Revision 1.51 1998/09/22 15:40:55 peter
  1471. * some extra ifdef GDB
  1472. Revision 1.50 1998/09/21 08:45:17 pierre
  1473. + added vmt_offset in tobjectdef.write for fututre use
  1474. (first steps to have objects without vmt if no virtual !!)
  1475. + added fpu_used field for tabstractprocdef :
  1476. sets this level to 2 if the functions return with value in FPU
  1477. (is then set to correct value at parsing of implementation)
  1478. THIS MIGHT refuse some code with FPU expression too complex
  1479. that were accepted before and even in some cases
  1480. that don't overflow in fact
  1481. ( like if f : float; is a forward that finally in implementation
  1482. only uses one fpu register !!)
  1483. Nevertheless I think that it will improve security on
  1484. FPU operations !!
  1485. * most other changes only for UseBrowser code
  1486. (added symtable references for record and objects)
  1487. local switch for refs to args and local of each function
  1488. (static symtable still missing)
  1489. UseBrowser still not stable and probably broken by
  1490. the definition hash array !!
  1491. Revision 1.49 1998/09/18 08:01:36 pierre
  1492. + improvement on the usebrowser part
  1493. (does not work correctly for now)
  1494. Revision 1.48 1998/09/09 15:33:07 peter
  1495. * fixed in_global to allow directives also after interface token
  1496. Revision 1.47 1998/09/09 11:50:55 pierre
  1497. * forward def are not put in record or objects
  1498. + added check for forwards also in record and objects
  1499. * dummy parasymtable for unit initialization removed from
  1500. symtable stack
  1501. Revision 1.46 1998/09/03 11:24:01 peter
  1502. * moved more inputfile things from tscannerfile to tinputfile
  1503. * changed ifdef Sourceline to cs_asm_source
  1504. Revision 1.45 1998/08/31 12:26:28 peter
  1505. * m68k and palmos updates from surebugfixes
  1506. Revision 1.44 1998/08/26 15:35:33 peter
  1507. * fixed scannerfiles for macros
  1508. + $I %<environment>%
  1509. Revision 1.43 1998/08/26 10:08:47 peter
  1510. * fixed problem with libprefix at the wrong place
  1511. * fixed lib generation with smartlinking and no -CS used
  1512. Revision 1.42 1998/08/19 18:04:54 peter
  1513. * fixed current_module^.in_implementation flag
  1514. Revision 1.41 1998/08/17 10:10:08 peter
  1515. - removed OLDPPU
  1516. Revision 1.40 1998/08/17 09:17:50 peter
  1517. * static/shared linking updates
  1518. Revision 1.39 1998/08/14 21:56:37 peter
  1519. * setting the outputfile using -o works now to create static libs
  1520. Revision 1.38 1998/08/10 14:50:13 peter
  1521. + localswitches, moduleswitches, globalswitches splitting
  1522. Revision 1.37 1998/08/10 10:18:31 peter
  1523. + Compiler,Comphook unit which are the new interface units to the
  1524. compiler
  1525. Revision 1.36 1998/07/14 14:46:54 peter
  1526. * released NEWINPUT
  1527. Revision 1.35 1998/07/08 12:39:38 peter
  1528. * heap_size for m68k
  1529. Revision 1.34 1998/07/07 11:20:03 peter
  1530. + NEWINPUT for a better inputfile and scanner object
  1531. Revision 1.33 1998/06/25 11:15:34 pierre
  1532. * ppu files where not closed in newppu !!
  1533. second compilation was impossible due to too many opened files
  1534. (not visible in 'make cycle' as we remove all the ppu files)
  1535. Revision 1.32 1998/06/25 08:48:16 florian
  1536. * first version of rtti support
  1537. Revision 1.31 1998/06/24 14:48:35 peter
  1538. * ifdef newppu -> ifndef oldppu
  1539. Revision 1.30 1998/06/17 14:10:16 peter
  1540. * small os2 fixes
  1541. * fixed interdependent units with newppu (remake3 under linux works now)
  1542. Revision 1.29 1998/06/16 08:56:25 peter
  1543. + targetcpu
  1544. * cleaner pmodules for newppu
  1545. Revision 1.28 1998/06/13 00:10:10 peter
  1546. * working browser and newppu
  1547. * some small fixes against crashes which occured in bp7 (but not in
  1548. fpc?!)
  1549. Revision 1.27 1998/06/11 13:58:08 peter
  1550. * small fix to let newppu compile
  1551. Revision 1.26 1998/06/09 16:01:47 pierre
  1552. + added procedure directive parsing for procvars
  1553. (accepted are popstack cdecl and pascal)
  1554. + added C vars with the following syntax
  1555. var C calias 'true_c_name';(can be followed by external)
  1556. reason is that you must add the Cprefix
  1557. which is target dependent
  1558. Revision 1.25 1998/06/08 22:59:49 peter
  1559. * smartlinking works for win32
  1560. * some defines to exclude some compiler parts
  1561. Revision 1.24 1998/06/08 13:13:44 pierre
  1562. + temporary variables now in temp_gen.pas unit
  1563. because it is processor independent
  1564. * mppc68k.bat modified to undefine i386 and support_mmx
  1565. (which are defaults for i386)
  1566. Revision 1.23 1998/06/05 17:47:29 peter
  1567. * some better uses clauses
  1568. Revision 1.22 1998/06/05 14:37:34 pierre
  1569. * fixes for inline for operators
  1570. * inline procedure more correctly restricted
  1571. Revision 1.21 1998/06/04 23:51:53 peter
  1572. * m68k compiles
  1573. + .def file creation moved to gendef.pas so it could also be used
  1574. for win32
  1575. Revision 1.20 1998/06/04 09:55:42 pierre
  1576. * demangled name of procsym reworked to become independant of the mangling scheme
  1577. Revision 1.19 1998/06/03 23:40:38 peter
  1578. + unlimited file support, release tempclose
  1579. Revision 1.18 1998/06/03 22:49:00 peter
  1580. + wordbool,longbool
  1581. * rename bis,von -> high,low
  1582. * moved some systemunit loading/creating to psystem.pas
  1583. Revision 1.17 1998/05/28 14:40:25 peter
  1584. * fixes for newppu, remake3 works now with it
  1585. Revision 1.16 1998/05/27 19:45:06 peter
  1586. * symtable.pas splitted into includefiles
  1587. * symtable adapted for $ifdef NEWPPU
  1588. Revision 1.15 1998/05/23 01:21:22 peter
  1589. + aktasmmode, aktoptprocessor, aktoutputformat
  1590. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1591. + $LIBNAME to set the library name where the unit will be put in
  1592. * splitted cgi386 a bit (codeseg to large for bp7)
  1593. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1594. Revision 1.14 1998/05/20 09:42:35 pierre
  1595. + UseTokenInfo now default
  1596. * unit in interface uses and implementation uses gives error now
  1597. * only one error for unknown symbol (uses lastsymknown boolean)
  1598. the problem came from the label code !
  1599. + first inlined procedures and function work
  1600. (warning there might be allowed cases were the result is still wrong !!)
  1601. * UseBrower updated gives a global list of all position of all used symbols
  1602. with switch -gb
  1603. Revision 1.13 1998/05/12 10:47:00 peter
  1604. * moved printstatus to verb_def
  1605. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1606. prefix like error: warning: and is included in V_Default
  1607. * fixed some messages
  1608. * first time parameter scan is only for -v and -T
  1609. - removed old style messages
  1610. Revision 1.12 1998/05/11 13:07:56 peter
  1611. + $ifdef NEWPPU for the new ppuformat
  1612. + $define GDB not longer required
  1613. * removed all warnings and stripped some log comments
  1614. * no findfirst/findnext anymore to remove smartlink *.o files
  1615. Revision 1.11 1998/05/06 18:36:53 peter
  1616. * tai_section extended with code,data,bss sections and enumerated type
  1617. * ident 'compiled by FPC' moved to pmodules
  1618. * small fix for smartlink
  1619. Revision 1.10 1998/05/04 17:54:28 peter
  1620. + smartlinking works (only case jumptable left todo)
  1621. * redesign of systems.pas to support assemblers and linkers
  1622. + Unitname is now also in the PPU-file, increased version to 14
  1623. Revision 1.9 1998/05/01 16:38:45 florian
  1624. * handling of private and protected fixed
  1625. + change_keywords_to_tp implemented to remove
  1626. keywords which aren't supported by tp
  1627. * break and continue are now symbols of the system unit
  1628. + widestring, longstring and ansistring type released
  1629. Revision 1.8 1998/04/30 15:59:41 pierre
  1630. * GDB works again better :
  1631. correct type info in one pass
  1632. + UseTokenInfo for better source position
  1633. * fixed one remaining bug in scanner for line counts
  1634. * several little fixes
  1635. Revision 1.7 1998/04/29 10:33:59 pierre
  1636. + added some code for ansistring (not complete nor working yet)
  1637. * corrected operator overloading
  1638. * corrected nasm output
  1639. + started inline procedures
  1640. + added starstarn : use ** for exponentiation (^ gave problems)
  1641. + started UseTokenInfo cond to get accurate positions
  1642. Revision 1.6 1998/04/27 23:10:28 peter
  1643. + new scanner
  1644. * $makelib -> if smartlink
  1645. * small filename fixes pmodule.setfilename
  1646. * moved import from files.pas -> import.pas
  1647. Revision 1.5 1998/04/14 23:27:03 florian
  1648. + exclude/include with constant second parameter added
  1649. Revision 1.4 1998/04/10 14:41:43 peter
  1650. * removed some Hints
  1651. * small speed optimization for AsmLn
  1652. Revision 1.3 1998/04/03 09:51:00 daniel
  1653. * Fixed heap allocation for OS/2.
  1654. }