globals.pas 41 KB

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