globals.pas 47 KB

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