globals.pas 47 KB

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