Merge #7030 'refactor/single-include'

ref #5321
This commit is contained in:
Justin M. Keyes
2017-10-21 04:09:11 +02:00
7 changed files with 38 additions and 32 deletions

View File

@@ -541,11 +541,6 @@ endfunction()
set(NO_SINGLE_CHECK_HEADERS set(NO_SINGLE_CHECK_HEADERS
os/win_defs.h os/win_defs.h
os/pty_process_win.h os/pty_process_win.h
regexp_defs.h
syntax_defs.h
terminal.h
undo.h
undo_defs.h
) )
foreach(hfile ${NVIM_HEADERS}) foreach(hfile ${NVIM_HEADERS})
get_test_target(test-includes "${hfile}" relative_path texe) get_test_target(test-includes "${hfile}" relative_path texe)

View File

@@ -15,6 +15,8 @@
#include <stdbool.h> #include <stdbool.h>
#include "nvim/pos.h" #include "nvim/pos.h"
#include "nvim/types.h"
#include "nvim/profile.h"
/* /*
* The number of sub-matches is limited to 10. * The number of sub-matches is limited to 10.
@@ -41,18 +43,36 @@
#define NFA_ENGINE 2 #define NFA_ENGINE 2
typedef struct regengine regengine_T; typedef struct regengine regengine_T;
typedef struct regprog regprog_T;
typedef struct reg_extmatch reg_extmatch_T;
/// Structure to be used for multi-line matching.
/// Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col"
/// and ends in line "endpos[no].lnum" just before column "endpos[no].col".
/// The line numbers are relative to the first line, thus startpos[0].lnum is
/// always 0.
/// When there is no match, the line number is -1.
typedef struct {
regprog_T *regprog;
lpos_T startpos[NSUBEXP];
lpos_T endpos[NSUBEXP];
int rmm_ic;
colnr_T rmm_maxcol; /// when not zero: maximum column
} regmmatch_T;
#include "nvim/buffer_defs.h"
/* /*
* Structure returned by vim_regcomp() to pass on to vim_regexec(). * Structure returned by vim_regcomp() to pass on to vim_regexec().
* This is the general structure. For the actual matcher, two specific * This is the general structure. For the actual matcher, two specific
* structures are used. See code below. * structures are used. See code below.
*/ */
typedef struct regprog { struct regprog {
regengine_T *engine; regengine_T *engine;
unsigned regflags; unsigned regflags;
unsigned re_engine; ///< Automatic, backtracking or NFA engine. unsigned re_engine; ///< Automatic, backtracking or NFA engine.
unsigned re_flags; ///< Second argument for vim_regcomp(). unsigned re_flags; ///< Second argument for vim_regcomp().
} regprog_T; };
/* /*
* Structure used by the back track matcher. * Structure used by the back track matcher.
@@ -125,31 +145,15 @@ typedef struct {
bool rm_ic; bool rm_ic;
} regmatch_T; } regmatch_T;
/*
* Structure to be used for multi-line matching.
* Sub-match "no" starts in line "startpos[no].lnum" column "startpos[no].col"
* and ends in line "endpos[no].lnum" just before column "endpos[no].col".
* The line numbers are relative to the first line, thus startpos[0].lnum is
* always 0.
* When there is no match, the line number is -1.
*/
typedef struct {
regprog_T *regprog;
lpos_T startpos[NSUBEXP];
lpos_T endpos[NSUBEXP];
int rmm_ic;
colnr_T rmm_maxcol; /* when not zero: maximum column */
} regmmatch_T;
/* /*
* Structure used to store external references: "\z\(\)" to "\z\1". * Structure used to store external references: "\z\(\)" to "\z\1".
* Use a reference count to avoid the need to copy this around. When it goes * Use a reference count to avoid the need to copy this around. When it goes
* from 1 to zero the matches need to be freed. * from 1 to zero the matches need to be freed.
*/ */
typedef struct { struct reg_extmatch {
short refcnt; int16_t refcnt;
char_u *matches[NSUBEXP]; char_u *matches[NSUBEXP];
} reg_extmatch_T; };
struct regengine { struct regengine {
regprog_T *(*regcomp)(char_u*, int); regprog_T *(*regcomp)(char_u*, int);

View File

@@ -2,7 +2,6 @@
#define NVIM_SYNTAX_DEFS_H #define NVIM_SYNTAX_DEFS_H
#include "nvim/highlight_defs.h" #include "nvim/highlight_defs.h"
#include "nvim/regexp_defs.h"
# define SST_MIN_ENTRIES 150 /* minimal size for state stack array */ # define SST_MIN_ENTRIES 150 /* minimal size for state stack array */
# define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */ # define SST_MAX_ENTRIES 1000 /* maximal size for state stack array */
@@ -10,6 +9,11 @@
# define SST_DIST 16 /* normal distance between entries */ # define SST_DIST 16 /* normal distance between entries */
# define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */ # define SST_INVALID (synstate_T *)-1 /* invalid syn_state pointer */
typedef struct syn_state synstate_T;
#include "nvim/buffer_defs.h"
#include "nvim/regexp_defs.h"
typedef unsigned short disptick_T; /* display tick type */ typedef unsigned short disptick_T; /* display tick type */
/* struct passed to in_id_list() */ /* struct passed to in_id_list() */
@@ -48,8 +52,6 @@ typedef struct buf_state {
* syn_state contains the syntax state stack for the start of one line. * syn_state contains the syntax state stack for the start of one line.
* Used by b_sst_array[]. * Used by b_sst_array[].
*/ */
typedef struct syn_state synstate_T;
struct syn_state { struct syn_state {
synstate_T *sst_next; /* next entry in used or free list */ synstate_T *sst_next; /* next entry in used or free list */
linenr_T sst_lnum; /* line number for this state */ linenr_T sst_lnum; /* line number for this state */

View File

@@ -10,6 +10,8 @@ typedef void (*terminal_write_cb)(char *buffer, size_t size, void *data);
typedef void (*terminal_resize_cb)(uint16_t width, uint16_t height, void *data); typedef void (*terminal_resize_cb)(uint16_t width, uint16_t height, void *data);
typedef void (*terminal_close_cb)(void *data); typedef void (*terminal_close_cb)(void *data);
#include "nvim/buffer_defs.h"
typedef struct { typedef struct {
void *data; void *data;
uint16_t width, height; uint16_t width, height;

View File

@@ -2,6 +2,7 @@
#define NVIM_UNDO_H #define NVIM_UNDO_H
#include "nvim/undo_defs.h" #include "nvim/undo_defs.h"
#include "nvim/ex_cmds_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS #ifdef INCLUDE_GENERATED_DECLARATIONS
# include "undo.h.generated.h" # include "undo.h.generated.h"

View File

@@ -4,9 +4,10 @@
#include <time.h> // for time_t #include <time.h> // for time_t
#include "nvim/pos.h" #include "nvim/pos.h"
#include "nvim/buffer_defs.h"
#include "nvim/mark_defs.h" #include "nvim/mark_defs.h"
typedef struct u_header u_header_T;
/* Structure to store info about the Visual area. */ /* Structure to store info about the Visual area. */
typedef struct { typedef struct {
pos_T vi_start; /* start pos of last VIsual */ pos_T vi_start; /* start pos of last VIsual */
@@ -15,8 +16,9 @@ typedef struct {
colnr_T vi_curswant; /* MAXCOL from w_curswant */ colnr_T vi_curswant; /* MAXCOL from w_curswant */
} visualinfo_T; } visualinfo_T;
#include "nvim/buffer_defs.h"
typedef struct u_entry u_entry_T; typedef struct u_entry u_entry_T;
typedef struct u_header u_header_T;
struct u_entry { struct u_entry {
u_entry_T *ue_next; /* pointer to next entry in list */ u_entry_T *ue_next; /* pointer to next entry in list */
linenr_T ue_top; /* number of line above undo block */ linenr_T ue_top; /* number of line above undo block */