diff options
Diffstat (limited to 'arch/all/cpp/include/ios')
-rw-r--r-- | arch/all/cpp/include/ios | 287 |
1 files changed, 0 insertions, 287 deletions
diff --git a/arch/all/cpp/include/ios b/arch/all/cpp/include/ios deleted file mode 100644 index 1f26df6..0000000 --- a/arch/all/cpp/include/ios +++ /dev/null @@ -1,287 +0,0 @@ -/* **************************************************************************** - * ios -- C++ I/O streams. - * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr> - * - * This file is part of the 'all/cpp' module in libcarrot, an experimental - * modular libc project. - * - * This file is governed by the CeCILL-C license under French law and abiding - * by the rules of distribution of free software. You can use, modify and or - * redistribute it under the terms of the CeCILL-C license as circulated by - * CEA, CNRS and INRIA at the following URL: http://www.cecill.info - * - * As a counterpart to the access to the source code and rights to copy, modify - * and redistribute granted by the license, users are provided only with a - * limited warranty and the software's author, the holder of the economic - * rights, and the successive licensors have only limited liability. - * - * In this respect, the user's attention is drawn to the risks associated with - * loading, using, modifying and/or developing and reproducing the software by - * the user in light of its specific status of free software, that may mean - * that it is complicated to manipulate, and that also therefore means that it - * is reserved for developers and experienced professionals having in-depth - * computer knowledge. Users are therefore encouraged to load and test the - * software's suitability as regards their requirements in conditions enabling - * the security of their systems and/or data to be ensured and, more generally, - * to use and operate it in the same conditions as regards security. - * - * The fact that you are presently reading this means you have had knowledge of - * the CeCILL-C license and that you accept its terms. - * ************************************************************************* */ -#if __USE_CXX98 && !defined(_IOS_HPP) && !defined(_IOS_) -# define _IOS_HPP 1 -# define _IOS_ 1 -# include <cdefs.h> -# include <iosfwd> -__BEGIN_NAMESPACE_STD - -/* Main types */ -typedef unsigned long streamoff; -typedef size_t streamsize; -/* ************************************************************************* */ -/* I/O stream base */ -/* ************************************************************************* */ -class ios_base { -public: - class failure : public exception { - public: - explicit failure(const string& __msg); - virtual ~failure(); - virtual const char* what() const throw(); - } - - typedef unsigned long fmtflags; - /* Insert and extract `bool` type in alphabetical format. */ - static const fmtflags boolalpha = 1L << 0; - /* Convert integer input or generate integer output in decimal base. */ - static const fmtflags dec = 1L << 1; - /* Generate floating-point output in fixed-point notation. */ - static const fmtflags fixed = 1L << 2; - /* Convert integer input or generate integer output in hexadecimal base. */ - static const fmtflags hex = 1L << 3; - /* Add fill characters at a designated internal point in certain - * generated output, or identical to `right` if no such point - * is designated. */ - static const fmtflags internal = 1L << 4; - /* Add fill characters on the right (final positions) of certain - * generated output. */ - static const fmtflags left = 1L << 5; - /* Convert integer input or generate integer output in octal base. */ - static const fmtflags oct = 1L << 6; - /* Add fill characters on the left (initial positions) of certain - * generated output. */ - static const fmtflags right = 1L << 7; - /* Generate floating-point ouput in scientific notation. */ - static const fmtflags scientific = 1L << 8; - /* Generate a prefix indicating the numeric base of generated - * integer output. */ - static const fmtflags showbase = 1L << 9; - /* Generate a decimal-point character unconditionally in generated - * floating-point output. */ - static const fmtflags showpoint = 1L << 10; - /* Generate a '+' sign in non-negative generated numeric output. */ - static const fmtflags showpos = 1L << 11; - /* Skip leading white space before certain input operations. */ - static const fmtflags skipws = 1L << 12; - /* Flush output after each output operation. */ - static const fmtflags unitbuf = 1L << 13; - /* Replace certain lowercase letters with their uppercase equivalents - * in generated output. */ - static const fmtflags uppercase = 1L << 14; - /* Constant values. */ - static const fmtflags adjustfield = left | right | internal; - static const fmtflags basefield = dec | oct | hex; - static const fmtflags floatfield = scientific | fixed; - - typedef unsigned long iostate; - /* Indicate a loss of integrity in an input or output sequence - * (such as irrecoverable read error from a file). */ - static const iostate badbit = 1L << 0; - /* Indicate that an input operation reached the end of an - * input sequence. */ - static const iostate eofbit = 1L << 1; - /* Indicate that an input operation failed to read the expected characters, - * or that an output operation failed to generate the desired characters. */ - static const iostate failbit = 1L << 2; - /* The value zero. */ - static const iostate goodbit = /* -1... just kidding, */ 0; - - typedef unsigned long openmode; - /* Seek to end before each write. */ - static const openmode app = 1L << 0; - /* Open and seek to end immediately after opening. */ - static const openmode ate = 1L << 1; - /* Perform input and output in binary mode (as opposed to text mode). */ - static const openmode binary = 1L << 2; - /* Open for input. */ - static const openmode in = 1L << 3; - /* Open for output. */ - static const openmode out = 1L << 4; - /* Truncate an existing stream when opening. */ - static const openmode trunc = 1L << 5; - - typedef unsigned long seekdir; - /* Request a seek relative to the beginning of the stream. */ - static const seekdir beg = 1L << 0; - /* Request a seek relative to the current position within the sequence. */ - static const seekdir cur = 1L << 1; - /* Request a seek relative to the current end of the sequence. */ - static const seekdir end = 1L << 2; - - /* The object that ensures the construction of the eight objects declared - * in <iostream> that associate file stream buffers with the standard - * C streams provided for by the functions declared in <cstdio>. */ - class Init { - public: - Init(); - ~Init(); - private: -# if 0 /* exposition only */ - static int init_cnt; -# endif - }; - - /* fmtflags state functions */ - fmtflags flags() const; - fmtflags flags(fmtflags __fmtfl); - fmtflags setf(fmtflags __fmtfl); - fmtflags setf(fmtflags __fmtfl, fmtflags __mask); - void unsetf(fmtflags __mask); - - streamsize precision() const; - streamsize precision(streamsize __prec); - streamsize width() const; - streamsize width(streamsize __wide); - - /* locale functions */ - locale imbue(const locale& __loc); - locale getloc() const; - - /* storage functions */ - static int xalloc(); - long& iword(int __index); - void*& pword(int __index); - - virtual ~ios_base(); - - enum event { erase_event, imbue_event, copyfmt_event }; - typedef void (*event_callback)(event, ios_base&, int __index); - void register_callback(event_callback __fn, int __index); - - static bool sync_with_stdio(bool __sync = true); - -protected: - ios_base(); - -private: -# if 0 /* exposition only */ - static int index; - long *iarray; - void **parray; -# endif - -private: - ios_base(const ios_base&); - ios_base& operator = (const ios_base&); -}; -/* ************************************************************************* */ -/* I/O stream position */ -/* ************************************************************************* */ -template <class _StateT> class fpos { -public: - _StateT state() const; - void state(_StateT); -private: -# if 0 /* exposition only */ - _StateT st; -# endif -}; -/* ************************************************************************* */ -/* I/O basic stream */ -/* ************************************************************************* */ -template <class _CharT, class _Traits = char_traits<_CharT>> -class basic_ios : public ios_base { -public: - typedef _CharT char_type; - typedef typename traits::int_type int_type; - typedef typename traits::pos_type pos_type; - typedef typename traits::off_type off_type; - typedef _Traits traits_type; - - operator void*() const; - bool operator !() const; - - iostate rdstate() const; - void clear(iostate __state = goodbit); - void setstate(iostate __state); - bool good() const; - bool eof() const; - bool fail() const; - bool bad() const; - - iostate exceptions() const; - void exceptions(iostate __except); - - explicit basic_ios(basic_streambuf<_CharT, _Traits>* __sb); - virtual ~basic_ios(); - - basic_ostream<_CharT, _Traits>* tie() const; - basic_ostream<_CharT, _Traits>* tie(basic_ostream<_CharT, _Traits>* __sb); - - basic_ios& copyfmt(const basic_ios& __rhs); - - char_type fill() const; - char_type fill(char_type __ch); - - locale imbue(const locale& __loc); - - char narrow(char_type __c, char __dfault) const; - char_type widen(char __c) const; - -protected: - basic_ios(); - void init(basic_streambuf<_CharT, _Traits>* __sb); - -private: - basic_ios (const basic_ios&); /* not defined */ - basic_ios& operator=(const basic_ios&); /* not defined */ -}; -/* ************************************************************************* */ -/* Utilities */ -/* ************************************************************************* */ -/* Manipulators */ -ios_base& boolalpha(ios_base& __str); -ios_base& noboolalpha(ios_base& __str); -ios_base& showbase(ios_base& __str); -ios_base& noshowbase(ios_base& __str); -ios_base& showpoint(ios_base& __str); -ios_base& noshowpoint(ios_base& __str); -ios_base& skipws(ios_base& __str); -ios_base& noskipws(ios_base& __str); -ios_base& uppercase(ios_base& __str); -ios_base& nouppercase(ios_base& __str); -ios_base& unitbuf(ios_base& __str); -ios_base& nounitbuf(ios_base& __str); - -/* Adjust field */ -ios_base& internal(ios_base& __str); -ios_base& left(ios_base& __str); -ios_base& right(ios_base& __str); - -/* Base field */ -ios_base& dec(ios_base& __str); -ios_base& hex(ios_base& __str); -ios_base& oct(ios_base& __str); - -/* Float field */ -ios_base& fixed(ios_base& __str); -ios_base& scientific(ios_base& __str); - -__END_NAMESPACE_STD -#endif /* _IOS_HPP, _IOS_ */ -#ifndef _IOS_HPP -# define _IOS_HPP 1 -#endif -#ifndef _IOS_ -# define _IOS_ 1 -#endif |