options.pas 53 KB

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