options.pas 63 KB

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