options.pas 54 KB

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