globals.pas 44 KB

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