options.pas 63 KB

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