Mercurial > ecos
annotate packages/language/c/libc/current/src/stdio/common/stdin.cxx @ 66:bf00f99aec69 ecos-sw-2000-02-02
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
| author | jlarmour |
|---|---|
| date | Wed, 02 Feb 2000 19:57:02 +0000 |
| parents | c38311975d4f |
| children |
| rev | line source |
|---|---|
| 2 | 1 //======================================================================== |
| 2 // | |
| 3 // stdin.cxx | |
| 4 // | |
| 5 // Initialization of stdin stream for ISO C library | |
| 6 // | |
| 7 //======================================================================== | |
| 8 //####COPYRIGHTBEGIN#### | |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
9 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
10 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
11 // The contents of this file are subject to the Red Hat eCos Public License |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
12 // Version 1.1 (the "License"); you may not use this file except in |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
13 // compliance with the License. You may obtain a copy of the License at |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
14 // http://www.redhat.com/ |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
15 // |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
16 // Software distributed under the License is distributed on an "AS IS" |
|
64
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
18 // License for the specific language governing rights and limitations under |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
19 // the License. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
20 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
21 // The Original Code is eCos - Embedded Configurable Operating System, |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
22 // released September 30, 1998. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
23 // |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
24 // The Initial Developer of the Original Code is Red Hat. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
25 // Portions created by Red Hat are |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
27 // All Rights Reserved. |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
28 // ------------------------------------------- |
|
c38311975d4f
Merge from eCos master repository on 2000-01-28-04:28:11-GMT
jlarmour
parents:
2
diff
changeset
|
29 // |
| 2 | 30 //####COPYRIGHTEND#### |
| 31 //======================================================================== | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): jlarmour | |
| 35 // Contributors: jlarmour | |
| 36 // Date: 1999-01-15 | |
| 37 // Purpose: Initialization of stdin stream for ISO C library | |
| 38 // Description: We put all this in a separate file in the hope that if | |
| 39 // no-one uses stdin, then it is not included in the image | |
| 40 // Usage: | |
| 41 // | |
| 42 //####DESCRIPTIONEND#### | |
| 43 // | |
| 44 //======================================================================== | |
| 45 | |
| 46 // CONFIGURATION | |
| 47 | |
| 48 #include <pkgconf/libc.h> // Configuration header | |
| 49 | |
| 50 #ifdef CYGPKG_LIBC_STDIO | |
| 51 | |
| 52 // Don't let us get the stream definitions of stdin/out/err from stdio.h | |
| 53 // since we are going to break the type safety :-( | |
| 54 #define CYGPRI_LIBC_STDIO_NO_DEFAULT_STREAMS | |
| 55 | |
| 56 // And we don't need the stdio inlines, which will otherwise complain if | |
| 57 // stdin/out/err are not available | |
| 58 #ifdef CYGIMP_LIBC_STDIO_INLINES | |
| 59 # undef CYGIMP_LIBC_STDIO_INLINES | |
| 60 #endif | |
| 61 | |
| 62 // INCLUDES | |
| 63 | |
| 64 #include <cyg/infra/cyg_type.h> // Common type definitions and support | |
| 65 #include "clibincl/stream.hxx" // Cyg_StdioStream class | |
| 66 #include "clibincl/stdiofiles.hxx" // C library files | |
| 67 #include "clibincl/stdiosupp.hxx" // Cyg_libc_stdio_find_filename() | |
| 68 | |
| 69 // STATICS | |
| 70 | |
| 71 Cyg_StdioStream | |
| 72 cyg_libc_stdio_stdin CYG_INIT_PRIORITY(LIBC) = Cyg_StdioStream( | |
| 73 Cyg_libc_stdio_find_filename(CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE), | |
| 74 Cyg_StdioStream::CYG_STREAM_READ, false, false, _IOLBF ); | |
| 75 | |
| 76 | |
| 77 // CLASSES | |
| 78 | |
| 79 // This is a dummy class just so we can execute arbitrary code when | |
| 80 // stdin is requested | |
| 81 | |
| 82 class cyg_libc_dummy_stdin_init_class { | |
| 83 public: | |
| 84 cyg_libc_dummy_stdin_init_class(void) { | |
| 85 Cyg_libc_stdio_files::set_file_stream(0, &cyg_libc_stdio_stdin); | |
| 86 } | |
| 87 }; | |
| 88 | |
| 89 // And here's an instance of the class just to make the code run | |
| 90 static cyg_libc_dummy_stdin_init_class cyg_libc_dummy_stdin_init | |
| 91 CYG_INIT_PRIORITY(LIBC); | |
| 92 | |
| 93 #endif // ifdef CYGPKG_LIBC_STDIO | |
| 94 | |
| 95 // EOF stdin.cxx |
