globals.pas 42 KB

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