parser.pas 30 KB

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