diff options
author | ZyX <kp-pav@yandex.ru> | 2017-11-06 19:06:24 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-11-06 19:06:24 +0300 |
commit | c85f485aa78352f31421d209176b2ed57b91b86e (patch) | |
tree | 43095669b66e8fe36287504bb2289d740fee0d34 | |
parent | 05f775b5f248d922c9539432235738cc53e7edd7 (diff) | |
download | rneovim-c85f485aa78352f31421d209176b2ed57b91b86e.tar.gz rneovim-c85f485aa78352f31421d209176b2ed57b91b86e.tar.bz2 rneovim-c85f485aa78352f31421d209176b2ed57b91b86e.zip |
charset: Move vim_str2nr flags from vim.h to charset.h
-rw-r--r-- | src/nvim/charset.c | 2 | ||||
-rw-r--r-- | src/nvim/charset.h | 15 | ||||
-rw-r--r-- | src/nvim/vim.h | 7 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/nvim/charset.c b/src/nvim/charset.c index 5aebf90194..980b4ed426 100644 --- a/src/nvim/charset.c +++ b/src/nvim/charset.c @@ -1615,7 +1615,7 @@ bool vim_isblankline(char_u *lbuf) /// hexadecimal, '0' = octal, 'b' or 'B' is binary. When using /// STR2NR_FORCE is always zero. /// @param len Returns the detected length of number. -/// @param what Recognizes what number passed. +/// @param what Recognizes what number passed, @see ChStr2NrFlags. /// @param nptr Returns the signed result. /// @param unptr Returns the unsigned result. /// @param maxlen Max length of string to check. diff --git a/src/nvim/charset.h b/src/nvim/charset.h index c69582c4c6..7198c8d405 100644 --- a/src/nvim/charset.h +++ b/src/nvim/charset.h @@ -15,6 +15,21 @@ ?((int)(uint8_t)(c)) \ :((int)(c))) +/// Flags for vim_str2nr() +typedef enum { + STR2NR_DEC = 0, + STR2NR_BIN = (1 << 0), ///< Allow binary numbers. + STR2NR_OCT = (1 << 1), ///< Allow octal numbers. + STR2NR_HEX = (1 << 2), ///< Allow hexadecimal numbers. + /// Force one of the above variants. + /// + /// STR2NR_FORCE|STR2NR_DEC is actually not different from supplying zero + /// as flags, but still present for completeness. + STR2NR_FORCE = (1 << 3), + /// Recognize all formats vim_str2nr() can recognize. + STR2NR_ALL = STR2NR_BIN | STR2NR_OCT | STR2NR_HEX, +} ChStr2NrFlags; + #ifdef INCLUDE_GENERATED_DECLARATIONS # include "charset.h.generated.h" #endif diff --git a/src/nvim/vim.h b/src/nvim/vim.h index 62ffc7433e..096c57450f 100644 --- a/src/nvim/vim.h +++ b/src/nvim/vim.h @@ -28,13 +28,6 @@ /// length of a buffer to store a number in ASCII (64 bits binary + NUL) enum { NUMBUFLEN = 65 }; -// flags for vim_str2nr() -#define STR2NR_BIN 1 -#define STR2NR_OCT 2 -#define STR2NR_HEX 4 -#define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX) -#define STR2NR_FORCE 8 // only when ONE of the above is used - #define MAX_TYPENR 65535 #define ROOT_UID 0 |