globals.pas 44 KB

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