globals.pas 47 KB

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