text.inc 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395
  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. Possible Defines:
  13. EOF_CTRLZ Is Ctrl-Z (#26) a EOF mark for textfiles
  14. SHORT_LINEBREAK Use short Linebreaks #10 instead of #10#13
  15. SHORT_LINEBREAK is defined in the Linux system unit (syslinux.pp)
  16. }
  17. {****************************************************************************
  18. subroutines For TextFile handling
  19. ****************************************************************************}
  20. Procedure FileCloseFunc(Var t:TextRec);
  21. Begin
  22. Do_Close(t.Handle);
  23. t.Handle:=UnusedHandle;
  24. End;
  25. Procedure FileReadFunc(var t:TextRec);
  26. Begin
  27. t.BufEnd:=Do_Read(t.Handle,Longint(t.Bufptr),t.BufSize);
  28. t.BufPos:=0;
  29. End;
  30. Procedure FileWriteFunc(var t:TextRec);
  31. Begin
  32. Do_Write(t.Handle,Longint(t.Bufptr),t.BufPos);
  33. t.BufPos:=0;
  34. End;
  35. Procedure FileOpenFunc(var t:TextRec);
  36. var
  37. Flags : Longint;
  38. Begin
  39. Case t.mode Of
  40. fmInput : Flags:=$1000;
  41. fmOutput : Flags:=$1101;
  42. fmAppend : Flags:=$1011;
  43. else
  44. begin
  45. InOutRes:=102;
  46. exit;
  47. end;
  48. End;
  49. Do_Open(t,PChar(@t.Name),Flags);
  50. t.CloseFunc:=@FileCloseFunc;
  51. t.FlushFunc:=nil;
  52. if t.Mode=fmInput then
  53. t.InOutFunc:=@FileReadFunc
  54. else
  55. begin
  56. t.InOutFunc:=@FileWriteFunc;
  57. { Only install flushing if its a NOT a file }
  58. if Do_Isdevice(t.Handle) then
  59. t.FlushFunc:=@FileWriteFunc;
  60. end;
  61. End;
  62. Procedure assign(var t:Text;const s:String);
  63. Begin
  64. FillChar(t,SizEof(TextRec),0);
  65. { only set things that are not zero }
  66. TextRec(t).Handle:=UnusedHandle;
  67. TextRec(t).mode:=fmClosed;
  68. TextRec(t).BufSize:=TextRecBufSize;
  69. TextRec(t).Bufptr:=@TextRec(t).Buffer;
  70. TextRec(t).OpenFunc:=@FileOpenFunc;
  71. Move(s[1],TextRec(t).Name,Length(s));
  72. End;
  73. Procedure assign(var t:Text;p:pchar);
  74. begin
  75. Assign(t,StrPas(p));
  76. end;
  77. Procedure assign(var t:Text;c:char);
  78. begin
  79. Assign(t,string(c));
  80. end;
  81. Procedure Close(var t : Text);[IOCheck];
  82. Begin
  83. if InOutRes<>0 then
  84. Exit;
  85. If (TextRec(t).mode<>fmClosed) Then
  86. Begin
  87. { Write pending buffer }
  88. If Textrec(t).Mode=fmoutput then
  89. FileFunc(TextRec(t).InOutFunc)(TextRec(t));
  90. TextRec(t).mode:=fmClosed;
  91. { Only close functions not connected to stdout.}
  92. If ((TextRec(t).Handle<>StdInputHandle) and
  93. (TextRec(t).Handle<>StdOutputHandle) and
  94. (TextRec(t).Handle<>StdErrorHandle)) Then
  95. FileFunc(TextRec(t).CloseFunc)(TextRec(t));
  96. { Reset buffer for safety }
  97. TextRec(t).BufPos:=0;
  98. TextRec(t).BufEnd:=0;
  99. End;
  100. End;
  101. Procedure OpenText(var t : Text;mode,defHdl:Longint);
  102. Begin
  103. Case TextRec(t).mode Of {This gives the fastest code}
  104. fmInput,fmOutput,fmInOut : Close(t);
  105. fmClosed : ;
  106. else
  107. Begin
  108. InOutRes:=102;
  109. exit;
  110. End;
  111. End;
  112. TextRec(t).mode:=mode;
  113. TextRec(t).bufpos:=0;
  114. TextRec(t).bufend:=0;
  115. FileFunc(TextRec(t).OpenFunc)(TextRec(t));
  116. { reset the mode to closed when an error has occured }
  117. if InOutRes<>0 then
  118. TextRec(t).mode:=fmClosed;
  119. End;
  120. Procedure Rewrite(var t : Text);[IOCheck];
  121. Begin
  122. If InOutRes<>0 then
  123. exit;
  124. OpenText(t,fmOutput,1);
  125. End;
  126. Procedure Reset(var t : Text);[IOCheck];
  127. Begin
  128. If InOutRes<>0 then
  129. exit;
  130. OpenText(t,fmInput,0);
  131. End;
  132. Procedure Append(var t : Text);[IOCheck];
  133. Begin
  134. If InOutRes<>0 then
  135. exit;
  136. OpenText(t,fmAppend,1);
  137. End;
  138. Procedure Flush(var t : Text);[IOCheck];
  139. Begin
  140. If InOutRes<>0 then
  141. exit;
  142. If TextRec(t).mode<>fmOutput Then
  143. begin
  144. InOutres:=105;
  145. exit;
  146. end;
  147. { Not the flushfunc but the inoutfunc should be used, becuase that
  148. writes the data, flushfunc doesn't need to be assigned }
  149. FileFunc(TextRec(t).InOutFunc)(TextRec(t));
  150. End;
  151. Procedure Erase(var t:Text);[IOCheck];
  152. Begin
  153. If InOutRes <> 0 then
  154. exit;
  155. If TextRec(t).mode=fmClosed Then
  156. Do_Erase(PChar(@TextRec(t).Name));
  157. End;
  158. Procedure Rename(var t : text;p:pchar);[IOCheck];
  159. Begin
  160. If InOutRes <> 0 then
  161. exit;
  162. If TextRec(t).mode=fmClosed Then
  163. Begin
  164. Do_Rename(PChar(@TextRec(t).Name),p);
  165. Move(p^,TextRec(t).Name,StrLen(p)+1);
  166. End;
  167. End;
  168. Procedure Rename(var t : Text;const s : string);[IOCheck];
  169. var
  170. p : array[0..255] Of Char;
  171. Begin
  172. If InOutRes <> 0 then
  173. exit;
  174. Move(s[1],p,Length(s));
  175. p[Length(s)]:=#0;
  176. Rename(t,Pchar(@p));
  177. End;
  178. Procedure Rename(var t : Text;c : char);[IOCheck];
  179. var
  180. p : array[0..1] Of Char;
  181. Begin
  182. If InOutRes <> 0 then
  183. exit;
  184. p[0]:=c;
  185. p[1]:=#0;
  186. Rename(t,Pchar(@p));
  187. End;
  188. Function Eof(Var t: Text): Boolean;[IOCheck];
  189. Begin
  190. If (InOutRes<>0) then
  191. exit(true);
  192. if (TextRec(t).mode<>fmInput) Then
  193. begin
  194. InOutRes:=104;
  195. exit(true);
  196. end;
  197. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  198. begin
  199. FileFunc(TextRec(t).InOutFunc)(TextRec(t));
  200. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  201. exit(true);
  202. end;
  203. {$ifdef EOF_CTRLZ}
  204. Eof:=(TextRec(t).Bufptr^[TextRec(t).BufPos]=#26);
  205. {$else}
  206. Eof:=false;
  207. {$endif EOL_CTRLZ}
  208. end;
  209. Function Eof:Boolean;
  210. Begin
  211. Eof:=Eof(Input);
  212. End;
  213. Function SeekEof (Var t : Text) : Boolean;
  214. Begin
  215. If (InOutRes<>0) then
  216. exit(true);
  217. if (TextRec(t).mode<>fmInput) Then
  218. begin
  219. InOutRes:=104;
  220. exit(true);
  221. end;
  222. repeat
  223. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  224. begin
  225. FileFunc(TextRec(t).InOutFunc)(TextRec(t));
  226. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  227. exit(true);
  228. end;
  229. case TextRec(t).Bufptr^[TextRec(t).BufPos] of
  230. #26 : exit(true);
  231. #10,#13,
  232. #9,' ' : ;
  233. else
  234. exit(false);
  235. end;
  236. inc(TextRec(t).BufPos);
  237. until false;
  238. End;
  239. Function SeekEof : Boolean;
  240. Begin
  241. SeekEof:=SeekEof(Input);
  242. End;
  243. Function Eoln(var t:Text) : Boolean;
  244. Begin
  245. If (InOutRes<>0) then
  246. exit(true);
  247. if (TextRec(t).mode<>fmInput) Then
  248. begin
  249. InOutRes:=104;
  250. exit(true);
  251. end;
  252. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  253. begin
  254. FileFunc(TextRec(t).InOutFunc)(TextRec(t));
  255. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  256. exit(true);
  257. end;
  258. Eoln:=(TextRec(t).Bufptr^[TextRec(t).BufPos] in [#10,#13]);
  259. End;
  260. Function Eoln : Boolean;
  261. Begin
  262. Eoln:=Eoln(Input);
  263. End;
  264. Function SeekEoln (Var t : Text) : Boolean;
  265. Begin
  266. If (InOutRes<>0) then
  267. exit(true);
  268. if (TextRec(t).mode<>fmInput) Then
  269. begin
  270. InOutRes:=104;
  271. exit(true);
  272. end;
  273. repeat
  274. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  275. begin
  276. FileFunc(TextRec(t).InOutFunc)(TextRec(t));
  277. If TextRec(t).BufPos>=TextRec(t).BufEnd Then
  278. exit(true);
  279. end;
  280. case TextRec(t).Bufptr^[TextRec(t).BufPos] of
  281. #26,
  282. #10,#13 : exit(true);
  283. #9,' ' : ;
  284. else
  285. exit(false);
  286. end;
  287. inc(TextRec(t).BufPos);
  288. until false;
  289. End;
  290. Function SeekEoln : Boolean;
  291. Begin
  292. SeekEoln:=SeekEoln(Input);
  293. End;
  294. Procedure SetTextBuf(Var F : Text; Var Buf);[INTERNPROC: In_settextbuf_file_x];
  295. Procedure SetTextBuf(Var F : Text; Var Buf; Size : Word);
  296. Begin
  297. TextRec(f).BufPtr:=@Buf;
  298. TextRec(f).BufSize:=Size;
  299. TextRec(f).BufPos:=0;
  300. TextRec(f).BufEnd:=0;
  301. End;
  302. {*****************************************************************************
  303. Write(Ln)
  304. *****************************************************************************}
  305. Procedure WriteBuffer(var f:TextRec;var b;len:longint);
  306. var
  307. p : pchar;
  308. left,
  309. idx : longint;
  310. begin
  311. p:=pchar(@b);
  312. idx:=0;
  313. left:=f.BufSize-f.BufPos;
  314. while len>left do
  315. begin
  316. move(p[idx],f.Bufptr^[f.BufPos],left);
  317. dec(len,left);
  318. inc(idx,left);
  319. inc(f.BufPos,left);
  320. FileFunc(f.InOutFunc)(f);
  321. left:=f.BufSize-f.BufPos;
  322. end;
  323. move(p[idx],f.Bufptr^[f.BufPos],len);
  324. inc(f.BufPos,len);
  325. end;
  326. Procedure WriteBlanks(var f:TextRec;len:longint);
  327. var
  328. left : longint;
  329. begin
  330. left:=f.BufSize-f.BufPos;
  331. while len>left do
  332. begin
  333. FillChar(f.Bufptr^[f.BufPos],left,' ');
  334. dec(len,left);
  335. inc(f.BufPos,left);
  336. FileFunc(f.InOutFunc)(f);
  337. left:=f.BufSize-f.BufPos;
  338. end;
  339. FillChar(f.Bufptr^[f.BufPos],len,' ');
  340. inc(f.BufPos,len);
  341. end;
  342. Procedure Write_End(var f:TextRec);[Public,Alias:'FPC_WRITE_END'];
  343. begin
  344. if f.FlushFunc<>nil then
  345. FileFunc(f.FlushFunc)(f);
  346. end;
  347. Procedure Writeln_End(var f:TextRec);[Public,Alias:'FPC_WRITELN_END'];
  348. const
  349. {$IFDEF SHORT_LINEBREAK}
  350. eollen=1;
  351. eol : array[0..0] of char=(#10);
  352. {$ELSE SHORT_LINEBREAK}
  353. eollen=2;
  354. eol : array[0..1] of char=(#13,#10);
  355. {$ENDIF SHORT_LINEBREAK}
  356. begin
  357. If InOutRes <> 0 then exit;
  358. { Write EOL }
  359. WriteBuffer(f,eol,eollen);
  360. { Flush }
  361. if f.FlushFunc<>nil then
  362. FileFunc(f.FlushFunc)(f);
  363. end;
  364. Procedure Write_Str(Len : Longint;var f : TextRec;const s : String);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef NEWREADINT}'SHORTSTR'{$else}'STRING'{$endif}];
  365. Begin
  366. If (InOutRes<>0) then
  367. exit;
  368. if (f.mode<>fmOutput) Then
  369. begin
  370. InOutRes:=105;
  371. exit;
  372. end;
  373. If Len>Length(s) Then
  374. WriteBlanks(f,Len-Length(s));
  375. WriteBuffer(f,s[1],Length(s));
  376. End;
  377. {$ifndef NEWWRITEARRAY}
  378. type
  379. array00=array[0..0] of char;
  380. {$endif}
  381. Procedure Write_Array(Len : Longint;var f : TextRec;const s : {$ifdef NEWWRITEARRAY} array of char{$else}array00{$endif});[Public,Alias:'FPC_WRITE_TEXT_PCHAR_AS_ARRAY'];
  382. var
  383. ArrayLen : longint;
  384. p : pchar;
  385. Begin
  386. If (InOutRes<>0) then
  387. exit;
  388. if (f.mode<>fmOutput) Then
  389. begin
  390. InOutRes:=105;
  391. exit;
  392. end;
  393. p:=pchar(@s);
  394. ArrayLen:=StrLen(p);
  395. if ArrayLen>high(s) then
  396. ArrayLen:=high(s);
  397. If Len>ArrayLen Then
  398. WriteBlanks(f,Len-ArrayLen);
  399. WriteBuffer(f,p^,ArrayLen);
  400. End;
  401. Procedure Write_PChar(Len : Longint;var f : TextRec;p : PChar);[Public,Alias:'FPC_WRITE_TEXT_PCHAR_AS_POINTER'];
  402. var
  403. PCharLen : longint;
  404. Begin
  405. If (p=nil) or (InOutRes<>0) then
  406. exit;
  407. if (f.mode<>fmOutput) Then
  408. begin
  409. InOutRes:=105;
  410. exit;
  411. end;
  412. PCharLen:=StrLen(p);
  413. If Len>PCharLen Then
  414. WriteBlanks(f,Len-PCharLen);
  415. WriteBuffer(f,p^,PCharLen);
  416. End;
  417. Procedure Write_Text_AnsiString (Len : Longint; Var T : TextRec; S : Pointer);[Public,alias:'FPC_WRITE_TEXT_'+{$ifdef NEWREADINT}'ANSISTR'{$else}'ANSISTRING'{$endif}];
  418. {
  419. Writes a AnsiString to the Text file T
  420. }
  421. begin
  422. If S=Nil then
  423. exit;
  424. Write_pchar (Len,t,PChar(S));
  425. end;
  426. Procedure Write_SInt(Len : Longint;var t : TextRec;l : ValSInt);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef NEWREADINT}'SINT'{$else}'LONGINT'{$endif}];
  427. var
  428. s : String;
  429. Begin
  430. If (InOutRes<>0) then
  431. exit;
  432. Str(l,s);
  433. Write_Str(Len,t,s);
  434. End;
  435. Procedure Write_UInt(Len : Longint;var t : TextRec;l : ValUInt);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef NEWREADINT}'UINT'{$else}'CARDINAL'{$endif}];
  436. var
  437. s : String;
  438. Begin
  439. If (InOutRes<>0) then
  440. exit;
  441. Str(L,s);
  442. Write_Str(Len,t,s);
  443. End;
  444. {$ifdef INTERNDOUBLE}
  445. Procedure Write_Float(rt,fixkomma,Len : Longint;var t : TextRec;r : ValReal);[Public,Alias:'FPC_WRITE_TEXT_FLOAT'];
  446. var
  447. s : String;
  448. Begin
  449. If (InOutRes<>0) then
  450. exit;
  451. Str_real(Len,fixkomma,r,treal_type(rt),s);
  452. Write_Str(Len,t,s);
  453. End;
  454. {$else INTERNDOUBLE}
  455. {$ifdef SUPPORT_SINGLE}
  456. Procedure Write_S32Real(fixkomma,Len : Longint;var t : TextRec;r : single);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef INTERNDOUBLE}'S32REAL'{$else}'SINGLE'{$endif}];
  457. var
  458. s : String;
  459. Begin
  460. If (InOutRes<>0) then
  461. exit;
  462. Str_real(Len,fixkomma,r,rt_s32real,s);
  463. Write_Str(Len,t,s);
  464. End;
  465. {$endif SUPPORT_S32REAL}
  466. {$ifdef SUPPORT_DOUBLE}
  467. Procedure Write_s64Real(fixkomma,Len : Longint;var t : TextRec;r : double);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef INTERNDOUBLE}'S64'{$endif}+'REAL'];
  468. var
  469. s : String;
  470. Begin
  471. If (InOutRes<>0) then
  472. exit;
  473. Str_real(Len,fixkomma,r,rt_s64real,s);
  474. Write_Str(Len,t,s);
  475. End;
  476. {$endif SUPPORT_S64REAL}
  477. {$ifdef SUPPORT_EXTENDED}
  478. Procedure Write_S80Real(fixkomma,Len : Longint;var t : TextRec;r : extended);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef INTERNDOUBLE}'S80REAL'{$else}'EXTENDED'{$endif}];
  479. var
  480. s : String;
  481. Begin
  482. If (InOutRes<>0) then
  483. exit;
  484. Str_real(Len,fixkomma,r,rt_s80real,s);
  485. Write_Str(Len,t,s);
  486. End;
  487. {$endif SUPPORT_S80REAL}
  488. {$ifdef SUPPORT_COMP}
  489. Procedure Write_C64Bit(fixkomma,Len : Longint;var t : TextRec;r : comp);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef INTERNDOUBLE}'C64BIT'{$else}'COMP'{$endif}];
  490. var
  491. s : String;
  492. Begin
  493. If (InOutRes<>0) then
  494. exit;
  495. Str_real(Len,fixkomma,r,rt_c64bit,s);
  496. Write_Str(Len,t,s);
  497. End;
  498. {$endif SUPPORT_C64BIT}
  499. {$ifdef SUPPORT_FIXED}
  500. Procedure Write_Fixed(fixkomma,Len : Longint;var t : TextRec;r : fixed16);[Public,Alias:'FPC_WRITE_TEXT_'+{$ifdef INTERNDOUBLE}'F16BIT'{$else}'FIXED'{$endif}];
  501. var
  502. s : String;
  503. Begin
  504. If (InOutRes<>0) then
  505. exit;
  506. Str_real(Len,fixkomma,r,rt_f32bit,s);
  507. Write_Str(Len,t,s);
  508. End;
  509. {$endif SUPPORT_F16BIT}
  510. {$endif INTERNDOUBLE}
  511. Procedure Write_Boolean(Len : Longint;var t : TextRec;b : Boolean);[Public,Alias:'FPC_WRITE_TEXT_BOOLEAN'];
  512. Begin
  513. If (InOutRes<>0) then
  514. exit;
  515. { Can't use array[boolean] because b can be >0 ! }
  516. if b then
  517. Write_Str(Len,t,'TRUE')
  518. else
  519. Write_Str(Len,t,'FALSE');
  520. End;
  521. Procedure Write_Char(Len : Longint;var t : TextRec;c : Char);[Public,Alias:'FPC_WRITE_TEXT_CHAR'];
  522. Begin
  523. If (InOutRes<>0) then
  524. exit;
  525. if (TextRec(t).mode<>fmOutput) Then
  526. begin
  527. InOutRes:=105;
  528. exit;
  529. end;
  530. If Len>1 Then
  531. WriteBlanks(t,Len-1);
  532. If t.BufPos+1>=t.BufSize Then
  533. FileFunc(t.InOutFunc)(t);
  534. t.Bufptr^[t.BufPos]:=c;
  535. Inc(t.BufPos);
  536. End;
  537. {*****************************************************************************
  538. Read(Ln)
  539. *****************************************************************************}
  540. Function NextChar(var f:TextRec;var s:string):Boolean;
  541. begin
  542. if f.BufPos<f.BufEnd then
  543. begin
  544. s:=s+f.BufPtr^[f.BufPos];
  545. Inc(f.BufPos);
  546. If f.BufPos>=f.BufEnd Then
  547. FileFunc(f.InOutFunc)(f);
  548. NextChar:=true;
  549. end
  550. else
  551. NextChar:=false;
  552. end;
  553. Function IgnoreSpaces(var f:TextRec):Boolean;
  554. {
  555. Removes all leading spaces,tab,eols from the input buffer, returns true if
  556. the buffer is empty
  557. }
  558. var
  559. s : string;
  560. begin
  561. s:='';
  562. IgnoreSpaces:=false;
  563. while f.Bufptr^[f.BufPos] in [#9,#10,#13,' '] do
  564. if not NextChar(f,s) then
  565. exit;
  566. IgnoreSpaces:=true;
  567. end;
  568. Function ReadSign(var f:TextRec;var s:string):Boolean;
  569. {
  570. Read + and - sign, return true if buffer is empty
  571. }
  572. begin
  573. ReadSign:=(not (f.Bufptr^[f.BufPos] in ['-','+'])) or NextChar(f,s);
  574. end;
  575. Function ReadBase(var f:TextRec;var s:string;var Base:longint):boolean;
  576. {
  577. Read the base $ For 16 and % For 2, if buffer is empty return true
  578. }
  579. begin
  580. case f.BufPtr^[f.BufPos] of
  581. '$' : Base:=16;
  582. '%' : Base:=2;
  583. else
  584. Base:=10;
  585. end;
  586. ReadBase:=(Base=10) or NextChar(f,s);
  587. end;
  588. Function ReadNumeric(var f:TextRec;var s:string;base:longint):Boolean;
  589. {
  590. Read numeric input, if buffer is empty then return True
  591. }
  592. var
  593. c : char;
  594. begin
  595. ReadNumeric:=false;
  596. c:=f.BufPtr^[f.BufPos];
  597. while ((base>=10) and (c in ['0'..'9'])) or
  598. ((base=16) and (c in ['A'..'F','a'..'f'])) or
  599. ((base=2) and (c in ['0'..'1'])) do
  600. begin
  601. if not NextChar(f,s) then
  602. exit;
  603. c:=f.BufPtr^[f.BufPos];
  604. end;
  605. ReadNumeric:=true;
  606. end;
  607. Procedure Read_End(var f:TextRec);[Public,Alias:'FPC_READ_END'];
  608. begin
  609. if f.FlushFunc<>nil then
  610. FileFunc(f.FlushFunc)(f);
  611. end;
  612. Procedure ReadLn_End(var f : TextRec);[Public,Alias:'FPC_READLN_END'];
  613. Begin
  614. { Check error and if file is open and load buf if empty }
  615. If (InOutRes<>0) then
  616. exit;
  617. if (f.mode<>fmInput) Then
  618. begin
  619. InOutRes:=104;
  620. exit;
  621. end;
  622. repeat
  623. If f.BufPos>=f.BufEnd Then
  624. begin
  625. FileFunc(f.InOutFunc)(f);
  626. if f.BufPos>=f.BufEnd then
  627. break;
  628. end;
  629. inc(f.BufPos);
  630. if (f.BufPtr^[f.BufPos-1]=#10) then
  631. exit;
  632. until false;
  633. { Flush if set }
  634. if f.FlushFunc<>nil then
  635. FileFunc(f.FlushFunc)(f);
  636. End;
  637. Function ReadPCharLen(var f:TextRec;s:pchar;maxlen:longint):longint;
  638. var
  639. sPos,len : Longint;
  640. p,startp,maxp : pchar;
  641. Begin
  642. ReadPCharLen:=0;
  643. { Check error and if file is open }
  644. If (InOutRes<>0) then
  645. exit;
  646. if (f.mode<>fmInput) Then
  647. begin
  648. InOutRes:=104;
  649. exit;
  650. end;
  651. { Read maximal until Maxlen is reached }
  652. sPos:=0;
  653. repeat
  654. If f.BufPos>=f.BufEnd Then
  655. begin
  656. FileFunc(f.InOutFunc)(f);
  657. If f.BufPos>=f.BufEnd Then
  658. break;
  659. end;
  660. p:[email protected]^[f.BufPos];
  661. if SPos+f.BufEnd-f.BufPos>MaxLen then
  662. maxp:[email protected]^[f.BufPos+MaxLen-SPos]
  663. else
  664. maxp:[email protected]^[f.BufEnd];
  665. startp:=p;
  666. { search linefeed }
  667. while (p<maxp) and (P^<>#10) do
  668. inc(p);
  669. { calculate read bytes }
  670. len:=p-startp;
  671. inc(f.BufPos,Len);
  672. Move(startp^,s[sPos],Len);
  673. inc(sPos,Len);
  674. { was it a LF? then leave }
  675. if (p<maxp) and (p^=#10) then
  676. begin
  677. if (spos>0) and (s[spos-1]=#13) then
  678. dec(sPos);
  679. break;
  680. end;
  681. { Maxlen reached ? }
  682. if spos=MaxLen then
  683. break;
  684. until false;
  685. ReadPCharLen:=spos;
  686. End;
  687. Procedure Read_String(var f : TextRec;var s : String);[Public,Alias:'FPC_READ_TEXT_'+{$ifdef NEWREADINT}'SHORTSTR'{$else}'STRING'{$endif}];
  688. Begin
  689. s[0]:=chr(ReadPCharLen(f,pchar(@s[1]),high(s)));
  690. End;
  691. Procedure Read_PChar(var f : TextRec;var s : PChar);[Public,Alias:'FPC_READ_TEXT_PCHAR_AS_POINTER'];
  692. Begin
  693. pchar(s+ReadPCharLen(f,s,$7fffffff))^:=#0;
  694. End;
  695. Procedure Read_Array(var f : TextRec;var s : {$ifdef NEWWRITEARRAY}array of char{$else}array00{$endif});[Public,Alias:'FPC_READ_TEXT_PCHAR_AS_ARRAY'];
  696. Begin
  697. pchar(pchar(@s)+ReadPCharLen(f,pchar(@s),{$ifdef NEWWRITEARRAY}high(s){$else}$7fffffff{$endif}))^:=#0;
  698. End;
  699. Procedure Read_AnsiString(var f : TextRec;var s : AnsiString);[Public,Alias:'FPC_READ_TEXT_'+{$ifdef NEWREADINT}'ANSISTR'{$else}'ANSISTRING'{$endif}];
  700. var
  701. len : longint;
  702. Begin
  703. { Delete the string }
  704. Setlength(S,0);
  705. Repeat
  706. // SetLength will reallocate the length.
  707. SetLength(S,Length(S)+255);
  708. len:=ReadPCharLen(f,pchar(Pointer(S)+Length(S)-255),255);
  709. If Len<255 then
  710. // Set actual length
  711. SetLength(S,Length(S)-255+Len);
  712. Until len<255;
  713. End;
  714. {$ifdef NEWREADINT}
  715. Function Read_Char(var f : TextRec):char;[Public,Alias:'FPC_READ_TEXT_CHAR'];
  716. Begin
  717. Read_Char:=#0;
  718. { Check error and if file is open }
  719. If (InOutRes<>0) then
  720. exit;
  721. if (f.mode<>fmInput) Then
  722. begin
  723. InOutRes:=104;
  724. exit;
  725. end;
  726. { Read next char or EOF }
  727. If f.BufPos>=f.BufEnd Then
  728. begin
  729. FileFunc(f.InOutFunc)(f);
  730. If f.BufPos>=f.BufEnd Then
  731. exit(#26);
  732. end;
  733. Read_Char:=f.Bufptr^[f.BufPos];
  734. inc(f.BufPos);
  735. end;
  736. Function Read_SInt(var f : TextRec):ValSInt;[Public,Alias:'FPC_READ_TEXT_SINT'];
  737. var
  738. hs : String;
  739. code : Longint;
  740. base : longint;
  741. Begin
  742. Read_SInt:=0;
  743. { Leave if error or not open file, else check for empty buf }
  744. If (InOutRes<>0) then
  745. exit;
  746. if (f.mode<>fmInput) Then
  747. begin
  748. InOutRes:=104;
  749. exit;
  750. end;
  751. If f.BufPos>=f.BufEnd Then
  752. FileFunc(f.InOutFunc)(f);
  753. hs:='';
  754. if IgnoreSpaces(f) and ReadSign(f,hs) and ReadBase(f,hs,Base) then
  755. ReadNumeric(f,hs,Base);
  756. Val(hs,Read_SInt,code);
  757. If code<>0 Then
  758. InOutRes:=106;
  759. End;
  760. Function Read_UInt(var f : TextRec):ValUInt;[Public,Alias:'FPC_READ_TEXT_UINT'];
  761. var
  762. hs : String;
  763. code : longint;
  764. base : longint;
  765. Begin
  766. Read_UInt:=0;
  767. { Leave if error or not open file, else check for empty buf }
  768. If (InOutRes<>0) then
  769. exit;
  770. if (f.mode<>fmInput) Then
  771. begin
  772. InOutRes:=104;
  773. exit;
  774. end;
  775. If f.BufPos>=f.BufEnd Then
  776. FileFunc(f.InOutFunc)(f);
  777. hs:='';
  778. if IgnoreSpaces(f) and ReadSign(f,hs) and ReadBase(f,hs,Base) then
  779. ReadNumeric(f,hs,Base);
  780. val(hs,Read_UInt,code);
  781. If code<>0 Then
  782. InOutRes:=106;
  783. End;
  784. Function Read_Float(var f : TextRec):ValReal;[Public,Alias:'FPC_READ_TEXT_FLOAT'];
  785. var
  786. hs : string;
  787. code : Word;
  788. begin
  789. Read_Float:=0.0;
  790. { Leave if error or not open file, else check for empty buf }
  791. If (InOutRes<>0) then
  792. exit;
  793. if (f.mode<>fmInput) Then
  794. begin
  795. InOutRes:=104;
  796. exit;
  797. end;
  798. If f.BufPos>=f.BufEnd Then
  799. FileFunc(f.InOutFunc)(f);
  800. hs:='';
  801. if IgnoreSpaces(f) and ReadSign(f,hs) and ReadNumeric(f,hs,10) then
  802. begin
  803. { First check for a . }
  804. if (f.Bufptr^[f.BufPos]='.') and (f.BufPos<f.BufEnd) Then
  805. begin
  806. hs:=hs+'.';
  807. Inc(f.BufPos);
  808. If f.BufPos>=f.BufEnd Then
  809. FileFunc(f.InOutFunc)(f);
  810. ReadNumeric(f,hs,10);
  811. end;
  812. { Also when a point is found check for a E }
  813. if (f.Bufptr^[f.BufPos] in ['e','E']) and (f.BufPos<f.BufEnd) Then
  814. begin
  815. hs:=hs+'E';
  816. Inc(f.BufPos);
  817. If f.BufPos>=f.BufEnd Then
  818. FileFunc(f.InOutFunc)(f);
  819. if ReadSign(f,hs) then
  820. ReadNumeric(f,hs,10);
  821. end;
  822. end;
  823. val(hs,Read_Float,code);
  824. If code<>0 Then
  825. InOutRes:=106;
  826. end;
  827. {$else}
  828. Procedure Read_Char(var f : TextRec;var c : Char);[Public,Alias:'FPC_READ_TEXT_CHAR'];
  829. Begin
  830. c:=#0;
  831. { Check error and if file is open }
  832. If (InOutRes<>0) then
  833. exit;
  834. if (f.mode<>fmInput) Then
  835. begin
  836. InOutRes:=104;
  837. exit;
  838. end;
  839. { Read next char or EOF }
  840. If f.BufPos>=f.BufEnd Then
  841. begin
  842. FileFunc(f.InOutFunc)(f);
  843. If f.BufPos>=f.BufEnd Then
  844. begin
  845. c:=#26;
  846. exit;
  847. end;
  848. end;
  849. c:=f.Bufptr^[f.BufPos];
  850. inc(f.BufPos);
  851. end;
  852. Procedure Read_Longint(var f : TextRec;var l : Longint);[Public,Alias:'FPC_READ_TEXT_LONGINT'];
  853. var
  854. hs : String;
  855. code : Longint;
  856. base : longint;
  857. Begin
  858. l:=0;
  859. { Leave if error or not open file, else check for empty buf }
  860. If (InOutRes<>0) then
  861. exit;
  862. if (f.mode<>fmInput) Then
  863. begin
  864. InOutRes:=104;
  865. exit;
  866. end;
  867. If f.BufPos>=f.BufEnd Then
  868. FileFunc(f.InOutFunc)(f);
  869. hs:='';
  870. if IgnoreSpaces(f) and ReadSign(f,hs) and ReadBase(f,hs,Base) then
  871. ReadNumeric(f,hs,Base);
  872. Val(hs,l,code);
  873. If code<>0 Then
  874. InOutRes:=106;
  875. End;
  876. Procedure Read_Integer(var f : TextRec;var l : Integer);[Public,Alias:'FPC_READ_TEXT_INTEGER'];
  877. var
  878. ll : Longint;
  879. Begin
  880. l:=0;
  881. If InOutRes <> 0 then
  882. exit;
  883. Read_Longint(f,ll);
  884. If (ll<-32768) or (ll>32767) Then
  885. InOutRes:=201
  886. else
  887. l:=ll;
  888. End;
  889. Procedure Read_Word(var f : TextRec;var l : Word);[Public,Alias:'FPC_READ_TEXT_WORD'];
  890. var
  891. ll : Longint;
  892. Begin
  893. l:=0;
  894. If InOutRes <> 0 then
  895. exit;
  896. Read_Longint(f,ll);
  897. If (ll<0) or (ll>$ffff) Then
  898. InOutRes:=201
  899. else
  900. l:=ll;
  901. End;
  902. Procedure Read_Byte(var f : TextRec;var l : byte);[Public,Alias:'FPC_READ_TEXT_BYTE'];
  903. var
  904. ll : Longint;
  905. Begin
  906. l:=0;
  907. If InOutRes <> 0 then
  908. exit;
  909. Read_Longint(f,ll);
  910. If (ll<0) or (ll>255) Then
  911. InOutRes:=201
  912. else
  913. l:=ll;
  914. End;
  915. Procedure Read_Shortint(var f : TextRec;var l : shortint);[Public,Alias:'FPC_READ_TEXT_SHORTINT'];
  916. var
  917. ll : Longint;
  918. Begin
  919. l:=0;
  920. If InOutRes <> 0 then
  921. exit;
  922. Read_Longint(f,ll);
  923. If (ll<-128) or (ll>127) Then
  924. InOutRes:=201
  925. else
  926. l:=ll;
  927. End;
  928. Procedure Read_Cardinal(var f : TextRec;var l : cardinal);[Public,Alias:'FPC_READ_TEXT_CARDINAL'];
  929. var
  930. hs : String;
  931. code : longint;
  932. base : longint;
  933. Begin
  934. l:=0;
  935. { Leave if error or not open file, else check for empty buf }
  936. If (InOutRes<>0) then
  937. exit;
  938. if (f.mode<>fmInput) Then
  939. begin
  940. InOutRes:=104;
  941. exit;
  942. end;
  943. If f.BufPos>=f.BufEnd Then
  944. FileFunc(f.InOutFunc)(f);
  945. hs:='';
  946. if IgnoreSpaces(f) and ReadSign(f,hs) and ReadBase(f,hs,Base) then
  947. ReadNumeric(f,hs,Base);
  948. val(hs,l,code);
  949. If code<>0 Then
  950. InOutRes:=106;
  951. End;
  952. function ReadRealStr(var f:TextRec):string;
  953. var
  954. hs : string;
  955. begin
  956. ReadRealStr:='';
  957. { Leave if error or not open file, else check for empty buf }
  958. If (InOutRes<>0) then
  959. exit;
  960. if (f.mode<>fmInput) Then
  961. begin
  962. InOutRes:=104;
  963. exit;
  964. end;
  965. If f.BufPos>=f.BufEnd Then
  966. FileFunc(f.InOutFunc)(f);
  967. hs:='';
  968. if IgnoreSpaces(f) and ReadSign(f,hs) and ReadNumeric(f,hs,10) then
  969. begin
  970. { First check for a . }
  971. if (f.Bufptr^[f.BufPos]='.') and (f.BufPos<f.BufEnd) Then
  972. begin
  973. hs:=hs+'.';
  974. Inc(f.BufPos);
  975. If f.BufPos>=f.BufEnd Then
  976. FileFunc(f.InOutFunc)(f);
  977. ReadNumeric(f,hs,10);
  978. end;
  979. { Also when a point is found check for a E }
  980. if (f.Bufptr^[f.BufPos] in ['e','E']) and (f.BufPos<f.BufEnd) Then
  981. begin
  982. hs:=hs+'E';
  983. Inc(f.BufPos);
  984. If f.BufPos>=f.BufEnd Then
  985. FileFunc(f.InOutFunc)(f);
  986. if ReadSign(f,hs) then
  987. ReadNumeric(f,hs,10);
  988. end;
  989. end;
  990. ReadRealStr:=hs;
  991. end;
  992. Procedure Read_Real(var f : TextRec;var d : Real);[Public,Alias:'FPC_READ_TEXT_REAL'];
  993. var
  994. code : Word;
  995. Begin
  996. val(ReadRealStr(f),d,code);
  997. If code<>0 Then
  998. InOutRes:=106;
  999. End;
  1000. {$ifdef SUPPORT_SINGLE}
  1001. Procedure Read_Single(var f : TextRec;var d : single);[Public,Alias:'FPC_READ_TEXT_SINGLE'];
  1002. var
  1003. code : Word;
  1004. Begin
  1005. val(ReadRealStr(f),d,code);
  1006. If code<>0 Then
  1007. InOutRes:=106;
  1008. End;
  1009. {$endif SUPPORT_SINGLE}
  1010. {$ifdef SUPPORT_EXTENDED}
  1011. Procedure Read_Extended(var f : TextRec;var d : extended);[Public,Alias:'FPC_READ_TEXT_EXTENDED'];
  1012. var
  1013. code : Word;
  1014. Begin
  1015. val(ReadRealStr(f),d,code);
  1016. If code<>0 Then
  1017. InOutRes:=106;
  1018. End;
  1019. {$endif SUPPORT_EXTENDED}
  1020. {$ifdef SUPPORT_COMP}
  1021. Procedure Read_Comp(var f : TextRec;var d : comp);[Public,Alias:'FPC_READ_TEXT_COMP'];
  1022. var
  1023. code : Word;
  1024. Begin
  1025. val(ReadRealStr(f),d,code);
  1026. If code<>0 Then
  1027. InOutRes:=106;
  1028. End;
  1029. {$endif SUPPORT_COMP}
  1030. {$ifdef SUPPORT_FIXED}
  1031. Procedure Read_Fixed(var f : TextRec;var d : fixed);[Public,Alias:'FPC_READ_TEXT_FIXED'];
  1032. var
  1033. code : Word;
  1034. Begin
  1035. val(ReadRealStr(f),d,code);
  1036. If code<>0 Then
  1037. InOutRes:=106;
  1038. End;
  1039. {$endif SUPPORT_FIXED}
  1040. {$endif}
  1041. {*****************************************************************************
  1042. Initializing
  1043. *****************************************************************************}
  1044. procedure OpenStdIO(var f:text;mode,hdl:longint);
  1045. begin
  1046. Assign(f,'');
  1047. TextRec(f).Handle:=hdl;
  1048. TextRec(f).Mode:=mode;
  1049. TextRec(f).Closefunc:=@FileCloseFunc;
  1050. case mode of
  1051. fmInput : TextRec(f).InOutFunc:=@FileReadFunc;
  1052. fmOutput : begin
  1053. TextRec(f).InOutFunc:=@FileWriteFunc;
  1054. TextRec(f).FlushFunc:=@FileWriteFunc;
  1055. end;
  1056. else
  1057. HandleError(102);
  1058. end;
  1059. end;
  1060. {
  1061. $Log$
  1062. Revision 1.46.2.1 1999-07-08 15:25:18 michael
  1063. + merged asistring fixes
  1064. Revision 1.50 1999/07/08 15:18:14 michael
  1065. * Now ansistring of arbitrary length can be read
  1066. Revision 1.49 1999/07/05 20:04:29 peter
  1067. * removed temp defines
  1068. Revision 1.48 1999/07/01 15:39:52 florian
  1069. + qword/int64 type released
  1070. Revision 1.47 1999/06/30 22:17:24 florian
  1071. + fpuint64 to system unit interface added: if it is true, the rtl
  1072. uses the fpu to do int64 operations, if possible
  1073. Revision 1.46 1999/05/06 09:05:16 peter
  1074. * generic write_float str_float
  1075. Revision 1.45 1999/04/26 18:27:26 peter
  1076. * fixed write array
  1077. * read array with maxlen
  1078. Revision 1.44 1999/04/08 15:57:57 peter
  1079. + subrange checking for readln()
  1080. Revision 1.43 1999/04/07 22:05:18 peter
  1081. * fixed bug with readln where it sometime didn't read until eol
  1082. Revision 1.42 1999/03/16 17:49:39 jonas
  1083. * changes for internal Val code (do a "make cycle OPT=-dvalintern" to test)
  1084. * in text.inc: changed RTE 106 when read integer values are out of bounds to RTE 201
  1085. * in systemh.inc: disabled "support_fixed" for the i386 because it gave internal errors,
  1086. Revision 1.41 1999/03/02 18:23:37 peter
  1087. * changed so handlerror() -> inoutres:= to have $I- support
  1088. Revision 1.40 1999/03/01 15:41:04 peter
  1089. * use external names
  1090. * removed all direct assembler modes
  1091. Revision 1.39 1999/02/17 10:13:29 peter
  1092. * when error when opening a file, then reset the mode to fmclosed
  1093. Revision 1.38 1999/01/28 19:38:19 peter
  1094. * fixed readln(ansistring)
  1095. Revision 1.37 1998/12/15 22:43:06 peter
  1096. * removed temp symbols
  1097. Revision 1.36 1998/12/11 18:07:39 peter
  1098. * fixed read(char) with empty buffer
  1099. Revision 1.35 1998/11/27 14:50:58 peter
  1100. + open strings, $P switch support
  1101. Revision 1.34 1998/11/16 12:21:48 peter
  1102. * fixes for 0.99.8
  1103. Revision 1.33 1998/10/23 00:03:29 peter
  1104. * write(pchar) has check for nil
  1105. Revision 1.32 1998/10/20 14:37:45 peter
  1106. * fixed maxlen which was not correct after my read_string update
  1107. Revision 1.31 1998/10/10 15:28:48 peter
  1108. + read single,fixed
  1109. + val with code:longint
  1110. + val for fixed
  1111. Revision 1.30 1998/09/29 08:39:07 michael
  1112. + Ansistring write now gets pointer.
  1113. Revision 1.29 1998/09/28 14:27:08 michael
  1114. + AnsiStrings update
  1115. Revision 1.28 1998/09/24 23:32:24 peter
  1116. * fixed small bug with a #13#10 on a line
  1117. Revision 1.27 1998/09/18 12:23:22 peter
  1118. * fixed a bug introduced by my previous update
  1119. Revision 1.26 1998/09/17 16:34:18 peter
  1120. * new eof,eoln,seekeoln,seekeof
  1121. * speed upgrade for read_string
  1122. * inoutres 104/105 updates for read_* and write_*
  1123. Revision 1.25 1998/09/14 10:48:23 peter
  1124. * FPC_ names
  1125. * Heap manager is now system independent
  1126. Revision 1.24 1998/09/08 10:14:06 peter
  1127. + textrecbufsize
  1128. Revision 1.23 1998/08/26 15:33:28 peter
  1129. * reset bufpos,bufend in opentext like tp7
  1130. Revision 1.22 1998/08/26 11:23:25 pierre
  1131. * close did not reset the bufpos and bufend fields
  1132. led to problems when using the same file several times
  1133. Revision 1.21 1998/08/17 22:42:17 michael
  1134. + Flush on close only for output files cd ../inc
  1135. Revision 1.20 1998/08/11 00:05:28 peter
  1136. * $ifdef ver0_99_5 updates
  1137. Revision 1.19 1998/07/30 13:26:16 michael
  1138. + Added support for ErrorProc variable. All internal functions are required
  1139. to call HandleError instead of runerror from now on.
  1140. This is necessary for exception support.
  1141. Revision 1.18 1998/07/29 21:44:35 michael
  1142. + Implemented reading/writing of ansistrings
  1143. Revision 1.17 1998/07/19 19:55:33 michael
  1144. + fixed rename. Changed p to p^
  1145. Revision 1.16 1998/07/10 11:02:40 peter
  1146. * support_fixed, becuase fixed is not 100% yet for the m68k
  1147. Revision 1.15 1998/07/06 15:56:43 michael
  1148. Added length checking for string reading
  1149. Revision 1.14 1998/07/02 12:14:56 carl
  1150. + Each IOCheck routine now check InOutRes before, just like TP
  1151. Revision 1.13 1998/07/01 15:30:00 peter
  1152. * better readln/writeln
  1153. Revision 1.12 1998/07/01 14:48:10 carl
  1154. * bugfix of WRITE_TEXT_BOOLEAN , was not TP compatible
  1155. + added explicit typecast in OpenText
  1156. Revision 1.11 1998/06/25 09:44:22 daniel
  1157. + RTLLITE directive to compile minimal RTL.
  1158. Revision 1.10 1998/06/04 23:46:03 peter
  1159. * comp,extended are only i386 added support_comp,support_extended
  1160. Revision 1.9 1998/06/02 16:47:56 pierre
  1161. * bug for boolean values greater than one fixed
  1162. Revision 1.8 1998/05/31 14:14:54 peter
  1163. * removed warnings using comp()
  1164. Revision 1.7 1998/05/27 00:19:21 peter
  1165. * fixed crt input
  1166. Revision 1.6 1998/05/21 19:31:01 peter
  1167. * objects compiles for linux
  1168. + assign(pchar), assign(char), rename(pchar), rename(char)
  1169. * fixed read_text_as_array
  1170. + read_text_as_pchar which was not yet in the rtl
  1171. Revision 1.5 1998/05/12 10:42:45 peter
  1172. * moved getopts to inc/, all supported OS's need argc,argv exported
  1173. + strpas, strlen are now exported in the systemunit
  1174. * removed logs
  1175. * removed $ifdef ver_above
  1176. Revision 1.4 1998/04/07 22:40:46 florian
  1177. * final fix of comp writing
  1178. }