source: libcfa/src/strstream.hfa@ 0d41e600

Last change on this file since 0d41e600 was 768d091, checked in by Peter A. Buhr <pabuhr@…>, 5 months ago

rename I/O function "clear" to "clearerr"

  • Property mode set to 100644
File size: 2.8 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2021 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// strstream.hfa --
8//
9// Author : Peter A. Buhr
10// Created On : Thu Apr 22 22:20:59 2021
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Mon Apr 14 20:57:15 2025
13// Update Count : 61
14//
15
16#pragma once
17
18#include "iostream.hfa"
19#include <stdio.h>
20
21
22// *********************************** ostrstream ***********************************
23
24
25enum { ostrstream_sepSize = 16 };
26struct ostrstream { // satisfied basic_ostream
27 char * buf$;
28 size_t size$;
29 size_t cursor$;
30 bool sepDefault$;
31 bool sepOnOff$;
32 bool nlOnOff$;
33 bool prt$; // print text
34 bool sawNL$;
35 const char * sepCur$;
36 char separator$[ostrstream_sepSize];
37 char tupleSeparator$[ostrstream_sepSize];
38}; // ostrstream
39
40// Satisfies basic_ostream
41
42// private
43bool sepPrt$( ostrstream & );
44void sepReset$( ostrstream & );
45void sepReset$( ostrstream &, bool );
46const char * sepGetCur$( ostrstream & );
47void sepSetCur$( ostrstream &, const char [] );
48bool getNL$( ostrstream & );
49bool setNL$( ostrstream &, bool );
50bool getANL$( ostrstream & );
51bool setANL$( ostrstream &, bool );
52bool getPrt$( ostrstream & );
53bool setPrt$( ostrstream &, bool );
54
55// public
56void nlOn( ostrstream & );
57void nlOff( ostrstream & );
58
59void sep( ostrstream & );
60void nosep( ostrstream & );
61bool sepOn( ostrstream & );
62bool sepOff( ostrstream & );
63const char * sepGet( ostrstream & );
64void sepSet( ostrstream &, const char [] );
65const char * sepGetTuple( ostrstream & );
66void sepSetTuple( ostrstream &, const char [] );
67
68void ends( ostrstream & );
69int fmt( ostrstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
70
71ostrstream & write( ostrstream & os, FILE * stream ); // FIX ME: use default = stdout
72ostrstream & write( ostrstream & os );
73
74void ?{}( ostrstream &, char buf[], size_t size );
75
76
77// *********************************** istrstream ***********************************
78
79
80// Currently, this is a placeholder because vsscanf returns number of values read versus buffer position scanned.
81// This issue makes it impossible to know where in the buffer the last read stopped.
82
83struct istrstream {
84 char * buf$;
85 size_t cursor$;
86 bool nlOnOff$;
87}; // istrstream
88
89void ?{}( istrstream &, char buf[] );
90
91// Satisfies basic_istream
92
93// private
94bool getANL$( istrstream & );
95bool setANL$( istrstream &, bool );
96
97// public
98void nlOn( istrstream & );
99void nlOff( istrstream & );
100int fmt( istrstream &, const char format[], ... ) __attribute__(( format(scanf, 2, 3) ));
101istrstream & ungetc( char, istrstream & );
102bool eof( istrstream & );
103void clearerr( istrstream & );
104void ends( istrstream & );
105
106// Local Variables: //
107// mode: c //
108// tab-width: 4 //
109// End: //
Note: See TracBrowser for help on using the repository browser.