mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
Add automatic generation of headers
- The 'stripdecls.py' script replaces declarations in all headers by includes to generated headers. `ag '#\s*if(?!ndef NEOVIM_).*((?!#\s*endif).*\n)*#ifdef INCLUDE_GENERATED'` was used for this. - Add and integrate gendeclarations.lua into the build system to generate the required includes. - Add -Wno-unused-function - Made a bunch of old-style definitions ANSI This adds a requirement: all type and structure definitions must be present before INCLUDE_GENERATED_DECLARATIONS-protected include. Warning: mch_expandpath (path.h.generated.h) was moved manually. So far it is the only exception.
This commit is contained in:
107
src/nvim/fold.c
107
src/nvim/fold.c
@@ -60,37 +60,33 @@ typedef struct {
|
||||
|
||||
#define MAX_LEVEL 20 /* maximum fold depth */
|
||||
|
||||
/* static functions {{{2 */
|
||||
static void newFoldLevelWin(win_T *wp);
|
||||
static int checkCloseRec(garray_T *gap, linenr_T lnum, int level);
|
||||
static int foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp);
|
||||
static int foldLevelWin(win_T *wp, linenr_T lnum);
|
||||
static void checkupdate(win_T *wp);
|
||||
static void setFoldRepeat(linenr_T lnum, long count, int do_open);
|
||||
static linenr_T setManualFold(linenr_T lnum, int opening, int recurse,
|
||||
int *donep);
|
||||
static linenr_T setManualFoldWin(win_T *wp, linenr_T lnum, int opening,
|
||||
int recurse,
|
||||
int *donep);
|
||||
static void foldOpenNested(fold_T *fpr);
|
||||
static void deleteFoldEntry(garray_T *gap, int idx, int recursive);
|
||||
static void foldMarkAdjustRecurse(garray_T *gap, linenr_T line1,
|
||||
linenr_T line2, long amount,
|
||||
long amount_after);
|
||||
static int getDeepestNestingRecurse(garray_T *gap);
|
||||
static int check_closed(win_T *win, fold_T *fp, int *use_levelp,
|
||||
int level, int *maybe_smallp,
|
||||
linenr_T lnum_off);
|
||||
static void checkSmall(win_T *wp, fold_T *fp, linenr_T lnum_off);
|
||||
static void setSmallMaybe(garray_T *gap);
|
||||
static void foldCreateMarkers(linenr_T start, linenr_T end);
|
||||
static void foldAddMarker(linenr_T lnum, char_u *marker, int markerlen);
|
||||
static void deleteFoldMarkers(fold_T *fp, int recursive,
|
||||
linenr_T lnum_off);
|
||||
static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen);
|
||||
static void foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot);
|
||||
static void parseMarker(win_T *wp);
|
||||
/* Define "fline_T", passed to get fold level for a line. {{{2 */
|
||||
typedef struct {
|
||||
win_T *wp; /* window */
|
||||
linenr_T lnum; /* current line number */
|
||||
linenr_T off; /* offset between lnum and real line number */
|
||||
linenr_T lnum_save; /* line nr used by foldUpdateIEMSRecurse() */
|
||||
int lvl; /* current level (-1 for undefined) */
|
||||
int lvl_next; /* level used for next line */
|
||||
int start; /* number of folds that are forced to start at
|
||||
this line. */
|
||||
int end; /* level of fold that is forced to end below
|
||||
this line */
|
||||
int had_end; /* level of fold that is forced to end above
|
||||
this line (copy of "end" of prev. line) */
|
||||
} fline_T;
|
||||
|
||||
/* Flag is set when redrawing is needed. */
|
||||
static int fold_changed;
|
||||
|
||||
/* Function used by foldUpdateIEMSRecurse */
|
||||
typedef void (*LevelGetter)(fline_T *);
|
||||
|
||||
/* static functions {{{2 */
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "fold.c.generated.h"
|
||||
#endif
|
||||
static char *e_nofold = N_("E490: No fold found");
|
||||
|
||||
/*
|
||||
@@ -1868,39 +1864,7 @@ void foldtext_cleanup(char_u *str)
|
||||
}
|
||||
|
||||
/* Folding by indent, expr, marker and syntax. {{{1 */
|
||||
/* Define "fline_T", passed to get fold level for a line. {{{2 */
|
||||
typedef struct {
|
||||
win_T *wp; /* window */
|
||||
linenr_T lnum; /* current line number */
|
||||
linenr_T off; /* offset between lnum and real line number */
|
||||
linenr_T lnum_save; /* line nr used by foldUpdateIEMSRecurse() */
|
||||
int lvl; /* current level (-1 for undefined) */
|
||||
int lvl_next; /* level used for next line */
|
||||
int start; /* number of folds that are forced to start at
|
||||
this line. */
|
||||
int end; /* level of fold that is forced to end below
|
||||
this line */
|
||||
int had_end; /* level of fold that is forced to end above
|
||||
this line (copy of "end" of prev. line) */
|
||||
} fline_T;
|
||||
|
||||
/* Flag is set when redrawing is needed. */
|
||||
static int fold_changed;
|
||||
|
||||
/* Function declarations. {{{2 */
|
||||
static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level,
|
||||
linenr_T startlnum, fline_T *flp,
|
||||
void (*getlevel)(fline_T *), linenr_T bot,
|
||||
int topflags);
|
||||
static void foldInsert(garray_T *gap, int i);
|
||||
static void foldSplit(garray_T *gap, int i, linenr_T top, linenr_T bot);
|
||||
static void foldRemove(garray_T *gap, linenr_T top, linenr_T bot);
|
||||
static void foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2);
|
||||
static void foldlevelIndent(fline_T *flp);
|
||||
static void foldlevelDiff(fline_T *flp);
|
||||
static void foldlevelExpr(fline_T *flp);
|
||||
static void foldlevelMarker(fline_T *flp);
|
||||
static void foldlevelSyntax(fline_T *flp);
|
||||
|
||||
/* foldUpdateIEMS() {{{2 */
|
||||
/*
|
||||
@@ -2137,15 +2101,12 @@ static void foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot)
|
||||
* Returns bot, which may have been increased for lines that also need to be
|
||||
* updated as a result of a detected change in the fold.
|
||||
*/
|
||||
static linenr_T foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot,
|
||||
topflags)
|
||||
garray_T *gap;
|
||||
int level;
|
||||
linenr_T startlnum;
|
||||
fline_T *flp;
|
||||
void (*getlevel)(fline_T *);
|
||||
linenr_T bot;
|
||||
int topflags; /* flags used by containing fold */
|
||||
static linenr_T foldUpdateIEMSRecurse(garray_T *gap, int level,
|
||||
linenr_T startlnum, fline_T *flp,
|
||||
LevelGetter getlevel,
|
||||
linenr_T bot,
|
||||
int topflags /* flags used by containing fold */
|
||||
)
|
||||
{
|
||||
linenr_T ll;
|
||||
fold_T *fp = NULL;
|
||||
@@ -2920,10 +2881,6 @@ static void foldlevelSyntax(fline_T *flp)
|
||||
|
||||
/* functions for storing the fold state in a View {{{1 */
|
||||
/* put_folds() {{{2 */
|
||||
static int put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off);
|
||||
static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap,
|
||||
linenr_T off);
|
||||
static int put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off);
|
||||
|
||||
/*
|
||||
* Write commands to "fd" to restore the manual folds in window "wp".
|
||||
|
Reference in New Issue
Block a user