options.pas 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl and Peter Vreman
  4. Reads command line options and config files
  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. unit options;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. globtype,globals,verbose,systems,cpuinfo;
  23. type
  24. TOption=class
  25. FirstPass,
  26. NoPressEnter,
  27. DoWriteLogo : boolean;
  28. FileLevel : longint;
  29. QuickInfo : string;
  30. ParaIncludePath,
  31. ParaUnitPath,
  32. ParaObjectPath,
  33. ParaLibraryPath : TSearchPathList;
  34. ParaAlignment : TAlignmentInfo;
  35. Constructor Create;
  36. Destructor Destroy;override;
  37. procedure WriteLogo;
  38. procedure WriteInfo;
  39. procedure WriteHelpPages;
  40. procedure WriteQuickInfo;
  41. procedure IllegalPara(const opt:string);
  42. function Unsetbool(var Opts:string; Pos: Longint):boolean;
  43. procedure interpret_proc_specific_options(const opt:string);virtual;
  44. procedure interpret_option(const opt :string;ispara:boolean);
  45. procedure Interpret_envvar(const envname : string);
  46. procedure Interpret_file(const filename : string);
  47. procedure Read_Parameters;
  48. procedure parsecmd(cmd:string);
  49. procedure TargetDefines(def:boolean);
  50. end;
  51. TOptionClass=class of toption;
  52. var
  53. coption : TOptionClass;
  54. procedure read_arguments(cmd:string);
  55. implementation
  56. uses
  57. widestr,
  58. {$ifdef Delphi}
  59. dmisc,
  60. {$else Delphi}
  61. dos,
  62. {$endif Delphi}
  63. version,
  64. cutils,cmsgs
  65. {$ifdef BrowserLog}
  66. ,browlog
  67. {$endif BrowserLog}
  68. ;
  69. const
  70. page_size = 24;
  71. var
  72. option : toption;
  73. read_configfile, { read config file, set when a cfgfile is found }
  74. disable_configfile,
  75. target_is_set : boolean; { do not allow contradictory target settings }
  76. asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
  77. fpcdir,
  78. ppccfg,
  79. ppcaltcfg,
  80. param_file : string; { file to compile specified on the commandline }
  81. {****************************************************************************
  82. Defines
  83. ****************************************************************************}
  84. procedure def_symbol(const s : string);
  85. begin
  86. if s='' then
  87. exit;
  88. initdefines.insert(upper(s));
  89. Message1(option_defining_symbol,s);
  90. end;
  91. procedure undef_symbol(const s : string);
  92. begin
  93. if s='' then
  94. exit;
  95. InitDefines.Remove(s);
  96. Message1(option_undefining_symbol,s);
  97. end;
  98. function check_symbol(const s:string):boolean;
  99. begin
  100. check_symbol:=(initdefines.find(s)<>nil);
  101. end;
  102. procedure set_default_link_type;
  103. begin
  104. if (target_info.system in [system_i386_win32,system_i386_wdosx]) then
  105. begin
  106. def_symbol('FPC_LINK_SMART');
  107. undef_symbol('FPC_LINK_STATIC');
  108. undef_symbol('FPC_LINK_DYNAMIC');
  109. initglobalswitches:=initglobalswitches+[cs_link_smart];
  110. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_static];
  111. end
  112. else
  113. begin
  114. undef_symbol('FPC_LINK_SMART');
  115. def_symbol('FPC_LINK_STATIC');
  116. undef_symbol('FPC_LINK_DYNAMIC');
  117. initglobalswitches:=initglobalswitches+[cs_link_static];
  118. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_smart];
  119. end;
  120. end;
  121. {****************************************************************************
  122. Toption
  123. ****************************************************************************}
  124. procedure StopOptions;
  125. begin
  126. if assigned(Option) then
  127. begin
  128. Option.free;
  129. Option:=nil;
  130. end;
  131. DoneVerbose;
  132. Stop;
  133. end;
  134. procedure Toption.WriteLogo;
  135. var
  136. p : pchar;
  137. begin
  138. p:=MessagePchar(option_logo);
  139. while assigned(p) do
  140. Comment(V_Normal,GetMsgLine(p));
  141. end;
  142. procedure Toption.WriteInfo;
  143. var
  144. p : pchar;
  145. hs,hs1,s : string;
  146. target : tsystem;
  147. begin
  148. p:=MessagePchar(option_info);
  149. while assigned(p) do
  150. begin
  151. s:=GetMsgLine(p);
  152. { list OS Targets }
  153. if pos('$OSTARGETS',s)>0 then
  154. begin
  155. for target:=low(tsystem) to high(tsystem) do
  156. if assigned(targetinfos[target]) then
  157. begin
  158. hs:=s;
  159. hs1:=targetinfos[target]^.name;
  160. if tf_under_development in targetinfos[target]^.flags then
  161. hs1:=hs1+' (under development)';
  162. Replace(hs,'$OSTARGETS',hs1);
  163. Comment(V_Normal,hs);
  164. end;
  165. end
  166. else
  167. Comment(V_Normal,s);
  168. end;
  169. StopOptions;
  170. end;
  171. procedure Toption.WriteHelpPages;
  172. function PadEnd(s:string;i:longint):string;
  173. begin
  174. while (length(s)<i) do
  175. s:=s+' ';
  176. PadEnd:=s;
  177. end;
  178. var
  179. lastident,
  180. j,outline,
  181. ident,
  182. lines : longint;
  183. show : boolean;
  184. opt : string[32];
  185. input,
  186. s : string;
  187. p : pchar;
  188. begin
  189. WriteLogo;
  190. Lines:=4;
  191. Message1(option_usage,system.paramstr(0));
  192. lastident:=0;
  193. p:=MessagePChar(option_help_pages);
  194. while assigned(p) do
  195. begin
  196. { get a line and reset }
  197. s:=GetMsgLine(p);
  198. ident:=0;
  199. show:=false;
  200. { parse options }
  201. case s[1] of
  202. {$ifdef UNITALIASES}
  203. 'a',
  204. {$endif}
  205. {$ifdef EXTDEBUG}
  206. 'e',
  207. {$endif EXTDEBUG}
  208. {$ifdef i386}
  209. '3',
  210. {$endif}
  211. {$ifdef powerpc}
  212. 'P',
  213. {$endif}
  214. {$ifdef vis}
  215. 'V',
  216. {$endif}
  217. {$ifdef sparc}
  218. 'S',
  219. {$endif}
  220. {$ifdef m68k}
  221. '6',
  222. {$endif}
  223. '*' : show:=true;
  224. end;
  225. if show then
  226. begin
  227. case s[2] of
  228. {$ifdef GDB}
  229. 'g',
  230. {$endif}
  231. {$ifdef Unix}
  232. 'L',
  233. {$endif}
  234. {$ifdef os2}
  235. 'O',
  236. {$endif}
  237. '*' : show:=true;
  238. else
  239. show:=false;
  240. end;
  241. end;
  242. { now we may show the message or not }
  243. if show then
  244. begin
  245. case s[3] of
  246. '0' : begin
  247. ident:=0;
  248. outline:=0;
  249. end;
  250. '1' : begin
  251. ident:=2;
  252. outline:=7;
  253. end;
  254. '2' : begin
  255. ident:=6;
  256. outline:=11;
  257. end;
  258. '3' : begin
  259. ident:=9;
  260. outline:=6;
  261. end;
  262. end;
  263. j:=pos('_',s);
  264. opt:=Copy(s,4,j-4);
  265. if opt='*' then
  266. opt:=''
  267. else
  268. if opt=' ' then
  269. opt:=PadEnd(opt,outline)
  270. else
  271. opt:=PadEnd('-'+opt,outline);
  272. if (ident=0) and (lastident<>0) then
  273. begin
  274. Comment(V_Normal,'');
  275. inc(Lines);
  276. end;
  277. { page full ? }
  278. if (lines >= page_size - 1) then
  279. begin
  280. if not NoPressEnter then
  281. begin
  282. Message(option_help_press_enter);
  283. readln(input);
  284. if upper(input)='Q' then
  285. StopOptions;
  286. end;
  287. lines:=0;
  288. end;
  289. Comment(V_Normal,PadEnd('',ident)+opt+Copy(s,j+1,255));
  290. LastIdent:=Ident;
  291. inc(Lines);
  292. end;
  293. end;
  294. StopOptions;
  295. end;
  296. procedure Toption.IllegalPara(const opt:string);
  297. begin
  298. Message1(option_illegal_para,opt);
  299. Message(option_help_pages_para);
  300. StopOptions;
  301. end;
  302. function Toption.Unsetbool(var Opts:string; Pos: Longint):boolean;
  303. { checks if the character after pos in Opts is a + or a - and returns resp.
  304. false or true. If it is another character (or none), it also returns false }
  305. begin
  306. UnsetBool := false;
  307. if Length(Opts)>Pos then
  308. begin
  309. inc(Pos);
  310. UnsetBool := Opts[Pos] = '-';
  311. if Opts[Pos] in ['-','+']then
  312. delete(Opts,Pos,1);
  313. end;
  314. end;
  315. procedure TOption.interpret_proc_specific_options(const opt:string);
  316. begin
  317. end;
  318. procedure TOption.interpret_option(const opt:string;ispara:boolean);
  319. var
  320. code : integer;
  321. c : char;
  322. more : string;
  323. major,minor : longint;
  324. error : integer;
  325. j,l : longint;
  326. d : DirStr;
  327. e : ExtStr;
  328. {$ifdef arm}
  329. s : string;
  330. {$endif arm}
  331. forceasm : tasm;
  332. begin
  333. if opt='' then
  334. exit;
  335. { only parse define,undef,target,verbosity and link options the firsttime }
  336. if firstpass and
  337. not((opt[1]='-') and (opt[2] in ['i','d','v','T','u','n','X'])) then
  338. exit;
  339. Message1(option_handling_option,opt);
  340. case opt[1] of
  341. '-' :
  342. begin
  343. more:=Copy(opt,3,255);
  344. if firstpass then
  345. Message1(option_interpreting_firstpass_option,opt)
  346. else
  347. Message1(option_interpreting_option,opt);
  348. case opt[2] of
  349. '?' :
  350. WriteHelpPages;
  351. 'a' :
  352. begin
  353. include(initglobalswitches,cs_asm_leave);
  354. j:=1;
  355. while j<=length(more) do
  356. begin
  357. case more[j] of
  358. 'l' :
  359. include(initglobalswitches,cs_asm_source);
  360. 'r' :
  361. include(initglobalswitches,cs_asm_regalloc);
  362. 't' :
  363. include(initglobalswitches,cs_asm_tempalloc);
  364. 'n' :
  365. include(initglobalswitches,cs_asm_nodes);
  366. 'p' :
  367. begin
  368. exclude(initglobalswitches,cs_asm_leave);
  369. if UnsetBool(More, 0) then
  370. exclude(initglobalswitches,cs_asm_pipe)
  371. else
  372. include(initglobalswitches,cs_asm_pipe);
  373. end;
  374. '-' :
  375. initglobalswitches:=initglobalswitches -
  376. [cs_asm_leave, cs_asm_source,cs_asm_regalloc, cs_asm_tempalloc,
  377. cs_asm_nodes, cs_asm_pipe];
  378. else
  379. IllegalPara(opt);
  380. end;
  381. inc(j);
  382. end;
  383. end;
  384. 'A' :
  385. begin
  386. if set_target_asm_by_string(More) then
  387. asm_is_set:=true
  388. else
  389. IllegalPara(opt);
  390. end;
  391. 'b' :
  392. begin
  393. if UnsetBool(More,0) then
  394. begin
  395. exclude(initmoduleswitches,cs_browser);
  396. exclude(initmoduleswitches,cs_local_browser);
  397. {$ifdef BrowserLog}
  398. exclude(initglobalswitches,cs_browser_log);
  399. {$endif}
  400. end
  401. else
  402. begin
  403. include(initmoduleswitches,cs_browser);
  404. {$ifdef BrowserLog}
  405. include(initglobalswitches,cs_browser_log);
  406. {$endif}
  407. end;
  408. if More<>'' then
  409. if (More='l') or (More='l+') then
  410. include(initmoduleswitches,cs_local_browser)
  411. else
  412. if More='l-' then
  413. exclude(initmoduleswitches,cs_local_browser)
  414. else
  415. {$ifdef BrowserLog}
  416. browserlog.elements_to_list.insert(more);
  417. {$else}
  418. IllegalPara(opt);
  419. {$endif}
  420. end;
  421. 'B' :
  422. do_build:=not UnSetBool(more,0);
  423. 'C' :
  424. begin
  425. j:=1;
  426. while j<=length(more) do
  427. begin
  428. case more[j] of
  429. 'a' :
  430. Message2(option_obsolete_switch_use_new,'-Ca','-Or');
  431. 'c' :
  432. begin
  433. if not SetAktProcCall(upper(copy(more,j+1,length(more)-j)),true) then
  434. IllegalPara(opt);
  435. break;
  436. end;
  437. {$ifdef cpufpemu}
  438. 'e' :
  439. begin
  440. If UnsetBool(More, j) then
  441. exclude(initmoduleswitches,cs_fp_emulation)
  442. Else
  443. include(initmoduleswitches,cs_fp_emulation);
  444. end;
  445. {$endif cpufpemu}
  446. {$ifdef arm}
  447. 'f' :
  448. begin
  449. s:=upper(copy(more,j+1,length(more)-j));
  450. if s='SOFT' then
  451. initfputype:=fpu_soft
  452. else if s='FPA' then
  453. initfputype:=fpu_fpa
  454. else if s='FPA10' then
  455. initfputype:=fpu_fpa10
  456. else if s='FPA11' then
  457. initfputype:=fpu_fpa11
  458. else if s='VFP' then
  459. initfputype:=fpu_vfp
  460. else
  461. IllegalPara(opt);
  462. break;
  463. end;
  464. {$endif arm}
  465. 'h' :
  466. begin
  467. val(copy(more,j+1,length(more)-j),heapsize,code);
  468. if (code<>0) or (heapsize>=67107840) or (heapsize<1024) then
  469. IllegalPara(opt);
  470. break;
  471. end;
  472. 'i' :
  473. If UnsetBool(More, j) then
  474. exclude(initlocalswitches,cs_check_io)
  475. else
  476. include(initlocalswitches,cs_check_io);
  477. 'n' :
  478. If UnsetBool(More, j) then
  479. exclude(initglobalswitches,cs_link_extern)
  480. Else
  481. include(initglobalswitches,cs_link_extern);
  482. 'o' :
  483. If UnsetBool(More, j) then
  484. exclude(initlocalswitches,cs_check_overflow)
  485. Else
  486. include(initlocalswitches,cs_check_overflow);
  487. 'r' :
  488. If UnsetBool(More, j) then
  489. exclude(initlocalswitches,cs_check_range)
  490. Else
  491. include(initlocalswitches,cs_check_range);
  492. 'R' :
  493. If UnsetBool(More, j) then
  494. begin
  495. exclude(initlocalswitches,cs_check_range);
  496. exclude(initlocalswitches,cs_check_object);
  497. end
  498. Else
  499. begin
  500. include(initlocalswitches,cs_check_range);
  501. include(initlocalswitches,cs_check_object);
  502. end;
  503. 's' :
  504. begin
  505. val(copy(more,j+1,length(more)-j),stacksize,code);
  506. if (code<>0) or (stacksize>=67107840) or (stacksize<1024) then
  507. IllegalPara(opt);
  508. break;
  509. end;
  510. 't' :
  511. If UnsetBool(More, j) then
  512. exclude(initlocalswitches,cs_check_stack)
  513. Else
  514. include(initlocalswitches,cs_check_stack);
  515. 'D' :
  516. If UnsetBool(More, j) then
  517. exclude(initmoduleswitches,cs_create_dynamic)
  518. Else
  519. include(initmoduleswitches,cs_create_dynamic);
  520. 'X' :
  521. If UnsetBool(More, j) then
  522. exclude(initmoduleswitches,cs_create_smart)
  523. Else
  524. include(initmoduleswitches,cs_create_smart);
  525. else
  526. IllegalPara(opt);
  527. end;
  528. inc(j);
  529. end;
  530. end;
  531. 'd' :
  532. def_symbol(more);
  533. 'D' :
  534. begin
  535. include(initglobalswitches,cs_link_deffile);
  536. j:=1;
  537. while j<=length(more) do
  538. begin
  539. case more[j] of
  540. 'd' :
  541. begin
  542. description:=Copy(more,j+1,255);
  543. break;
  544. end;
  545. 'v' :
  546. begin
  547. dllversion:=Copy(more,j+1,255);
  548. l:=pos('.',dllversion);
  549. dllminor:=0;
  550. error:=0;
  551. if l>0 then
  552. begin
  553. valint(copy(dllversion,l+1,255),minor,error);
  554. if (error=0) and
  555. (minor>=0) and (minor<=$ffff) then
  556. dllminor:=minor
  557. else
  558. if error=0 then
  559. error:=1;
  560. end;
  561. if l=0 then
  562. l:=256;
  563. dllmajor:=1;
  564. if error=0 then
  565. valint(copy(dllversion,1,l-1),major,error);
  566. if (error=0) and (major>=0) and (major<=$ffff) then
  567. dllmajor:=major
  568. else
  569. if error=0 then
  570. error:=1;
  571. if error<>0 then
  572. Message1(scan_w_wrong_version_ignored,dllversion);
  573. break;
  574. end;
  575. 'w' :
  576. usewindowapi:=true;
  577. '-' :
  578. begin
  579. exclude(initglobalswitches,cs_link_deffile);
  580. usewindowapi:=false;
  581. end;
  582. else
  583. IllegalPara(opt);
  584. end;
  585. inc(j);
  586. end;
  587. end;
  588. 'e' :
  589. exepath:=FixPath(More,true);
  590. 'E' :
  591. begin
  592. if UnsetBool(More, 0) then
  593. exclude(initglobalswitches,cs_link_extern)
  594. else
  595. include(initglobalswitches,cs_link_extern);
  596. end;
  597. 'F' :
  598. begin
  599. c:=more[1];
  600. Delete(more,1,1);
  601. DefaultReplacements(More);
  602. case c of
  603. 'c' :
  604. begin
  605. if not(cpavailable(more)) then
  606. Message1(option_code_page_not_available,more)
  607. else
  608. initsourcecodepage:=more;
  609. end;
  610. 'D' :
  611. utilsdirectory:=FixPath(More,true);
  612. 'e' :
  613. SetRedirectFile(More);
  614. 'E' :
  615. OutputExeDir:=FixPath(More,true);
  616. 'i' :
  617. begin
  618. if ispara then
  619. ParaIncludePath.AddPath(More,false)
  620. else
  621. includesearchpath.AddPath(More,true);
  622. end;
  623. 'g' :
  624. Message2(option_obsolete_switch_use_new,'-Fg','-Fl');
  625. 'l' :
  626. begin
  627. if ispara then
  628. ParaLibraryPath.AddPath(More,false)
  629. else
  630. LibrarySearchPath.AddPath(More,true);
  631. end;
  632. 'L' :
  633. begin
  634. if More<>'' then
  635. ParaDynamicLinker:=More
  636. else
  637. IllegalPara(opt);
  638. end;
  639. 'o' :
  640. begin
  641. if ispara then
  642. ParaObjectPath.AddPath(More,false)
  643. else
  644. ObjectSearchPath.AddPath(More,true);
  645. end;
  646. 'r' :
  647. Msgfilename:=More;
  648. 'u' :
  649. begin
  650. if ispara then
  651. ParaUnitPath.AddPath(More,false)
  652. else
  653. unitsearchpath.AddPath(More,true);
  654. end;
  655. 'U' :
  656. OutputUnitDir:=FixPath(More,true);
  657. else
  658. IllegalPara(opt);
  659. end;
  660. end;
  661. 'g' : begin
  662. if UnsetBool(More, 0) then
  663. begin
  664. exclude(initmoduleswitches,cs_debuginfo);
  665. exclude(initglobalswitches,cs_gdb_dbx);
  666. exclude(initglobalswitches,cs_gdb_gsym);
  667. exclude(initglobalswitches,cs_gdb_heaptrc);
  668. exclude(initglobalswitches,cs_gdb_lineinfo);
  669. exclude(initglobalswitches,cs_checkpointer);
  670. end
  671. else
  672. begin
  673. {$ifdef GDB}
  674. include(initmoduleswitches,cs_debuginfo);
  675. if not RelocSectionSetExplicitly then
  676. RelocSection:=false;
  677. j:=1;
  678. while j<=length(more) do
  679. begin
  680. case more[j] of
  681. 'd' :
  682. begin
  683. if UnsetBool(More, j) then
  684. exclude(initglobalswitches,cs_gdb_dbx)
  685. else
  686. include(initglobalswitches,cs_gdb_dbx);
  687. end;
  688. 'g' :
  689. begin
  690. if UnsetBool(More, j) then
  691. exclude(initglobalswitches,cs_gdb_gsym)
  692. else
  693. include(initglobalswitches,cs_gdb_gsym);
  694. end;
  695. 'h' :
  696. begin
  697. if UnsetBool(More, j) then
  698. exclude(initglobalswitches,cs_gdb_heaptrc)
  699. else
  700. include(initglobalswitches,cs_gdb_heaptrc);
  701. end;
  702. 'l' :
  703. begin
  704. if UnsetBool(More, j) then
  705. exclude(initglobalswitches,cs_gdb_lineinfo)
  706. else
  707. include(initglobalswitches,cs_gdb_lineinfo);
  708. end;
  709. 'c' :
  710. begin
  711. if UnsetBool(More, j) then
  712. exclude(initglobalswitches,cs_checkpointer)
  713. else
  714. include(initglobalswitches,cs_checkpointer);
  715. end;
  716. else
  717. IllegalPara(opt);
  718. end;
  719. inc(j);
  720. end;
  721. {$else GDB}
  722. Message(option_no_debug_support);
  723. Message(option_no_debug_support_recompile_fpc);
  724. {$endif GDB}
  725. end;
  726. end;
  727. 'h' :
  728. begin
  729. NoPressEnter:=true;
  730. WriteHelpPages;
  731. end;
  732. 'i' :
  733. begin
  734. if More='' then
  735. WriteInfo
  736. else
  737. QuickInfo:=QuickInfo+More;
  738. end;
  739. 'I' :
  740. begin
  741. if ispara then
  742. ParaIncludePath.AddPath(More,false)
  743. else
  744. includesearchpath.AddPath(More,false);
  745. end;
  746. 'k' :
  747. begin
  748. if more<>'' then
  749. ParaLinkOptions:=ParaLinkOptions+' '+More
  750. else
  751. IllegalPara(opt);
  752. end;
  753. 'l' :
  754. DoWriteLogo:=not UnSetBool(more,0);
  755. 'm' :
  756. parapreprocess:=not UnSetBool(more,0);
  757. 'n' :
  758. begin
  759. if More='' then
  760. disable_configfile:=true
  761. else
  762. IllegalPara(opt);
  763. end;
  764. 'o' :
  765. begin
  766. if More<>'' then
  767. Fsplit(More,d,OutputFile,e)
  768. else
  769. IllegalPara(opt);
  770. end;
  771. 'p' :
  772. begin
  773. if UnsetBool(More, 0) then
  774. begin
  775. initmoduleswitches:=initmoduleswitches-[cs_profile];
  776. undef_symbol('FPC_PROFILE');
  777. end
  778. else
  779. if Length(More)=0 then
  780. IllegalPara(opt)
  781. else
  782. case more[1] of
  783. 'g' : if UnsetBool(more, 1) then
  784. begin
  785. exclude(initmoduleswitches,cs_profile);
  786. undef_symbol('FPC_PROFILE');
  787. end
  788. else
  789. begin
  790. include(initmoduleswitches,cs_profile);
  791. def_symbol('FPC_PROFILE');
  792. end;
  793. else
  794. IllegalPara(opt);
  795. end;
  796. end;
  797. {$ifdef Unix}
  798. 'P' : ; { Ignore used by fpc.pp }
  799. {$endif Unix}
  800. 's' :
  801. begin
  802. if UnsetBool(More, 0) then
  803. begin
  804. initglobalswitches:=initglobalswitches-[cs_asm_extern,cs_link_extern];
  805. if more<>'' then
  806. IllegalPara(opt);
  807. end
  808. else
  809. begin
  810. initglobalswitches:=initglobalswitches+[cs_asm_extern,cs_link_extern];
  811. if more='h' then
  812. initglobalswitches:=initglobalswitches-[cs_link_on_target]
  813. else if more='t' then
  814. initglobalswitches:=initglobalswitches+[cs_link_on_target]
  815. else if more='r' then
  816. initglobalswitches:=initglobalswitches+[cs_asm_leave,cs_no_regalloc]
  817. else if more<>'' then
  818. IllegalPara(opt);
  819. end;
  820. end;
  821. 'M' :
  822. begin
  823. more:=Upper(more);
  824. if not SetCompileMode(more, true) then
  825. IllegalPara(opt);
  826. end;
  827. 'S' :
  828. begin
  829. if more[1]='I' then
  830. begin
  831. if upper(more)='ICOM' then
  832. initinterfacetype:=it_interfacecom
  833. else if upper(more)='ICORBA' then
  834. initinterfacetype:=it_interfacecorba
  835. else
  836. IllegalPara(opt);
  837. end
  838. else
  839. begin
  840. j:=1;
  841. while j<=length(more) do
  842. begin
  843. case more[j] of
  844. '2' : //an alternative to -Mobjfpc
  845. SetCompileMode('OBJFPC',true);
  846. 'a' :
  847. include(initlocalswitches,cs_do_assertion);
  848. 'c' :
  849. include(initmoduleswitches,cs_support_c_operators);
  850. 'd' : //an alternative to -Mdelphi
  851. SetCompileMode('DELPHI',true);
  852. 'e' :
  853. begin
  854. SetErrorFlags(copy(more,j+1,length(more)));
  855. break;
  856. end;
  857. 'g' :
  858. include(initmoduleswitches,cs_support_goto);
  859. 'h' :
  860. include(initlocalswitches,cs_ansistrings);
  861. 'i' :
  862. include(initmoduleswitches,cs_support_inline);
  863. 'm' :
  864. include(initmoduleswitches,cs_support_macro);
  865. 'o' : //an alternative to -Mtp
  866. SetCompileMode('TP',true);
  867. 'p' : //an alternative to -Mgpc
  868. SetCompileMode('GPC',true);
  869. 's' :
  870. include(initglobalswitches,cs_constructor_name);
  871. 't' :
  872. include(initmoduleswitches,cs_static_keyword);
  873. '-' :
  874. begin
  875. exclude(initglobalswitches,cs_constructor_name);
  876. initlocalswitches:=InitLocalswitches - [cs_do_assertion, cs_ansistrings];
  877. initmoduleswitches:=initmoduleswitches - [cs_support_c_operators, cs_support_goto,
  878. cs_support_inline, cs_support_macro,
  879. cs_static_keyword];
  880. end;
  881. else
  882. IllegalPara(opt);
  883. end;
  884. inc(j);
  885. end;
  886. end;
  887. end;
  888. 'T' :
  889. begin
  890. more:=Upper(More);
  891. if not target_is_set then
  892. begin
  893. { remove old target define }
  894. TargetDefines(false);
  895. { Save assembler if set }
  896. if asm_is_set then
  897. forceasm:=target_asm.id;
  898. { load new target }
  899. if not(set_target_by_string(More)) then
  900. IllegalPara(opt);
  901. { also initialize assembler if not explicitly set }
  902. if asm_is_set then
  903. set_target_asm(forceasm);
  904. { set new define }
  905. TargetDefines(true);
  906. target_is_set:=true;
  907. end
  908. else
  909. if More<>upper(target_info.shortname) then
  910. Message1(option_target_is_already_set,target_info.shortname);
  911. end;
  912. 'u' :
  913. undef_symbol(upper(More));
  914. 'U' :
  915. begin
  916. j:=1;
  917. while j<=length(more) do
  918. begin
  919. case more[j] of
  920. {$ifdef UNITALIASES}
  921. 'a' :
  922. begin
  923. AddUnitAlias(Copy(More,j+1,255));
  924. break;
  925. end;
  926. {$endif UNITALIASES}
  927. 'n' :
  928. exclude(initglobalswitches,cs_check_unit_name);
  929. 'p' :
  930. begin
  931. Message2(option_obsolete_switch_use_new,'-Up','-Fu');
  932. break;
  933. end;
  934. 'r' :
  935. do_release:=true;
  936. 's' :
  937. include(initmoduleswitches,cs_compilesystem);
  938. '-' :
  939. begin
  940. exclude(initmoduleswitches,cs_compilesystem);
  941. exclude(initglobalswitches,cs_check_unit_name);
  942. end;
  943. else
  944. IllegalPara(opt);
  945. end;
  946. inc(j);
  947. end;
  948. end;
  949. 'v' :
  950. begin
  951. if not setverbosity(More) then
  952. IllegalPara(opt);
  953. end;
  954. 'V' : ; { Ignore used by fpc }
  955. 'W' :
  956. begin
  957. j:=1;
  958. while j<=length(More) do
  959. begin
  960. case More[j] of
  961. 'B':
  962. begin
  963. { -WB200000 means set trefered base address
  964. to $200000, but does not change relocsection boolean
  965. this way we can create both relocatble and
  966. non relocatable DLL at a specific base address PM }
  967. if (length(More)>j) then
  968. begin
  969. if DLLImageBase=nil then
  970. DLLImageBase:=StringDup(Copy(More,j+1,255));
  971. end
  972. else
  973. begin
  974. RelocSection:=true;
  975. RelocSectionSetExplicitly:=true;
  976. end;
  977. break;
  978. end;
  979. 'C':
  980. begin
  981. if UnsetBool(More, j) then
  982. apptype:=app_gui
  983. else
  984. apptype:=app_cui;
  985. end;
  986. 'D':
  987. ForceDeffileForExport:=not UnsetBool(More, j);
  988. 'F':
  989. begin
  990. if UnsetBool(More, j) then
  991. apptype:=app_cui
  992. else
  993. apptype:=app_fs;
  994. end;
  995. 'G':
  996. begin
  997. if UnsetBool(More, j) then
  998. apptype:=app_cui
  999. else
  1000. apptype:=app_gui;
  1001. end;
  1002. 'N':
  1003. begin
  1004. RelocSection:=UnsetBool(More,j);
  1005. RelocSectionSetExplicitly:=true;
  1006. end;
  1007. 'R':
  1008. begin
  1009. { support -WR+ / -WR- as synonyms to -WR / -WN }
  1010. RelocSection:=not UnsetBool(More,j);
  1011. RelocSectionSetExplicitly:=true;
  1012. end;
  1013. else
  1014. IllegalPara(opt);
  1015. end;
  1016. inc(j);
  1017. end;
  1018. end;
  1019. 'X' :
  1020. begin
  1021. j:=1;
  1022. while j<=length(more) do
  1023. begin
  1024. case More[j] of
  1025. 'i' :
  1026. include(initglobalswitches,cs_link_internal);
  1027. 'm' :
  1028. include(initglobalswitches,cs_link_map);
  1029. 's' :
  1030. include(initglobalswitches,cs_link_strip);
  1031. 't' :
  1032. include(initglobalswitches,cs_link_staticflag);
  1033. 'D' :
  1034. begin
  1035. def_symbol('FPC_LINK_DYNAMIC');
  1036. undef_symbol('FPC_LINK_SMART');
  1037. undef_symbol('FPC_LINK_STATIC');
  1038. exclude(initglobalswitches,cs_link_static);
  1039. exclude(initglobalswitches,cs_link_smart);
  1040. include(initglobalswitches,cs_link_shared);
  1041. LinkTypeSetExplicitly:=true;
  1042. end;
  1043. 'd' : Dontlinkstdlibpath:=TRUE;
  1044. 'P' : Begin
  1045. utilsprefix:=Copy(more,2,length(More)-1);
  1046. More:='';
  1047. End;
  1048. 'p' :
  1049. include(initmoduleswitches,cs_create_pic);
  1050. 'S' :
  1051. begin
  1052. def_symbol('FPC_LINK_STATIC');
  1053. undef_symbol('FPC_LINK_SMART');
  1054. undef_symbol('FPC_LINK_DYNAMIC');
  1055. include(initglobalswitches,cs_link_static);
  1056. exclude(initglobalswitches,cs_link_smart);
  1057. exclude(initglobalswitches,cs_link_shared);
  1058. LinkTypeSetExplicitly:=true;
  1059. end;
  1060. 'X' :
  1061. begin
  1062. def_symbol('FPC_LINK_SMART');
  1063. undef_symbol('FPC_LINK_STATIC');
  1064. undef_symbol('FPC_LINK_DYNAMIC');
  1065. exclude(initglobalswitches,cs_link_static);
  1066. include(initglobalswitches,cs_link_smart);
  1067. exclude(initglobalswitches,cs_link_shared);
  1068. LinkTypeSetExplicitly:=true;
  1069. end;
  1070. '-' :
  1071. begin
  1072. exclude(initglobalswitches,cs_link_staticflag);
  1073. exclude(initglobalswitches,cs_link_strip);
  1074. exclude(initglobalswitches,cs_link_map);
  1075. set_default_link_type;
  1076. end;
  1077. else
  1078. IllegalPara(opt);
  1079. end;
  1080. inc(j);
  1081. end;
  1082. end;
  1083. { give processor specific options a chance }
  1084. else
  1085. interpret_proc_specific_options(opt);
  1086. end;
  1087. end;
  1088. '@' :
  1089. begin
  1090. Message(option_no_nested_response_file);
  1091. StopOptions;
  1092. end;
  1093. else
  1094. begin
  1095. if (length(param_file)<>0) then
  1096. Message(option_only_one_source_support);
  1097. param_file:=opt;
  1098. Message1(option_found_file,opt);
  1099. end;
  1100. end;
  1101. end;
  1102. procedure Toption.Interpret_file(const filename : string);
  1103. procedure RemoveSep(var fn:string);
  1104. var
  1105. i : longint;
  1106. begin
  1107. i:=0;
  1108. while (i<length(fn)) and (fn[i+1] in [',',' ',#9]) do
  1109. inc(i);
  1110. Delete(fn,1,i);
  1111. i:=length(fn);
  1112. while (i>0) and (fn[i] in [',',' ',#9]) do
  1113. dec(i);
  1114. fn:=copy(fn,1,i);
  1115. end;
  1116. function GetName(var fn:string):string;
  1117. var
  1118. i : longint;
  1119. begin
  1120. i:=0;
  1121. while (i<length(fn)) and (fn[i+1] in ['a'..'z','A'..'Z','0'..'9','_','-']) do
  1122. inc(i);
  1123. GetName:=Copy(fn,1,i);
  1124. Delete(fn,1,i);
  1125. end;
  1126. const
  1127. maxlevel=16;
  1128. var
  1129. f : text;
  1130. s,
  1131. opts : string;
  1132. skip : array[0..maxlevel-1] of boolean;
  1133. level : longint;
  1134. option_read : boolean;
  1135. begin
  1136. { avoid infinite loop }
  1137. Inc(FileLevel);
  1138. Option_read:=false;
  1139. If FileLevel>MaxLevel then
  1140. Message(option_too_many_cfg_files);
  1141. { open file }
  1142. Message1(option_using_file,filename);
  1143. assign(f,filename);
  1144. {$I-}
  1145. reset(f);
  1146. {$I+}
  1147. if ioresult<>0 then
  1148. begin
  1149. Message1(option_unable_open_file,filename);
  1150. exit;
  1151. end;
  1152. Message1(option_start_reading_configfile,filename);
  1153. fillchar(skip,sizeof(skip),0);
  1154. level:=0;
  1155. while not eof(f) do
  1156. begin
  1157. readln(f,opts);
  1158. RemoveSep(opts);
  1159. if (opts<>'') and (opts[1]<>';') then
  1160. begin
  1161. if opts[1]='#' then
  1162. begin
  1163. Message1(option_interpreting_file_option,opts);
  1164. Delete(opts,1,1);
  1165. s:=upper(GetName(opts));
  1166. if (s='SECTION') then
  1167. begin
  1168. RemoveSep(opts);
  1169. s:=upper(GetName(opts));
  1170. if level=0 then
  1171. skip[level]:=not (check_symbol(s) or (s='COMMON'));
  1172. end
  1173. else
  1174. if (s='IFDEF') then
  1175. begin
  1176. RemoveSep(opts);
  1177. if Level>=maxlevel then
  1178. begin
  1179. Message(option_too_many_ifdef);
  1180. stopOptions;
  1181. end;
  1182. inc(Level);
  1183. skip[level]:=(skip[level-1] or (not check_symbol(upper(GetName(opts)))));
  1184. end
  1185. else
  1186. if (s='IFNDEF') then
  1187. begin
  1188. RemoveSep(opts);
  1189. if Level>=maxlevel then
  1190. begin
  1191. Message(option_too_many_ifdef);
  1192. stopOptions;
  1193. end;
  1194. inc(Level);
  1195. skip[level]:=(skip[level-1] or (check_symbol(upper(GetName(opts)))));
  1196. end
  1197. else
  1198. if (s='ELSE') then
  1199. skip[level]:=skip[level-1] or (not skip[level])
  1200. else
  1201. if (s='ENDIF') then
  1202. begin
  1203. skip[level]:=false;
  1204. if Level=0 then
  1205. begin
  1206. Message(option_too_many_endif);
  1207. stopOptions;
  1208. end;
  1209. dec(level);
  1210. end
  1211. else
  1212. if (not skip[level]) then
  1213. begin
  1214. if (s='DEFINE') then
  1215. begin
  1216. RemoveSep(opts);
  1217. def_symbol(upper(GetName(opts)));
  1218. end
  1219. else
  1220. if (s='UNDEF') then
  1221. begin
  1222. RemoveSep(opts);
  1223. undef_symbol(upper(GetName(opts)));
  1224. end
  1225. else
  1226. if (s='WRITE') then
  1227. begin
  1228. Delete(opts,1,1);
  1229. WriteLn(opts);
  1230. end
  1231. else
  1232. if (s='INCLUDE') then
  1233. begin
  1234. Delete(opts,1,1);
  1235. Interpret_file(opts);
  1236. end;
  1237. end;
  1238. end
  1239. else
  1240. begin
  1241. if (opts[1]='-') or (opts[1]='@') then
  1242. begin
  1243. if (not skip[level]) then
  1244. interpret_option(opts,false);
  1245. Option_read:=true;
  1246. end
  1247. else
  1248. Message1(option_illegal_para,opts);
  1249. end;
  1250. end;
  1251. end;
  1252. if Level>0 then
  1253. Message(option_too_less_endif);
  1254. if Not Option_read then
  1255. Message1(option_no_option_found,filename)
  1256. else
  1257. Message1(option_end_reading_configfile,filename);
  1258. Close(f);
  1259. Dec(FileLevel);
  1260. end;
  1261. procedure Toption.Interpret_envvar(const envname : string);
  1262. var
  1263. argstart,
  1264. env,
  1265. pc : pchar;
  1266. arglen : longint;
  1267. quote : set of char;
  1268. hs : string;
  1269. begin
  1270. Message1(option_using_env,envname);
  1271. env:=GetEnvPChar(envname);
  1272. pc:=env;
  1273. if assigned(pc) then
  1274. begin
  1275. repeat
  1276. { skip leading spaces }
  1277. while pc^ in [' ',#9,#13] do
  1278. inc(pc);
  1279. case pc^ of
  1280. #0 :
  1281. break;
  1282. '"' :
  1283. begin
  1284. quote:=['"'];
  1285. inc(pc);
  1286. end;
  1287. '''' :
  1288. begin
  1289. quote:=[''''];
  1290. inc(pc);
  1291. end;
  1292. else
  1293. quote:=[' ',#9,#13];
  1294. end;
  1295. { scan until the end of the argument }
  1296. argstart:=pc;
  1297. while (pc^<>#0) and not(pc^ in quote) do
  1298. inc(pc);
  1299. { create argument }
  1300. arglen:=pc-argstart;
  1301. hs[0]:=chr(arglen);
  1302. move(argstart^,hs[1],arglen);
  1303. interpret_option(hs,true);
  1304. { skip quote }
  1305. if pc^ in quote then
  1306. inc(pc);
  1307. until false;
  1308. end
  1309. else
  1310. Message1(option_no_option_found,'(env) '+envname);
  1311. FreeEnvPChar(env);
  1312. end;
  1313. procedure toption.read_parameters;
  1314. var
  1315. opts : string;
  1316. paramindex : longint;
  1317. begin
  1318. paramindex:=0;
  1319. while paramindex<paramcount do
  1320. begin
  1321. inc(paramindex);
  1322. opts:=system.paramstr(paramindex);
  1323. case opts[1] of
  1324. '@' :
  1325. if not firstpass then
  1326. begin
  1327. Delete(opts,1,1);
  1328. Message1(option_reading_further_from,opts);
  1329. interpret_file(opts);
  1330. end;
  1331. '!' :
  1332. if not firstpass then
  1333. begin
  1334. Delete(opts,1,1);
  1335. Message1(option_reading_further_from,'(env) '+opts);
  1336. interpret_envvar(opts);
  1337. end;
  1338. else
  1339. interpret_option(opts,true);
  1340. end;
  1341. end;
  1342. end;
  1343. procedure toption.parsecmd(cmd:string);
  1344. var
  1345. i,ps : longint;
  1346. opts : string;
  1347. begin
  1348. while (cmd<>'') do
  1349. begin
  1350. while cmd[1]=' ' do
  1351. delete(cmd,1,1);
  1352. i:=pos(' ',cmd);
  1353. if i=0 then
  1354. i:=256;
  1355. opts:=Copy(cmd,1,i-1);
  1356. Delete(cmd,1,i);
  1357. case opts[1] of
  1358. '@' :
  1359. if not firstpass then
  1360. begin
  1361. Delete(opts,1,1);
  1362. Message1(option_reading_further_from,opts);
  1363. interpret_file(opts);
  1364. end;
  1365. '!' :
  1366. if not firstpass then
  1367. begin
  1368. Delete(opts,1,1);
  1369. Message1(option_reading_further_from,'(env) '+opts);
  1370. interpret_envvar(opts);
  1371. end;
  1372. '"' :
  1373. begin
  1374. Delete(opts,1,1);
  1375. ps:=pos('"',cmd);
  1376. if (i<>256) and (ps>0) then
  1377. begin
  1378. opts:=opts + ' '+ copy(cmd,1,ps-1);
  1379. cmd:=copy(cmd,ps+1,255);
  1380. end;
  1381. interpret_option(opts,true);
  1382. end;
  1383. else
  1384. interpret_option(opts,true);
  1385. end;
  1386. end;
  1387. end;
  1388. procedure toption.writequickinfo;
  1389. var
  1390. s : string;
  1391. i : longint;
  1392. procedure addinfo(const hs:string);
  1393. begin
  1394. if s<>'' then
  1395. s:=s+' '+hs
  1396. else
  1397. s:=hs;
  1398. end;
  1399. begin
  1400. s:='';
  1401. i:=0;
  1402. while (i<length(quickinfo)) do
  1403. begin
  1404. inc(i);
  1405. case quickinfo[i] of
  1406. 'S' :
  1407. begin
  1408. inc(i);
  1409. case quickinfo[i] of
  1410. 'O' :
  1411. addinfo(lower(source_info.shortname));
  1412. {$ifdef Delphi}
  1413. 'P' :
  1414. addinfo('i386');
  1415. {$else Delphi}
  1416. 'P' :
  1417. addinfo(source_cpu_string);
  1418. {$endif Delphi}
  1419. else
  1420. IllegalPara('-iS'+QuickInfo);
  1421. end;
  1422. end;
  1423. 'T' :
  1424. begin
  1425. inc(i);
  1426. case quickinfo[i] of
  1427. 'O' :
  1428. addinfo(lower(target_info.shortname));
  1429. 'P' :
  1430. AddInfo(target_cpu_string);
  1431. else
  1432. IllegalPara('-iT'+QuickInfo);
  1433. end;
  1434. end;
  1435. 'V' :
  1436. AddInfo(version_string);
  1437. 'D' :
  1438. AddInfo(date_string);
  1439. '_' :
  1440. ;
  1441. else
  1442. IllegalPara('-i'+QuickInfo);
  1443. end;
  1444. end;
  1445. if s<>'' then
  1446. begin
  1447. writeln(s);
  1448. stopoptions;
  1449. end;
  1450. end;
  1451. procedure TOption.TargetDefines(def:boolean);
  1452. var
  1453. s : string;
  1454. i : integer;
  1455. begin
  1456. if def then
  1457. def_symbol(upper(target_info.shortname))
  1458. else
  1459. undef_symbol(upper(target_info.shortname));
  1460. s:=target_info.extradefines;
  1461. while (s<>'') do
  1462. begin
  1463. i:=pos(';',s);
  1464. if i=0 then
  1465. i:=length(s)+1;
  1466. if def then
  1467. def_symbol(Copy(s,1,i-1))
  1468. else
  1469. undef_symbol(Copy(s,1,i-1));
  1470. delete(s,1,i);
  1471. end;
  1472. end;
  1473. constructor TOption.create;
  1474. begin
  1475. DoWriteLogo:=false;
  1476. NoPressEnter:=false;
  1477. FirstPass:=false;
  1478. FileLevel:=0;
  1479. Quickinfo:='';
  1480. ParaIncludePath:=TSearchPathList.Create;
  1481. ParaObjectPath:=TSearchPathList.Create;
  1482. ParaUnitPath:=TSearchPathList.Create;
  1483. ParaLibraryPath:=TSearchPathList.Create;
  1484. FillChar(ParaAlignment,sizeof(ParaAlignment),0);
  1485. end;
  1486. destructor TOption.destroy;
  1487. begin
  1488. ParaIncludePath.Free;
  1489. ParaObjectPath.Free;
  1490. ParaUnitPath.Free;
  1491. ParaLibraryPath.Free;
  1492. end;
  1493. {****************************************************************************
  1494. Callable Routines
  1495. ****************************************************************************}
  1496. function check_configfile(const fn:string;var foundfn:string):boolean;
  1497. function CfgFileExists(const fn:string):boolean;
  1498. begin
  1499. Comment(V_Tried,'Configfile search: '+fn);
  1500. CfgFileExists:=FileExists(fn);
  1501. end;
  1502. var
  1503. configpath : pathstr;
  1504. begin
  1505. foundfn:=fn;
  1506. check_configfile:=true;
  1507. { retrieve configpath }
  1508. {$ifdef Delphi}
  1509. configpath:=FixPath(dmisc.getenv('PPC_CONFIG_PATH'),false);
  1510. {$else Delphi}
  1511. configpath:=FixPath(dos.getenv('PPC_CONFIG_PATH'),false);
  1512. {$endif Delphi}
  1513. {$ifdef Unix}
  1514. if configpath='' then
  1515. configpath:='/etc/';
  1516. {$endif}
  1517. {
  1518. Order to read configuration file :
  1519. try reading fpc.cfg in :
  1520. 1 - current dir
  1521. 2 - configpath
  1522. 3 - compiler path
  1523. }
  1524. if not FileExists(fn) then
  1525. begin
  1526. {$ifdef Unix}
  1527. if (dos.getenv('HOME')<>'') and CfgFileExists(FixPath(dos.getenv('HOME'),false)+'.'+fn) then
  1528. foundfn:=FixPath(dos.getenv('HOME'),false)+'.'+fn
  1529. else
  1530. {$endif}
  1531. if CfgFileExists(configpath+fn) then
  1532. foundfn:=configpath+fn
  1533. else
  1534. {$ifndef Unix}
  1535. if CfgFileExists(exepath+fn) then
  1536. foundfn:=exepath+fn
  1537. else
  1538. {$endif}
  1539. check_configfile:=false;
  1540. end;
  1541. end;
  1542. procedure read_arguments(cmd:string);
  1543. begin
  1544. option:=coption.create;
  1545. disable_configfile:=false;
  1546. { default defines }
  1547. def_symbol(upper(target_info.shortname));
  1548. def_symbol('FPC');
  1549. def_symbol('VER'+version_nr);
  1550. def_symbol('VER'+version_nr+'_'+release_nr);
  1551. def_symbol('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
  1552. { Temporary defines, until things settle down }
  1553. def_symbol('HASWIDECHAR');
  1554. def_symbol('HASWIDESTRING');
  1555. def_symbol('HASOUT');
  1556. { for now, the PowerPC doesn't support variants and interfaces }
  1557. {$ifdef i386}
  1558. def_symbol('HASINTF');
  1559. def_symbol('HASVARIANT');
  1560. {$endif i386}
  1561. def_symbol('INTERNSETLENGTH');
  1562. def_symbol('INTERNLENGTH');
  1563. def_symbol('INTERNCOPY');
  1564. def_symbol('INT64FUNCRESOK');
  1565. def_symbol('HAS_ADDR_STACK_ON_STACK');
  1566. def_symbol('NOBOUNDCHECK');
  1567. def_symbol('HASCOMPILERPROC');
  1568. def_symbol('VALUEGETMEM');
  1569. def_symbol('VALUEFREEMEM');
  1570. def_symbol('HASCURRENCY');
  1571. def_symbol('HASTHREADVAR');
  1572. def_symbol('HAS_GENERICCONSTRUCTOR');
  1573. def_symbol('NOCLASSHELPERS');
  1574. { using a case is pretty useless here (FK) }
  1575. { some stuff for TP compatibility }
  1576. {$ifdef i386}
  1577. def_symbol('CPU86');
  1578. def_symbol('CPU87');
  1579. {$endif}
  1580. {$ifdef m68k}
  1581. def_symbol('CPU68');
  1582. {$endif}
  1583. { new processor stuff }
  1584. {$ifdef i386}
  1585. def_symbol('CPUI386');
  1586. def_symbol('CPU32');
  1587. def_symbol('FPC_HAS_TYPE_EXTENDED');
  1588. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1589. def_symbol('FPC_HAS_TYPE_SINGLE');
  1590. {$endif}
  1591. {$ifdef m68k}
  1592. def_symbol('CPU68K');
  1593. def_symbol('CPU32');
  1594. {$endif}
  1595. {$ifdef ALPHA}
  1596. def_symbol('CPUALPHA');
  1597. def_symbol('CPU64');
  1598. {$endif}
  1599. {$ifdef powerpc}
  1600. def_symbol('CPUPOWERPC');
  1601. def_symbol('CPUPOWERPC32');
  1602. def_symbol('CPU32');
  1603. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1604. def_symbol('FPC_HAS_TYPE_SINGLE');
  1605. def_symbol('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
  1606. {$endif}
  1607. {$ifdef iA64}
  1608. def_symbol('CPUIA64');
  1609. def_symbol('CPU64');
  1610. {$endif}
  1611. {$ifdef x86_64}
  1612. def_symbol('CPUX86_64');
  1613. def_symbol('CPU64');
  1614. def_symbol('FPC_HAS_TYPE_FLOAT128');
  1615. def_symbol('FPC_HAS_TYPE_EXTENDED');
  1616. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1617. def_symbol('FPC_HAS_TYPE_SINGLE');
  1618. {$endif}
  1619. {$ifdef sparc}
  1620. def_symbol('CPUSPARC');
  1621. def_symbol('CPUSPARC32');
  1622. def_symbol('CPU32');
  1623. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1624. def_symbol('FPC_HAS_TYPE_SINGLE');
  1625. def_symbol('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
  1626. {$endif}
  1627. {$ifdef vis}
  1628. def_symbol('CPUVIS');
  1629. def_symbol('CPU32');
  1630. {$endif}
  1631. {$ifdef arm}
  1632. def_symbol('CPUARM');
  1633. def_symbol('CPU32');
  1634. def_symbol('FPC_HAS_TYPE_DOUBLE');
  1635. def_symbol('FPC_HAS_TYPE_SINGLE');
  1636. {$endif arm}
  1637. { get default messagefile }
  1638. {$ifdef Delphi}
  1639. msgfilename:=dmisc.getenv('PPC_ERROR_FILE');
  1640. {$else Delphi}
  1641. msgfilename:=dos.getenv('PPC_ERROR_FILE');
  1642. {$endif Delphi}
  1643. { default configfile can be specified on the commandline,
  1644. remove it first }
  1645. if (cmd<>'') and (cmd[1]='[') then
  1646. begin
  1647. ppccfg:=Copy(cmd,2,pos(']',cmd)-2);
  1648. Delete(cmd,1,pos(']',cmd));
  1649. end
  1650. else
  1651. begin
  1652. ppccfg:='fpc.cfg';
  1653. ppcaltcfg:='ppc386.cfg';
  1654. end;
  1655. { read the parameters quick, only -i -v -T }
  1656. option.firstpass:=true;
  1657. if cmd<>'' then
  1658. option.parsecmd(cmd)
  1659. else
  1660. begin
  1661. option.read_parameters;
  1662. { Write only quickinfo }
  1663. if option.quickinfo<>'' then
  1664. option.writequickinfo;
  1665. end;
  1666. option.firstpass:=false;
  1667. { read configuration file }
  1668. if (not disable_configfile) and
  1669. (ppccfg<>'') then
  1670. begin
  1671. read_configfile:=check_configfile(ppccfg,ppccfg);
  1672. { Maybe alternative configfile ? }
  1673. if (not read_configfile) and
  1674. (ppcaltcfg<>'') then
  1675. read_configfile:=check_configfile(ppcaltcfg,ppccfg);
  1676. end
  1677. else
  1678. read_configfile := false;
  1679. { Read commandline and configfile }
  1680. target_is_set:=false;
  1681. asm_is_set:=false;
  1682. param_file:='';
  1683. { read configfile }
  1684. if read_configfile then
  1685. option.interpret_file(ppccfg);
  1686. { read parameters again to override config file }
  1687. if cmd<>'' then
  1688. option.parsecmd(cmd)
  1689. else
  1690. begin
  1691. option.read_parameters;
  1692. { Write only quickinfo }
  1693. if option.quickinfo<>'' then
  1694. option.writequickinfo;
  1695. end;
  1696. { Write help pages }
  1697. if (cmd='') and (paramcount=0) then
  1698. Option.WriteHelpPages;
  1699. { Stop if errors in options }
  1700. if ErrorCount>0 then
  1701. StopOptions;
  1702. { Non-core target defines }
  1703. Option.TargetDefines(true);
  1704. { endian define }
  1705. case target_info.endian of
  1706. endian_little :
  1707. begin
  1708. def_symbol('ENDIAN_LITTLE');
  1709. def_symbol('FPC_LITTLE_ENDIAN');
  1710. end;
  1711. endian_big :
  1712. begin
  1713. def_symbol('ENDIAN_BIG');
  1714. def_symbol('FPC_BIG_ENDIAN');
  1715. end;
  1716. end;
  1717. { abi define }
  1718. case target_info.abi of
  1719. abi_powerpc_sysv :
  1720. def_symbol('FPC_ABI_SYSV');
  1721. abi_powerpc_aix :
  1722. def_symbol('FPC_ABI_AIX');
  1723. end;
  1724. {$ifdef m68k}
  1725. if initoptprocessor=MC68020 then
  1726. def_symbol('CPUM68020');
  1727. {$endif m68k}
  1728. { write logo if set }
  1729. if option.DoWriteLogo then
  1730. option.WriteLogo;
  1731. { Check file to compile }
  1732. if param_file='' then
  1733. begin
  1734. Message(option_no_source_found);
  1735. StopOptions;
  1736. end;
  1737. {$ifndef Unix}
  1738. param_file:=FixFileName(param_file);
  1739. {$endif}
  1740. fsplit(param_file,inputdir,inputfile,inputextension);
  1741. if inputextension='' then
  1742. begin
  1743. if FileExists(inputdir+inputfile+target_info.sourceext) then
  1744. inputextension:=target_info.sourceext
  1745. else
  1746. if FileExists(inputdir+inputfile+target_info.pasext) then
  1747. inputextension:=target_info.pasext;
  1748. end;
  1749. { Add paths specified with parameters to the searchpaths }
  1750. UnitSearchPath.AddList(option.ParaUnitPath,true);
  1751. ObjectSearchPath.AddList(option.ParaObjectPath,true);
  1752. IncludeSearchPath.AddList(option.ParaIncludePath,true);
  1753. LibrarySearchPath.AddList(option.ParaLibraryPath,true);
  1754. { add unit environment and exepath to the unit search path }
  1755. if inputdir<>'' then
  1756. Unitsearchpath.AddPath(inputdir,true);
  1757. if not disable_configfile then
  1758. begin
  1759. {$ifdef Delphi}
  1760. UnitSearchPath.AddPath(dmisc.getenv(target_info.unit_env),false);
  1761. {$else}
  1762. UnitSearchPath.AddPath(dos.getenv(target_info.unit_env),false);
  1763. {$endif Delphi}
  1764. end;
  1765. {$ifdef Unix}
  1766. fpcdir:=FixPath(getenv('FPCDIR'),false);
  1767. if fpcdir='' then
  1768. begin
  1769. if PathExists('/usr/local/lib/fpc/'+version_string) then
  1770. fpcdir:='/usr/local/lib/fpc/'+version_string+'/'
  1771. else
  1772. fpcdir:='/usr/lib/fpc/'+version_string+'/';
  1773. end;
  1774. {$else}
  1775. fpcdir:=FixPath(getenv('FPCDIR'),false);
  1776. if fpcdir='' then
  1777. begin
  1778. fpcdir:=ExePath+'../';
  1779. if not(PathExists(fpcdir+'/units')) and
  1780. not(PathExists(fpcdir+'/rtl')) then
  1781. fpcdir:=fpcdir+'../';
  1782. end;
  1783. {$endif}
  1784. { first try development RTL, else use the default installation path }
  1785. if not disable_configfile then
  1786. begin
  1787. if PathExists(FpcDir+'rtl/'+lower(target_info.shortname)) then
  1788. UnitSearchPath.AddPath(FpcDir+'rtl/'+lower(target_info.shortname),false)
  1789. else
  1790. begin
  1791. UnitSearchPath.AddPath(FpcDir+'units/'+lower(target_info.shortname),false);
  1792. UnitSearchPath.AddPath(FpcDir+'units/'+lower(target_info.shortname)+'/rtl',false);
  1793. end;
  1794. end;
  1795. { Add exepath if the exe is not in the current dir, because that is always searched already.
  1796. Do not add it when linking on the target because then we can maybe already find
  1797. .o files that are not for the target }
  1798. if (ExePath<>GetCurrentDir) and
  1799. not(cs_link_on_target in initglobalswitches) then
  1800. UnitSearchPath.AddPath(ExePath,false);
  1801. { Add unit dir to the object and library path }
  1802. objectsearchpath.AddList(unitsearchpath,false);
  1803. librarysearchpath.AddList(unitsearchpath,false);
  1804. { switch assembler if it's binary and we got -a on the cmdline }
  1805. if (cs_asm_leave in initglobalswitches) and
  1806. (target_asm.outputbinary) then
  1807. begin
  1808. Message(option_switch_bin_to_src_assembler);
  1809. set_target_asm(target_info.assemextern);
  1810. end;
  1811. if (target_asm.supported_target <> system_any) and
  1812. (target_asm.supported_target <> target_info.system) then
  1813. begin
  1814. Message2(option_incompatible_asm,target_asm.idtxt,target_info.name);
  1815. set_target_asm(target_info.assemextern);
  1816. Message1(option_asm_forced,target_asm.idtxt);
  1817. end;
  1818. { turn off stripping if compiling with debuginfo or profile }
  1819. if (cs_debuginfo in initmoduleswitches) or
  1820. (cs_profile in initmoduleswitches) then
  1821. exclude(initglobalswitches,cs_link_strip);
  1822. if not LinkTypeSetExplicitly then
  1823. set_default_link_type;
  1824. { Default alignment settings,
  1825. 1. load the defaults for the target
  1826. 2. override with generic optimizer setting (little size)
  1827. 3. override with the user specified -Oa }
  1828. UpdateAlignment(initalignment,target_info.alignment);
  1829. if (cs_littlesize in aktglobalswitches) then
  1830. begin
  1831. initalignment.procalign:=1;
  1832. initalignment.jumpalign:=1;
  1833. initalignment.loopalign:=1;
  1834. end;
  1835. UpdateAlignment(initalignment,option.paraalignment);
  1836. option.free;
  1837. Option:=nil;
  1838. end;
  1839. initialization
  1840. coption:=toption;
  1841. finalization
  1842. if assigned(option) then
  1843. option.free;
  1844. end.
  1845. {
  1846. $Log$
  1847. Revision 1.110 2003-10-14 00:30:48 florian
  1848. + some code for PIC support added
  1849. Revision 1.109 2003/10/11 19:32:04 marco
  1850. * -Xd
  1851. Revision 1.108 2003/10/08 19:17:43 peter
  1852. * -P to -ap
  1853. * -V to -vv
  1854. Revision 1.107 2003/10/03 14:16:48 marco
  1855. * -XP<prefix> support
  1856. Revision 1.106 2003/09/17 21:37:07 olle
  1857. + added command line option for language mode -M<x>
  1858. Revision 1.105 2003/09/14 21:33:11 peter
  1859. * don't check exepath when linking on target
  1860. Revision 1.104 2003/09/06 10:41:54 olle
  1861. + compiler now define abi macros for powerpc FPC_ABI_AIX or FPC_ABI_SYSV
  1862. Revision 1.103 2003/09/05 17:41:12 florian
  1863. * merged Wiktor's Watcom patches in 1.1
  1864. Revision 1.102 2003/09/03 21:06:05 peter
  1865. * powerpc needs software int64 to double
  1866. Revision 1.101 2003/09/03 15:55:01 peter
  1867. * NEWRA branch merged
  1868. Revision 1.100 2003/09/03 11:18:37 florian
  1869. * fixed arm concatcopy
  1870. + arm support in the common compiler sources added
  1871. * moved some generic cg code around
  1872. + tfputype added
  1873. * ...
  1874. Revision 1.99.2.4 2003/09/02 17:48:42 peter
  1875. * sparc need software int64 to double
  1876. Revision 1.99.2.3 2003/09/01 21:02:55 peter
  1877. * sparc updates for new tregister
  1878. Revision 1.99.2.2 2003/08/31 16:18:05 peter
  1879. * more fixes
  1880. Revision 1.99.2.1 2003/08/31 13:50:15 daniel
  1881. * Remove sorting and use pregenerated indexes
  1882. * Some work on making things compile
  1883. Revision 1.99 2003/05/13 19:14:41 peter
  1884. * failn removed
  1885. * inherited result code check moven to pexpr
  1886. Revision 1.98 2003/05/11 19:17:16 florian
  1887. * FPC_LITTLE_ENDIAN and FPC_BIG_ENDIAN is now defined as well
  1888. Revision 1.97 2003/05/01 07:59:42 florian
  1889. * introduced defaultordconsttype to decribe the default size of ordinal constants
  1890. on 64 bit CPUs it's equal to cs64bitdef while on 32 bit CPUs it's equal to s32bitdef
  1891. + added defines CPU32 and CPU64 for 32 bit and 64 bit CPUs
  1892. * int64s/qwords are allowed as for loop counter on 64 bit CPUs
  1893. Revision 1.96 2003/04/30 16:35:00 florian
  1894. * fixed defines for x86-64
  1895. Revision 1.95 2003/04/24 11:21:45 florian
  1896. + HAS_TYPE_* defines for floats on i386 and powerpc added
  1897. Revision 1.94 2003/03/28 19:16:56 peter
  1898. * generic constructor working for i386
  1899. * remove fixed self register
  1900. * esi added as address register for i386
  1901. Revision 1.93 2003/03/23 23:20:38 hajny
  1902. + emx target added
  1903. Revision 1.92 2003/03/08 08:59:07 daniel
  1904. + $define newra will enable new register allocator
  1905. + getregisterint will return imaginary registers with $newra
  1906. + -sr switch added, will skip register allocation so you can see
  1907. the direct output of the code generator before register allocation
  1908. Revision 1.91 2002/12/06 16:56:58 peter
  1909. * only compile cs_fp_emulation support when cpufpuemu is defined
  1910. * define cpufpuemu for m68k only
  1911. Revision 1.90 2002/11/30 23:14:55 carl
  1912. - removed cs_fp_emulation checking for m68k, its now controled
  1913. by a global switch
  1914. + added powerpc/sparc/vis message options support
  1915. Revision 1.89 2002/11/30 21:29:56 carl
  1916. + -Ce for softfpu
  1917. Revision 1.88 2002/11/15 01:58:52 peter
  1918. * merged changes from 1.0.7 up to 04-11
  1919. - -V option for generating bug report tracing
  1920. - more tracing for option parsing
  1921. - errors for cdecl and high()
  1922. - win32 import stabs
  1923. - win32 records<=8 are returned in eax:edx (turned off by default)
  1924. - heaptrc update
  1925. - more info for temp management in .s file with EXTDEBUG
  1926. Revision 1.87 2002/10/23 17:07:40 peter
  1927. * fix -n that was broken in the previous commit
  1928. Revision 1.86 2002/10/23 16:57:16 peter
  1929. * first search for fpc.cfg instead of deprecated ppc386.cfg
  1930. * parse commandline options first before searching configfile so -vt
  1931. can be used to display the searched files
  1932. Revision 1.85 2002/10/13 21:33:01 peter
  1933. * define HASTHREADVAR
  1934. Revision 1.84 2002/10/02 18:20:52 peter
  1935. * Copy() is now internal syssym that calls compilerprocs
  1936. Revision 1.83 2002/09/22 14:02:35 carl
  1937. * stack checking cannot be called before system unit is initialized
  1938. * MC68020 define
  1939. Revision 1.82 2002/08/12 15:08:40 carl
  1940. + stab register indexes for powerpc (moved from gdb to cpubase)
  1941. + tprocessor enumeration moved to cpuinfo
  1942. + linker in target_info is now a class
  1943. * many many updates for m68k (will soon start to compile)
  1944. - removed some ifdef or correct them for correct cpu
  1945. Revision 1.81 2002/08/10 14:46:29 carl
  1946. + moved target_cpu_string to cpuinfo
  1947. * renamed asmmode enum.
  1948. * assembler reader has now less ifdef's
  1949. * move from nppcmem.pas -> ncgmem.pas vec. node.
  1950. Revision 1.80 2002/08/09 19:15:41 carl
  1951. - removed newcg define
  1952. Revision 1.79 2002/07/26 22:22:10 florian
  1953. * several PowerPC related fixes to get forward with system unit compilation
  1954. Revision 1.78 2002/07/26 21:15:39 florian
  1955. * rewrote the system handling
  1956. Revision 1.77 2002/07/20 17:16:03 florian
  1957. + source code page support
  1958. Revision 1.76 2002/07/04 20:43:01 florian
  1959. * first x86-64 patches
  1960. Revision 1.75 2002/07/01 18:46:24 peter
  1961. * internal linker
  1962. * reorganized aasm layer
  1963. Revision 1.74 2002/07/01 16:23:53 peter
  1964. * cg64 patch
  1965. * basics for currency
  1966. * asnode updates for class and interface (not finished)
  1967. Revision 1.73 2002/05/18 13:34:11 peter
  1968. * readded missing revisions
  1969. Revision 1.72 2002/05/16 19:46:41 carl
  1970. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  1971. + try to fix temp allocation (still in ifdef)
  1972. + generic constructor calls
  1973. + start of tassembler / tmodulebase class cleanup
  1974. Revision 1.70 2002/05/12 16:53:08 peter
  1975. * moved entry and exitcode to ncgutil and cgobj
  1976. * foreach gets extra argument for passing local data to the
  1977. iterator function
  1978. * -CR checks also class typecasts at runtime by changing them
  1979. into as
  1980. * fixed compiler to cycle with the -CR option
  1981. * fixed stabs with elf writer, finally the global variables can
  1982. be watched
  1983. * removed a lot of routines from cga unit and replaced them by
  1984. calls to cgobj
  1985. * u32bit-s32bit updates for and,or,xor nodes. When one element is
  1986. u32bit then the other is typecasted also to u32bit without giving
  1987. a rangecheck warning/error.
  1988. * fixed pascal calling method with reversing also the high tree in
  1989. the parast, detected by tcalcst3 test
  1990. Revision 1.69 2002/04/21 19:02:04 peter
  1991. * removed newn and disposen nodes, the code is now directly
  1992. inlined from pexpr
  1993. * -an option that will write the secondpass nodes to the .s file, this
  1994. requires EXTDEBUG define to actually write the info
  1995. * fixed various internal errors and crashes due recent code changes
  1996. Revision 1.68 2002/04/20 21:32:24 carl
  1997. + generic FPC_CHECKPOINTER
  1998. + first parameter offset in stack now portable
  1999. * rename some constants
  2000. + move some cpu stuff to other units
  2001. - remove unused constents
  2002. * fix stacksize for some targets
  2003. * fix generic size problems which depend now on EXTEND_SIZE constant
  2004. Revision 1.67 2002/04/07 10:22:35 carl
  2005. + CPU defines now depends on current target
  2006. Revision 1.66 2002/04/04 19:05:58 peter
  2007. * removed unused units
  2008. * use tlocation.size in cg.a_*loc*() routines
  2009. Revision 1.65 2002/04/04 18:39:45 carl
  2010. + added wdosx support (patch from Pavel)
  2011. }