options.pas 51 KB

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