aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/fileio.h')
-rw-r--r--src/nvim/fileio.h43
1 files changed, 33 insertions, 10 deletions
diff --git a/src/nvim/fileio.h b/src/nvim/fileio.h
index dabcda5bf2..d1f6561507 100644
--- a/src/nvim/fileio.h
+++ b/src/nvim/fileio.h
@@ -1,11 +1,16 @@
-#ifndef NVIM_FILEIO_H
-#define NVIM_FILEIO_H
+#pragma once
-#include "nvim/buffer_defs.h"
-#include "nvim/eval/typval.h"
+#include <stdint.h> // IWYU pragma: keep
+#include <stdio.h> // IWYU pragma: keep
+#include <time.h> // IWYU pragma: keep
+
+#include "nvim/buffer_defs.h" // IWYU pragma: keep
#include "nvim/eval/typval_defs.h"
-#include "nvim/garray.h"
-#include "nvim/os/os.h"
+#include "nvim/ex_cmds_defs.h" // IWYU pragma: keep
+#include "nvim/garray_defs.h" // IWYU pragma: keep
+#include "nvim/globals.h"
+#include "nvim/os/fs_defs.h" // IWYU pragma: keep
+#include "nvim/pos_defs.h"
// Values for readfile() flags
#define READ_NEW 0x01 // read a file into a new buffer
@@ -18,12 +23,30 @@
#define READ_NOWINENTER 0x80 // do not trigger BufWinEnter
#define READ_NOFILE 0x100 // do not read a file, do trigger BufReadCmd
-#define READ_STRING(x, y) (char_u *)read_string((x), (size_t)(y))
-
typedef varnumber_T (*CheckItem)(void *expr, const char *name);
+enum {
+ FIO_LATIN1 = 0x01, // convert Latin1
+ FIO_UTF8 = 0x02, // convert UTF-8
+ FIO_UCS2 = 0x04, // convert UCS-2
+ FIO_UCS4 = 0x08, // convert UCS-4
+ FIO_UTF16 = 0x10, // convert UTF-16
+ FIO_ENDIAN_L = 0x80, // little endian
+ FIO_NOCONVERT = 0x2000, // skip encoding conversion
+ FIO_UCSBOM = 0x4000, // check for BOM at start of file
+ FIO_ALL = -1, // allow all formats
+};
+
+// When converting, a read() or write() may leave some bytes to be converted
+// for the next call. The value is guessed...
+#define CONV_RESTLEN 30
+
+#define WRITEBUFSIZE 8192 // size of normal write buffer
+
+// We have to guess how much a sequence of bytes may expand when converting
+// with iconv() to be able to allocate a buffer.
+#define ICONV_MULT 8
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
-// Events for autocommands
# include "fileio.h.generated.h"
#endif
-#endif // NVIM_FILEIO_H