globals.pas 45 KB

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