sstrings.inc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {****************************************************************************
  12. subroutines for string handling
  13. ****************************************************************************}
  14. {$I real2str.inc}
  15. function copy(const s : string;index : StrLenInt;count : StrLenInt): string;
  16. begin
  17. if count<0 then
  18. count:=0;
  19. if index>1 then
  20. dec(index)
  21. else
  22. index:=0;
  23. if index>length(s) then
  24. count:=0
  25. else
  26. if index+count>length(s) then
  27. count:=length(s)-index;
  28. Copy[0]:=chr(Count);
  29. Move(s[Index+1],Copy[1],Count);
  30. end;
  31. procedure delete(var s : string;index : StrLenInt;count : StrLenInt);
  32. begin
  33. if index<=0 then
  34. begin
  35. inc(count,index-1);
  36. index:=1;
  37. end;
  38. if (Index<=Length(s)) and (Count>0) then
  39. begin
  40. if Count+Index>length(s) then
  41. Count:=length(s)-Index+1;
  42. s[0]:=Chr(length(s)-Count);
  43. if Index<=Length(s) then
  44. Move(s[Index+Count],s[Index],Length(s)-Index+1);
  45. end;
  46. end;
  47. procedure insert(const source : string;var s : string;index : StrLenInt);
  48. begin
  49. if index>1 then
  50. dec(index)
  51. else
  52. index:=0;
  53. s:=Copy(s,1,Index)+source+Copy(s,Index+1,length(s));
  54. end;
  55. function pos(const substr : string;const s : string): byte;
  56. var
  57. i,j : longint;
  58. e : boolean;
  59. begin
  60. i := 0;
  61. j := 0;
  62. e:=(length(SubStr)>0);
  63. while e and (i<=Length(s)-Length(SubStr)) do
  64. begin
  65. inc(i);
  66. if (SubStr[1]=s[i]) and (Substr=Copy(s,i,Length(SubStr))) then
  67. begin
  68. j:=i;
  69. e:=false;
  70. end;
  71. end;
  72. Pos:=j;
  73. end;
  74. {Faster when looking for a single char...}
  75. function pos(c:char;const s:string):byte;
  76. var
  77. i : longint;
  78. begin
  79. for i:=1 to length(s) do
  80. if s[i]=c then
  81. begin
  82. pos:=i;
  83. exit;
  84. end;
  85. pos:=0;
  86. end;
  87. {$ifdef IBM_CHAR_SET}
  88. const
  89. UpCaseTbl : string[7]=#154#142#153#144#128#143#165;
  90. LoCaseTbl : string[7]=#129#132#148#130#135#134#164;
  91. {$endif}
  92. function upcase(c : char) : char;
  93. {$IFDEF IBM_CHAR_SET}
  94. var
  95. i : longint;
  96. {$ENDIF}
  97. begin
  98. if (c in ['a'..'z']) then
  99. upcase:=char(byte(c)-32)
  100. else
  101. {$IFDEF IBM_CHAR_SET}
  102. begin
  103. i:=Pos(c,LoCaseTbl);
  104. if i>0 then
  105. upcase:=UpCaseTbl[i]
  106. else
  107. upcase:=c;
  108. end;
  109. {$ELSE}
  110. upcase:=c;
  111. {$ENDIF}
  112. end;
  113. function upcase(const s : string) : string;
  114. var
  115. i : longint;
  116. begin
  117. upcase[0]:=s[0];
  118. for i := 1 to length (s) do
  119. upcase[i] := upcase (s[i]);
  120. end;
  121. {$ifndef RTLLITE}
  122. function lowercase(c : char) : char;
  123. {$IFDEF IBM_CHAR_SET}
  124. var
  125. i : longint;
  126. {$ENDIF}
  127. begin
  128. if (c in ['A'..'Z']) then
  129. lowercase:=char(byte(c)+32)
  130. else
  131. {$IFDEF IBM_CHAR_SET}
  132. begin
  133. i:=Pos(c,UpCaseTbl);
  134. if i>0 then
  135. lowercase:=LoCaseTbl[i]
  136. else
  137. lowercase:=c;
  138. end;
  139. {$ELSE}
  140. lowercase:=c;
  141. {$ENDIF}
  142. end;
  143. function lowercase(const s : string) : string;
  144. var
  145. i : longint;
  146. begin
  147. lowercase [0]:=s[0];
  148. for i:=1 to length(s) do
  149. lowercase[i]:=lowercase (s[i]);
  150. end;
  151. function hexstr(val : longint;cnt : byte) : string;
  152. const
  153. HexTbl : array[0..15] of char='0123456789ABCDEF';
  154. var
  155. i : longint;
  156. begin
  157. hexstr[0]:=char(cnt);
  158. for i:=cnt downto 1 do
  159. begin
  160. hexstr[i]:=hextbl[val and $f];
  161. val:=val shr 4;
  162. end;
  163. end;
  164. function binstr(val : longint;cnt : byte) : string;
  165. var
  166. i : longint;
  167. begin
  168. binstr[0]:=char(cnt);
  169. for i:=cnt downto 1 do
  170. begin
  171. binstr[i]:=char(48+val and 1);
  172. val:=val shr 1;
  173. end;
  174. end;
  175. {$endif RTLLITE}
  176. function space (b : byte): string;
  177. begin
  178. space[0] := chr(b);
  179. FillChar (Space[1],b,' ');
  180. end;
  181. {*****************************************************************************
  182. Str() Helpers
  183. *****************************************************************************}
  184. procedure int_str_real(d : real;len,fr : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_REAL'{$else}'STR_REAL'{$endif}];
  185. begin
  186. {$ifdef i386}
  187. str_real(len,fr,d,rt_s64real,s);
  188. {$else}
  189. str_real(len,fr,d,rt_s32real,s);
  190. {$endif}
  191. end;
  192. {$ifdef SUPPORT_SINGLE}
  193. procedure int_str_single(d : single;len,fr : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_SINGLE'{$else}'STR_SINGLE'{$endif}];
  194. begin
  195. str_real(len,fr,d,rt_s32real,s);
  196. end;
  197. {$endif SUPPORT_SINGLE}
  198. {$ifdef SUPPORT_EXTENDED}
  199. procedure int_str_extended(d : extended;len,fr : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_EXTENDED'{$else}'STR_EXTENDED'{$endif}];
  200. begin
  201. str_real(len,fr,d,rt_s80real,s);
  202. end;
  203. {$endif SUPPORT_EXTENDED}
  204. {$ifdef SUPPORT_COMP}
  205. procedure int_str_comp(d : comp;len,fr : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_COMP'{$else}'STR_COMP'{$endif}];
  206. begin
  207. str_real(len,fr,d,rt_s64bit,s);
  208. end;
  209. {$endif SUPPORT_COMP}
  210. {$ifdef SUPPORT_FIXED}
  211. procedure int_str_fixed(d : fixed;len,fr : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_FIXED'{$else}'STR_FIXED'{$endif}];
  212. begin
  213. str_real(len,fr,d,rt_f32bit,s);
  214. end;
  215. {$endif SUPPORT_FIXED}
  216. procedure int_str_longint(v : longint;len : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_LONGINT'{$else}'STR_LONGINT'{$endif}];
  217. begin
  218. int_str(v,s);
  219. if length(s)<len then
  220. s:=space(len-length(s))+s;
  221. end;
  222. procedure int_str_cardinal(v : cardinal;len : longint;var s : string);[public, alias : {$ifdef FPCNAMES}'FPC_STR_CARDINAL'{$else}'STR_CARDINAL'{$endif}];
  223. begin
  224. int_str(v,s);
  225. if length(s)<len then
  226. s:=space(len-length(s))+s;
  227. end;
  228. {*****************************************************************************
  229. Val() Functions
  230. *****************************************************************************}
  231. Function InitVal(const s:string;var negativ:boolean;var base:byte):Word;
  232. var
  233. Code : Longint;
  234. begin
  235. {Skip Spaces and Tab}
  236. code:=1;
  237. while (code<=length(s)) and (s[code] in [' ',#9]) do
  238. inc(code);
  239. {Sign}
  240. negativ:=false;
  241. case s[code] of
  242. '-' : begin
  243. negativ:=true;
  244. inc(code);
  245. end;
  246. '+' : inc(code);
  247. end;
  248. {Base}
  249. base:=10;
  250. if code<=length(s) then
  251. begin
  252. case s[code] of
  253. '$' : begin
  254. base:=16;
  255. repeat
  256. inc(code);
  257. until (code>=length(s)) or (s[code]<>'0');
  258. if length(s)-code>7 then
  259. code:=code+8;
  260. end;
  261. '%' : begin
  262. base:=2;
  263. inc(code);
  264. end;
  265. end;
  266. end;
  267. InitVal:=code;
  268. end;
  269. procedure val(const s : string;var l : longint;var code : word);
  270. var
  271. base,u : byte;
  272. negativ : boolean;
  273. begin
  274. l:=0;
  275. Code:=InitVal(s,negativ,base);
  276. if Code>length(s) then
  277. exit;
  278. if negativ and (s='-2147483648') then
  279. begin
  280. Code:=0;
  281. l:=$80000000;
  282. exit;
  283. end;
  284. while Code<=Length(s) do
  285. begin
  286. u:=ord(s[code]);
  287. case u of
  288. 48..57 : u:=u-48;
  289. 65..70 : u:=u-55;
  290. 97..104 : u:=u-87;
  291. else
  292. u:=16;
  293. end;
  294. l:=l*longint(base);
  295. if (u>=base) or ((base=10) and (2147483647-l<longint(u))) then
  296. begin
  297. l:=0;
  298. exit;
  299. end;
  300. l:=l+u;
  301. inc(code);
  302. end;
  303. code := 0;
  304. if negativ then
  305. l:=0-l;
  306. end;
  307. procedure val(const s : string;var l : longint;var code : integer);
  308. begin
  309. val(s,l,integer(code));
  310. end;
  311. procedure val(const s : string;var l : longint;var code : longint);
  312. var
  313. cw : word;
  314. begin
  315. val (s,l,cw);
  316. code:=cw;
  317. end;
  318. procedure val(const s : string;var l : longint);
  319. var
  320. code : word;
  321. begin
  322. val (s,l,code);
  323. end;
  324. procedure val(const s : string;var b : byte);
  325. var
  326. l : longint;
  327. begin
  328. val(s,l);
  329. b:=l;
  330. end;
  331. procedure val(const s : string;var b : byte;var code : word);
  332. var
  333. l : longint;
  334. begin
  335. val(s,l,code);
  336. b:=l;
  337. end;
  338. procedure val(const s : string;var b : byte;var code : Integer);
  339. begin
  340. val(s,b,word(code));
  341. end;
  342. procedure val(const s : string;var b : byte;var code : longint);
  343. var
  344. l : longint;
  345. begin
  346. val(s,l,code);
  347. b:=l;
  348. end;
  349. procedure val(const s : string;var b : shortint);
  350. var
  351. l : longint;
  352. begin
  353. val(s,l);
  354. b:=l;
  355. end;
  356. procedure val(const s : string;var b : shortint;var code : word);
  357. var
  358. l : longint;
  359. begin
  360. val(s,l,code);
  361. b:=l;
  362. end;
  363. procedure val(const s : string;var b : shortint;var code : Integer);
  364. begin
  365. val(s,b,word(code));
  366. end;
  367. procedure val(const s : string;var b : shortint;var code : longint);
  368. var
  369. l : longint;
  370. begin
  371. val(s,l,code);
  372. b:=l;
  373. end;
  374. procedure val(const s : string;var b : word);
  375. var
  376. l : longint;
  377. begin
  378. val(s,l);
  379. b:=l;
  380. end;
  381. procedure val(const s : string;var b : word;var code : word);
  382. var
  383. l : longint;
  384. begin
  385. val(s,l,code);
  386. b:=l;
  387. end;
  388. procedure val(const s : string;var b : word;var code : Integer);
  389. begin
  390. val(s,b,word(code));
  391. end;
  392. procedure val(const s : string;var b : word;var code : longint);
  393. var
  394. l : longint;
  395. begin
  396. val(s,l,code);
  397. b:=l;
  398. end;
  399. procedure val(const s : string;var b : integer);
  400. var
  401. l : longint;
  402. begin
  403. val(s,l);
  404. b:=l;
  405. end;
  406. procedure val(const s : string;var b : integer;var code : word);
  407. var
  408. l : longint;
  409. begin
  410. val(s,l,code);
  411. b:=l;
  412. end;
  413. procedure val(const s : string;var b : integer;var code : Integer);
  414. begin
  415. val(s,b,word(code));
  416. end;
  417. procedure val(const s : string;var b : integer;var code : longint);
  418. var
  419. l : longint;
  420. begin
  421. val(s,l,code);
  422. b:=l;
  423. end;
  424. procedure val(const s : string;var v : cardinal;var code : word);
  425. var
  426. negativ : boolean;
  427. base,u : byte;
  428. begin
  429. v:=0;
  430. code:=InitVal(s,negativ,base);
  431. if (Code>length(s)) or negativ then
  432. exit;
  433. while Code<=Length(s) do
  434. begin
  435. u:=ord(s[code]);
  436. case u of
  437. 48..57 : u:=u-48;
  438. 65..70 : u:=u-55;
  439. 97..104 : u:=u-87;
  440. else
  441. u:=16;
  442. end;
  443. cardinal(v):=cardinal(v)*cardinal(longint(base));
  444. if (u>base) or (cardinal($ffffffff)-cardinal(v)>cardinal(longint(u))) then
  445. begin
  446. v:=0;
  447. exit;
  448. end;
  449. v:=v+u;
  450. inc(code);
  451. end;
  452. code:=0;
  453. end;
  454. procedure val(const s : string;var v : cardinal);
  455. var
  456. code : word;
  457. begin
  458. val(s,v,code);
  459. end;
  460. procedure val(const s : string;var v : cardinal;var code : integer);
  461. begin
  462. val(s,v,word(code));
  463. end;
  464. procedure val(const s : string;var v : cardinal;var code : longint);
  465. var
  466. cw : word;
  467. begin
  468. val(s,v,cw);
  469. code:=cw;
  470. end;
  471. procedure val(const s : string;var d : valreal;var code : word);
  472. var
  473. hd,
  474. esign,sign : valreal;
  475. exponent,i : longint;
  476. flags : byte;
  477. begin
  478. d:=0;
  479. code:=1;
  480. exponent:=0;
  481. esign:=1;
  482. flags:=0;
  483. sign:=1;
  484. while (code<=length(s)) and (s[code] in [' ',#9]) do
  485. inc(code);
  486. case s[code] of
  487. '+' : inc(code);
  488. '-' : begin
  489. sign:=-1.0;
  490. inc(code);
  491. end;
  492. end;
  493. while (Code<=Length(s)) and (s[code] in ['0'..'9']) do
  494. begin
  495. { Read integer part }
  496. flags:=flags or 1;
  497. d:=d*10;
  498. d:=d+(ord(s[code])-ord('0'));
  499. inc(code);
  500. end;
  501. { Decimal ? }
  502. if (s[code]='.') and (length(s)>=code) then
  503. begin
  504. hd:=0.1;
  505. inc(code);
  506. { After dot, a number is required. }
  507. if not(s[code] in ['0'..'9']) or (length(s)<code) then
  508. begin
  509. d:=0.0;
  510. exit;
  511. end;
  512. while (s[code] in ['0'..'9']) and (length(s)>=code) do
  513. begin
  514. { Read fractional part. }
  515. flags:=flags or 2;
  516. d:=d+hd*(ord(s[code])-ord('0'));
  517. hd:=hd/10.0;
  518. inc(code);
  519. end;
  520. end;
  521. { Again, read integer and fractional part}
  522. if flags=0 then
  523. begin
  524. d:=0.0;
  525. exit;
  526. end;
  527. { Exponent ? }
  528. if (upcase(s[code])='E') and (length(s)>=code) then
  529. begin
  530. inc(code);
  531. if s[code]='+' then
  532. inc(code)
  533. else
  534. if s[code]='-' then
  535. begin
  536. esign:=-1;
  537. inc(code);
  538. end;
  539. if not(s[code] in ['0'..'9']) or (length(s)<code) then
  540. begin
  541. d:=0.0;
  542. exit;
  543. end;
  544. while (s[code] in ['0'..'9']) and (length(s)>=code) do
  545. begin
  546. exponent:=exponent*10;
  547. exponent:=exponent+ord(s[code])-ord('0');
  548. inc(code);
  549. end;
  550. end;
  551. { Calculate Exponent }
  552. if esign>0 then
  553. for i:=1 to exponent do
  554. d:=d*10
  555. else
  556. for i:=1 to exponent do
  557. d:=d/10;
  558. { Not all characters are read ? }
  559. if length(s)>=code then
  560. begin
  561. d:=0.0;
  562. exit;
  563. end;
  564. { evalute sign }
  565. d:=d*sign;
  566. { success ! }
  567. code:=0;
  568. end;
  569. procedure val(const s : string;var d : valreal;var code : integer);
  570. begin
  571. val(s,d,word(code));
  572. end;
  573. procedure val(const s : string;var d : valreal;var code : longint);
  574. var
  575. cw : word;
  576. begin
  577. val(s,d,cw);
  578. code:=cw;
  579. end;
  580. procedure val(const s : string;var d : valreal);
  581. var
  582. code : word;
  583. begin
  584. val(s,d,code);
  585. end;
  586. {$ifdef SUPPORT_SINGLE}
  587. procedure val(const s : string;var d : single;var code : word);
  588. var
  589. e : valreal;
  590. begin
  591. val(s,e,code);
  592. d:=e;
  593. end;
  594. procedure val(const s : string;var d : single;var code : integer);
  595. var
  596. e : valreal;
  597. begin
  598. val(s,e,word(code));
  599. d:=e;
  600. end;
  601. procedure val(const s : string;var d : single;var code : longint);
  602. var
  603. cw : word;
  604. e : valreal;
  605. begin
  606. val(s,e,cw);
  607. d:=e;
  608. code:=cw;
  609. end;
  610. procedure val(const s : string;var d : single);
  611. var
  612. code : word;
  613. e : valreal;
  614. begin
  615. val(s,e,code);
  616. d:=e;
  617. end;
  618. {$endif SUPPORT_SINGLE}
  619. {$ifdef DEFAULT_EXTENDED}
  620. { with extended as default the valreal is extended so for real there need
  621. to be a new val }
  622. procedure val(const s : string;var d : real;var code : word);
  623. var
  624. e : valreal;
  625. begin
  626. val(s,e,code);
  627. d:=e;
  628. end;
  629. procedure val(const s : string;var d : real;var code : integer);
  630. var
  631. e : valreal;
  632. begin
  633. val(s,e,word(code));
  634. d:=e;
  635. end;
  636. procedure val(const s : string;var d : real;var code : longint);
  637. var
  638. cw : word;
  639. e : valreal;
  640. begin
  641. val(s,e,cw);
  642. d:=e;
  643. code:=cw;
  644. end;
  645. procedure val(const s : string;var d : real);
  646. var
  647. code : word;
  648. e : valreal;
  649. begin
  650. val(s,e,code);
  651. d:=e;
  652. end;
  653. {$else DEFAULT_EXTENDED}
  654. { when extended is not the default it could still be supported }
  655. {$ifdef SUPPORT_EXTENDED}
  656. procedure val(const s : string;var d : extended;var code : word);
  657. var
  658. e : valreal;
  659. begin
  660. val(s,e,code);
  661. d:=e;
  662. end;
  663. procedure val(const s : string;var d : extended;var code : integer);
  664. var
  665. e : valreal;
  666. begin
  667. val(s,e,word(code));
  668. d:=e;
  669. end;
  670. procedure val(const s : string;var d : extended;var code : longint);
  671. var
  672. cw : word;
  673. e : valreal;
  674. begin
  675. val(s,e,cw);
  676. d:=e;
  677. code:=cw;
  678. end;
  679. procedure val(const s : string;var d : extended);
  680. var
  681. code : word;
  682. e : valreal;
  683. begin
  684. val(s,e,code);
  685. d:=e;
  686. end;
  687. {$endif SUPPORT_EXTENDED}
  688. {$endif DEFAULT_EXTENDED}
  689. {$ifdef SUPPORT_COMP}
  690. procedure val(const s : string;var d : comp;var code : word);
  691. var
  692. e : valreal;
  693. begin
  694. val(s,e,code);
  695. d:=comp(e);
  696. end;
  697. procedure val(const s : string;var d : comp;var code : integer);
  698. var
  699. e : valreal;
  700. begin
  701. val(s,e,word(code));
  702. d:=comp(e);
  703. end;
  704. procedure val(const s : string;var d : comp;var code : longint);
  705. var
  706. cw : word;
  707. e : valreal;
  708. begin
  709. val(s,e,cw);
  710. d:=comp(e);
  711. code:=cw;
  712. end;
  713. procedure val(const s : string;var d : comp);
  714. var
  715. code : word;
  716. e : valreal;
  717. begin
  718. val(s,e,code);
  719. d:=comp(e);
  720. end;
  721. {$endif SUPPORT_COMP}
  722. {$ifdef SUPPORT_FIXED}
  723. procedure val(const s : string;var d : fixed;var code : word);
  724. var
  725. e : valreal;
  726. begin
  727. val(s,e,code);
  728. d:=fixed(e);
  729. end;
  730. procedure val(const s : string;var d : fixed;var code : integer);
  731. var
  732. e : valreal;
  733. begin
  734. val(s,e,word(code));
  735. d:=fixed(e);
  736. end;
  737. procedure val(const s : string;var d : fixed;var code : longint);
  738. var
  739. cw : word;
  740. e : valreal;
  741. begin
  742. val(s,e,cw);
  743. d:=fixed(e);
  744. code:=cw;
  745. end;
  746. procedure val(const s : string;var d : fixed);
  747. var
  748. code : word;
  749. e : valreal;
  750. begin
  751. val(s,e,code);
  752. d:=fixed(e);
  753. end;
  754. {$endif SUPPORT_FIXED}
  755. {
  756. $Log$
  757. Revision 1.13 1998-10-10 15:28:46 peter
  758. + read single,fixed
  759. + val with code:longint
  760. + val for fixed
  761. Revision 1.12 1998/09/14 10:48:19 peter
  762. * FPC_ names
  763. * Heap manager is now system independent
  764. Revision 1.11 1998/08/11 21:39:07 peter
  765. * splitted default_extended from support_extended
  766. Revision 1.10 1998/08/08 12:28:13 florian
  767. * a lot small fixes to the extended data type work
  768. Revision 1.9 1998/07/18 17:14:23 florian
  769. * strlenint type implemented
  770. Revision 1.8 1998/07/10 11:02:38 peter
  771. * support_fixed, becuase fixed is not 100% yet for the m68k
  772. Revision 1.7 1998/07/02 12:14:19 carl
  773. * No SINGLE type for non-intel processors!!
  774. Revision 1.6 1998/06/25 09:44:19 daniel
  775. + RTLLITE directive to compile minimal RTL.
  776. Revision 1.5 1998/06/04 23:45:59 peter
  777. * comp,extended are only i386 added support_comp,support_extended
  778. Revision 1.4 1998/05/31 14:14:52 peter
  779. * removed warnings using comp()
  780. Revision 1.3 1998/05/12 10:42:45 peter
  781. * moved getopts to inc/, all supported OS's need argc,argv exported
  782. + strpas, strlen are now exported in the systemunit
  783. * removed logs
  784. * removed $ifdef ver_above
  785. }