text.inc 30 KB

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