globals.pas 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630
  1. {
  2. $Id$
  3. Copyright (C) 1993-98 by Florian Klaempfl
  4. This unit implements some support functions and global variables
  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. {$ifdef tp}
  19. {$E+,N+}
  20. {$endif}
  21. unit globals;
  22. interface
  23. uses
  24. {$ifdef TP}
  25. objects,
  26. {$endif}
  27. {$ifdef linux}
  28. linux,
  29. {$endif}
  30. strings,dos,
  31. globtype,version,tokens,systems,cobjects;
  32. const
  33. {$ifdef linux}
  34. DirSep = '/';
  35. {$else}
  36. {$ifdef amiga}
  37. DirSep = '/';
  38. {$else}
  39. DirSep = '\';
  40. {$endif}
  41. {$endif}
  42. {$ifdef Splitheap}
  43. testsplit : boolean = false;
  44. {$endif Splitheap}
  45. delphimodeswitches : tmodeswitches=
  46. [m_delphi,m_tp,m_all,m_class,m_objpas,m_result,m_string_pchar,
  47. m_pointer_2_procedure,m_autoderef];
  48. fpcmodeswitches : tmodeswitches=
  49. [m_fpc,m_all,m_class,m_string_pchar,m_nested_comment,m_repeat_forward,
  50. m_cvar_support];
  51. objfpcmodeswitches : tmodeswitches=
  52. [m_fpc,m_all,m_objpas,m_class,m_result,m_string_pchar,m_nested_comment,
  53. m_repeat_forward,m_cvar_support];
  54. tpmodeswitches : tmodeswitches=
  55. [m_tp,m_all,m_tp_procvar];
  56. gpcmodeswitches : tmodeswitches=
  57. [m_gpc,m_all];
  58. var
  59. { specified inputfile }
  60. inputdir : dirstr;
  61. inputfile : namestr;
  62. inputextension : extstr;
  63. { specified outputfile with -o parameter }
  64. outputfile : namestr;
  65. { specified with -FE or -FU }
  66. outputexedir : dirstr;
  67. outputunitdir : dirstr;
  68. { directory where the utils can be found (options -FD) }
  69. utilsdirectory : dirstr;
  70. { some flags for global compiler switches }
  71. do_build,
  72. do_make : boolean;
  73. not_unit_proc : boolean;
  74. { path for searching units, different paths can be seperated by ; }
  75. exepath : dirstr; { Path to ppc }
  76. unitsearchpath,
  77. objectsearchpath,
  78. includesearchpath : string;
  79. { deffile }
  80. usewindowapi : boolean;
  81. description : string;
  82. { current position }
  83. token, { current token being parsed }
  84. idtoken : ttoken; { holds the token if the pattern is a known word }
  85. tokenpos, { last postion of the read token }
  86. aktfilepos : tfileposinfo; { current position }
  87. { type of currently parsed block }
  88. { isn't full implemented (FK) }
  89. block_type : tblock_type;
  90. in_args : boolean; { arguments must be checked especially }
  91. parsing_para_level : longint; { parameter level, used to convert
  92. proc calls to proc loads in firstcalln }
  93. Must_be_valid : boolean; { should the variable already have a value }
  94. compile_level : word;
  95. make_ref : boolean;
  96. use_esp_stackframe : boolean; { to test for call with ESP as stack frame }
  97. {$ifdef TP}
  98. use_big : boolean;
  99. {$endif}
  100. { commandline values }
  101. initdefines : tlinkedlist;
  102. initglobalswitches : tglobalswitches;
  103. initmoduleswitches : tmoduleswitches;
  104. initlocalswitches : tlocalswitches;
  105. initmodeswitches : tmodeswitches;
  106. initpackenum,
  107. initpackrecords : longint;
  108. initoutputformat : tasm;
  109. initoptprocessor : tprocessors;
  110. initasmmode : tasmmode;
  111. { current state values }
  112. aktglobalswitches : tglobalswitches;
  113. aktmoduleswitches : tmoduleswitches;
  114. aktlocalswitches : tlocalswitches;
  115. aktmodeswitches : tmodeswitches;
  116. aktpackenum,
  117. aktpackrecords : longint;
  118. aktoutputformat : tasm;
  119. aktoptprocessor : tprocessors;
  120. aktasmmode : tasmmode;
  121. { Memory sizes }
  122. heapsize,
  123. maxheapsize,
  124. stacksize : longint;
  125. {$Ifdef EXTDEBUG}
  126. total_of_firstpass,
  127. firstpass_several : longint;
  128. {$EndIf EXTDEBUG}
  129. { parameter switches }
  130. {$Ifdef EXTDEBUG}
  131. debugstop,
  132. only_one_pass : boolean;
  133. {$EndIf EXTDEBUG}
  134. { windows application type }
  135. apptype : tapptype;
  136. const
  137. RelocSection : boolean = false;
  138. DLLsource : boolean = false;
  139. { no binding needed for win32
  140. .edata written directly !! PM }
  141. bind_win32_dll : boolean = false;
  142. { should we allow non static members ? }
  143. allow_only_static : boolean = false;
  144. Inside_asm_statement : boolean = false;
  145. { for error info in pp.pas }
  146. const
  147. parser_current_file : string = '';
  148. function getspeedvalue(const s : string) : longint;
  149. {$ifdef debug}
  150. { if the pointer don't point to the heap then write an error }
  151. function assigned(p : pointer) : boolean;
  152. {$endif}
  153. function min(a,b : longint) : longint;
  154. function max(a,b : longint) : longint;
  155. function align(i,a:longint):longint;
  156. procedure Replace(var s:string;const s1,s2:string);
  157. function upper(const s : string) : string;
  158. function lower(const s : string) : string;
  159. function trimspace(const s:string):string;
  160. procedure uppervar(var s : string);
  161. function tostr(i : longint) : string;
  162. function tostr_with_plus(i : longint) : string;
  163. procedure valint(S : string;var V : longint;var code : integer);
  164. function is_number(const s : string) : boolean;
  165. function ispowerof2(value : longint;var power : longint) : boolean;
  166. { enable ansistring comparison }
  167. function compareansistrings(p1,p2 : pchar;length1,length2 : longint) : longint;
  168. function concatansistrings(p1,p2 : pchar;length1,length2 : longint) : pchar;
  169. function bstoslash(const s : string) : string;
  170. procedure abstract;
  171. function getdatestr:string;
  172. function gettimestr:string;
  173. function filetimestring( t : longint) : string;
  174. function path_absolute(const s : string) : boolean;
  175. Function FileExists ( Const F : String) : Boolean;
  176. Function RemoveFile(const f:string):boolean;
  177. Function RemoveDir(d:string):boolean;
  178. Function GetFileTime ( Var F : File) : Longint;
  179. Function GetNamedFileTime ( Const F : String) : Longint;
  180. Function SplitFileName(const s:string):string;
  181. Function SplitName(const s:string):string;
  182. Function SplitExtension(Const HStr:String):String;
  183. Function AddExtension(Const HStr,ext:String):String;
  184. Function ForceExtension(Const HStr,ext:String):String;
  185. Function FixPath(s:string;allowdot:boolean):string;
  186. function FixFileName(const s:string):string;
  187. procedure AddPathToList(var list:string;s:string;first:boolean);
  188. function search(const f : string;path : string;var b : boolean) : string;
  189. procedure SynchronizeFileTime(const fn1,fn2:string);
  190. function FindExe(bin:string;var found:boolean):string;
  191. procedure InitGlobals;
  192. procedure DoneGlobals;
  193. implementation
  194. {$ifdef FPC}
  195. function getspeedvalue(const s : string) : longint;
  196. var
  197. p1,p2:^byte;
  198. begin
  199. p1:=@s;
  200. longint(p2):=longint(p1)+p1^+1;
  201. inc(longint(p1));
  202. getspeedvalue:=0;
  203. while p1<>p2 do
  204. begin
  205. inc(getspeedvalue,p1^);
  206. inc(longint(p1));
  207. end;
  208. end;
  209. {$else}
  210. function getspeedvalue(const s : string) : longint;
  211. type
  212. ptrrec=record
  213. ofs,seg:word;
  214. end;
  215. var
  216. l,w : longint;
  217. p1,p2 : ^byte;
  218. begin
  219. p1:=@s;
  220. ptrrec(p2).seg:=ptrrec(p1).seg;
  221. ptrrec(p2).ofs:=ptrrec(p1).ofs+p1^+1;
  222. inc(p1);
  223. l:=0;
  224. while p1<>p2 do
  225. begin
  226. l:=l+p1^;
  227. inc(p1);
  228. end;
  229. getspeedvalue:=l;
  230. end;
  231. {$endif}
  232. function ngraphsearchvalue(const s1,s2 : string) : double;
  233. const
  234. n = 3;
  235. var
  236. equals,i,j : longint;
  237. hs : string;
  238. begin
  239. equals:=0;
  240. { is the string long enough ? }
  241. if min(length(s1),length(s2))-n+1<1 then
  242. begin
  243. ngraphsearchvalue:=0.0;
  244. exit;
  245. end;
  246. for i:=1 to length(s1)-n+1 do
  247. begin
  248. hs:=copy(s1,i,n);
  249. for j:=1 to length(s2)-n+1 do
  250. if hs=copy(s2,j,n) then
  251. inc(equals);
  252. end;
  253. {$ifdef fpc}
  254. ngraphsearchvalue:=equals/double(max(length(s1),length(s2))-n+1);
  255. {$else}
  256. ngraphsearchvalue:=equals/(max(length(s1),length(s2))-n+1);
  257. {$endif}
  258. end;
  259. function bstoslash(const s : string) : string;
  260. {
  261. return string s with all \ changed into /
  262. }
  263. var
  264. i : longint;
  265. begin
  266. for i:=1to length(s) do
  267. if s[i]='\' then
  268. bstoslash[i]:='/'
  269. else
  270. bstoslash[i]:=s[i];
  271. {$ifndef TP}
  272. {$ifopt H+}
  273. setlength(bstoslash,length(s));
  274. {$else}
  275. bstoslash[0]:=s[0];
  276. {$endif}
  277. {$else}
  278. bstoslash[0]:=s[0];
  279. {$endif}
  280. end;
  281. {$ifdef debug}
  282. function assigned(p : pointer) : boolean;
  283. {$ifndef FPC}
  284. {$ifndef DPMI}
  285. var
  286. lp : longint;
  287. {$endif DPMI}
  288. {$endif FPC}
  289. begin
  290. {$ifdef FPC}
  291. { Assigned is used for procvar and
  292. stack stored temp records !! PM }
  293. (* if (p<>nil) {and
  294. ((p<heaporg) or
  295. (p>heapptr))} then
  296. runerror(230); *)
  297. {$else}
  298. {$ifdef DPMI}
  299. assigned:=(p<>nil);
  300. exit;
  301. {$else DPMI}
  302. if p=nil then
  303. lp:=0
  304. else
  305. lp:=longint(ptrrec(p).seg)*16+longint(ptrrec(p).ofs);
  306. if (lp<>0) and
  307. ((lp<longint(seg(heaporg^))*16+longint(ofs(heaporg^))) or
  308. (lp>longint(seg(heapptr^))*16+longint(ofs(heapptr^)))) then
  309. runerror(230);
  310. {$endif DPMI}
  311. {$endif FPC}
  312. assigned:=(p<>nil);
  313. end;
  314. {$endif}
  315. function min(a,b : longint) : longint;
  316. {
  317. return the minimal of a and b
  318. }
  319. begin
  320. if a>b then
  321. min:=b
  322. else
  323. min:=a;
  324. end;
  325. function max(a,b : longint) : longint;
  326. {
  327. return the maximum of a and b
  328. }
  329. begin
  330. if a<b then
  331. max:=b
  332. else
  333. max:=a;
  334. end;
  335. function align(i,a:longint):longint;
  336. {
  337. return value <i> aligned <a> boundary
  338. }
  339. begin
  340. align:=(i+a-1) and not(a-1);
  341. end;
  342. procedure Replace(var s:string;const s1,s2:string);
  343. {
  344. replace all s1 with s2 in string s
  345. }
  346. var
  347. i : longint;
  348. begin
  349. repeat
  350. i:=pos(s1,s);
  351. if i>0 then
  352. begin
  353. Delete(s,i,length(s1));
  354. Insert(s2,s,i);
  355. end;
  356. until i=0;
  357. end;
  358. function upper(const s : string) : string;
  359. {
  360. return uppercased string of s
  361. }
  362. var
  363. i : longint;
  364. begin
  365. for i:=1 to length(s) do
  366. if s[i] in ['a'..'z'] then
  367. upper[i]:=char(byte(s[i])-32)
  368. else
  369. upper[i]:=s[i];
  370. {$ifdef FPC}
  371. {$ifopt H+}
  372. setlength(upper,length(s));
  373. {$else}
  374. upper[0]:=s[0];
  375. {$endif}
  376. {$else}
  377. upper[0]:=s[0];
  378. {$endif}
  379. end;
  380. function lower(const s : string) : string;
  381. {
  382. return lowercased string of s
  383. }
  384. var
  385. i : longint;
  386. begin
  387. for i:=1 to length(s) do
  388. if s[i] in ['A'..'Z'] then
  389. lower[i]:=char(byte(s[i])+32)
  390. else
  391. lower[i]:=s[i];
  392. {$ifndef TP}
  393. {$ifopt H+}
  394. setlength(lower,length(s));
  395. {$else}
  396. lower[0]:=s[0];
  397. {$endif}
  398. {$else}
  399. lower[0]:=s[0];
  400. {$endif}
  401. end;
  402. procedure uppervar(var s : string);
  403. {
  404. uppercase string s
  405. }
  406. var
  407. i : longint;
  408. begin
  409. for i:=1 to length(s) do
  410. if s[i] in ['a'..'z'] then
  411. s[i]:=char(byte(s[i])-32);
  412. end;
  413. function trimspace(const s:string):string;
  414. {
  415. return s with all leading and ending spaces and tabs removed
  416. }
  417. var
  418. i,j : longint;
  419. begin
  420. i:=length(s);
  421. while (i>0) and (s[i] in [#9,' ']) do
  422. dec(i);
  423. j:=1;
  424. while (j<i) and (s[j] in [#9,' ']) do
  425. inc(j);
  426. trimspace:=Copy(s,j,i-j+1);
  427. end;
  428. function tostr(i : longint) : string;
  429. {
  430. return string of value i
  431. }
  432. var
  433. hs : string;
  434. begin
  435. str(i,hs);
  436. tostr:=hs;
  437. end;
  438. function tostr_with_plus(i : longint) : string;
  439. {
  440. return string of value i, but always include a + when i>=0
  441. }
  442. var
  443. hs : string;
  444. begin
  445. str(i,hs);
  446. if i>=0 then
  447. tostr_with_plus:='+'+hs
  448. else
  449. tostr_with_plus:=hs;
  450. end;
  451. procedure valint(S : string;var V : longint;var code : integer);
  452. {
  453. val() with support for octal, which is not supported under tp7
  454. }
  455. {$ifndef FPC}
  456. var
  457. vs : longint;
  458. c : byte;
  459. begin
  460. if s[1]='%' then
  461. begin
  462. vs:=0;
  463. longint(v):=0;
  464. for c:=2 to length(s) do
  465. begin
  466. if s[c]='0' then
  467. vs:=vs shl 1
  468. else
  469. if s[c]='1' then
  470. vs:=vs shl 1+1
  471. else
  472. begin
  473. code:=c;
  474. exit;
  475. end;
  476. end;
  477. code:=0;
  478. longint(v):=vs;
  479. end
  480. else
  481. system.val(S,V,code);
  482. end;
  483. {$else not FPC}
  484. begin
  485. system.val(S,V,code);
  486. end;
  487. {$endif not FPC}
  488. function is_number(const s : string) : boolean;
  489. {
  490. is string a correct number ?
  491. }
  492. var
  493. w : integer;
  494. l : longint;
  495. begin
  496. valint(s,l,w);
  497. is_number:=(w=0);
  498. end;
  499. function ispowerof2(value : longint;var power : longint) : boolean;
  500. {
  501. return if value is a power of 2. And if correct return the power
  502. }
  503. var
  504. hl : longint;
  505. i : longint;
  506. begin
  507. hl:=1;
  508. ispowerof2:=true;
  509. for i:=0 to 31 do
  510. begin
  511. if hl=value then
  512. begin
  513. power:=i;
  514. exit;
  515. end;
  516. hl:=hl shl 1;
  517. end;
  518. ispowerof2:=false;
  519. end;
  520. { enable ansistring comparison }
  521. { 0 means equal }
  522. { 1 means p1 > p2 }
  523. { -1 means p1 < p2 }
  524. function compareansistrings(p1,p2 : pchar;length1,length2 : longint) : longint;
  525. var
  526. i,j : longint;
  527. begin
  528. compareansistrings:=0;
  529. j:=min(length1,length2);
  530. for i:=1 to j do
  531. begin
  532. if p1[i]>p2[i] then
  533. begin
  534. compareansistrings:=1;
  535. exit;
  536. end
  537. else if p1[i]<p2[i] then
  538. begin
  539. compareansistrings:=-1;
  540. exit;
  541. end;
  542. end;
  543. if length1>length2 then
  544. compareansistrings:=1
  545. else
  546. if length1<length2 then
  547. compareansistrings:=-1;
  548. end;
  549. function concatansistrings(p1,p2 : pchar;length1,length2 : longint) : pchar;
  550. var
  551. p : pchar;
  552. begin
  553. getmem(p,length1+length2+1);
  554. move(p1[0],p[0],length1);
  555. move(p2[0],p[length1],length2+1);
  556. concatansistrings:=p;
  557. end;
  558. {****************************************************************************
  559. Time Handling
  560. ****************************************************************************}
  561. Function L0(l:longint):string;
  562. {
  563. return the string of value l, if l<10 then insert a zero, so
  564. the string is always at least 2 chars '01','02',etc
  565. }
  566. var
  567. s : string;
  568. begin
  569. Str(l,s);
  570. if l<10 then
  571. s:='0'+s;
  572. L0:=s;
  573. end;
  574. function gettimestr:string;
  575. {
  576. get the current time in a string HH:MM:SS
  577. }
  578. var
  579. hour,min,sec,hsec : word;
  580. begin
  581. dos.gettime(hour,min,sec,hsec);
  582. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  583. end;
  584. function getdatestr:string;
  585. {
  586. get the current date in a string YY/MM/DD
  587. }
  588. var
  589. Year,Month,Day,Wday : Word;
  590. begin
  591. dos.getdate(year,month,day,wday);
  592. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  593. end;
  594. function filetimestring( t : longint) : string;
  595. {
  596. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  597. }
  598. var
  599. {$ifndef linux}
  600. DT : DateTime;
  601. {$endif}
  602. Year,Month,Day,Hour,Min,Sec : Word;
  603. begin
  604. if t=-1 then
  605. begin
  606. FileTimeString:='Not Found';
  607. exit;
  608. end;
  609. {$ifndef linux}
  610. unpacktime(t,DT);
  611. Year:=dT.year;month:=dt.month;day:=dt.day;
  612. Hour:=dt.hour;min:=dt.min;sec:=dt.sec;
  613. {$else}
  614. EpochToLocal (t,year,month,day,hour,min,sec);
  615. {$endif}
  616. filetimestring:=L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  617. end;
  618. {****************************************************************************
  619. File Handling
  620. ****************************************************************************}
  621. function path_absolute(const s : string) : boolean;
  622. {
  623. is path s an absolute path?
  624. }
  625. begin
  626. path_absolute:=false;
  627. {$ifdef linux}
  628. if (length(s)>0) and (s[1]='/') then
  629. path_absolute:=true;
  630. {$else linux}
  631. {$ifdef amiga}
  632. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
  633. path_absolute:=true;
  634. {$else}
  635. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
  636. ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
  637. path_absolute:=true;
  638. {$endif amiga}
  639. {$endif linux}
  640. end;
  641. {$ifndef FPC}
  642. Procedure FindClose(var Info : SearchRec);
  643. Begin
  644. End;
  645. {$endif not FPC}
  646. Function FileExists ( Const F : String) : Boolean;
  647. Var
  648. {$ifdef linux}
  649. Info : Stat;
  650. {$else}
  651. Info : SearchRec;
  652. {$endif}
  653. begin
  654. {$ifdef linux}
  655. FileExists:=FStat(F,info);
  656. {$else}
  657. findfirst(F,readonly+archive+hidden,info);
  658. FileExists:=(doserror=0);
  659. findclose(Info);
  660. {$endif}
  661. end;
  662. Function RemoveFile(const f:string):boolean;
  663. var
  664. g : file;
  665. begin
  666. assign(g,f);
  667. {$I-}
  668. erase(g);
  669. {$I+}
  670. RemoveFile:=(ioresult=0);
  671. end;
  672. Function RemoveDir(d:string):boolean;
  673. begin
  674. if d[length(d)]=DirSep then
  675. Delete(d,length(d),1);
  676. {$I-}
  677. rmdir(d);
  678. {$I+}
  679. RemoveDir:=(ioresult=0);
  680. end;
  681. Function SplitFileName(const s:string):string;
  682. var
  683. p : dirstr;
  684. n : namestr;
  685. e : extstr;
  686. begin
  687. FSplit(s,p,n,e);
  688. SplitFileName:=n+e;
  689. end;
  690. Function SplitName(const s:string):string;
  691. var
  692. i,j : longint;
  693. begin
  694. i:=Length(s);
  695. j:=Length(s);
  696. while (i>0) and not(s[i] in ['/','\']) do
  697. dec(i);
  698. while (j>0) and (s[j]<>'.') do
  699. dec(j);
  700. if j<=i then
  701. j:=255;
  702. SplitName:=Copy(s,i+1,j-(i+1));
  703. end;
  704. Function SplitExtension(Const HStr:String):String;
  705. var
  706. j : longint;
  707. begin
  708. j:=length(Hstr);
  709. while (j>0) and (Hstr[j]<>'.') do
  710. begin
  711. if hstr[j]=DirSep then
  712. j:=0
  713. else
  714. dec(j);
  715. end;
  716. if j=0 then
  717. j:=254;
  718. SplitExtension:=Copy(Hstr,j,255);
  719. end;
  720. Function AddExtension(Const HStr,ext:String):String;
  721. begin
  722. if (Ext<>'') and (SplitExtension(HStr)='') then
  723. AddExtension:=Hstr+Ext
  724. else
  725. AddExtension:=Hstr;
  726. end;
  727. Function ForceExtension(Const HStr,ext:String):String;
  728. var
  729. j : longint;
  730. begin
  731. j:=length(Hstr);
  732. while (j>0) and (Hstr[j]<>'.') do
  733. dec(j);
  734. if j=0 then
  735. j:=255;
  736. ForceExtension:=Copy(Hstr,1,j-1)+Ext;
  737. end;
  738. Function FixPath(s:string;allowdot:boolean):string;
  739. var
  740. i : longint;
  741. begin
  742. for i:=1 to length(s) do
  743. if s[i] in ['/','\'] then
  744. s[i]:=DirSep;
  745. if (length(s)>0) and (s[length(s)]<>DirSep) and
  746. (s[length(s)]<>':') then
  747. s:=s+DirSep;
  748. if (not allowdot) and (s='.'+DirSep) then
  749. s:='';
  750. FixPath:=s;
  751. end;
  752. function FixFileName(const s:string):string;
  753. var
  754. i : longint;
  755. NoPath : boolean;
  756. begin
  757. NoPath:=true;
  758. for i:=length(s) downto 1 do
  759. begin
  760. case s[i] of
  761. {$ifdef Linux}
  762. '/','\' : begin
  763. FixFileName[i]:='/';
  764. NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
  765. end;
  766. 'A'..'Z' : if NoPath then
  767. FixFileName[i]:=char(byte(s[i])+32)
  768. else
  769. FixFileName[i]:=s[i];
  770. {$else}
  771. '/' : FixFileName[i]:='\';
  772. 'A'..'Z' : FixFileName[i]:=char(byte(s[i])+32);
  773. {$endif}
  774. else
  775. FixFileName[i]:=s[i];
  776. end;
  777. end;
  778. {$ifndef TP}
  779. {$ifopt H+}
  780. SetLength(FixFileName,length(s));
  781. {$else}
  782. FixFileName[0]:=s[0];
  783. {$endif}
  784. {$else}
  785. FixFileName[0]:=s[0];
  786. {$endif}
  787. end;
  788. procedure AddPathToList(var list:string;s:string;first:boolean);
  789. var
  790. LastAdd,
  791. starti,i,j : longint;
  792. Found : boolean;
  793. CurrentDir,
  794. CurrPath,
  795. AddList : string;
  796. begin
  797. if s='' then
  798. exit;
  799. {Fix List}
  800. if (length(list)>0) and (list[length(list)]<>';') then
  801. list:=list+';';
  802. GetDir(0,CurrentDir);
  803. CurrentDir:=FixPath(CurrentDir,false);
  804. AddList:='';
  805. LastAdd:=1;
  806. repeat
  807. j:=Pos(';',s);
  808. if j=0 then
  809. j:=255;
  810. {Get Pathname}
  811. CurrPath:=FixPath(Copy(s,1,j-1),false);
  812. if CurrPath='' then
  813. CurrPath:='.'+DirSep+';'
  814. else
  815. begin
  816. CurrPath:=FixPath(FExpand(CurrPath),false)+';';
  817. if (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
  818. CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
  819. end;
  820. Delete(s,1,j);
  821. {Check if already in path}
  822. found:=false;
  823. i:=0;
  824. starti:=1;
  825. while (not found) and (i<length(list)) do
  826. begin
  827. inc(i);
  828. if (list[i]=';') then
  829. begin
  830. found:=(CurrPath=Copy(List,starti,i-starti+1));
  831. if Found then
  832. begin
  833. if First then
  834. Delete(List,Starti,i-starti+1); {The new entry is placed first}
  835. end
  836. else
  837. starti:=i+1;
  838. end;
  839. end;
  840. if First then
  841. begin
  842. Insert(CurrPath,List,LastAdd);
  843. inc(LastAdd,Length(CurrPath));
  844. end
  845. else
  846. if not Found then
  847. List:=List+CurrPath
  848. until (s='');
  849. end;
  850. function search(const f : string;path : string;var b : boolean) : string;
  851. Var
  852. singlepathstring : string;
  853. i : longint;
  854. begin
  855. {$ifdef linux}
  856. for i:=1 to length(path) do
  857. if path[i]=':' then
  858. path[i]:=';';
  859. {$endif}
  860. b:=false;
  861. search:='';
  862. repeat
  863. i:=pos(';',path);
  864. if i=0 then
  865. i:=255;
  866. singlepathstring:=FixPath(copy(path,1,i-1),false);
  867. delete(path,1,i);
  868. If FileExists (singlepathstring+f) then
  869. begin
  870. Search:=singlepathstring;
  871. b:=true;
  872. exit;
  873. end;
  874. until path='';
  875. end;
  876. Function GetFileTime ( Var F : File) : Longint;
  877. Var
  878. {$ifdef linux}
  879. Info : Stat;
  880. {$endif}
  881. L : longint;
  882. begin
  883. {$ifdef linux}
  884. FStat (F,Info);
  885. L:=Info.Mtime;
  886. {$else}
  887. GetFTime(f,l);
  888. {$endif}
  889. GetFileTime:=L;
  890. end;
  891. Function GetNamedFileTime (Const F : String) : Longint;
  892. var
  893. L : Longint;
  894. {$ifndef linux}
  895. info : SearchRec;
  896. {$else}
  897. info : stat;
  898. {$endif}
  899. begin
  900. l:=-1;
  901. {$ifdef linux}
  902. if FStat (F,Info) then
  903. L:=info.mtime;
  904. {$else}
  905. FindFirst (F,archive+readonly+hidden,info);
  906. if DosError=0 then
  907. l:=info.time;
  908. {$ifdef Linux}
  909. FindClose(info);
  910. {$endif}
  911. {$ifdef Win32}
  912. FindClose(info);
  913. {$endif}
  914. {$endif}
  915. GetNamedFileTime:=l;
  916. end;
  917. {Touch Assembler and object time to ppu time is there is a ppufilename}
  918. procedure SynchronizeFileTime(const fn1,fn2:string);
  919. var
  920. f : file;
  921. l : longint;
  922. begin
  923. Assign(f,fn1);
  924. {$I-}
  925. reset(f,1);
  926. {$I+}
  927. if ioresult=0 then
  928. begin
  929. getftime(f,l);
  930. close(f);
  931. assign(f,fn2);
  932. {$I-}
  933. reset(f,1);
  934. {$I+}
  935. if ioresult=0 then
  936. begin
  937. setftime(f,l);
  938. close(f);
  939. end;
  940. end;
  941. end;
  942. function FindExe(bin:string;var found:boolean):string;
  943. begin
  944. bin:=FixFileName(bin)+source_os.exeext;
  945. FindExe:=Search(bin,'.;'+exepath+';'+dos.getenv('PATH'),found)+bin;
  946. end;
  947. procedure abstract;
  948. begin
  949. runerror(255);
  950. end;
  951. {****************************************************************************
  952. Init
  953. ****************************************************************************}
  954. procedure get_exepath;
  955. var
  956. hs1 : namestr;
  957. hs2 : extstr;
  958. begin
  959. exepath:=dos.getenv('PPC_EXEC_PATH');
  960. if exepath='' then
  961. fsplit(FixFileName(paramstr(0)),exepath,hs1,hs2);
  962. {$ifdef linux}
  963. if exepath='' then
  964. fsearch(hs1,dos.getenv('PATH'));
  965. {$endif}
  966. exepath:=FixPath(exepath,false);
  967. end;
  968. procedure DoneGlobals;
  969. begin
  970. initdefines.done;
  971. end;
  972. procedure InitGlobals;
  973. begin
  974. { set global switches }
  975. do_build:=false;
  976. do_make:=true;
  977. {$ifdef tp}
  978. use_big:=false;
  979. {$endif tp}
  980. { Output }
  981. OutputFile:='';
  982. OutputExeDir:='';
  983. OutputUnitDir:='';
  984. { Utils directory }
  985. utilsdirectory:='';
  986. { Def file }
  987. usewindowapi:=false;
  988. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  989. {$ifdef BrowserCol}
  990. {$define BrowserDefault}
  991. {$endif BrowserCol}
  992. {$ifdef BrowserLog}
  993. {$define BrowserDefault}
  994. {$endif BrowserLog}
  995. { Init values }
  996. {$ifdef i386}
  997. initoptprocessor:=Class386;
  998. initlocalswitches:=[];
  999. initmoduleswitches:=[cs_extsyntax{$ifdef BrowserDefault},cs_browser{$endif}];
  1000. initglobalswitches:=[cs_check_unit_name];
  1001. initmodeswitches:=fpcmodeswitches;
  1002. initpackenum:=4;
  1003. initpackrecords:=2;
  1004. initoutputformat:=target_asm.id;
  1005. {$ifdef AG386BIN}
  1006. initasmmode:=asmmode_i386_att;
  1007. {$else}
  1008. initasmmode:=asmmode_i386_direct;
  1009. {$endif}
  1010. initdefines.init;
  1011. {$else not i386}
  1012. {$ifdef m68k}
  1013. initoptprocessor:=MC68000;
  1014. initlocalswitches:=[];
  1015. initmoduleswitches:=[cs_extsyntax{$ifdef BrowserDefault},cs_browser{$endif},cs_fp_emulation];
  1016. initglobalswitches:=[cs_check_unit_name];
  1017. initmodeswitches:=fpcmodeswitches;
  1018. initpackenum:=4;
  1019. initpackrecords:=2;
  1020. initoutputformat:=as_m68k_as;
  1021. initasmmode:=asmmode_m68k_mot;
  1022. initdefines.init;
  1023. {$endif m68k}
  1024. {$endif i386}
  1025. { memory sizes, will be overriden by parameter or default for target
  1026. in options or init_parser }
  1027. stacksize:=0;
  1028. heapsize:=0;
  1029. maxheapsize:=0;
  1030. { compile state }
  1031. in_args:=false;
  1032. must_be_valid:=true;
  1033. not_unit_proc:=true;
  1034. apptype:=at_cui;
  1035. end;
  1036. begin
  1037. get_exepath;
  1038. end.
  1039. {
  1040. $Log$
  1041. Revision 1.2 1999-04-16 09:56:05 pierre
  1042. * unused local var commented
  1043. Revision 1.1 1999/04/08 09:14:46 michael
  1044. + Re-added;
  1045. Revision 1.119 1999/04/07 14:15:53 pierre
  1046. * assigned test for FPC removed, problems with stack variables
  1047. Revision 1.118 1999/03/17 22:23:17 florian
  1048. * a FPC compiled compiler checks now also in debug mode in assigned
  1049. if a pointer points to the heap
  1050. * when a symtable is loaded, there is no need to check for duplicate
  1051. symbols. This leads to crashes because defowner isn't assigned
  1052. in this case
  1053. Revision 1.117 1999/03/04 13:55:42 pierre
  1054. * some m68k fixes (still not compilable !)
  1055. * new(tobj) does not give warning if tobj has no VMT !
  1056. Revision 1.116 1999/03/02 18:20:09 peter
  1057. * fixed compareansistring which gave always -1 or 1 and never 0 :)
  1058. Revision 1.115 1999/03/01 15:43:47 peter
  1059. * synchronize also the objfile for ag386bin
  1060. Revision 1.114 1999/02/25 21:02:36 peter
  1061. * ag386bin updates
  1062. + coff writer
  1063. Revision 1.113 1999/02/22 13:06:50 pierre
  1064. + -b and -bl options work !
  1065. + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
  1066. is not enabled when quitting global section
  1067. * local vars and procedures are not yet stored into PPU
  1068. Revision 1.111 1999/02/11 09:46:22 pierre
  1069. * fix for normal method calls inside static methods :
  1070. WARNING there were both parser and codegen errors !!
  1071. added static_call boolean to calln tree
  1072. Revision 1.110 1999/01/27 13:05:42 pierre
  1073. * give include file name on error
  1074. Revision 1.109 1999/01/22 16:56:50 pierre
  1075. * findclose problem fixed
  1076. Revision 1.108 1999/01/22 10:08:19 daniel
  1077. * Findclose is removed for go32v1 and go32v2 platforms, because this is
  1078. TP incompatible. It is now only called for Linux and Win32.
  1079. Revision 1.107 1999/01/12 14:25:27 peter
  1080. + BrowserLog for browser.log generation
  1081. + BrowserCol for browser info in TCollections
  1082. * released all other UseBrowser
  1083. Revision 1.106 1999/01/05 08:19:57 florian
  1084. * mainly problem with invalid case ranges fixed (reported by Jonas)
  1085. Revision 1.105 1998/12/28 23:26:16 peter
  1086. + resource file handling ($R directive) for Win32
  1087. Revision 1.104 1998/12/23 22:49:42 peter
  1088. * forgot one conflict :(
  1089. Revision 1.103 1998/12/23 22:48:41 peter
  1090. * fixed findclose problem
  1091. Revision 1.102 1998/12/23 14:26:30 jonas
  1092. * patch from Peter: remove FindClose call in FileExists (caused error under Dos
  1093. when opening the ppc386.cfg file)
  1094. Revision 1.101 1998/12/23 14:02:00 peter
  1095. * daniels patches against the latest versions
  1096. Revision 1.99 1998/12/19 00:23:47 florian
  1097. * ansistring memory leaks fixed
  1098. Revision 1.98 1998/12/15 10:23:24 peter
  1099. + -iSO, -iSP, -iTO, -iTP
  1100. Revision 1.97 1998/12/11 00:03:17 peter
  1101. + globtype,tokens,version unit splitted from globals
  1102. Revision 1.96 1998/12/08 10:18:06 peter
  1103. + -gh for heaptrc unit
  1104. Revision 1.95 1998/12/03 10:17:30 peter
  1105. * target_os.use_bound_instruction boolean
  1106. Revision 1.94 1998/11/30 13:26:22 pierre
  1107. * the code for ordering the exported procs/vars was buggy
  1108. + added -WB to force binding (Ozerski way of creating DLL)
  1109. this is off by default as direct writing of .edata section seems
  1110. OK
  1111. Revision 1.93 1998/11/30 09:43:10 pierre
  1112. * some range check bugs fixed (still not working !)
  1113. + added DLL writing support for win32 (also accepts variables)
  1114. + TempAnsi for code that could be used for Temporary ansi strings
  1115. handling
  1116. Revision 1.92 1998/11/27 14:50:37 peter
  1117. + open strings, $P switch support
  1118. Revision 1.91 1998/11/26 21:33:08 peter
  1119. * rangecheck updates
  1120. Revision 1.90 1998/11/24 17:03:23 peter
  1121. * removed obsolete version.inc
  1122. Revision 1.89 1998/11/16 15:41:41 peter
  1123. * tp7 didn't like my ifopt H+ :(
  1124. Revision 1.88 1998/11/16 10:17:07 peter
  1125. * fixed for H+ compilation
  1126. Revision 1.87 1998/11/15 16:32:36 florian
  1127. * some stuff of Pavel implement (win32 dll creation)
  1128. * bug with ansistring function results fixed
  1129. Revision 1.86 1998/11/05 12:02:43 peter
  1130. * released useansistring
  1131. * removed -Sv, its now available in fpc modes
  1132. Revision 1.85 1998/10/26 22:23:30 peter
  1133. + fixpath() has an extra option to allow a ./ as path
  1134. Revision 1.84 1998/10/25 23:30:15 peter
  1135. * valint fix for tp7 to overcome overflow
  1136. Revision 1.83 1998/10/22 17:54:02 florian
  1137. + switch $APPTYPE for win32 added
  1138. Revision 1.82 1998/10/22 11:56:44 pierre
  1139. * FixPath handling of c: corrected
  1140. Revision 1.81 1998/10/19 15:41:00 peter
  1141. * better splitname to support glib-1.1.dll alike names
  1142. Revision 1.80 1998/10/16 13:37:17 florian
  1143. + switch -FD added to specify the path for utilities
  1144. Revision 1.79 1998/10/16 08:51:46 peter
  1145. + target_os.stackalignment
  1146. + stack can be aligned at 2 or 4 byte boundaries
  1147. Revision 1.78 1998/10/14 13:38:21 peter
  1148. * fixed path with staticlib/objects in ppufiles
  1149. Revision 1.77 1998/10/13 14:01:09 peter
  1150. * fixed -al
  1151. Revision 1.76 1998/10/13 13:10:15 peter
  1152. * new style for m68k/i386 infos and enums
  1153. Revision 1.75 1998/10/13 08:19:32 pierre
  1154. + source_os is now set correctly for cross-processor compilers
  1155. (tos contains all target_infos and
  1156. we use CPU86 and CPU68 conditionnals to
  1157. get the source operating system
  1158. this only works if you do not undefine
  1159. the source target !!)
  1160. * several cg68k memory leaks fixed
  1161. + started to change the code so that it should be possible to have
  1162. a complete compiler (both for m68k and i386 !!)
  1163. Revision 1.74 1998/10/12 10:28:29 florian
  1164. + auto dereferencing of pointers to structured types in delphi mode
  1165. Revision 1.73 1998/10/12 09:49:56 florian
  1166. + support of <procedure var type>:=<pointer> in delphi mode added
  1167. Revision 1.72 1998/10/06 17:16:48 pierre
  1168. * some memory leaks fixed (thanks to Peter for heaptrc !)
  1169. Revision 1.71 1998/09/30 19:53:54 michael
  1170. + Upgraded to version 0.99.9
  1171. Revision 1.70 1998/09/29 15:23:03 peter
  1172. * remove also the end files for smartlinking
  1173. Revision 1.69 1998/09/26 17:45:28 peter
  1174. + idtoken and only one token table
  1175. Revision 1.68 1998/09/24 23:49:04 peter
  1176. + aktmodeswitches
  1177. Revision 1.67 1998/09/22 17:13:46 pierre
  1178. + browsing updated and developed
  1179. records and objects fields are also stored
  1180. Revision 1.66 1998/09/22 15:40:54 peter
  1181. * some extra ifdef GDB
  1182. Revision 1.65 1998/09/18 16:03:38 florian
  1183. * some changes to compile with Delphi
  1184. Revision 1.64 1998/09/10 15:25:29 daniel
  1185. + Added maxheapsize.
  1186. * Corrected semi-bug in calling the assembler and the linker
  1187. Revision 1.63 1998/09/09 18:17:13 florian
  1188. * version number changed to 0.99.8
  1189. Revision 1.62 1998/09/07 17:36:59 florian
  1190. * first fixes for published properties
  1191. Revision 1.61 1998/09/03 11:21:52 peter
  1192. * -al sets cs_asm_source
  1193. Revision 1.60 1998/09/01 12:53:20 peter
  1194. + aktpackenum
  1195. Revision 1.59 1998/09/01 07:54:18 pierre
  1196. * UseBrowser a little updated (might still be buggy !!)
  1197. * bug in psub.pas in function specifier removed
  1198. * stdcall allowed in interface and in implementation
  1199. (FPC will not yet complain if it is missing in either part
  1200. because stdcall is only a dummy !!)
  1201. Revision 1.58 1998/08/31 12:26:25 peter
  1202. * m68k and palmos updates from surebugfixes
  1203. Revision 1.57 1998/08/29 13:51:09 peter
  1204. * moved get_exepath to globals
  1205. + date_string const with the current date for 0.99.7+
  1206. Revision 1.56 1998/08/26 15:35:31 peter
  1207. * fixed scannerfiles for macros
  1208. + $I %<environment>%
  1209. Revision 1.55 1998/08/25 12:42:35 pierre
  1210. * CDECL changed to CVAR for variables
  1211. specifications are read in structures also
  1212. + started adding GPC compatibility mode ( option -Sp)
  1213. * names changed to lowercase
  1214. Revision 1.54 1998/08/19 18:04:53 peter
  1215. * fixed current_module^.in_implementation flag
  1216. Revision 1.53 1998/08/19 16:07:45 jonas
  1217. * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
  1218. Revision 1.52 1998/08/19 10:06:13 peter
  1219. * fixed filenames and removedir which supports slash at the end
  1220. Revision 1.51 1998/08/17 09:17:46 peter
  1221. * static/shared linking updates
  1222. Revision 1.50 1998/08/14 21:56:33 peter
  1223. * setting the outputfile using -o works now to create static libs
  1224. Revision 1.49 1998/08/13 10:57:31 peter
  1225. * constant sets are now written correctly to the ppufile
  1226. Revision 1.48 1998/08/11 15:31:37 peter
  1227. * write extended to ppu file
  1228. * new version 0.99.7
  1229. Revision 1.47 1998/08/10 14:49:59 peter
  1230. + localswitches, moduleswitches, globalswitches splitting
  1231. Revision 1.46 1998/08/10 10:18:25 peter
  1232. + Compiler,Comphook unit which are the new interface units to the
  1233. compiler
  1234. Revision 1.45 1998/07/24 22:16:56 florian
  1235. * internal error 10 together with array access fixed. I hope
  1236. that's the final fix.
  1237. Revision 1.44 1998/07/18 17:11:08 florian
  1238. + ansi string constants fixed
  1239. + switch $H partial implemented
  1240. Revision 1.43 1998/07/14 21:46:42 peter
  1241. * updated messages file
  1242. Revision 1.42 1998/07/08 14:28:35 daniel
  1243. * Fixed small TP incompatibility: Fsplit requires use of dirstr, namestr and
  1244. extstr
  1245. Revision 1.41 1998/07/07 11:19:56 peter
  1246. + NEWINPUT for a better inputfile and scanner object
  1247. Revision 1.40 1998/06/25 08:48:13 florian
  1248. * first version of rtti support
  1249. Revision 1.39 1998/06/17 14:10:12 peter
  1250. * small os2 fixes
  1251. * fixed interdependent units with newppu (remake3 under linux works now)
  1252. Revision 1.38 1998/06/16 08:56:21 peter
  1253. + targetcpu
  1254. * cleaner pmodules for newppu
  1255. Revision 1.37 1998/06/13 00:10:06 peter
  1256. * working browser and newppu
  1257. * some small fixes against crashes which occured in bp7 (but not in
  1258. fpc?!)
  1259. Revision 1.36 1998/06/12 16:15:31 pierre
  1260. * external name 'C_var';
  1261. export name 'intern_C_var';
  1262. cdecl;
  1263. cdecl;external;
  1264. are now supported only with -Sv switch
  1265. Revision 1.34 1998/06/04 23:51:39 peter
  1266. * m68k compiles
  1267. + .def file creation moved to gendef.pas so it could also be used
  1268. for win32
  1269. Revision 1.33 1998/06/03 22:48:54 peter
  1270. + wordbool,longbool
  1271. * rename bis,von -> high,low
  1272. * moved some systemunit loading/creating to psystem.pas
  1273. Revision 1.32 1998/05/30 14:31:04 peter
  1274. + $ASMMODE
  1275. Revision 1.31 1998/05/28 14:40:24 peter
  1276. * fixes for newppu, remake3 works now with it
  1277. Revision 1.30 1998/05/27 19:45:03 peter
  1278. * symtable.pas splitted into includefiles
  1279. * symtable adapted for $ifdef NEWPPU
  1280. Revision 1.29 1998/05/25 17:11:39 pierre
  1281. * firstpasscount bug fixed
  1282. now all is already set correctly the first time
  1283. under EXTDEBUG try -gp to skip all other firstpasses
  1284. it works !!
  1285. * small bug fixes
  1286. - for smallsets with -dTESTSMALLSET
  1287. - some warnings removed (by correcting code !)
  1288. Revision 1.28 1998/05/23 01:21:07 peter
  1289. + aktasmmode, aktoptprocessor, aktoutputformat
  1290. + smartlink per module $SMARTLINK-/+ (like MMX) and moved to aktswitches
  1291. + $LIBNAME to set the library name where the unit will be put in
  1292. * splitted cgi386 a bit (codeseg to large for bp7)
  1293. * nasm, tasm works again. nasm moved to ag386nsm.pas
  1294. Revision 1.27 1998/05/20 09:42:33 pierre
  1295. + UseTokenInfo now default
  1296. * unit in interface uses and implementation uses gives error now
  1297. * only one error for unknown symbol (uses lastsymknown boolean)
  1298. the problem came from the label code !
  1299. + first inlined procedures and function work
  1300. (warning there might be allowed cases were the result is still wrong !!)
  1301. * UseBrower updated gives a global list of all position of all used symbols
  1302. with switch -gb
  1303. Revision 1.26 1998/05/12 10:46:59 peter
  1304. * moved printstatus to verb_def
  1305. + V_Normal which is between V_Error and V_Warning and doesn't have a
  1306. prefix like error: warning: and is included in V_Default
  1307. * fixed some messages
  1308. * first time parameter scan is only for -v and -T
  1309. - removed old style messages
  1310. Revision 1.25 1998/05/11 13:07:54 peter
  1311. + $ifdef NEWPPU for the new ppuformat
  1312. + $define GDB not longer required
  1313. * removed all warnings and stripped some log comments
  1314. * no findfirst/findnext anymore to remove smartlink *.o files
  1315. Revision 1.24 1998/05/08 09:21:20 michael
  1316. * Added missing -Fl message to messages file.
  1317. * Corrected mangling of file names when doing Linklib
  1318. * -Fl now actually WORKS.
  1319. * Librarysearchpath is now a field in linker object.
  1320. Revision 1.23 1998/05/06 15:04:20 pierre
  1321. + when trying to find source files of a ppufile
  1322. check the includepathlist for included files
  1323. the main file must still be in the same directory
  1324. Revision 1.22 1998/05/06 08:38:39 pierre
  1325. * better position info with UseTokenInfo
  1326. UseTokenInfo greatly simplified
  1327. + added check for changed tree after first time firstpass
  1328. (if we could remove all the cases were it happen
  1329. we could skip all firstpass if firstpasscount > 1)
  1330. Only with ExtDebug
  1331. Revision 1.21 1998/05/04 17:54:25 peter
  1332. + smartlinking works (only case jumptable left todo)
  1333. * redesign of systems.pas to support assemblers and linkers
  1334. + Unitname is now also in the PPU-file, increased version to 14
  1335. Revision 1.20 1998/05/01 07:43:53 florian
  1336. + basics for rtti implemented
  1337. + switch $m (generate rtti for published sections)
  1338. Revision 1.19 1998/04/30 15:59:40 pierre
  1339. * GDB works again better :
  1340. correct type info in one pass
  1341. + UseTokenInfo for better source position
  1342. * fixed one remaining bug in scanner for line counts
  1343. * several little fixes
  1344. Revision 1.18 1998/04/29 10:33:52 pierre
  1345. + added some code for ansistring (not complete nor working yet)
  1346. * corrected operator overloading
  1347. * corrected nasm output
  1348. + started inline procedures
  1349. + added starstarn : use ** for exponentiation (^ gave problems)
  1350. + started UseTokenInfo cond to get accurate positions
  1351. Revision 1.17 1998/04/27 23:10:28 peter
  1352. + new scanner
  1353. * $makelib -> if smartlink
  1354. * small filename fixes pmodule.setfilename
  1355. * moved import from files.pas -> import.pas
  1356. Revision 1.16 1998/04/27 15:45:20 peter
  1357. + -Xl for smartlink
  1358. + target_info.arext = .a
  1359. Revision 1.15 1998/04/22 21:06:50 florian
  1360. * last fixes before the release:
  1361. - veryyyy slow firstcall fixed
  1362. Revision 1.14 1998/04/21 13:48:09 michael
  1363. + Updated patch number
  1364. Revision 1.13 1998/04/21 10:16:47 peter
  1365. * patches from strasbourg
  1366. * objects is not used anymore in the fpc compiled version
  1367. Revision 1.12 1998/04/09 14:28:06 jonas
  1368. + basic k6 and 6x86 optimizing support (-O7 and -O8)
  1369. Revision 1.11 1998/04/08 16:58:02 pierre
  1370. * several bugfixes
  1371. ADD ADC and AND are also sign extended
  1372. nasm output OK (program still crashes at end
  1373. and creates wrong assembler files !!)
  1374. procsym types sym in tdef removed !!
  1375. Revision 1.10 1998/04/08 11:34:22 peter
  1376. * nasm works (linux only tested)
  1377. Revision 1.9 1998/04/07 21:37:30 peter
  1378. * fixed fixpath to also change / and \ slashes and better addpathtolist
  1379. Revision 1.8 1998/04/07 13:19:44 pierre
  1380. * bugfixes for reset_gdb_info
  1381. in MEM parsing for go32v2
  1382. better external symbol creation
  1383. support for rhgdb.exe (lowercase file names)
  1384. Revision 1.7 1998/04/06 16:19:46 peter
  1385. * fixed the -Up.. bug
  1386. }