astrings.inc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  6. This file implements AnsiStrings for FPC
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  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.
  12. **********************************************************************}
  13. { This will release some functions for special shortstring support }
  14. { define EXTRAANSISHORT}
  15. {
  16. This file contains the implementation of the AnsiString type,
  17. and all things that are needed for it.
  18. AnsiString is defined as a 'silent' pchar :
  19. a pchar that points to :
  20. @-12 : Longint for maximum size;
  21. @-8 : Longint for size;
  22. @-4 : Longint for reference count;
  23. @ : String + Terminating #0;
  24. Pchar(Ansistring) is a valid typecast.
  25. So AS[i] is converted to the address @AS+i-1.
  26. Constants should be assigned a reference count of -1
  27. Meaning that they can't be disposed of.
  28. }
  29. Type
  30. PAnsiRec = ^TAnsiRec;
  31. TAnsiRec = Packed Record
  32. Maxlen,
  33. len,
  34. ref : Longint;
  35. First : Char;
  36. end;
  37. Const
  38. AnsiRecLen = SizeOf(TAnsiRec);
  39. FirstOff = SizeOf(TAnsiRec)-1;
  40. {****************************************************************************
  41. Internal functions, not in interface.
  42. ****************************************************************************}
  43. {$ifdef AnsiStrDebug}
  44. Procedure DumpAnsiRec(S : Pointer);
  45. begin
  46. If S=Nil then
  47. Writeln ('String is nil')
  48. Else
  49. Begin
  50. With PAnsiRec(S-Firstoff)^ do
  51. begin
  52. Write ('(Maxlen: ',maxlen);
  53. Write (' Len:',len);
  54. Writeln (' Ref: ',ref,')');
  55. end;
  56. end;
  57. end;
  58. {$endif}
  59. Function NewAnsiString(Len : Longint) : Pointer;
  60. {
  61. Allocate a new AnsiString on the heap.
  62. initialize it to zero length and reference count 1.
  63. }
  64. Var
  65. P : Pointer;
  66. begin
  67. { Also add +1 for a terminating zero }
  68. GetMem(P,Len+AnsiRecLen);
  69. If P<>Nil then
  70. begin
  71. PAnsiRec(P)^.Maxlen:=Len; { Maximal length }
  72. PAnsiRec(P)^.Len:=0; { Initial length }
  73. PAnsiRec(P)^.Ref:=1; { Set reference count }
  74. PAnsiRec(P)^.First:=#0; { Terminating #0 }
  75. P:=P+FirstOff; { Points to string now }
  76. end;
  77. NewAnsiString:=P;
  78. end;
  79. Procedure DisposeAnsiString(Var S : Pointer);
  80. {
  81. Deallocates a AnsiString From the heap.
  82. }
  83. begin
  84. If S=Nil then
  85. exit;
  86. Dec (Longint(S),FirstOff);
  87. FreeMem (S,PAnsiRec(S)^.Maxlen+AnsiRecLen);
  88. S:=Nil;
  89. end;
  90. Procedure AnsiStr_Decr_Ref (Var S : Pointer);[Public,Alias:'FPC_ANSISTR_DECR_REF'];
  91. {
  92. Decreases the ReferenceCount of a non constant ansistring;
  93. If the reference count is zero, deallocate the string;
  94. }
  95. Type
  96. plongint = ^longint;
  97. Var
  98. l : plongint;
  99. Begin
  100. { Zero string }
  101. If S=Nil then exit;
  102. { check for constant strings ...}
  103. l:=@PANSIREC(S-FirstOff)^.Ref;
  104. If l^<0 then exit;
  105. Dec(l^);
  106. If l^=0 then
  107. { Ref count dropped to zero }
  108. DisposeAnsiString (S); { Remove...}
  109. { this pointer is not valid anymore, so set it to zero }
  110. S:=nil;
  111. end;
  112. Procedure AnsiStr_Incr_Ref (Var S : Pointer);[Public,Alias:'FPC_ANSISTR_INCR_REF'];
  113. Begin
  114. If S=Nil then
  115. exit;
  116. { Let's be paranoid : Constant string ??}
  117. If PAnsiRec(S-FirstOff)^.Ref<0 then exit;
  118. Inc(PAnsiRec(S-FirstOff)^.Ref);
  119. end;
  120. Procedure AnsiStr_Assign (Var S1 : Pointer;S2 : Pointer);[Public,Alias:'FPC_ANSISTR_ASSIGN'];
  121. {
  122. Assigns S2 to S1 (S1:=S2), taking in account reference counts.
  123. }
  124. begin
  125. If S2<>nil then
  126. If PAnsiRec(S2-FirstOff)^.Ref>0 then
  127. Inc(PAnsiRec(S2-FirstOff)^.ref);
  128. { Decrease the reference count on the old S1 }
  129. ansistr_decr_ref (S1);
  130. { And finally, have S1 pointing to S2 (or its copy) }
  131. S1:=S2;
  132. end;
  133. Procedure AnsiStr_Concat (S1,S2 : Pointer;var S3 : Pointer);[Public, alias: 'FPC_ANSISTR_CONCAT'];
  134. {
  135. Concatenates 2 AnsiStrings : S1+S2.
  136. Result Goes to S3;
  137. }
  138. Var
  139. Size,Location : Longint;
  140. begin
  141. { create new result }
  142. if S3<>nil then
  143. AnsiStr_Decr_Ref(S3);
  144. { only assign if s1 or s2 is empty }
  145. if (S1=Nil) then
  146. AnsiStr_Assign(S3,S2)
  147. else
  148. if (S2=Nil) then
  149. AnsiStr_Assign(S3,S1)
  150. else
  151. begin
  152. Size:=PAnsiRec(S2-FirstOff)^.Len;
  153. Location:=Length(AnsiString(S1));
  154. SetLength (AnsiString(S3),Size+Location);
  155. Move (S1^,S3^,Location);
  156. Move (S2^,(S3+location)^,Size+1);
  157. end;
  158. end;
  159. {$ifdef EXTRAANSISHORT}
  160. Procedure AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString);
  161. {
  162. Concatenates a Ansi with a short string; : S2 + S2
  163. }
  164. Var
  165. Size,Location : Longint;
  166. begin
  167. Size:=Length(S2);
  168. Location:=Length(S1);
  169. If Size=0 then
  170. exit;
  171. { Setlength takes case of uniqueness
  172. and alllocated memory. We need to use length,
  173. to take into account possibility of S1=Nil }
  174. SetLength (S1,Size+Length(S1));
  175. Move (S2[1],Pointer(Pointer(S1)+Location)^,Size);
  176. PByte( Pointer(S1)+length(S1) )^:=0; { Terminating Zero }
  177. end;
  178. {$endif EXTRAANSISHORT}
  179. Procedure AnsiStr_To_ShortStr (Var S1 : ShortString;S2 : Pointer);[Public, alias: 'FPC_ANSISTR_TO_SHORTSTR'];
  180. {
  181. Converts a AnsiString to a ShortString;
  182. }
  183. Var
  184. Size : Longint;
  185. begin
  186. if S2=nil then
  187. S1:=''
  188. else
  189. begin
  190. Size:=PAnsiRec(S2-FirstOff)^.Len;
  191. If Size>high(S1) then
  192. Size:=high(S1);
  193. Move (S2^,S1[1],Size);
  194. byte(S1[0]):=Size;
  195. end;
  196. end;
  197. Procedure ShortStr_To_AnsiStr (Var S1 : Pointer; Const S2 : ShortString);[Public, alias: 'FPC_SHORTSTR_TO_ANSISTR'];
  198. {
  199. Converts a ShortString to a AnsiString;
  200. }
  201. Var
  202. Size : Longint;
  203. begin
  204. Size:=Length(S2);
  205. Setlength (AnsiString(S1),Size);
  206. if Size>0 then
  207. begin
  208. Move (S2[1],Pointer(S1)^,Size);
  209. { Terminating Zero }
  210. PByte(Pointer(S1)+Size)^:=0;
  211. end;
  212. end;
  213. Procedure Char_To_AnsiStr(var S1 : Pointer; c : Char);[Public, alias: 'FPC_CHAR_TO_ANSISTR'];
  214. {
  215. Converts a ShortString to a AnsiString;
  216. }
  217. begin
  218. Setlength (AnsiString(S1),1);
  219. PByte(Pointer(S1))^:=byte(c);
  220. { Terminating Zero }
  221. PByte(Pointer(S1)+1)^:=0;
  222. end;
  223. Procedure PChar_To_AnsiStr(var a : ansistring;p : pchar);[Public,Alias : 'FPC_PCHAR_TO_ANSISTR'];
  224. Var
  225. L : Longint;
  226. begin
  227. if pointer(a)<>nil then
  228. begin
  229. AnsiStr_Decr_Ref(Pointer(a));
  230. pointer(a):=nil;
  231. end;
  232. if (not assigned(p)) or (p[0]=#0) Then
  233. Pointer(a):=nil
  234. else
  235. begin
  236. //!! Horribly inneficient, but I see no other way...
  237. L:=1;
  238. While P[l]<>#0 do
  239. inc (l);
  240. Pointer(a):=NewAnsistring(L);
  241. SetLength(A,L);
  242. Move (P[0],Pointer(A)^,L)
  243. end;
  244. end;
  245. Procedure CharArray_To_AnsiStr(var a : ansistring;p : pchar;l:longint);[Public,Alias : 'FPC_CHARARRAY_TO_ANSISTR'];
  246. var
  247. i : longint;
  248. hp : pchar;
  249. begin
  250. if p[0]=#0 Then
  251. Pointer(a):=nil
  252. else
  253. begin
  254. Pointer(a):=NewAnsistring(L);
  255. hp:=p;
  256. i:=0;
  257. while (i<l) and (hp^<>#0) do
  258. begin
  259. inc(hp);
  260. inc(i);
  261. end;
  262. SetLength(A,i);
  263. Move (P[0],Pointer(A)^,i)
  264. end;
  265. end;
  266. Function AnsiStr_Compare(S1,S2 : Pointer): Longint;[Public,Alias : 'FPC_ANSISTR_COMPARE'];
  267. {
  268. Compares 2 AnsiStrings;
  269. The result is
  270. <0 if S1<S2
  271. 0 if S1=S2
  272. >0 if S1>S2
  273. }
  274. Var
  275. i,MaxI,Temp : Longint;
  276. begin
  277. i:=0;
  278. Maxi:=Length(AnsiString(S1));
  279. temp:=Length(AnsiString(S2));
  280. If MaxI>Temp then
  281. MaxI:=Temp;
  282. Temp:=0;
  283. While (i<MaxI) and (Temp=0) do
  284. begin
  285. Temp:= PByte(S1+I)^ - PByte(S2+i)^;
  286. inc(i);
  287. end;
  288. if temp=0 then
  289. temp:=Length(AnsiString(S1))-Length(AnsiString(S2));
  290. AnsiStr_Compare:=Temp;
  291. end;
  292. Procedure AnsiStr_CheckZero(p : pointer);[Public,Alias : 'FPC_ANSISTR_CHECKZERO'];
  293. begin
  294. if p=nil then
  295. HandleErrorFrame(201,get_frame);
  296. end;
  297. Procedure AnsiStr_CheckRange(len,index : longint);[Public,Alias : 'FPC_ANSISTR_RANGECHECK'];
  298. begin
  299. if (index>len) or (Index<1) then
  300. HandleErrorFrame(201,get_frame);
  301. end;
  302. {$ifdef EXTRAANSISHORT}
  303. Function AnsiStr_ShortStr_Compare (Var S1 : Pointer; Var S2 : ShortString): Longint;
  304. {
  305. Compares a AnsiString with a ShortString;
  306. The result is
  307. <0 if S1<S2
  308. 0 if S1=S2
  309. >0 if S1>S2
  310. }
  311. Var
  312. i,MaxI,Temp : Longint;
  313. begin
  314. Temp:=0;
  315. i:=0;
  316. MaxI:=Length(AnsiString(S1));
  317. if MaxI>byte(S2[0]) then
  318. MaxI:=Byte(S2[0]);
  319. While (i<MaxI) and (Temp=0) do
  320. begin
  321. Temp:= PByte(S1+I)^ - Byte(S2[i+1]);
  322. inc(i);
  323. end;
  324. AnsiStr_ShortStr_Compare:=Temp;
  325. end;
  326. {$endif EXTRAANSISHORT}
  327. {*****************************************************************************
  328. Public functions, In interface.
  329. *****************************************************************************}
  330. Function Length (Const S : AnsiString) : Longint;
  331. {
  332. Returns the length of an AnsiString.
  333. Takes in acount that zero strings are NIL;
  334. }
  335. begin
  336. If Pointer(S)=Nil then
  337. Length:=0
  338. else
  339. Length:=PAnsiRec(Pointer(S)-FirstOff)^.Len;
  340. end;
  341. Procedure SetLength (Var S : AnsiString; l : Longint);
  342. {
  343. Sets The length of string S to L.
  344. Makes sure S is unique, and contains enough room.
  345. }
  346. Var
  347. Temp : Pointer;
  348. begin
  349. if (l>0) then
  350. begin
  351. if Pointer(S)=nil then
  352. begin
  353. { Need a complete new string...}
  354. Pointer(s):=NewAnsiString(l);
  355. end
  356. else
  357. If (PAnsiRec(Pointer(S)-FirstOff)^.Maxlen < L) or
  358. (PAnsiRec(Pointer(S)-FirstOff)^.Ref <> 1) then
  359. begin
  360. { Reallocation is needed... }
  361. Temp:=Pointer(NewAnsiString(L));
  362. if Length(S)>0 then
  363. Move(Pointer(S)^,Temp^,L);
  364. ansistr_decr_ref(Pointer(S));
  365. Pointer(S):=Temp;
  366. end;
  367. { Force nil termination in case it gets shorter }
  368. PByte(Pointer(S)+l)^:=0;
  369. PAnsiRec(Pointer(S)-FirstOff)^.Len:=l;
  370. end
  371. else
  372. begin
  373. { Length=0 }
  374. if Pointer(S)<>nil then
  375. ansistr_decr_ref (Pointer(S));
  376. Pointer(S):=Nil;
  377. end;
  378. end;
  379. Procedure UniqueAnsiString(Var S : AnsiString); [Public,Alias : 'FPC_ANSISTR_UNIQUE'];
  380. {
  381. Make sure reference count of S is 1,
  382. using copy-on-write semantics.
  383. }
  384. Var
  385. SNew : Pointer;
  386. begin
  387. If Pointer(S)=Nil then
  388. exit;
  389. if PAnsiRec(Pointer(S)-Firstoff)^.Ref<>1 then
  390. begin
  391. SNew:=NewAnsiString (PAnsiRec(Pointer(S)-FirstOff)^.len);
  392. Move (Pointer(S)^,SNew^,PAnsiRec(Pointer(S)-FirstOff)^.len+1);
  393. PAnsiRec(SNew-FirstOff)^.len:=PAnsiRec(Pointer(S)-FirstOff)^.len;
  394. ansistr_decr_ref (Pointer(S)); { Thread safe }
  395. Pointer(S):=SNew;
  396. end;
  397. end;
  398. Function Copy (Const S : AnsiString; Index,Size : Longint) : AnsiString;
  399. var
  400. ResultAddress : Pointer;
  401. begin
  402. ResultAddress:=Nil;
  403. dec(index);
  404. { Check Size. Accounts for Zero-length S }
  405. if Length(S)<Index+Size then
  406. Size:=Length(S)-Index;
  407. If Size>0 then
  408. begin
  409. If Index<0 Then
  410. Index:=0;
  411. ResultAddress:=Pointer(NewAnsiString (Size));
  412. if ResultAddress<>Nil then
  413. begin
  414. Move (Pointer(Pointer(S)+index)^,ResultAddress^,Size);
  415. PAnsiRec(ResultAddress-FirstOff)^.Len:=Size;
  416. PByte(ResultAddress+Size)^:=0;
  417. end;
  418. end;
  419. Pointer(Copy):=ResultAddress;
  420. end;
  421. Function Pos (Const Substr : AnsiString; Const Source : AnsiString) : Longint;
  422. var
  423. substrlen,
  424. maxi,
  425. i,j : longint;
  426. e : boolean;
  427. S : AnsiString;
  428. se : Pointer;
  429. begin
  430. i := 0;
  431. j := 0;
  432. substrlen:=Length(SubStr);
  433. maxi:=length(source)-substrlen;
  434. e:=(substrlen>0);
  435. while (e) and (i <= maxi) do
  436. begin
  437. inc (i);
  438. if Source[i]=SubStr[1] then
  439. begin
  440. S:=copy(Source,i,substrlen);
  441. Se:=pointer(SubStr);
  442. if AnsiStr_Compare(se,Pointer(S))=0 then
  443. begin
  444. j := i;
  445. break;
  446. end;
  447. end;
  448. end;
  449. pos := j;
  450. end;
  451. Function ValAnsiFloat(Const S : AnsiString; Var Code : ValSInt): ValReal; [public, alias:'FPC_VAL_REAL_ANSISTR'];
  452. Var
  453. SS : String;
  454. begin
  455. AnsiStr_To_ShortStr(SS,Pointer(S));
  456. ValAnsiFloat := ValFloat(SS,Code);
  457. end;
  458. Function ValAnsiUnsigendInt (Const S : AnsiString; Code : ValSInt): ValUInt; [public, alias:'FPC_VAL_UINT_ANSISTR'];
  459. Var
  460. SS : ShortString;
  461. begin
  462. AnsiStr_To_ShortStr(SS,Pointer(S));
  463. ValAnsiUnsigendInt := ValUnsignedInt(SS,Code);
  464. end;
  465. Function ValAnsiSignedInt (DestSize: longint; Const S : AnsiString; Var Code : ValSInt): ValSInt; [public, alias:'FPC_VAL_SINT_ANSISTR'];
  466. Var
  467. SS : ShortString;
  468. begin
  469. AnsiStr_To_ShortStr (SS,Pointer(S));
  470. ValAnsiSignedInt := ValSignedInt(DestSize,SS,Code);
  471. end;
  472. {$IfDef SUPPORT_FIXED}
  473. Function ValAnsiFixed(Const S : AnsiString; Var Code : ValSint): ValReal; [public, alias:'FPC_VAL_FIXED_ANSISTR'];
  474. Var
  475. SS : String;
  476. begin
  477. AnsiStr_To_ShortStr (SS,Pointer(S));
  478. ValAnsiFixed := Fixed(ValFloat(SS,Code));
  479. end;
  480. {$EndIf SUPPORT_FIXED}
  481. procedure AnsiStr_Float(d : ValReal;len,fr,rt : longint;var s : ansistring);[public,alias:'FPC_ANSISTR_FLOAT'];
  482. var
  483. ss : shortstring;
  484. begin
  485. str_real(len,fr,d,treal_type(rt),ss);
  486. s:=ss;
  487. end;
  488. Procedure AnsiStr_Cardinal(C : Cardinal;Len : Longint; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_CARDINAL'];
  489. Var
  490. SS : ShortString;
  491. begin
  492. int_str_cardinal(C,Len,SS);
  493. S:=SS;
  494. end;
  495. Procedure AnsiStr_Longint(L : Longint; Len : Longint; Var S : AnsiString);[Public,Alias : 'FPC_ANSISTR_LONGINT'];
  496. Var
  497. SS : ShortString;
  498. begin
  499. int_Str_Longint (L,Len,SS);
  500. S:=SS;
  501. end;
  502. Procedure Delete (Var S : AnsiString; Index,Size: Longint);
  503. Var
  504. LS : Longint;
  505. begin
  506. If Length(S)=0 then
  507. exit;
  508. if index<=0 then
  509. begin
  510. inc(Size,index-1);
  511. index:=1;
  512. end;
  513. LS:=PAnsiRec(Pointer(S)-FirstOff)^.Len;
  514. if (Index<=LS) and (Size>0) then
  515. begin
  516. UniqueAnsiString (S);
  517. if Size+Index>LS then
  518. Size:=LS-Index+1;
  519. if Index+Size<=LS then
  520. begin
  521. Dec(Index);
  522. Move(PByte(Pointer(S))[Index+Size],PByte(Pointer(S))[Index],LS-Index+1);
  523. end;
  524. Setlength(s,LS-Size);
  525. end;
  526. end;
  527. Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : Longint);
  528. var
  529. Temp : AnsiString;
  530. LS : Longint;
  531. begin
  532. If Length(Source)=0 then
  533. exit;
  534. if index <= 0 then
  535. index := 1;
  536. Ls:=Length(S);
  537. if index > LS then
  538. index := LS+1;
  539. Dec(Index);
  540. Pointer(Temp) := NewAnsiString(Length(Source)+LS);
  541. SetLength(Temp,Length(Source)+LS);
  542. If Index>0 then
  543. move (Pointer(S)^,Pointer(Temp)^,Index);
  544. Move (Pointer(Source)^,PByte(Temp)[Index],Length(Source));
  545. If (LS-Index)>0 then
  546. Move(PByte(Pointer(S))[Index],PByte(temp)[Length(Source)+index],LS-Index);
  547. S:=Temp;
  548. end;
  549. {
  550. $Log$
  551. Revision 1.31 1999-10-04 20:48:18 peter
  552. * pos function speed up by a factor 40 :)
  553. Revision 1.30 1999/07/05 20:04:21 peter
  554. * removed temp defines
  555. Revision 1.29 1999/06/14 00:47:33 peter
  556. * merged
  557. Revision 1.28.2.1 1999/06/14 00:39:07 peter
  558. * setlength finally fixed when l < length(s)
  559. Revision 1.28 1999/06/09 23:00:16 peter
  560. * small ansistring fixes
  561. * val_ansistr_sint destsize changed to longint
  562. * don't write low/hi ascii with -al
  563. Revision 1.27 1999/06/05 20:48:56 michael
  564. Copy checks index now for negative values.
  565. Revision 1.26 1999/05/31 20:37:39 peter
  566. * fixed decr_ansistr which didn't set s to nil
  567. Revision 1.25 1999/05/17 22:41:24 florian
  568. * small fixes for the new ansistring temp. management
  569. Revision 1.24 1999/05/17 21:52:35 florian
  570. * most of the Object Pascal stuff moved to the system unit
  571. Revision 1.23 1999/05/06 09:05:11 peter
  572. * generic write_float str_float
  573. Revision 1.22 1999/04/22 10:51:17 peter
  574. * fixed pchar 2 ansi
  575. Revision 1.21 1999/04/13 09:02:06 michael
  576. + 1 byte too much allocated in new_ansiStringastrings.inc
  577. Revision 1.20 1999/04/09 07:33:15 michael
  578. * More fixes and optimizing for ansistr_concat
  579. Revision 1.19 1999/04/08 15:57:53 peter
  580. + subrange checking for readln()
  581. Revision 1.18 1999/04/08 10:19:55 peter
  582. * fixed concat when s1 or s2 was nil
  583. Revision 1.17 1999/04/06 11:23:58 peter
  584. * fixed insert on last char
  585. * saver chararray 2 ansi
  586. Revision 1.16 1999/04/06 10:06:51 michael
  587. * Fixed chararray to ansistring conversion
  588. Revision 1.15 1999/04/01 22:00:48 peter
  589. * universal names for str/val (ansistr instead of stransi)
  590. * '1.' support for val() this is compatible with tp7
  591. Revision 1.14 1999/03/16 17:49:40 jonas
  592. * changes for internal Val code (do a "make cycle OPT=-dvalintern" to test)
  593. * in text.inc: changed RTE 106 when read integer values are out of bounds to RTE 201
  594. * in systemh.inc: disabled "support_fixed" for the i386 because it gave internal errors,
  595. Revision 1.13 1999/03/02 18:24:51 peter
  596. * function names cleanup
  597. + chararray -> ansistring
  598. Revision 1.12 1999/03/01 15:41:02 peter
  599. * use external names
  600. * removed all direct assembler modes
  601. Revision 1.11 1999/02/04 14:55:42 michael
  602. * Fixed pos
  603. Revision 1.10 1999/02/04 10:49:21 florian
  604. + routines for range checking added
  605. Revision 1.9 1999/02/02 11:37:34 peter
  606. * fixed ansi2short
  607. Revision 1.8 1999/01/06 14:48:43 michael
  608. + Implemented more str() functions
  609. Revision 1.7 1999/01/06 13:03:39 peter
  610. * fixed str() and made it working
  611. Revision 1.6 1999/01/06 12:25:02 florian
  612. * naming for str(...) routines inserted
  613. * don't know what in int64 changed
  614. Revision 1.5 1998/12/15 22:43:01 peter
  615. * removed temp symbols
  616. Revision 1.4 1998/11/18 10:56:46 michael
  617. + Fixed pchar2ansi
  618. Revision 1.3 1998/11/17 12:16:07 michael
  619. + Fixed copy. Now reference count is correct
  620. Revision 1.2 1998/11/17 11:33:22 peter
  621. + several checks for empty string
  622. Revision 1.1 1998/11/17 10:34:18 michael
  623. + renamed from astrings.pp to astrings.inc
  624. Revision 1.34 1998/11/17 00:41:11 peter
  625. * renamed string functions
  626. Revision 1.33 1998/11/16 15:42:04 peter
  627. + char2ansi
  628. Revision 1.32 1998/11/16 11:11:47 michael
  629. + Fix for Insert and Delete functions
  630. Revision 1.31 1998/11/13 14:37:11 michael
  631. + Insert procedure corrected
  632. Revision 1.30 1998/11/05 14:20:36 peter
  633. * removed warnings
  634. Revision 1.29 1998/11/04 20:34:04 michael
  635. + Removed ifdef useansistrings
  636. Revision 1.28 1998/11/04 15:39:44 michael
  637. + Small fixes to assign and add
  638. Revision 1.27 1998/11/04 10:20:48 peter
  639. * ansistring fixes
  640. Revision 1.26 1998/11/02 09:46:12 michael
  641. + Fix for assign of null string
  642. Revision 1.25 1998/10/30 21:42:48 michael
  643. Fixed assignment of NIL string.
  644. Revision 1.24 1998/10/22 11:32:23 michael
  645. + AssignAnsistring no longer copies constant ansistrings;
  646. + CompareAnsiString is now faster (1 call to length less)
  647. + UniqueAnsiString is fixed.
  648. Revision 1.23 1998/10/21 23:01:54 michael
  649. + Some more corrections
  650. Revision 1.22 1998/10/21 09:03:11 michael
  651. + more fixes so it compiles
  652. Revision 1.21 1998/10/21 08:56:58 michael
  653. + Fix so it compiles
  654. Revision 1.20 1998/10/21 08:38:46 florian
  655. * ansistringconcat fixed
  656. Revision 1.19 1998/10/20 12:46:11 florian
  657. * small fixes to ansicompare
  658. Revision 1.18 1998/09/28 14:02:34 michael
  659. + AnsiString changes
  660. Revision 1.17 1998/09/27 22:44:50 florian
  661. * small fixes
  662. * made UniqueAnsistring public
  663. * ...
  664. Revision 1.16 1998/09/20 17:49:08 florian
  665. * some ansistring fixes
  666. Revision 1.15 1998/09/19 08:33:17 florian
  667. * some internal procedures take now an pointer instead of a
  668. ansistring
  669. Revision 1.14 1998/09/14 10:48:14 peter
  670. * FPC_ names
  671. * Heap manager is now system independent
  672. Revision 1.13 1998/08/23 20:58:51 florian
  673. + rtti for objects and classes
  674. + TObject.GetClassName implemented
  675. Revision 1.12 1998/08/22 09:32:12 michael
  676. + minor fixes typos, and ansi2pchar
  677. Revision 1.11 1998/08/08 12:28:10 florian
  678. * a lot small fixes to the extended data type work
  679. Revision 1.10 1998/07/29 21:44:34 michael
  680. + Implemented reading/writing of ansistrings
  681. Revision 1.9 1998/07/20 23:36:56 michael
  682. changes for ansistrings
  683. Revision 1.8 1998/07/13 21:19:09 florian
  684. * some problems with ansi string support fixed
  685. Revision 1.7 1998/07/06 14:29:08 michael
  686. + Added Public,Alias directives for some calls
  687. Revision 1.6 1998/06/25 08:41:44 florian
  688. * better rtti
  689. Revision 1.5 1998/06/12 07:39:13 michael
  690. + Added aliases for Incr/Decr ref.
  691. Revision 1.4 1998/06/08 19:35:02 michael
  692. Some changes to integrate in system unit
  693. Revision 1.3 1998/06/08 12:38:22 michael
  694. Implemented rtti, inserted ansistrings again
  695. Revision 1.2 1998/05/12 10:42:44 peter
  696. * moved getopts to inc/, all supported OS's need argc,argv exported
  697. + strpas, strlen are now exported in the systemunit
  698. * removed logs
  699. * removed $ifdef ver_above
  700. }