MOS Source Code
Loading...
Searching...
No Matches
mos_stdio.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3
4#include <mos/mos_global.h>
5#include <mos/moslib_global.h>
6#include <stdarg.h>
7#include <stddef.h>
8
16// defined in stdio.c & stdio_impl.c
17MOSAPI int __printf(2, 3) sprintf(char *__restrict str, const char *__restrict format, ...);
18MOSAPI int __printf(3, 4) snprintf(char *__restrict str, size_t size, const char *__restrict format, ...);
19MOSAPI int vsprintf(char *__restrict str, const char *__restrict format, va_list ap);
20MOSAPI int vsnprintf(char *__restrict buf, size_t size, const char *__restrict format, va_list args);
21
22#ifndef __MOS_KERNEL__ // for userspace only
23
24typedef struct _FILE FILE;
28
29// C standard says they are macros, make them happy.
30#define stdin stdin
31#define stdout stdout
32#define stderr stderr
33
34MOSAPI int __printf(1, 2) printf(const char *__restrict format, ...);
35MOSAPI int __printf(2, 3) fprintf(FILE *__restrict file, const char *__restrict format, ...);
36MOSAPI int __printf(2, 3) dprintf(int fd, const char *__restrict format, ...);
37MOSAPI int vprintf(const char *__restrict format, va_list ap);
38MOSAPI int vfprintf(FILE *__restrict file, const char *__restrict format, va_list ap);
39MOSAPI int vdprintf(int fd, const char *__restrict format, va_list ap);
40
41MOSAPI int getchar(void);
42MOSAPI int putchar(int c);
43MOSAPI int puts(const char *s);
44
45MOSAPI int fputs(const char *__restrict s, FILE *__restrict file);
46MOSAPI int fputc(int c, FILE *file);
47MOSAPI int fgetc(FILE *file);
48
49size_t fread(void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream);
50size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream);
51int fseek(FILE *stream, long offset, io_seek_whence_t whence);
52off_t ftell(FILE *stream);
53FILE *fopen(const char *path, const char *mode);
54int fclose(FILE *stream);
55#endif
56
char args[3][16]
Definition avr_io.c:16
MOSAPI const char *__restrict MOSAPI size_t size
Definition mos_stdio.h:18
MOSAPI int vsnprintf(char *__restrict buf, size_t size, const char *__restrict format, va_list args)
size_t fread(void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)
#define stdout
Definition mos_stdio.h:31
struct _FILE FILE
Definition mos_stdio.h:24
MOSAPI int puts(const char *s)
MOSAPI const char *__restrict MOSAPI size_t const char *__restrict MOSAPI int vsprintf(char *__restrict str, const char *__restrict format, va_list ap)
Definition mos_stdio.c:25
FILE * fopen(const char *path, const char *mode)
int fseek(FILE *stream, long offset, io_seek_whence_t whence)
MOSAPI int putchar(int c)
#define stderr
Definition mos_stdio.h:32
int fclose(FILE *stream)
MOSAPI int fputs(const char *__restrict s, FILE *__restrict file)
#define stdin
Definition mos_stdio.h:30
MOSAPI int fputc(int c, FILE *file)
MOSAPI int getchar(void)
MOSAPI const char *__restrict format
Definition mos_stdio.h:17
MOSAPI int vdprintf(int fd, const char *__restrict format, va_list ap)
off_t ftell(FILE *stream)
MOSAPI int vfprintf(FILE *__restrict file, const char *__restrict format, va_list ap)
size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)
MOSAPI MOSAPI const char *__restrict MOSAPI const char *__restrict MOSAPI int vprintf(const char *__restrict format, va_list ap)
MOSAPI int fgetc(FILE *file)
io_seek_whence_t
Definition io_types.h:6
#define MOSAPI
Definition mos_global.h:102
#define __printf(a, b)
Definition mos_global.h:30
int sprintf(char *__restrict str, const char *__restrict format,...)
Definition mos_stdio.c:7
int snprintf(char *__restrict str, size_t size, const char *__restrict format,...)
Definition mos_stdio.c:16
ssize_t off_t
Definition types.h:84