globals.pas 44 KB

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