summaryrefslogtreecommitdiff
path: root/include/libc/ansi_files.h
blob: 60a39ece19528e93cc3946fc6d16df7224be4d77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef _DOLPHIN_ANSI_FILES_H
#define _DOLPHIN_ANSI_FILES_H
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus

#define set_eof(file)                                                                              \
  do {                                                                                             \
    (file)->state.io_state = __neutral;                                                            \
    (file)->state.eof = 1;                                                                         \
    (file)->buffer_len = 0;                                                                        \
  } while (0)

#define set_error(file)                                                                            \
  do {                                                                                             \
    (file)->state.error = 1;                                                                       \
    (file)->buffer_len = 0;                                                                        \
  } while (0)

int __flush_buffer(FILE* file, size_t* length);
void __prep_buffer(FILE* file);
int __flush_all();

#ifdef __cplusplus
};
#endif // ifdef __cplusplus

#endif