options.pas 64 KB

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