cobjects.pas 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646
  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. end;
  709. function Tnamed_object.name:string;
  710. begin
  711. name:=_name^;
  712. end;
  713. {****************************************************************************
  714. TDICTIONARY
  715. ****************************************************************************}
  716. constructor Tdictionary.init(usehash:boolean);
  717. begin
  718. root:=nil;
  719. hasharray:=nil;
  720. replace_existing:=false;
  721. if usehash then
  722. begin
  723. new(hasharray);
  724. fillchar(hasharray^,sizeof(hasharray^),0);
  725. end;
  726. end;
  727. procedure Tdictionary.clear;
  728. var w:longint;
  729. begin
  730. {remove no entry from a withsymtable as it is only a pointer to the
  731. recorddef or objectdef symtable }
  732. { remove all entry from a symbol table }
  733. if assigned(root) then
  734. dispose(root,done);
  735. if assigned(hasharray) then
  736. for w:=0 to hasharraysize-1 do
  737. if assigned(hasharray^[w]) then
  738. begin
  739. dispose(hasharray^[w],done);
  740. hasharray^[w]:=nil;
  741. end;
  742. end;
  743. procedure Tdictionary.foreach(proc2call:Tcallback);
  744. procedure a(p:Pnamed_object);
  745. { must be preorder, because it's used by reading in }
  746. { a PPU file }
  747. begin
  748. proc2call(p);
  749. if assigned(p^.left) then
  750. a(p^.left);
  751. if assigned(p^.right) then
  752. a(p^.right);
  753. end;
  754. var i:longint;
  755. begin
  756. if assigned(hasharray) then
  757. begin
  758. for i:=0 to hasharraysize-1 do
  759. if assigned(hasharray^[i]) then
  760. a(hasharray^[i]);
  761. end
  762. else
  763. if assigned(root) then
  764. a(root);
  765. end;
  766. function Tdictionary.insert(obj:Pnamed_object):Pnamed_object;
  767. function _insert(var osym:Pnamed_object):Pnamed_object;
  768. {To prevent TP from allocating temp space for temp strings, we allocate
  769. some temp strings manually. We can use two temp strings, plus a third
  770. one that TP adds, where TP alone needs five temp strings!. Storing
  771. these on the heap saves even more, totally 1016 bytes per recursion!}
  772. var s1,s2:^string;
  773. begin
  774. if osym=nil then
  775. begin
  776. osym:=obj;
  777. _insert:=osym;
  778. end
  779. { first check speedvalue, to allow a fast insert }
  780. else
  781. if osym^.speedvalue>obj^.speedvalue then
  782. _insert:=_insert(osym^.right)
  783. else
  784. if osym^.speedvalue<obj^.speedvalue then
  785. _insert:=_insert(osym^.left)
  786. else
  787. begin
  788. new(s1);
  789. new(s2);
  790. s1^:=osym^._name^;
  791. s2^:=obj^._name^;
  792. if s1^>s2^ then
  793. begin
  794. dispose(s2);
  795. dispose(s1);
  796. _insert:=_insert(osym^.right);
  797. end
  798. else
  799. if s1^<s2^ then
  800. begin
  801. dispose(s2);
  802. dispose(s1);
  803. _insert:=_insert(osym^.left);
  804. end
  805. else
  806. begin
  807. dispose(s2);
  808. dispose(s1);
  809. if replace_existing and
  810. assigned(osym) then
  811. begin
  812. obj^.left:=osym^.left;
  813. obj^.right:=osym^.right;
  814. osym:=obj;
  815. _insert:=obj;
  816. end
  817. else
  818. _insert:=osym;
  819. end;
  820. end;
  821. end;
  822. begin
  823. obj^.owner:=@self;
  824. obj^.speedvalue:=getspeedvalue(obj^._name^);
  825. if assigned(hasharray) then
  826. insert:=_insert(hasharray^[obj^.speedvalue mod hasharraysize])
  827. else
  828. insert:=_insert(root);
  829. end;
  830. function Tdictionary.search(const s:string):Pnamed_object;
  831. begin
  832. search:=speedsearch(s,getspeedvalue(s));
  833. end;
  834. function Tdictionary.speedsearch(const s:string;
  835. speedvalue:longint):Pnamed_object;
  836. var hp:Pnamed_object;
  837. begin
  838. if assigned(hasharray) then
  839. hp:=hasharray^[speedvalue mod hasharraysize]
  840. else
  841. hp:=root;
  842. while assigned(hp) do
  843. begin
  844. if speedvalue>hp^.speedvalue then
  845. hp:=hp^.left
  846. else
  847. if speedvalue<hp^.speedvalue then
  848. hp:=hp^.right
  849. else
  850. begin
  851. if (hp^._name^=s) then
  852. begin
  853. speedsearch:=hp;
  854. exit;
  855. end
  856. else
  857. if s>hp^._name^ then
  858. hp:=hp^.left
  859. else
  860. hp:=hp^.right;
  861. end;
  862. end;
  863. speedsearch:=nil;
  864. end;
  865. destructor Tdictionary.done;
  866. begin
  867. clear;
  868. if assigned(hasharray) then
  869. dispose(hasharray);
  870. end;
  871. {****************************************************************************
  872. tdynamicarray
  873. ****************************************************************************}
  874. constructor tdynamicarray.init(Aelemlen,Agrow:longint);
  875. begin
  876. posn:=0;
  877. count:=0;
  878. limit:=0;
  879. data:=nil;
  880. elemlen:=Aelemlen;
  881. growcount:=Agrow;
  882. grow;
  883. end;
  884. function tdynamicarray.size:longint;
  885. begin
  886. size:=limit*elemlen;
  887. end;
  888. function tdynamicarray.usedsize:longint;
  889. begin
  890. usedsize:=count*elemlen;
  891. end;
  892. procedure tdynamicarray.grow;
  893. var
  894. osize : longint;
  895. odata : pchar;
  896. begin
  897. osize:=size;
  898. odata:=data;
  899. inc(limit,growcount);
  900. getmem(data,size);
  901. if assigned(odata) then
  902. begin
  903. move(odata^,data^,osize);
  904. freemem(odata,osize);
  905. end;
  906. fillchar(data[osize],growcount*elemlen,0);
  907. end;
  908. procedure tdynamicarray.align(i:longint);
  909. var
  910. j : longint;
  911. begin
  912. j:=(posn*elemlen mod i);
  913. if j<>0 then
  914. begin
  915. j:=i-j;
  916. while limit<(posn+j) do
  917. grow;
  918. inc(posn,j);
  919. if (posn>count) then
  920. count:=posn;
  921. end;
  922. end;
  923. procedure tdynamicarray.seek(i:longint);
  924. begin
  925. while limit<i do
  926. grow;
  927. posn:=i;
  928. if (posn>count) then
  929. count:=posn;
  930. end;
  931. procedure tdynamicarray.write(var d;len:longint);
  932. begin
  933. while limit<(posn+len) do
  934. grow;
  935. move(d,data[posn*elemlen],len*elemlen);
  936. inc(posn,len);
  937. if (posn>count) then
  938. count:=posn;
  939. end;
  940. procedure tdynamicarray.read(var d;len:longint);
  941. begin
  942. move(data[posn*elemlen],d,len*elemlen);
  943. inc(posn,len);
  944. if (posn>count) then
  945. count:=posn;
  946. end;
  947. procedure tdynamicarray.writepos(pos:longint;var d;len:longint);
  948. begin
  949. while limit<(pos+len) do
  950. grow;
  951. move(d,data[pos*elemlen],len*elemlen);
  952. posn:=pos+len;
  953. if (posn>count) then
  954. count:=posn;
  955. end;
  956. procedure tdynamicarray.readpos(pos:longint;var d;len:longint);
  957. begin
  958. while limit<(pos+len) do
  959. grow;
  960. move(data[pos*elemlen],d,len*elemlen);
  961. posn:=pos+len;
  962. if (posn>count) then
  963. count:=posn;
  964. end;
  965. destructor tdynamicarray.done;
  966. begin
  967. if assigned(data) then
  968. freemem(data,size);
  969. end;
  970. {$ifdef BUFFEREDFILE}
  971. {****************************************************************************
  972. TBUFFEREDFILE
  973. ****************************************************************************}
  974. Const
  975. crcseed = $ffffffff;
  976. crctable : array[0..255] of longint = (
  977. $00000000,$77073096,$ee0e612c,$990951ba,$076dc419,$706af48f,
  978. $e963a535,$9e6495a3,$0edb8832,$79dcb8a4,$e0d5e91e,$97d2d988,
  979. $09b64c2b,$7eb17cbd,$e7b82d07,$90bf1d91,$1db71064,$6ab020f2,
  980. $f3b97148,$84be41de,$1adad47d,$6ddde4eb,$f4d4b551,$83d385c7,
  981. $136c9856,$646ba8c0,$fd62f97a,$8a65c9ec,$14015c4f,$63066cd9,
  982. $fa0f3d63,$8d080df5,$3b6e20c8,$4c69105e,$d56041e4,$a2677172,
  983. $3c03e4d1,$4b04d447,$d20d85fd,$a50ab56b,$35b5a8fa,$42b2986c,
  984. $dbbbc9d6,$acbcf940,$32d86ce3,$45df5c75,$dcd60dcf,$abd13d59,
  985. $26d930ac,$51de003a,$c8d75180,$bfd06116,$21b4f4b5,$56b3c423,
  986. $cfba9599,$b8bda50f,$2802b89e,$5f058808,$c60cd9b2,$b10be924,
  987. $2f6f7c87,$58684c11,$c1611dab,$b6662d3d,$76dc4190,$01db7106,
  988. $98d220bc,$efd5102a,$71b18589,$06b6b51f,$9fbfe4a5,$e8b8d433,
  989. $7807c9a2,$0f00f934,$9609a88e,$e10e9818,$7f6a0dbb,$086d3d2d,
  990. $91646c97,$e6635c01,$6b6b51f4,$1c6c6162,$856530d8,$f262004e,
  991. $6c0695ed,$1b01a57b,$8208f4c1,$f50fc457,$65b0d9c6,$12b7e950,
  992. $8bbeb8ea,$fcb9887c,$62dd1ddf,$15da2d49,$8cd37cf3,$fbd44c65,
  993. $4db26158,$3ab551ce,$a3bc0074,$d4bb30e2,$4adfa541,$3dd895d7,
  994. $a4d1c46d,$d3d6f4fb,$4369e96a,$346ed9fc,$ad678846,$da60b8d0,
  995. $44042d73,$33031de5,$aa0a4c5f,$dd0d7cc9,$5005713c,$270241aa,
  996. $be0b1010,$c90c2086,$5768b525,$206f85b3,$b966d409,$ce61e49f,
  997. $5edef90e,$29d9c998,$b0d09822,$c7d7a8b4,$59b33d17,$2eb40d81,
  998. $b7bd5c3b,$c0ba6cad,$edb88320,$9abfb3b6,$03b6e20c,$74b1d29a,
  999. $ead54739,$9dd277af,$04db2615,$73dc1683,$e3630b12,$94643b84,
  1000. $0d6d6a3e,$7a6a5aa8,$e40ecf0b,$9309ff9d,$0a00ae27,$7d079eb1,
  1001. $f00f9344,$8708a3d2,$1e01f268,$6906c2fe,$f762575d,$806567cb,
  1002. $196c3671,$6e6b06e7,$fed41b76,$89d32be0,$10da7a5a,$67dd4acc,
  1003. $f9b9df6f,$8ebeeff9,$17b7be43,$60b08ed5,$d6d6a3e8,$a1d1937e,
  1004. $38d8c2c4,$4fdff252,$d1bb67f1,$a6bc5767,$3fb506dd,$48b2364b,
  1005. $d80d2bda,$af0a1b4c,$36034af6,$41047a60,$df60efc3,$a867df55,
  1006. $316e8eef,$4669be79,$cb61b38c,$bc66831a,$256fd2a0,$5268e236,
  1007. $cc0c7795,$bb0b4703,$220216b9,$5505262f,$c5ba3bbe,$b2bd0b28,
  1008. $2bb45a92,$5cb36a04,$c2d7ffa7,$b5d0cf31,$2cd99e8b,$5bdeae1d,
  1009. $9b64c2b0,$ec63f226,$756aa39c,$026d930a,$9c0906a9,$eb0e363f,
  1010. $72076785,$05005713,$95bf4a82,$e2b87a14,$7bb12bae,$0cb61b38,
  1011. $92d28e9b,$e5d5be0d,$7cdcefb7,$0bdbdf21,$86d3d2d4,$f1d4e242,
  1012. $68ddb3f8,$1fda836e,$81be16cd,$f6b9265b,$6fb077e1,$18b74777,
  1013. $88085ae6,$ff0f6a70,$66063bca,$11010b5c,$8f659eff,$f862ae69,
  1014. $616bffd3,$166ccf45,$a00ae278,$d70dd2ee,$4e048354,$3903b3c2,
  1015. $a7672661,$d06016f7,$4969474d,$3e6e77db,$aed16a4a,$d9d65adc,
  1016. $40df0b66,$37d83bf0,$a9bcae53,$debb9ec5,$47b2cf7f,$30b5ffe9,
  1017. $bdbdf21c,$cabac28a,$53b39330,$24b4a3a6,$bad03605,$cdd70693,
  1018. $54de5729,$23d967bf,$b3667a2e,$c4614ab8,$5d681b02,$2a6f2b94,
  1019. $b40bbe37,$c30c8ea1,$5a05df1b,$2d02ef8d);
  1020. constructor tbufferedfile.init(const filename : string;_bufsize : longint);
  1021. begin
  1022. assign(f,filename);
  1023. bufsize:=_bufsize;
  1024. bufpos:=0;
  1025. buflast:=0;
  1026. do_crc:=false;
  1027. iomode:=0;
  1028. tempclosed:=false;
  1029. change_endian:=false;
  1030. clear_crc;
  1031. end;
  1032. destructor tbufferedfile.done;
  1033. begin
  1034. close;
  1035. end;
  1036. procedure tbufferedfile.clear_crc;
  1037. begin
  1038. crc:=crcseed;
  1039. end;
  1040. procedure tbufferedfile.setbuf(p : pchar;s : longint);
  1041. begin
  1042. flush;
  1043. freemem(buf,bufsize);
  1044. bufsize:=s;
  1045. buf:=p;
  1046. end;
  1047. function tbufferedfile.reset:boolean;
  1048. var
  1049. ofm : byte;
  1050. begin
  1051. ofm:=filemode;
  1052. iomode:=1;
  1053. getmem(buf,bufsize);
  1054. filemode:=0;
  1055. {$I-}
  1056. system.reset(f,1);
  1057. {$I+}
  1058. reset:=(ioresult=0);
  1059. filemode:=ofm;
  1060. end;
  1061. procedure tbufferedfile.rewrite;
  1062. begin
  1063. iomode:=2;
  1064. getmem(buf,bufsize);
  1065. system.rewrite(f,1);
  1066. end;
  1067. procedure tbufferedfile.flush;
  1068. var
  1069. {$ifdef FPC}
  1070. count : longint;
  1071. {$else}
  1072. count : integer;
  1073. {$endif}
  1074. begin
  1075. if iomode=2 then
  1076. begin
  1077. if bufpos=0 then
  1078. exit;
  1079. blockwrite(f,buf^,bufpos)
  1080. end
  1081. else if iomode=1 then
  1082. if buflast=bufpos then
  1083. begin
  1084. blockread(f,buf^,bufsize,count);
  1085. buflast:=count;
  1086. end;
  1087. bufpos:=0;
  1088. end;
  1089. function tbufferedfile.getftime : longint;
  1090. var
  1091. l : longint;
  1092. {$ifdef linux}
  1093. Info : Stat;
  1094. {$endif}
  1095. begin
  1096. {$ifndef linux}
  1097. { this only works if the file is open !! }
  1098. dos.getftime(f,l);
  1099. {$else}
  1100. Fstat(f,Info);
  1101. l:=info.mtime;
  1102. {$endif}
  1103. getftime:=l;
  1104. end;
  1105. function tbufferedfile.getsize : longint;
  1106. begin
  1107. getsize:=filesize(f);
  1108. end;
  1109. procedure tbufferedfile.seek(l : longint);
  1110. begin
  1111. if iomode=2 then
  1112. begin
  1113. flush;
  1114. system.seek(f,l);
  1115. end
  1116. else if iomode=1 then
  1117. begin
  1118. { forces a reload }
  1119. bufpos:=buflast;
  1120. system.seek(f,l);
  1121. flush;
  1122. end;
  1123. end;
  1124. type
  1125. {$ifdef tp}
  1126. bytearray1 = array [1..65535] of byte;
  1127. {$else}
  1128. bytearray1 = array [1..10000000] of byte;
  1129. {$endif}
  1130. procedure tbufferedfile.read_data(var data;bytes : longint;var count : longint);
  1131. var
  1132. p : pchar;
  1133. c,i : longint;
  1134. begin
  1135. p:=pchar(@data);
  1136. count:=0;
  1137. while bytes-count>0 do
  1138. begin
  1139. if bytes-count>buflast-bufpos then
  1140. begin
  1141. move((buf+bufpos)^,(p+count)^,buflast-bufpos);
  1142. inc(count,buflast-bufpos);
  1143. bufpos:=buflast;
  1144. flush;
  1145. { can't we read anything ? }
  1146. if bufpos=buflast then
  1147. break;
  1148. end
  1149. else
  1150. begin
  1151. move((buf+bufpos)^,(p+count)^,bytes-count);
  1152. inc(bufpos,bytes-count);
  1153. count:=bytes;
  1154. break;
  1155. end;
  1156. end;
  1157. if do_crc then
  1158. begin
  1159. c:=crc;
  1160. for i:=1 to bytes do
  1161. c:=(c shr 8) xor crctable[byte(c) xor (bytearray1(data)[i])];
  1162. crc:=c;
  1163. end;
  1164. end;
  1165. procedure tbufferedfile.write_data(var data;count : longint);
  1166. var
  1167. c,i : longint;
  1168. begin
  1169. if bufpos+count>bufsize then
  1170. flush;
  1171. move(data,(buf+bufpos)^,count);
  1172. inc(bufpos,count);
  1173. if do_crc then
  1174. begin
  1175. c:=crc;
  1176. for i:=1 to count do
  1177. c:=(c shr 8) xor crctable[byte(c) xor (bytearray1(data)[i])];
  1178. crc:=c;
  1179. end;
  1180. end;
  1181. function tbufferedfile.getcrc : longint;
  1182. begin
  1183. getcrc:=crc xor crcseed;
  1184. end;
  1185. procedure tbufferedfile.write_string(const s : string);
  1186. begin
  1187. if bufpos+length(s)>bufsize then
  1188. flush;
  1189. { why is there not CRC here ??? }
  1190. move(s[1],(buf+bufpos)^,length(s));
  1191. inc(bufpos,length(s));
  1192. { should be
  1193. write_data(s[1],length(s)); }
  1194. end;
  1195. procedure tbufferedfile.write_pchar(p : pchar);
  1196. var
  1197. l : longint;
  1198. begin
  1199. l:=strlen(p);
  1200. if l>=bufsize then
  1201. runerror(222);
  1202. { why is there not CRC here ???}
  1203. if bufpos+l>bufsize then
  1204. flush;
  1205. move(p^,(buf+bufpos)^,l);
  1206. inc(bufpos,l);
  1207. { should be
  1208. write_data(p^,l); }
  1209. end;
  1210. procedure tbufferedfile.write_byte(b : byte);
  1211. begin
  1212. write_data(b,sizeof(byte));
  1213. end;
  1214. procedure tbufferedfile.write_long(l : longint);
  1215. var
  1216. w1,w2 : word;
  1217. begin
  1218. if change_endian then
  1219. begin
  1220. w1:=l and $ffff;
  1221. w2:=l shr 16;
  1222. l:=swap(w2)+(longint(swap(w1)) shl 16);
  1223. write_data(l,sizeof(longint))
  1224. end
  1225. else
  1226. write_data(l,sizeof(longint))
  1227. end;
  1228. procedure tbufferedfile.write_word(w : word);
  1229. begin
  1230. if change_endian then
  1231. begin
  1232. w:=swap(w);
  1233. write_data(w,sizeof(word))
  1234. end
  1235. else
  1236. write_data(w,sizeof(word));
  1237. end;
  1238. procedure tbufferedfile.write_double(d : double);
  1239. begin
  1240. write_data(d,sizeof(double));
  1241. end;
  1242. function tbufferedfile.getpath : string;
  1243. begin
  1244. {$ifdef dummy}
  1245. getpath:=strpas(filerec(f).name);
  1246. {$endif}
  1247. getpath:='';
  1248. end;
  1249. procedure tbufferedfile.close;
  1250. begin
  1251. if iomode<>0 then
  1252. begin
  1253. flush;
  1254. system.close(f);
  1255. freemem(buf,bufsize);
  1256. buf:=nil;
  1257. iomode:=0;
  1258. end;
  1259. end;
  1260. procedure tbufferedfile.tempclose;
  1261. begin
  1262. if iomode<>0 then
  1263. begin
  1264. temppos:=system.filepos(f);
  1265. tempmode:=iomode;
  1266. tempclosed:=true;
  1267. system.close(f);
  1268. iomode:=0;
  1269. end
  1270. else
  1271. tempclosed:=false;
  1272. end;
  1273. procedure tbufferedfile.tempreopen;
  1274. var
  1275. ofm : byte;
  1276. begin
  1277. if tempclosed then
  1278. begin
  1279. case tempmode of
  1280. 1 : begin
  1281. ofm:=filemode;
  1282. iomode:=1;
  1283. filemode:=0;
  1284. system.reset(f,1);
  1285. filemode:=ofm;
  1286. end;
  1287. 2 : begin
  1288. iomode:=2;
  1289. system.rewrite(f,1);
  1290. end;
  1291. end;
  1292. system.seek(f,temppos);
  1293. tempclosed:=false;
  1294. end;
  1295. end;
  1296. {$endif BUFFEREDFILE}
  1297. end.
  1298. {
  1299. $Log$
  1300. Revision 1.20 1999-03-18 20:30:45 peter
  1301. + .a writer
  1302. Revision 1.19 1999/03/01 13:32:00 pierre
  1303. * external used before implemented problem fixed
  1304. Revision 1.18 1999/02/24 00:59:13 peter
  1305. * small updates for ag386bin
  1306. Revision 1.17 1999/01/19 11:00:33 daniel
  1307. + Tdictionary object: Tsymtable will become object(TTdictionary) in the
  1308. future
  1309. + Tnamed_item object: Tsym will become object(Tnamed_item) in the future
  1310. Revision 1.16 1998/11/04 10:11:37 peter
  1311. * ansistring fixes
  1312. Revision 1.15 1998/10/19 18:04:40 peter
  1313. + tstringcontainer.init_no_doubles
  1314. Revision 1.14 1998/09/18 16:03:37 florian
  1315. * some changes to compile with Delphi
  1316. Revision 1.13 1998/08/12 19:28:16 peter
  1317. * better libc support
  1318. Revision 1.12 1998/07/14 14:46:47 peter
  1319. * released NEWINPUT
  1320. Revision 1.11 1998/07/07 11:19:54 peter
  1321. + NEWINPUT for a better inputfile and scanner object
  1322. Revision 1.10 1998/07/01 15:26:59 peter
  1323. * better bufferfile.reset error handling
  1324. Revision 1.9 1998/06/03 23:40:37 peter
  1325. + unlimited file support, release tempclose
  1326. Revision 1.8 1998/05/20 09:42:33 pierre
  1327. + UseTokenInfo now default
  1328. * unit in interface uses and implementation uses gives error now
  1329. * only one error for unknown symbol (uses lastsymknown boolean)
  1330. the problem came from the label code !
  1331. + first inlined procedures and function work
  1332. (warning there might be allowed cases were the result is still wrong !!)
  1333. * UseBrower updated gives a global list of all position of all used symbols
  1334. with switch -gb
  1335. Revision 1.7 1998/05/06 18:36:53 peter
  1336. * tai_section extended with code,data,bss sections and enumerated type
  1337. * ident 'compiled by FPC' moved to pmodules
  1338. * small fix for smartlink
  1339. Revision 1.6 1998/05/06 08:38:37 pierre
  1340. * better position info with UseTokenInfo
  1341. UseTokenInfo greatly simplified
  1342. + added check for changed tree after first time firstpass
  1343. (if we could remove all the cases were it happen
  1344. we could skip all firstpass if firstpasscount > 1)
  1345. Only with ExtDebug
  1346. Revision 1.5 1998/04/30 15:59:40 pierre
  1347. * GDB works again better :
  1348. correct type info in one pass
  1349. + UseTokenInfo for better source position
  1350. * fixed one remaining bug in scanner for line counts
  1351. * several little fixes
  1352. Revision 1.4 1998/04/29 10:33:50 pierre
  1353. + added some code for ansistring (not complete nor working yet)
  1354. * corrected operator overloading
  1355. * corrected nasm output
  1356. + started inline procedures
  1357. + added starstarn : use ** for exponentiation (^ gave problems)
  1358. + started UseTokenInfo cond to get accurate positions
  1359. Revision 1.3 1998/04/27 23:10:28 peter
  1360. + new scanner
  1361. * $makelib -> if smartlink
  1362. * small filename fixes pmodule.setfilename
  1363. * moved import from files.pas -> import.pas
  1364. Revision 1.2 1998/04/07 11:09:04 peter
  1365. + filemode is set correct in tbufferedfile.reset
  1366. }