parser.pas 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. This unit does the parsing process
  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. {$ifdef tp}
  19. {$E+,N+,D+,F+}
  20. {$endif}
  21. unit parser;
  22. interface
  23. procedure compile(const filename:string;compile_system:boolean);
  24. procedure initparser;
  25. implementation
  26. uses
  27. dos,objects,cobjects,globals,scanner,systems,symtable,tree,aasm,
  28. types,strings,pass_1,hcodegen,files,verbose,script,import
  29. {$ifdef i386}
  30. ,i386
  31. ,cgi386
  32. ,cgai386
  33. ,tgeni386
  34. ,aopt386
  35. {$endif i386}
  36. {$ifdef m68k}
  37. ,m68k
  38. ,cg68k
  39. ,tgen68k
  40. ,cga68k
  41. {$endif m68k}
  42. { parser units }
  43. ,pbase,pmodules,pdecl,
  44. { assembling & linking }
  45. assemble,
  46. link;
  47. { dummy variable for search when calling exec }
  48. var
  49. file_found : boolean;
  50. procedure readconstdefs;
  51. begin
  52. s32bitdef:=porddef(globaldef('longint'));
  53. u32bitdef:=porddef(globaldef('ulong'));
  54. cstringdef:=pstringdef(globaldef('string'));
  55. {$ifdef UseLongString}
  56. clongstringdef:=pstringdef(globaldef('longstring'));
  57. {$endif UseLongString}
  58. {$ifdef UseAnsiString}
  59. cansistringdef:=pstringdef(globaldef('ansistring'));
  60. {$endif UseAnsiString}
  61. cchardef:=porddef(globaldef('char'));
  62. {$ifdef i386}
  63. c64floatdef:=pfloatdef(globaldef('s64real'));
  64. {$endif}
  65. {$ifdef m68k}
  66. c64floatdef:=pfloatdef(globaldef('s32real'));
  67. {$endif m68k}
  68. s80floatdef:=pfloatdef(globaldef('s80real'));
  69. s32fixeddef:=pfloatdef(globaldef('cs32fixed'));
  70. voiddef:=porddef(globaldef('void'));
  71. u8bitdef:=porddef(globaldef('byte'));
  72. u16bitdef:=porddef(globaldef('word'));
  73. booldef:=porddef(globaldef('boolean'));
  74. voidpointerdef:=ppointerdef(globaldef('void_pointer'));
  75. cfiledef:=pfiledef(globaldef('file'));
  76. end;
  77. procedure initparser;
  78. begin
  79. forwardsallowed:=false;
  80. { ^M means a string or a char, because we don't parse a }
  81. { type declaration }
  82. block_type:=bt_general;
  83. ignore_equal:=false;
  84. { we didn't parse a object or class declaration }
  85. { and no function header }
  86. testcurobject:=0;
  87. { create error defintion }
  88. generrordef:=new(perrordef,init);
  89. symtablestack:=nil;
  90. { a long time, this was forgotten }
  91. aktprocsym:=nil;
  92. current_module:=nil;
  93. loaded_units.init;
  94. usedunits.init;
  95. end;
  96. { moved out to save stack }
  97. var
  98. addparam : string;
  99. procedure compile(const filename:string;compile_system:boolean);
  100. var
  101. hp : pmodule;
  102. comp_unit : boolean;
  103. { some variables to save the compiler state }
  104. oldtoken : ttoken;
  105. oldpattern : stringid;
  106. oldpreprocstack : ppreprocstack;
  107. oldorgpattern,oldprocprefix : string;
  108. old_block_type : tblock_type;
  109. oldinputbuffer : pchar;
  110. oldinputpointer : longint;
  111. olds_point,oldparse_only : boolean;
  112. oldc : char;
  113. oldcomment_level : word;
  114. oldimports,oldexports,oldresource,
  115. oldbsssegment,olddatasegment,oldcodesegment,
  116. oldexprasmlist,olddebuglist,
  117. oldinternals,oldexternals,oldconsts : paasmoutput;
  118. oldnextlabelnr : longint;
  119. oldswitches : Tcswitches;
  120. oldmacros,oldrefsymtable,oldsymtablestack : psymtable;
  121. procedure def_macro(const s : string);
  122. var
  123. mac : pmacrosym;
  124. begin
  125. mac:=pmacrosym(macros^.search(s));
  126. if mac=nil then
  127. begin
  128. mac:=new(pmacrosym,init(s));
  129. Message1(parser_m_macro_defined,mac^.name);
  130. macros^.insert(mac);
  131. end;
  132. mac^.defined:=true;
  133. end;
  134. procedure set_macro(const s : string;value : string);
  135. var
  136. mac : pmacrosym;
  137. begin
  138. mac:=pmacrosym(macros^.search(s));
  139. if mac=nil then
  140. begin
  141. mac:=new(pmacrosym,init(s));
  142. macros^.insert(mac);
  143. end
  144. else
  145. begin
  146. if assigned(mac^.buftext) then
  147. freemem(mac^.buftext,mac^.buflen);
  148. end;
  149. Message2(parser_m_macro_set_to,mac^.name,value);
  150. mac^.buflen:=length(value);
  151. getmem(mac^.buftext,mac^.buflen);
  152. move(value[1],mac^.buftext^,mac^.buflen);
  153. mac^.defined:=true;
  154. end;
  155. procedure define_macros;
  156. var
  157. hp : pstring_item;
  158. begin
  159. hp:=pstring_item(commandlinedefines.first);
  160. while assigned(hp) do
  161. begin
  162. def_macro(hp^.str^);
  163. hp:=pstring_item(hp^.next);
  164. end;
  165. { set macros for version checking }
  166. set_macro('FPC_VERSION',version_nr);
  167. set_macro('FPC_RELEASE',release_nr);
  168. set_macro('FPC_PATCH',patch_nr);
  169. end;
  170. var
  171. a : PAsmFile;
  172. g : file;
  173. ftime : longint;
  174. label
  175. done;
  176. begin {compile}
  177. inc(compile_level);
  178. { save old state }
  179. { save symtable state }
  180. oldsymtablestack:=symtablestack;
  181. symtablestack:=nil;
  182. oldrefsymtable:=refsymtable;
  183. refsymtable:=nil;
  184. oldprocprefix:=procprefix;
  185. { a long time, this was only in init_parser
  186. but it should be reset to zero for each module }
  187. aktprocsym:=nil;
  188. { first, we assume a program }
  189. if not(assigned(current_module)) then
  190. begin
  191. {!!!}
  192. current_module:=new(pmodule,init(filename,false));
  193. main_module:=current_module;
  194. end;
  195. { reset flags }
  196. current_module^.flags:=0;
  197. { ... and crc }
  198. current_module^.crc:=0;
  199. { save scanner state }
  200. oldmacros:=macros;
  201. oldpattern:=pattern;
  202. oldtoken:=token;
  203. oldorgpattern:=orgpattern;
  204. old_block_type:=block_type;
  205. oldpreprocstack:=preprocstack;
  206. oldinputbuffer:=inputbuffer;
  207. oldinputpointer:=inputpointer;
  208. olds_point:=s_point;
  209. oldc:=c;
  210. oldcomment_level:=comment_level;
  211. oldparse_only:=parse_only;
  212. { save assembler lists }
  213. olddatasegment:=datasegment;
  214. oldbsssegment:=bsssegment;
  215. oldcodesegment:=codesegment;
  216. olddebuglist:=debuglist;
  217. oldexternals:=externals;
  218. oldinternals:=internals;
  219. oldconsts:=consts;
  220. oldexprasmlist:=exprasmlist;
  221. oldimports:=importssection;
  222. oldexports:=exportssection;
  223. oldresource:=resourcesection;
  224. oldswitches:=aktswitches;
  225. oldnextlabelnr:=nextlabelnr;
  226. Message1(parser_i_compiling,filename);
  227. InitScanner(filename);
  228. aktswitches:=initswitches;
  229. { we need this to make the system unit }
  230. if compile_system then
  231. aktswitches:=aktswitches+[cs_compilesystem];
  232. aktpackrecords:=initpackrecords;
  233. { init code generator for a new module }
  234. codegen_newmodule;
  235. macros:=new(psymtable,init(macrosymtable));
  236. define_macros;
  237. { startup scanner }
  238. token:=yylex;
  239. { init asm writing }
  240. datasegment:=new(paasmoutput,init);
  241. codesegment:=new(paasmoutput,init);
  242. bsssegment:=new(paasmoutput,init);
  243. debuglist:=new(paasmoutput,init);
  244. externals:=new(paasmoutput,init);
  245. internals:=new(paasmoutput,init);
  246. consts:=new(paasmoutput,init);
  247. importssection:=nil;
  248. exportssection:=nil;
  249. resourcesection:=nil;
  250. { global switches are read, so further changes aren't allowed }
  251. current_module^.in_main:=true;
  252. { open assembler response }
  253. if (compile_level=1) then
  254. AsmRes.Init('ppas');
  255. { if the current file isn't a system unit }
  256. { the the system unit will be loaded }
  257. if not(cs_compilesystem in aktswitches) then
  258. begin
  259. { should be done in unit system (changing the field system_unit)
  260. FK
  261. }
  262. hp:=loadunit(upper(target_info.system_unit),true,true);
  263. systemunit:=hp^.symtable;
  264. readconstdefs;
  265. { we could try to overload caret by default }
  266. symtablestack:=systemunit;
  267. { if POWER is defined in the RTL then use it for caret overloading }
  268. getsym('POWER',false);
  269. if assigned(srsym) and (srsym^.typ=procsym) and
  270. (overloaded_operators[CARET]=nil) then
  271. overloaded_operators[CARET]:=pprocsym(srsym);
  272. end
  273. else
  274. begin
  275. { create definitions for constants }
  276. registerdef:=false;
  277. s32bitdef:=new(porddef,init(s32bit,$80000000,$7fffffff));
  278. u32bitdef:=new(porddef,init(u32bit,0,$ffffffff));
  279. cstringdef:=new(pstringdef,init(255));
  280. { should we give a length to the default long and ansi string definition ?? }
  281. {$ifdef UseLongString}
  282. clongstringdef:=new(pstringdef,longinit(-1));
  283. {$endif UseLongString}
  284. {$ifdef UseAnsiString}
  285. cansistringdef:=new(pstringdef,ansiinit(-1));
  286. {$endif UseAnsiString}
  287. cchardef:=new(porddef,init(uchar,0,255));
  288. {$ifdef i386}
  289. c64floatdef:=new(pfloatdef,init(s64real));
  290. s80floatdef:=new(pfloatdef,init(s80real));
  291. {$endif}
  292. {$ifdef m68k}
  293. c64floatdef:=new(pfloatdef,init(s32real));
  294. if (cs_fp_emulation in aktswitches) then
  295. s80floatdef:=new(pfloatdef,init(s32real))
  296. else
  297. s80floatdef:=new(pfloatdef,init(s80real));
  298. {$endif}
  299. s32fixeddef:=new(pfloatdef,init(f32bit));
  300. { some other definitions }
  301. voiddef:=new(porddef,init(uvoid,0,0));
  302. u8bitdef:=new(porddef,init(u8bit,0,255));
  303. u16bitdef:=new(porddef,init(u16bit,0,65535));
  304. booldef:=new(porddef,init(bool8bit,0,1));
  305. voidpointerdef:=new(ppointerdef,init(voiddef));
  306. cfiledef:=new(pfiledef,init(ft_untyped,nil));
  307. systemunit:=nil;
  308. end;
  309. registerdef:=true;
  310. { current return type is void }
  311. procinfo.retdef:=voiddef;
  312. { reset lexical level }
  313. lexlevel:=0;
  314. { parse source }
  315. {***BUGFIX}
  316. if (token=_UNIT) or (compile_level>1) then
  317. begin
  318. {If the compile level > 1 we get a nice "unit expected" error
  319. message if we are trying to use a program as unit.}
  320. proc_unit;
  321. if current_module^.compiled then
  322. goto done;
  323. comp_unit:=true;
  324. end
  325. else
  326. begin
  327. proc_program(token=_LIBRARY);
  328. comp_unit:=false;
  329. end;
  330. { Why? The definition of Pascal requires that everything
  331. after 'end.' is ignored!
  332. if not(cs_tp_compatible in aktswitches) then
  333. consume(_EOF); }
  334. if errorcount=0 then
  335. begin
  336. if current_module^.uses_imports then
  337. importlib^.generatelib;
  338. a:=new(PAsmFile,Init(filename));
  339. a^.WriteAsmSource;
  340. a^.DoAssemble;
  341. dispose(a,Done);
  342. { Check linking => we are at first level in compile }
  343. if (compile_level=1) then
  344. begin
  345. if Linker.ExeName='' then
  346. Linker.SetFileName(FileName);
  347. if (comp_unit) then
  348. begin
  349. Linker.Make_Library;
  350. end
  351. else
  352. begin
  353. if (cs_no_linking in initswitches) then
  354. externlink:=true;
  355. Linker.Link;
  356. end;
  357. end;
  358. end
  359. else
  360. begin
  361. Message1(unit_e_total_errors,tostr(errorcount));
  362. Message(unit_f_errors_in_unit);
  363. end;
  364. { clear memory }
  365. {$ifdef Splitheap}
  366. if testsplit then
  367. begin
  368. { temp heap should be empty after that !!!}
  369. codegen_donemodule;
  370. Releasetempheap;
  371. end;
  372. {else
  373. codegen_donemodule;}
  374. {$endif Splitheap}
  375. { restore old state }
  376. { if already compiled jumps directly here }
  377. done:
  378. { close trees }
  379. {$ifdef disposetree}
  380. dispose(datasegment,Done);
  381. dispose(codesegment,Done);
  382. dispose(bsssegment,Done);
  383. dispose(debuglist,Done);
  384. dispose(externals,Done);
  385. dispose(internals,Done);
  386. dispose(consts,Done);
  387. {$endif}
  388. { restore symtable state }
  389. {$ifdef UseBrowser}
  390. if (compile_level>1) then
  391. { we want to keep the current symtablestack }
  392. {$endif UseBrowser}
  393. begin
  394. refsymtable:=oldrefsymtable;
  395. symtablestack:=oldsymtablestack;
  396. end;
  397. procprefix:=oldprocprefix;
  398. { close the inputfiles }
  399. {$ifndef UseBrowser}
  400. { but not if we want the names for the browser ! }
  401. current_module^.sourcefiles.done;
  402. {$endif not UseBrowser}
  403. { restore scanner state }
  404. pattern:=oldpattern;
  405. token:=oldtoken;
  406. orgpattern:=oldorgpattern;
  407. block_type:=old_block_type;
  408. { call donescanner before restoring preprocstack, because }
  409. { donescanner tests for a empty preprocstack }
  410. { and can also check for unused macros }
  411. donescanner(current_module^.compiled);
  412. dispose(macros,done);
  413. macros:=oldmacros;
  414. preprocstack:=oldpreprocstack;
  415. aktswitches:=oldswitches;
  416. inputbuffer:=oldinputbuffer;
  417. inputpointer:=oldinputpointer;
  418. s_point:=olds_point;
  419. c:=oldc;
  420. comment_level:=oldcomment_level;
  421. parse_only:=oldparse_only;
  422. { restore asmlists }
  423. datasegment:=olddatasegment;
  424. bsssegment:=oldbsssegment;
  425. codesegment:=oldcodesegment;
  426. debuglist:=olddebuglist;
  427. externals:=oldexternals;
  428. internals:=oldinternals;
  429. importssection:=oldimports;
  430. exportssection:=oldexports;
  431. resourcesection:=oldresource;
  432. nextlabelnr:=oldnextlabelnr;
  433. exprasmlist:=oldexprasmlist;
  434. consts:=oldconsts;
  435. nextlabelnr:=oldnextlabelnr;
  436. reset_gdb_info;
  437. if (compile_level=1) then
  438. begin
  439. if (not AsmRes.Empty) then
  440. begin
  441. Message1(exec_i_closing_script,AsmRes.Fn);
  442. AsmRes.WriteToDisk;
  443. end;
  444. end;
  445. dec(compile_level);
  446. end;
  447. end.
  448. {
  449. $Log$
  450. Revision 1.3 1998-04-07 22:45:04 florian
  451. * bug0092, bug0115 and bug0121 fixed
  452. + packed object/class/array
  453. Revision 1.2 1998/03/26 11:18:30 florian
  454. - switch -Sa removed
  455. - support of a:=b:=0 removed
  456. Revision 1.1.1.1 1998/03/25 11:18:12 root
  457. * Restored version
  458. Revision 1.60 1998/03/24 21:48:32 florian
  459. * just a couple of fixes applied:
  460. - problem with fixed16 solved
  461. - internalerror 10005 problem fixed
  462. - patch for assembler reading
  463. - small optimizer fix
  464. - mem is now supported
  465. Revision 1.59 1998/03/20 23:31:33 florian
  466. * bug0113 fixed
  467. * problem with interdepened units fixed ("options.pas problem")
  468. * two small extensions for future AMD 3D support
  469. Revision 1.58 1998/03/13 22:45:58 florian
  470. * small bug fixes applied
  471. Revision 1.57 1998/03/10 17:19:29 peter
  472. * fixed bug0108
  473. * better linebreak scanning (concentrated in nextchar(), it supports
  474. #10, #13, #10#13, #13#10
  475. Revision 1.56 1998/03/10 16:27:40 pierre
  476. * better line info in stabs debug
  477. * symtabletype and lexlevel separated into two fields of tsymtable
  478. + ifdef MAKELIB for direct library output, not complete
  479. + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
  480. working
  481. + ifdef TESTFUNCRET for setting func result in underfunction, not
  482. working
  483. Revision 1.55 1998/03/10 12:54:06 peter
  484. * def_symbol renamed to def_macro and use it in defines_macros
  485. Revision 1.54 1998/03/10 01:17:22 peter
  486. * all files have the same header
  487. * messages are fully implemented, EXTDEBUG uses Comment()
  488. + AG... files for the Assembler generation
  489. Revision 1.53 1998/03/06 00:52:34 peter
  490. * replaced all old messages from errore.msg, only ExtDebug and some
  491. Comment() calls are left
  492. * fixed options.pas
  493. Revision 1.52 1998/03/02 16:00:37 peter
  494. * -Ch works again
  495. Revision 1.51 1998/03/02 13:38:44 peter
  496. + importlib object
  497. * doesn't crash on a systemunit anymore
  498. * updated makefile and depend
  499. Revision 1.49 1998/02/28 00:20:31 florian
  500. * more changes to get import libs for Win32 working
  501. Revision 1.48 1998/02/27 22:27:56 florian
  502. + win_targ unit
  503. + support of sections
  504. + new asmlists: sections, exports and resource
  505. Revision 1.47 1998/02/24 10:29:17 peter
  506. * -a works again
  507. Revision 1.46 1998/02/24 00:19:14 peter
  508. * makefile works again (btw. linux does like any char after a \ )
  509. * removed circular unit with assemble and files
  510. * fixed a sigsegv in pexpr
  511. * pmodule init unit/program is the almost the same, merged them
  512. Revision 1.45 1998/02/22 23:03:25 peter
  513. * renamed msource->mainsource and name->unitname
  514. * optimized filename handling, filename is not seperate anymore with
  515. path+name+ext, this saves stackspace and a lot of fsplit()'s
  516. * recompiling of some units in libraries fixed
  517. * shared libraries are working again
  518. + $LINKLIB <lib> to support automatic linking to libraries
  519. + libraries are saved/read from the ppufile, also allows more libraries
  520. per ppufile
  521. Revision 1.44 1998/02/19 00:11:04 peter
  522. * fixed -g to work again
  523. * fixed some typos with the scriptobject
  524. Revision 1.43 1998/02/18 13:48:12 michael
  525. + Implemented an OS independent AsmRes object.
  526. Revision 1.42 1998/02/17 21:20:54 peter
  527. + Script unit
  528. + __EXIT is called again to exit a program
  529. - target_info.link/assembler calls
  530. * linking works again for dos
  531. * optimized a few filehandling functions
  532. * fixed stabs generation for procedures
  533. Revision 1.41 1998/02/16 12:51:35 michael
  534. + Implemented linker object
  535. Revision 1.40 1998/02/15 21:16:25 peter
  536. * all assembler outputs supported by assemblerobject
  537. * cleanup with assembleroutputs, better .ascii generation
  538. * help_constructor/destructor are now added to the externals
  539. - generation of asmresponse is not outputformat depended
  540. Revision 1.39 1998/02/14 01:45:26 peter
  541. * more fixes
  542. - pmode target is removed
  543. - search_as_ld is removed, this is done in the link.pas/assemble.pas
  544. + findexe() to search for an executable (linker,assembler,binder)
  545. Revision 1.38 1998/02/13 22:26:33 peter
  546. * fixed a few SigSegv's
  547. * INIT$$ was not written for linux!
  548. * assembling and linking works again for linux and dos
  549. + assembler object, only attasmi3 supported yet
  550. * restore pp.pas with AddPath etc.
  551. Revision 1.37 1998/02/13 10:35:17 daniel
  552. * Made Motorola version compilable.
  553. * Fixed optimizer
  554. Revision 1.36 1998/02/12 17:19:12 florian
  555. * fixed to get remake3 work, but needs additional fixes (output, I don't like
  556. also that aktswitches isn't a pointer)
  557. Revision 1.35 1998/02/12 11:50:16 daniel
  558. Yes! Finally! After three retries, my patch!
  559. Changes:
  560. Complete rewrite of psub.pas.
  561. Added support for DLL's.
  562. Compiler requires less memory.
  563. Platform units for each platform.
  564. Revision 1.34 1998/02/02 11:47:36 pierre
  565. + compilation stops at unit with error
  566. Revision 1.33 1998/02/01 22:41:08 florian
  567. * clean up
  568. + system.assigned([class])
  569. + system.assigned([class of xxxx])
  570. * first fixes of as and is-operator
  571. Revision 1.32 1998/01/30 17:31:23 pierre
  572. * bug of cyclic symtablestack fixed
  573. Revision 1.31 1998/01/29 12:13:21 michael
  574. * fixed Typos for library making
  575. Revision 1.30 1998/01/28 13:48:45 michael
  576. + Initial implementation for making libs from within FPC. Not tested, as compiler does not run
  577. Revision 1.29 1998/01/25 18:45:47 peter
  578. + Search for as and ld at startup
  579. + source_info works the same as target_info
  580. + externlink allows only external linking
  581. Revision 1.28 1998/01/23 21:14:59 carl
  582. * RunError 105 (file not open) with -Agas switch fix
  583. Revision 1.27 1998/01/23 17:55:11 michael
  584. + Moved linking stage to it's own unit (link.pas)
  585. Incorporated Pierres changes, but removed -E switch
  586. switch for not linking is now -Cn instead of -E
  587. Revision 1.26 1998/01/23 17:12:15 pierre
  588. * added some improvements for as and ld :
  589. - doserror and dosexitcode treated separately
  590. - PATH searched if doserror=2
  591. + start of long and ansi string (far from complete)
  592. in conditionnal UseLongString and UseAnsiString
  593. * options.pas cleaned (some variables shifted to globals)gl
  594. Revision 1.25 1998/01/22 14:47:16 michael
  595. + Reinstated linker options as -k option. How did they dissapear ?
  596. Revision 1.24 1998/01/17 01:57:36 michael
  597. + Start of shared library support. First working version.
  598. Revision 1.23 1998/01/16 22:34:37 michael
  599. * Changed 'conversation' to 'conversion'. Waayyy too much chatting going on
  600. in this compiler :)
  601. Revision 1.22 1998/01/14 12:52:04 michael
  602. - Removed the 'Assembled' line and replaced 'Calling Linker/assembler...'
  603. with 'Assembling/linking...'. Too much verbosity when V_info is on.
  604. Revision 1.21 1998/01/13 16:15:56 pierre
  605. * bug in interdependent units handling
  606. - primary unit was not in loaded_units list
  607. - current_module^.symtable was assigned too early
  608. - donescanner must not call error if the compilation
  609. of the unit was done at a higher level.
  610. Revision 1.20 1998/01/11 10:54:22 florian
  611. + generic library support
  612. Revision 1.19 1998/01/11 04:17:11 carl
  613. + correct heap and memory variables for m68k targets
  614. Revision 1.18 1998/01/08 23:56:39 florian
  615. * parser unit divided into several smaller units
  616. Revision 1.17 1998/01/08 17:10:12 florian
  617. * the name of the initialization part of a unit was sometimes written
  618. in lower case
  619. Revision 1.16 1998/01/07 00:16:56 michael
  620. Restored released version (plus fixes) as current
  621. Revision 1.13 1997/12/14 22:43:21 florian
  622. + command line switch -Xs for DOS (passes -s to the linker to strip symbols from
  623. executable)
  624. * some changes of Carl-Eric implemented
  625. Revision 1.12 1997/12/12 13:28:31 florian
  626. + version 0.99.0
  627. * all WASM options changed into MASM
  628. + -O2 for Pentium II optimizations
  629. Revision 1.11 1997/12/10 23:07:21 florian
  630. * bugs fixed: 12,38 (also m68k),39,40,41
  631. + warning if a system unit is without -Us compiled
  632. + warning if a method is virtual and private (was an error)
  633. * some indentions changed
  634. + factor does a better error recovering (omit some crashes)
  635. + problem with @type(x) removed (crashed the compiler)
  636. Revision 1.10 1997/12/09 13:50:36 carl
  637. * bugfix of possible alignment problems with m68k
  638. * bugfix of circular unit use -- could still give a stack overflow,
  639. so changed to fatalerror instead.
  640. * bugfix of nil procedural variables, fpc = @nil is illogical!
  641. (if was reversed!)
  642. Revision 1.9 1997/12/08 13:31:31 daniel
  643. * File was in DOS format. Translated to Unix.
  644. Revision 1.8 1997/12/08 10:01:08 pierre
  645. * nil for a procvar const was not allowed (os2_targ.pas not compilable)
  646. * bug in loadunit for units in implementation part already loaded
  647. (crashed on dos_targ.pas, thanks to Daniel who permitted me
  648. to find this bug out)
  649. Revision 1.7 1997/12/04 17:47:50 carl
  650. + renamed m68k units and refs to these units according to cpu rules.
  651. Revision 1.6 1997/12/02 15:56:13 carl
  652. * bugfix of postfixoperator with pd =nil
  653. * bugfix of motorola instructions types for exit code.
  654. Revision 1.5 1997/12/01 18:14:33 pierre
  655. * fixes a bug in nasm output due to my previous changes
  656. Revision 1.3 1997/11/28 18:14:40 pierre
  657. working version with several bug fixes
  658. Revision 1.2 1997/11/27 17:59:46 carl
  659. * made it compile under BP (line too long errors)
  660. Revision 1.1.1.1 1997/11/27 08:32:57 michael
  661. FPC Compiler CVS start
  662. Pre-CVS log:
  663. CEC Carl-Eric Codere
  664. FK Florian Klaempfl
  665. PM Pierre Muller
  666. + feature added
  667. - removed
  668. * bug fixed or changed
  669. History (started with version 0.9.0):
  670. 5th november 1996:
  671. * adapted to 0.9.0
  672. 25th november 1996:
  673. * more stuff adapted
  674. 9th december 1996:
  675. + support for different inline assemblers added (FK)
  676. 22th september:
  677. + support for PACKED RECORD implemented (FK)
  678. 24th september:
  679. + internal support of system.seg added (FK)
  680. * system.ofs bug fixed (FK)
  681. * problem with compiler switches solved (see also pass_1.pas) (FK)
  682. * all aktswitch memory is now recoverd (see also scanner.pas) (FK)
  683. 24th september 1997:
  684. * bug in ESI offset, pushed only if not nested, changed in cgi386.pas in v93 by (FK)
  685. but forgotten here (PM)
  686. 25th september:
  687. + parsing of open arrays implemented (FK)
  688. + parsing of high and low implemented (FK)
  689. + open array support also for proc vars added (FK)
  690. 1th october:
  691. * in typed constants is now the conversion int -> real
  692. automatically done (FK)
  693. 3rd october 1997:
  694. + started conversion to motorola 68000 - ifdef m68k to find
  695. changes (this makes the code look horrible, may later separate
  696. in includes?) - look for all ifdef i386 and ifdef m68k to see
  697. changes. (CEC)
  698. - commented out regnames (was unused) (CEC)
  699. + peepholeopt put in i386 define (not yet available for motorola
  700. 68000) (CEC)
  701. + i386 defines around a_att, in a_o and around a_wasm, a_nasm (CEC).
  702. + code for in_ord_x (PM)
  703. 4th october 1997:
  704. + checking for double definitions of function/procedure
  705. with same parameters in interface (PM)
  706. + enums with jumps set the boolean has_jumps and
  707. disable the succ and pred use (PM)
  708. 9th october 1997:
  709. * Fixed problem with 80float on the 68000 output, caused a GPF (CEC).
  710. 13th october 1997:
  711. + Added support for Motorola Standard assembler. (CEC)
  712. 15th october 1997:
  713. + added code for static modifier for objects variables and methods
  714. controlled by -St switch at command line (PM)
  715. 17th october 1997:
  716. + Added support for Motorola inline assembler (CEC)
  717. * Bugfix with .align 4,0x90, this is NOT allowed in TASM/MASM/WASM (CEC).
  718. + procedure set_macro and setting of fpc_* macros (FK)
  719. 19th october 1997:
  720. * Bugfix of RTS on 68000 target. PC Counter would become corrupt
  721. with paramsize (CEC).
  722. 23th october 1997:
  723. * Small bugfixes concerning SUBI #const,address_reg (CEC).
  724. 24th october 1997:
  725. * array[boolean] works now (FK)
  726. 25th october 1997:
  727. + CDECL and STDCALL (FK)
  728. * ASSEMBLER isn't a keyword anymore (FK)
  729. 3rd november 1997:
  730. + added symdif for sets (PM)
  731. 5th november 1997:
  732. * changed all while token<>ATOKEN do consume(token);
  733. by a procedure call consume_all_untill(ATOKEN)
  734. to test for _EOF (PM)
  735. * aktobjectname was not reset to '' at the end of objectcomponenten (PM)
  736. 14th november 1997:
  737. * removed bug for procvar where the type was not allways set correctly (PM)
  738. + integer const not in longint range converted to real constant (PM)
  739. 25th november 1997:
  740. * removed bugs due to wrong current_module references in compile procedure (PM)
  741. }