aboutsummaryrefslogtreecommitdiff
path: root/lib/libk/stdio.h
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2023-03-12 18:39:39 +0200
committeraqua <aqua@iserlohn-fortress.net>2023-03-12 18:39:39 +0200
commitfbc736463f2ca2f5dbf1b7c412f408245e61df97 (patch)
tree84a66eabc5e3be2191ae0d5d1e0ff33d05515b4a /lib/libk/stdio.h
parentAdd unit tests for C drivers (diff)
downloadkernel-fbc736463f2ca2f5dbf1b7c412f408245e61df97.tar.xz
Revert VGA C driver
Diffstat (limited to 'lib/libk/stdio.h')
-rw-r--r--lib/libk/stdio.h35
1 files changed, 13 insertions, 22 deletions
diff --git a/lib/libk/stdio.h b/lib/libk/stdio.h
index 5ef68f1..b28eb5e 100644
--- a/lib/libk/stdio.h
+++ b/lib/libk/stdio.h
@@ -7,22 +7,19 @@
///@defgroup stdio stdio
///@{
-#ifdef __cplusplus
-/**
- * An object type used for streams
- */
-struct kIoDevice {
- /** Function that prints a character to the stream */
- virtual void putc(char) = 0;
- /** Function that prints a string to the stream */
- virtual int puts(const char *, int) = 0;
- /** Flush write buffers */
- virtual void flush() = 0;
-};
-typedef kIoDevice FILE;
-#else
-typedef void FILE;
-#endif
+/// An object type used for streams
+typedef struct FILE {
+ int id;
+
+ /// Function that prints a character to the stream
+ void (*putc)(const struct FILE *, char);
+
+ /// Function that prints a string to the stream
+ int (*puts)(const struct FILE *, const char *, int);
+
+ /// Flush write buffers
+ void (*flush)(const struct FILE *);
+} FILE;
/** A FILE value corresponding to stdin, the keyboard buffer */
extern FILE *stdin;
@@ -31,9 +28,6 @@ extern FILE *stdout;
/** A FILE value corresponding to stderr, the uart */
extern FILE *stderr;
-#ifdef __cplusplus
-extern "C" {
-#endif
/**
* Write the formatted string to stdout
* Supports ``%s`` (string), ``%d`` (decimal), ``%u`` (unsigned), ``%x`` (hexadecimal)
@@ -50,9 +44,6 @@ int fprintf(FILE *restrict stream, const char *restrict format, ...);
* Write the formatted string to stream; see printf
*/
int vfprintf(FILE *restrict stream, const char *restrict format, va_list ap);
-#ifdef __cplusplus
-}
-#endif
///@}
///@}