cobjects.pas 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. This module provides some basic objects
  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+,D+,F+}
  20. {$endif}
  21. {$I-}
  22. {$R-}{ necessary for crc calculation }
  23. unit cobjects;
  24. interface
  25. uses
  26. strings
  27. {$ifndef linux}
  28. ,dos
  29. {$else}
  30. ,linux
  31. {$endif}
  32. ;
  33. const hasharraysize = 253; {The size of a hasharray should be a prime
  34. number for better spreading of nodes in
  35. the array!! (DM)}
  36. type
  37. pstring = ^string;
  38. pfileposinfo = ^tfileposinfo;
  39. tfileposinfo = record
  40. line : longint;
  41. column : word;
  42. fileindex : word;
  43. end;
  44. { some help data types }
  45. pstringitem = ^tstringitem;
  46. tstringitem = record
  47. data : pstring;
  48. next : pstringitem;
  49. fileinfo : tfileposinfo; { pointer to tinputfile }
  50. end;
  51. plinkedlist_item = ^tlinkedlist_item;
  52. tlinkedlist_item = object
  53. next,previous : plinkedlist_item;
  54. { does nothing }
  55. constructor init;
  56. destructor done;virtual;
  57. end;
  58. pstring_item = ^tstring_item;
  59. tstring_item = object(tlinkedlist_item)
  60. str : pstring;
  61. constructor init(const s : string);
  62. destructor done;virtual;
  63. end;
  64. { this implements a double linked list }
  65. plinkedlist = ^tlinkedlist;
  66. tlinkedlist = object
  67. first,last : plinkedlist_item;
  68. constructor init;
  69. destructor done;
  70. { disposes the items of the list }
  71. procedure clear;
  72. { concats a new item at the end }
  73. procedure concat(p : plinkedlist_item);
  74. { inserts a new item at the begin }
  75. procedure insert(p : plinkedlist_item);
  76. { inserts another list at the begin and make this list empty }
  77. procedure insertlist(p : plinkedlist);
  78. { concats another list at the end and make this list empty }
  79. procedure concatlist(p : plinkedlist);
  80. { removes p from the list (p isn't disposed) }
  81. { it's not tested if p is in the list ! }
  82. procedure remove(p : plinkedlist_item);
  83. { is the linkedlist empty ? }
  84. function empty:boolean;
  85. end;
  86. { String Queue}
  87. PStringQueue=^TStringQueue;
  88. TStringQueue=object
  89. first,last : PStringItem;
  90. constructor Init;
  91. destructor Done;
  92. function Empty:boolean;
  93. function Get:string;
  94. procedure Insert(const s:string);
  95. procedure Concat(const s:string);
  96. procedure Clear;
  97. end;
  98. { string container }
  99. pstringcontainer = ^tstringcontainer;
  100. tstringcontainer = object
  101. root,
  102. last : pstringitem;
  103. doubles : boolean; { if this is set to true, doubles are allowed }
  104. constructor init;
  105. constructor init_no_double;
  106. destructor done;
  107. { true when the container is empty }
  108. function empty:boolean;
  109. { inserts a string }
  110. procedure insert(const s : string);
  111. procedure insert_with_tokeninfo(const s : string;const file_info : tfileposinfo);
  112. { gets a string }
  113. function get : string;
  114. function get_with_tokeninfo(var file_info : tfileposinfo) : string;
  115. { true if string is in the container }
  116. function find(const s:string):boolean;
  117. { deletes all strings }
  118. procedure clear;
  119. end;
  120. Pnamed_object=^Tnamed_object;
  121. Pdictionary=^Tdictionary;
  122. Pdictionaryhasharray=^Tdictionaryhasharray;
  123. Tdictionaryhasharray=array[0..hasharraysize-1] of Pnamed_object;
  124. Tcallback = procedure(p:Pnamed_object);
  125. Tdictionary=object
  126. root:Pnamed_object;
  127. hasharray:Pdictionaryhasharray;
  128. replace_existing : boolean;
  129. constructor init(usehash:boolean);
  130. procedure clear;virtual;
  131. procedure foreach(proc2call:Tcallback);
  132. function insert(obj:Pnamed_object):Pnamed_object;virtual;
  133. function search(const s:string):Pnamed_object;
  134. function speedsearch(const s:string;
  135. speedvalue:longint):Pnamed_object;virtual;
  136. destructor done;virtual;
  137. end;
  138. Tnamed_object=object
  139. _name:Pstring;
  140. left,right:Pnamed_object;
  141. speedvalue:longint;
  142. owner:Pdictionary;
  143. constructor init(const n:string);
  144. destructor done;virtual;
  145. function name:string;
  146. end;
  147. pdynamicarray = ^tdynamicarray;
  148. tdynamicarray = object
  149. posn,
  150. count,
  151. limit,
  152. elemlen,
  153. growcount : longint;
  154. data : pchar;
  155. constructor init(Aelemlen,Agrow:longint);
  156. destructor done;
  157. function size:longint;
  158. function usedsize:longint;
  159. procedure grow;
  160. procedure align(i:longint);
  161. procedure seek(i:longint);
  162. procedure write(var d;len:longint);
  163. procedure read(var d;len:longint);
  164. procedure writepos(pos:longint;var d;len:longint);
  165. procedure readpos(pos:longint;var d;len:longint);
  166. end;
  167. {$ifdef BUFFEREDFILE}
  168. { this is implemented to allow buffered binary I/O }
  169. pbufferedfile = ^tbufferedfile;
  170. tbufferedfile = object
  171. f : file;
  172. buf : pchar;
  173. bufsize,buflast,bufpos : longint;
  174. { 0 closed, 1 input, 2 output }
  175. iomode : byte;
  176. { true, if the compile should change the endian of the output }
  177. change_endian : boolean;
  178. { calcules a crc for the file, }
  179. { but it's assumed, that there no seek while do_crc is true }
  180. do_crc : boolean;
  181. crc : longint;
  182. { temporary closing feature }
  183. tempclosed : boolean;
  184. tempmode : byte;
  185. temppos : longint;
  186. { inits a buffer with the size bufsize which is assigned to }
  187. { the file filename }
  188. constructor init(const filename : string;_bufsize : longint);
  189. { closes the file, if needed, and releases the memory }
  190. destructor done;virtual;
  191. { opens the file for input, other accesses are rejected }
  192. function reset:boolean;
  193. { opens the file for output, other accesses are rejected }
  194. procedure rewrite;
  195. { reads or writes the buffer from or to disk }
  196. procedure flush;
  197. { writes a string to the file }
  198. { the string is written without a length byte }
  199. procedure write_string(const s : string);
  200. { writes a zero terminated string }
  201. procedure write_pchar(p : pchar);
  202. { write specific data types, takes care of }
  203. { byte order }
  204. procedure write_byte(b : byte);
  205. procedure write_word(w : word);
  206. procedure write_long(l : longint);
  207. procedure write_double(d : double);
  208. { writes any data }
  209. procedure write_data(var data;count : longint);
  210. { reads any data }
  211. procedure read_data(var data;bytes : longint;var count : longint);
  212. { closes the file and releases the buffer }
  213. procedure close;
  214. { temporary closing }
  215. procedure tempclose;
  216. procedure tempreopen;
  217. { goto the given position }
  218. procedure seek(l : longint);
  219. { installes an user defined buffer }
  220. { and releases the old one, but be }
  221. { careful, if the old buffer contains }
  222. { data, this data is lost }
  223. procedure setbuf(p : pchar;s : longint);
  224. { reads the file time stamp of the file, }
  225. { the file must be opened }
  226. function getftime : longint;
  227. { returns filesize }
  228. function getsize : longint;
  229. { returns the path }
  230. function getpath : string;
  231. { resets the crc }
  232. procedure clear_crc;
  233. { returns the crc }
  234. function getcrc : longint;
  235. end;
  236. {$endif BUFFEREDFILE}
  237. { releases the string p and assignes nil to p }
  238. { if p=nil then freemem isn't called }
  239. procedure stringdispose(var p : pstring);
  240. { idem for ansistrings }
  241. procedure ansistringdispose(var p : pchar;length : longint);
  242. { allocates mem for a copy of s, copies s to this mem and returns }
  243. { a pointer to this mem }
  244. function stringdup(const s : string) : pstring;
  245. { allocates memory for s and copies s as zero terminated string
  246. to that mem and returns a pointer to that mem }
  247. function strpnew(const s : string) : pchar;
  248. { makes a char lowercase, with spanish, french and german char set }
  249. function lowercase(c : char) : char;
  250. { makes zero terminated string to a pascal string }
  251. { the data in p is modified and p is returned }
  252. function pchar2pstring(p : pchar) : pstring;
  253. { ambivalent to pchar2pstring }
  254. function pstring2pchar(p : pstring) : pchar;
  255. implementation
  256. {$ifdef FPC}
  257. function getspeedvalue(const s : string) : longint;
  258. var
  259. p1,p2:^byte;
  260. begin
  261. p1:=@s;
  262. longint(p2):=longint(p1)+p1^+1;
  263. inc(longint(p1));
  264. getspeedvalue:=0;
  265. while p1<>p2 do
  266. begin
  267. inc(getspeedvalue,p1^);
  268. inc(longint(p1));
  269. end;
  270. end;
  271. {$else}
  272. function getspeedvalue(const s : string) : longint;
  273. type
  274. ptrrec=record
  275. ofs,seg:word;
  276. end;
  277. var
  278. l,w : longint;
  279. p1,p2 : ^byte;
  280. begin
  281. p1:=@s;
  282. ptrrec(p2).seg:=ptrrec(p1).seg;
  283. ptrrec(p2).ofs:=ptrrec(p1).ofs+p1^+1;
  284. inc(p1);
  285. l:=0;
  286. while p1<>p2 do
  287. begin
  288. l:=l+p1^;
  289. inc(p1);
  290. end;
  291. getspeedvalue:=l;
  292. end;
  293. {$endif}
  294. function pchar2pstring(p : pchar) : pstring;
  295. var
  296. w,i : longint;
  297. begin
  298. w:=strlen(p);
  299. for i:=w-1 downto 0 do
  300. p[i+1]:=p[i];
  301. p[0]:=chr(w);
  302. pchar2pstring:=pstring(p);
  303. end;
  304. function pstring2pchar(p : pstring) : pchar;
  305. var
  306. w,i : longint;
  307. begin
  308. w:=length(p^);
  309. for i:=1 to w do
  310. p^[i-1]:=p^[i];
  311. p^[w]:=#0;
  312. pstring2pchar:=pchar(p);
  313. end;
  314. function lowercase(c : char) : char;
  315. begin
  316. case c of
  317. #65..#90 : c := chr(ord (c) + 32);
  318. #154 : c:=#129; { german }
  319. #142 : c:=#132; { german }
  320. #153 : c:=#148; { german }
  321. #144 : c:=#130; { french }
  322. #128 : c:=#135; { french }
  323. #143 : c:=#134; { swedish/norge (?) }
  324. #165 : c:=#164; { spanish }
  325. #228 : c:=#229; { greek }
  326. #226 : c:=#231; { greek }
  327. #232 : c:=#227; { greek }
  328. end;
  329. lowercase := c;
  330. end;
  331. function strpnew(const s : string) : pchar;
  332. var
  333. p : pchar;
  334. begin
  335. getmem(p,length(s)+1);
  336. strpcopy(p,s);
  337. strpnew:=p;
  338. end;
  339. procedure stringdispose(var p : pstring);
  340. begin
  341. if assigned(p) then
  342. freemem(p,length(p^)+1);
  343. p:=nil;
  344. end;
  345. procedure ansistringdispose(var p : pchar;length : longint);
  346. begin
  347. if assigned(p) then
  348. freemem(p,length+1);
  349. p:=nil;
  350. end;
  351. function stringdup(const s : string) : pstring;
  352. var
  353. p : pstring;
  354. begin
  355. getmem(p,length(s)+1);
  356. p^:=s;
  357. stringdup:=p;
  358. end;
  359. {****************************************************************************
  360. TStringQueue
  361. ****************************************************************************}
  362. constructor TStringQueue.Init;
  363. begin
  364. first:=nil;
  365. end;
  366. function TStringQueue.Empty:boolean;
  367. begin
  368. Empty:=(first=nil);
  369. end;
  370. function TStringQueue.Get:string;
  371. var
  372. hp : pstringitem;
  373. begin
  374. if first=nil then
  375. begin
  376. Get:='';
  377. exit;
  378. end;
  379. Get:=first^.data^;
  380. stringdispose(first^.data);
  381. hp:=first;
  382. first:=first^.next;
  383. dispose(hp);
  384. end;
  385. procedure TStringQueue.Insert(const s:string);
  386. var
  387. hp : pstringitem;
  388. begin
  389. new(hp);
  390. hp^.next:=first;
  391. hp^.data:=stringdup(s);
  392. first:=hp;
  393. if last=nil then
  394. last:=hp;
  395. end;
  396. procedure TStringQueue.Concat(const s:string);
  397. var
  398. hp : pstringitem;
  399. begin
  400. new(hp);
  401. hp^.next:=nil;
  402. hp^.data:=stringdup(s);
  403. if first=nil then
  404. first:=hp
  405. else
  406. last^.next:=hp;
  407. last:=hp;
  408. end;
  409. procedure TStringQueue.Clear;
  410. var
  411. hp : pstringitem;
  412. begin
  413. while (first<>nil) do
  414. begin
  415. hp:=first;
  416. stringdispose(first^.data);
  417. first:=first^.next;
  418. dispose(hp);
  419. end;
  420. end;
  421. destructor TStringQueue.Done;
  422. begin
  423. Clear;
  424. end;
  425. {****************************************************************************
  426. TSTRINGCONTAINER
  427. ****************************************************************************}
  428. constructor tstringcontainer.init;
  429. begin
  430. root:=nil;
  431. last:=nil;
  432. doubles:=true;
  433. end;
  434. constructor tstringcontainer.init_no_double;
  435. begin
  436. root:=nil;
  437. last:=nil;
  438. doubles:=false;
  439. end;
  440. destructor tstringcontainer.done;
  441. begin
  442. clear;
  443. end;
  444. function tstringcontainer.empty:boolean;
  445. begin
  446. empty:=(root=nil);
  447. end;
  448. procedure tstringcontainer.insert(const s : string);
  449. var
  450. hp : pstringitem;
  451. begin
  452. if not(doubles) then
  453. begin
  454. hp:=root;
  455. while assigned(hp) do
  456. begin
  457. if hp^.data^=s then exit;
  458. hp:=hp^.next;
  459. end;
  460. end;
  461. new(hp);
  462. hp^.next:=nil;
  463. hp^.data:=stringdup(s);
  464. if root=nil then root:=hp
  465. else last^.next:=hp;
  466. last:=hp;
  467. end;
  468. procedure tstringcontainer.insert_with_tokeninfo(const s : string; const file_info : tfileposinfo);
  469. var
  470. hp : pstringitem;
  471. begin
  472. if not(doubles) then
  473. begin
  474. hp:=root;
  475. while assigned(hp) do
  476. begin
  477. if hp^.data^=s then exit;
  478. hp:=hp^.next;
  479. end;
  480. end;
  481. new(hp);
  482. hp^.next:=nil;
  483. hp^.data:=stringdup(s);
  484. hp^.fileinfo:=file_info;
  485. if root=nil then root:=hp
  486. else last^.next:=hp;
  487. last:=hp;
  488. end;
  489. procedure tstringcontainer.clear;
  490. var
  491. hp : pstringitem;
  492. begin
  493. hp:=root;
  494. while assigned(hp) do
  495. begin
  496. stringdispose(hp^.data);
  497. root:=hp^.next;
  498. dispose(hp);
  499. hp:=root;
  500. end;
  501. last:=nil;
  502. root:=nil;
  503. end;
  504. function tstringcontainer.get : string;
  505. var
  506. hp : pstringitem;
  507. begin
  508. if root=nil then
  509. get:=''
  510. else
  511. begin
  512. get:=root^.data^;
  513. hp:=root;
  514. root:=root^.next;
  515. stringdispose(hp^.data);
  516. dispose(hp);
  517. end;
  518. end;
  519. function tstringcontainer.get_with_tokeninfo(var file_info : tfileposinfo) : string;
  520. var
  521. hp : pstringitem;
  522. begin
  523. if root=nil then
  524. begin
  525. get_with_tokeninfo:='';
  526. file_info.fileindex:=0;
  527. file_info.line:=0;
  528. file_info.column:=0;
  529. end
  530. else
  531. begin
  532. get_with_tokeninfo:=root^.data^;
  533. hp:=root;
  534. root:=root^.next;
  535. stringdispose(hp^.data);
  536. file_info:=hp^.fileinfo;
  537. dispose(hp);
  538. end;
  539. end;
  540. function tstringcontainer.find(const s:string):boolean;
  541. var
  542. hp : pstringitem;
  543. begin
  544. find:=false;
  545. hp:=root;
  546. while assigned(hp) do
  547. begin
  548. if hp^.data^=s then
  549. begin
  550. find:=true;
  551. exit;
  552. end;
  553. hp:=hp^.next;
  554. end;
  555. end;
  556. {****************************************************************************
  557. TLINKEDLIST_ITEM
  558. ****************************************************************************}
  559. constructor tlinkedlist_item.init;
  560. begin
  561. previous:=nil;
  562. next:=nil;
  563. end;
  564. destructor tlinkedlist_item.done;
  565. begin
  566. end;
  567. {****************************************************************************
  568. TSTRING_ITEM
  569. ****************************************************************************}
  570. constructor tstring_item.init(const s : string);
  571. begin
  572. str:=stringdup(s);
  573. end;
  574. destructor tstring_item.done;
  575. begin
  576. stringdispose(str);
  577. inherited done;
  578. end;
  579. {****************************************************************************
  580. TLINKEDLIST
  581. ****************************************************************************}
  582. constructor tlinkedlist.init;
  583. begin
  584. first:=nil;
  585. last:=nil;
  586. end;
  587. destructor tlinkedlist.done;
  588. begin
  589. clear;
  590. end;
  591. procedure tlinkedlist.clear;
  592. var
  593. hp : plinkedlist_item;
  594. begin
  595. hp:=first;
  596. while assigned(hp) do
  597. begin
  598. first:=hp^.next;
  599. dispose(hp,done);
  600. hp:=first;
  601. end;
  602. end;
  603. procedure tlinkedlist.insertlist(p : plinkedlist);
  604. begin
  605. { empty list ? }
  606. if not(assigned(p^.first)) then
  607. exit;
  608. p^.last^.next:=first;
  609. { we have a double linked list }
  610. if assigned(first) then
  611. first^.previous:=p^.last;
  612. first:=p^.first;
  613. if not(assigned(last)) then
  614. last:=p^.last;
  615. { p becomes empty }
  616. p^.first:=nil;
  617. p^.last:=nil;
  618. end;
  619. procedure tlinkedlist.concat(p : plinkedlist_item);
  620. begin
  621. p^.previous:=nil;
  622. p^.next:=nil;
  623. if not(assigned(first)) then
  624. first:=p
  625. else
  626. begin
  627. last^.next:=p;
  628. p^.previous:=last;
  629. end;
  630. last:=p;
  631. end;
  632. procedure tlinkedlist.insert(p : plinkedlist_item);
  633. begin
  634. p^.previous:=nil;
  635. p^.next:=nil;
  636. if not(assigned(first)) then
  637. last:=p
  638. else
  639. begin
  640. first^.previous:=p;
  641. p^.next:=first;
  642. first:=p;
  643. end;
  644. first:=p;
  645. end;
  646. procedure tlinkedlist.remove(p : plinkedlist_item);
  647. begin
  648. if not(assigned(p)) then
  649. exit;
  650. if (first=p) and (last=p) then
  651. begin
  652. first:=nil;
  653. last:=nil;
  654. end
  655. else if first=p then
  656. begin
  657. first:=p^.next;
  658. if assigned(first) then
  659. first^.previous:=nil;
  660. end
  661. else if last=p then
  662. begin
  663. last:=last^.previous;
  664. if assigned(last) then
  665. last^.next:=nil;
  666. end
  667. else
  668. begin
  669. p^.previous^.next:=p^.next;
  670. p^.next^.previous:=p^.previous;
  671. end;
  672. p^.next:=nil;
  673. p^.previous:=nil;
  674. end;
  675. procedure tlinkedlist.concatlist(p : plinkedlist);
  676. begin
  677. if not(assigned(p^.first)) then
  678. exit;
  679. if not(assigned(first)) then
  680. first:=p^.first
  681. else
  682. begin
  683. last^.next:=p^.first;
  684. p^.first^.previous:=last;
  685. end;
  686. last:=p^.last;
  687. { make p empty }
  688. p^.last:=nil;
  689. p^.first:=nil;
  690. end;
  691. function tlinkedlist.empty:boolean;
  692. begin
  693. empty:=(first=nil);
  694. end;
  695. {****************************************************************************
  696. TNAMED_OBJECT
  697. ****************************************************************************}
  698. constructor Tnamed_object.init(const n:string);
  699. begin
  700. left:=nil;
  701. right:=nil;
  702. _name:=stringdup(n);
  703. speedvalue:=getspeedvalue(n);
  704. end;
  705. destructor Tnamed_object.done;
  706. begin
  707. stringdispose(_name);
  708. if assigned(left) then
  709. dispose(left,done);
  710. if assigned(right) then
  711. dispose(right,done);
  712. end;
  713. function Tnamed_object.name:string;
  714. begin
  715. name:=_name^;
  716. end;
  717. {****************************************************************************
  718. TDICTIONARY
  719. ****************************************************************************}
  720. constructor Tdictionary.init(usehash:boolean);
  721. begin
  722. root:=nil;
  723. hasharray:=nil;
  724. replace_existing:=false;
  725. if usehash then
  726. begin
  727. new(hasharray);
  728. fillchar(hasharray^,sizeof(hasharray^),0);
  729. end;
  730. end;
  731. procedure Tdictionary.clear;
  732. var w:longint;
  733. begin
  734. {remove no entry from a withsymtable as it is only a pointer to the
  735. recorddef or objectdef symtable }
  736. { remove all entry from a symbol table }
  737. if assigned(root) then
  738. dispose(root,done);
  739. if assigned(hasharray) then
  740. for w:=0 to hasharraysize-1 do
  741. if assigned(hasharray^[w]) then
  742. begin
  743. dispose(hasharray^[w],done);
  744. hasharray^[w]:=nil;
  745. end;
  746. end;
  747. procedure Tdictionary.foreach(proc2call:Tcallback);
  748. procedure a(p:Pnamed_object);
  749. { must be preorder, because it's used by reading in }
  750. { a PPU file }
  751. begin
  752. proc2call(p);
  753. if assigned(p^.left) then
  754. a(p^.left);
  755. if assigned(p^.right) then
  756. a(p^.right);
  757. end;
  758. var i:longint;
  759. begin
  760. if assigned(hasharray) then
  761. begin
  762. for i:=0 to hasharraysize-1 do
  763. if assigned(hasharray^[i]) then
  764. a(hasharray^[i]);
  765. end
  766. else
  767. if assigned(root) then
  768. a(root);
  769. end;
  770. function Tdictionary.insert(obj:Pnamed_object):Pnamed_object;
  771. function _insert(var osym:Pnamed_object):Pnamed_object;
  772. {To prevent TP from allocating temp space for temp strings, we allocate
  773. some temp strings manually. We can use two temp strings, plus a third
  774. one that TP adds, where TP alone needs five temp strings!. Storing
  775. these on the heap saves even more, totally 1016 bytes per recursion!}
  776. var s1,s2:^string;
  777. begin
  778. if osym=nil then
  779. begin
  780. osym:=obj;
  781. _insert:=osym;
  782. end
  783. { first check speedvalue, to allow a fast insert }
  784. else
  785. if osym^.speedvalue>obj^.speedvalue then
  786. _insert:=_insert(osym^.right)
  787. else
  788. if osym^.speedvalue<obj^.speedvalue then
  789. _insert:=_insert(osym^.left)
  790. else
  791. begin
  792. new(s1);
  793. new(s2);
  794. s1^:=osym^._name^;
  795. s2^:=obj^._name^;
  796. if s1^>s2^ then
  797. begin
  798. dispose(s2);
  799. dispose(s1);
  800. _insert:=_insert(osym^.right);
  801. end
  802. else
  803. if s1^<s2^ then
  804. begin
  805. dispose(s2);
  806. dispose(s1);
  807. _insert:=_insert(osym^.left);
  808. end
  809. else
  810. begin
  811. dispose(s2);
  812. dispose(s1);
  813. if replace_existing and
  814. assigned(osym) then
  815. begin
  816. obj^.left:=osym^.left;
  817. obj^.right:=osym^.right;
  818. osym:=obj;
  819. _insert:=obj;
  820. end
  821. else
  822. _insert:=osym;
  823. end;
  824. end;
  825. end;
  826. begin
  827. obj^.owner:=@self;
  828. obj^.speedvalue:=getspeedvalue(obj^._name^);
  829. if assigned(hasharray) then
  830. insert:=_insert(hasharray^[obj^.speedvalue mod hasharraysize])
  831. else
  832. insert:=_insert(root);
  833. end;
  834. function Tdictionary.search(const s:string):Pnamed_object;
  835. begin
  836. search:=speedsearch(s,getspeedvalue(s));
  837. end;
  838. function Tdictionary.speedsearch(const s:string;
  839. speedvalue:longint):Pnamed_object;
  840. var hp:Pnamed_object;
  841. begin
  842. if assigned(hasharray) then
  843. hp:=hasharray^[speedvalue mod hasharraysize]
  844. else
  845. hp:=root;
  846. while assigned(hp) do
  847. begin
  848. if speedvalue>hp^.speedvalue then
  849. hp:=hp^.left
  850. else
  851. if speedvalue<hp^.speedvalue then
  852. hp:=hp^.right
  853. else
  854. begin
  855. if (hp^._name^=s) then
  856. begin
  857. speedsearch:=hp;
  858. exit;
  859. end
  860. else
  861. if s>hp^._name^ then
  862. hp:=hp^.left
  863. else
  864. hp:=hp^.right;
  865. end;
  866. end;
  867. speedsearch:=nil;
  868. end;
  869. destructor Tdictionary.done;
  870. begin
  871. clear;
  872. if assigned(hasharray) then
  873. dispose(hasharray);
  874. end;
  875. {****************************************************************************
  876. tdynamicarray
  877. ****************************************************************************}
  878. constructor tdynamicarray.init(Aelemlen,Agrow:longint);
  879. begin
  880. posn:=0;
  881. count:=0;
  882. limit:=0;
  883. data:=nil;
  884. elemlen:=Aelemlen;
  885. growcount:=Agrow;
  886. grow;
  887. end;
  888. function tdynamicarray.size:longint;
  889. begin
  890. size:=limit*elemlen;
  891. end;
  892. function tdynamicarray.usedsize:longint;
  893. begin
  894. usedsize:=count*elemlen;
  895. end;
  896. procedure tdynamicarray.grow;
  897. var
  898. osize : longint;
  899. odata : pchar;
  900. begin
  901. osize:=size;
  902. odata:=data;
  903. inc(limit,growcount);
  904. getmem(data,size);
  905. if assigned(odata) then
  906. begin
  907. move(odata^,data^,osize);
  908. freemem(odata,osize);
  909. end;
  910. fillchar(data[osize],growcount*elemlen,0);
  911. end;
  912. procedure tdynamicarray.align(i:longint);
  913. var
  914. j : longint;
  915. begin
  916. j:=(posn*elemlen mod i);
  917. if j<>0 then
  918. begin
  919. j:=i-j;
  920. while limit<(posn+j) do
  921. grow;
  922. inc(posn,j);
  923. if (posn>count) then
  924. count:=posn;
  925. end;
  926. end;
  927. procedure tdynamicarray.seek(i:longint);
  928. begin
  929. while limit<i do
  930. grow;
  931. posn:=i;
  932. if (posn>count) then
  933. count:=posn;
  934. end;
  935. procedure tdynamicarray.write(var d;len:longint);
  936. begin
  937. while limit<(posn+len) do
  938. grow;
  939. move(d,data[posn*elemlen],len*elemlen);
  940. inc(posn,len);
  941. if (posn>count) then
  942. count:=posn;
  943. end;
  944. procedure tdynamicarray.read(var d;len:longint);
  945. begin
  946. move(data[posn*elemlen],d,len*elemlen);
  947. inc(posn,len);
  948. if (posn>count) then
  949. count:=posn;
  950. end;
  951. procedure tdynamicarray.writepos(pos:longint;var d;len:longint);
  952. begin
  953. while limit<(pos+len) do
  954. grow;
  955. move(d,data[pos*elemlen],len*elemlen);
  956. posn:=pos+len;
  957. if (posn>count) then
  958. count:=posn;
  959. end;
  960. procedure tdynamicarray.readpos(pos:longint;var d;len:longint);
  961. begin
  962. while limit<(pos+len) do
  963. grow;
  964. move(data[pos*elemlen],d,len*elemlen);
  965. posn:=pos+len;
  966. if (posn>count) then
  967. count:=posn;
  968. end;
  969. destructor tdynamicarray.done;
  970. begin
  971. if assigned(data) then
  972. freemem(data,size);
  973. end;
  974. {$ifdef BUFFEREDFILE}
  975. {****************************************************************************
  976. TBUFFEREDFILE
  977. ****************************************************************************}
  978. Const
  979. crcseed = $ffffffff;
  980. crctable : array[0..255] of longint = (
  981. $00000000,$77073096,$ee0e612c,$990951ba,$076dc419,$706af48f,
  982. $e963a535,$9e6495a3,$0edb8832,$79dcb8a4,$e0d5e91e,$97d2d988,
  983. $09b64c2b,$7eb17cbd,$e7b82d07,$90bf1d91,$1db71064,$6ab020f2,
  984. $f3b97148,$84be41de,$1adad47d,$6ddde4eb,$f4d4b551,$83d385c7,
  985. $136c9856,$646ba8c0,$fd62f97a,$8a65c9ec,$14015c4f,$63066cd9,
  986. $fa0f3d63,$8d080df5,$3b6e20c8,$4c69105e,$d56041e4,$a2677172,
  987. $3c03e4d1,$4b04d447,$d20d85fd,$a50ab56b,$35b5a8fa,$42b2986c,
  988. $dbbbc9d6,$acbcf940,$32d86ce3,$45df5c75,$dcd60dcf,$abd13d59,
  989. $26d930ac,$51de003a,$c8d75180,$bfd06116,$21b4f4b5,$56b3c423,
  990. $cfba9599,$b8bda50f,$2802b89e,$5f058808,$c60cd9b2,$b10be924,
  991. $2f6f7c87,$58684c11,$c1611dab,$b6662d3d,$76dc4190,$01db7106,
  992. $98d220bc,$efd5102a,$71b18589,$06b6b51f,$9fbfe4a5,$e8b8d433,
  993. $7807c9a2,$0f00f934,$9609a88e,$e10e9818,$7f6a0dbb,$086d3d2d,
  994. $91646c97,$e6635c01,$6b6b51f4,$1c6c6162,$856530d8,$f262004e,
  995. $6c0695ed,$1b01a57b,$8208f4c1,$f50fc457,$65b0d9c6,$12b7e950,
  996. $8bbeb8ea,$fcb9887c,$62dd1ddf,$15da2d49,$8cd37cf3,$fbd44c65,
  997. $4db26158,$3ab551ce,$a3bc0074,$d4bb30e2,$4adfa541,$3dd895d7,
  998. $a4d1c46d,$d3d6f4fb,$4369e96a,$346ed9fc,$ad678846,$da60b8d0,
  999. $44042d73,$33031de5,$aa0a4c5f,$dd0d7cc9,$5005713c,$270241aa,
  1000. $be0b1010,$c90c2086,$5768b525,$206f85b3,$b966d409,$ce61e49f,
  1001. $5edef90e,$29d9c998,$b0d09822,$c7d7a8b4,$59b33d17,$2eb40d81,
  1002. $b7bd5c3b,$c0ba6cad,$edb88320,$9abfb3b6,$03b6e20c,$74b1d29a,
  1003. $ead54739,$9dd277af,$04db2615,$73dc1683,$e3630b12,$94643b84,
  1004. $0d6d6a3e,$7a6a5aa8,$e40ecf0b,$9309ff9d,$0a00ae27,$7d079eb1,
  1005. $f00f9344,$8708a3d2,$1e01f268,$6906c2fe,$f762575d,$806567cb,
  1006. $196c3671,$6e6b06e7,$fed41b76,$89d32be0,$10da7a5a,$67dd4acc,
  1007. $f9b9df6f,$8ebeeff9,$17b7be43,$60b08ed5,$d6d6a3e8,$a1d1937e,
  1008. $38d8c2c4,$4fdff252,$d1bb67f1,$a6bc5767,$3fb506dd,$48b2364b,
  1009. $d80d2bda,$af0a1b4c,$36034af6,$41047a60,$df60efc3,$a867df55,
  1010. $316e8eef,$4669be79,$cb61b38c,$bc66831a,$256fd2a0,$5268e236,
  1011. $cc0c7795,$bb0b4703,$220216b9,$5505262f,$c5ba3bbe,$b2bd0b28,
  1012. $2bb45a92,$5cb36a04,$c2d7ffa7,$b5d0cf31,$2cd99e8b,$5bdeae1d,
  1013. $9b64c2b0,$ec63f226,$756aa39c,$026d930a,$9c0906a9,$eb0e363f,
  1014. $72076785,$05005713,$95bf4a82,$e2b87a14,$7bb12bae,$0cb61b38,
  1015. $92d28e9b,$e5d5be0d,$7cdcefb7,$0bdbdf21,$86d3d2d4,$f1d4e242,
  1016. $68ddb3f8,$1fda836e,$81be16cd,$f6b9265b,$6fb077e1,$18b74777,
  1017. $88085ae6,$ff0f6a70,$66063bca,$11010b5c,$8f659eff,$f862ae69,
  1018. $616bffd3,$166ccf45,$a00ae278,$d70dd2ee,$4e048354,$3903b3c2,
  1019. $a7672661,$d06016f7,$4969474d,$3e6e77db,$aed16a4a,$d9d65adc,
  1020. $40df0b66,$37d83bf0,$a9bcae53,$debb9ec5,$47b2cf7f,$30b5ffe9,
  1021. $bdbdf21c,$cabac28a,$53b39330,$24b4a3a6,$bad03605,$cdd70693,
  1022. $54de5729,$23d967bf,$b3667a2e,$c4614ab8,$5d681b02,$2a6f2b94,
  1023. $b40bbe37,$c30c8ea1,$5a05df1b,$2d02ef8d);
  1024. constructor tbufferedfile.init(const filename : string;_bufsize : longint);
  1025. begin
  1026. assign(f,filename);
  1027. bufsize:=_bufsize;
  1028. bufpos:=0;
  1029. buflast:=0;
  1030. do_crc:=false;
  1031. iomode:=0;
  1032. tempclosed:=false;
  1033. change_endian:=false;
  1034. clear_crc;
  1035. end;
  1036. destructor tbufferedfile.done;
  1037. begin
  1038. close;
  1039. end;
  1040. procedure tbufferedfile.clear_crc;
  1041. begin
  1042. crc:=crcseed;
  1043. end;
  1044. procedure tbufferedfile.setbuf(p : pchar;s : longint);
  1045. begin
  1046. flush;
  1047. freemem(buf,bufsize);
  1048. bufsize:=s;
  1049. buf:=p;
  1050. end;
  1051. function tbufferedfile.reset:boolean;
  1052. var
  1053. ofm : byte;
  1054. begin
  1055. ofm:=filemode;
  1056. iomode:=1;
  1057. getmem(buf,bufsize);
  1058. filemode:=0;
  1059. {$I-}
  1060. system.reset(f,1);
  1061. {$I+}
  1062. reset:=(ioresult=0);
  1063. filemode:=ofm;
  1064. end;
  1065. procedure tbufferedfile.rewrite;
  1066. begin
  1067. iomode:=2;
  1068. getmem(buf,bufsize);
  1069. system.rewrite(f,1);
  1070. end;
  1071. procedure tbufferedfile.flush;
  1072. var
  1073. {$ifdef FPC}
  1074. count : longint;
  1075. {$else}
  1076. count : integer;
  1077. {$endif}
  1078. begin
  1079. if iomode=2 then
  1080. begin
  1081. if bufpos=0 then
  1082. exit;
  1083. blockwrite(f,buf^,bufpos)
  1084. end
  1085. else if iomode=1 then
  1086. if buflast=bufpos then
  1087. begin
  1088. blockread(f,buf^,bufsize,count);
  1089. buflast:=count;
  1090. end;
  1091. bufpos:=0;
  1092. end;
  1093. function tbufferedfile.getftime : longint;
  1094. var
  1095. l : longint;
  1096. {$ifdef linux}
  1097. Info : Stat;
  1098. {$endif}
  1099. begin
  1100. {$ifndef linux}
  1101. { this only works if the file is open !! }
  1102. dos.getftime(f,l);
  1103. {$else}
  1104. Fstat(f,Info);
  1105. l:=info.mtime;
  1106. {$endif}
  1107. getftime:=l;
  1108. end;
  1109. function tbufferedfile.getsize : longint;
  1110. begin
  1111. getsize:=filesize(f);
  1112. end;
  1113. procedure tbufferedfile.seek(l : longint);
  1114. begin
  1115. if iomode=2 then
  1116. begin
  1117. flush;
  1118. system.seek(f,l);
  1119. end
  1120. else if iomode=1 then
  1121. begin
  1122. { forces a reload }
  1123. bufpos:=buflast;
  1124. system.seek(f,l);
  1125. flush;
  1126. end;
  1127. end;
  1128. type
  1129. {$ifdef tp}
  1130. bytearray1 = array [1..65535] of byte;
  1131. {$else}
  1132. bytearray1 = array [1..10000000] of byte;
  1133. {$endif}
  1134. procedure tbufferedfile.read_data(var data;bytes : longint;var count : longint);
  1135. var
  1136. p : pchar;
  1137. c,i : longint;
  1138. begin
  1139. p:=pchar(@data);
  1140. count:=0;
  1141. while bytes-count>0 do
  1142. begin
  1143. if bytes-count>buflast-bufpos then
  1144. begin
  1145. move((buf+bufpos)^,(p+count)^,buflast-bufpos);
  1146. inc(count,buflast-bufpos);
  1147. bufpos:=buflast;
  1148. flush;
  1149. { can't we read anything ? }
  1150. if bufpos=buflast then
  1151. break;
  1152. end
  1153. else
  1154. begin
  1155. move((buf+bufpos)^,(p+count)^,bytes-count);
  1156. inc(bufpos,bytes-count);
  1157. count:=bytes;
  1158. break;
  1159. end;
  1160. end;
  1161. if do_crc then
  1162. begin
  1163. c:=crc;
  1164. for i:=1 to bytes do
  1165. c:=(c shr 8) xor crctable[byte(c) xor (bytearray1(data)[i])];
  1166. crc:=c;
  1167. end;
  1168. end;
  1169. procedure tbufferedfile.write_data(var data;count : longint);
  1170. var
  1171. c,i : longint;
  1172. begin
  1173. if bufpos+count>bufsize then
  1174. flush;
  1175. move(data,(buf+bufpos)^,count);
  1176. inc(bufpos,count);
  1177. if do_crc then
  1178. begin
  1179. c:=crc;
  1180. for i:=1 to count do
  1181. c:=(c shr 8) xor crctable[byte(c) xor (bytearray1(data)[i])];
  1182. crc:=c;
  1183. end;
  1184. end;
  1185. function tbufferedfile.getcrc : longint;
  1186. begin
  1187. getcrc:=crc xor crcseed;
  1188. end;
  1189. procedure tbufferedfile.write_string(const s : string);
  1190. begin
  1191. if bufpos+length(s)>bufsize then
  1192. flush;
  1193. { why is there not CRC here ??? }
  1194. move(s[1],(buf+bufpos)^,length(s));
  1195. inc(bufpos,length(s));
  1196. { should be
  1197. write_data(s[1],length(s)); }
  1198. end;
  1199. procedure tbufferedfile.write_pchar(p : pchar);
  1200. var
  1201. l : longint;
  1202. begin
  1203. l:=strlen(p);
  1204. if l>=bufsize then
  1205. runerror(222);
  1206. { why is there not CRC here ???}
  1207. if bufpos+l>bufsize then
  1208. flush;
  1209. move(p^,(buf+bufpos)^,l);
  1210. inc(bufpos,l);
  1211. { should be
  1212. write_data(p^,l); }
  1213. end;
  1214. procedure tbufferedfile.write_byte(b : byte);
  1215. begin
  1216. write_data(b,sizeof(byte));
  1217. end;
  1218. procedure tbufferedfile.write_long(l : longint);
  1219. var
  1220. w1,w2 : word;
  1221. begin
  1222. if change_endian then
  1223. begin
  1224. w1:=l and $ffff;
  1225. w2:=l shr 16;
  1226. l:=swap(w2)+(longint(swap(w1)) shl 16);
  1227. write_data(l,sizeof(longint))
  1228. end
  1229. else
  1230. write_data(l,sizeof(longint))
  1231. end;
  1232. procedure tbufferedfile.write_word(w : word);
  1233. begin
  1234. if change_endian then
  1235. begin
  1236. w:=swap(w);
  1237. write_data(w,sizeof(word))
  1238. end
  1239. else
  1240. write_data(w,sizeof(word));
  1241. end;
  1242. procedure tbufferedfile.write_double(d : double);
  1243. begin
  1244. write_data(d,sizeof(double));
  1245. end;
  1246. function tbufferedfile.getpath : string;
  1247. begin
  1248. {$ifdef dummy}
  1249. getpath:=strpas(filerec(f).name);
  1250. {$endif}
  1251. getpath:='';
  1252. end;
  1253. procedure tbufferedfile.close;
  1254. begin
  1255. if iomode<>0 then
  1256. begin
  1257. flush;
  1258. system.close(f);
  1259. freemem(buf,bufsize);
  1260. buf:=nil;
  1261. iomode:=0;
  1262. end;
  1263. end;
  1264. procedure tbufferedfile.tempclose;
  1265. begin
  1266. if iomode<>0 then
  1267. begin
  1268. temppos:=system.filepos(f);
  1269. tempmode:=iomode;
  1270. tempclosed:=true;
  1271. system.close(f);
  1272. iomode:=0;
  1273. end
  1274. else
  1275. tempclosed:=false;
  1276. end;
  1277. procedure tbufferedfile.tempreopen;
  1278. var
  1279. ofm : byte;
  1280. begin
  1281. if tempclosed then
  1282. begin
  1283. case tempmode of
  1284. 1 : begin
  1285. ofm:=filemode;
  1286. iomode:=1;
  1287. filemode:=0;
  1288. system.reset(f,1);
  1289. filemode:=ofm;
  1290. end;
  1291. 2 : begin
  1292. iomode:=2;
  1293. system.rewrite(f,1);
  1294. end;
  1295. end;
  1296. system.seek(f,temppos);
  1297. tempclosed:=false;
  1298. end;
  1299. end;
  1300. {$endif BUFFEREDFILE}
  1301. end.
  1302. {
  1303. $Log$
  1304. Revision 1.21 1999-03-19 16:35:29 pierre
  1305. * Tnamed_object done also removed left and right
  1306. Revision 1.20 1999/03/18 20:30:45 peter
  1307. + .a writer
  1308. Revision 1.19 1999/03/01 13:32:00 pierre
  1309. * external used before implemented problem fixed
  1310. Revision 1.18 1999/02/24 00:59:13 peter
  1311. * small updates for ag386bin
  1312. Revision 1.17 1999/01/19 11:00:33 daniel
  1313. + Tdictionary object: Tsymtable will become object(TTdictionary) in the
  1314. future
  1315. + Tnamed_item object: Tsym will become object(Tnamed_item) in the future
  1316. Revision 1.16 1998/11/04 10:11:37 peter
  1317. * ansistring fixes
  1318. Revision 1.15 1998/10/19 18:04:40 peter
  1319. + tstringcontainer.init_no_doubles
  1320. Revision 1.14 1998/09/18 16:03:37 florian
  1321. * some changes to compile with Delphi
  1322. Revision 1.13 1998/08/12 19:28:16 peter
  1323. * better libc support
  1324. Revision 1.12 1998/07/14 14:46:47 peter
  1325. * released NEWINPUT
  1326. Revision 1.11 1998/07/07 11:19:54 peter
  1327. + NEWINPUT for a better inputfile and scanner object
  1328. Revision 1.10 1998/07/01 15:26:59 peter
  1329. * better bufferfile.reset error handling
  1330. Revision 1.9 1998/06/03 23:40:37 peter
  1331. + unlimited file support, release tempclose
  1332. Revision 1.8 1998/05/20 09:42:33 pierre
  1333. + UseTokenInfo now default
  1334. * unit in interface uses and implementation uses gives error now
  1335. * only one error for unknown symbol (uses lastsymknown boolean)
  1336. the problem came from the label code !
  1337. + first inlined procedures and function work
  1338. (warning there might be allowed cases were the result is still wrong !!)
  1339. * UseBrower updated gives a global list of all position of all used symbols
  1340. with switch -gb
  1341. Revision 1.7 1998/05/06 18:36:53 peter
  1342. * tai_section extended with code,data,bss sections and enumerated type
  1343. * ident 'compiled by FPC' moved to pmodules
  1344. * small fix for smartlink
  1345. Revision 1.6 1998/05/06 08:38:37 pierre
  1346. * better position info with UseTokenInfo
  1347. UseTokenInfo greatly simplified
  1348. + added check for changed tree after first time firstpass
  1349. (if we could remove all the cases were it happen
  1350. we could skip all firstpass if firstpasscount > 1)
  1351. Only with ExtDebug
  1352. Revision 1.5 1998/04/30 15:59:40 pierre
  1353. * GDB works again better :
  1354. correct type info in one pass
  1355. + UseTokenInfo for better source position
  1356. * fixed one remaining bug in scanner for line counts
  1357. * several little fixes
  1358. Revision 1.4 1998/04/29 10:33:50 pierre
  1359. + added some code for ansistring (not complete nor working yet)
  1360. * corrected operator overloading
  1361. * corrected nasm output
  1362. + started inline procedures
  1363. + added starstarn : use ** for exponentiation (^ gave problems)
  1364. + started UseTokenInfo cond to get accurate positions
  1365. Revision 1.3 1998/04/27 23:10:28 peter
  1366. + new scanner
  1367. * $makelib -> if smartlink
  1368. * small filename fixes pmodule.setfilename
  1369. * moved import from files.pas -> import.pas
  1370. Revision 1.2 1998/04/07 11:09:04 peter
  1371. + filemode is set correct in tbufferedfile.reset
  1372. }