options.pas 50 KB

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