parser.pas 29 KB

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