options.pas 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by the FPC development team
  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. 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 : string;
  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);
  43. procedure Interpret_file(const filename : string);
  44. procedure Read_Parameters;
  45. procedure parsecmd(cmd:string);
  46. end;
  47. procedure read_arguments(cmd:string);
  48. implementation
  49. uses
  50. {$ifdef Delphi}
  51. dmisc,
  52. {$else Delphi}
  53. dos,
  54. {$endif Delphi}
  55. globtype,version,systems,
  56. cobjects,globals,
  57. scanner,link,messages
  58. {$ifdef BrowserLog}
  59. ,browlog
  60. {$endif BrowserLog}
  61. {$ifdef i386}
  62. ,opts386
  63. {$endif}
  64. {$ifdef m68k}
  65. ,opts68k
  66. {$endif}
  67. ;
  68. const
  69. page_size = 24;
  70. var
  71. read_configfile, { read config file, set when a cfgfile is found }
  72. target_is_set : boolean; { do not allow contradictory target settings }
  73. asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
  74. ppccfg,
  75. msgfilename,
  76. param_file : string; { file to compile specified on the commandline }
  77. {****************************************************************************
  78. Defines
  79. ****************************************************************************}
  80. procedure def_symbol(const s : string);
  81. begin
  82. if s='' then
  83. exit;
  84. initdefines.concat(new(pstring_item,init(upper(s))));
  85. end;
  86. procedure undef_symbol(const s : string);
  87. var
  88. item,next : pstring_item;
  89. begin
  90. if s='' then
  91. exit;
  92. item:=pstring_item(initdefines.first);
  93. while assigned(item) do
  94. begin
  95. if (item^.str^=s) then
  96. begin
  97. next:=pstring_item(item^.next);
  98. initdefines.remove(item);
  99. dispose(item,done);
  100. item:=next;
  101. end
  102. else
  103. if item<>pstring_item(item^.next) then
  104. item:=pstring_item(item^.next)
  105. else
  106. break;
  107. end;
  108. end;
  109. function check_symbol(const s:string):boolean;
  110. var
  111. hp : pstring_item;
  112. begin
  113. hp:=pstring_item(initdefines.first);
  114. while assigned(hp) do
  115. begin
  116. if (hp^.str^=s) then
  117. begin
  118. check_symbol:=true;
  119. exit;
  120. end;
  121. hp:=pstring_item(hp^.next);
  122. end;
  123. check_symbol:=false;
  124. end;
  125. procedure MaybeLoadMessageFile;
  126. begin
  127. { Load new message file }
  128. if (msgfilename<>'') then
  129. begin
  130. if fileexists(msgfilename) then
  131. LoadMsgFile(msgfilename);
  132. msgfilename:='';
  133. end;
  134. end;
  135. {****************************************************************************
  136. Toption
  137. ****************************************************************************}
  138. procedure Toption.WriteLogo;
  139. var
  140. i : tmsgconst;
  141. begin
  142. MaybeLoadMessageFile;
  143. for i:=option_logo_start to option_logo_end do
  144. Message1(i,target_cpu_string);
  145. end;
  146. procedure Toption.WriteInfo;
  147. var
  148. i : tmsgconst;
  149. begin
  150. MaybeLoadMessageFile;
  151. for i:=option_info_start to option_info_end do
  152. Message(i);
  153. Stop;
  154. end;
  155. procedure Toption.WriteHelpPages;
  156. function PadEnd(s:string;i:longint):string;
  157. begin
  158. while (length(s)<i) do
  159. s:=s+' ';
  160. PadEnd:=s;
  161. end;
  162. var
  163. idx,
  164. lastident,
  165. j,outline,
  166. ident,
  167. lines : longint;
  168. show : boolean;
  169. opt : string[32];
  170. input,
  171. s : string;
  172. begin
  173. MaybeLoadMessageFile;
  174. Message1(option_usage,paramstr(0));
  175. lastident:=0;
  176. if DoWriteLogo then
  177. lines:=3
  178. else
  179. lines:=1;
  180. for idx:=ord(ol_begin) to ord(ol_end) do
  181. begin
  182. { get a line and reset }
  183. s:=msg^.Get(idx);
  184. ident:=0;
  185. show:=false;
  186. { parse options }
  187. case s[1] of
  188. {$ifdef i386}
  189. '3',
  190. {$endif}
  191. {$ifdef m68k}
  192. '6',
  193. {$endif}
  194. '*' : show:=true;
  195. end;
  196. if show then
  197. begin
  198. case s[2] of
  199. {$ifdef TP}
  200. 't',
  201. {$endif}
  202. {$ifdef GDB}
  203. 'g',
  204. {$endif}
  205. {$ifdef linux}
  206. 'L',
  207. {$endif}
  208. {$ifdef os2}
  209. 'O',
  210. {$endif}
  211. '*' : show:=true;
  212. else
  213. show:=false;
  214. end;
  215. end;
  216. { now we may show the message or not }
  217. if show then
  218. begin
  219. case s[3] of
  220. '0' : begin
  221. ident:=0;
  222. outline:=0;
  223. end;
  224. '1' : begin
  225. ident:=2;
  226. outline:=7;
  227. end;
  228. '2' : begin
  229. ident:=11;
  230. outline:=11;
  231. end;
  232. '3' : begin
  233. ident:=21;
  234. outline:=6;
  235. end;
  236. end;
  237. j:=pos('_',s);
  238. opt:=Copy(s,4,j-4);
  239. if opt='*' then
  240. opt:=''
  241. else
  242. opt:=PadEnd('-'+opt,outline);
  243. if (ident=0) and (lastident<>0) then
  244. begin
  245. Comment(V_Normal,'');
  246. inc(Lines);
  247. end;
  248. { page full ? }
  249. if (lines>=page_size) then
  250. begin
  251. if not NoPressEnter then
  252. begin
  253. write('*** press enter ***');
  254. readln(input);
  255. if upper(input)='Q' then
  256. stop;
  257. end;
  258. lines:=0;
  259. end;
  260. Comment(V_Normal,PadEnd('',ident)+opt+Copy(s,j+1,255));
  261. LastIdent:=Ident;
  262. inc(Lines);
  263. end;
  264. end;
  265. stop;
  266. end;
  267. procedure Toption.QuickInfo(const s:string);
  268. begin
  269. Writeln(s);
  270. Stop;
  271. end;
  272. procedure Toption.IllegalPara(const opt:string);
  273. begin
  274. Message1(option_illegal_para,opt);
  275. Message(option_help_pages_para);
  276. stop;
  277. end;
  278. function Toption.Unsetbool(const opts:string; pos: Longint):boolean;
  279. { checks if the character after pos in Opts is a + or a - and returns resp.
  280. false or true. If it is another character (or none), it also returns false }
  281. begin
  282. UnsetBool := (Length(Opts) > Pos) And (Opts[Succ(Pos)] = '-');
  283. end;
  284. procedure TOption.interpret_proc_specific_options(const opt:string);
  285. begin
  286. end;
  287. procedure TOption.interpret_option(const opt:string);
  288. var
  289. code : integer;
  290. c : char;
  291. more : string;
  292. j,l : longint;
  293. d : DirStr;
  294. e : ExtStr;
  295. begin
  296. if opt='' then
  297. exit;
  298. case opt[1] of
  299. '-' : begin
  300. more:=Copy(opt,3,255);
  301. case opt[2] of
  302. '!' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
  303. '?' : WriteHelpPages;
  304. 'a' : begin
  305. initglobalswitches:=initglobalswitches+[cs_asm_leave];
  306. for j:=1 to length(more) do
  307. case more[j] of
  308. 'l' : initglobalswitches:=initglobalswitches+[cs_asm_source];
  309. 'r' : initglobalswitches:=initglobalswitches+[cs_asm_regalloc];
  310. 't' : initglobalswitches:=initglobalswitches+[cs_asm_tempalloc];
  311. '-' : initglobalswitches:=initglobalswitches-[cs_asm_leave,cs_asm_source,cs_asm_regalloc];
  312. else
  313. IllegalPara(opt);
  314. end;
  315. end;
  316. 'A' : begin
  317. if set_string_asm(More) then
  318. begin
  319. initoutputformat:=target_asm.id;
  320. asm_is_set:=true;
  321. end
  322. else
  323. IllegalPara(opt);
  324. end;
  325. 'b' : begin
  326. {$ifdef BrowserLog}
  327. initglobalswitches:=initglobalswitches+[cs_browser_log];
  328. {$endif}
  329. if More<>'' then
  330. if More='l' then
  331. initmoduleswitches:=initmoduleswitches+[cs_local_browser]
  332. else if More='-' then
  333. begin
  334. initmoduleswitches:=initmoduleswitches-[cs_browser,cs_local_browser];
  335. {$ifdef BrowserLog}
  336. initglobalswitches:=initglobalswitches-[cs_browser_log];
  337. {$endif}
  338. end
  339. else if More<>'+' then
  340. {$ifdef BrowserLog}
  341. browserlog.elements_to_list^.insert(more);
  342. {$else}
  343. IllegalPara(opt);
  344. {$endif}
  345. end;
  346. 'B' : if more='' then
  347. do_build:=true
  348. else
  349. if more = '-' then
  350. do_build := False
  351. else
  352. IllegalPara(opt);
  353. 'C' : begin
  354. j := 1;
  355. while j <= length(more) Do
  356. Begin
  357. case more[j] of
  358. 'a' : Simplify_ppu:=true;
  359. 'h' :
  360. begin
  361. val(copy(more,j+1,length(more)-j),heapsize,code);
  362. if (code<>0) or (heapsize>=67107840) or (heapsize<1024) then
  363. IllegalPara(opt);
  364. break;
  365. end;
  366. 'i' : If UnsetBool(More, j) then
  367. Begin
  368. initlocalswitches:=initlocalswitches-[cs_check_io];
  369. inc(j)
  370. End
  371. else initlocalswitches:=initlocalswitches+[cs_check_io];
  372. 'n' : If UnsetBool(More, j) then
  373. Begin
  374. initglobalswitches:=initglobalswitches-[cs_link_extern];
  375. inc(j)
  376. End
  377. Else initglobalswitches:=initglobalswitches+[cs_link_extern];
  378. 'o' :
  379. If UnsetBool(More, j) then
  380. Begin
  381. initlocalswitches:=initlocalswitches-[cs_check_overflow];
  382. inc(j);
  383. End
  384. Else
  385. initlocalswitches:=initlocalswitches+[cs_check_overflow];
  386. 'r' :
  387. If UnsetBool(More, j) then
  388. Begin
  389. initlocalswitches:=initlocalswitches-[cs_check_range];
  390. inc(j);
  391. End
  392. Else
  393. initlocalswitches:=initlocalswitches+[cs_check_range];
  394. 's' :
  395. begin
  396. val(copy(more,j+1,length(more)-j),stacksize,code);
  397. if (code<>0) or (stacksize>=67107840) or (stacksize<1024) then
  398. IllegalPara(opt);
  399. break;
  400. end;
  401. 't' :
  402. If UnsetBool(More, j) then
  403. Begin
  404. initlocalswitches:=initlocalswitches-[cs_check_stack];
  405. inc(j)
  406. End
  407. Else
  408. initlocalswitches:=initlocalswitches+[cs_check_stack];
  409. 'x' :
  410. If UnsetBool(More, j) then
  411. Begin
  412. initmoduleswitches:=initmoduleswitches-[cs_smartlink];
  413. inc(j)
  414. End
  415. Else
  416. initmoduleswitches:=initmoduleswitches+[cs_smartlink];
  417. else
  418. IllegalPara(opt);
  419. end;
  420. inc(j);
  421. end;
  422. end;
  423. 'd' : def_symbol(more);
  424. 'D' : begin
  425. initglobalswitches:=initglobalswitches+[cs_link_deffile];
  426. for j:=1 to length(more) do
  427. case more[j] of
  428. 'd' : begin
  429. description:=Copy(more,j+1,255);
  430. break;
  431. end;
  432. 'w' : usewindowapi:=true;
  433. else
  434. IllegalPara(opt);
  435. end;
  436. end;
  437. 'e' : exepath:=FixPath(More,true);
  438. { Just used by RHIDE }
  439. 'E' : if (length(more)=0) or (UnsetBool(More, 0)) then
  440. initglobalswitches:=initglobalswitches+[cs_link_extern]
  441. else
  442. initglobalswitches:=initglobalswitches-[cs_link_extern];
  443. 'F' : begin
  444. c:=more[1];
  445. Delete(more,1,1);
  446. case c of
  447. 'D' : utilsdirectory:=FixPath(More,true);
  448. 'e' : SetRedirectFile(More);
  449. 'E' : OutputExeDir:=FixPath(More,true);
  450. 'i' : if firstpass then
  451. AddPathToList(includesearchpath,More,false)
  452. else
  453. AddPathToList(ParaIncludePath,More,false);
  454. 'g' : Message2(option_obsolete_switch_use_new,'-Fg','-Fl');
  455. 'l' : if firstpass then
  456. AddPathToList(LibrarySearchPath,More,false)
  457. else
  458. AddPathToList(ParaLibraryPath,More,false);
  459. 'L' : if More<>'' then
  460. ParaDynamicLinker:=More
  461. else
  462. IllegalPara(opt);
  463. 'o' : if firstpass then
  464. AddPathToList(objectsearchpath,More,false)
  465. else
  466. AddPathToList(ParaObjectPath,More,false);
  467. 'r' : Msgfilename:=More;
  468. 'u' : if firstpass then
  469. AddPathToList(unitsearchpath,More,false)
  470. else
  471. AddPathToList(ParaUnitPath,More,false);
  472. 'U' : OutputUnitDir:=FixPath(More,true);
  473. else
  474. IllegalPara(opt);
  475. end;
  476. end;
  477. 'g' : begin
  478. if UnsetBool(More, 0) then
  479. initmoduleswitches:=initmoduleswitches-[cs_debuginfo]
  480. else
  481. begin
  482. {$ifdef GDB}
  483. initmoduleswitches:=initmoduleswitches+[cs_debuginfo];
  484. for j:=1 to length(more) do
  485. case more[j] of
  486. 'd' : initglobalswitches:=initglobalswitches+[cs_gdb_dbx];
  487. 'g' : initglobalswitches:=initglobalswitches+[cs_gdb_gsym];
  488. 'h' : initglobalswitches:=initglobalswitches+[cs_gdb_heaptrc];
  489. 'c' : initglobalswitches:=initglobalswitches+[cs_checkpointer];
  490. {$ifdef EXTDEBUG}
  491. 'p' : only_one_pass:=true;
  492. {$endif EXTDEBUG}
  493. else
  494. IllegalPara(opt);
  495. end;
  496. {$else GDB}
  497. Message(option_no_debug_support);
  498. Message(option_no_debug_support_recompile_fpc);
  499. {$endif GDB}
  500. end;
  501. end;
  502. 'h' : begin
  503. NoPressEnter:=true;
  504. WriteHelpPages;
  505. end;
  506. 'i' : if more='' then
  507. WriteInfo
  508. else
  509. begin
  510. { Specific info, which can be used in Makefiles }
  511. case More[1] of
  512. 'S' : begin
  513. case More[2] of
  514. 'O' : QuickInfo(source_os.shortname);
  515. {$ifdef Delphi !!!!!!!!!}
  516. 'P' : QuickInfo('unknown');
  517. {$else}
  518. 'P' : QuickInfo(source_cpu_string);
  519. {$endif}
  520. end;
  521. end;
  522. 'T' : begin
  523. case More[2] of
  524. 'O' : QuickInfo(target_os.shortname);
  525. 'P' : QuickInfo(target_cpu_string);
  526. end;
  527. end;
  528. 'V' : QuickInfo(version_string);
  529. 'D' : QuickInfo(date_string);
  530. else
  531. IllegalPara(Opt);
  532. end;
  533. end;
  534. 'I' : if firstpass then
  535. AddPathToList(includesearchpath,More,false)
  536. else
  537. AddPathToList(ParaIncludePath,More,false);
  538. 'k' : if more<>'' then
  539. ParaLinkOptions:=ParaLinkOptions+' '+More
  540. else
  541. IllegalPara(opt);
  542. 'l' : if more='' then
  543. DoWriteLogo:=true
  544. else
  545. IllegalPara(opt);
  546. 'n' : if More='' then
  547. read_configfile:=false
  548. else
  549. IllegalPara(opt);
  550. 'o' : if More<>'' then
  551. Fsplit(More,d,OutputFile,e)
  552. else
  553. IllegalPara(opt);
  554. 'p' : begin
  555. if UnsetBool(More, 0) then
  556. begin
  557. initmoduleswitches:=initmoduleswitches-[cs_profile];
  558. undef_symbol('FPC_PROFILE');
  559. end
  560. else
  561. case more[1] of
  562. 'g' : if (length(opt)=3) and UnsetBool(more, 1) then
  563. begin
  564. initmoduleswitches:=initmoduleswitches-[cs_profile];
  565. undef_symbol('FPC_PROFILE');
  566. end
  567. else
  568. begin
  569. initmoduleswitches:=initmoduleswitches+[cs_profile];
  570. def_symbol('FPC_PROFILE');
  571. end;
  572. else
  573. IllegalPara(opt);
  574. end;
  575. end;
  576. {$ifdef linux}
  577. 'P' : initglobalswitches:=initglobalswitches+[cs_asm_pipe];
  578. {$endif}
  579. 's' : initglobalswitches:=initglobalswitches+[cs_asm_extern,cs_link_extern];
  580. 'S' : begin
  581. for j:=1 to length(more) do
  582. case more[j] of
  583. '2' : initmodeswitches:=objfpcmodeswitches;
  584. 'c' : initmoduleswitches:=initmoduleswitches+[cs_support_c_operators];
  585. 'd' : initmodeswitches:=delphimodeswitches;
  586. 'e' : begin
  587. val(copy(more,j+1,length(more)-j),l,code);
  588. if (code<>0) then
  589. SetMaxErrorCount(1)
  590. else
  591. begin
  592. SetMaxErrorCount(l);
  593. break;
  594. end;
  595. end;
  596. 'g' : initmoduleswitches:=initmoduleswitches+[cs_support_goto];
  597. 'h' : initlocalswitches:=initlocalswitches+[cs_ansistrings];
  598. 'i' : initmoduleswitches:=initmoduleswitches+[cs_support_inline];
  599. 'm' : initmoduleswitches:=initmoduleswitches+[cs_support_macro];
  600. 'o': initmodeswitches:=tpmodeswitches;
  601. 'p' : initmodeswitches:=gpcmodeswitches;
  602. 's' : initglobalswitches:=initglobalswitches+[cs_constructor_name];
  603. 't' : initmoduleswitches:=initmoduleswitches+[cs_static_keyword];
  604. 'v' : Message1(option_obsolete_switch,'-Sv');
  605. else
  606. IllegalPara(opt);
  607. end;
  608. end;
  609. 'T' : begin
  610. more:=Upper(More);
  611. if not target_is_set then
  612. begin
  613. { remove old target define }
  614. undef_symbol(target_info.short_name);
  615. { load new target }
  616. if not(set_string_target(More)) then
  617. IllegalPara(opt);
  618. { set new define }
  619. def_symbol(target_info.short_name);
  620. if not asm_is_set then
  621. initoutputformat:=target_asm.id;
  622. target_is_set:=true;
  623. end
  624. else
  625. if More<>target_info.short_name then
  626. Message1(option_target_is_already_set,target_info.short_name);
  627. end;
  628. 'u' : undef_symbol(upper(More));
  629. 'U' : begin
  630. for j:=1 to length(more) do
  631. case more[j] of
  632. 'n' : initglobalswitches:=initglobalswitches-[cs_check_unit_name];
  633. 'p' : begin
  634. Message2(option_obsolete_switch_use_new,'-Up','-Fu');
  635. break;
  636. end;
  637. 's' : initmoduleswitches:=initmoduleswitches+[cs_compilesystem];
  638. else
  639. IllegalPara(opt);
  640. end;
  641. end;
  642. 'v' : if not setverbosity(More) then
  643. IllegalPara(opt);
  644. 'W' : begin
  645. for j:=1 to length(More) do
  646. case More[j] of
  647. 'B': {bind_win32_dll:=true}
  648. begin
  649. { -WB200000 means set prefered base address
  650. to $200000, but does not change relocsection boolean
  651. this way we can create both relocatble and
  652. non relocatable DLL at a specific base address PM }
  653. if (length(More)>j) then
  654. begin
  655. if DLLImageBase=nil then
  656. DLLImageBase:=StringDup(Copy(More,j+1,255));
  657. end
  658. else
  659. RelocSection:=true;
  660. break;
  661. end;
  662. 'C': apptype:=at_cui;
  663. 'G': apptype:=at_gui;
  664. 'N': begin
  665. RelocSection:=false;
  666. end;
  667. 'R': RelocSection:=true;
  668. else
  669. IllegalPara(opt);
  670. end;
  671. end;
  672. 'X' : begin
  673. for j:=1 to length(More) do
  674. case More[j] of
  675. 'c' : initglobalswitches:=initglobalswitches+[cs_link_toc];
  676. 's' : initglobalswitches:=initglobalswitches+[cs_link_strip];
  677. 'D' : begin
  678. def_symbol('FPC_LINK_DYNAMIC');
  679. undef_symbol('FPC_LINK_SMART');
  680. undef_symbol('FPC_LINK_STATIC');
  681. initglobalswitches:=initglobalswitches+[cs_link_shared];
  682. initglobalswitches:=initglobalswitches-[cs_link_static,cs_link_smart];
  683. end;
  684. 'S' : begin
  685. def_symbol('FPC_LINK_STATIC');
  686. undef_symbol('FPC_LINK_SMART');
  687. undef_symbol('FPC_LINK_DYNAMIC');
  688. initglobalswitches:=initglobalswitches+[cs_link_static];
  689. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_smart];
  690. end;
  691. 'X' : begin
  692. def_symbol('FPC_LINK_SMART');
  693. undef_symbol('FPC_LINK_STATIC');
  694. undef_symbol('FPC_LINK_DYNAMIC');
  695. initglobalswitches:=initglobalswitches+[cs_link_smart];
  696. initglobalswitches:=initglobalswitches-[cs_link_shared,cs_link_static];
  697. end;
  698. else
  699. IllegalPara(opt);
  700. end;
  701. end;
  702. { give processor specific options a chance }
  703. else
  704. interpret_proc_specific_options(opt);
  705. end;
  706. end;
  707. '@' : begin
  708. Message(option_no_nested_response_file);
  709. Stop;
  710. end;
  711. else
  712. begin
  713. if (length(param_file)<>0) then
  714. Message(option_only_one_source_support);
  715. param_file:=opt;
  716. end;
  717. end;
  718. end;
  719. procedure Toption.Interpret_file(const filename : string);
  720. procedure RemoveSep(var fn:string);
  721. var
  722. i : longint;
  723. begin
  724. i:=0;
  725. while (i<length(fn)) and (fn[i+1] in [',',' ',#9]) do
  726. inc(i);
  727. Delete(fn,1,i);
  728. i:=length(fn);
  729. while (i>0) and (fn[i] in [',',' ',#9]) do
  730. dec(i);
  731. fn:=copy(fn,1,i);
  732. end;
  733. function GetName(var fn:string):string;
  734. var
  735. i : longint;
  736. begin
  737. i:=0;
  738. while (i<length(fn)) and (fn[i+1] in ['a'..'z','A'..'Z','0'..'9','_','-']) do
  739. inc(i);
  740. GetName:=Copy(fn,1,i);
  741. Delete(fn,1,i);
  742. end;
  743. const
  744. maxlevel=16;
  745. var
  746. f : text;
  747. s,
  748. opts : string;
  749. skip : array[0..maxlevel-1] of boolean;
  750. level : longint;
  751. begin
  752. { avoid infinite loop }
  753. Inc(FileLevel);
  754. If FileLevel>MaxLevel then
  755. Message(option_too_many_cfg_files);
  756. { open file }
  757. assign(f,filename);
  758. {$ifdef extdebug}
  759. Comment(V_Info,'trying to open file: '+filename);
  760. {$endif extdebug}
  761. {$I-}
  762. reset(f);
  763. {$I+}
  764. if ioresult<>0 then
  765. begin
  766. Message1(option_unable_open_file,filename);
  767. exit;
  768. end;
  769. fillchar(skip,sizeof(skip),0);
  770. level:=0;
  771. while not eof(f) do
  772. begin
  773. readln(f,opts);
  774. RemoveSep(opts);
  775. if (opts<>'') then
  776. begin
  777. if opts[1]='#' then
  778. begin
  779. Delete(opts,1,1);
  780. s:=upper(GetName(opts));
  781. if (s='SECTION') then
  782. begin
  783. RemoveSep(opts);
  784. s:=upper(GetName(opts));
  785. if level=0 then
  786. skip[level]:=not (check_symbol(s) or (s='COMMON'));
  787. end
  788. else
  789. if (s='IFDEF') then
  790. begin
  791. RemoveSep(opts);
  792. if Level>=maxlevel then
  793. begin
  794. Message(option_too_many_ifdef);
  795. stop;
  796. end;
  797. inc(Level);
  798. skip[level]:=(skip[level-1] or (not check_symbol(upper(GetName(opts)))));
  799. end
  800. else
  801. if (s='IFNDEF') then
  802. begin
  803. RemoveSep(opts);
  804. if Level>=maxlevel then
  805. begin
  806. Message(option_too_many_ifdef);
  807. stop;
  808. end;
  809. inc(Level);
  810. skip[level]:=(skip[level-1] or (check_symbol(upper(GetName(opts)))));
  811. end
  812. else
  813. if (s='ELSE') then
  814. skip[level]:=skip[level-1] or (not skip[level])
  815. else
  816. if (s='ENDIF') then
  817. begin
  818. skip[level]:=false;
  819. if Level=0 then
  820. begin
  821. Message(option_too_many_endif);
  822. stop;
  823. end;
  824. dec(level);
  825. end
  826. else
  827. if (not skip[level]) then
  828. begin
  829. if (s='DEFINE') then
  830. begin
  831. RemoveSep(opts);
  832. def_symbol(upper(GetName(opts)));
  833. end
  834. else
  835. if (s='UNDEF') then
  836. begin
  837. RemoveSep(opts);
  838. undef_symbol(upper(GetName(opts)));
  839. end
  840. else
  841. if (s='WRITE') then
  842. begin
  843. Delete(opts,1,1);
  844. WriteLn(opts);
  845. end
  846. else
  847. if (s='INCLUDE') then
  848. begin
  849. Delete(opts,1,1);
  850. Interpret_file(opts);
  851. end;
  852. end;
  853. end
  854. else
  855. begin
  856. if (not skip[level]) and (opts[1]='-') then
  857. interpret_option(opts)
  858. end;
  859. end;
  860. end;
  861. if Level>0 then
  862. Message(option_too_less_endif);
  863. Close(f);
  864. Dec(FileLevel);
  865. end;
  866. procedure toption.read_parameters;
  867. var
  868. opts : string;
  869. paramindex : longint;
  870. begin
  871. paramindex:=0;
  872. while paramindex<paramcount do
  873. begin
  874. inc(paramindex);
  875. opts:=paramstr(paramindex);
  876. if firstpass then
  877. begin
  878. { only parse define,undef,target,verbosity and link options }
  879. if (opts[1]='-') and (opts[2] in ['i','d','v','T','u','n','X']) then
  880. interpret_option(opts);
  881. end
  882. else
  883. begin
  884. if opts[1]='@' then
  885. begin
  886. Delete(opts,1,1);
  887. Message1(option_reading_further_from,opts);
  888. interpret_file(opts);
  889. end
  890. else
  891. interpret_option(opts);
  892. end;
  893. end;
  894. end;
  895. procedure toption.parsecmd(cmd:string);
  896. var
  897. i : longint;
  898. opts : string;
  899. begin
  900. while (cmd<>'') do
  901. begin
  902. while cmd[1]=' ' do
  903. delete(cmd,1,1);
  904. i:=pos(' ',cmd);
  905. if i=0 then
  906. i:=255;
  907. opts:=Copy(cmd,1,i-1);
  908. Delete(cmd,1,i);
  909. if firstpass then
  910. begin
  911. { only parse define,undef,target,verbosity and link options }
  912. if (opts[1]='-') and (opts[2] in ['d','v','T','u','n','X']) then
  913. interpret_option(opts);
  914. end
  915. else
  916. begin
  917. if opts[1]='@' then
  918. begin
  919. Delete(opts,1,1);
  920. Message1(option_reading_further_from,opts);
  921. interpret_file(opts);
  922. end
  923. else
  924. interpret_option(opts);
  925. end;
  926. end;
  927. end;
  928. constructor TOption.Init;
  929. begin
  930. DoWriteLogo:=false;
  931. NoPressEnter:=false;
  932. FirstPass:=false;
  933. FileLevel:=0;
  934. ParaIncludePath:='';
  935. ParaObjectPath:='';
  936. ParaUnitPath:='';
  937. ParaLibraryPath:='';
  938. end;
  939. destructor TOption.Done;
  940. begin
  941. end;
  942. {****************************************************************************
  943. Callable Routines
  944. ****************************************************************************}
  945. procedure read_arguments(cmd:string);
  946. var
  947. configpath : pathstr;
  948. option : poption;
  949. begin
  950. {$ifdef Delphi}
  951. option:=new(poption386,Init);
  952. {$endif Delphi}
  953. {$ifdef i386}
  954. option:=new(poption386,Init);
  955. {$endif}
  956. {$ifdef m68k}
  957. option:=new(poption68k,Init);
  958. {$endif}
  959. {$ifdef alpha}
  960. option:=new(poption,Init);
  961. {$endif}
  962. {$ifdef powerpc}
  963. option:=new(poption,Init);
  964. {$endif}
  965. { Load messages }
  966. if (cmd='') and (paramcount=0) then
  967. Option^.WriteHelpPages;
  968. { default defines }
  969. def_symbol(target_info.short_name);
  970. def_symbol('FPK');
  971. def_symbol('FPC');
  972. def_symbol('VER'+version_nr);
  973. def_symbol('VER'+version_nr+'_'+release_nr);
  974. def_symbol('VER'+version_nr+'_'+release_nr+'_'+patch_nr);
  975. {$ifdef newcg}
  976. def_symbol('WITHNEWCG');
  977. {$endif}
  978. { Temporary defines, until things settle down }
  979. def_symbol('INT64');
  980. def_symbol('HASRESOURCESTRINGS');
  981. def_symbol('HASSAVEREGISTERS');
  982. def_symbol('NEWVMTOFFSET');
  983. def_symbol('HASINTERNMATH');
  984. { some stuff for TP compatibility }
  985. {$ifdef i386}
  986. def_symbol('CPU86');
  987. def_symbol('CPU87');
  988. if (target_info.target in [target_i386_GO32V1,target_i386_GO32V2]) then
  989. def_symbol('DPMI'); { MSDOS is not defined in BP when target is DPMI }
  990. {$endif}
  991. {$ifdef m68k}
  992. def_symbol('CPU68');
  993. {$endif}
  994. {$ifdef ALPHA}
  995. def_symbol('ALPHA');
  996. {$endif}
  997. {$ifdef powerpc}
  998. def_symbol('POWERPC');
  999. {$endif}
  1000. { get default messagefile }
  1001. {$ifdef Delphi}
  1002. msgfilename:=dmisc.getenv('PPC_ERROR_FILE');
  1003. {$else Delphi}
  1004. msgfilename:=dos.getenv('PPC_ERROR_FILE');
  1005. {$endif Delphi}
  1006. { default configfile }
  1007. if (cmd<>'') and (cmd[1]='[') then
  1008. begin
  1009. ppccfg:=Copy(cmd,2,pos(']',cmd)-2);
  1010. Delete(cmd,1,pos(']',cmd));
  1011. end
  1012. else
  1013. begin
  1014. {$ifdef i386}
  1015. ppccfg:='ppc386.cfg';
  1016. {$endif i386}
  1017. {$ifdef m68k}
  1018. ppccfg:='ppc.cfg';
  1019. {$endif}
  1020. {$ifdef alpha}
  1021. ppccfg:='ppcalpha.cfg';
  1022. {$endif}
  1023. {$ifdef powerpc}
  1024. ppccfg:='ppcppc.cfg';
  1025. {$endif}
  1026. end;
  1027. { Order to read ppc386.cfg:
  1028. 1 - current dir
  1029. 2 - configpath
  1030. 3 - compiler path }
  1031. {$ifdef Delphi}
  1032. configpath:=FixPath(dmisc.getenv('PPC_CONFIG_PATH'),false);
  1033. {$else Delphi}
  1034. configpath:=FixPath(dos.getenv('PPC_CONFIG_PATH'),false);
  1035. {$endif Delphi}
  1036. {$ifdef linux}
  1037. if configpath='' then
  1038. configpath:='/etc/';
  1039. {$endif}
  1040. if ppccfg<>'' then
  1041. begin
  1042. read_configfile:=true;
  1043. if not FileExists(ppccfg) then
  1044. begin
  1045. {$ifdef linux}
  1046. if (dos.getenv('HOME')<>'') and FileExists(FixPath(dos.getenv('HOME'),false)+'.'+ppccfg) then
  1047. ppccfg:=FixPath(dos.getenv('HOME'),false)+'.'+ppccfg
  1048. else
  1049. {$endif}
  1050. if FileExists(configpath+ppccfg) then
  1051. ppccfg:=configpath+ppccfg
  1052. else
  1053. {$ifndef linux}
  1054. if FileExists(exepath+ppccfg) then
  1055. ppccfg:=exepath+ppccfg
  1056. else
  1057. {$endif}
  1058. read_configfile:=false;
  1059. end;
  1060. end
  1061. else
  1062. read_configfile:=false;
  1063. { Read commandline and configfile }
  1064. target_is_set:=false;
  1065. asm_is_set:=false;
  1066. param_file:='';
  1067. if read_configfile then
  1068. begin
  1069. { read the parameters quick, only -v -T }
  1070. option^.firstpass:=true;
  1071. if cmd<>'' then
  1072. option^.parsecmd(cmd)
  1073. else
  1074. option^.read_parameters;
  1075. if read_configfile then
  1076. begin
  1077. {$ifdef EXTDEBUG}
  1078. Comment(V_Debug,'read config file: '+ppccfg);
  1079. {$endif EXTDEBUG}
  1080. option^.interpret_file(ppccfg);
  1081. end;
  1082. end;
  1083. option^.firstpass:=false;
  1084. if cmd<>'' then
  1085. option^.parsecmd(cmd)
  1086. else
  1087. option^.read_parameters;
  1088. { Stop if errors in options }
  1089. if ErrorCount>0 then
  1090. Stop;
  1091. { write logo if set }
  1092. if option^.DoWriteLogo then
  1093. option^.WriteLogo;
  1094. { Check file to compile }
  1095. if param_file='' then
  1096. begin
  1097. Message(option_no_source_found);
  1098. Stop;
  1099. end;
  1100. {$ifndef linux}
  1101. param_file:=FixFileName(param_file);
  1102. {$endif}
  1103. fsplit(param_file,inputdir,inputfile,inputextension);
  1104. if inputextension='' then
  1105. begin
  1106. if FileExists(inputdir+inputfile+target_os.sourceext) then
  1107. inputextension:=target_os.sourceext
  1108. else
  1109. if FileExists(inputdir+inputfile+target_os.pasext) then
  1110. inputextension:=target_os.pasext;
  1111. end;
  1112. { Add paths specified with parameters to the searchpaths }
  1113. AddPathToList(UnitSearchPath,Option^.ParaUnitPath,true);
  1114. AddPathToList(ObjectSearchPath,Option^.ParaObjectPath,true);
  1115. AddPathToList(IncludeSearchPath,Option^.ParaIncludePath,true);
  1116. AddPathToList(LibrarySearchPath,Option^.ParaLibraryPath,true);
  1117. { add unit environment and exepath to the unit search path }
  1118. if inputdir<>'' then
  1119. AddPathToList(Unitsearchpath,inputdir,true);
  1120. {$ifdef Delphi}
  1121. AddPathToList(UnitSearchPath,dmisc.getenv(target_info.unit_env),false);
  1122. {$else}
  1123. AddPathToList(UnitSearchPath,dos.getenv(target_info.unit_env),false);
  1124. {$endif Delphi}
  1125. AddPathToList(UnitSearchPath,ExePath,false);
  1126. { Add unit dir to the object and library path }
  1127. AddPathToList(objectsearchpath,unitsearchpath,false);
  1128. AddPathToList(librarysearchpath,unitsearchpath,false);
  1129. { switch assembler if it's binary and we got -a on the cmdline }
  1130. if (cs_asm_leave in initglobalswitches) and
  1131. (target_asm.id in binassem) then
  1132. begin
  1133. Message(option_switch_bin_to_src_assembler);
  1134. set_target_asm(target_info.assemsrc);
  1135. initoutputformat:=target_asm.id;
  1136. end;
  1137. { turn off stripping if compiling with debuginfo or profile }
  1138. if (cs_debuginfo in initmoduleswitches) or
  1139. (cs_profile in initmoduleswitches) then
  1140. initglobalswitches:=initglobalswitches-[cs_link_strip];
  1141. MaybeLoadMessageFile;
  1142. dispose(option,Done);
  1143. end;
  1144. end.
  1145. {
  1146. $Log$
  1147. Revision 1.22 1999-09-16 11:34:56 pierre
  1148. * typo correction
  1149. Revision 1.21 1999/09/15 20:35:40 florian
  1150. * small fix to operator overloading when in MMX mode
  1151. + the compiler uses now fldz and fld1 if possible
  1152. + some fixes to floating point registers
  1153. + some math. functions (arctan, ln, sin, cos, sqrt, sqr, pi) are now inlined
  1154. * .... ???
  1155. Revision 1.20 1999/09/03 09:31:22 peter
  1156. * reading of search paths fixed to work as expected
  1157. Revision 1.19 1999/09/01 22:07:20 peter
  1158. * turn off stripping if profiling or debugging
  1159. Revision 1.18 1999/08/28 17:46:10 peter
  1160. * resources are working correct
  1161. Revision 1.17 1999/08/28 15:34:19 florian
  1162. * bug 519 fixed
  1163. Revision 1.16 1999/08/27 10:45:03 pierre
  1164. options -Ca sets simply_ppu to true
  1165. Revision 1.15 1999/08/25 22:51:00 pierre
  1166. * remove trailing space in cfg files
  1167. Revision 1.14 1999/08/16 15:35:26 pierre
  1168. * fix for DLL relocation problems
  1169. * external bss vars had wrong stabs for pecoff
  1170. + -WB11000000 to specify default image base, allows to
  1171. load several DLLs with debugging info included
  1172. (relocatable DLL are stripped because the relocation
  1173. of the .Stab section is misplaced by ldw)
  1174. Revision 1.13 1999/08/11 17:26:35 peter
  1175. * tlinker object is now inherited for win32 and dos
  1176. * postprocessexecutable is now a method of tlinker
  1177. Revision 1.12 1999/08/10 12:51:17 pierre
  1178. * bind_win32_dll removed (Relocsection used instead)
  1179. * now relocsection is true by default ! (needs dlltool
  1180. for DLL generation)
  1181. Revision 1.11 1999/08/09 22:19:52 peter
  1182. * classes vmt changed to only positive addresses
  1183. * sharedlib creation is working
  1184. Revision 1.10 1999/08/05 23:45:10 peter
  1185. * saveregister is now working and used for assert and iocheck (which has
  1186. been moved to system.inc because it's now system independent)
  1187. Revision 1.9 1999/08/04 13:02:46 jonas
  1188. * all tokens now start with an underscore
  1189. * PowerPC compiles!!
  1190. Revision 1.8 1999/08/03 17:09:36 florian
  1191. * the alpha compiler can be compiled now
  1192. Revision 1.7 1999/08/02 23:13:19 florian
  1193. * more changes to compile for the Alpha
  1194. Revision 1.6 1999/07/23 22:56:27 michael
  1195. + Added HasResourceStrings define
  1196. Revision 1.5 1999/07/18 10:19:57 florian
  1197. * made it compilable with Dlephi 4 again
  1198. + fixed problem with large stack allocations on win32
  1199. Revision 1.4 1999/07/05 20:13:14 peter
  1200. * removed temp defines
  1201. Revision 1.3 1999/07/03 00:29:54 peter
  1202. * new link writing to the ppu, one .ppu is needed for all link types,
  1203. static (.o) is now always created also when smartlinking is used
  1204. Revision 1.2 1999/07/01 15:49:19 florian
  1205. * int64/qword type release
  1206. + lo/hi for int64/qword
  1207. Revision 1.1 1999/06/11 13:28:40 peter
  1208. * reinserted
  1209. Revision 1.111 1999/06/10 23:52:31 pierre
  1210. * merged from fixes branch
  1211. Revision 1.110.2.1 1999/06/10 23:37:17 pierre
  1212. * language switch before help screen
  1213. Revision 1.110 1999/05/27 19:44:40 peter
  1214. * removed oldasm
  1215. * plabel -> pasmlabel
  1216. * -a switches to source writing automaticly
  1217. * assembler readers OOPed
  1218. * asmsymbol automaticly external
  1219. * jumptables and other label fixes for asm readers
  1220. Revision 1.109 1999/05/18 14:11:46 peter
  1221. * stop after errors in options
  1222. Revision 1.108 1999/05/17 14:14:15 pierre
  1223. + -gc for check pointer with heaptrc
  1224. Revision 1.107 1999/05/16 02:28:59 peter
  1225. * removed -Fg and -Up
  1226. Revision 1.106 1999/05/06 09:05:20 peter
  1227. * generic write_float and str_float
  1228. * fixed constant float conversions
  1229. Revision 1.105 1999/05/04 21:44:51 florian
  1230. * changes to compile it with Delphi 4.0
  1231. Revision 1.104 1999/05/02 22:41:56 peter
  1232. * moved section names to systems
  1233. * fixed nasm,intel writer
  1234. Revision 1.103 1999/05/01 13:24:25 peter
  1235. * merged nasm compiler
  1236. * old asm moved to oldasm/
  1237. Revision 1.102 1999/04/26 18:29:55 peter
  1238. * farpointerdef moved into pointerdef.is_far
  1239. Revision 1.101 1999/04/26 13:31:35 peter
  1240. * release storenumber,double_checksum
  1241. Revision 1.100 1999/04/17 13:12:21 peter
  1242. * addr() internal
  1243. Revision 1.99 1999/04/16 11:49:44 peter
  1244. + tempalloc
  1245. + -at to show temp alloc info in .s file
  1246. Revision 1.98 1999/04/15 12:19:56 peter
  1247. + finalization support
  1248. Revision 1.97 1999/04/10 16:15:02 peter
  1249. * fixed browcol
  1250. + -ar to show regalloc info in .s file
  1251. Revision 1.96 1999/04/08 15:57:49 peter
  1252. + subrange checking for readln()
  1253. Revision 1.95 1999/04/01 22:07:52 peter
  1254. * universal string names (ansistr instead of stransi) for val/str
  1255. Revision 1.94 1999/03/26 00:05:32 peter
  1256. * released valintern
  1257. + deffile is now removed when compiling is finished
  1258. * ^( compiles now correct
  1259. + static directive
  1260. * shrd fixed
  1261. Revision 1.93 1999/03/25 16:55:32 peter
  1262. + unitpath,librarypath,includepath,objectpath directives
  1263. Revision 1.92 1999/03/24 23:17:08 peter
  1264. * fixed bugs 212,222,225,227,229,231,233
  1265. Revision 1.91 1999/03/16 17:52:51 jonas
  1266. * changes for internal Val code (do a "make cycle OPT=-dvalintern" to test)
  1267. * in cgi386inl: also range checking for subrange types (compile with "-dreadrangecheck")
  1268. * in cgai386: also small fixes to emitrangecheck
  1269. Revision 1.90 1999/03/11 13:39:15 pierre
  1270. * initoutputformat also set by -T arg
  1271. Revision 1.89 1999/03/02 02:56:13 peter
  1272. + stabs support for binary writers
  1273. * more fixes and missing updates from the previous commit :(
  1274. Revision 1.88 1999/02/22 13:06:57 pierre
  1275. + -b and -bl options work !
  1276. + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
  1277. is not enabled when quitting global section
  1278. * local vars and procedures are not yet stored into PPU
  1279. Revision 1.87 1999/02/03 10:18:12 pierre
  1280. * conditional code for extended check of virtual methods
  1281. Revision 1.86 1999/01/12 14:25:28 peter
  1282. + BrowserLog for browser.log generation
  1283. + BrowserCol for browser info in TCollections
  1284. * released all other UseBrowser
  1285. Revision 1.85 1998/12/30 22:04:34 michael
  1286. + Added -Sh switch
  1287. Revision 1.84 1998/12/28 15:45:48 peter
  1288. * fixes for parse_cmd
  1289. Revision 1.83 1998/12/19 00:23:50 florian
  1290. * ansistring memory leaks fixed
  1291. Revision 1.82 1998/12/18 17:25:50 peter
  1292. * removed temp symbols again :)
  1293. Revision 1.81 1998/12/16 14:29:00 jonas
  1294. * use of UnsetBool instead of manually checking for -Option-
  1295. Revision 1.80 1998/12/16 13:36:05 jonas
  1296. * allow '-' after the -C? options to disable them
  1297. Revision 1.78 1998/12/15 10:23:25 peter
  1298. + -iSO, -iSP, -iTO, -iTP
  1299. Revision 1.77 1998/12/14 17:23:05 peter
  1300. + -iV, -iD
  1301. Revision 1.76 1998/12/11 00:03:21 peter
  1302. + globtype,tokens,version unit splitted from globals
  1303. Revision 1.75 1998/12/08 10:18:10 peter
  1304. + -gh for heaptrc unit
  1305. Revision 1.74 1998/11/30 13:26:24 pierre
  1306. * the code for ordering the exported procs/vars was buggy
  1307. + added -WB to force binding (Ozerski way of creating DLL)
  1308. this is off by default as direct writing of .edata section seems
  1309. OK
  1310. Revision 1.73 1998/11/30 09:43:18 pierre
  1311. * some range check bugs fixed (still not working !)
  1312. + added DLL writing support for win32 (also accepts variables)
  1313. + TempAnsi for code that could be used for Temporary ansi strings
  1314. handling
  1315. Revision 1.72 1998/11/28 14:09:45 peter
  1316. * NOATTCDQ define
  1317. Revision 1.71 1998/11/27 14:50:39 peter
  1318. + open strings, $P switch support
  1319. Revision 1.70 1998/11/18 09:18:02 pierre
  1320. + automatic loading of profile unit with -pg option
  1321. in go32v2 mode (also defines FPC_PROFILE)
  1322. * some memory leaks removed
  1323. * unreleased temp problem with sets solved
  1324. Revision 1.69 1998/11/17 11:32:45 peter
  1325. * optimize str:='' in H+ mode
  1326. + -! to test ansistrings
  1327. Revision 1.68 1998/11/17 00:36:46 peter
  1328. * more ansistring fixes
  1329. Revision 1.67 1998/11/13 15:40:20 pierre
  1330. + added -Se in Makefile cvstest target
  1331. + lexlevel cleanup
  1332. normal_function_level main_program_level and unit_init_level defined
  1333. * tins_cache grown to A_EMMS (gave range check error in asm readers)
  1334. (test added in code !)
  1335. * -Un option was wrong
  1336. * _FAIL and _SELF only keyword inside
  1337. constructors and methods respectively
  1338. Revision 1.66 1998/11/13 10:18:08 peter
  1339. + nil constants
  1340. Revision 1.65 1998/11/11 12:34:53 peter
  1341. * fixed small typo
  1342. Revision 1.64 1998/11/10 17:54:12 peter
  1343. * -g disables linker.strip
  1344. Revision 1.63 1998/11/05 12:02:49 peter
  1345. * released useansistring
  1346. * removed -Sv, its now available in fpc modes
  1347. Revision 1.62 1998/11/04 10:11:39 peter
  1348. * ansistring fixes
  1349. Revision 1.61 1998/10/27 08:24:11 pierre
  1350. -lS and -lT options changed to -iS and -iT
  1351. Revision 1.60 1998/10/26 22:23:33 peter
  1352. + fixpath() has an extra option to allow a ./ as path
  1353. Revision 1.59 1998/10/26 14:19:27 pierre
  1354. + added options -lS and -lT for source and target os output
  1355. (to have a easier way to test OS_SOURCE abd OS_TARGET in makefiles)
  1356. * several problems with rtti data
  1357. (type of sym was not checked)
  1358. assumed to be varsym when they could be procsym or property syms !!
  1359. Revision 1.58 1998/10/20 09:32:55 peter
  1360. * removed some unused vars
  1361. Revision 1.57 1998/10/16 13:37:23 florian
  1362. + switch -FD added to specify the path for utilities
  1363. Revision 1.56 1998/10/15 12:37:43 pierre
  1364. + passes vmt offset to HELP_CONSTRUCTOR for objects
  1365. Revision 1.55 1998/10/13 13:10:19 peter
  1366. * new style for m68k/i386 infos and enums
  1367. Revision 1.54 1998/10/13 08:19:40 pierre
  1368. + source_os is now set correctly for cross-processor compilers
  1369. (tos contains all target_infos and
  1370. we use CPU86 and CPU68 conditionals to
  1371. get the source operating system
  1372. this only works if you do not undefine
  1373. the source target !!)
  1374. * several cg68k memory leaks fixed
  1375. + started to change the code so that it should be possible to have
  1376. a complete compiler (both for m68k and i386 !!)
  1377. Revision 1.53 1998/10/09 13:00:25 pierre
  1378. * msgfile existence tested
  1379. Revision 1.52 1998/10/08 17:17:22 pierre
  1380. * current_module old scanner tagged as invalid if unit is recompiled
  1381. + added ppheap for better info on tracegetmem of heaptrc
  1382. (adds line column and file index)
  1383. * several memory leaks removed ith help of heaptrc !!
  1384. Revision 1.51 1998/10/05 13:53:42 peter
  1385. + -Se<value>
  1386. Revision 1.50 1998/10/02 09:24:21 peter
  1387. * more constant expression evaluators
  1388. Revision 1.49 1998/09/26 17:45:29 peter
  1389. + idtoken and only one token table
  1390. Revision 1.48 1998/09/25 09:57:07 peter
  1391. * moved -A to options.pas, becuase the code is the same
  1392. Revision 1.47 1998/09/24 23:47:03 peter
  1393. + -FE,-FU,-Sd
  1394. Revision 1.46 1998/09/23 15:39:06 pierre
  1395. * browser bugfixes
  1396. was adding a reference when looking for the symbol
  1397. if -bSYM_NAME was used
  1398. Revision 1.45 1998/09/22 17:13:47 pierre
  1399. + browsing updated and developed
  1400. records and objects fields are also stored
  1401. Revision 1.44 1998/09/21 08:45:11 pierre
  1402. + added vmt_offset in tobjectdef.write for fututre use
  1403. (first steps to have objects without vmt if no virtual !!)
  1404. + added fpu_used field for tabstractprocdef :
  1405. sets this level to 2 if the functions return with value in FPU
  1406. (is then set to correct value at parsing of implementation)
  1407. THIS MIGHT refuse some code with FPU expression too complex
  1408. that were accepted before and even in some cases
  1409. that don't overflow in fact
  1410. ( like if f : float; is a forward that finally in implementation
  1411. only uses one fpu register !!)
  1412. Nevertheless I think that it will improve security on
  1413. FPU operations !!
  1414. * most other changes only for UseBrowser code
  1415. (added symtable references for record and objects)
  1416. local switch for refs to args and local of each function
  1417. (static symtable still missing)
  1418. UseBrowser still not stable and probably broken by
  1419. the definition hash array !!
  1420. Revision 1.43 1998/09/18 08:01:33 pierre
  1421. + improvement on the usebrowser part
  1422. (does not work correctly for now)
  1423. Revision 1.42 1998/09/14 10:44:09 peter
  1424. * all internal RTL functions start with FPC_
  1425. Revision 1.41 1998/09/03 11:21:51 peter
  1426. * -al sets cs_asm_source
  1427. Revision 1.40 1998/08/31 08:50:32 peter
  1428. * fixed default msgfile loading which is now in verbose.pas
  1429. Revision 1.39 1998/08/29 13:52:38 peter
  1430. + new messagefile
  1431. * merged optione.msg into errore.msg
  1432. Revision 1.38 1998/08/25 12:42:38 pierre
  1433. * CDECL changed to CVAR for variables
  1434. specifications are read in structures also
  1435. + started adding GPC compatibility mode ( option -Sp)
  1436. * names changed to lowercase
  1437. Revision 1.37 1998/08/20 16:10:52 pierre
  1438. Q
  1439. * Changed the -E switch to get better use of RHIDE v1.4.5
  1440. Revision 1.36 1998/08/18 09:05:59 peter
  1441. * new library options
  1442. * smartlink is now -Cx
  1443. Revision 1.35 1998/08/17 09:17:48 peter
  1444. * static/shared linking updates
  1445. Revision 1.34 1998/08/14 21:56:35 peter
  1446. * setting the outputfile using -o works now to create static libs
  1447. Revision 1.33 1998/08/10 23:53:47 peter
  1448. * released all temporary defines
  1449. Revision 1.32 1998/08/10 14:50:03 peter
  1450. + localswitches, moduleswitches, globalswitches splitting
  1451. Revision 1.30 1998/08/10 08:33:17 michael
  1452. -d was destroyed by last comit
  1453. Revision 1.29 1998/08/08 15:31:04 michael
  1454. + Reinstated -e option for linux
  1455. Revision 1.28 1998/07/17 10:06:18 michael
  1456. + under linux, looking for ppc38.cfg in bindir removed.
  1457. Revision 1.27 1998/07/07 11:19:58 peter
  1458. + NEWINPUT for a better inputfile and scanner object
  1459. Revision 1.26 1998/07/06 15:51:17 michael
  1460. Added length checking for string reading
  1461. Revision 1.25 1998/07/04 10:00:22 peter
  1462. + define HAS_PROPERTY
  1463. Revision 1.24 1998/07/01 15:28:49 peter
  1464. + better writeln/readln handling, now 100% like tp7
  1465. Revision 1.22 1998/06/13 00:10:07 peter
  1466. * working browser and newppu
  1467. * some small fixes against crashes which occured in bp7 (but not in
  1468. fpc?!)
  1469. Revision 1.21 1998/06/12 16:15:32 pierre
  1470. * external name 'C_var';
  1471. export name 'intern_C_var';
  1472. cdecl;
  1473. cdecl;external;
  1474. are now supported only with -Sv switch
  1475. Revision 1.20 1998/06/08 22:59:47 peter
  1476. * smartlinking works for win32
  1477. * some defines to exclude some compiler parts
  1478. Revision 1.19 1998/06/04 23:51:46 peter
  1479. * m68k compiles
  1480. + .def file creation moved to gendef.pas so it could also be used
  1481. for win32
  1482. Revision 1.17 1998/05/25 17:11:40 pierre
  1483. * firstpasscount bug fixed
  1484. now all is already set correctly the first time
  1485. under EXTDEBUG try -gp to skip all other firstpasses
  1486. it works !!
  1487. * small bug fixes
  1488. - for smallsets with -dTESTSMALLSET
  1489. - some warnings removed (by correcting code !)
  1490. Revision 1.16 1998/05/23 01:21:12 peter
  1491. + aktasmmode, aktoptprocessor, aktoutputformat
  1492. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1493. + $LIBNAME to set the library name where the unit will be put in
  1494. * splitted cgi386 a bit (codeseg to large for bp7)
  1495. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1496. Revision 1.15 1998/05/20 09:42:34 pierre
  1497. + UseTokenInfo now default
  1498. * unit in interface uses and implementation uses gives error now
  1499. * only one error for unknown symbol (uses lastsymknown boolean)
  1500. the problem came from the label code !
  1501. + first inlined procedures and function work
  1502. (warning there might be allowed cases were the result is still wrong !!)
  1503. * UseBrower updated gives a global list of all position of all used symbols
  1504. with switch -gb
  1505. Revision 1.14 1998/05/12 10:46:59 peter
  1506. * moved printstatus to verb_def
  1507. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1508. prefix like error: warning: and is included in V_Default
  1509. * fixed some messages
  1510. * first time parameter scan is only for -v and -T
  1511. - removed old style messages
  1512. Revision 1.13 1998/05/08 09:21:20 michael
  1513. * Added missing -Fl message to messages file.
  1514. * Corrected mangling of file names when doing Linklib
  1515. * -Fl now actually WORKS.
  1516. * Librarysearchpath is now a field in linker object.
  1517. Revision 1.12 1998/05/06 08:38:41 pierre
  1518. * better position info with UseTokenInfo
  1519. UseTokenInfo greatly simplified
  1520. + added check for changed tree after first time firstpass
  1521. (if we could remove all the cases were it happen
  1522. we could skip all firstpass if firstpasscount > 1)
  1523. Only with ExtDebug
  1524. Revision 1.11 1998/05/04 17:54:27 peter
  1525. + smartlinking works (only case jumptable left todo)
  1526. * redesign of systems.pas to support assemblers and linkers
  1527. + Unitname is now also in the PPU-file, increased version to 14
  1528. Revision 1.10 1998/05/01 16:38:44 florian
  1529. * handling of private and protected fixed
  1530. + change_keywords_to_tp implemented to remove
  1531. keywords which aren't supported by tp
  1532. * break and continue are now symbols of the system unit
  1533. + widestring, longstring and ansistring type released
  1534. Revision 1.9 1998/04/30 15:59:40 pierre
  1535. * GDB works again better :
  1536. correct type info in one pass
  1537. + UseTokenInfo for better source position
  1538. * fixed one remaining bug in scanner for line counts
  1539. * several little fixes
  1540. Revision 1.8 1998/04/27 15:45:20 peter
  1541. + -Xl for smartlink
  1542. + target_info.arext = .a
  1543. Revision 1.7 1998/04/23 12:07:25 peter
  1544. * fixed -i
  1545. Revision 1.6 1998/04/08 16:58:03 pierre
  1546. * several bugfixes
  1547. ADD ADC and AND are also sign extended
  1548. nasm output OK (program still crashes at end
  1549. and creates wrong assembler files !!)
  1550. procsym types sym in tdef removed !!
  1551. Revision 1.5 1998/04/08 12:31:00 peter
  1552. + .ppc386.cfg and #INCLUDE support
  1553. Revision 1.4 1998/04/07 13:19:46 pierre
  1554. * bugfixes for reset_gdb_info
  1555. in MEM parsing for go32v2
  1556. better external symbol creation
  1557. support for rhgdb.exe (lowercase file names)
  1558. }