options.pas 62 KB

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