globals.pas 44 KB

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