parser.pas 28 KB

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