pmodules.pas 65 KB

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