globals.pas 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 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 win32}
  25. windows,
  26. {$endif}
  27. {$ifdef linux}
  28. linux,
  29. {$endif}
  30. {$ifdef Delphi4}
  31. dmisc,
  32. sysutils,
  33. {$else}
  34. strings,dos,
  35. {$endif}
  36. {$ifdef TP}
  37. objects,
  38. {$endif}
  39. globtype,version,tokens,systems,cobjects;
  40. const
  41. {$ifdef linux}
  42. DirSep = '/';
  43. {$else}
  44. {$ifdef amiga}
  45. DirSep = '/';
  46. {$else}
  47. DirSep = '\';
  48. {$endif}
  49. {$endif}
  50. {$ifdef Splitheap}
  51. testsplit : boolean = false;
  52. {$endif Splitheap}
  53. delphimodeswitches : tmodeswitches=
  54. [m_delphi,m_tp,m_all,m_class,m_objpas,m_result,m_string_pchar,
  55. m_pointer_2_procedure,m_autoderef,m_tp_procvar,m_initfinal];
  56. fpcmodeswitches : tmodeswitches=
  57. [m_fpc,m_all,m_string_pchar,m_nested_comment,m_repeat_forward,
  58. m_cvar_support,m_initfinal,m_add_pointer];
  59. objfpcmodeswitches : tmodeswitches=
  60. [m_objfpc,m_fpc,m_all,m_class,m_objpas,m_result,m_string_pchar,m_nested_comment,
  61. m_repeat_forward,m_cvar_support,m_initfinal,m_add_pointer];
  62. tpmodeswitches : tmodeswitches=
  63. [m_tp,m_all,m_tp_procvar];
  64. gpcmodeswitches : tmodeswitches=
  65. [m_gpc,m_all];
  66. type
  67. TSearchPathList = object(TStringQueue)
  68. procedure AddPath(s:string;addfirst:boolean);
  69. procedure AddList(list:TSearchPathList;addfirst:boolean);
  70. function FindFile(const f : string;var b : boolean) : string;
  71. end;
  72. var
  73. { specified inputfile }
  74. inputdir : dirstr;
  75. inputfile : namestr;
  76. inputextension : extstr;
  77. { specified outputfile with -o parameter }
  78. outputfile : namestr;
  79. { specified with -FE or -FU }
  80. outputexedir : dirstr;
  81. outputunitdir : dirstr;
  82. { things specified with parameters }
  83. paralinkoptions,
  84. paradynamiclinker : string;
  85. parapreprocess : boolean;
  86. { directory where the utils can be found (options -FD) }
  87. utilsdirectory : dirstr;
  88. { some flags for global compiler switches }
  89. do_build,
  90. do_make : boolean;
  91. not_unit_proc : boolean;
  92. { path for searching units, different paths can be seperated by ; }
  93. exepath : dirstr; { Path to ppc }
  94. librarysearchpath,
  95. unitsearchpath,
  96. objectsearchpath,
  97. includesearchpath : TSearchPathList;
  98. { deffile }
  99. usewindowapi : boolean;
  100. description : string;
  101. dllversion : string;
  102. dllmajor,dllminor : word;
  103. { current position }
  104. token, { current token being parsed }
  105. idtoken : ttoken; { holds the token if the pattern is a known word }
  106. tokenpos, { last postion of the read token }
  107. aktfilepos : tfileposinfo; { current position }
  108. { type of currently parsed block }
  109. { isn't full implemented (FK) }
  110. block_type : tblock_type;
  111. in_args : boolean; { arguments must be checked especially }
  112. parsing_para_level : longint; { parameter level, used to convert
  113. proc calls to proc loads in firstcalln }
  114. { Must_be_valid : boolean; should the variable already have a value
  115. obsolete replace by set_varstate function }
  116. compile_level : word;
  117. make_ref : boolean;
  118. resolving_forward : boolean; { used to add forward reference as second ref }
  119. use_esp_stackframe : boolean; { to test for call with ESP as stack frame }
  120. inlining_procedure : boolean; { are we inlining a procedure }
  121. {$ifdef TP}
  122. use_big : boolean;
  123. {$endif}
  124. { commandline values }
  125. initdefines : tlinkedlist;
  126. initglobalswitches : tglobalswitches;
  127. initmoduleswitches : tmoduleswitches;
  128. initlocalswitches : tlocalswitches;
  129. initmodeswitches : tmodeswitches;
  130. initpackenum : longint;
  131. initpackrecords : tpackrecords;
  132. initoutputformat : tasm;
  133. initoptprocessor,
  134. initspecificoptprocessor : tprocessors;
  135. initasmmode : tasmmode;
  136. { current state values }
  137. aktglobalswitches : tglobalswitches;
  138. aktmoduleswitches : tmoduleswitches;
  139. aktlocalswitches : tlocalswitches;
  140. aktmodeswitches : tmodeswitches;
  141. aktpackenum : longint;
  142. aktmaxfpuregisters: longint;
  143. aktpackrecords : tpackrecords;
  144. aktoutputformat : tasm;
  145. aktoptprocessor,
  146. aktspecificoptprocessor : tprocessors;
  147. aktasmmode : tasmmode;
  148. { Memory sizes }
  149. heapsize,
  150. maxheapsize,
  151. stacksize : longint;
  152. {$Ifdef EXTDEBUG}
  153. total_of_firstpass,
  154. firstpass_several : longint;
  155. {$ifdef FPC}
  156. EntryMemUsed : longint;
  157. {$endif FPC}
  158. { parameter switches }
  159. debugstop,
  160. only_one_pass : boolean;
  161. {$EndIf EXTDEBUG}
  162. { windows application type }
  163. apptype : tapptype;
  164. const
  165. RelocSection : boolean = true;
  166. RelocSectionSetExplicitly : boolean = false;
  167. DLLsource : boolean = false;
  168. DLLImageBase : pstring = nil;
  169. UseDeffileForExport : boolean = true;
  170. ForceDeffileForExport : boolean = false;
  171. { used to set all registers used for each global function
  172. this should dramatically decrease the number of
  173. recompilations needed PM }
  174. simplify_ppu : boolean = false;
  175. { should we allow non static members ? }
  176. allow_only_static : boolean = false;
  177. Inside_asm_statement : boolean = false;
  178. { for error info in pp.pas }
  179. const
  180. parser_current_file : string = '';
  181. {$ifdef debug}
  182. { if the pointer don't point to the heap then write an error }
  183. function assigned(p : pointer) : boolean;
  184. {$endif}
  185. function min(a,b : longint) : longint;
  186. function max(a,b : longint) : longint;
  187. function align(i,a:longint):longint;
  188. procedure Replace(var s:string;s1:string;const s2:string);
  189. procedure ReplaceCase(var s:string;const s1,s2:string);
  190. function upper(const s : string) : string;
  191. function lower(const s : string) : string;
  192. function trimspace(const s:string):string;
  193. {$ifdef FPC}
  194. function tostru(i:cardinal) : string;
  195. {$else}
  196. function tostru(i:longint) : string;
  197. {$endif}
  198. procedure uppervar(var s : string);
  199. function tostr(i : longint) : string;
  200. function tostr_with_plus(i : longint) : string;
  201. procedure valint(S : string;var V : longint;var code : integer);
  202. function is_number(const s : string) : boolean;
  203. function ispowerof2(value : longint;var power : longint) : boolean;
  204. { enable ansistring comparison }
  205. function compareansistrings(p1,p2 : pchar;length1,length2 : longint) : longint;
  206. function concatansistrings(p1,p2 : pchar;length1,length2 : longint) : pchar;
  207. function bstoslash(const s : string) : string;
  208. procedure abstract;
  209. function getdatestr:string;
  210. function gettimestr:string;
  211. function filetimestring( t : longint) : string;
  212. procedure DefaultReplacements(var s:string);
  213. function path_absolute(const s : string) : boolean;
  214. Function PathExists ( F : String) : Boolean;
  215. Function FileExists ( Const F : String) : Boolean;
  216. Function RemoveFile(const f:string):boolean;
  217. Function RemoveDir(d:string):boolean;
  218. Function GetFileTime ( Var F : File) : Longint;
  219. Function GetNamedFileTime ( Const F : String) : Longint;
  220. Function SplitPath(const s:string):string;
  221. Function SplitFileName(const s:string):string;
  222. Function SplitName(const s:string):string;
  223. Function SplitExtension(Const HStr:String):String;
  224. Function AddExtension(Const HStr,ext:String):String;
  225. Function ForceExtension(Const HStr,ext:String):String;
  226. Function FixPath(s:string;allowdot:boolean):string;
  227. function FixFileName(const s:string):string;
  228. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  229. procedure SynchronizeFileTime(const fn1,fn2:string);
  230. function FindFile(const f : string;path : string;var b : boolean) : string;
  231. function FindExe(bin:string;var found:boolean):string;
  232. function GetShortName(const n:string):string;
  233. Procedure Shell(const command:string);
  234. function GetEnvPChar(const envname:string):pchar;
  235. procedure FreeEnvPChar(p:pchar);
  236. procedure InitGlobals;
  237. procedure DoneGlobals;
  238. implementation
  239. uses
  240. comphook;
  241. procedure abstract;
  242. begin
  243. do_internalerror(255);
  244. end;
  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. type
  299. ptrrec = record
  300. ofs,seg : word;
  301. end;
  302. var
  303. lp : longint;
  304. {$endif DPMI}
  305. {$endif FPC}
  306. begin
  307. {$ifdef FPC}
  308. { Assigned is used for procvar and
  309. stack stored temp records !! PM }
  310. (* if (p<>nil) {and
  311. ((p<heaporg) or
  312. (p>heapptr))} then
  313. do_internalerror(230); *)
  314. {$else}
  315. {$ifdef DPMI}
  316. assigned:=(p<>nil);
  317. exit;
  318. {$else DPMI}
  319. if p=nil then
  320. lp:=0
  321. else
  322. lp:=longint(ptrrec(p).seg)*16+longint(ptrrec(p).ofs);
  323. if (lp<>0) and
  324. ((lp<longint(seg(heaporg^))*16+longint(ofs(heaporg^))) or
  325. (lp>longint(seg(heapptr^))*16+longint(ofs(heapptr^)))) then
  326. do_internalerror(230);
  327. {$endif DPMI}
  328. {$endif FPC}
  329. assigned:=(p<>nil);
  330. end;
  331. {$endif}
  332. function min(a,b : longint) : longint;
  333. {
  334. return the minimal of a and b
  335. }
  336. begin
  337. if a>b then
  338. min:=b
  339. else
  340. min:=a;
  341. end;
  342. function max(a,b : longint) : longint;
  343. {
  344. return the maximum of a and b
  345. }
  346. begin
  347. if a<b then
  348. max:=b
  349. else
  350. max:=a;
  351. end;
  352. function align(i,a:longint):longint;
  353. {
  354. return value <i> aligned <a> boundary
  355. }
  356. begin
  357. align:=(i+a-1) and not(a-1);
  358. end;
  359. procedure Replace(var s:string;s1:string;const s2:string);
  360. var
  361. last,
  362. i : longint;
  363. begin
  364. s1:=upper(s1);
  365. last:=0;
  366. repeat
  367. i:=pos(s1,upper(s));
  368. if i=last then
  369. i:=0;
  370. if (i>0) then
  371. begin
  372. Delete(s,i,length(s1));
  373. Insert(s2,s,i);
  374. last:=i;
  375. end;
  376. until (i=0);
  377. end;
  378. procedure ReplaceCase(var s:string;const s1,s2:string);
  379. var
  380. last,
  381. i : longint;
  382. begin
  383. last:=0;
  384. repeat
  385. i:=pos(s1,s);
  386. if i=last then
  387. i:=0;
  388. if (i>0) then
  389. begin
  390. Delete(s,i,length(s1));
  391. Insert(s2,s,i);
  392. last:=i;
  393. end;
  394. until (i=0);
  395. end;
  396. function upper(const s : string) : string;
  397. {
  398. return uppercased string of s
  399. }
  400. var
  401. i : longint;
  402. begin
  403. for i:=1 to length(s) do
  404. if s[i] in ['a'..'z'] then
  405. upper[i]:=char(byte(s[i])-32)
  406. else
  407. upper[i]:=s[i];
  408. upper[0]:=s[0];
  409. end;
  410. function lower(const s : string) : string;
  411. {
  412. return lowercased string of s
  413. }
  414. var
  415. i : longint;
  416. begin
  417. for i:=1 to length(s) do
  418. if s[i] in ['A'..'Z'] then
  419. lower[i]:=char(byte(s[i])+32)
  420. else
  421. lower[i]:=s[i];
  422. lower[0]:=s[0];
  423. end;
  424. procedure uppervar(var s : string);
  425. {
  426. uppercase string s
  427. }
  428. var
  429. i : longint;
  430. begin
  431. for i:=1 to length(s) do
  432. if s[i] in ['a'..'z'] then
  433. s[i]:=char(byte(s[i])-32);
  434. end;
  435. {$ifdef FPC}
  436. function tostru(i:cardinal):string;
  437. {
  438. return string of value i, but for cardinals
  439. }
  440. var
  441. hs : string;
  442. begin
  443. str(i,hs);
  444. tostru:=hs;
  445. end;
  446. {$else FPC}
  447. function tostru(i:longint):string;
  448. begin
  449. tostru:=tostr(i);
  450. end;
  451. {$endif FPC}
  452. function trimspace(const s:string):string;
  453. {
  454. return s with all leading and ending spaces and tabs removed
  455. }
  456. var
  457. i,j : longint;
  458. begin
  459. i:=length(s);
  460. while (i>0) and (s[i] in [#9,' ']) do
  461. dec(i);
  462. j:=1;
  463. while (j<i) and (s[j] in [#9,' ']) do
  464. inc(j);
  465. trimspace:=Copy(s,j,i-j+1);
  466. end;
  467. function tostr(i : longint) : string;
  468. {
  469. return string of value i
  470. }
  471. var
  472. hs : string;
  473. begin
  474. str(i,hs);
  475. tostr:=hs;
  476. end;
  477. function tostr_with_plus(i : longint) : string;
  478. {
  479. return string of value i, but always include a + when i>=0
  480. }
  481. var
  482. hs : string;
  483. begin
  484. str(i,hs);
  485. if i>=0 then
  486. tostr_with_plus:='+'+hs
  487. else
  488. tostr_with_plus:=hs;
  489. end;
  490. procedure valint(S : string;var V : longint;var code : integer);
  491. {
  492. val() with support for octal, which is not supported under tp7
  493. }
  494. {$ifndef FPC}
  495. var
  496. vs : longint;
  497. c : byte;
  498. begin
  499. if s[1]='%' then
  500. begin
  501. vs:=0;
  502. longint(v):=0;
  503. for c:=2 to length(s) do
  504. begin
  505. if s[c]='0' then
  506. vs:=vs shl 1
  507. else
  508. if s[c]='1' then
  509. vs:=vs shl 1+1
  510. else
  511. begin
  512. code:=c;
  513. exit;
  514. end;
  515. end;
  516. code:=0;
  517. longint(v):=vs;
  518. end
  519. else
  520. system.val(S,V,code);
  521. end;
  522. {$else not FPC}
  523. begin
  524. system.val(S,V,code);
  525. end;
  526. {$endif not FPC}
  527. function is_number(const s : string) : boolean;
  528. {
  529. is string a correct number ?
  530. }
  531. var
  532. w : integer;
  533. l : longint;
  534. begin
  535. valint(s,l,w);
  536. is_number:=(w=0);
  537. end;
  538. function ispowerof2(value : longint;var power : longint) : boolean;
  539. {
  540. return if value is a power of 2. And if correct return the power
  541. }
  542. var
  543. hl : longint;
  544. i : longint;
  545. begin
  546. hl:=1;
  547. ispowerof2:=true;
  548. for i:=0 to 31 do
  549. begin
  550. if hl=value then
  551. begin
  552. power:=i;
  553. exit;
  554. end;
  555. hl:=hl shl 1;
  556. end;
  557. ispowerof2:=false;
  558. end;
  559. { enable ansistring comparison }
  560. { 0 means equal }
  561. { 1 means p1 > p2 }
  562. { -1 means p1 < p2 }
  563. function compareansistrings(p1,p2 : pchar;length1,length2 : longint) : longint;
  564. var
  565. i,j : longint;
  566. begin
  567. compareansistrings:=0;
  568. j:=min(length1,length2);
  569. i:=0;
  570. while (i<j) do
  571. begin
  572. if p1[i]>p2[i] then
  573. begin
  574. compareansistrings:=1;
  575. exit;
  576. end
  577. else
  578. if p1[i]<p2[i] then
  579. begin
  580. compareansistrings:=-1;
  581. exit;
  582. end;
  583. inc(i);
  584. end;
  585. if length1>length2 then
  586. compareansistrings:=1
  587. else
  588. if length1<length2 then
  589. compareansistrings:=-1;
  590. end;
  591. function concatansistrings(p1,p2 : pchar;length1,length2 : longint) : pchar;
  592. var
  593. p : pchar;
  594. begin
  595. getmem(p,length1+length2+1);
  596. move(p1[0],p[0],length1);
  597. move(p2[0],p[length1],length2+1);
  598. concatansistrings:=p;
  599. end;
  600. {****************************************************************************
  601. Time Handling
  602. ****************************************************************************}
  603. Function L0(l:longint):string;
  604. {
  605. return the string of value l, if l<10 then insert a zero, so
  606. the string is always at least 2 chars '01','02',etc
  607. }
  608. var
  609. s : string;
  610. begin
  611. Str(l,s);
  612. if l<10 then
  613. s:='0'+s;
  614. L0:=s;
  615. end;
  616. function gettimestr:string;
  617. {
  618. get the current time in a string HH:MM:SS
  619. }
  620. var
  621. hour,min,sec,hsec : word;
  622. begin
  623. {$ifdef delphi}
  624. dmisc.gettime(hour,min,sec,hsec);
  625. {$else delphi}
  626. dos.gettime(hour,min,sec,hsec);
  627. {$endif delphi}
  628. gettimestr:=L0(Hour)+':'+L0(min)+':'+L0(sec);
  629. end;
  630. function getdatestr:string;
  631. {
  632. get the current date in a string YY/MM/DD
  633. }
  634. var
  635. Year,Month,Day,Wday : Word;
  636. begin
  637. {$ifdef delphi}
  638. dmisc.getdate(year,month,day,wday);
  639. {$else}
  640. dos.getdate(year,month,day,wday);
  641. {$endif}
  642. getdatestr:=L0(Year)+'/'+L0(Month)+'/'+L0(Day);
  643. end;
  644. function filetimestring( t : longint) : string;
  645. {
  646. convert dos datetime t to a string YY/MM/DD HH:MM:SS
  647. }
  648. var
  649. {$ifndef linux}
  650. DT : DateTime;
  651. {$endif}
  652. Year,Month,Day,Hour,Min,Sec : Word;
  653. begin
  654. if t=-1 then
  655. begin
  656. FileTimeString:='Not Found';
  657. exit;
  658. end;
  659. {$ifndef linux}
  660. unpacktime(t,DT);
  661. Year:=dT.year;month:=dt.month;day:=dt.day;
  662. Hour:=dt.hour;min:=dt.min;sec:=dt.sec;
  663. {$else}
  664. EpochToLocal (t,year,month,day,hour,min,sec);
  665. {$endif}
  666. filetimestring:=L0(Year)+'/'+L0(Month)+'/'+L0(Day)+' '+L0(Hour)+':'+L0(min)+':'+L0(sec);
  667. end;
  668. {****************************************************************************
  669. Default Macro Handling
  670. ****************************************************************************}
  671. procedure DefaultReplacements(var s:string);
  672. begin
  673. { Replace some macro's }
  674. Replace(s,'$FPCVER',full_version_string);
  675. Replace(s,'$VERSION',full_version_string);
  676. Replace(s,'$FPCDATE',date_string);
  677. Replace(s,'$FPCTARGET',target_cpu_string);
  678. Replace(s,'$FPCCPU',target_cpu_string);
  679. Replace(s,'$TARGET',target_path);
  680. Replace(s,'$FPCOS',target_path);
  681. end;
  682. {****************************************************************************
  683. File Handling
  684. ****************************************************************************}
  685. function path_absolute(const s : string) : boolean;
  686. {
  687. is path s an absolute path?
  688. }
  689. begin
  690. path_absolute:=false;
  691. {$ifdef linux}
  692. if (length(s)>0) and (s[1]='/') then
  693. path_absolute:=true;
  694. {$else linux}
  695. {$ifdef amiga}
  696. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or (Pos(':',s) = length(s)) then
  697. path_absolute:=true;
  698. {$else}
  699. if ((length(s)>0) and ((s[1]='\') or (s[1]='/'))) or
  700. ((length(s)>2) and (s[2]=':') and ((s[3]='\') or (s[3]='/'))) then
  701. path_absolute:=true;
  702. {$endif amiga}
  703. {$endif linux}
  704. end;
  705. {$ifndef FPC}
  706. Procedure FindClose(var Info : SearchRec);
  707. Begin
  708. End;
  709. {$endif not FPC}
  710. {$ifdef delphi}
  711. Function FileExists ( Const F : String) : Boolean;
  712. begin
  713. FileExists:=sysutils.FileExists(f);
  714. end;
  715. {$else}
  716. Function FileExists ( Const F : String) : Boolean;
  717. Var
  718. {$ifdef linux}
  719. Info : Stat;
  720. {$else}
  721. Info : SearchRec;
  722. {$endif}
  723. begin
  724. {$ifdef linux}
  725. FileExists:=FStat(F,info);
  726. {$else}
  727. findfirst(F,readonly+archive+hidden,info);
  728. FileExists:=(doserror=0);
  729. findclose(Info);
  730. {$endif}
  731. end;
  732. Function PathExists ( F : String) : Boolean;
  733. Var
  734. Info : SearchRec;
  735. begin
  736. if F[Length(f)] in ['/','\'] then
  737. Delete(f,length(f),1);
  738. findfirst(F,readonly+archive+hidden+directory,info);
  739. PathExists:=(doserror=0) and ((info.attr and directory)=directory);
  740. findclose(Info);
  741. end;
  742. {$endif}
  743. Function RemoveFile(const f:string):boolean;
  744. var
  745. g : file;
  746. begin
  747. assign(g,f);
  748. {$I-}
  749. erase(g);
  750. {$I+}
  751. RemoveFile:=(ioresult=0);
  752. end;
  753. Function RemoveDir(d:string):boolean;
  754. begin
  755. if d[length(d)]=DirSep then
  756. Delete(d,length(d),1);
  757. {$I-}
  758. rmdir(d);
  759. {$I+}
  760. RemoveDir:=(ioresult=0);
  761. end;
  762. Function SplitPath(const s:string):string;
  763. var
  764. i : longint;
  765. begin
  766. i:=Length(s);
  767. while (i>0) and not(s[i] in ['/','\']) do
  768. dec(i);
  769. SplitPath:=Copy(s,1,i);
  770. end;
  771. Function SplitFileName(const s:string):string;
  772. var
  773. p : dirstr;
  774. n : namestr;
  775. e : extstr;
  776. begin
  777. FSplit(s,p,n,e);
  778. SplitFileName:=n+e;
  779. end;
  780. Function SplitName(const s:string):string;
  781. var
  782. i,j : longint;
  783. begin
  784. i:=Length(s);
  785. j:=Length(s);
  786. while (i>0) and not(s[i] in ['/','\']) do
  787. dec(i);
  788. while (j>0) and (s[j]<>'.') do
  789. dec(j);
  790. if j<=i then
  791. j:=255;
  792. SplitName:=Copy(s,i+1,j-(i+1));
  793. end;
  794. Function SplitExtension(Const HStr:String):String;
  795. var
  796. j : longint;
  797. begin
  798. j:=length(Hstr);
  799. while (j>0) and (Hstr[j]<>'.') do
  800. begin
  801. if hstr[j]=DirSep then
  802. j:=0
  803. else
  804. dec(j);
  805. end;
  806. if j=0 then
  807. j:=254;
  808. SplitExtension:=Copy(Hstr,j,255);
  809. end;
  810. Function AddExtension(Const HStr,ext:String):String;
  811. begin
  812. if (Ext<>'') and (SplitExtension(HStr)='') then
  813. AddExtension:=Hstr+Ext
  814. else
  815. AddExtension:=Hstr;
  816. end;
  817. Function ForceExtension(Const HStr,ext:String):String;
  818. var
  819. j : longint;
  820. begin
  821. j:=length(Hstr);
  822. while (j>0) and (Hstr[j]<>'.') do
  823. dec(j);
  824. if j=0 then
  825. j:=255;
  826. ForceExtension:=Copy(Hstr,1,j-1)+Ext;
  827. end;
  828. Function FixPath(s:string;allowdot:boolean):string;
  829. var
  830. i : longint;
  831. begin
  832. { Fix separator }
  833. for i:=1 to length(s) do
  834. if s[i] in ['/','\'] then
  835. s[i]:=DirSep;
  836. { Fix ending / }
  837. if (length(s)>0) and (s[length(s)]<>DirSep) and
  838. (s[length(s)]<>':') then
  839. s:=s+DirSep;
  840. { Remove ./ }
  841. if (not allowdot) and (s='.'+DirSep) then
  842. s:='';
  843. { return }
  844. FixPath:=s;
  845. end;
  846. function FixFileName(const s:string):string;
  847. var
  848. i : longint;
  849. {$ifdef Linux}
  850. NoPath : boolean;
  851. {$endif Linux}
  852. begin
  853. {$ifdef Linux}
  854. NoPath:=true;
  855. {$endif Linux}
  856. for i:=length(s) downto 1 do
  857. begin
  858. case s[i] of
  859. {$ifdef Linux}
  860. '/','\' : begin
  861. FixFileName[i]:='/';
  862. NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
  863. end;
  864. 'A'..'Z' : if NoPath then
  865. FixFileName[i]:=char(byte(s[i])+32)
  866. else
  867. FixFileName[i]:=s[i];
  868. {$else}
  869. '/' : FixFileName[i]:='\';
  870. 'A'..'Z' : FixFileName[i]:=char(byte(s[i])+32);
  871. {$endif}
  872. else
  873. FixFileName[i]:=s[i];
  874. end;
  875. end;
  876. {$ifndef TP}
  877. {$ifopt H+}
  878. SetLength(FixFileName,length(s));
  879. {$else}
  880. FixFileName[0]:=s[0];
  881. {$endif}
  882. {$else}
  883. FixFileName[0]:=s[0];
  884. {$endif}
  885. end;
  886. procedure SplitBinCmd(const s:string;var bstr,cstr:string);
  887. var
  888. i : longint;
  889. begin
  890. i:=pos(' ',s);
  891. if i>0 then
  892. begin
  893. bstr:=Copy(s,1,i-1);
  894. cstr:=Copy(s,i+1,length(s)-i);
  895. end
  896. else
  897. begin
  898. bstr:='';
  899. cstr:='';
  900. end;
  901. end;
  902. procedure TSearchPathList.AddPath(s:string;addfirst:boolean);
  903. var
  904. j : longint;
  905. hs,hsd,
  906. CurrentDir,
  907. CurrPath : string;
  908. dir : searchrec;
  909. hp : PStringQueueItem;
  910. procedure addcurrpath;
  911. begin
  912. if addfirst then
  913. begin
  914. Delete(currPath);
  915. Insert(currPath);
  916. end
  917. else
  918. begin
  919. { Check if already in path, then we don't add it }
  920. hp:=Find(currPath);
  921. if not assigned(hp) then
  922. Concat(currPath);
  923. end;
  924. end;
  925. begin
  926. if s='' then
  927. exit;
  928. { Support default macro's }
  929. DefaultReplacements(s);
  930. { get current dir }
  931. GetDir(0,CurrentDir);
  932. CurrentDir:=FixPath(CurrentDir,false);
  933. repeat
  934. j:=Pos(';',s);
  935. if j=0 then
  936. j:=255;
  937. {Get Pathname}
  938. CurrPath:=FixPath(Copy(s,1,j-1),false);
  939. if CurrPath='' then
  940. CurrPath:='.'+DirSep
  941. else
  942. begin
  943. CurrPath:=FixPath(FExpand(CurrPath),false);
  944. if (Copy(CurrPath,1,length(CurrentDir))=CurrentDir) then
  945. CurrPath:='.'+DirSep+Copy(CurrPath,length(CurrentDir)+1,255);
  946. end;
  947. System.Delete(s,1,j);
  948. if pos('*',currpath)>0 then
  949. begin
  950. if currpath[length(currpath)]=dirsep then
  951. hs:=Copy(currpath,1,length(CurrPath)-1)
  952. else
  953. hs:=currpath;
  954. hsd:=SplitPath(hs);
  955. findfirst(hs,directory,dir);
  956. while doserror=0 do
  957. begin
  958. if (dir.name<>'.') and
  959. (dir.name<>'..') and
  960. ((dir.attr and directory)<>0) then
  961. begin
  962. currpath:=hsd+dir.name+dirsep;
  963. hp:=Find(currPath);
  964. if not assigned(hp) then
  965. AddCurrPath;
  966. end;
  967. findnext(dir);
  968. end;
  969. {$ifdef Linux}
  970. FindClose(dir);
  971. {$endif}
  972. {$ifdef Win32}
  973. FindClose(dir);
  974. {$endif}
  975. end
  976. else
  977. addcurrpath;
  978. until (s='');
  979. end;
  980. procedure TSearchPathList.AddList(list:TSearchPathList;addfirst:boolean);
  981. var
  982. s : string;
  983. hl : TSearchPathList;
  984. hp,hp2 : PStringQueueItem;
  985. begin
  986. if list.empty then
  987. exit;
  988. { create temp and reverse the list }
  989. if addfirst then
  990. begin
  991. hl.Init;
  992. hp:=list.first;
  993. while assigned(hp) do
  994. begin
  995. hl.insert(hp^.data^);
  996. hp:=hp^.next;
  997. end;
  998. while not hl.empty do
  999. begin
  1000. s:=hl.Get;
  1001. Delete(s);
  1002. Insert(s);
  1003. end;
  1004. hl.done;
  1005. end
  1006. else
  1007. begin
  1008. hp:=list.first;
  1009. while assigned(hp) do
  1010. begin
  1011. hp2:=Find(hp^.data^);
  1012. { Check if already in path, then we don't add it }
  1013. if not assigned(hp2) then
  1014. Concat(hp^.data^);
  1015. hp:=hp^.next;
  1016. end;
  1017. end;
  1018. end;
  1019. function TSearchPathList.FindFile(const f : string;var b : boolean) : string;
  1020. Var
  1021. p : PStringQueueItem;
  1022. begin
  1023. FindFile:='';
  1024. b:=false;
  1025. p:=first;
  1026. while assigned(p) do
  1027. begin
  1028. If FileExists(p^.data^+f) then
  1029. begin
  1030. FindFile:=p^.data^;
  1031. b:=true;
  1032. exit;
  1033. end;
  1034. p:=p^.next;
  1035. end;
  1036. end;
  1037. Function GetFileTime ( Var F : File) : Longint;
  1038. Var
  1039. {$ifdef linux}
  1040. Info : Stat;
  1041. {$endif}
  1042. L : longint;
  1043. begin
  1044. {$ifdef linux}
  1045. FStat (F,Info);
  1046. L:=Info.Mtime;
  1047. {$else}
  1048. GetFTime(f,l);
  1049. {$endif}
  1050. GetFileTime:=L;
  1051. end;
  1052. Function GetNamedFileTime (Const F : String) : Longint;
  1053. var
  1054. L : Longint;
  1055. {$ifndef linux}
  1056. info : SearchRec;
  1057. {$else}
  1058. info : stat;
  1059. {$endif}
  1060. begin
  1061. l:=-1;
  1062. {$ifdef linux}
  1063. if FStat (F,Info) then
  1064. L:=info.mtime;
  1065. {$else}
  1066. {$ifdef delphi}
  1067. dmisc.FindFirst (F,archive+readonly+hidden,info);
  1068. {$else delphi}
  1069. FindFirst (F,archive+readonly+hidden,info);
  1070. {$endif delphi}
  1071. if DosError=0 then
  1072. l:=info.time;
  1073. {$ifdef Linux}
  1074. FindClose(info);
  1075. {$endif}
  1076. {$ifdef Win32}
  1077. FindClose(info);
  1078. {$endif}
  1079. {$endif}
  1080. GetNamedFileTime:=l;
  1081. end;
  1082. {Touch Assembler and object time to ppu time is there is a ppufilename}
  1083. procedure SynchronizeFileTime(const fn1,fn2:string);
  1084. var
  1085. f : file;
  1086. l : longint;
  1087. begin
  1088. Assign(f,fn1);
  1089. {$I-}
  1090. reset(f,1);
  1091. {$I+}
  1092. if ioresult=0 then
  1093. begin
  1094. getftime(f,l);
  1095. close(f);
  1096. assign(f,fn2);
  1097. {$I-}
  1098. reset(f,1);
  1099. {$I+}
  1100. if ioresult=0 then
  1101. begin
  1102. setftime(f,l);
  1103. close(f);
  1104. end;
  1105. end;
  1106. end;
  1107. function FindFile(const f : string;path : string;var b : boolean) : string;
  1108. Var
  1109. singlepathstring : string;
  1110. i : longint;
  1111. begin
  1112. {$ifdef linux}
  1113. for i:=1 to length(path) do
  1114. if path[i]=':' then
  1115. path[i]:=';';
  1116. {$endif}
  1117. b:=false;
  1118. FindFile:='';
  1119. repeat
  1120. i:=pos(';',path);
  1121. if i=0 then
  1122. i:=256;
  1123. singlepathstring:=FixPath(copy(path,1,i-1),false);
  1124. delete(path,1,i);
  1125. If FileExists (singlepathstring+f) then
  1126. begin
  1127. FindFile:=singlepathstring;
  1128. b:=true;
  1129. exit;
  1130. end;
  1131. until path='';
  1132. end;
  1133. function FindExe(bin:string;var found:boolean):string;
  1134. begin
  1135. bin:=FixFileName(bin)+source_os.exeext;
  1136. {$ifdef delphi}
  1137. FindExe:=FindFile(bin,'.;'+exepath+';'+dmisc.getenv('PATH'),found)+bin;
  1138. {$else delphi}
  1139. FindExe:=FindFile(bin,'.;'+exepath+';'+dos.getenv('PATH'),found)+bin;
  1140. {$endif delphi}
  1141. end;
  1142. function GetShortName(const n:string):string;
  1143. {$ifdef win32}
  1144. var
  1145. hs,hs2 : string;
  1146. i : longint;
  1147. {$endif}
  1148. {$ifdef go32v2}
  1149. var
  1150. hs : string;
  1151. {$endif}
  1152. begin
  1153. GetShortName:=n;
  1154. {$ifdef win32}
  1155. hs:=n+#0;
  1156. i:=Windows.GetShortPathName(@hs[1],@hs2[1],high(hs2));
  1157. if (i>0) and (i<=high(hs2)) then
  1158. begin
  1159. hs2[0]:=chr(strlen(@hs2[1]));
  1160. GetShortName:=hs2;
  1161. end;
  1162. {$endif}
  1163. {$ifdef go32v2}
  1164. hs:=n;
  1165. if Dos.GetShortName(hs) then
  1166. GetShortName:=hs;
  1167. {$endif}
  1168. end;
  1169. {****************************************************************************
  1170. OS Dependent things
  1171. ****************************************************************************}
  1172. function GetEnvPChar(const envname:string):pchar;
  1173. {$ifdef win32}
  1174. var
  1175. s : string;
  1176. i,len : longint;
  1177. hp,p,p2 : pchar;
  1178. {$endif}
  1179. begin
  1180. {$ifdef linux}
  1181. GetEnvPchar:=Linux.Getenv(envname);
  1182. {$define GETENVOK}
  1183. {$endif}
  1184. {$ifdef win32}
  1185. GetEnvPchar:=nil;
  1186. p:=GetEnvironmentStrings;
  1187. hp:=p;
  1188. while hp^<>#0 do
  1189. begin
  1190. s:=strpas(hp);
  1191. i:=pos('=',s);
  1192. len:=strlen(hp);
  1193. if upcase(copy(s,1,i-1))=upcase(envname) then
  1194. begin
  1195. GetMem(p2,len-length(envname));
  1196. Move(hp[i],p2^,len-length(envname));
  1197. GetEnvPchar:=p2;
  1198. break;
  1199. end;
  1200. { next string entry}
  1201. hp:=hp+len+1;
  1202. end;
  1203. FreeEnvironmentStrings(p);
  1204. {$define GETENVOK}
  1205. {$endif}
  1206. {$ifdef GETENVOK}
  1207. {$undef GETENVOK}
  1208. {$else}
  1209. GetEnvPchar:=StrPNew(Dos.Getenv(envname));
  1210. {$endif}
  1211. end;
  1212. procedure FreeEnvPChar(p:pchar);
  1213. begin
  1214. {$ifndef linux}
  1215. StrDispose(p);
  1216. {$endif}
  1217. end;
  1218. Procedure Shell(const command:string);
  1219. { This is already defined in the linux.ppu for linux, need for the *
  1220. expansion under linux }
  1221. {$ifdef linux}
  1222. begin
  1223. Linux.Shell(command);
  1224. end;
  1225. {$else}
  1226. var
  1227. comspec : string;
  1228. begin
  1229. comspec:=getenv('COMSPEC');
  1230. Exec(comspec,' /C '+command);
  1231. end;
  1232. {$endif}
  1233. {****************************************************************************
  1234. Init
  1235. ****************************************************************************}
  1236. procedure get_exepath;
  1237. var
  1238. hs1 : namestr;
  1239. hs2 : extstr;
  1240. begin
  1241. {$ifdef delphi}
  1242. exepath:=dmisc.getenv('PPC_EXEC_PATH');
  1243. {$else delphi}
  1244. exepath:=dos.getenv('PPC_EXEC_PATH');
  1245. {$endif delphi}
  1246. if exepath='' then
  1247. fsplit(FixFileName(paramstr(0)),exepath,hs1,hs2);
  1248. {$ifdef linux}
  1249. if exepath='' then
  1250. fsearch(hs1,dos.getenv('PATH'));
  1251. {$endif}
  1252. exepath:=FixPath(exepath,false);
  1253. end;
  1254. procedure DoneGlobals;
  1255. begin
  1256. initdefines.done;
  1257. if assigned(DLLImageBase) then
  1258. StringDispose(DLLImageBase);
  1259. RelocSection:=true;
  1260. RelocSectionSetExplicitly:=false;
  1261. DLLsource:=false;
  1262. UseDeffileForExport:=true;
  1263. librarysearchpath.Done;
  1264. unitsearchpath.Done;
  1265. objectsearchpath.Done;
  1266. includesearchpath.Done;
  1267. end;
  1268. procedure InitGlobals;
  1269. begin
  1270. { set global switches }
  1271. do_build:=false;
  1272. do_make:=true;
  1273. {$ifdef tp}
  1274. use_big:=false;
  1275. {$endif tp}
  1276. compile_level:=0;
  1277. { Output }
  1278. OutputFile:='';
  1279. OutputExeDir:='';
  1280. OutputUnitDir:='';
  1281. { Utils directory }
  1282. utilsdirectory:='';
  1283. { Search Paths }
  1284. librarysearchpath.Init;
  1285. unitsearchpath.Init;
  1286. includesearchpath.Init;
  1287. objectsearchpath.Init;
  1288. { Def file }
  1289. usewindowapi:=false;
  1290. description:='Compiled by FPC '+version_string+' - '+target_cpu_string;
  1291. dllversion:='';
  1292. { Init values }
  1293. initmodeswitches:=fpcmodeswitches;
  1294. initlocalswitches:=[cs_check_io];
  1295. initmoduleswitches:=[cs_extsyntax,cs_browser];
  1296. initglobalswitches:=[cs_check_unit_name,cs_link_static];
  1297. {$ifdef i386}
  1298. initoptprocessor:=Class386;
  1299. initspecificoptprocessor:=Class386;
  1300. initpackenum:=4;
  1301. initpackrecords:=packrecord_2;
  1302. initoutputformat:=target_asm.id;
  1303. initasmmode:=asmmode_i386_att;
  1304. {$else not i386}
  1305. {$ifdef m68k}
  1306. initoptprocessor:=MC68000;
  1307. include(initmoduleswitches,cs_fp_emulation);
  1308. initpackenum:=4;
  1309. initpackrecords:=packrecord_2;
  1310. initoutputformat:=as_m68k_as;
  1311. initasmmode:=asmmode_m68k_mot;
  1312. {$endif m68k}
  1313. {$endif i386}
  1314. initdefines.init;
  1315. { memory sizes, will be overriden by parameter or default for target
  1316. in options or init_parser }
  1317. stacksize:=0;
  1318. heapsize:=0;
  1319. maxheapsize:=0;
  1320. { compile state }
  1321. in_args:=false;
  1322. { must_be_valid:=true; obsolete PM }
  1323. not_unit_proc:=true;
  1324. apptype:=at_cui;
  1325. end;
  1326. begin
  1327. get_exepath;
  1328. {$ifdef EXTDEBUG}
  1329. {$ifdef FPC}
  1330. EntryMemUsed:=system.HeapSize-MemAvail;
  1331. {$endif FPC}
  1332. {$endif}
  1333. end.
  1334. {
  1335. $Log$
  1336. Revision 1.50 2000-01-26 14:31:03 marco
  1337. * $VERSION is now also substituted in -F paths (that have subst active)
  1338. Revision 1.49 2000/01/23 21:29:14 florian
  1339. * CMOV support in optimizer (in define USECMOV)
  1340. + start of support of exceptions in constructors
  1341. Revision 1.48 2000/01/23 16:36:37 peter
  1342. * better auto RTL dir detection
  1343. Revision 1.47 2000/01/20 00:23:03 pierre
  1344. * fix for GetShortName, now checks results from Win32
  1345. Revision 1.46 2000/01/07 01:14:27 peter
  1346. * updated copyright to 2000
  1347. Revision 1.45 2000/01/07 00:08:09 peter
  1348. * tp7 fix
  1349. Revision 1.44 2000/01/06 15:48:59 peter
  1350. * wildcard support for directory adding, this allows the use of units/*
  1351. in ppc386.cfg
  1352. Revision 1.43 2000/01/04 15:15:50 florian
  1353. + added compiler switch $maxfpuregisters
  1354. + fixed a small problem in secondvecn
  1355. Revision 1.42 1999/12/22 01:01:48 peter
  1356. - removed freelabel()
  1357. * added undefined label detection in internal assembler, this prevents
  1358. a lot of ld crashes and wrong .o files
  1359. * .o files aren't written anymore if errors have occured
  1360. * inlining of assembler labels is now correct
  1361. Revision 1.41 1999/12/20 23:23:28 pierre
  1362. + $description $version
  1363. Revision 1.40 1999/12/20 21:42:34 pierre
  1364. + dllversion global variable
  1365. * FPC_USE_CPREFIX code removed, not necessary anymore
  1366. as we use .edata direct writing by default now.
  1367. Revision 1.39 1999/12/08 10:40:00 pierre
  1368. + allow use of unit var in exports of DLL for win32
  1369. by using direct export writing by default instead of use of DEFFILE
  1370. that does not allow assembler labels that do not
  1371. start with an underscore.
  1372. Use -WD to force use of Deffile for Win32 DLL
  1373. Revision 1.38 1999/12/06 18:21:03 peter
  1374. * support !ENVVAR for long commandlines
  1375. * win32/go32v2 write short pathnames to link.res so c:\Program Files\ is
  1376. finally supported as installdir.
  1377. Revision 1.37 1999/12/02 17:34:34 peter
  1378. * preprocessor support. But it fails on the caret in type blocks
  1379. Revision 1.36 1999/11/18 15:34:45 pierre
  1380. * Notes/Hints for local syms changed to
  1381. Set_varstate function
  1382. Revision 1.35 1999/11/17 17:04:59 pierre
  1383. * Notes/hints changes
  1384. Revision 1.34 1999/11/15 17:42:41 pierre
  1385. * -g disables reloc section for win32
  1386. Revision 1.33 1999/11/12 11:03:50 peter
  1387. * searchpaths changed to stringqueue object
  1388. Revision 1.32 1999/11/09 23:34:46 pierre
  1389. + resolving_forward boolean used for references
  1390. Revision 1.31 1999/11/09 13:00:38 peter
  1391. * define FPC_DELPHI,FPC_OBJFPC,FPC_TP,FPC_GPC
  1392. * initial support for ansistring default with modes
  1393. Revision 1.30 1999/11/08 16:27:20 pierre
  1394. + Reset AnsiStrings to clean up memory
  1395. Revision 1.29 1999/11/06 14:34:20 peter
  1396. * truncated log to 20 revs
  1397. Revision 1.28 1999/11/04 10:55:31 peter
  1398. * TSearchPathList for the string type of the searchpaths, which is
  1399. ansistring under FPC/Delphi
  1400. Revision 1.27 1999/10/26 12:30:41 peter
  1401. * const parameter is now checked
  1402. * better and generic check if a node can be used for assigning
  1403. * export fixes
  1404. * procvar equal works now (it never had worked at least from 0.99.8)
  1405. * defcoll changed to linkedlist with pparaitem so it can easily be
  1406. walked both directions
  1407. Revision 1.26 1999/10/21 14:29:34 peter
  1408. * redesigned linker object
  1409. + library support for linux (only procedures can be exported)
  1410. Revision 1.25 1999/09/10 18:48:02 florian
  1411. * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
  1412. * most things for stored properties fixed
  1413. Revision 1.24 1999/09/08 16:05:31 peter
  1414. * pointer add/sub is now as expected and the same results as inc/dec
  1415. Revision 1.23 1999/09/07 15:11:00 pierre
  1416. * use do_internalerror insetead of runerror
  1417. Revision 1.22 1999/08/30 10:17:56 peter
  1418. * fixed crash in psub
  1419. * ansistringcompare fixed
  1420. * support for #$0b8
  1421. Revision 1.21 1999/08/27 10:45:00 pierre
  1422. options -Ca sets simply_ppu to true
  1423. Revision 1.20 1999/08/19 13:02:12 pierre
  1424. + label faillabel added for _FAIL support
  1425. Revision 1.19 1999/08/16 15:35:21 pierre
  1426. * fix for DLL relocation problems
  1427. * external bss vars had wrong stabs for pecoff
  1428. + -WB11000000 to specify default image base, allows to
  1429. load several DLLs with debugging info included
  1430. (relocatable DLL are stripped because the relocation
  1431. of the .Stab section is misplaced by ldw)
  1432. Revision 1.18 1999/08/11 17:26:32 peter
  1433. * tlinker object is now inherited for win32 and dos
  1434. * postprocessexecutable is now a method of tlinker
  1435. Revision 1.17 1999/08/10 12:51:14 pierre
  1436. * bind_win32_dll removed (Relocsection used instead)
  1437. * now relocsection is true by default ! (needs dlltool
  1438. for DLL generation)
  1439. Revision 1.16 1999/08/05 20:54:19 daniel
  1440. * Changes for new symtable.
  1441. Revision 1.15 1999/08/03 17:09:35 florian
  1442. * the alpha compiler can be compiled now
  1443. Revision 1.14 1999/07/23 16:05:19 peter
  1444. * alignment is now saved in the symtable
  1445. * C alignment added for records
  1446. * PPU version increased to solve .12 <-> .13 probs
  1447. Revision 1.13 1999/07/18 10:19:52 florian
  1448. * made it compilable with Dlephi 4 again
  1449. + fixed problem with large stack allocations on win32
  1450. Revision 1.12 1999/07/13 19:14:44 michael
  1451. + Defaultreplacemens now more logical
  1452. Revision 1.11 1999/07/10 10:26:18 peter
  1453. * merged
  1454. Revision 1.8.2.2 1999/07/10 10:03:04 peter
  1455. * fixed initialization/finalization in fpc mode
  1456. * allow $TARGET also in search paths
  1457. Revision 1.8.2.1 1999/07/07 07:53:21 michael
  1458. + Merged patches from florian
  1459. }