OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [language/] [c/] [libc/] [stdio/] [current/] [include/] [stdio.inl] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_LIBC_STDIO_STDIO_INL
2
#define CYGONCE_LIBC_STDIO_STDIO_INL
3
//===========================================================================
4
//
5
//      stdio.inl
6
//
7
//      ANSI standard I/O routines - inlined functions
8
//
9
//===========================================================================
10
// ####ECOSGPLCOPYRIGHTBEGIN####
11
// -------------------------------------------
12
// This file is part of eCos, the Embedded Configurable Operating System.
13
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
14
//
15
// eCos is free software; you can redistribute it and/or modify it under
16
// the terms of the GNU General Public License as published by the Free
17
// Software Foundation; either version 2 or (at your option) any later
18
// version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
//
29
// As a special exception, if other files instantiate templates or use
30
// macros or inline functions from this file, or you compile this file
31
// and link it with other works to produce a work based on this file,
32
// this file does not by itself cause the resulting work to be covered by
33
// the GNU General Public License. However the source code for this file
34
// must still be made available in accordance with section (3) of the GNU
35
// General Public License v2.
36
//
37
// This exception does not invalidate any other reasons why a work based
38
// on this file might be covered by the GNU General Public License.
39
// -------------------------------------------
40
// ####ECOSGPLCOPYRIGHTEND####
41
//===========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):    jlarmour
45
// Contributors:
46
// Date:         2000-04-19
47
// Purpose:
48
// Description:
49
// Usage:       Do not include this file directly - use #include 
50
//
51
//####DESCRIPTIONEND####
52
//
53
//===========================================================================
54
 
55
// CONFIGURATION
56
 
57
#include    // Configuration header
58
 
59
// INCLUDES
60
 
61
#include     // Common type definitions and support
62
#include                 // NULL and size_t from compiler
63
#include                 // va_list
64
#include                  // Just be sure it has been included
65
#include                  // Definition of error codes and errno
66
#include                 // Definition of strerror() for perror()
67
#include                 // INT_MAX
68
 
69
// INLINE FUNCTION DEFINITIONS
70
 
71
//===========================================================================
72
 
73
// 7.9.5 File access functions
74
 
75
extern __inline__ void
76
setbuf( FILE *stream, char *buf ) __THROW
77
{
78
    if (buf == NULL)
79
        setvbuf( stream, NULL, _IONBF, 0 );
80
    else
81
        // NB: Should use full buffering by default ordinarily, but in
82
        // the current system we're always connected to an interactive
83
        // terminal, so use line buffering
84
        setvbuf( stream, buf, _IOLBF, BUFSIZ );
85
 
86
} // setbuf()
87
 
88
//===========================================================================
89
 
90
// 7.9.6 Formatted input/output functions
91
 
92
extern __inline__ int
93
vfprintf( FILE *stream, const char *format, va_list arg ) __THROW
94
{
95
    return vfnprintf(stream, INT_MAX, format, arg);
96
} // vfprintf()
97
 
98
 
99
extern __inline__ int
100
vprintf( const char *format, va_list arg ) __THROW
101
{
102
    return vfnprintf(stdout, INT_MAX, format, arg);
103
} // vprintf()
104
 
105
 
106
extern __inline__ int
107
vsprintf( char *s, const char *format, va_list arg ) __THROW
108
{
109
    return vsnprintf(s, INT_MAX, format, arg);
110
} // vsprintf()
111
 
112
 
113
//===========================================================================
114
 
115
// 7.9.7 Character input/output functions
116
 
117
extern __inline__ int
118
puts( const char *s ) __THROW
119
{
120
    int rc;
121
 
122
    rc = fputs( s, stdout );
123
 
124
    if (rc >= 0)
125
        rc = fputc('\n', stdout );
126
 
127
    return rc;
128
} // puts()
129
 
130
 
131
//===========================================================================
132
 
133
// 7.9.10 Error-handling functions
134
 
135
extern __inline__ void
136
perror( const char *s ) __THROW
137
{
138
    if (s && *s)
139
        fprintf( stderr, "%s: %s\n", s, strerror(errno) );
140
    else
141
        fputs( strerror(errno), stderr );
142
 
143
} // perror()
144
 
145
//===========================================================================
146
 
147
// Other non-ANSI functions
148
 
149
extern __inline__ int
150
vscanf( const char *format, va_list arg ) __THROW
151
{
152
    return vfscanf( stdin, format, arg );
153
} // vscanf()
154
 
155
 
156
#endif // CYGONCE_LIBC_STDIO_STDIO_INL multiple inclusion protection
157
 
158
// EOF stdio.inl

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.