charset.h (1349B)
1 #pragma once 2 3 #include <stdbool.h> 4 #include <stdint.h> 5 6 #include "nvim/option_vars.h" 7 #include "nvim/strings.h" // IWYU pragma: keep 8 9 /// Flags for vim_str2nr() 10 typedef enum { 11 STR2NR_DEC = 0, 12 STR2NR_BIN = (1 << 0), ///< Allow binary numbers. 13 STR2NR_OCT = (1 << 1), ///< Allow octal numbers. 14 STR2NR_HEX = (1 << 2), ///< Allow hexadecimal numbers. 15 STR2NR_OOCT = (1 << 3), ///< Octal with prefix "0o": 0o777 16 /// Force one of the above variants. 17 /// 18 /// STR2NR_FORCE|STR2NR_DEC is actually not different from supplying zero 19 /// as flags, but still present for completeness. 20 /// 21 /// STR2NR_FORCE|STR2NR_OCT|STR2NR_OOCT is the same as STR2NR_FORCE|STR2NR_OCT 22 /// or STR2NR_FORCE|STR2NR_OOCT. 23 STR2NR_FORCE = (1 << 7), 24 /// Recognize all formats vim_str2nr() can recognize. 25 STR2NR_ALL = STR2NR_BIN | STR2NR_OCT | STR2NR_HEX | STR2NR_OOCT, 26 /// Disallow octals numbers without the 0o prefix. 27 STR2NR_NO_OCT = STR2NR_BIN | STR2NR_HEX | STR2NR_OOCT, 28 STR2NR_QUOTE = (1 << 4), ///< Ignore embedded single quotes. 29 } ChStr2NrFlags; 30 31 #include "charset.h.generated.h" 32 #include "charset.h.inline.generated.h" 33 34 /// Check if `c` is one of the characters in 'breakat'. 35 /// Used very often if 'linebreak' is set 36 static inline bool vim_isbreak(int c) 37 FUNC_ATTR_CONST FUNC_ATTR_ALWAYS_INLINE 38 { 39 return breakat_flags[(uint8_t)c]; 40 }