globals.pas 48 KB

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