Debian Codegraph @

ext/misc/sqlite3_stdio.h

raw
1 /*
2 ** 2024-09-24
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
6 **
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
10 **
11 *************************************************************************
12 **
13 ** This header file contains definitions of interfaces that provide
14 ** cross-platform I/O for UTF-8 content.
15 **
16 ** On most platforms, the interfaces definitions in this file are
17 ** just #defines. For example sqlite3_fopen() is a macro that resolves
18 ** to the standard fopen() in the C-library.
19 **
20 ** But Windows does not have a standard C-library, at least not one that
21 ** can handle UTF-8. So for windows build, the interfaces resolve to new
22 ** C-language routines contained in the separate sqlite3_stdio.c source file.
23 **
24 ** So on all non-Windows platforms, simply #include this header file and
25 ** use the interfaces defined herein. Then to run your application on Windows,
26 ** also link in the accompanying sqlite3_stdio.c source file when compiling
27 ** to get compatible interfaces.
28 */
29 #ifndef _SQLITE3_STDIO_H_
30 #define _SQLITE3_STDIO_H_ 1
31 #ifdef _WIN32
32 /**** Definitions For Windows ****/
33 #include <stdio.h>
34 #include <stdarg.h>
35 #include <windows.h>
36
37 FILE *sqlite3_fopen(const char *zFilename, const char *zMode);
38 FILE *sqlite3_popen(const char *zCommand, const char *type);
39 char *sqlite3_fgets(char *s, int size, FILE *stream);
40 int sqlite3_fputs(const char *s, FILE *stream);
41 int sqlite3_fprintf(FILE *stream, const char *format, ...);
42 int sqlite3_vfprintf(FILE *stream, const char *format, va_list);
43 void sqlite3_fsetmode(FILE *stream, int mode);
44
45
46 #else
47 /**** Definitions For All Other Platforms ****/
48 #include <stdio.h>
49 #define sqlite3_fopen fopen
50 #define sqlite3_popen popen
51 #define sqlite3_fgets fgets
52 #define sqlite3_fputs fputs
53 #define sqlite3_fprintf fprintf
54 #define sqlite3_vfprintf vfprintf
55 #define sqlite3_fsetmode(F,X) /*no-op*/
56
57 #endif
58 #endif /* _SQLITE3_STDIO_H_ */