-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
The scanf reader is the abstraction that scanf uses to read from either a file or a string, similar to printf's writer. Unlike printf, however, there are only two variants of scanf: fscanf and sscanf (just scanf is the same as fscanf(stdin, ...)). This means that the stream_getc and stream_ungetc functions don't need to be pointers, they can be declared with using statements based on the current platform.
Files you'll need to edit:
libc/src/stdio/scanf_core/vfscanf_internal.h
libc/src/stdio/scanf_core/reader.h
What to do:
Move the definitions of getc and ungetc in vfscanf_internal into reader.h (along with the associated #if defined logic for each target).
Define the stream_getc and stream_ungetc functions with using statements inside of class Reader (or do something equivalent).
Clean up the relevant code.
If you have questions or need help, feel free to comment on this issue or reach out via the LLVM discord.