pmodules.pas 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930
  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
  30. {$ifdef i386}
  31. ,i386base,i386asm
  32. {$endif}
  33. {$ifdef m68k}
  34. ,m68k
  35. {$endif}
  36. {$ifdef newcg}
  37. {$ifndef i386}
  38. ,cpubase
  39. {$endif}
  40. {$endif newcg}
  41. ,scanner,pbase,psystem,pdecl,psub,parser;
  42. procedure create_objectfile;
  43. begin
  44. { create the .s file and assemble it }
  45. GenerateAsm(false);
  46. { Also create a smartlinked version ? }
  47. if (cs_smartlink in aktmoduleswitches) then
  48. begin
  49. GenerateAsm(true);
  50. if target_asm.needar then
  51. Linker.MakeStaticLibrary(SmartLinkFilesCnt);
  52. end;
  53. { resource files }
  54. CompileResourceFiles;
  55. end;
  56. procedure insertobjectfile;
  57. { Insert the used object file for this unit in the used list for this unit }
  58. begin
  59. current_module^.linkunitofiles.insert(current_module^.objfilename^,link_static);
  60. current_module^.flags:=current_module^.flags or uf_static_linked;
  61. if (cs_smartlink in aktmoduleswitches) then
  62. begin
  63. current_module^.linkunitstaticlibs.insert(current_module^.staticlibfilename^,link_smart);
  64. current_module^.flags:=current_module^.flags or uf_smart_linked;
  65. end;
  66. end;
  67. procedure insertsegment;
  68. procedure fixseg(p:paasmoutput;sec:tsection);
  69. begin
  70. p^.insert(new(pai_section,init(sec)));
  71. if (cs_smartlink in aktmoduleswitches) then
  72. p^.insert(new(pai_cut,init));
  73. p^.concat(new(pai_section,init(sec_none)));
  74. end;
  75. begin
  76. {Insert Ident of the compiler}
  77. if (not (cs_smartlink in aktmoduleswitches))
  78. {$ifndef EXTDEBUG}
  79. and (not current_module^.is_unit)
  80. {$endif}
  81. then
  82. begin
  83. datasegment^.insert(new(pai_align,init(4)));
  84. datasegment^.insert(new(pai_string,init('FPC '+full_version_string+
  85. ' for '+target_cpu_string+' - '+target_info.short_name)));
  86. end;
  87. { Insert start and end of sections }
  88. fixseg(codesegment,sec_code);
  89. fixseg(datasegment,sec_data);
  90. fixseg(bsssegment,sec_bss);
  91. { we should use .rdata section for these two no ? }
  92. { .rdata is a read only data section (PM) }
  93. fixseg(rttilist,sec_data);
  94. fixseg(consts,sec_data);
  95. if assigned(resourcestringlist) then
  96. fixseg(resourcestringlist,sec_data);
  97. {$ifdef GDB}
  98. if assigned(debuglist) then
  99. fixseg(debuglist,sec_code);
  100. {$endif GDB}
  101. end;
  102. procedure InsertInitFinalTable;
  103. var
  104. hp : pused_unit;
  105. unitinits : taasmoutput;
  106. count : longint;
  107. begin
  108. unitinits.init;
  109. count:=0;
  110. hp:=pused_unit(usedunits.first);
  111. while assigned(hp) do
  112. begin
  113. { call the unit init code and make it external }
  114. if (hp^.u^.flags and (uf_init or uf_finalize))<>0 then
  115. begin
  116. if (hp^.u^.flags and uf_init)<>0 then
  117. begin
  118. unitinits.concat(new(pai_const_symbol,initname('INIT$$'+hp^.u^.modulename^)));
  119. end
  120. else
  121. unitinits.concat(new(pai_const,init_32bit(0)));
  122. if (hp^.u^.flags and uf_finalize)<>0 then
  123. begin
  124. unitinits.concat(new(pai_const_symbol,initname('FINALIZE$$'+hp^.u^.modulename^)));
  125. end
  126. else
  127. unitinits.concat(new(pai_const,init_32bit(0)));
  128. inc(count);
  129. end;
  130. hp:=Pused_unit(hp^.next);
  131. end;
  132. { TableCount,InitCount }
  133. unitinits.insert(new(pai_const,init_32bit(0)));
  134. unitinits.insert(new(pai_const,init_32bit(count)));
  135. unitinits.insert(new(pai_symbol,initname_global('INITFINAL',0)));
  136. unitinits.concat(new(pai_symbol_end,initname('INITFINAL')));
  137. { insert in data segment }
  138. if (cs_smartlink in aktmoduleswitches) then
  139. datasegment^.concat(new(pai_cut,init));
  140. datasegment^.concatlist(@unitinits);
  141. unitinits.done;
  142. end;
  143. procedure insertheap;
  144. begin
  145. if (cs_smartlink in aktmoduleswitches) then
  146. begin
  147. bsssegment^.concat(new(pai_cut,init));
  148. datasegment^.concat(new(pai_cut,init));
  149. end;
  150. { On the Macintosh Classic M68k Architecture
  151. The Heap variable is simply a POINTER to the
  152. real HEAP. The HEAP must be set up by the RTL
  153. and must store the pointer in this value.
  154. On OS/2 the heap is also intialized by the RTL. We do
  155. not output a pointer }
  156. case target_info.target of
  157. {$ifdef i386}
  158. target_i386_OS2:
  159. ;
  160. {$endif i386}
  161. {$ifdef alpha}
  162. target_alpha_linux:
  163. ;
  164. {$endif alpha}
  165. {$ifdef m68k}
  166. target_m68k_Mac:
  167. bsssegment^.concat(new(pai_datablock,init_global('HEAP',4)));
  168. target_m68k_PalmOS:
  169. ;
  170. {$endif m68k}
  171. else
  172. bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize)));
  173. end;
  174. {$ifdef m68k}
  175. if target_info.target<>target_m68k_PalmOS then
  176. begin
  177. datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE')));
  178. datasegment^.concat(new(pai_const,init_32bit(heapsize)));
  179. end;
  180. {$else m68k}
  181. datasegment^.concat(new(pai_symbol,initname_global('HEAPSIZE',4)));
  182. datasegment^.concat(new(pai_const,init_32bit(heapsize)));
  183. {$endif m68k}
  184. end;
  185. procedure inserttargetspecific;
  186. begin
  187. case target_info.target of
  188. {$ifdef alpha}
  189. target_alpha_linux:
  190. ;
  191. {$endif alpha}
  192. {$ifdef i386}
  193. target_i386_GO32V2 :
  194. begin
  195. { stacksize can be specified }
  196. datasegment^.concat(new(pai_symbol,initname_global('__stklen',4)));
  197. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  198. end;
  199. target_i386_WIN32 :
  200. begin
  201. { Generate an external entry to be sure that _mainCRTStarup will be
  202. linked, can't use concat_external because those aren't written for
  203. asw (PFV) }
  204. target_link.bindcmd[1]:=target_link.bindcmd[1]+' -d '+deffile.fname;
  205. if DLLsource then
  206. target_link.binders:=2;
  207. if RelocSection then
  208. begin
  209. target_link.linkcmd:=target_link.linkcmd+' --base-file base.$$$';
  210. target_link.bindcmd[1]:=target_link.bindcmd[1]+' --base-file base.$$$';
  211. target_link.binders:=2;
  212. end;
  213. if apptype=at_gui then
  214. begin
  215. target_link.linkcmd:='--subsystem windows '+target_link.linkcmd;
  216. target_link.bindcmd[2]:='--subsystem windows '+target_link.bindcmd[2];
  217. end;
  218. if DLLsource then
  219. begin
  220. target_link.linkcmd:='--dll '+target_link.linkcmd;
  221. target_link.bindcmd[2]:='--dll '+target_link.bindcmd[2];
  222. end;
  223. end;
  224. {$endif i386}
  225. {$ifdef m68k}
  226. target_m68k_Atari :
  227. begin
  228. { stacksize can be specified }
  229. datasegment^.concat(new(pai_symbol,init_global('__stklen',4)));
  230. datasegment^.concat(new(pai_const,init_32bit(stacksize)));
  231. end;
  232. {$endif m68k}
  233. end;
  234. end;
  235. function loadunit(const s : string;compile_system:boolean) : pmodule;forward;
  236. procedure load_usedunits(compile_system:boolean);
  237. var
  238. pu : pused_unit;
  239. loaded_unit : pmodule;
  240. load_refs : boolean;
  241. nextmapentry : longint;
  242. begin
  243. load_refs:=true;
  244. { init the map }
  245. new(current_module^.map);
  246. fillchar(current_module^.map^,sizeof(tunitmap),#0);
  247. {$ifdef NEWMAP}
  248. current_module^.map^[0]:=current_module;
  249. {$endif NEWMAP}
  250. nextmapentry:=1;
  251. { load the used units from interface }
  252. current_module^.in_implementation:=false;
  253. pu:=pused_unit(current_module^.used_units.first);
  254. while assigned(pu) do
  255. begin
  256. if (not pu^.loaded) and (pu^.in_interface) then
  257. begin
  258. loaded_unit:=loadunit(pu^.name^,false);
  259. if current_module^.compiled then
  260. exit;
  261. { register unit in used units }
  262. pu^.u:=loaded_unit;
  263. pu^.loaded:=true;
  264. { doubles are not important for that list PM }
  265. pu^.u^.dependent_units.concat(new(pdependent_unit,init(current_module)));
  266. { need to recompile the current unit ? }
  267. if loaded_unit^.crc<>pu^.checksum then
  268. begin
  269. Message2(unit_u_recompile_crc_change,current_module^.modulename^,pu^.name^);
  270. current_module^.recompile_reason:=rr_crcchanged;
  271. current_module^.do_compile:=true;
  272. dispose(current_module^.map);
  273. current_module^.map:=nil;
  274. exit;
  275. end;
  276. { setup the map entry for deref }
  277. {$ifndef NEWMAP}
  278. current_module^.map^[nextmapentry]:=loaded_unit^.globalsymtable;
  279. {$else NEWMAP}
  280. current_module^.map^[nextmapentry]:=loaded_unit;
  281. {$endif NEWMAP}
  282. inc(nextmapentry);
  283. if nextmapentry>maxunits then
  284. Message(unit_f_too_much_units);
  285. end;
  286. pu:=pused_unit(pu^.next);
  287. end;
  288. { ok, now load the unit }
  289. current_module^.globalsymtable:=new(punitsymtable,loadasunit);
  290. { now only read the implementation part }
  291. current_module^.in_implementation:=true;
  292. { load the used units from implementation }
  293. pu:=pused_unit(current_module^.used_units.first);
  294. while assigned(pu) do
  295. begin
  296. if (not pu^.loaded) and (not pu^.in_interface) then
  297. begin
  298. loaded_unit:=loadunit(pu^.name^,false);
  299. if current_module^.compiled then
  300. exit;
  301. { register unit in used units }
  302. pu^.u:=loaded_unit;
  303. pu^.loaded:=true;
  304. { need to recompile the current unit ? }
  305. if (loaded_unit^.interface_crc<>pu^.interface_checksum) and
  306. not(current_module^.in_second_compile) then
  307. begin
  308. Message2(unit_u_recompile_crc_change,current_module^.modulename^,pu^.name^+' {impl}');
  309. current_module^.recompile_reason:=rr_crcchanged;
  310. current_module^.do_compile:=true;
  311. dispose(current_module^.map);
  312. current_module^.map:=nil;
  313. exit;
  314. end;
  315. { setup the map entry for deref }
  316. {$ifndef NEWMAP}
  317. current_module^.map^[nextmapentry]:=loaded_unit^.globalsymtable;
  318. {$else NEWMAP}
  319. current_module^.map^[nextmapentry]:=loaded_unit;
  320. {$endif NEWMAP}
  321. inc(nextmapentry);
  322. if nextmapentry>maxunits then
  323. Message(unit_f_too_much_units);
  324. end;
  325. pu:=pused_unit(pu^.next);
  326. end;
  327. { load browser info if stored }
  328. if ((current_module^.flags and uf_has_browser)<>0) and load_refs then
  329. punitsymtable(current_module^.globalsymtable)^.load_symtable_refs;
  330. { remove the map, it's not needed anymore }
  331. dispose(current_module^.map);
  332. current_module^.map:=nil;
  333. end;
  334. function loadunit(const s : string;compile_system:boolean) : pmodule;
  335. const
  336. ImplIntf : array[boolean] of string[15]=('interface','implementation');
  337. var
  338. st : punitsymtable;
  339. second_time : boolean;
  340. old_current_ppu : pppufile;
  341. old_current_module,hp,hp2 : pmodule;
  342. name : string;{ necessary because current_module^.mainsource^ is reset in compile !! }
  343. scanner : pscannerfile;
  344. procedure loadppufile;
  345. begin
  346. { load interface section }
  347. if not current_module^.do_compile then
  348. load_interface;
  349. { only load units when we don't recompile }
  350. if not current_module^.do_compile then
  351. load_usedunits(compile_system);
  352. { recompile if set }
  353. if current_module^.do_compile then
  354. begin
  355. { we don't need the ppufile anymore }
  356. if assigned(current_module^.ppufile) then
  357. begin
  358. dispose(current_module^.ppufile,done);
  359. current_module^.ppufile:=nil;
  360. current_ppu:=nil;
  361. end;
  362. { recompile the unit or give a fatal error if sources not available }
  363. if not(current_module^.sources_avail) then
  364. if (not current_module^.search_unit(current_module^.modulename^,true))
  365. and (length(current_module^.modulename^)>8) then
  366. current_module^.search_unit(copy(current_module^.modulename^,1,8),true);
  367. if not(current_module^.sources_avail) then
  368. begin
  369. if current_module^.recompile_reason=rr_noppu then
  370. Message1(unit_f_cant_find_ppu,current_module^.modulename^)
  371. else
  372. Message1(unit_f_cant_compile_unit,current_module^.modulename^);
  373. end
  374. else
  375. begin
  376. if current_module^.in_second_compile then
  377. Message1(parser_d_compiling_second_time,current_module^.modulename^);
  378. current_scanner^.tempcloseinputfile;
  379. name:=current_module^.mainsource^;
  380. if assigned(scanner) then
  381. scanner^.invalid:=true;
  382. compile(name,compile_system);
  383. if (not current_scanner^.invalid) then
  384. current_scanner^.tempopeninputfile;
  385. end;
  386. end
  387. else
  388. begin
  389. { only reassemble ? }
  390. if (current_module^.do_assemble) then
  391. OnlyAsm;
  392. end;
  393. if assigned(current_module^.ppufile) then
  394. begin
  395. dispose(current_module^.ppufile,done);
  396. current_module^.ppufile:=nil;
  397. current_ppu:=nil;
  398. end;
  399. end;
  400. var
  401. dummy : pmodule;
  402. begin
  403. old_current_module:=current_module;
  404. old_current_ppu:=current_ppu;
  405. { Info }
  406. Message3(unit_u_load_unit,current_module^.modulename^,ImplIntf[current_module^.in_implementation],s);
  407. { unit not found }
  408. st:=nil;
  409. { search all loaded units }
  410. hp:=pmodule(loaded_units.first);
  411. while assigned(hp) do
  412. begin
  413. if hp^.modulename^=s then
  414. begin
  415. { forced to reload ? }
  416. if hp^.do_reload then
  417. begin
  418. hp^.do_reload:=false;
  419. break;
  420. end;
  421. { the unit is already registered }
  422. { and this means that the unit }
  423. { is already compiled }
  424. { else there is a cyclic unit use }
  425. if assigned(hp^.globalsymtable) then
  426. st:=punitsymtable(hp^.globalsymtable)
  427. else
  428. begin
  429. { both units in interface ? }
  430. if (not current_module^.in_implementation) and (not hp^.in_implementation) then
  431. begin
  432. { check for a cycle }
  433. hp2:=current_module^.loaded_from;
  434. while assigned(hp2) and (hp2<>hp) do
  435. begin
  436. if hp2^.in_implementation then
  437. hp2:=nil
  438. else
  439. hp2:=hp2^.loaded_from;
  440. end;
  441. if assigned(hp2) then
  442. Message2(unit_f_circular_unit_reference,current_module^.modulename^,hp^.modulename^);
  443. end;
  444. end;
  445. break;
  446. end;
  447. { the next unit }
  448. hp:=pmodule(hp^.next);
  449. end;
  450. { the unit is not in the symtable stack }
  451. if (not assigned(st)) then
  452. begin
  453. if assigned(hp) then
  454. begin
  455. { remove the old unit }
  456. loaded_units.remove(hp);
  457. scanner:=hp^.scanner;
  458. hp^.reset;
  459. hp^.scanner:=scanner;
  460. { try to reopen ppu }
  461. hp^.search_unit(s,false);
  462. { try to load the unit a second time first }
  463. current_module:=hp;
  464. current_module^.in_second_compile:=true;
  465. Message1(unit_u_second_load_unit,current_module^.modulename^);
  466. second_time:=true;
  467. end
  468. else
  469. { generates a new unit info record }
  470. begin
  471. current_module:=new(pmodule,init(s,true));
  472. scanner:=nil;
  473. second_time:=false;
  474. end;
  475. current_ppu:=current_module^.ppufile;
  476. { now we can register the unit }
  477. current_module^.loaded_from:=old_current_module;
  478. loaded_units.insert(current_module);
  479. { now realy load the ppu }
  480. loadppufile;
  481. { set compiled flag }
  482. current_module^.compiled:=true;
  483. { load return pointer }
  484. hp:=current_module;
  485. { for a second_time recompile reload all dependent units,
  486. for a first time compile register the unit _once_ }
  487. if second_time then
  488. begin
  489. { now reload all dependent units }
  490. hp2:=pmodule(loaded_units.first);
  491. while assigned(hp2) do
  492. begin
  493. if hp2^.do_reload then
  494. dummy:=loadunit(hp2^.modulename^,false);
  495. hp2:=pmodule(hp2^.next);
  496. end;
  497. end
  498. else
  499. usedunits.concat(new(pused_unit,init(current_module,true)));
  500. end;
  501. { set the old module }
  502. current_ppu:=old_current_ppu;
  503. current_module:=old_current_module;
  504. loadunit:=hp;
  505. end;
  506. procedure loaddefaultunits;
  507. var
  508. hp : pmodule;
  509. begin
  510. { are we compiling the system unit? }
  511. if (cs_compilesystem in aktmoduleswitches) then
  512. begin
  513. { create system defines }
  514. createconstdefs;
  515. { we don't need to reset anything, it's already done in parser.pas }
  516. exit;
  517. end;
  518. { insert the system unit, it is allways the first }
  519. hp:=loadunit(upper(target_info.system_unit),true);
  520. systemunit:=hp^.globalsymtable;
  521. { it's always the first unit }
  522. systemunit^.next:=nil;
  523. symtablestack:=systemunit;
  524. { add to the used units }
  525. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  526. refsymtable^.insert(new(punitsym,init('SYSTEM',systemunit)));
  527. { read default constant definitions }
  528. make_ref:=false;
  529. readconstdefs;
  530. make_ref:=true;
  531. { if POWER is defined in the RTL then use it for starstar overloading }
  532. getsym('POWER',false);
  533. if assigned(srsym) and (srsym^.typ=procsym) and (overloaded_operators[STARSTAR]=nil) then
  534. overloaded_operators[STARSTAR]:=pprocsym(srsym);
  535. { Objpas unit? }
  536. if m_objpas in aktmodeswitches then
  537. begin
  538. hp:=loadunit('OBJPAS',false);
  539. objpasunit:=hp^.globalsymtable;
  540. { insert in stack }
  541. objpasunit^.next:=symtablestack;
  542. symtablestack:=objpasunit;
  543. { add to the used units }
  544. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  545. refsymtable^.insert(new(punitsym,init('OBJPAS',objpasunit)));
  546. end
  547. else
  548. objpasunit:=nil;
  549. { Profile unit? Needed for go32v2 only }
  550. if (cs_profile in aktmoduleswitches) and (target_info.target=target_i386_go32v2) then
  551. begin
  552. hp:=loadunit('PROFILE',false);
  553. psymtable(hp^.globalsymtable)^.next:=symtablestack;
  554. symtablestack:=hp^.globalsymtable;
  555. { add to the used units }
  556. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  557. refsymtable^.insert(new(punitsym,init('PROFILE',hp^.globalsymtable)));
  558. end;
  559. { Heaptrc unit? (not needed for units), this is here to be sure that it is really
  560. loaded as first unit }
  561. if (cs_gdb_heaptrc in aktglobalswitches) and not(current_module^.is_unit)then
  562. begin
  563. hp:=loadunit('HEAPTRC',false);
  564. psymtable(hp^.globalsymtable)^.next:=symtablestack;
  565. symtablestack:=hp^.globalsymtable;
  566. { add to the used units }
  567. current_module^.used_units.concat(new(pused_unit,init(hp,true)));
  568. refsymtable^.insert(new(punitsym,init('HEAPTRC',hp^.globalsymtable)));
  569. end;
  570. { save default symtablestack }
  571. defaultsymtablestack:=symtablestack;
  572. end;
  573. procedure loadunits;
  574. var
  575. s : stringid;
  576. pu,
  577. hp : pused_unit;
  578. hp2 : pmodule;
  579. hp3 : psymtable;
  580. oldprocsym:Pprocsym;
  581. begin
  582. oldprocsym:=aktprocsym;
  583. consume(_USES);
  584. {$ifdef DEBUG}
  585. test_symtablestack;
  586. {$endif DEBUG}
  587. repeat
  588. s:=pattern;
  589. consume(ID);
  590. { Give a warning if objpas is loaded }
  591. if s='OBJPAS' then
  592. Message(parser_w_no_objpas_use_mode);
  593. { check if the unit is already used }
  594. pu:=pused_unit(current_module^.used_units.first);
  595. while assigned(pu) do
  596. begin
  597. if (pu^.name^=s) then
  598. break;
  599. pu:=pused_unit(pu^.next);
  600. end;
  601. { avoid uses of itself }
  602. if not assigned(pu) and (s<>current_module^.modulename^) then
  603. begin
  604. { load the unit }
  605. hp2:=loadunit(s,false);
  606. { the current module uses the unit hp2 }
  607. current_module^.used_units.concat(new(pused_unit,init(hp2,not current_module^.in_implementation)));
  608. pused_unit(current_module^.used_units.last)^.in_uses:=true;
  609. if current_module^.compiled then
  610. exit;
  611. refsymtable^.insert(new(punitsym,init(s,hp2^.globalsymtable)));
  612. end
  613. else
  614. Message1(sym_e_duplicate_id,s);
  615. if token=COMMA then
  616. begin
  617. pattern:='';
  618. consume(COMMA);
  619. end
  620. else
  621. break;
  622. until false;
  623. consume(SEMICOLON);
  624. { set the symtable to systemunit so it gets reorderd correctly }
  625. symtablestack:=defaultsymtablestack;
  626. { now insert the units in the symtablestack }
  627. hp:=pused_unit(current_module^.used_units.first);
  628. while assigned(hp) do
  629. begin
  630. {$IfDef GDB}
  631. {$IfnDef New_GDB}
  632. if (cs_debuginfo in aktmoduleswitches) and
  633. not hp^.is_stab_written then
  634. begin
  635. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  636. hp^.is_stab_written:=true;
  637. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  638. end;
  639. {$endIf nDef New_GDB}
  640. {$EndIf GDB}
  641. if hp^.in_uses then
  642. begin
  643. hp3:=symtablestack;
  644. while assigned(hp3) do
  645. begin
  646. { insert units only once ! }
  647. if hp^.u^.globalsymtable=hp3 then
  648. break;
  649. hp3:=hp3^.next;
  650. { unit isn't inserted }
  651. if hp3=nil then
  652. begin
  653. psymtable(hp^.u^.globalsymtable)^.next:=symtablestack;
  654. symtablestack:=psymtable(hp^.u^.globalsymtable);
  655. {$ifdef CHAINPROCSYMS}
  656. symtablestack^.chainprocsyms;
  657. {$endif CHAINPROCSYMS}
  658. {$ifdef DEBUG}
  659. test_symtablestack;
  660. {$endif DEBUG}
  661. end;
  662. end;
  663. end;
  664. hp:=pused_unit(hp^.next);
  665. end;
  666. aktprocsym:=oldprocsym;
  667. end;
  668. procedure write_gdb_info;
  669. {$IfDef GDB}
  670. var
  671. hp : pused_unit;
  672. begin
  673. if not (cs_debuginfo in aktmoduleswitches) then
  674. exit;
  675. { now insert the units in the symtablestack }
  676. hp:=pused_unit(current_module^.used_units.first);
  677. while assigned(hp) do
  678. begin
  679. if (cs_debuginfo in aktmoduleswitches) and
  680. not hp^.is_stab_written then
  681. begin
  682. punitsymtable(hp^.u^.globalsymtable)^.concattypestabto(debuglist);
  683. hp^.is_stab_written:=true;
  684. hp^.unitid:=psymtable(hp^.u^.globalsymtable)^.unitid;
  685. end;
  686. hp:=pused_unit(hp^.next);
  687. end;
  688. if current_module^.in_implementation then
  689. begin
  690. if assigned(current_module^.localsymtable) then
  691. begin
  692. { all types }
  693. punitsymtable(current_module^.localsymtable)^.concattypestabto(debuglist);
  694. { and all local symbols}
  695. punitsymtable(current_module^.localsymtable)^.concatstabto(debuglist);
  696. end;
  697. end
  698. else
  699. begin
  700. if assigned(current_module^.globalsymtable) then
  701. begin
  702. { all types }
  703. punitsymtable(current_module^.globalsymtable)^.concattypestabto(debuglist);
  704. { and all local symbols}
  705. punitsymtable(current_module^.globalsymtable)^.concatstabto(debuglist);
  706. end;
  707. end;
  708. end;
  709. {$Else GDB}
  710. begin
  711. end;
  712. {$EndIf GDB}
  713. procedure parse_implementation_uses(symt:Psymtable);
  714. begin
  715. if token=_USES then
  716. begin
  717. symt^.symtabletype:=unitsymtable;
  718. loadunits;
  719. symt^.symtabletype:=globalsymtable;
  720. {$ifdef DEBUG}
  721. test_symtablestack;
  722. {$endif DEBUG}
  723. end;
  724. end;
  725. procedure gen_main_procsym(const name:string;options:tproctypeoption;st:psymtable);
  726. var
  727. stt : psymtable;
  728. begin
  729. {Generate a procsym for main}
  730. make_ref:=false;
  731. aktprocsym:=new(Pprocsym,init(name));
  732. {Try to insert in in static symtable ! }
  733. stt:=symtablestack;
  734. symtablestack:=st;
  735. aktprocsym^.definition:=new(Pprocdef,init);
  736. symtablestack:=stt;
  737. aktprocsym^.definition^.proctypeoption:=options;
  738. aktprocsym^.definition^.setmangledname(target_os.cprefix+name);
  739. aktprocsym^.definition^.forwarddef:=false;
  740. make_ref:=true;
  741. { The localst is a local symtable. Change it into the static
  742. symtable }
  743. dispose(aktprocsym^.definition^.localst,done);
  744. aktprocsym^.definition^.localst:=st;
  745. { and insert the procsym in symtable }
  746. st^.insert(aktprocsym);
  747. { set some informations about the main program }
  748. with procinfo do
  749. begin
  750. retdef:=voiddef;
  751. _class:=nil;
  752. call_offset:=8;
  753. framepointer:=frame_pointer;
  754. flags:=0;
  755. end;
  756. end;
  757. procedure proc_unit;
  758. function is_assembler_generated:boolean;
  759. begin
  760. is_assembler_generated:=(Errorcount=0) and
  761. not(
  762. codesegment^.empty and
  763. datasegment^.empty and
  764. bsssegment^.empty and
  765. ((importssection=nil) or importssection^.empty) and
  766. ((resourcesection=nil) or resourcesection^.empty) and
  767. ((resourcestringlist=nil) or resourcestringlist^.empty)
  768. );
  769. end;
  770. var
  771. names : Tstringcontainer;
  772. st : psymtable;
  773. unitst : punitsymtable;
  774. {$ifdef GDB}
  775. pu : pused_unit;
  776. {$endif GDB}
  777. {$ifdef Test_Double_checksum}
  778. store_crc : longint;
  779. {$endif}
  780. s1,s2 : ^string; {Saves stack space}
  781. begin
  782. consume(_UNIT);
  783. if token=ID then
  784. begin
  785. { create filenames and unit name }
  786. current_module^.SetFileName(current_scanner^.inputfile^.path^+current_scanner^.inputfile^.name^,true);
  787. stringdispose(current_module^.modulename);
  788. current_module^.modulename:=stringdup(upper(pattern));
  789. { check for system unit }
  790. new(s1);
  791. new(s2);
  792. s1^:=upper(target_info.system_unit);
  793. s2^:=upper(SplitName(current_scanner^.inputfile^.name^));
  794. if (cs_compilesystem in aktmoduleswitches) then
  795. begin
  796. if ((length(current_module^.modulename^)>8) or
  797. (current_module^.modulename^<>s1^) or
  798. (current_module^.modulename^<>s2^)) then
  799. Message1(unit_e_illegal_unit_name,current_module^.modulename^);
  800. end
  801. else
  802. begin
  803. if (cs_check_unit_name in aktglobalswitches) and
  804. not((current_module^.modulename^=s2^) or
  805. ((length(current_module^.modulename^)>8) and
  806. (copy(current_module^.modulename^,1,8)=s2^))) then
  807. Message1(unit_e_illegal_unit_name,current_module^.modulename^);
  808. if (current_module^.modulename^=s1^) then
  809. Message(unit_w_switch_us_missed);
  810. end;
  811. dispose(s2);
  812. dispose(s1);
  813. end;
  814. consume(ID);
  815. consume(SEMICOLON);
  816. consume(_INTERFACE);
  817. { global switches are read, so further changes aren't allowed }
  818. current_module^.in_global:=false;
  819. { can't have local browser when no global browser }
  820. if (cs_local_browser in aktmoduleswitches) and
  821. not(cs_browser in aktmoduleswitches) then
  822. aktmoduleswitches:=aktmoduleswitches-[cs_local_browser];
  823. Message1(unit_u_start_parse_interface,current_module^.modulename^);
  824. { update status }
  825. status.currentmodule:=current_module^.modulename^;
  826. { maybe turn off m_objpas if we are compiling objpas }
  827. if (current_module^.modulename^='OBJPAS') then
  828. aktmodeswitches:=aktmodeswitches-[m_objpas];
  829. { this should be placed after uses !!}
  830. {$ifndef UseNiceNames}
  831. procprefix:='_'+current_module^.modulename^+'$$';
  832. {$else UseNiceNames}
  833. procprefix:='_'+tostr(length(current_module^.modulename^))+lowercase(current_module^.modulename^)+'_';
  834. {$endif UseNiceNames}
  835. parse_only:=true;
  836. { generate now the global symboltable }
  837. st:=new(punitsymtable,init(globalsymtable,current_module^.modulename^));
  838. refsymtable:=st;
  839. unitst:=punitsymtable(st);
  840. { define first as local to overcome dependency conflicts }
  841. current_module^.localsymtable:=st;
  842. { the unit name must be usable as a unit specifier }
  843. { inside the unit itself (PM) }
  844. { this also forbids to have another symbol }
  845. { with the same name as the unit }
  846. refsymtable^.insert(new(punitsym,init(current_module^.modulename^,unitst)));
  847. { a unit compiled at command line must be inside the loaded_unit list }
  848. if (compile_level=1) then
  849. loaded_units.insert(current_module);
  850. { load default units, like the system unit }
  851. loaddefaultunits;
  852. { reset }
  853. make_ref:=true;
  854. lexlevel:=0;
  855. { insert qualifier for the system unit (allows system.writeln) }
  856. if not(cs_compilesystem in aktmoduleswitches) then
  857. begin
  858. if token=_USES then
  859. begin
  860. unitst^.symtabletype:=unitsymtable;
  861. loadunits;
  862. { has it been compiled at a higher level ?}
  863. if current_module^.compiled then
  864. begin
  865. { this unit symtable is obsolete }
  866. { dispose(unitst,done);
  867. disposed as localsymtable !! }
  868. exit;
  869. end;
  870. unitst^.symtabletype:=globalsymtable;
  871. end;
  872. { ... but insert the symbol table later }
  873. st^.next:=symtablestack;
  874. symtablestack:=st;
  875. end
  876. else
  877. { while compiling a system unit, some types are directly inserted }
  878. begin
  879. st^.next:=symtablestack;
  880. symtablestack:=st;
  881. insert_intern_types(st);
  882. end;
  883. { now we know the place to insert the constants }
  884. constsymtable:=symtablestack;
  885. { move the global symtab from the temporary local to global }
  886. current_module^.globalsymtable:=current_module^.localsymtable;
  887. current_module^.localsymtable:=nil;
  888. reset_global_defs;
  889. { number all units, so we know if a unit is used by this unit or
  890. needs to be added implicitly }
  891. numberunits;
  892. { ... parse the declarations }
  893. read_interface_declarations;
  894. { leave when we got an error }
  895. if (Errorcount>0) and not status.skip_error then
  896. begin
  897. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  898. status.skip_error:=true;
  899. exit;
  900. end;
  901. {$ifdef New_GDB}
  902. write_gdb_info;
  903. {$endIf Def New_GDB}
  904. {$ifdef Test_Double_checksum}
  905. if (Errorcount=0) then
  906. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack),true);
  907. {$endif Test_Double_checksum}
  908. { Parse the implementation section }
  909. consume(_IMPLEMENTATION);
  910. current_module^.in_implementation:=true;
  911. Message1(unit_u_start_parse_implementation,current_module^.modulename^);
  912. parse_only:=false;
  913. { generates static symbol table }
  914. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  915. current_module^.localsymtable:=st;
  916. { remove the globalsymtable from the symtable stack }
  917. { to reinsert it after loading the implementation units }
  918. symtablestack:=unitst^.next;
  919. { we don't want implementation units symbols in unitsymtable !! PM }
  920. refsymtable:=st;
  921. { Read the implementation units }
  922. parse_implementation_uses(unitst);
  923. if current_module^.compiled then
  924. begin
  925. exit;
  926. end;
  927. { reset ranges/stabs in exported definitions }
  928. reset_global_defs;
  929. { All units are read, now give them a number }
  930. numberunits;
  931. { now we can change refsymtable }
  932. refsymtable:=st;
  933. { but reinsert the global symtable as lasts }
  934. unitst^.next:=symtablestack;
  935. symtablestack:=unitst;
  936. {$ifdef DEBUG}
  937. test_symtablestack;
  938. {$endif DEBUG}
  939. constsymtable:=symtablestack;
  940. {$ifdef Splitheap}
  941. if testsplit then
  942. begin
  943. Split_Heap;
  944. allow_special:=true;
  945. Switch_to_temp_heap;
  946. end;
  947. { it will report all crossings }
  948. allow_special:=false;
  949. {$endif Splitheap}
  950. { Generate a procsym }
  951. gen_main_procsym(current_module^.modulename^+'_init',potype_unitinit,st);
  952. { Compile the unit }
  953. codegen_newprocedure;
  954. names.init;
  955. names.insert('INIT$$'+current_module^.modulename^);
  956. names.insert(target_os.cprefix+current_module^.modulename^+'_init');
  957. compile_proc_body(names,true,false);
  958. names.done;
  959. codegen_doneprocedure;
  960. { avoid self recursive destructor call !! PM }
  961. aktprocsym^.definition^.localst:=nil;
  962. { finalize? }
  963. if token=_FINALIZATION then
  964. begin
  965. { set module options }
  966. current_module^.flags:=current_module^.flags or uf_finalize;
  967. { Generate a procsym }
  968. gen_main_procsym(current_module^.modulename^+'_finalize',potype_unitfinalize,st);
  969. { Compile the finalize }
  970. codegen_newprocedure;
  971. names.init;
  972. names.insert('FINALIZE$$'+current_module^.modulename^);
  973. names.insert(target_os.cprefix+current_module^.modulename^+'_finalize');
  974. compile_proc_body(names,true,false);
  975. names.done;
  976. codegen_doneprocedure;
  977. end;
  978. { the last char should always be a point }
  979. consume(POINT);
  980. { avoid self recursive destructor call !! PM }
  981. aktprocsym^.definition^.localst:=nil;
  982. { absence does not matter here !! }
  983. aktprocsym^.definition^.forwarddef:=false;
  984. { test static symtable }
  985. if (Errorcount=0) then
  986. st^.allsymbolsused;
  987. { size of the static data }
  988. datasize:=st^.datasize;
  989. {$ifdef GDB}
  990. { add all used definitions even for implementation}
  991. if (cs_debuginfo in aktmoduleswitches) then
  992. begin
  993. {$IfnDef New_GDB}
  994. if assigned(current_module^.globalsymtable) then
  995. begin
  996. { all types }
  997. punitsymtable(current_module^.globalsymtable)^.concattypestabto(debuglist);
  998. { and all local symbols}
  999. punitsymtable(current_module^.globalsymtable)^.concatstabto(debuglist);
  1000. end;
  1001. { all local types }
  1002. punitsymtable(st)^.concattypestabto(debuglist);
  1003. { and all local symbols}
  1004. st^.concatstabto(debuglist);
  1005. {$else New_GDB}
  1006. write_gdb_info;
  1007. {$endIf Def New_GDB}
  1008. end;
  1009. {$endif GDB}
  1010. reset_global_defs;
  1011. { tests, if all (interface) forwards are resolved }
  1012. if (Errorcount=0) then
  1013. symtablestack^.check_forwards;
  1014. { now we have a correct unit, change the symtable type }
  1015. current_module^.in_implementation:=false;
  1016. symtablestack^.symtabletype:=unitsymtable;
  1017. {$ifdef GDB}
  1018. punitsymtable(symtablestack)^.is_stab_written:=false;
  1019. {$endif GDB}
  1020. { leave when we got an error }
  1021. if (Errorcount>0) and not status.skip_error then
  1022. begin
  1023. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1024. status.skip_error:=true;
  1025. exit;
  1026. end;
  1027. { generate imports }
  1028. if current_module^.uses_imports then
  1029. importlib^.generatelib;
  1030. { insert own objectfile, or say that it's in a library
  1031. (no check for an .o when loading) }
  1032. if is_assembler_generated then
  1033. insertobjectfile
  1034. else
  1035. current_module^.flags:=current_module^.flags or uf_no_link;
  1036. if cs_local_browser in aktmoduleswitches then
  1037. current_module^.localsymtable:=refsymtable;
  1038. { Write out the ppufile }
  1039. {$ifdef Test_Double_checksum}
  1040. store_crc:=current_module^.interface_crc;
  1041. {$endif Test_Double_checksum}
  1042. if (Errorcount=0) then
  1043. writeunitas(current_module^.ppufilename^,punitsymtable(symtablestack),false);
  1044. {$ifdef Test_Double_checksum}
  1045. if store_crc<>current_module^.interface_crc then
  1046. Def_comment(V_Warning,current_module^.ppufilename^+' CRC changed '+
  1047. tostr(store_crc)+'<>'+tostr(current_module^.interface_crc));
  1048. {$endif def Test_Double_checksum}
  1049. { must be done only after local symtable ref stores !! }
  1050. closecurrentppu;
  1051. {$ifdef GDB}
  1052. pu:=pused_unit(usedunits.first);
  1053. while assigned(pu) do
  1054. begin
  1055. if assigned(pu^.u^.globalsymtable) then
  1056. punitsymtable(pu^.u^.globalsymtable)^.is_stab_written:=false;
  1057. pu:=pused_unit(pu^.next);
  1058. end;
  1059. {$endif GDB}
  1060. { remove static symtable (=refsymtable) here to save some mem }
  1061. if not (cs_local_browser in aktmoduleswitches) then
  1062. begin
  1063. dispose(st,done);
  1064. current_module^.localsymtable:=nil;
  1065. end;
  1066. if is_assembler_generated then
  1067. begin
  1068. { finish asmlist by adding segment starts }
  1069. insertsegment;
  1070. { assemble }
  1071. create_objectfile;
  1072. end;
  1073. { leave when we got an error }
  1074. if (Errorcount>0) and not status.skip_error then
  1075. begin
  1076. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1077. status.skip_error:=true;
  1078. exit;
  1079. end;
  1080. end;
  1081. procedure proc_program(islibrary : boolean);
  1082. var
  1083. st : psymtable;
  1084. hp : pmodule;
  1085. names : Tstringcontainer;
  1086. begin
  1087. DLLsource:=islibrary;
  1088. parse_only:=false;
  1089. if islibrary then
  1090. begin
  1091. consume(_LIBRARY);
  1092. stringdispose(current_module^.modulename);
  1093. current_module^.modulename:=stringdup(pattern);
  1094. current_module^.islibrary:=true;
  1095. exportlib^.preparelib(pattern);
  1096. consume(ID);
  1097. consume(SEMICOLON);
  1098. end
  1099. else
  1100. { is there an program head ? }
  1101. if token=_PROGRAM then
  1102. begin
  1103. consume(_PROGRAM);
  1104. stringdispose(current_module^.modulename);
  1105. current_module^.modulename:=stringdup(pattern);
  1106. consume(ID);
  1107. if token=LKLAMMER then
  1108. begin
  1109. consume(LKLAMMER);
  1110. idlist;
  1111. consume(RKLAMMER);
  1112. end;
  1113. consume(SEMICOLON);
  1114. end;
  1115. { global switches are read, so further changes aren't allowed }
  1116. current_module^.in_global:=false;
  1117. { can't have local browser when no global browser }
  1118. if (cs_local_browser in aktmoduleswitches) and
  1119. not(cs_browser in aktmoduleswitches) then
  1120. aktmoduleswitches:=aktmoduleswitches-[cs_local_browser];
  1121. { set implementation flag }
  1122. current_module^.in_implementation:=true;
  1123. { insert after the unit symbol tables the static symbol table }
  1124. { of the program }
  1125. st:=new(punitsymtable,init(staticsymtable,current_module^.modulename^));
  1126. current_module^.localsymtable:=st;
  1127. symtablestack:=st;
  1128. refsymtable:=st;
  1129. { necessary for browser }
  1130. loaded_units.insert(current_module);
  1131. { load standard units (system,objpas,profile unit) }
  1132. loaddefaultunits;
  1133. { reset }
  1134. lexlevel:=0;
  1135. {Load the units used by the program we compile.}
  1136. if token=_USES then
  1137. loadunits;
  1138. { reset ranges/stabs in exported definitions }
  1139. reset_global_defs;
  1140. { All units are read, now give them a number }
  1141. numberunits;
  1142. {Insert the name of the main program into the symbol table.}
  1143. if current_module^.modulename^<>'' then
  1144. {st^.insert(new(pprogramsym,init(current_module^.modulename^)));}
  1145. st^.insert(new(punitsym,init(current_module^.modulename^,punitsymtable(st))));
  1146. { ...is also constsymtable, this is the symtable where }
  1147. { the elements of enumeration types are inserted }
  1148. constsymtable:=st;
  1149. { Generate a procsym for main }
  1150. gen_main_procsym('main',potype_proginit,st);
  1151. { reset }
  1152. procprefix:='';
  1153. {The program intialization needs an alias, so it can be called
  1154. from the bootstrap code.}
  1155. codegen_newprocedure;
  1156. names.init;
  1157. names.insert('program_init');
  1158. names.insert('PASCALMAIN');
  1159. names.insert(target_os.cprefix+'main');
  1160. {$ifdef m68k}
  1161. if target_info.target=target_m68k_PalmOS then
  1162. names.insert('PilotMain');
  1163. {$endif}
  1164. compile_proc_body(names,true,false);
  1165. names.done;
  1166. { avoid self recursive destructor call !! PM }
  1167. aktprocsym^.definition^.localst:=nil;
  1168. { consider these symbols as global ones }
  1169. { for browser }
  1170. current_module^.globalsymtable:=current_module^.localsymtable;
  1171. current_module^.localsymtable:=nil;
  1172. codegen_doneprocedure;
  1173. { consume the last point }
  1174. consume(POINT);
  1175. {$ifdef New_GDB}
  1176. write_gdb_info;
  1177. {$endIf Def New_GDB}
  1178. { leave when we got an error }
  1179. if (Errorcount>0) and not status.skip_error then
  1180. begin
  1181. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1182. status.skip_error:=true;
  1183. exit;
  1184. end;
  1185. { generate imports }
  1186. if current_module^.uses_imports then
  1187. importlib^.generatelib;
  1188. if islibrary then
  1189. exportlib^.generatelib;
  1190. { insert heap }
  1191. insertresourcestrings;
  1192. insertinitfinaltable;
  1193. insertheap;
  1194. inserttargetspecific;
  1195. datasize:=symtablestack^.datasize;
  1196. { finish asmlist by adding segment starts }
  1197. insertsegment;
  1198. { insert own objectfile }
  1199. insertobjectfile;
  1200. { assemble and link }
  1201. create_objectfile;
  1202. { leave when we got an error }
  1203. if (Errorcount>0) and not status.skip_error then
  1204. begin
  1205. Message1(unit_f_errors_in_unit,tostr(Errorcount));
  1206. status.skip_error:=true;
  1207. exit;
  1208. end;
  1209. { create the executable when we are at level 1 }
  1210. if (compile_level=1) then
  1211. begin
  1212. { insert all .o files from all loaded units }
  1213. hp:=pmodule(loaded_units.first);
  1214. while assigned(hp) do
  1215. begin
  1216. Linker.AddModuleFiles(hp);
  1217. hp:=pmodule(hp^.next);
  1218. end;
  1219. { write .def file }
  1220. if (cs_link_deffile in aktglobalswitches) then
  1221. deffile.writefile;
  1222. { finally we can create a executable }
  1223. if (not current_module^.is_unit) then
  1224. Linker.MakeExecutable;
  1225. end;
  1226. end;
  1227. end.
  1228. {
  1229. $Log$
  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. }