options.pas 64 KB

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