URI: 
       libc/wchar: Group single wchar I/O functions - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 0827b4938a966940d42e0382c4fd16d325110c8d
   DIR parent e7d90888786b65dee9fec9deb9c880857d6e4d8c
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
       Date:   Fri, 21 Mar 2025 09:14:06 +0100
       
       libc/wchar: Group single wchar I/O functions
       
       This makes easier to know the functions that still has to be implemented
       and makes easier to know the not implemented functions. It also adds the
       macro definition for getwc(). The macro definitions for  getwchar()  and
       for putwchar() were considered, but as they required a definition of the
       stdin or stdout macros (or the full defition of FILE to have access  to
       the __iob array) it was considered worthless and they will just have the
       function library definition.
       
       Diffstat:
         M include/wchar.h                     |      10 ++++++----
         M src/libc/libc.h                     |       5 ++---
       
       2 files changed, 8 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/include/wchar.h b/include/wchar.h
       @@ -35,8 +35,11 @@ extern wint_t fgetwc(struct _FILE *);
        extern wint_t fputwc(wchar_t c, struct _FILE *);
        extern wint_t getwc(struct _FILE *);
        extern wint_t putwc(wchar_t, struct _FILE *);
       -extern int fwide(struct _FILE *, int);
       +extern wint_t getwchar(void);
       +extern wint_t putwchar(wchar_t);
        extern wint_t ungetwc(wint_t, struct _FILE *);
       +
       +extern int fwide(struct _FILE *, int);
        extern wchar_t *fgetws(wchar_t *restrict, int, struct _FILE *restrict);
        extern int fputws(const wchar_t *restrict, struct _FILE *restrict);
        
       @@ -45,9 +48,6 @@ extern int swscanf(const wchar_t *restrict, const wchar_t *restrict, ...);
        extern int wprintf(const wchar_t *restrict, ...);
        extern int wscanf(const wchar_t *restrict, ...);
        
       -extern wint_t getwchar(void);
       -extern wint_t putwchar(wchar_t);
       -
        extern double wcstod(const wchar_t *restrict, wchar_t **restrict);
        extern float wcstof(const wchar_t *restrict, wchar_t **restrict);
        extern long double wcstold(const wchar_t *restrict, wchar_t **restrict);
       @@ -82,6 +82,7 @@ extern wchar_t *wmemset(wchar_t *, wchar_t, size_t);
        extern size_t wcsftime(wchar_t *restrict, size_t, const wchar_t *restrict, const struct tm *restrict);
        extern wint_t btowc(int);
        extern int wctob(wint_t);
       +
        extern int mbsinit(const mbstate_t *);
        extern size_t mbrlen(const char *restrict, size_t, mbstate_t *restrict);
        extern size_t mbrtowc(wchar_t *restrict, const char *restrict, size_t, mbstate_t *restrict);
       @@ -91,5 +92,6 @@ extern size_t wcsrtombs(char *restrict, const wchar_t **restrict, size_t, mbstat
        extern int wcwidth(wchar_t);
        
        #define putwc(wc, fp) fputwc(wc, fp)
       +#define getwc(fp)     fgetwc(fp)
        
        #endif
   DIR diff --git a/src/libc/libc.h b/src/libc/libc.h
       @@ -20,6 +20,7 @@ enum {
        #define SECDAY (24 * SECHOUR)   /* 86400 */
        
        struct tm;
       +struct _FILE;
        
        struct tzone {
                char *name;
       @@ -61,7 +62,5 @@ extern void (*_atexithdl)(void);
        
        #ifdef _WCHAR_H
        extern int _validutf8(wchar_t, int *);
       -#ifdef _STDIO_H
       -extern wint_t _fputwc(wchar_t, FILE *, int *);
       -#endif
       +extern wint_t _fputwc(wchar_t, struct _FILE *, int *);
        #endif