parser.pas 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  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. if dispose_asm_lists then
  380. begin
  381. dispose(datasegment,Done);
  382. dispose(codesegment,Done);
  383. dispose(bsssegment,Done);
  384. dispose(debuglist,Done);
  385. dispose(externals,Done);
  386. dispose(internals,Done);
  387. dispose(consts,Done);
  388. end;
  389. { restore symtable state }
  390. {$ifdef UseBrowser}
  391. if (compile_level>1) then
  392. { we want to keep the current symtablestack }
  393. {$endif UseBrowser}
  394. begin
  395. refsymtable:=oldrefsymtable;
  396. symtablestack:=oldsymtablestack;
  397. end;
  398. procprefix:=oldprocprefix;
  399. { close the inputfiles }
  400. {$ifndef UseBrowser}
  401. { but not if we want the names for the browser ! }
  402. current_module^.sourcefiles.done;
  403. {$endif not UseBrowser}
  404. { restore scanner state }
  405. pattern:=oldpattern;
  406. token:=oldtoken;
  407. orgpattern:=oldorgpattern;
  408. block_type:=old_block_type;
  409. { call donescanner before restoring preprocstack, because }
  410. { donescanner tests for a empty preprocstack }
  411. { and can also check for unused macros }
  412. donescanner(current_module^.compiled);
  413. dispose(macros,done);
  414. macros:=oldmacros;
  415. preprocstack:=oldpreprocstack;
  416. aktswitches:=oldswitches;
  417. inputbuffer:=oldinputbuffer;
  418. inputpointer:=oldinputpointer;
  419. s_point:=olds_point;
  420. c:=oldc;
  421. comment_level:=oldcomment_level;
  422. parse_only:=oldparse_only;
  423. { restore asmlists }
  424. datasegment:=olddatasegment;
  425. bsssegment:=oldbsssegment;
  426. codesegment:=oldcodesegment;
  427. debuglist:=olddebuglist;
  428. externals:=oldexternals;
  429. internals:=oldinternals;
  430. importssection:=oldimports;
  431. exportssection:=oldexports;
  432. resourcesection:=oldresource;
  433. nextlabelnr:=oldnextlabelnr;
  434. exprasmlist:=oldexprasmlist;
  435. consts:=oldconsts;
  436. nextlabelnr:=oldnextlabelnr;
  437. reset_gdb_info;
  438. if (compile_level=1) then
  439. begin
  440. if (not AsmRes.Empty) then
  441. begin
  442. Message1(exec_i_closing_script,AsmRes.Fn);
  443. AsmRes.WriteToDisk;
  444. end;
  445. end;
  446. dec(compile_level);
  447. end;
  448. end.
  449. {
  450. $Log$
  451. Revision 1.4 1998-04-08 16:58:03 pierre
  452. * several bugfixes
  453. ADD ADC and AND are also sign extended
  454. nasm output OK (program still crashes at end
  455. and creates wrong assembler files !!)
  456. procsym types sym in tdef removed !!
  457. Revision 1.3 1998/04/07 22:45:04 florian
  458. * bug0092, bug0115 and bug0121 fixed
  459. + packed object/class/array
  460. Revision 1.2 1998/03/26 11:18:30 florian
  461. - switch -Sa removed
  462. - support of a:=b:=0 removed
  463. Revision 1.1.1.1 1998/03/25 11:18:12 root
  464. * Restored version
  465. Revision 1.60 1998/03/24 21:48:32 florian
  466. * just a couple of fixes applied:
  467. - problem with fixed16 solved
  468. - internalerror 10005 problem fixed
  469. - patch for assembler reading
  470. - small optimizer fix
  471. - mem is now supported
  472. Revision 1.59 1998/03/20 23:31:33 florian
  473. * bug0113 fixed
  474. * problem with interdepened units fixed ("options.pas problem")
  475. * two small extensions for future AMD 3D support
  476. Revision 1.58 1998/03/13 22:45:58 florian
  477. * small bug fixes applied
  478. Revision 1.57 1998/03/10 17:19:29 peter
  479. * fixed bug0108
  480. * better linebreak scanning (concentrated in nextchar(), it supports
  481. #10, #13, #10#13, #13#10
  482. Revision 1.56 1998/03/10 16:27:40 pierre
  483. * better line info in stabs debug
  484. * symtabletype and lexlevel separated into two fields of tsymtable
  485. + ifdef MAKELIB for direct library output, not complete
  486. + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
  487. working
  488. + ifdef TESTFUNCRET for setting func result in underfunction, not
  489. working
  490. Revision 1.55 1998/03/10 12:54:06 peter
  491. * def_symbol renamed to def_macro and use it in defines_macros
  492. Revision 1.54 1998/03/10 01:17:22 peter
  493. * all files have the same header
  494. * messages are fully implemented, EXTDEBUG uses Comment()
  495. + AG... files for the Assembler generation
  496. Revision 1.53 1998/03/06 00:52:34 peter
  497. * replaced all old messages from errore.msg, only ExtDebug and some
  498. Comment() calls are left
  499. * fixed options.pas
  500. Revision 1.52 1998/03/02 16:00:37 peter
  501. * -Ch works again
  502. Revision 1.51 1998/03/02 13:38:44 peter
  503. + importlib object
  504. * doesn't crash on a systemunit anymore
  505. * updated makefile and depend
  506. Revision 1.49 1998/02/28 00:20:31 florian
  507. * more changes to get import libs for Win32 working
  508. Revision 1.48 1998/02/27 22:27:56 florian
  509. + win_targ unit
  510. + support of sections
  511. + new asmlists: sections, exports and resource
  512. Revision 1.47 1998/02/24 10:29:17 peter
  513. * -a works again
  514. Revision 1.46 1998/02/24 00:19:14 peter
  515. * makefile works again (btw. linux does like any char after a \ )
  516. * removed circular unit with assemble and files
  517. * fixed a sigsegv in pexpr
  518. * pmodule init unit/program is the almost the same, merged them
  519. Revision 1.45 1998/02/22 23:03:25 peter
  520. * renamed msource->mainsource and name->unitname
  521. * optimized filename handling, filename is not seperate anymore with
  522. path+name+ext, this saves stackspace and a lot of fsplit()'s
  523. * recompiling of some units in libraries fixed
  524. * shared libraries are working again
  525. + $LINKLIB <lib> to support automatic linking to libraries
  526. + libraries are saved/read from the ppufile, also allows more libraries
  527. per ppufile
  528. Revision 1.44 1998/02/19 00:11:04 peter
  529. * fixed -g to work again
  530. * fixed some typos with the scriptobject
  531. Revision 1.43 1998/02/18 13:48:12 michael
  532. + Implemented an OS independent AsmRes object.
  533. Revision 1.42 1998/02/17 21:20:54 peter
  534. + Script unit
  535. + __EXIT is called again to exit a program
  536. - target_info.link/assembler calls
  537. * linking works again for dos
  538. * optimized a few filehandling functions
  539. * fixed stabs generation for procedures
  540. Revision 1.41 1998/02/16 12:51:35 michael
  541. + Implemented linker object
  542. Revision 1.40 1998/02/15 21:16:25 peter
  543. * all assembler outputs supported by assemblerobject
  544. * cleanup with assembleroutputs, better .ascii generation
  545. * help_constructor/destructor are now added to the externals
  546. - generation of asmresponse is not outputformat depended
  547. Revision 1.39 1998/02/14 01:45:26 peter
  548. * more fixes
  549. - pmode target is removed
  550. - search_as_ld is removed, this is done in the link.pas/assemble.pas
  551. + findexe() to search for an executable (linker,assembler,binder)
  552. Revision 1.38 1998/02/13 22:26:33 peter
  553. * fixed a few SigSegv's
  554. * INIT$$ was not written for linux!
  555. * assembling and linking works again for linux and dos
  556. + assembler object, only attasmi3 supported yet
  557. * restore pp.pas with AddPath etc.
  558. Revision 1.37 1998/02/13 10:35:17 daniel
  559. * Made Motorola version compilable.
  560. * Fixed optimizer
  561. Revision 1.36 1998/02/12 17:19:12 florian
  562. * fixed to get remake3 work, but needs additional fixes (output, I don't like
  563. also that aktswitches isn't a pointer)
  564. Revision 1.35 1998/02/12 11:50:16 daniel
  565. Yes! Finally! After three retries, my patch!
  566. Changes:
  567. Complete rewrite of psub.pas.
  568. Added support for DLL's.
  569. Compiler requires less memory.
  570. Platform units for each platform.
  571. Revision 1.34 1998/02/02 11:47:36 pierre
  572. + compilation stops at unit with error
  573. Revision 1.33 1998/02/01 22:41:08 florian
  574. * clean up
  575. + system.assigned([class])
  576. + system.assigned([class of xxxx])
  577. * first fixes of as and is-operator
  578. Revision 1.32 1998/01/30 17:31:23 pierre
  579. * bug of cyclic symtablestack fixed
  580. Revision 1.31 1998/01/29 12:13:21 michael
  581. * fixed Typos for library making
  582. Revision 1.30 1998/01/28 13:48:45 michael
  583. + Initial implementation for making libs from within FPC. Not tested, as compiler does not run
  584. Revision 1.29 1998/01/25 18:45:47 peter
  585. + Search for as and ld at startup
  586. + source_info works the same as target_info
  587. + externlink allows only external linking
  588. Revision 1.28 1998/01/23 21:14:59 carl
  589. * RunError 105 (file not open) with -Agas switch fix
  590. Revision 1.27 1998/01/23 17:55:11 michael
  591. + Moved linking stage to it's own unit (link.pas)
  592. Incorporated Pierres changes, but removed -E switch
  593. switch for not linking is now -Cn instead of -E
  594. Revision 1.26 1998/01/23 17:12:15 pierre
  595. * added some improvements for as and ld :
  596. - doserror and dosexitcode treated separately
  597. - PATH searched if doserror=2
  598. + start of long and ansi string (far from complete)
  599. in conditionnal UseLongString and UseAnsiString
  600. * options.pas cleaned (some variables shifted to globals)gl
  601. Revision 1.25 1998/01/22 14:47:16 michael
  602. + Reinstated linker options as -k option. How did they dissapear ?
  603. Revision 1.24 1998/01/17 01:57:36 michael
  604. + Start of shared library support. First working version.
  605. Revision 1.23 1998/01/16 22:34:37 michael
  606. * Changed 'conversation' to 'conversion'. Waayyy too much chatting going on
  607. in this compiler :)
  608. Revision 1.22 1998/01/14 12:52:04 michael
  609. - Removed the 'Assembled' line and replaced 'Calling Linker/assembler...'
  610. with 'Assembling/linking...'. Too much verbosity when V_info is on.
  611. Revision 1.21 1998/01/13 16:15:56 pierre
  612. * bug in interdependent units handling
  613. - primary unit was not in loaded_units list
  614. - current_module^.symtable was assigned too early
  615. - donescanner must not call error if the compilation
  616. of the unit was done at a higher level.
  617. Revision 1.20 1998/01/11 10:54:22 florian
  618. + generic library support
  619. Revision 1.19 1998/01/11 04:17:11 carl
  620. + correct heap and memory variables for m68k targets
  621. Revision 1.18 1998/01/08 23:56:39 florian
  622. * parser unit divided into several smaller units
  623. Revision 1.17 1998/01/08 17:10:12 florian
  624. * the name of the initialization part of a unit was sometimes written
  625. in lower case
  626. Revision 1.16 1998/01/07 00:16:56 michael
  627. Restored released version (plus fixes) as current
  628. Revision 1.13 1997/12/14 22:43:21 florian
  629. + command line switch -Xs for DOS (passes -s to the linker to strip symbols from
  630. executable)
  631. * some changes of Carl-Eric implemented
  632. Revision 1.12 1997/12/12 13:28:31 florian
  633. + version 0.99.0
  634. * all WASM options changed into MASM
  635. + -O2 for Pentium II optimizations
  636. Revision 1.11 1997/12/10 23:07:21 florian
  637. * bugs fixed: 12,38 (also m68k),39,40,41
  638. + warning if a system unit is without -Us compiled
  639. + warning if a method is virtual and private (was an error)
  640. * some indentions changed
  641. + factor does a better error recovering (omit some crashes)
  642. + problem with @type(x) removed (crashed the compiler)
  643. Revision 1.10 1997/12/09 13:50:36 carl
  644. * bugfix of possible alignment problems with m68k
  645. * bugfix of circular unit use -- could still give a stack overflow,
  646. so changed to fatalerror instead.
  647. * bugfix of nil procedural variables, fpc = @nil is illogical!
  648. (if was reversed!)
  649. Revision 1.9 1997/12/08 13:31:31 daniel
  650. * File was in DOS format. Translated to Unix.
  651. Revision 1.8 1997/12/08 10:01:08 pierre
  652. * nil for a procvar const was not allowed (os2_targ.pas not compilable)
  653. * bug in loadunit for units in implementation part already loaded
  654. (crashed on dos_targ.pas, thanks to Daniel who permitted me
  655. to find this bug out)
  656. Revision 1.7 1997/12/04 17:47:50 carl
  657. + renamed m68k units and refs to these units according to cpu rules.
  658. Revision 1.6 1997/12/02 15:56:13 carl
  659. * bugfix of postfixoperator with pd =nil
  660. * bugfix of motorola instructions types for exit code.
  661. Revision 1.5 1997/12/01 18:14:33 pierre
  662. * fixes a bug in nasm output due to my previous changes
  663. Revision 1.3 1997/11/28 18:14:40 pierre
  664. working version with several bug fixes
  665. Revision 1.2 1997/11/27 17:59:46 carl
  666. * made it compile under BP (line too long errors)
  667. Revision 1.1.1.1 1997/11/27 08:32:57 michael
  668. FPC Compiler CVS start
  669. Pre-CVS log:
  670. CEC Carl-Eric Codere
  671. FK Florian Klaempfl
  672. PM Pierre Muller
  673. + feature added
  674. - removed
  675. * bug fixed or changed
  676. History (started with version 0.9.0):
  677. 5th november 1996:
  678. * adapted to 0.9.0
  679. 25th november 1996:
  680. * more stuff adapted
  681. 9th december 1996:
  682. + support for different inline assemblers added (FK)
  683. 22th september:
  684. + support for PACKED RECORD implemented (FK)
  685. 24th september:
  686. + internal support of system.seg added (FK)
  687. * system.ofs bug fixed (FK)
  688. * problem with compiler switches solved (see also pass_1.pas) (FK)
  689. * all aktswitch memory is now recoverd (see also scanner.pas) (FK)
  690. 24th september 1997:
  691. * bug in ESI offset, pushed only if not nested, changed in cgi386.pas in v93 by (FK)
  692. but forgotten here (PM)
  693. 25th september:
  694. + parsing of open arrays implemented (FK)
  695. + parsing of high and low implemented (FK)
  696. + open array support also for proc vars added (FK)
  697. 1th october:
  698. * in typed constants is now the conversion int -> real
  699. automatically done (FK)
  700. 3rd october 1997:
  701. + started conversion to motorola 68000 - ifdef m68k to find
  702. changes (this makes the code look horrible, may later separate
  703. in includes?) - look for all ifdef i386 and ifdef m68k to see
  704. changes. (CEC)
  705. - commented out regnames (was unused) (CEC)
  706. + peepholeopt put in i386 define (not yet available for motorola
  707. 68000) (CEC)
  708. + i386 defines around a_att, in a_o and around a_wasm, a_nasm (CEC).
  709. + code for in_ord_x (PM)
  710. 4th october 1997:
  711. + checking for double definitions of function/procedure
  712. with same parameters in interface (PM)
  713. + enums with jumps set the boolean has_jumps and
  714. disable the succ and pred use (PM)
  715. 9th october 1997:
  716. * Fixed problem with 80float on the 68000 output, caused a GPF (CEC).
  717. 13th october 1997:
  718. + Added support for Motorola Standard assembler. (CEC)
  719. 15th october 1997:
  720. + added code for static modifier for objects variables and methods
  721. controlled by -St switch at command line (PM)
  722. 17th october 1997:
  723. + Added support for Motorola inline assembler (CEC)
  724. * Bugfix with .align 4,0x90, this is NOT allowed in TASM/MASM/WASM (CEC).
  725. + procedure set_macro and setting of fpc_* macros (FK)
  726. 19th october 1997:
  727. * Bugfix of RTS on 68000 target. PC Counter would become corrupt
  728. with paramsize (CEC).
  729. 23th october 1997:
  730. * Small bugfixes concerning SUBI #const,address_reg (CEC).
  731. 24th october 1997:
  732. * array[boolean] works now (FK)
  733. 25th october 1997:
  734. + CDECL and STDCALL (FK)
  735. * ASSEMBLER isn't a keyword anymore (FK)
  736. 3rd november 1997:
  737. + added symdif for sets (PM)
  738. 5th november 1997:
  739. * changed all while token<>ATOKEN do consume(token);
  740. by a procedure call consume_all_untill(ATOKEN)
  741. to test for _EOF (PM)
  742. * aktobjectname was not reset to '' at the end of objectcomponenten (PM)
  743. 14th november 1997:
  744. * removed bug for procvar where the type was not allways set correctly (PM)
  745. + integer const not in longint range converted to real constant (PM)
  746. 25th november 1997:
  747. * removed bugs due to wrong current_module references in compile procedure (PM)
  748. }