source: libcfa/src/strstream.hfa @ c323837

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since c323837 was fec63b2, checked in by Peter A. Buhr <pabuhr@…>, 3 years ago

add first draft of strstream type

  • Property mode set to 100644
File size: 2.0 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 : Sat Apr 24 11:17:33 2021
13// Update Count     : 37
14//
15
16#pragma once
17
18#include "iostream.hfa"
19#include <stdio.h>
20
21
22// *********************************** strstream ***********************************
23
24
25enum { strstream_sepSize = 16 };
26struct strstream {                                                                              // 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$[strstream_sepSize];
37        char tupleSeparator$[strstream_sepSize];
38}; // strstream
39
40// Satisfies basic_ostream
41
42// private
43bool sepPrt$( strstream & );
44void sepReset$( strstream & );
45void sepReset$( strstream &, bool );
46const char * sepGetCur$( strstream & );
47void sepSetCur$( strstream &, const char [] );
48bool getNL$( strstream & );
49void setNL$( strstream &, bool );
50bool getANL$( strstream & );
51bool getPrt$( strstream & );
52void setPrt$( strstream &, bool );
53
54// public
55void sepOn( strstream & );
56void sepOff( strstream & );
57bool sepDisable( strstream & );
58bool sepEnable( strstream & );
59void nlOn( strstream & );
60void nlOff( strstream & );
61
62const char * sepGet( strstream & );
63void sepSet( strstream &, const char [] );
64const char * sepGetTuple( strstream & );
65void sepSetTuple( strstream &, const char [] );
66
67void ends( strstream & );
68int fmt( strstream &, const char format[], ... ) __attribute__(( format(printf, 2, 3) ));
69int flush( strstream & );
70
71strstream & write( strstream & os );                                    // use stdout, default value not working
72strstream & write( strstream & os, FILE * stream = stdout );
73
74void ?{}( strstream &, char buf[], size_t size );
75
76extern strstream & sstr;
77
78// Local Variables: //
79// mode: c //
80// tab-width: 4 //
81// End: //
Note: See TracBrowser for help on using the repository browser.