pmodules.pas 67 KB

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