globals.pas 44 KB

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