globals.pas 42 KB

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