types_defs.h (1934B)
1 #pragma once 2 3 #include <stdint.h> 4 5 #include "klib/kvec.h" 6 7 // dummy to pass an ACL to a function 8 typedef void *vim_acl_T; 9 10 // if data[0] is 0xFF, then data[1..4] is a 24-bit index (in machine endianness) 11 // otherwise it must be a UTF-8 string of length maximum 4 (no NUL when n=4) 12 typedef uint32_t schar_T; 13 typedef int32_t sattr_T; 14 // must be at least as big as the biggest of schar_T, sattr_T, colnr_T 15 typedef int32_t sscratch_T; 16 17 // Includes final NUL. MAX_MCO is no longer used, but at least 4*(MAX_MCO+1)+1=29 18 // ensures we can fit all composed chars which did fit before. 19 #define MAX_SCHAR_SIZE 32 20 21 // Opaque handle used by API clients to refer to various objects in vim 22 typedef int handle_T; 23 24 // Opaque handle to a lua value. Must be free with `api_free_luaref` when 25 // not needed anymore! LUA_NOREF represents missing reference, i e to indicate 26 // absent callback etc. 27 typedef int LuaRef; 28 29 /// Type used for Vimscript VAR_FLOAT values 30 typedef double float_T; 31 32 typedef struct MsgpackRpcRequestHandler MsgpackRpcRequestHandler; 33 34 typedef union { 35 float_T (*float_func)(float_T); 36 const MsgpackRpcRequestHandler *api_handler; 37 void *null; 38 } EvalFuncData; 39 40 typedef handle_T NS; 41 42 typedef uint64_t proftime_T; 43 44 typedef enum { 45 kNone = -1, 46 kFalse = 0, 47 kTrue = 1, 48 } TriState; 49 50 #define TRISTATE_TO_BOOL(val, \ 51 default) ((val) == kTrue ? true : ((val) == kFalse ? false : (default))) 52 53 #define TRISTATE_FROM_INT(val) ((val) == 0 ? kFalse : ((val) >= 1 ? kTrue : kNone)) 54 55 typedef int64_t OptInt; 56 57 enum { SIGN_WIDTH = 2, }; ///< Number of display cells for a sign in the signcolumn 58 59 typedef struct file_buffer buf_T; 60 typedef struct loop Loop; 61 typedef struct regprog regprog_T; 62 typedef struct syn_state synstate_T; 63 typedef struct terminal Terminal; 64 typedef struct window_S win_T; 65 66 typedef struct { 67 uint32_t nitems; 68 uint32_t nbytes; 69 char data[]; 70 } AdditionalData; 71 72 typedef kvec_t(char) StringBuilder;