options.pas 64 KB

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