options.pas 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. interface
  20. uses
  21. globtype,globals,verbose;
  22. type
  23. POption=^TOption;
  24. TOption=object
  25. FirstPass,
  26. NoPressEnter,
  27. DoWriteLogo : boolean;
  28. FileLevel : longint;
  29. ParaIncludePath,
  30. ParaUnitPath,
  31. ParaObjectPath,
  32. ParaLibraryPath : TSearchPathList;
  33. Constructor Init;
  34. Destructor Done;
  35. procedure WriteLogo;
  36. procedure WriteInfo;
  37. procedure WriteHelpPages;
  38. procedure QuickInfo(const s:string);
  39. procedure IllegalPara(const opt:string);
  40. function Unsetbool(const opts:string; pos: Longint):boolean;
  41. procedure interpret_proc_specific_options(const opt:string);virtual;
  42. procedure interpret_option(const opt :string;ispara:boolean);
  43. procedure Interpret_envvar(const envname : string);
  44. procedure Interpret_file(const filename : string);
  45. procedure Read_Parameters;
  46. procedure parsecmd(cmd:string);
  47. end;
  48. procedure read_arguments(cmd:string);
  49. implementation
  50. uses
  51. {$ifdef Delphi}
  52. dmisc,
  53. {$else Delphi}
  54. dos,
  55. {$endif Delphi}
  56. version,systems,
  57. cobjects,
  58. symtable,scanner,link,messages
  59. {$ifdef BrowserLog}
  60. ,browlog
  61. {$endif BrowserLog}
  62. {$ifdef i386}
  63. ,opts386
  64. {$endif}
  65. {$ifdef m68k}
  66. ,opts68k
  67. {$endif}
  68. ;
  69. const
  70. page_size = 24;
  71. var
  72. option : poption;
  73. read_configfile, { read config file, set when a cfgfile is found }
  74. target_is_set : boolean; { do not allow contradictory target settings }
  75. asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
  76. ppccfg,
  77. msgfilename,
  78. param_file : string; { file to compile specified on the commandline }
  79. {****************************************************************************
  80. Defines
  81. ****************************************************************************}
  82. procedure def_symbol(const s : string);
  83. begin
  84. if s='' then
  85. exit;
  86. initdefines.concat(new(pstring_item,init(upper(s))));
  87. end;
  88. procedure undef_symbol(const s : string);
  89. var
  90. item,next : pstring_item;
  91. begin
  92. if s='' then
  93. exit;
  94. item:=pstring_item(initdefines.first);
  95. while assigned(item) do
  96. begin
  97. if (item^.str^=s) then
  98. begin
  99. next:=pstring_item(item^.next);
  100. initdefines.remove(item);
  101. dispose(item,done);
  102. item:=next;
  103. end
  104. else
  105. if item<>pstring_item(item^.next) then
  106. item:=pstring_item(item^.next)
  107. else
  108. break;
  109. end;
  110. end;
  111. function check_symbol(const s:string):boolean;
  112. var
  113. hp : pstring_item;
  114. begin
  115. hp:=pstring_item(initdefines.first);
  116. while assigned(hp) do
  117. begin
  118. if (hp^.str^=s) then
  119. begin
  120. check_symbol:=true;
  121. exit;
  122. end;
  123. hp:=pstring_item(hp^.next);
  124. end;
  125. check_symbol:=false;
  126. end;
  127. procedure MaybeLoadMessageFile;
  128. begin
  129. { Load new message file }
  130. if (msgfilename<>'') then
  131. begin
  132. if fileexists(msgfilename) then
  133. LoadMsgFile(msgfilename);
  134. msgfilename:='';
  135. end;
  136. end;
  137. {****************************************************************************
  138. Toption
  139. ****************************************************************************}
  140. procedure StopOptions;
  141. begin
  142. if assigned(Option) then
  143. begin
  144. dispose(Option,Done);
  145. Option:=nil;
  146. end;
  147. DoneVerbose;
  148. Stop;
  149. end;
  150. procedure Toption.WriteLogo;
  151. var
  152. i : tmsgconst;
  153. begin
  154. MaybeLoadMessageFile;
  155. for i:=option_logo_start to option_logo_end do
  156. Message1(i,target_cpu_string);
  157. end;
  158. procedure Toption.WriteInfo;
  159. var
  160. i : tmsgconst;
  161. begin
  162. MaybeLoadMessageFile;
  163. for i:=option_info_start to option_info_end do
  164. Message(i);
  165. StopOptions;
  166. end;
  167. procedure Toption.WriteHelpPages;
  168. function PadEnd(s:string;i:longint):string;
  169. begin
  170. while (length(s)<i) do
  171. s:=s+' ';
  172. PadEnd:=s;
  173. end;
  174. var
  175. idx,
  176. lastident,
  177. j,outline,
  178. ident,
  179. lines : longint;
  180. show : boolean;
  181. opt : string[32];
  182. input,
  183. s : string;
  184. begin
  185. MaybeLoadMessageFile;
  186. Message1(option_usage,paramstr(0));
  187. lastident:=0;
  188. if DoWriteLogo then
  189. lines:=3
  190. else
  191. lines:=1;
  192. for idx:=ord(ol_begin) to ord(ol_end) do
  193. begin
  194. { get a line and reset }
  195. s:=msg^.Get(idx);
  196. ident:=0;
  197. show:=false;
  198. { parse options }
  199. case s[1] of
  200. {$ifdef i386}
  201. '3',
  202. {$endif}
  203. {$ifdef m68k}
  204. '6',
  205. {$endif}
  206. '*' : show:=true;
  207. end;
  208. if show then
  209. begin
  210. case s[2] of
  211. {$ifdef TP}
  212. 't',
  213. {$endif}
  214. {$ifdef GDB}
  215. 'g',
  216. {$endif}
  217. {$ifdef linux}
  218. 'L',
  219. {$endif}
  220. {$ifdef os2}
  221. 'O',
  222. {$endif}
  223. '*' : show:=true;
  224. else
  225. show:=false;
  226. end;
  227. end;
  228. { now we may show the message or not }
  229. if show then
  230. begin
  231. case s[3] of
  232. '0' : begin
  233. ident:=0;
  234. outline:=0;
  235. end;
  236. '1' : begin
  237. ident:=2;
  238. outline:=7;
  239. end;
  240. '2' : begin
  241. ident:=11;
  242. outline:=11;
  243. end;
  244. '3' : begin
  245. ident:=21;
  246. outline:=6;
  247. end;
  248. end;
  249. j:=pos('_',s);
  250. opt:=Copy(s,4,j-4);
  251. if opt='*' then
  252. opt:=''
  253. else
  254. opt:=PadEnd('-'+opt,outline);
  255. if (ident=0) and (lastident<>0) then
  256. begin
  257. Comment(V_Normal,'');
  258. inc(Lines);
  259. end;
  260. { page full ? }
  261. if (lines>=page_size) then
  262. begin
  263. if not NoPressEnter then
  264. begin
  265. write('*** press enter ***');
  266. readln(input);
  267. if upper(input)='Q' then
  268. StopOptions;
  269. end;
  270. lines:=0;
  271. end;
  272. Comment(V_Normal,PadEnd('',ident)+opt+Copy(s,j+1,255));
  273. LastIdent:=Ident;
  274. inc(Lines);
  275. end;
  276. end;
  277. StopOptions;
  278. end;
  279. procedure Toption.QuickInfo(const s:string);
  280. begin
  281. if source_os.newline=#13#10 then
  282. Write(s+#10)
  283. else
  284. Writeln(s);
  285. StopOptions;
  286. end;
  287. procedure Toption.IllegalPara(const opt:string);
  288. begin
  289. Message1(option_illegal_para,opt);
  290. Message(option_help_pages_para);
  291. StopOptions;
  292. end;
  293. function Toption.Unsetbool(const opts:string; pos: Longint):boolean;
  294. { checks if the character after pos in Opts is a + or a - and returns resp.
  295. false or true. If it is another character (or none), it also returns false }
  296. begin
  297. UnsetBool := (Length(Opts) > Pos) And (Opts[Succ(Pos)] = '-');
  298. end;
  299. procedure TOption.interpret_proc_specific_options(const opt:string);
  300. begin
  301. end;
  302. procedure TOption.interpret_option(const opt:string;ispara:boolean);
  303. var
  304. code : integer;
  305. c : char;
  306. more : string;
  307. major,minor : longint;
  308. error : integer;
  309. j,l : longint;
  310. d : DirStr;
  311. e : ExtStr;
  312. begin
  313. if opt='' then
  314. exit;
  315. { only parse define,undef,target,verbosity and link options the firsttime }
  316. if firstpass and
  317. not((opt[1]='-') and (opt[2] in ['i','d','v','T','u','n','X'])) then
  318. exit;
  319. case opt[1] of
  320. '-' : begin
  321. more:=Copy(opt,3,255);
  322. case opt[2] of
  323. '!' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
  324. '?' : WriteHelpPages;
  325. 'a' : begin
  326. initglobalswitches:=initglobalswitches+[cs_asm_leave];
  327. for j:=1 to length(more) do
  328. case more[j] of
  329. 'l' : initglobalswitches:=initglobalswitches+[cs_asm_source];
  330. 'r' : initglobalswitches:=initglobalswitches+[cs_asm_regalloc];
  331. 't' : initglobalswitches:=initglobalswitches+[cs_asm_tempalloc];
  332. '-' : initglobalswitches:=initglobalswitches-[cs_asm_leave,cs_asm_source,cs_asm_regalloc];
  333. else
  334. IllegalPara(opt);
  335. end;
  336. end;
  337. 'A' : begin
  338. if set_string_asm(More) then
  339. begin
  340. initoutputformat:=target_asm.id;
  341. asm_is_set:=true;
  342. end
  343. else
  344. IllegalPara(opt);
  345. end;
  346. 'b' : begin
  347. {$ifdef BrowserLog}
  348. initglobalswitches:=initglobalswitches+[cs_browser_log];
  349. {$endif}
  350. if More<>'' then
  351. if More='l' then
  352. initmoduleswitches:=initmoduleswitches+[cs_local_browser]
  353. else if More='-' then
  354. begin
  355. initmoduleswitches:=initmoduleswitches-[cs_browser,cs_local_browser];
  356. {$ifdef BrowserLog}
  357. initglobalswitches:=initglobalswitches-[cs_browser_log];
  358. {$endif}
  359. end
  360. else if More<>'+' then
  361. {$ifdef BrowserLog}
  362. browserlog.elements_to_list^.insert(more);
  363. {$else}
  364. IllegalPara(opt);
  365. {$endif}
  366. end;
  367. 'B' : if more='' then
  368. do_build:=true
  369. else
  370. if more = '-' then
  371. do_build := False
  372. else
  373. IllegalPara(opt);
  374. 'C' : begin
  375. j := 1;
  376. while j <= length(more) Do
  377. Begin
  378. case more[j] of
  379. 'a' : Simplify_ppu:=true;
  380. 'h' :
  381. begin
  382. val(copy(more,j+1,length(more)-j),heapsize,code);
  383. if (code<>0) or (heapsize>=67107840) or (heapsize<1024) then
  384. IllegalPara(opt);
  385. break;
  386. end;
  387. 'i' : If UnsetBool(More, j) then
  388. Begin
  389. initlocalswitches:=initlocalswitches-[cs_check_io];
  390. inc(j)
  391. End
  392. else initlocalswitches:=initlocalswitches+[cs_check_io];
  393. 'n' : If UnsetBool(More, j) then
  394. Begin
  395. initglobalswitches:=initglobalswitches-[cs_link_extern];
  396. inc(j)
  397. End
  398. Else initglobalswitches:=initglobalswitches+[cs_link_extern];
  399. 'o' :
  400. If UnsetBool(More, j) then
  401. Begin
  402. initlocalswitches:=initlocalswitches-[cs_check_overflow];
  403. inc(j);
  404. End
  405. Else
  406. initlocalswitches:=initlocalswitches+[cs_check_overflow];
  407. 'r' :
  408. If UnsetBool(More, j) then
  409. Begin
  410. initlocalswitches:=initlocalswitches-[cs_check_range];
  411. inc(j);
  412. End
  413. Else
  414. initlocalswitches:=initlocalswitches+[cs_check_range];
  415. 's' :
  416. begin
  417. val(copy(more,j+1,length(more)-j),stacksize,code);
  418. if (code<>0) or (stacksize>=67107840) or (stacksize<1024) then
  419. IllegalPara(opt);
  420. break;
  421. end;
  422. 't' :
  423. If UnsetBool(More, j) then
  424. Begin
  425. initlocalswitches:=initlocalswitches-[cs_check_stack];
  426. inc(j)
  427. End
  428. Else
  429. initlocalswitches:=initlocalswitches+[cs_check_stack];
  430. 'D' :
  431. If UnsetBool(More, j) then
  432. Begin
  433. initmoduleswitches:=initmoduleswitches-[cs_create_dynamic];
  434. inc(j)
  435. End
  436. Else
  437. initmoduleswitches:=initmoduleswitches+[cs_create_dynamic];
  438. 'X' :
  439. If UnsetBool(More, j) then
  440. Begin
  441. initmoduleswitches:=initmoduleswitches-[cs_create_smart];
  442. inc(j)
  443. End
  444. Else
  445. initmoduleswitches:=initmoduleswitches+[cs_create_smart];
  446. else
  447. IllegalPara(opt);
  448. end;
  449. inc(j);
  450. end;
  451. end;
  452. 'd' : def_symbol(more);
  453. 'D' : begin
  454. initglobalswitches:=initglobalswitches+[cs_link_deffile];
  455. for j:=1 to length(more) do
  456. case more[j] of
  457. 'd' : begin
  458. description:=Copy(more,j+1,255);
  459. break;
  460. end;
  461. 'v' : begin
  462. dllversion:=Copy(more,j+1,255);
  463. l:=pos('.',dllversion);
  464. dllminor:=0;
  465. error:=0;
  466. if l>0 then
  467. begin
  468. valint(copy(dllversion,l+1,255),minor,error);
  469. if (error=0) and
  470. (minor>=0) and (minor<=$ffff) then
  471. dllminor:=minor
  472. else if error=0 then
  473. error:=1;
  474. end;
  475. if l=0 then l:=256;
  476. dllmajor:=1;
  477. if error=0 then
  478. valint(copy(dllversion,1,l-1),major,error);
  479. if (error=0) and (major>=0) and (major<=$ffff) then
  480. dllmajor:=major
  481. else if error=0 then
  482. error:=1;
  483. if error<>0 then
  484. Message1(scan_w_wrong_version_ignored,dllversion);
  485. break;
  486. end;
  487. 'w' : usewindowapi:=true;
  488. else
  489. IllegalPara(opt);
  490. end;
  491. end;
  492. 'e' : exepath:=FixPath(More,true);
  493. { Just used by RHIDE }
  494. 'E' : if (length(more)=0) or (UnsetBool(More, 0)) then
  495. initglobalswitches:=initglobalswitches+[cs_link_extern]
  496. else
  497. initglobalswitches:=initglobalswitches-[cs_link_extern];
  498. 'F' : begin
  499. c:=more[1];
  500. Delete(more,1,1);
  501. case c of
  502. 'D' : begin
  503. if not ispara then
  504. DefaultReplacements(More);
  505. utilsdirectory:=FixPath(More,true);
  506. end;
  507. 'e' : SetRedirectFile(More);
  508. 'E' : OutputExeDir:=FixPath(More,true);
  509. 'i' : if ispara then
  510. ParaIncludePath.AddPath(More,false)
  511. else
  512. includesearchpath.AddPath(More,false);
  513. 'g' : Message2(option_obsolete_switch_use_new,'-Fg','-Fl');
  514. 'l' : if ispara then
  515. ParaLibraryPath.AddPath(More,false)
  516. else
  517. LibrarySearchPath.AddPath(More,false);
  518. 'L' : if More<>'' then
  519. ParaDynamicLinker:=More
  520. else
  521. IllegalPara(opt);
  522. 'o' : if ispara then
  523. ParaObjectPath.AddPath(More,false)
  524. else
  525. ObjectSearchPath.AddPath(More,false);
  526. 'r' : Msgfilename:=More;
  527. 'u' : if ispara then
  528. ParaUnitPath.AddPath(More,false)
  529. else
  530. unitsearchpath.AddPath(More,false);
  531. 'U' : OutputUnitDir:=FixPath(More,true);
  532. else
  533. IllegalPara(opt);
  534. end;
  535. end;
  536. 'g' : begin
  537. if UnsetBool(More, 0) then
  538. initmoduleswitches:=initmoduleswitches-[cs_debuginfo]
  539. else
  540. begin
  541. {$ifdef GDB}
  542. initmoduleswitches:=initmoduleswitches+[cs_debuginfo];
  543. if not RelocSectionSetExplicitly then
  544. RelocSection:=false;
  545. for j:=1 to length(more) do
  546. case more[j] of
  547. 'd' : initglobalswitches:=initglobalswitches+[cs_gdb_dbx];
  548. 'g' : initglobalswitches:=initglobalswitches+[cs_gdb_gsym];
  549. 'h' : initglobalswitches:=initglobalswitches+[cs_gdb_heaptrc];
  550. 'c' : initglobalswitches:=initglobalswitches+[cs_checkpointer];
  551. {$ifdef EXTDEBUG}
  552. 'p' : only_one_pass:=true;
  553. {$endif EXTDEBUG}
  554. else
  555. IllegalPara(opt);
  556. end;
  557. {$else GDB}
  558. Message(option_no_debug_support);
  559. Message(option_no_debug_support_recompile_fpc);
  560. {$endif GDB}
  561. end;
  562. end;
  563. 'h' : begin
  564. NoPressEnter:=true;
  565. WriteHelpPages;
  566. end;
  567. 'i' : if more='' then
  568. WriteInfo
  569. else
  570. begin
  571. { Specific info, which can be used in Makefiles }
  572. case More[1] of
  573. 'S' : begin
  574. case More[2] of
  575. 'O' : QuickInfo(source_os.shortname);
  576. {$ifdef Delphi !!!!!!!!!}
  577. 'P' : QuickInfo('unknown');
  578. {$else}
  579. 'P' : QuickInfo(source_cpu_string);
  580. {$endif}
  581. end;
  582. end;
  583. 'T' : begin
  584. case More[2] of
  585. 'O' : QuickInfo(target_os.shortname);
  586. 'P' : QuickInfo(target_cpu_string);
  587. end;
  588. end;
  589. 'V' : QuickInfo(version_string);
  590. 'D' : QuickInfo(date_string);
  591. else
  592. IllegalPara(Opt);
  593. end;
  594. end;
  595. 'I' : if ispara then
  596. ParaIncludePath.AddPath(More,false)
  597. else
  598. includesearchpath.AddPath(More,false);
  599. 'k' : if more<>'' then
  600. ParaLinkOptions:=ParaLinkOptions+' '+More
  601. else
  602. IllegalPara(opt);
  603. 'l' : if more='' then
  604. DoWriteLogo:=true
  605. else
  606. IllegalPara(opt);
  607. 'm' : parapreprocess:=true;
  608. 'n' : if More='' then
  609. read_configfile:=false
  610. else
  611. IllegalPara(opt);
  612. 'o' : if More<>'' then
  613. Fsplit(More,d,OutputFile,e)
  614. else
  615. IllegalPara(opt);
  616. 'p' : begin
  617. if UnsetBool(More, 0) then
  618. begin
  619. initmoduleswitches:=initmoduleswitches-[cs_profile];
  620. undef_symbol('FPC_PROFILE');
  621. end
  622. else
  623. case more[1] of
  624. 'g' : if (length(opt)=3) and UnsetBool(more, 1) then
  625. begin
  626. initmoduleswitches:=initmoduleswitches-[cs_profile];
  627. undef_symbol('FPC_PROFILE');
  628. end
  629. else
  630. begin
  631. initmoduleswitches:=initmoduleswitches+[cs_profile];
  632. def_symbol('FPC_PROFILE');
  633. end;
  634. else
  635. IllegalPara(opt);
  636. end;
  637. end;
  638. {$ifdef linux}
  639. 'P' : initglobalswitches:=initglobalswitches+[cs_asm_pipe];
  640. {$endif}
  641. 's' : initglobalswitches:=initglobalswitches+[cs_asm_extern,cs_link_extern];
  642. 'S' : begin
  643. for j:=1 to length(more) do
  644. case more[j] of
  645. '2' : initmodeswitches:=objfpcmodeswitches;
  646. 'c' : initmoduleswitches:=initmoduleswitches+[cs_support_c_operators];
  647. 'd' : initmodeswitches:=delphimodeswitches;
  648. 'e' : begin
  649. val(copy(more,j+1,length(more)-j),l,code);
  650. if (code<>0) then
  651. SetMaxErrorCount(1)
  652. else
  653. begin
  654. SetMaxErrorCount(l);
  655. break;
  656. end;
  657. end;
  658. 'g' : initmoduleswitches:=initmoduleswitches+[cs_support_goto];
  659. 'h' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
  660. 'i' : initmoduleswitches:=initmoduleswitches+[cs_support_inline];
  661. 'm' : initmoduleswitches:=initmoduleswitches+[cs_support_macro];
  662. 'o': initmodeswitches:=tpmodeswitches;
  663. 'p' : initmodeswitches:=gpcmodeswitches;
  664. 's' : initglobalswitches:=initglobalswitches+[cs_constructor_name];
  665. 't' : initmoduleswitches:=initmoduleswitches+[cs_static_keyword];
  666. 'v' : Message1(option_obsolete_switch,'-Sv');
  667. else
  668. IllegalPara(opt);
  669. end;
  670. end;
  671. 'T' : begin
  672. more:=Upper(More);
  673. if not target_is_set then
  674. begin
  675. { remove old target define }
  676. undef_symbol(target_info.short_name);
  677. { load new target }
  678. if not(set_string_target(More)) then
  679. IllegalPara(opt);
  680. { set new define }
  681. def_symbol(target_info.short_name);
  682. if not asm_is_set then
  683. initoutputformat:=target_asm.id;
  684. target_is_set:=true;
  685. end
  686. else
  687. if More<>target_info.short_name then
  688. Message1(option_target_is_already_set,target_info.short_name);
  689. end;
  690. 'u' : undef_symbol(upper(More));
  691. 'U' : begin
  692. for j:=1 to length(more) do
  693. case more[j] of
  694. {$ifdef UNITALIASES}
  695. 'a' : begin
  696. AddUnitAlias(Copy(More,j+1,255));
  697. break;
  698. end;
  699. {$endif UNITALIASES}
  700. 'n' : initglobalswitches:=initglobalswitches-[cs_check_unit_name];
  701. 'p' : begin
  702. Message2(option_obsolete_switch_use_new,'-Up','-Fu');
  703. break;
  704. end;
  705. 's' : initmoduleswitches:=initmoduleswitches+[cs_compilesystem];
  706. else
  707. IllegalPara(opt);
  708. end;
  709. end;
  710. 'v' : if not setverbosity(More) then
  711. IllegalPara(opt);
  712. 'W' : begin
  713. for j:=1 to length(More) do
  714. case More[j] of
  715. 'B': {bind_win32_dll:=true}
  716. begin
  717. { -WB200000 means set prefered base address
  718. to $200000, but does not change relocsection boolean
  719. this way we can create both relocatble and
  720. non relocatable DLL at a specific base address PM }
  721. if (length(More)>j) then
  722. begin
  723. if DLLImageBase=nil then
  724. DLLImageBase:=StringDup(Copy(More,j+1,255));
  725. end
  726. else
  727. begin
  728. RelocSection:=true;
  729. RelocSectionSetExplicitly:=true;
  730. end;
  731. break;
  732. end;
  733. 'C': apptype:=at_cui;
  734. 'D': ForceDeffileForExport:=true;
  735. 'G': apptype:=at_gui;
  736. 'N': begin
  737. RelocSection:=false;
  738. RelocSectionSetExplicitly:=true;
  739. end;
  740. 'R': begin
  741. RelocSection:=true;
  742. RelocSectionSetExplicitly:=true;
  743. end;
  744. else
  745. IllegalPara(opt);
  746. end;
  747. end;
  748. 'X' : begin
  749. for j:=1 to length(More) do
  750. case More[j] of
  751. 'c' : initglobalswitches:=initglobalswitches+[cs_link_toc];
  752. 's' : initglobalswitches:=initglobalswitches+[cs_link_strip];
  753. 'D' : begin
  754. def_symbol('FPC_LINK_DYNAMIC');
  755. undef_symbol('FPC_LINK_SMART');
  756. undef_symbol('FPC_LINK_STATIC');
  757. initglobalswitches:=initglobalswitches+[cs_link_shared];
  758. initglobalswitches:=initglobalswitches-[cs_link_static,cs_link_smart];
  759. end;
  760. 'S' : begin
  761. def_symbol('FPC_LINK_STATIC');
  762. undef_symbol('FPC_LINK_SMART');
  763. undef_symbol('FPC_LINK_DYNAMIC');
  764. initglobalswitches:=initglobalswitches+[cs_link_static];
  765. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_smart];
  766. end;
  767. 'X' : begin
  768. def_symbol('FPC_LINK_SMART');
  769. undef_symbol('FPC_LINK_STATIC');
  770. undef_symbol('FPC_LINK_DYNAMIC');
  771. initglobalswitches:=initglobalswitches+[cs_link_smart];
  772. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_static];
  773. end;
  774. else
  775. IllegalPara(opt);
  776. end;
  777. end;
  778. { give processor specific options a chance }
  779. else
  780. interpret_proc_specific_options(opt);
  781. end;
  782. end;
  783. '@' : begin
  784. Message(option_no_nested_response_file);
  785. StopOptions;
  786. end;
  787. else
  788. begin
  789. if (length(param_file)<>0) then
  790. Message(option_only_one_source_support);
  791. param_file:=opt;
  792. end;
  793. end;
  794. end;
  795. procedure Toption.Interpret_file(const filename : string);
  796. procedure RemoveSep(var fn:string);
  797. var
  798. i : longint;
  799. begin
  800. i:=0;
  801. while (i<length(fn)) and (fn[i+1] in [',',' ',#9]) do
  802. inc(i);
  803. Delete(fn,1,i);
  804. i:=length(fn);
  805. while (i>0) and (fn[i] in [',',' ',#9]) do
  806. dec(i);
  807. fn:=copy(fn,1,i);
  808. end;
  809. function GetName(var fn:string):string;
  810. var
  811. i : longint;
  812. begin
  813. i:=0;
  814. while (i<length(fn)) and (fn[i+1] in ['a'..'z','A'..'Z','0'..'9','_','-']) do
  815. inc(i);
  816. GetName:=Copy(fn,1,i);
  817. Delete(fn,1,i);
  818. end;
  819. const
  820. maxlevel=16;
  821. var
  822. f : text;
  823. s,
  824. opts : string;
  825. skip : array[0..maxlevel-1] of boolean;
  826. level : longint;
  827. option_read : boolean;
  828. begin
  829. { avoid infinite loop }
  830. Inc(FileLevel);
  831. Option_read:=false;
  832. If FileLevel>MaxLevel then
  833. Message(option_too_many_cfg_files);
  834. { open file }
  835. assign(f,filename);
  836. {$ifdef extdebug}
  837. Comment(V_Info,'trying to open file: '+filename);
  838. {$endif extdebug}
  839. {$I-}
  840. reset(f);
  841. {$I+}
  842. if ioresult<>0 then
  843. begin
  844. Message1(option_unable_open_file,filename);
  845. exit;
  846. end;
  847. fillchar(skip,sizeof(skip),0);
  848. level:=0;
  849. while not eof(f) do
  850. begin
  851. readln(f,opts);
  852. RemoveSep(opts);
  853. if (opts<>'') then
  854. begin
  855. if opts[1]='#' then
  856. begin
  857. Delete(opts,1,1);
  858. s:=upper(GetName(opts));
  859. if (s='SECTION') then
  860. begin
  861. RemoveSep(opts);
  862. s:=upper(GetName(opts));
  863. if level=0 then
  864. skip[level]:=not (check_symbol(s) or (s='COMMON'));
  865. end
  866. else
  867. if (s='IFDEF') then
  868. begin
  869. RemoveSep(opts);
  870. if Level>=maxlevel then
  871. begin
  872. Message(option_too_many_ifdef);
  873. stopOptions;
  874. end;
  875. inc(Level);
  876. skip[level]:=(skip[level-1] or (not check_symbol(upper(GetName(opts)))));
  877. end
  878. else
  879. if (s='IFNDEF') then
  880. begin
  881. RemoveSep(opts);
  882. if Level>=maxlevel then
  883. begin
  884. Message(option_too_many_ifdef);
  885. stopOptions;
  886. end;
  887. inc(Level);
  888. skip[level]:=(skip[level-1] or (check_symbol(upper(GetName(opts)))));
  889. end
  890. else
  891. if (s='ELSE') then
  892. skip[level]:=skip[level-1] or (not skip[level])
  893. else
  894. if (s='ENDIF') then
  895. begin
  896. skip[level]:=false;
  897. if Level=0 then
  898. begin
  899. Message(option_too_many_endif);
  900. stopOptions;
  901. end;
  902. dec(level);
  903. end
  904. else
  905. if (not skip[level]) then
  906. begin
  907. if (s='DEFINE') then
  908. begin
  909. RemoveSep(opts);
  910. def_symbol(upper(GetName(opts)));
  911. end
  912. else
  913. if (s='UNDEF') then
  914. begin
  915. RemoveSep(opts);
  916. undef_symbol(upper(GetName(opts)));
  917. end
  918. else
  919. if (s='WRITE') then
  920. begin
  921. Delete(opts,1,1);
  922. WriteLn(opts);
  923. end
  924. else
  925. if (s='INCLUDE') then
  926. begin
  927. Delete(opts,1,1);
  928. Interpret_file(opts);
  929. end;
  930. end;
  931. end
  932. else
  933. begin
  934. if (opts[1]='-') then
  935. begin
  936. if (not skip[level]) then
  937. interpret_option(opts,false);
  938. Option_read:=true;
  939. end
  940. else
  941. Message1(option_illegal_para,opts);
  942. end;
  943. end;
  944. end;
  945. if Level>0 then
  946. Message(option_too_less_endif);
  947. if Not Option_read then
  948. Message1(option_no_option_found,filename);
  949. Close(f);
  950. Dec(FileLevel);
  951. end;
  952. procedure Toption.Interpret_envvar(const envname : string);
  953. var
  954. argstart,
  955. env,
  956. pc : pchar;
  957. arglen : longint;
  958. quote : set of char;
  959. hs : string;
  960. begin
  961. env:=GetEnvPChar(envname);
  962. pc:=env;
  963. if assigned(pc) then
  964. begin
  965. repeat
  966. { skip leading spaces }
  967. while pc^ in [' ',#9,#13] do
  968. inc(pc);
  969. case pc^ of
  970. #0 :
  971. break;
  972. '"' :
  973. begin
  974. quote:=['"'];
  975. inc(pc);
  976. end;
  977. '''' :
  978. begin
  979. quote:=[''''];
  980. inc(pc);
  981. end;
  982. else
  983. quote:=[' ',#9,#13];
  984. end;
  985. { scan until the end of the argument }
  986. argstart:=pc;
  987. while (pc^<>#0) and not(pc^ in quote) do
  988. inc(pc);
  989. { create argument }
  990. arglen:=pc-argstart;
  991. hs[0]:=chr(arglen);
  992. move(argstart^,hs[1],arglen);
  993. interpret_option(hs,true);
  994. { skip quote }
  995. if pc^ in quote then
  996. inc(pc);
  997. until false;
  998. end
  999. else
  1000. Message1(option_no_option_found,'(env) '+envname);
  1001. FreeEnvPChar(env);
  1002. end;
  1003. procedure toption.read_parameters;
  1004. var
  1005. opts : string;
  1006. paramindex : longint;
  1007. begin
  1008. paramindex:=0;
  1009. while paramindex<paramcount do
  1010. begin
  1011. inc(paramindex);
  1012. opts:=paramstr(paramindex);
  1013. case opts[1] of
  1014. '@' :
  1015. begin
  1016. Delete(opts,1,1);
  1017. if not firstpass then
  1018. Message1(option_reading_further_from,opts);
  1019. interpret_file(opts);
  1020. end;
  1021. '!' :
  1022. begin
  1023. Delete(opts,1,1);
  1024. if not firstpass then
  1025. Message1(option_reading_further_from,'(env) '+opts);
  1026. interpret_envvar(opts);
  1027. end;
  1028. else
  1029. interpret_option(opts,true);
  1030. end;
  1031. end;
  1032. end;
  1033. procedure toption.parsecmd(cmd:string);
  1034. var
  1035. i,ps : longint;
  1036. opts : string;
  1037. begin
  1038. while (cmd<>'') do
  1039. begin
  1040. while cmd[1]=' ' do
  1041. delete(cmd,1,1);
  1042. i:=pos(' ',cmd);
  1043. if i=0 then
  1044. i:=256;
  1045. opts:=Copy(cmd,1,i-1);
  1046. Delete(cmd,1,i);
  1047. case opts[1] of
  1048. '@' :
  1049. begin
  1050. Delete(opts,1,1);
  1051. if not firstpass then
  1052. Message1(option_reading_further_from,opts);
  1053. interpret_file(opts);
  1054. end;
  1055. '!' :
  1056. begin
  1057. Delete(opts,1,1);
  1058. if not firstpass then
  1059. Message1(option_reading_further_from,'(env) '+opts);
  1060. interpret_envvar(opts);
  1061. end;
  1062. '"' :
  1063. begin
  1064. Delete(opts,1,1);
  1065. ps:=pos('"',cmd);
  1066. if (i<>256) and (ps>0) then
  1067. begin
  1068. opts:=opts + ' '+ copy(cmd,1,ps-1);
  1069. cmd:=copy(cmd,ps+1,255);
  1070. end;
  1071. interpret_option(opts,true);
  1072. end;
  1073. else
  1074. interpret_option(opts,true);
  1075. end;
  1076. end;
  1077. end;
  1078. constructor TOption.Init;
  1079. begin
  1080. DoWriteLogo:=false;
  1081. NoPressEnter:=false;
  1082. FirstPass:=false;
  1083. FileLevel:=0;
  1084. ParaIncludePath.Init;
  1085. ParaObjectPath.Init;
  1086. ParaUnitPath.Init;
  1087. ParaLibraryPath.Init;
  1088. end;
  1089. destructor TOption.Done;
  1090. begin
  1091. ParaIncludePath.Done;
  1092. ParaObjectPath.Done;
  1093. ParaUnitPath.Done;
  1094. ParaLibraryPath.Done;
  1095. end;
  1096. {****************************************************************************
  1097. Callable Routines
  1098. ****************************************************************************}
  1099. procedure read_arguments(cmd:string);
  1100. var
  1101. configpath : pathstr;
  1102. begin
  1103. {$ifdef Delphi}
  1104. option:=new(poption386,Init);
  1105. {$endif Delphi}
  1106. {$ifdef i386}
  1107. option:=new(poption386,Init);
  1108. {$endif}
  1109. {$ifdef m68k}
  1110. option:=new(poption68k,Init);
  1111. {$endif}
  1112. {$ifdef alpha}
  1113. option:=new(poption,Init);
  1114. {$endif}
  1115. {$ifdef powerpc}
  1116. option:=new(poption,Init);
  1117. {$endif}
  1118. { Load messages }
  1119. if (cmd='') and (paramcount=0) then
  1120. Option^.WriteHelpPages;
  1121. { default defines }
  1122. def_symbol(target_info.short_name);
  1123. def_symbol('FPK');
  1124. def_symbol('FPC');
  1125. def_symbol('VER'+version_nr);
  1126. def_symbol('VER'+version_nr+'_'+release_nr);
  1127. def_symbol('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
  1128. {$ifdef newcg}
  1129. def_symbol('WITHNEWCG');
  1130. {$endif}
  1131. { Temporary defines, until things settle down }
  1132. def_symbol('INT64');
  1133. def_symbol('HASRESOURCESTRINGS');
  1134. def_symbol('HASSAVEREGISTERS');
  1135. def_symbol('NEWVMTOFFSET');
  1136. def_symbol('HASINTERNMATH');
  1137. def_symbol('SYSTEMTVARREC');
  1138. def_symbol('INCLUDEOK');
  1139. def_symbol('NEWMM');
  1140. def_symbol('HASWIDECHAR');
  1141. {$ifdef cardinalmulfix}
  1142. { for the compiler }
  1143. def_symbol('CARDINALMULFIX');
  1144. { for the RTL }
  1145. def_symbol('CARDINALMULFIXED');
  1146. {$endif cardinalmulfix}
  1147. { some stuff for TP compatibility }
  1148. {$ifdef i386}
  1149. def_symbol('CPU86');
  1150. def_symbol('CPU87');
  1151. {$endif}
  1152. {$ifdef m68k}
  1153. def_symbol('CPU68');
  1154. {$endif}
  1155. { new processor stuff }
  1156. {$ifdef i386}
  1157. def_symbol('CPUI386');
  1158. {$endif}
  1159. {$ifdef m68k}
  1160. def_symbol('CPU68K');
  1161. {$endif}
  1162. {$ifdef ALPHA}
  1163. def_symbol('CPUALPHA');
  1164. {$endif}
  1165. {$ifdef powerpc}
  1166. def_symbol('CPUPOWERPC');
  1167. {$endif}
  1168. { get default messagefile }
  1169. {$ifdef Delphi}
  1170. msgfilename:=dmisc.getenv('PPC_ERROR_FILE');
  1171. {$else Delphi}
  1172. msgfilename:=dos.getenv('PPC_ERROR_FILE');
  1173. {$endif Delphi}
  1174. { default configfile }
  1175. if (cmd<>'') and (cmd[1]='[') then
  1176. begin
  1177. ppccfg:=Copy(cmd,2,pos(']',cmd)-2);
  1178. Delete(cmd,1,pos(']',cmd));
  1179. end
  1180. else
  1181. begin
  1182. {$ifdef i386}
  1183. ppccfg:='ppc386.cfg';
  1184. {$endif i386}
  1185. {$ifdef m68k}
  1186. ppccfg:='ppc.cfg';
  1187. {$endif}
  1188. {$ifdef alpha}
  1189. ppccfg:='ppcalpha.cfg';
  1190. {$endif}
  1191. {$ifdef powerpc}
  1192. ppccfg:='ppcppc.cfg';
  1193. {$endif}
  1194. end;
  1195. { Order to read ppc386.cfg:
  1196. 1 - current dir
  1197. 2 - configpath
  1198. 3 - compiler path }
  1199. {$ifdef Delphi}
  1200. configpath:=FixPath(dmisc.getenv('PPC_CONFIG_PATH'),false);
  1201. {$else Delphi}
  1202. configpath:=FixPath(dos.getenv('PPC_CONFIG_PATH'),false);
  1203. {$endif Delphi}
  1204. {$ifdef linux}
  1205. if configpath='' then
  1206. configpath:='/etc/';
  1207. {$endif}
  1208. if ppccfg<>'' then
  1209. begin
  1210. read_configfile:=true;
  1211. if not FileExists(ppccfg) then
  1212. begin
  1213. {$ifdef linux}
  1214. if (dos.getenv('HOME')<>'') and FileExists(FixPath(dos.getenv('HOME'),false)+'.'+ppccfg) then
  1215. ppccfg:=FixPath(dos.getenv('HOME'),false)+'.'+ppccfg
  1216. else
  1217. {$endif}
  1218. if FileExists(configpath+ppccfg) then
  1219. ppccfg:=configpath+ppccfg
  1220. else
  1221. {$ifndef linux}
  1222. if FileExists(exepath+ppccfg) then
  1223. ppccfg:=exepath+ppccfg
  1224. else
  1225. {$endif}
  1226. read_configfile:=false;
  1227. end;
  1228. end
  1229. else
  1230. read_configfile:=false;
  1231. { Read commandline and configfile }
  1232. target_is_set:=false;
  1233. asm_is_set:=false;
  1234. param_file:='';
  1235. if read_configfile then
  1236. begin
  1237. { read the parameters quick, only -v -T }
  1238. option^.firstpass:=true;
  1239. if cmd<>'' then
  1240. option^.parsecmd(cmd)
  1241. else
  1242. option^.read_parameters;
  1243. option^.firstpass:=false;
  1244. if read_configfile then
  1245. begin
  1246. {$ifdef EXTDEBUG}
  1247. Comment(V_Debug,'read config file: '+ppccfg);
  1248. {$endif EXTDEBUG}
  1249. option^.interpret_file(ppccfg);
  1250. end;
  1251. end;
  1252. if cmd<>'' then
  1253. option^.parsecmd(cmd)
  1254. else
  1255. option^.read_parameters;
  1256. { Stop if errors in options }
  1257. if ErrorCount>0 then
  1258. StopOptions;
  1259. { write logo if set }
  1260. if option^.DoWriteLogo then
  1261. option^.WriteLogo;
  1262. { Check file to compile }
  1263. if param_file='' then
  1264. begin
  1265. Message(option_no_source_found);
  1266. StopOptions;
  1267. end;
  1268. {$ifndef linux}
  1269. param_file:=FixFileName(param_file);
  1270. {$endif}
  1271. fsplit(param_file,inputdir,inputfile,inputextension);
  1272. if inputextension='' then
  1273. begin
  1274. if FileExists(inputdir+inputfile+target_os.sourceext) then
  1275. inputextension:=target_os.sourceext
  1276. else
  1277. if FileExists(inputdir+inputfile+target_os.pasext) then
  1278. inputextension:=target_os.pasext;
  1279. end;
  1280. { Add paths specified with parameters to the searchpaths }
  1281. UnitSearchPath.AddList(Option^.ParaUnitPath,true);
  1282. ObjectSearchPath.AddList(Option^.ParaObjectPath,true);
  1283. IncludeSearchPath.AddList(Option^.ParaIncludePath,true);
  1284. LibrarySearchPath.AddList(Option^.ParaLibraryPath,true);
  1285. { add unit environment and exepath to the unit search path }
  1286. if inputdir<>'' then
  1287. Unitsearchpath.AddPath(inputdir,true);
  1288. {$ifdef Delphi}
  1289. UnitSearchPath.AddPath(dmisc.getenv(target_info.unit_env),false);
  1290. {$else}
  1291. UnitSearchPath.AddPath(dos.getenv(target_info.unit_env),false);
  1292. {$endif Delphi}
  1293. {$ifdef linux}
  1294. UnitSearchPath.AddPath('/usr/lib/fpc/'+version_string+'/units/'+lower(target_info.short_name),false);
  1295. UnitSearchPath.AddPath('/usr/lib/fpc/'+version_string+'/units/'+lower(target_info.short_name)+'/rtl',false);
  1296. {$else}
  1297. UnitSearchPath.AddPath(ExePath+'../units/'+lower(target_info.short_name),false);
  1298. UnitSearchPath.AddPath(ExePath+'../units/'+lower(target_info.short_name)+'/rtl',false);
  1299. {$endif}
  1300. UnitSearchPath.AddPath(ExePath,false);
  1301. { Add unit dir to the object and library path }
  1302. objectsearchpath.AddList(unitsearchpath,false);
  1303. librarysearchpath.AddList(unitsearchpath,false);
  1304. { switch assembler if it's binary and we got -a on the cmdline }
  1305. if (cs_asm_leave in initglobalswitches) and
  1306. (target_asm.id in binassem) then
  1307. begin
  1308. Message(option_switch_bin_to_src_assembler);
  1309. set_target_asm(target_info.assemsrc);
  1310. initoutputformat:=target_asm.id;
  1311. end;
  1312. { turn off stripping if compiling with debuginfo or profile }
  1313. if (cs_debuginfo in initmoduleswitches) or
  1314. (cs_profile in initmoduleswitches) then
  1315. initglobalswitches:=initglobalswitches-[cs_link_strip];
  1316. { Set defines depending on the target }
  1317. if (target_info.target in [target_i386_GO32V1,target_i386_GO32V2]) then
  1318. def_symbol('DPMI'); { MSDOS is not defined in BP when target is DPMI }
  1319. MaybeLoadMessageFile;
  1320. dispose(option,Done);
  1321. Option:=nil;
  1322. end;
  1323. end.
  1324. {
  1325. $Log$
  1326. Revision 1.52 2000-01-17 22:50:28 peter
  1327. * fixed interpret_envvar whcih crashed when the envvar was not set
  1328. * also warn if the envvar is empty (=not set)
  1329. Revision 1.51 2000/01/14 15:33:15 pierre
  1330. + parsecmd supports "filename with spaces" for IDE
  1331. Revision 1.50 2000/01/14 14:33:54 pierre
  1332. + some warnings for wrong lines inside config files
  1333. Revision 1.49 2000/01/10 11:14:19 peter
  1334. * fixed memory leak with options, you must use StopOptions instead of
  1335. Stop
  1336. * fixed memory leak with forward resolving, make_ref is now false
  1337. Revision 1.48 2000/01/07 22:22:02 marco
  1338. * Added $target support for -FD
  1339. Revision 1.47 2000/01/07 01:14:27 peter
  1340. * updated copyright to 2000
  1341. Revision 1.46 2000/01/06 15:48:59 peter
  1342. * wildcard support for directory adding, this allows the use of units/*
  1343. in ppc386.cfg
  1344. Revision 1.45 1999/12/20 23:23:30 pierre
  1345. + $description $version
  1346. Revision 1.44 1999/12/20 21:42:36 pierre
  1347. + dllversion global variable
  1348. * FPC_USE_CPREFIX code removed, not necessary anymore
  1349. as we use .edata direct writing by default now.
  1350. Revision 1.43 1999/12/18 14:55:21 florian
  1351. * very basic widestring support
  1352. Revision 1.42 1999/12/11 18:53:31 jonas
  1353. * fixed type conversions of results of operations with cardinals
  1354. (between -dcardinalmulfix)
  1355. Revision 1.41 1999/12/10 10:03:54 peter
  1356. * fixed parameter orderning
  1357. Revision 1.40 1999/12/08 10:40:01 pierre
  1358. + allow use of unit var in exports of DLL for win32
  1359. by using direct export writing by default instead of use of DEFFILE
  1360. that does not allow assembler labels that do not
  1361. start with an underscore.
  1362. Use -WD to force use of Deffile for Win32 DLL
  1363. Revision 1.39 1999/12/06 18:21:03 peter
  1364. * support !ENVVAR for long commandlines
  1365. * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
  1366. finally supported as installdir.
  1367. Revision 1.38 1999/12/02 17:34:34 peter
  1368. * preprocessor support. But it fails on the caret in type blocks
  1369. Revision 1.37 1999/11/20 01:22:19 pierre
  1370. + cond FPC_USE_CPREFIX (needs also some RTL changes)
  1371. this allows to use unit global vars as DLL exports
  1372. (the underline prefix seems needed by dlltool)
  1373. Revision 1.36 1999/11/15 17:42:40 pierre
  1374. * -g disables reloc section for win32
  1375. Revision 1.35 1999/11/12 11:03:50 peter
  1376. * searchpaths changed to stringqueue object
  1377. Revision 1.34 1999/11/09 23:06:45 peter
  1378. * esi_offset -> selfpointer_offset to be newcg compatible
  1379. * hcogegen -> cgbase fixes for newcg
  1380. Revision 1.33 1999/11/06 14:34:21 peter
  1381. * truncated log to 20 revs
  1382. Revision 1.32 1999/11/04 23:13:25 peter
  1383. * moved unit alias support into ifdef
  1384. Revision 1.31 1999/11/04 10:54:03 peter
  1385. + -Ua<oldname>=<newname> unit alias support
  1386. Revision 1.30 1999/11/03 23:43:09 peter
  1387. * default units/rtl paths
  1388. Revision 1.29 1999/10/30 17:35:26 peter
  1389. * fpc_freemem fpc_getmem new callings updated
  1390. Revision 1.28 1999/10/28 11:13:36 pierre
  1391. * fix for cygwin make problem with -iTP
  1392. Revision 1.27 1999/10/26 13:13:47 peter
  1393. * define INCLUDEOK, which seems to work correct
  1394. Revision 1.26 1999/10/14 14:57:52 florian
  1395. - removed the hcodegen use in the new cg, use cgbase instead
  1396. Revision 1.25 1999/10/13 10:24:49 peter
  1397. * dpmi can only be set after reading the options
  1398. Revision 1.24 1999/10/03 19:44:41 peter
  1399. * removed objpasunit reference, tvarrec is now searched in systemunit
  1400. where it already was located
  1401. Revision 1.23 1999/09/20 16:38:59 peter
  1402. * cs_create_smart instead of cs_smartlink
  1403. * -CX is create smartlink
  1404. * -CD is create dynamic, but does nothing atm.
  1405. Revision 1.22 1999/09/16 11:34:56 pierre
  1406. * typo correction
  1407. Revision 1.21 1999/09/15 20:35:40 florian
  1408. * small fix to operator overloading when in MMX mode
  1409. + the compiler uses now fldz and fld1 if possible
  1410. + some fixes to floating point registers
  1411. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1412. * .... ???
  1413. Revision 1.20 1999/09/03 09:31:22 peter
  1414. * reading of search paths fixed to work as expected
  1415. Revision 1.19 1999/09/01 22:07:20 peter
  1416. * turn off stripping if profiling or debugging
  1417. Revision 1.18 1999/08/28 17:46:10 peter
  1418. * resources are working correct
  1419. Revision 1.17 1999/08/28 15:34:19 florian
  1420. * bug 519 fixed
  1421. Revision 1.16 1999/08/27 10:45:03 pierre
  1422. options -Ca sets simply_ppu to true
  1423. Revision 1.15 1999/08/25 22:51:00 pierre
  1424. * remove trailing space in cfg files
  1425. Revision 1.14 1999/08/16 15:35:26 pierre
  1426. * fix for DLL relocation problems
  1427. * external bss vars had wrong stabs for pecoff
  1428. + -WB11000000 to specify default image base, allows to
  1429. load several DLLs with debugging info included
  1430. (relocatable DLL are stripped because the relocation
  1431. of the .Stab section is misplaced by ldw)
  1432. Revision 1.13 1999/08/11 17:26:35 peter
  1433. * tlinker object is now inherited for win32 and dos
  1434. * postprocessexecutable is now a method of tlinker
  1435. }