mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06: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:
parent
880957ad4e
commit
70929f7e16
@ -33,6 +33,8 @@ if(TRAVIS_CI_BUILD)
|
||||
add_definitions(-Werror)
|
||||
endif()
|
||||
|
||||
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
# cmake automatically appends -g to the compiler flags
|
||||
|
232
scripts/gendeclarations.lua
Executable file
232
scripts/gendeclarations.lua
Executable file
@ -0,0 +1,232 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
local fname = arg[1]
|
||||
local static_fname = arg[2]
|
||||
local non_static_fname = arg[3]
|
||||
local cpp = arg[4]
|
||||
|
||||
cpp = cpp:gsub(' %-DINCLUDE_GENERATED_DECLARATIONS ', ' ')
|
||||
|
||||
local lpeg = require('lpeg')
|
||||
|
||||
local fold = function (func, ...)
|
||||
local result = nil
|
||||
for i, v in ipairs({...}) do
|
||||
if result == nil then
|
||||
result = v
|
||||
else
|
||||
result = func(result, v)
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
local folder = function (func)
|
||||
return function (...)
|
||||
return fold(func, ...)
|
||||
end
|
||||
end
|
||||
|
||||
local lit = lpeg.P
|
||||
local set = function(...)
|
||||
return lpeg.S(fold(function (a, b) return a .. b end, ...))
|
||||
end
|
||||
local any_character = lpeg.P(1)
|
||||
local rng = function(s, e) return lpeg.R(s .. e) end
|
||||
local concat = folder(function (a, b) return a * b end)
|
||||
local branch = folder(function (a, b) return a + b end)
|
||||
local one_or_more = function(v) return v ^ 1 end
|
||||
local two_or_more = function(v) return v ^ 2 end
|
||||
local any_amount = function(v) return v ^ 0 end
|
||||
local one_or_no = function(v) return v ^ -1 end
|
||||
local look_behind = lpeg.B
|
||||
local look_ahead = function(v) return #v end
|
||||
local neg_look_ahead = function(v) return -v end
|
||||
local neg_look_behind = function(v) return -look_behind(v) end
|
||||
|
||||
local w = branch(
|
||||
rng('a', 'z'),
|
||||
rng('A', 'Z'),
|
||||
lit('_')
|
||||
)
|
||||
local aw = branch(
|
||||
w,
|
||||
rng('0', '9')
|
||||
)
|
||||
local s = set(' ', '\n', '\t')
|
||||
local raw_word = concat(w, any_amount(aw))
|
||||
local right_word = concat(
|
||||
raw_word,
|
||||
neg_look_ahead(aw)
|
||||
)
|
||||
local word = concat(
|
||||
neg_look_behind(aw),
|
||||
right_word
|
||||
)
|
||||
local spaces = any_amount(branch(
|
||||
s,
|
||||
-- Comments are really handled by preprocessor, so the following is not needed
|
||||
concat(
|
||||
lit('/*'),
|
||||
any_amount(concat(
|
||||
neg_look_ahead(lit('*/')),
|
||||
any_character
|
||||
)),
|
||||
lit('*/')
|
||||
),
|
||||
concat(
|
||||
lit('//'),
|
||||
any_amount(concat(
|
||||
neg_look_ahead(lit('\n')),
|
||||
any_character
|
||||
)),
|
||||
lit('\n')
|
||||
)
|
||||
))
|
||||
local typ_part = concat(
|
||||
word,
|
||||
any_amount(concat(
|
||||
spaces,
|
||||
lit('*')
|
||||
)),
|
||||
spaces
|
||||
)
|
||||
local typ = one_or_more(typ_part)
|
||||
local typ_id = two_or_more(typ_part)
|
||||
local arg = typ_id -- argument name is swallowed by typ
|
||||
local pattern = concat(
|
||||
typ_id, -- return type with function name
|
||||
spaces,
|
||||
lit('('),
|
||||
spaces,
|
||||
one_or_no(branch( -- function arguments
|
||||
concat(
|
||||
arg, -- first argument, does not require comma
|
||||
any_amount(concat( -- following arguments, start with a comma
|
||||
spaces,
|
||||
lit(','),
|
||||
spaces,
|
||||
arg,
|
||||
any_amount(concat(
|
||||
lit('['),
|
||||
spaces,
|
||||
any_amount(aw),
|
||||
spaces,
|
||||
lit(']')
|
||||
))
|
||||
)),
|
||||
one_or_no(concat(
|
||||
spaces,
|
||||
lit(','),
|
||||
spaces,
|
||||
lit('...')
|
||||
))
|
||||
),
|
||||
lit('void') -- also accepts just void
|
||||
)),
|
||||
spaces,
|
||||
lit(')'),
|
||||
any_amount(concat( -- optional attributes
|
||||
spaces,
|
||||
lit('FUNC_ATTR_'),
|
||||
any_amount(aw),
|
||||
one_or_no(concat( -- attribute argument
|
||||
spaces,
|
||||
lit('('),
|
||||
any_amount(concat(
|
||||
neg_look_ahead(lit(')')),
|
||||
any_character
|
||||
)),
|
||||
lit(')')
|
||||
))
|
||||
)),
|
||||
look_ahead(concat( -- definition must be followed by "{"
|
||||
spaces,
|
||||
lit('{')
|
||||
))
|
||||
)
|
||||
|
||||
if fname == '--help' then
|
||||
print'Usage:'
|
||||
print()
|
||||
print' gendeclarations.lua definitions.c static.h non-static.h "cc -E …"'
|
||||
os.exit()
|
||||
end
|
||||
|
||||
local pipe = io.popen(cpp .. ' -DDO_NOT_DEFINE_EMPTY_ATTRIBUTES ' .. fname, 'r')
|
||||
local text = pipe:read('*a')
|
||||
if not pipe:close() then
|
||||
os.exit(2)
|
||||
end
|
||||
|
||||
local header = [[
|
||||
#ifndef DEFINE_FUNC_ATTRIBUTES
|
||||
# define DEFINE_FUNC_ATTRIBUTES
|
||||
#endif
|
||||
#include "nvim/func_attr.h"
|
||||
#undef DEFINE_FUNC_ATTRIBUTES
|
||||
]]
|
||||
|
||||
local footer = [[
|
||||
#include "nvim/func_attr.h"
|
||||
]]
|
||||
|
||||
local non_static = header
|
||||
local static = header
|
||||
|
||||
local filepattern = '^# %d+ "[^"]-/?([^"/]+)"'
|
||||
local curfile
|
||||
|
||||
init = 0
|
||||
curfile = nil
|
||||
neededfile = fname:match('[^/]+$')
|
||||
while init ~= nil do
|
||||
init = text:find('\n', init)
|
||||
if init == nil then
|
||||
break
|
||||
end
|
||||
init = init + 1
|
||||
if text:sub(init, init) == '#' then
|
||||
file = text:match(filepattern, init)
|
||||
if file ~= nil then
|
||||
curfile = file
|
||||
end
|
||||
elseif curfile == neededfile then
|
||||
s = init
|
||||
e = pattern:match(text, init)
|
||||
if e ~= nil then
|
||||
local declaration = text:sub(s, e - 1)
|
||||
-- Comments are really handled by preprocessor, so the following is not
|
||||
-- needed
|
||||
declaration = declaration:gsub('/%*.-%*/', '')
|
||||
declaration = declaration:gsub('//.-\n', '\n')
|
||||
|
||||
declaration = declaration:gsub('\n', ' ')
|
||||
declaration = declaration:gsub('%s+', ' ')
|
||||
declaration = declaration:gsub(' ?%( ?', '(')
|
||||
declaration = declaration:gsub(' ?%) ?', ')')
|
||||
declaration = declaration:gsub(' ?, ?', ', ')
|
||||
declaration = declaration:gsub(' ?(%*+) ?', ' %1')
|
||||
declaration = declaration:gsub(' ?(FUNC_ATTR_)', ' %1')
|
||||
declaration = declaration:gsub(' $', '')
|
||||
declaration = declaration .. ';\n'
|
||||
if text:sub(s, s + 5) == 'static' then
|
||||
static = static .. declaration
|
||||
else
|
||||
non_static = non_static .. declaration
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
non_static = non_static .. footer
|
||||
static = static .. footer
|
||||
|
||||
local F
|
||||
F = io.open(static_fname, 'w')
|
||||
F:write(static)
|
||||
F:close()
|
||||
|
||||
F = io.open(non_static_fname, 'w')
|
||||
F:write(non_static)
|
||||
F:close()
|
@ -94,7 +94,9 @@ output:write([[
|
||||
]])
|
||||
|
||||
for i = 1, #headers do
|
||||
output:write('\n#include "nvim/'..headers[i]..'"')
|
||||
if headers[i]:sub(-12) ~= '.generated.h' then
|
||||
output:write('\n#include "nvim/'..headers[i]..'"')
|
||||
end
|
||||
end
|
||||
|
||||
output:write([[
|
||||
|
141
scripts/stripdecls.py
Executable file
141
scripts/stripdecls.py
Executable file
@ -0,0 +1,141 @@
|
||||
#!/usr/bin/python
|
||||
# vim: set fileencoding=utf-8:
|
||||
|
||||
from __future__ import print_function, unicode_literals, division
|
||||
|
||||
from clang.cindex import Index, CursorKind
|
||||
from collections import namedtuple, OrderedDict, defaultdict
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
DECL_KINDS = {
|
||||
CursorKind.FUNCTION_DECL,
|
||||
}
|
||||
|
||||
|
||||
Strip = namedtuple('Strip', 'start_line start_column end_line end_column')
|
||||
|
||||
|
||||
def main(progname, cfname, only_static, move_all):
|
||||
only_static = False
|
||||
|
||||
cfname = os.path.abspath(os.path.normpath(cfname))
|
||||
|
||||
hfname1 = os.path.splitext(cfname)[0] + os.extsep + 'h'
|
||||
hfname2 = os.path.splitext(cfname)[0] + '_defs' + os.extsep + 'h'
|
||||
|
||||
files_to_modify = (cfname, hfname1, hfname2)
|
||||
|
||||
index = Index.create()
|
||||
src_dirname = os.path.join(os.path.dirname(__file__), '..', 'src')
|
||||
src_dirname = os.path.abspath(os.path.normpath(src_dirname))
|
||||
relname = os.path.join(src_dirname, 'nvim')
|
||||
unit = index.parse(cfname, args=('-I' + src_dirname,
|
||||
'-DUNIX',
|
||||
'-DEXITFREE',
|
||||
'-DFEAT_USR_CMDS',
|
||||
'-DFEAT_CMDL_COMPL',
|
||||
'-DFEAT_COMPL_FUNC',
|
||||
'-DPROTO',
|
||||
'-DUSE_MCH_ERRMSG'))
|
||||
cursor = unit.cursor
|
||||
|
||||
tostrip = defaultdict(OrderedDict)
|
||||
definitions = set()
|
||||
|
||||
for child in cursor.get_children():
|
||||
if not (child.location and child.location.file):
|
||||
continue
|
||||
fname = os.path.abspath(os.path.normpath(child.location.file.name))
|
||||
if fname not in files_to_modify:
|
||||
continue
|
||||
if child.kind not in DECL_KINDS:
|
||||
continue
|
||||
if only_static and next(child.get_tokens()).spelling == 'static':
|
||||
continue
|
||||
|
||||
if child.is_definition() and fname == cfname:
|
||||
definitions.add(child.spelling)
|
||||
else:
|
||||
stripdict = tostrip[fname]
|
||||
assert(child.spelling not in stripdict)
|
||||
stripdict[child.spelling] = Strip(
|
||||
child.extent.start.line,
|
||||
child.extent.start.column,
|
||||
child.extent.end.line,
|
||||
child.extent.end.column,
|
||||
)
|
||||
|
||||
for (fname, stripdict) in tostrip.items():
|
||||
if not move_all:
|
||||
for name in set(stripdict) - definitions:
|
||||
stripdict.pop(name)
|
||||
|
||||
if not stripdict:
|
||||
continue
|
||||
|
||||
if fname.endswith('.h'):
|
||||
is_h_file = True
|
||||
include_line = next(reversed(stripdict.values())).start_line + 1
|
||||
else:
|
||||
is_h_file = False
|
||||
include_line = next(iter(stripdict.values())).start_line
|
||||
|
||||
lines = None
|
||||
generated_existed = os.path.exists(fname + '.generated.h')
|
||||
with open(fname, 'rb') as F:
|
||||
lines = list(F)
|
||||
|
||||
stripped = []
|
||||
|
||||
for name, position in reversed(stripdict.items()):
|
||||
sl = slice(position.start_line - 1, position.end_line)
|
||||
if is_h_file:
|
||||
include_line -= sl.stop - sl.start
|
||||
stripped += lines[sl]
|
||||
lines[sl] = ()
|
||||
|
||||
if not generated_existed:
|
||||
lines[include_line:include_line] = [
|
||||
'#ifdef INCLUDE_GENERATED_DECLARATIONS\n',
|
||||
'# include "{0}.generated.h"\n'.format(os.path.relpath(fname, relname)),
|
||||
'#endif\n',
|
||||
]
|
||||
|
||||
with open(fname, 'wb') as F:
|
||||
F.writelines(lines)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
progname = sys.argv[0]
|
||||
args = sys.argv[1:]
|
||||
if not args or '--help' in args:
|
||||
print('Usage:')
|
||||
print('')
|
||||
print(' {0} [--static [--all]] file.c...'.format(progname))
|
||||
print('')
|
||||
print('Stripts all declarations from file.c, file.h and file_defs.h.')
|
||||
print('If --static argument is given then only static declarations are')
|
||||
print('stripped. Declarations are stripped only if corresponding')
|
||||
print('definition is found unless --all argument was given.')
|
||||
print('')
|
||||
print('Note: it is assumed that static declarations starts with "static"')
|
||||
print(' keyword.')
|
||||
sys.exit(0 if args else 1)
|
||||
|
||||
if args[0] == '--static':
|
||||
only_static = True
|
||||
args = args[1:]
|
||||
else:
|
||||
only_static = False
|
||||
|
||||
if args[0] == '--all':
|
||||
move_all = True
|
||||
args = args[1:]
|
||||
else:
|
||||
move_all = False
|
||||
|
||||
for cfname in args:
|
||||
print('Processing {0}'.format(cfname))
|
||||
main(progname, cfname, only_static, move_all)
|
@ -5,16 +5,20 @@ set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/msgpack-gen.lua)
|
||||
file(GLOB API_HEADERS api/*.h)
|
||||
set(MSGPACK_RPC_HEADER ${PROJECT_SOURCE_DIR}/src/nvim/os/msgpack_rpc.h)
|
||||
set(MSGPACK_DISPATCH ${GENERATED_DIR}/msgpack_dispatch.c)
|
||||
set(HEADER_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendeclarations.lua)
|
||||
set(GENERATED_INCLUDES_DIR ${PROJECT_BINARY_DIR}/include)
|
||||
|
||||
include_directories(${GENERATED_DIR})
|
||||
include_directories(${GENERATED_INCLUDES_DIR})
|
||||
|
||||
file(MAKE_DIRECTORY ${GENERATED_DIR})
|
||||
|
||||
add_custom_command(OUTPUT ${MSGPACK_DISPATCH}
|
||||
COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${API_HEADERS} ${MSGPACK_DISPATCH}
|
||||
DEPENDS
|
||||
${API_HEADERS}
|
||||
${MSGPACK_RPC_HEADER}
|
||||
${DISPATCH_GENERATOR}
|
||||
)
|
||||
file(MAKE_DIRECTORY ${GENERATED_DIR}/os)
|
||||
file(MAKE_DIRECTORY ${GENERATED_DIR}/api)
|
||||
file(MAKE_DIRECTORY ${GENERATED_DIR}/api/private)
|
||||
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR})
|
||||
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/os)
|
||||
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/api)
|
||||
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/api/private)
|
||||
|
||||
file( GLOB NEOVIM_SOURCES *.c )
|
||||
|
||||
@ -26,8 +30,6 @@ foreach(sfile ${NEOVIM_SOURCES})
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
|
||||
list(APPEND NEOVIM_SOURCES "${PROJECT_BINARY_DIR}/config/auto/pathdef.c")
|
||||
list(APPEND NEOVIM_SOURCES "${MSGPACK_DISPATCH}")
|
||||
|
||||
file( GLOB OS_SOURCES os/*.c )
|
||||
file( GLOB API_SOURCES api/*.c )
|
||||
@ -78,6 +80,57 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
get_directory_property(gen_cdefs COMPILE_DEFINITIONS)
|
||||
foreach(gen_cdef ${gen_cdefs})
|
||||
set(gen_cflags "${gen_cflags} -D${gen_cdef}")
|
||||
endforeach()
|
||||
|
||||
get_directory_property(gen_includes INCLUDE_DIRECTORIES)
|
||||
foreach(gen_include ${gen_includes})
|
||||
set(gen_cflags "${gen_cflags} -I${gen_include}")
|
||||
endforeach()
|
||||
set(gen_cflags "${gen_cflags} ${CMAKE_C_FLAGS}")
|
||||
|
||||
foreach(sfile ${NEOVIM_SOURCES}
|
||||
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c"
|
||||
${OS_SOURCES}
|
||||
${API_SOURCES}
|
||||
${API_PRIV_SOURCES})
|
||||
get_filename_component(full_d ${sfile} PATH)
|
||||
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
|
||||
get_filename_component(f ${sfile} NAME)
|
||||
get_filename_component(r ${sfile} NAME_WE)
|
||||
if(NOT ${d} EQUAL ".")
|
||||
set(f "${d}/${f}")
|
||||
set(r "${d}/${r}")
|
||||
endif()
|
||||
set(gf1 "${GENERATED_DIR}/${r}.c.generated.h")
|
||||
set(gf2 "${GENERATED_INCLUDES_DIR}/${r}.h.generated.h")
|
||||
add_custom_command(
|
||||
OUTPUT "${gf1}" "${gf2}"
|
||||
COMMAND "${LUA_PRG}" "${HEADER_GENERATOR}"
|
||||
"${sfile}" "${gf1}" "${gf2}"
|
||||
"${CMAKE_C_COMPILER} ${gen_cflags} -E"
|
||||
DEPENDS "${HEADER_GENERATOR}" "${sfile}"
|
||||
)
|
||||
list(APPEND NEOVIM_GENERATED_SOURCES "${gf1}")
|
||||
list(APPEND NEOVIM_GENERATED_SOURCES "${gf2}")
|
||||
if(${d} MATCHES "^api$" AND NOT ${f} MATCHES "^api/helpers.c$")
|
||||
list(APPEND API_HEADERS ${gf2})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${MSGPACK_DISPATCH}
|
||||
COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${API_HEADERS} ${MSGPACK_DISPATCH}
|
||||
DEPENDS
|
||||
${API_HEADERS}
|
||||
${MSGPACK_RPC_HEADER}
|
||||
${DISPATCH_GENERATOR}
|
||||
)
|
||||
|
||||
list(APPEND NEOVIM_SOURCES "${PROJECT_BINARY_DIR}/config/auto/pathdef.c")
|
||||
list(APPEND NEOVIM_SOURCES "${MSGPACK_DISPATCH}")
|
||||
|
||||
# Our dependencies come first.
|
||||
|
||||
if (LibIntl_FOUND)
|
||||
@ -106,14 +159,14 @@ list(APPEND NVIM_LINK_LIBRARIES
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(NOT DEFINED ENV{SKIP_EXEC})
|
||||
add_executable(nvim ${NEOVIM_SOURCES} ${OS_SOURCES} ${API_SOURCES}
|
||||
${API_PRIV_SOURCES})
|
||||
add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES}
|
||||
${OS_SOURCES} ${API_SOURCES} ${API_PRIV_SOURCES})
|
||||
target_link_libraries(nvim ${NVIM_LINK_LIBRARIES})
|
||||
install(TARGETS nvim RUNTIME DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED ENV{SKIP_UNITTEST})
|
||||
add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_SOURCES}
|
||||
${OS_SOURCES} ${API_SOURCES} ${API_PRIV_SOURCES})
|
||||
add_library(nvim-test MODULE EXCLUDE_FROM_ALL ${NEOVIM_GENERATED_SOURCES}
|
||||
${NEOVIM_SOURCES} ${OS_SOURCES} ${API_SOURCES} ${API_PRIV_SOURCES})
|
||||
target_link_libraries(nvim-test ${NVIM_LINK_LIBRARIES})
|
||||
endif()
|
||||
|
@ -20,18 +20,9 @@
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/undo.h"
|
||||
|
||||
static void switch_to_win_for_buf(buf_T *buf,
|
||||
win_T **save_curwinp,
|
||||
tabpage_T **save_curtabp,
|
||||
buf_T **save_curbufp);
|
||||
|
||||
static void restore_win_for_buf(win_T *save_curwin,
|
||||
tabpage_T *save_curtab,
|
||||
buf_T *save_curbuf);
|
||||
|
||||
static void fix_cursor(linenr_T lo, linenr_T hi, linenr_T extra);
|
||||
|
||||
static int64_t normalize_index(buf_T *buf, int64_t index);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/buffer.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Gets the buffer line count
|
||||
///
|
||||
|
@ -6,48 +6,7 @@
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
Integer buffer_get_length(Buffer buffer, Error *err);
|
||||
|
||||
String buffer_get_line(Buffer buffer, Integer index, Error *err);
|
||||
|
||||
void buffer_set_line(Buffer buffer, Integer index, String line, Error *err);
|
||||
|
||||
void buffer_del_line(Buffer buffer, Integer index, Error *err);
|
||||
|
||||
StringArray buffer_get_slice(Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean include_start,
|
||||
Boolean include_end,
|
||||
Error *err);
|
||||
|
||||
void buffer_set_slice(Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean include_start,
|
||||
Boolean include_end,
|
||||
StringArray replacement,
|
||||
Error *err);
|
||||
|
||||
Object buffer_get_var(Buffer buffer, String name, Error *err);
|
||||
|
||||
Object buffer_set_var(Buffer buffer, String name, Object value, Error *err);
|
||||
|
||||
Object buffer_get_option(Buffer buffer, String name, Error *err);
|
||||
|
||||
void buffer_set_option(Buffer buffer, String name, Object value, Error *err);
|
||||
|
||||
Integer buffer_get_number(Buffer buffer, Error *err);
|
||||
|
||||
String buffer_get_name(Buffer buffer, Error *err);
|
||||
|
||||
void buffer_set_name(Buffer buffer, String name, Error *err);
|
||||
|
||||
Boolean buffer_is_valid(Buffer buffer);
|
||||
|
||||
void buffer_insert(Buffer buffer, Integer lnum, StringArray lines, Error *err);
|
||||
|
||||
Position buffer_get_mark(Buffer buffer, String name, Error *err);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/buffer.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_API_BUFFER_H
|
||||
|
||||
|
@ -15,23 +15,9 @@
|
||||
#include "nvim/option.h"
|
||||
#include "nvim/option_defs.h"
|
||||
|
||||
static Object vim_to_object_rec(typval_T *obj, PMap(ptr_t) *lookup);
|
||||
|
||||
static bool object_to_vim(Object obj, typval_T *tv, Error *err);
|
||||
|
||||
static void set_option_value_for(char *key,
|
||||
int numval,
|
||||
char *stringval,
|
||||
int opt_flags,
|
||||
int opt_type,
|
||||
void *from,
|
||||
Error *err);
|
||||
|
||||
static void set_option_value_err(char *key,
|
||||
int numval,
|
||||
char *stringval,
|
||||
int opt_flags,
|
||||
Error *err);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/private/helpers.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Start block that may cause vimscript exceptions
|
||||
void try_start()
|
||||
@ -366,6 +352,11 @@ tabpage_T * find_tab(Tabpage tabpage, Error *err)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Copies a C string into a String (binary safe string, characters + length)
|
||||
///
|
||||
/// @param str the C string to copy
|
||||
/// @return the resulting String, if the input string was NULL, then an
|
||||
/// empty String is returned
|
||||
String cstr_to_string(const char *str) {
|
||||
if (str == NULL) {
|
||||
return (String) STRING_INIT;
|
||||
|
@ -13,32 +13,7 @@
|
||||
err->set = true; \
|
||||
} while (0)
|
||||
|
||||
void try_start(void);
|
||||
|
||||
bool try_end(Error *err);
|
||||
|
||||
Object dict_get_value(dict_T *dict, String key, Error *err);
|
||||
|
||||
Object dict_set_value(dict_T *dict, String key, Object value, Error *err);
|
||||
|
||||
Object get_option_from(void *from, int type, String name, Error *err);
|
||||
|
||||
void set_option_to(void *to, int type, String name, Object value, Error *err);
|
||||
|
||||
Object vim_to_object(typval_T *obj);
|
||||
|
||||
buf_T *find_buffer(Buffer buffer, Error *err);
|
||||
|
||||
win_T * find_window(Window window, Error *err);
|
||||
|
||||
tabpage_T * find_tab(Tabpage tabpage, Error *err);
|
||||
|
||||
/// Copies a C string into a String (binary safe string, characters + length)
|
||||
///
|
||||
/// @param str the C string to copy
|
||||
/// @return the resulting String, if the input string was NULL, then an
|
||||
/// empty String is returned
|
||||
String cstr_to_string(const char *str);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/private/helpers.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_API_PRIVATE_HELPERS_H
|
||||
|
||||
|
@ -6,13 +6,7 @@
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
Object tabpage_get_var(Tabpage tabpage, String name, Error *err);
|
||||
|
||||
Object tabpage_set_var(Tabpage tabpage, String name, Object value, Error *err);
|
||||
|
||||
Window tabpage_get_window(Tabpage tabpage, Error *err);
|
||||
|
||||
Boolean tabpage_is_valid(Tabpage tabpage);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/tabpage.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_API_TABPAGE_H
|
||||
|
||||
|
@ -22,7 +22,9 @@
|
||||
|
||||
#define LINE_BUFFER_SIZE 4096
|
||||
|
||||
static void write_msg(String message, bool to_err);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/vim.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Send keys to vim input buffer, simulating user input.
|
||||
///
|
||||
|
@ -6,59 +6,7 @@
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
void vim_push_keys(String str);
|
||||
|
||||
void vim_command(String str, Error *err);
|
||||
|
||||
Object vim_eval(String str, Error *err);
|
||||
|
||||
Integer vim_strwidth(String str, Error *err);
|
||||
|
||||
StringArray vim_list_runtime_paths(void);
|
||||
|
||||
void vim_change_directory(String dir, Error *err);
|
||||
|
||||
String vim_get_current_line(Error *err);
|
||||
|
||||
void vim_del_current_line(Error *err);
|
||||
|
||||
void vim_set_current_line(String line, Error *err);
|
||||
|
||||
Object vim_get_var(String name, Error *err);
|
||||
|
||||
Object vim_set_var(String name, Object value, Error *err);
|
||||
|
||||
Object vim_get_vvar(String name, Error *err);
|
||||
|
||||
Object vim_get_option(String name, Error *err);
|
||||
|
||||
void vim_set_option(String name, Object value, Error *err);
|
||||
|
||||
void vim_out_write(String str);
|
||||
|
||||
void vim_err_write(String str);
|
||||
|
||||
BufferArray vim_get_buffers(void);
|
||||
|
||||
Buffer vim_get_current_buffer(void);
|
||||
|
||||
void vim_set_current_buffer(Buffer buffer, Error *err);
|
||||
|
||||
WindowArray vim_get_windows(void);
|
||||
|
||||
Window vim_get_current_window(void);
|
||||
|
||||
void vim_set_current_window(Window window, Error *err);
|
||||
|
||||
TabpageArray vim_get_tabpages(void);
|
||||
|
||||
Tabpage vim_get_current_tabpage(void);
|
||||
|
||||
void vim_set_current_tabpage(Tabpage tabpage, Error *err);
|
||||
|
||||
void vim_subscribe(uint64_t channel_id, String event);
|
||||
|
||||
void vim_unsubscribe(uint64_t channel_id, String event);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/vim.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_API_VIM_H
|
||||
|
||||
|
@ -6,33 +6,7 @@
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
Buffer window_get_buffer(Window window, Error *err);
|
||||
|
||||
Position window_get_cursor(Window window, Error *err);
|
||||
|
||||
void window_set_cursor(Window window, Position pos, Error *err);
|
||||
|
||||
Integer window_get_height(Window window, Error *err);
|
||||
|
||||
void window_set_height(Window window, Integer height, Error *err);
|
||||
|
||||
Integer window_get_width(Window window, Error *err);
|
||||
|
||||
void window_set_width(Window window, Integer width, Error *err);
|
||||
|
||||
Object window_get_var(Window window, String name, Error *err);
|
||||
|
||||
Object window_set_var(Window window, String name, Object value, Error *err);
|
||||
|
||||
Object window_get_option(Window window, String name, Error *err);
|
||||
|
||||
void window_set_option(Window window, String name, Object value, Error *err);
|
||||
|
||||
Position window_get_position(Window window, Error *err);
|
||||
|
||||
Tabpage window_get_tabpage(Window window, Error *err);
|
||||
|
||||
Boolean window_is_valid(Window window);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/window.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_API_WINDOW_H
|
||||
|
||||
|
@ -240,26 +240,10 @@
|
||||
|
||||
#define a_BYTE_ORDER_MARK 0xfeff
|
||||
|
||||
static int A_is_a(int cur_c);
|
||||
static int A_is_s(int cur_c);
|
||||
static int A_is_f(int cur_c);
|
||||
static int chg_c_a2s(int cur_c);
|
||||
static int chg_c_a2i(int cur_c);
|
||||
static int chg_c_a2m(int cur_c);
|
||||
static int chg_c_a2f(int cur_c);
|
||||
static int chg_c_i2m(int cur_c);
|
||||
static int chg_c_f2m(int cur_c);
|
||||
static int chg_c_laa2i(int hid_c);
|
||||
static int chg_c_laa2f(int hid_c);
|
||||
static int half_shape(int c);
|
||||
static int A_firstc_laa(int c1, int c);
|
||||
static int A_is_harakat(int c);
|
||||
static int A_is_iso(int c);
|
||||
static int A_is_formb(int c);
|
||||
static int A_is_ok(int c);
|
||||
static int A_is_valid(int c);
|
||||
static int A_is_special(int c);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "arabic.c.generated.h"
|
||||
#endif
|
||||
// Returns True if c is an ISO-8859-6 shaped ARABIC letter (user entered).
|
||||
static int A_is_a(int cur_c)
|
||||
{
|
||||
|
@ -8,9 +8,7 @@ static inline int arabic_char(int c)
|
||||
return c >= 0x0621 && c <= 0x0670;
|
||||
}
|
||||
|
||||
int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1,
|
||||
int next_c);
|
||||
int arabic_combine(int one, int two);
|
||||
int arabic_maycombine(int two);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "arabic.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_ARABIC_H
|
||||
|
@ -73,22 +73,17 @@
|
||||
// Todo(stefan991): remove this macro
|
||||
#define INVALID_DEVICE_ID UINT64_MAX
|
||||
|
||||
static char_u *buflist_match(regprog_T *prog, buf_T *buf);
|
||||
# define HAVE_BUFLIST_MATCH
|
||||
static char_u *fname_match(regprog_T *prog, char_u *name);
|
||||
static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum,
|
||||
colnr_T col, int copy_options);
|
||||
static wininfo_T *find_wininfo(buf_T *buf, int skip_diff_buffer);
|
||||
static buf_T *buflist_findname_file_info(char_u *ffname, FileInfo *file_info);
|
||||
static int otherfile_buf(buf_T *buf, char_u *ffname, FileInfo *file_info);
|
||||
static int buf_same_ino(buf_T *buf, FileInfo *file_info);
|
||||
static int ti_change(char_u *str, char_u **last);
|
||||
static int append_arg_number(win_T *wp, char_u *buf, int buflen, int add_file);
|
||||
static void free_buffer(buf_T *);
|
||||
static void free_buffer_stuff(buf_T *buf, int free_options);
|
||||
static void clear_wininfo(buf_T *buf);
|
||||
#define HAVE_BUFLIST_MATCH
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "buffer.c.generated.h"
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
# define dev_T dev_t
|
||||
#else
|
||||
# define dev_T unsigned
|
||||
#endif
|
||||
|
||||
static void insert_sign(buf_T *buf, signlist_T *prev, signlist_T *next, int id, linenr_T lnum, int typenr);
|
||||
|
||||
static char *msg_loclist = N_("[Location List]");
|
||||
static char *msg_qflist = N_("[Quickfix List]");
|
||||
@ -791,7 +786,6 @@ do_bufdel (
|
||||
}
|
||||
|
||||
|
||||
static int empty_curbuf(int close_others, int forceit, int action);
|
||||
|
||||
/*
|
||||
* Make the current buffer empty.
|
||||
@ -2014,7 +2008,6 @@ static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T col,
|
||||
return;
|
||||
}
|
||||
|
||||
static int wininfo_other_tab_diff(wininfo_T *wip);
|
||||
|
||||
/*
|
||||
* Return TRUE when "wip" has 'diff' set and the diff is only for another tab
|
||||
@ -4016,7 +4009,6 @@ void ex_buffer_all(exarg_T *eap)
|
||||
}
|
||||
|
||||
|
||||
static int chk_modeline(linenr_T, int);
|
||||
|
||||
/*
|
||||
* do_modelines() - process mode lines for the current file
|
||||
|
@ -1,81 +1,7 @@
|
||||
#ifndef NVIM_BUFFER_H
|
||||
#define NVIM_BUFFER_H
|
||||
/* buffer.c */
|
||||
int open_buffer(int read_stdin, exarg_T *eap, int flags);
|
||||
int buf_valid(buf_T *buf);
|
||||
void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last);
|
||||
void buf_clear_file(buf_T *buf);
|
||||
void buf_freeall(buf_T *buf, int flags);
|
||||
void goto_buffer(exarg_T *eap, int start, int dir, int count);
|
||||
void handle_swap_exists(buf_T *old_curbuf);
|
||||
char_u *do_bufdel(int command, char_u *arg, int addr_count,
|
||||
int start_bnr, int end_bnr,
|
||||
int forceit);
|
||||
int do_buffer(int action, int start, int dir, int count, int forceit);
|
||||
void set_curbuf(buf_T *buf, int action);
|
||||
void enter_buffer(buf_T *buf);
|
||||
void do_autochdir(void);
|
||||
buf_T *buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum,
|
||||
int flags);
|
||||
void free_buf_options(buf_T *buf, int free_p_ff);
|
||||
int buflist_getfile(int n, linenr_T lnum, int options, int forceit);
|
||||
void buflist_getfpos(void);
|
||||
buf_T *buflist_findname_exp(char_u *fname);
|
||||
buf_T *buflist_findname(char_u *ffname);
|
||||
int buflist_findpat(char_u *pattern, char_u *pattern_end, int unlisted,
|
||||
int diffmode,
|
||||
int curtab_only);
|
||||
int ExpandBufnames(char_u *pat, int *num_file, char_u ***file,
|
||||
int options);
|
||||
buf_T *buflist_findnr(int nr);
|
||||
char_u *buflist_nr2name(int n, int fullname, int helptail);
|
||||
void get_winopts(buf_T *buf);
|
||||
pos_T *buflist_findfpos(buf_T *buf);
|
||||
linenr_T buflist_findlnum(buf_T *buf);
|
||||
void buflist_list(exarg_T *eap);
|
||||
int buflist_name_nr(int fnum, char_u **fname, linenr_T *lnum);
|
||||
int setfname(buf_T *buf, char_u *ffname, char_u *sfname, int message);
|
||||
void buf_set_name(int fnum, char_u *name);
|
||||
void buf_name_changed(buf_T *buf);
|
||||
buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum);
|
||||
char_u *getaltfname(int errmsg);
|
||||
int buflist_add(char_u *fname, int flags);
|
||||
void buflist_slash_adjust(void);
|
||||
void buflist_altfpos(win_T *win);
|
||||
int otherfile(char_u *ffname);
|
||||
void buf_setino(buf_T *buf);
|
||||
void fileinfo(int fullname, int shorthelp, int dont_truncate);
|
||||
void col_print(char_u *buf, size_t buflen, int col, int vcol);
|
||||
void maketitle(void);
|
||||
void resettitle(void);
|
||||
void free_titles(void);
|
||||
int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt,
|
||||
int use_sandbox, int fillchar, int maxwidth,
|
||||
struct stl_hlrec *hltab,
|
||||
struct stl_hlrec *tabtab);
|
||||
void get_rel_pos(win_T *wp, char_u *buf, int buflen);
|
||||
void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname);
|
||||
char_u *alist_name(aentry_T *aep);
|
||||
void do_arg_all(int count, int forceit, int keep_tabs);
|
||||
void ex_buffer_all(exarg_T *eap);
|
||||
void do_modelines(int flags);
|
||||
int read_viminfo_bufferlist(vir_T *virp, int writing);
|
||||
void write_viminfo_bufferlist(FILE *fp);
|
||||
char_u *buf_spname(buf_T *buf);
|
||||
int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp);
|
||||
void buf_addsign(buf_T *buf, int id, linenr_T lnum, int typenr);
|
||||
linenr_T buf_change_sign_type(buf_T *buf, int markId, int typenr);
|
||||
int buf_getsigntype(buf_T *buf, linenr_T lnum, int type);
|
||||
linenr_T buf_delsign(buf_T *buf, int id);
|
||||
int buf_findsign(buf_T *buf, int id);
|
||||
int buf_findsign_id(buf_T *buf, linenr_T lnum);
|
||||
void buf_delete_signs(buf_T *buf);
|
||||
void buf_delete_all_signs(void);
|
||||
void sign_list_placed(buf_T *rbuf);
|
||||
void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount,
|
||||
long amount_after);
|
||||
void set_buflisted(int on);
|
||||
int buf_contents_changed(buf_T *buf);
|
||||
void wipe_buffer(buf_T *buf, int aucmd);
|
||||
|
||||
#endif /* NVIM_BUFFER_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "buffer.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_BUFFER_H
|
||||
|
@ -20,12 +20,11 @@
|
||||
#include "nvim/os_unix.h"
|
||||
#include "nvim/strings.h"
|
||||
|
||||
static int win_chartabsize(win_T *wp, char_u *p, colnr_T col);
|
||||
|
||||
static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col,
|
||||
int *headp);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "charset.c.generated.h"
|
||||
#endif
|
||||
|
||||
static unsigned nr2hex(unsigned c);
|
||||
|
||||
static int chartab_initialized = FALSE;
|
||||
|
||||
|
@ -1,66 +1,8 @@
|
||||
#ifndef NVIM_CHARSET_H
|
||||
#define NVIM_CHARSET_H
|
||||
|
||||
int init_chartab(void);
|
||||
int buf_init_chartab(buf_T *buf, int global);
|
||||
void trans_characters(char_u *buf, int bufsize);
|
||||
char_u *transstr(char_u *s);
|
||||
char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen);
|
||||
char_u *transchar(int c);
|
||||
char_u *transchar_byte(int c);
|
||||
void transchar_nonprint(char_u *buf, int c);
|
||||
void transchar_hex(char_u *buf, int c);
|
||||
int byte2cells(int b);
|
||||
int char2cells(int c);
|
||||
int ptr2cells(char_u *p);
|
||||
int vim_strsize(char_u *s);
|
||||
int vim_strnsize(char_u *s, int len);
|
||||
int chartabsize(char_u *p, colnr_T col);
|
||||
int linetabsize(char_u *s);
|
||||
int linetabsize_col(int startcol, char_u *s);
|
||||
int win_linetabsize(win_T *wp, char_u *p, colnr_T len);
|
||||
int vim_isIDc(int c);
|
||||
int vim_iswordc(int c);
|
||||
int vim_iswordc_buf(int c, buf_T *buf);
|
||||
int vim_iswordp(char_u *p);
|
||||
int vim_iswordp_buf(char_u *p, buf_T *buf);
|
||||
int vim_isfilec(int c);
|
||||
int vim_isfilec_or_wc(int c);
|
||||
int vim_isprintc(int c);
|
||||
int vim_isprintc_strict(int c);
|
||||
int lbr_chartabsize(unsigned char *s, colnr_T col);
|
||||
int lbr_chartabsize_adv(char_u **s, colnr_T col);
|
||||
int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp);
|
||||
int in_win_border(win_T *wp, colnr_T vcol);
|
||||
void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor,
|
||||
colnr_T *end);
|
||||
colnr_T getvcol_nolist(pos_T *posp);
|
||||
void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor,
|
||||
colnr_T *end);
|
||||
void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left,
|
||||
colnr_T *right);
|
||||
char_u *skipwhite(char_u *q);
|
||||
char_u *skipdigits(char_u *q);
|
||||
char_u *skiphex(char_u *q);
|
||||
char_u *skiptodigit(char_u *q);
|
||||
char_u *skiptohex(char_u *q);
|
||||
int vim_isdigit(int c);
|
||||
int vim_isxdigit(int c);
|
||||
int vim_islower(int c);
|
||||
int vim_isupper(int c);
|
||||
int vim_toupper(int c);
|
||||
int vim_tolower(int c);
|
||||
char_u *skiptowhite(char_u *p);
|
||||
char_u *skiptowhite_esc(char_u *p);
|
||||
long getdigits(char_u **pp);
|
||||
int vim_isblankline(char_u *lbuf);
|
||||
void vim_str2nr(char_u *start, int *hexp, int *len, int dooct,
|
||||
int dohex, long *nptr,
|
||||
unsigned long *unptr);
|
||||
int hex2nr(int c);
|
||||
int hexhex2nr(char_u *p);
|
||||
int rem_backslash(char_u *str);
|
||||
void backslash_halve(char_u *p);
|
||||
char_u *backslash_halve_save(char_u *p);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "charset.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_CHARSET_H
|
||||
|
@ -47,6 +47,8 @@ typedef struct cursor_entry {
|
||||
char used_for; /* SHAPE_MOUSE and/or SHAPE_CURSOR */
|
||||
} cursorentry_T;
|
||||
|
||||
char_u *parse_shape_opt(int what);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "cursor_shape.h.generated.h"
|
||||
#endif
|
||||
#endif /* NVIM_CURSOR_SHAPE_H */
|
||||
|
@ -46,24 +46,10 @@ static int diff_flags = DIFF_FILLER;
|
||||
// checked yet
|
||||
static int diff_a_works = MAYBE;
|
||||
|
||||
static int diff_buf_idx(buf_T *buf);
|
||||
static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp);
|
||||
static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1,
|
||||
linenr_T line2, long amount,
|
||||
long amount_after);
|
||||
static void diff_check_unchanged(tabpage_T *tp, diff_T *dp);
|
||||
static int diff_check_sanity(tabpage_T *tp, diff_T *dp);
|
||||
static void diff_redraw(int dofold);
|
||||
static int diff_write(buf_T *buf, char_u *fname);
|
||||
static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff);
|
||||
static int diff_equal_entry(diff_T *dp, int idx1, int idx2);
|
||||
static int diff_cmp(char_u *s1, char_u *s2);
|
||||
static void diff_fold_update(diff_T *dp, int skip_idx);
|
||||
static void diff_read(int idx_orig, int idx_new, char_u *fname);
|
||||
static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig,
|
||||
int idx_new);
|
||||
static diff_T* diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "diff.c.generated.h"
|
||||
#endif
|
||||
#ifndef USE_CR
|
||||
# define tag_fgets vim_fgets
|
||||
#endif // ifndef USE_CR
|
||||
|
@ -1,33 +1,8 @@
|
||||
#ifndef NVIM_DIFF_H
|
||||
#define NVIM_DIFF_H
|
||||
|
||||
void diff_buf_delete(buf_T *buf);
|
||||
void diff_buf_adjust(win_T *win);
|
||||
void diff_buf_add(buf_T *buf);
|
||||
void diff_invalidate(buf_T *buf);
|
||||
void diff_mark_adjust(linenr_T line1, linenr_T line2, long amount,
|
||||
long amount_after);
|
||||
void ex_diffupdate(exarg_T *eap);
|
||||
void ex_diffpatch(exarg_T *eap);
|
||||
void ex_diffsplit(exarg_T *eap);
|
||||
void ex_diffthis(exarg_T *eap);
|
||||
void diff_win_options(win_T *wp, int addbuf);
|
||||
void ex_diffoff(exarg_T *eap);
|
||||
void diff_clear(tabpage_T *tp);
|
||||
int diff_check(win_T *wp, linenr_T lnum);
|
||||
int diff_check_fill(win_T *wp, linenr_T lnum);
|
||||
void diff_set_topline(win_T *fromwin, win_T *towin);
|
||||
int diffopt_changed(void);
|
||||
int diffopt_horizontal(void);
|
||||
int diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp);
|
||||
int diff_infold(win_T *wp, linenr_T lnum);
|
||||
void nv_diffgetput(int put);
|
||||
void ex_diffgetput(exarg_T *eap);
|
||||
int diff_mode_buf(buf_T *buf);
|
||||
int diff_move_to(int dir, long count);
|
||||
linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1,
|
||||
buf_T *buf2,
|
||||
linenr_T lnum3);
|
||||
linenr_T diff_lnum_win(linenr_T lnum, win_T *wp);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "diff.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_DIFF_H
|
||||
|
@ -27,9 +27,10 @@ typedef struct digraph {
|
||||
result_T result;
|
||||
} digr_T;
|
||||
|
||||
static int getexactdigraph(int char1, int char2, int meta_char);
|
||||
static void printdigraph(digr_T *dp);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "digraph.c.generated.h"
|
||||
#endif
|
||||
// digraphs added by the user
|
||||
static garray_T user_digraphs = {0, 0, (int)sizeof(digr_T), 10, NULL};
|
||||
|
||||
@ -1721,7 +1722,6 @@ typedef struct {
|
||||
|
||||
#define KMAP_MAXLEN 20 // maximum length of "from" or "to"
|
||||
|
||||
static void keymap_unload(void);
|
||||
|
||||
/// Set up key mapping tables for the 'keymap' option.
|
||||
///
|
||||
|
@ -1,12 +1,8 @@
|
||||
#ifndef NVIM_DIGRAPH_H
|
||||
#define NVIM_DIGRAPH_H
|
||||
|
||||
int do_digraph(int c);
|
||||
int get_digraph(int cmdline);
|
||||
int getdigraph(int char1, int char2, int meta_char);
|
||||
void putdigraph(char_u *str);
|
||||
void listdigraphs(void);
|
||||
char_u *keymap_init(void);
|
||||
void ex_loadkeymap(exarg_T *eap);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "digraph.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_DIGRAPH_H
|
||||
|
109
src/nvim/edit.c
109
src/nvim/edit.c
@ -175,113 +175,16 @@ static expand_T compl_xp;
|
||||
|
||||
static int compl_opt_refresh_always = FALSE;
|
||||
|
||||
static void ins_ctrl_x(void);
|
||||
static int has_compl_option(int dict_opt);
|
||||
static int ins_compl_accept_char(int c);
|
||||
static int ins_compl_add(char_u *str, int len, int icase, char_u *fname,
|
||||
char_u **cptext, int cdir, int flags,
|
||||
int adup);
|
||||
static int ins_compl_equal(compl_T *match, char_u *str, int len);
|
||||
static void ins_compl_longest_match(compl_T *match);
|
||||
static void ins_compl_add_matches(int num_matches, char_u **matches,
|
||||
int icase);
|
||||
static int ins_compl_make_cyclic(void);
|
||||
static void ins_compl_upd_pum(void);
|
||||
static void ins_compl_del_pum(void);
|
||||
static int pum_wanted(void);
|
||||
static int pum_enough_matches(void);
|
||||
static void ins_compl_dictionaries(char_u *dict, char_u *pat, int flags,
|
||||
int thesaurus);
|
||||
static void ins_compl_files(int count, char_u **files, int thesaurus,
|
||||
int flags, regmatch_T *regmatch, char_u *
|
||||
buf,
|
||||
int *dir);
|
||||
static char_u *find_line_end(char_u *ptr);
|
||||
static void ins_compl_free(void);
|
||||
static void ins_compl_clear(void);
|
||||
static int ins_compl_bs(void);
|
||||
static int ins_compl_need_restart(void);
|
||||
static void ins_compl_new_leader(void);
|
||||
static void ins_compl_addleader(int c);
|
||||
static int ins_compl_len(void);
|
||||
static void ins_compl_restart(void);
|
||||
static void ins_compl_set_original_text(char_u *str);
|
||||
static void ins_compl_addfrommatch(void);
|
||||
static int ins_compl_prep(int c);
|
||||
static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg);
|
||||
static buf_T *ins_compl_next_buf(buf_T *buf, int flag);
|
||||
static void ins_compl_add_list(list_T *list);
|
||||
static void ins_compl_add_dict(dict_T *dict);
|
||||
static int ins_compl_get_exp(pos_T *ini);
|
||||
static void ins_compl_delete(void);
|
||||
static void ins_compl_insert(void);
|
||||
static int ins_compl_next(int allow_get_expansion, int count,
|
||||
int insert_match);
|
||||
static int ins_compl_key2dir(int c);
|
||||
static int ins_compl_pum_key(int c);
|
||||
static int ins_compl_key2count(int c);
|
||||
static int ins_compl_use_match(int c);
|
||||
static int ins_complete(int c);
|
||||
static unsigned quote_meta(char_u *dest, char_u *str, int len);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "edit.c.generated.h"
|
||||
#endif
|
||||
#define BACKSPACE_CHAR 1
|
||||
#define BACKSPACE_WORD 2
|
||||
#define BACKSPACE_WORD_NOT_SPACE 3
|
||||
#define BACKSPACE_LINE 4
|
||||
|
||||
static void ins_redraw(int ready);
|
||||
static void ins_ctrl_v(void);
|
||||
static void undisplay_dollar(void);
|
||||
static void insert_special(int, int, int);
|
||||
static void internal_format(int textwidth, int second_indent, int flags,
|
||||
int format_only,
|
||||
int c);
|
||||
static void check_auto_format(int);
|
||||
static void redo_literal(int c);
|
||||
static void start_arrow(pos_T *end_insert_pos);
|
||||
static void check_spell_redraw(void);
|
||||
static void spell_back_to_badword(void);
|
||||
static int spell_bad_len = 0; /* length of located bad word */
|
||||
static void stop_insert(pos_T *end_insert_pos, int esc, int nomove);
|
||||
static int echeck_abbr(int);
|
||||
static int replace_pop(void);
|
||||
static void replace_join(int off);
|
||||
static void replace_pop_ins(void);
|
||||
static void mb_replace_pop_ins(int cc);
|
||||
static void replace_flush(void);
|
||||
static void replace_do_bs(int limit_col);
|
||||
static int del_char_after_col(int limit_col);
|
||||
static int cindent_on(void);
|
||||
static void ins_reg(void);
|
||||
static void ins_ctrl_g(void);
|
||||
static void ins_ctrl_hat(void);
|
||||
static int ins_esc(long *count, int cmdchar, int nomove);
|
||||
static void ins_ctrl_(void);
|
||||
static int ins_start_select(int c);
|
||||
static void ins_insert(int replaceState);
|
||||
static void ins_ctrl_o(void);
|
||||
static void ins_shift(int c, int lastc);
|
||||
static void ins_del(void);
|
||||
static int ins_bs(int c, int mode, int *inserted_space_p);
|
||||
static void ins_mouse(int c);
|
||||
static void ins_mousescroll(int dir);
|
||||
static void ins_left(void);
|
||||
static void ins_home(int c);
|
||||
static void ins_end(int c);
|
||||
static void ins_s_left(void);
|
||||
static void ins_right(void);
|
||||
static void ins_s_right(void);
|
||||
static void ins_up(int startcol);
|
||||
static void ins_pageup(void);
|
||||
static void ins_down(int startcol);
|
||||
static void ins_pagedown(void);
|
||||
static int ins_tab(void);
|
||||
static int ins_eol(int c);
|
||||
static int ins_digraph(void);
|
||||
static int ins_ctrl_ey(int tc);
|
||||
static void ins_try_si(int c);
|
||||
static colnr_T get_nolist_virtcol(void);
|
||||
static char_u *do_insert_char_pre(int c);
|
||||
|
||||
static colnr_T Insstart_textlen; /* length of line when insert started */
|
||||
static colnr_T Insstart_blank_vcol; /* vcol for first inserted blank */
|
||||
@ -3341,7 +3244,6 @@ static buf_T *ins_compl_next_buf(buf_T *buf, int flag)
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void expand_by_function(int type, char_u *base);
|
||||
|
||||
/*
|
||||
* Execute user defined complete function 'completefunc' or 'omnifunc', and
|
||||
@ -6472,9 +6374,7 @@ static int cindent_on(void) {
|
||||
* confused what all the part that handles Control-T is doing that I'm not.
|
||||
* "get_the_indent" should be get_c_indent, get_expr_indent or get_lisp_indent.
|
||||
*/
|
||||
|
||||
void fixthisline(get_the_indent)
|
||||
int (*get_the_indent)(void);
|
||||
void fixthisline(IndentGetter get_the_indent)
|
||||
{
|
||||
change_indent(INDENT_SET, get_the_indent(), FALSE, 0, TRUE);
|
||||
if (linewhite(curwin->w_cursor.lnum))
|
||||
@ -7259,7 +7159,6 @@ static void ins_del(void)
|
||||
AppendCharToRedobuff(K_DEL);
|
||||
}
|
||||
|
||||
static void ins_bs_one(colnr_T *vcolp);
|
||||
|
||||
/*
|
||||
* Delete one character for ins_bs().
|
||||
|
@ -12,47 +12,10 @@
|
||||
#define CPT_INFO 3 /* "info" */
|
||||
#define CPT_COUNT 4 /* Number of entries */
|
||||
|
||||
int edit(int cmdchar, int startln, long count);
|
||||
void edit_putchar(int c, int highlight);
|
||||
void edit_unputchar(void);
|
||||
void display_dollar(colnr_T col);
|
||||
void change_indent(int type, int amount, int round, int replaced,
|
||||
int call_changed_bytes);
|
||||
void truncate_spaces(char_u *line);
|
||||
void backspace_until_column(int col);
|
||||
int vim_is_ctrl_x_key(int c);
|
||||
int ins_compl_add_infercase(char_u *str, int len, int icase,
|
||||
char_u *fname, int dir,
|
||||
int flags);
|
||||
void set_completion(colnr_T startcol, list_T *list);
|
||||
void ins_compl_show_pum(void);
|
||||
char_u *find_word_start(char_u *ptr);
|
||||
char_u *find_word_end(char_u *ptr);
|
||||
int ins_compl_active(void);
|
||||
int ins_compl_add_tv(typval_T *tv, int dir);
|
||||
void ins_compl_check_keys(int frequency);
|
||||
int get_literal(void);
|
||||
void insertchar(int c, int flags, int second_indent);
|
||||
void auto_format(int trailblank, int prev_line);
|
||||
int comp_textwidth(int ff);
|
||||
int stop_arrow(void);
|
||||
void set_last_insert(int c);
|
||||
void free_last_insert(void);
|
||||
char_u *add_char2buf(int c, char_u *s);
|
||||
void beginline(int flags);
|
||||
int oneright(void);
|
||||
int oneleft(void);
|
||||
int cursor_up(long n, int upd_topline);
|
||||
int cursor_down(long n, int upd_topline);
|
||||
int stuff_inserted(int c, long count, int no_esc);
|
||||
char_u *get_last_insert(void);
|
||||
char_u *get_last_insert_save(void);
|
||||
void replace_push(int c);
|
||||
int replace_push_mb(char_u *p);
|
||||
void fixthisline(int (*get_the_indent)(void));
|
||||
void fix_indent(void);
|
||||
int in_cinkeys(int keytyped, int when, int line_is_empty);
|
||||
int hkmap(int c);
|
||||
int ins_copychar(linenr_T lnum);
|
||||
typedef int (*IndentGetter)(void);
|
||||
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "edit.h.generated.h"
|
||||
#endif
|
||||
#endif /* NVIM_EDIT_H */
|
||||
|
515
src/nvim/eval.c
515
src/nvim/eval.c
@ -305,6 +305,14 @@ typedef struct {
|
||||
dictitem_T *fd_di; /* Dictionary item used */
|
||||
} funcdict_T;
|
||||
|
||||
/*
|
||||
* enum used by var_flavour()
|
||||
*/
|
||||
typedef enum {
|
||||
VAR_FLAVOUR_DEFAULT, /* doesn't start with uppercase */
|
||||
VAR_FLAVOUR_SESSION, /* starts with uppercase, some lower */
|
||||
VAR_FLAVOUR_VIMINFO /* all uppercase */
|
||||
} var_flavour_T;
|
||||
|
||||
/*
|
||||
* Array to hold the value of v: variables.
|
||||
@ -404,457 +412,16 @@ static struct vimvar {
|
||||
static dictitem_T vimvars_var; /* variable used for v: */
|
||||
#define vimvarht vimvardict.dv_hashtab
|
||||
|
||||
static void on_job_stdout(RStream *rstream, void *data, bool eof);
|
||||
static void on_job_stderr(RStream *rstream, void *data, bool eof);
|
||||
static void on_job_exit(Job *job, void *data);
|
||||
static void on_job_data(RStream *rstream, void *data, bool eof, char *type);
|
||||
static void apply_job_autocmds(Job *job, char *name, char *type, char *str);
|
||||
static void prepare_vimvar(int idx, typval_T *save_tv);
|
||||
static void restore_vimvar(int idx, typval_T *save_tv);
|
||||
static int ex_let_vars(char_u *arg, typval_T *tv, int copy,
|
||||
int semicolon, int var_count,
|
||||
char_u *nextchars);
|
||||
static char_u *skip_var_list(char_u *arg, int *var_count,
|
||||
int *semicolon);
|
||||
static char_u *skip_var_one(char_u *arg);
|
||||
static void list_hashtable_vars(hashtab_T *ht, char_u *prefix,
|
||||
int empty,
|
||||
int *first);
|
||||
static void list_glob_vars(int *first);
|
||||
static void list_buf_vars(int *first);
|
||||
static void list_win_vars(int *first);
|
||||
static void list_tab_vars(int *first);
|
||||
static void list_vim_vars(int *first);
|
||||
static void list_script_vars(int *first);
|
||||
static void list_func_vars(int *first);
|
||||
static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first);
|
||||
static char_u *ex_let_one(char_u *arg, typval_T *tv, int copy,
|
||||
char_u *endchars, char_u *op);
|
||||
static int check_changedtick(char_u *arg);
|
||||
static char_u *get_lval(char_u *name, typval_T *rettv, lval_T *lp,
|
||||
int unlet, int skip, int flags,
|
||||
int fne_flags);
|
||||
static void clear_lval(lval_T *lp);
|
||||
static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv,
|
||||
int copy,
|
||||
char_u *op);
|
||||
static int tv_op(typval_T *tv1, typval_T *tv2, char_u *op);
|
||||
static void list_fix_watch(list_T *l, listitem_T *item);
|
||||
static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep);
|
||||
static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit);
|
||||
static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock);
|
||||
static void item_lock(typval_T *tv, int deep, int lock);
|
||||
static int tv_islocked(typval_T *tv);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "eval.c.generated.h"
|
||||
#endif
|
||||
|
||||
static int eval0(char_u *arg, typval_T *rettv, char_u **nextcmd,
|
||||
int evaluate);
|
||||
static int eval1(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int eval2(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int eval3(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int eval4(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int eval5(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int eval6(char_u **arg, typval_T *rettv, int evaluate,
|
||||
int want_string);
|
||||
static int eval7(char_u **arg, typval_T *rettv, int evaluate,
|
||||
int want_string);
|
||||
|
||||
static int eval_index(char_u **arg, typval_T *rettv, int evaluate,
|
||||
int verbose);
|
||||
static int get_option_tv(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int get_list_tv(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static void rettv_list_alloc(typval_T *rettv);
|
||||
static long list_len(list_T *l);
|
||||
static int list_equal(list_T *l1, list_T *l2, int ic, int recursive);
|
||||
static int dict_equal(dict_T *d1, dict_T *d2, int ic, int recursive);
|
||||
static int tv_equal(typval_T *tv1, typval_T *tv2, int ic, int recursive);
|
||||
static long list_find_nr(list_T *l, long idx, int *errorp);
|
||||
static long list_idx_of_item(list_T *l, listitem_T *item);
|
||||
static void list_append_number(list_T *l, varnumber_T n);
|
||||
static int list_extend(list_T *l1, list_T *l2, listitem_T *bef);
|
||||
static int list_concat(list_T *l1, list_T *l2, typval_T *tv);
|
||||
static list_T *list_copy(list_T *orig, int deep, int copyID);
|
||||
static char_u *list2string(typval_T *tv, int copyID);
|
||||
static int list_join_inner(garray_T *gap, list_T *l, char_u *sep,
|
||||
int echo_style, int copyID,
|
||||
garray_T *join_gap);
|
||||
static int list_join(garray_T *gap, list_T *l, char_u *sep, int echo,
|
||||
int copyID);
|
||||
static int free_unref_items(int copyID);
|
||||
static int rettv_dict_alloc(typval_T *rettv);
|
||||
static dictitem_T *dictitem_copy(dictitem_T *org);
|
||||
static void dictitem_remove(dict_T *dict, dictitem_T *item);
|
||||
static dict_T *dict_copy(dict_T *orig, int deep, int copyID);
|
||||
static long dict_len(dict_T *d);
|
||||
static char_u *dict2string(typval_T *tv, int copyID);
|
||||
static int get_dict_tv(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static char_u *echo_string(typval_T *tv, char_u **tofree,
|
||||
char_u *numbuf,
|
||||
int copyID);
|
||||
static char_u *tv2string(typval_T *tv, char_u **tofree, char_u *numbuf,
|
||||
int copyID);
|
||||
static char_u *string_quote(char_u *str, int function);
|
||||
static int string2float(char_u *text, float_T *value);
|
||||
static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate);
|
||||
static int find_internal_func(char_u *name);
|
||||
static char_u *deref_func_name(char_u *name, int *lenp, int no_autoload);
|
||||
static int get_func_tv(char_u *name, int len, typval_T *rettv,
|
||||
char_u **arg, linenr_T firstline, linenr_T lastline,
|
||||
int *doesrange, int evaluate,
|
||||
dict_T *selfdict);
|
||||
static int call_func(char_u *funcname, int len, typval_T *rettv,
|
||||
int argcount, typval_T *argvars,
|
||||
linenr_T firstline, linenr_T lastline,
|
||||
int *doesrange, int evaluate,
|
||||
dict_T *selfdict);
|
||||
static void emsg_funcname(char *ermsg, char_u *name);
|
||||
static int non_zero_arg(typval_T *argvars);
|
||||
|
||||
static void f_abs(typval_T *argvars, typval_T *rettv);
|
||||
static void f_acos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_add(typval_T *argvars, typval_T *rettv);
|
||||
static void f_and(typval_T *argvars, typval_T *rettv);
|
||||
static void f_append(typval_T *argvars, typval_T *rettv);
|
||||
static void f_argc(typval_T *argvars, typval_T *rettv);
|
||||
static void f_argidx(typval_T *argvars, typval_T *rettv);
|
||||
static void f_argv(typval_T *argvars, typval_T *rettv);
|
||||
static void f_asin(typval_T *argvars, typval_T *rettv);
|
||||
static void f_atan(typval_T *argvars, typval_T *rettv);
|
||||
static void f_atan2(typval_T *argvars, typval_T *rettv);
|
||||
static void f_browse(typval_T *argvars, typval_T *rettv);
|
||||
static void f_browsedir(typval_T *argvars, typval_T *rettv);
|
||||
static void f_bufexists(typval_T *argvars, typval_T *rettv);
|
||||
static void f_buflisted(typval_T *argvars, typval_T *rettv);
|
||||
static void f_bufloaded(typval_T *argvars, typval_T *rettv);
|
||||
static void f_bufname(typval_T *argvars, typval_T *rettv);
|
||||
static void f_bufnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_bufwinnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_byte2line(typval_T *argvars, typval_T *rettv);
|
||||
static void byteidx(typval_T *argvars, typval_T *rettv, int comp);
|
||||
static void f_byteidx(typval_T *argvars, typval_T *rettv);
|
||||
static void f_byteidxcomp(typval_T *argvars, typval_T *rettv);
|
||||
static void f_call(typval_T *argvars, typval_T *rettv);
|
||||
static void f_ceil(typval_T *argvars, typval_T *rettv);
|
||||
static void f_changenr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_char2nr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_cindent(typval_T *argvars, typval_T *rettv);
|
||||
static void f_clearmatches(typval_T *argvars, typval_T *rettv);
|
||||
static void f_col(typval_T *argvars, typval_T *rettv);
|
||||
static void f_complete(typval_T *argvars, typval_T *rettv);
|
||||
static void f_complete_add(typval_T *argvars, typval_T *rettv);
|
||||
static void f_complete_check(typval_T *argvars, typval_T *rettv);
|
||||
static void f_confirm(typval_T *argvars, typval_T *rettv);
|
||||
static void f_copy(typval_T *argvars, typval_T *rettv);
|
||||
static void f_cos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_cosh(typval_T *argvars, typval_T *rettv);
|
||||
static void f_count(typval_T *argvars, typval_T *rettv);
|
||||
static void f_cscope_connection(typval_T *argvars, typval_T *rettv);
|
||||
static void f_cursor(typval_T *argsvars, typval_T *rettv);
|
||||
static void f_deepcopy(typval_T *argvars, typval_T *rettv);
|
||||
static void f_delete(typval_T *argvars, typval_T *rettv);
|
||||
static void f_did_filetype(typval_T *argvars, typval_T *rettv);
|
||||
static void f_diff_filler(typval_T *argvars, typval_T *rettv);
|
||||
static void f_diff_hlID(typval_T *argvars, typval_T *rettv);
|
||||
static void f_empty(typval_T *argvars, typval_T *rettv);
|
||||
static void f_escape(typval_T *argvars, typval_T *rettv);
|
||||
static void f_eval(typval_T *argvars, typval_T *rettv);
|
||||
static void f_eventhandler(typval_T *argvars, typval_T *rettv);
|
||||
static void f_executable(typval_T *argvars, typval_T *rettv);
|
||||
static void f_exists(typval_T *argvars, typval_T *rettv);
|
||||
static void f_exp(typval_T *argvars, typval_T *rettv);
|
||||
static void f_expand(typval_T *argvars, typval_T *rettv);
|
||||
static void f_extend(typval_T *argvars, typval_T *rettv);
|
||||
static void f_feedkeys(typval_T *argvars, typval_T *rettv);
|
||||
static void f_filereadable(typval_T *argvars, typval_T *rettv);
|
||||
static void f_filewritable(typval_T *argvars, typval_T *rettv);
|
||||
static void f_filter(typval_T *argvars, typval_T *rettv);
|
||||
static void f_finddir(typval_T *argvars, typval_T *rettv);
|
||||
static void f_findfile(typval_T *argvars, typval_T *rettv);
|
||||
static void f_float2nr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_floor(typval_T *argvars, typval_T *rettv);
|
||||
static void f_fmod(typval_T *argvars, typval_T *rettv);
|
||||
static void f_fnameescape(typval_T *argvars, typval_T *rettv);
|
||||
static void f_fnamemodify(typval_T *argvars, typval_T *rettv);
|
||||
static void f_foldclosed(typval_T *argvars, typval_T *rettv);
|
||||
static void f_foldclosedend(typval_T *argvars, typval_T *rettv);
|
||||
static void f_foldlevel(typval_T *argvars, typval_T *rettv);
|
||||
static void f_foldtext(typval_T *argvars, typval_T *rettv);
|
||||
static void f_foldtextresult(typval_T *argvars, typval_T *rettv);
|
||||
static void f_foreground(typval_T *argvars, typval_T *rettv);
|
||||
static void f_function(typval_T *argvars, typval_T *rettv);
|
||||
static void f_garbagecollect(typval_T *argvars, typval_T *rettv);
|
||||
static void f_get(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getbufline(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getbufvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getchar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcharmod(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcmdline(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcmdpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcmdtype(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getcwd(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getfontname(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getfperm(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getfsize(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getftime(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getftype(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getline(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getmatches(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getpid(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getqflist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getreg(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getregtype(typval_T *argvars, typval_T *rettv);
|
||||
static void f_gettabvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_gettabwinvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getwinposx(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getwinposy(typval_T *argvars, typval_T *rettv);
|
||||
static void f_getwinvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_glob(typval_T *argvars, typval_T *rettv);
|
||||
static void f_globpath(typval_T *argvars, typval_T *rettv);
|
||||
static void f_has(typval_T *argvars, typval_T *rettv);
|
||||
static void f_has_key(typval_T *argvars, typval_T *rettv);
|
||||
static void f_haslocaldir(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hasmapto(typval_T *argvars, typval_T *rettv);
|
||||
static void f_histadd(typval_T *argvars, typval_T *rettv);
|
||||
static void f_histdel(typval_T *argvars, typval_T *rettv);
|
||||
static void f_histget(typval_T *argvars, typval_T *rettv);
|
||||
static void f_histnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hlID(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hlexists(typval_T *argvars, typval_T *rettv);
|
||||
static void f_hostname(typval_T *argvars, typval_T *rettv);
|
||||
static void f_iconv(typval_T *argvars, typval_T *rettv);
|
||||
static void f_indent(typval_T *argvars, typval_T *rettv);
|
||||
static void f_index(typval_T *argvars, typval_T *rettv);
|
||||
static void f_input(typval_T *argvars, typval_T *rettv);
|
||||
static void f_inputdialog(typval_T *argvars, typval_T *rettv);
|
||||
static void f_inputlist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_inputrestore(typval_T *argvars, typval_T *rettv);
|
||||
static void f_inputsave(typval_T *argvars, typval_T *rettv);
|
||||
static void f_inputsecret(typval_T *argvars, typval_T *rettv);
|
||||
static void f_insert(typval_T *argvars, typval_T *rettv);
|
||||
static void f_invert(typval_T *argvars, typval_T *rettv);
|
||||
static void f_isdirectory(typval_T *argvars, typval_T *rettv);
|
||||
static void f_islocked(typval_T *argvars, typval_T *rettv);
|
||||
static void f_items(typval_T *argvars, typval_T *rettv);
|
||||
static void f_job_start(typval_T *argvars, typval_T *rettv);
|
||||
static void f_job_stop(typval_T *argvars, typval_T *rettv);
|
||||
static void f_job_write(typval_T *argvars, typval_T *rettv);
|
||||
static void f_join(typval_T *argvars, typval_T *rettv);
|
||||
static void f_keys(typval_T *argvars, typval_T *rettv);
|
||||
static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_len(typval_T *argvars, typval_T *rettv);
|
||||
static void f_libcall(typval_T *argvars, typval_T *rettv);
|
||||
static void f_libcallnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_line(typval_T *argvars, typval_T *rettv);
|
||||
static void f_line2byte(typval_T *argvars, typval_T *rettv);
|
||||
static void f_lispindent(typval_T *argvars, typval_T *rettv);
|
||||
static void f_localtime(typval_T *argvars, typval_T *rettv);
|
||||
static void f_log(typval_T *argvars, typval_T *rettv);
|
||||
static void f_log10(typval_T *argvars, typval_T *rettv);
|
||||
static void f_map(typval_T *argvars, typval_T *rettv);
|
||||
static void f_maparg(typval_T *argvars, typval_T *rettv);
|
||||
static void f_mapcheck(typval_T *argvars, typval_T *rettv);
|
||||
static void f_match(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchadd(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matcharg(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchdelete(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchend(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchlist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchstr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_max(typval_T *argvars, typval_T *rettv);
|
||||
static void f_min(typval_T *argvars, typval_T *rettv);
|
||||
static void f_mkdir(typval_T *argvars, typval_T *rettv);
|
||||
static void f_mode(typval_T *argvars, typval_T *rettv);
|
||||
static void f_nextnonblank(typval_T *argvars, typval_T *rettv);
|
||||
static void f_nr2char(typval_T *argvars, typval_T *rettv);
|
||||
static void f_or(typval_T *argvars, typval_T *rettv);
|
||||
static void f_pathshorten(typval_T *argvars, typval_T *rettv);
|
||||
static void f_pow(typval_T *argvars, typval_T *rettv);
|
||||
static void f_prevnonblank(typval_T *argvars, typval_T *rettv);
|
||||
static void f_printf(typval_T *argvars, typval_T *rettv);
|
||||
static void f_pumvisible(typval_T *argvars, typval_T *rettv);
|
||||
static void f_range(typval_T *argvars, typval_T *rettv);
|
||||
static void f_readfile(typval_T *argvars, typval_T *rettv);
|
||||
static void f_reltime(typval_T *argvars, typval_T *rettv);
|
||||
static void f_reltimestr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_remove(typval_T *argvars, typval_T *rettv);
|
||||
static void f_rename(typval_T *argvars, typval_T *rettv);
|
||||
static void f_repeat(typval_T *argvars, typval_T *rettv);
|
||||
static void f_resolve(typval_T *argvars, typval_T *rettv);
|
||||
static void f_reverse(typval_T *argvars, typval_T *rettv);
|
||||
static void f_round(typval_T *argvars, typval_T *rettv);
|
||||
static void f_screenattr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_screenchar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_screencol(typval_T *argvars, typval_T *rettv);
|
||||
static void f_screenrow(typval_T *argvars, typval_T *rettv);
|
||||
static void f_search(typval_T *argvars, typval_T *rettv);
|
||||
static void f_searchdecl(typval_T *argvars, typval_T *rettv);
|
||||
static void f_searchpair(typval_T *argvars, typval_T *rettv);
|
||||
static void f_searchpairpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_searchpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_send_event(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setbufvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setcmdpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setline(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setloclist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setmatches(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setqflist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setreg(typval_T *argvars, typval_T *rettv);
|
||||
static void f_settabvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_settabwinvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_setwinvar(typval_T *argvars, typval_T *rettv);
|
||||
static void f_shellescape(typval_T *argvars, typval_T *rettv);
|
||||
static void f_shiftwidth(typval_T *argvars, typval_T *rettv);
|
||||
static void f_simplify(typval_T *argvars, typval_T *rettv);
|
||||
static void f_sin(typval_T *argvars, typval_T *rettv);
|
||||
static void f_sinh(typval_T *argvars, typval_T *rettv);
|
||||
static void f_sort(typval_T *argvars, typval_T *rettv);
|
||||
static void f_soundfold(typval_T *argvars, typval_T *rettv);
|
||||
static void f_spellbadword(typval_T *argvars, typval_T *rettv);
|
||||
static void f_spellsuggest(typval_T *argvars, typval_T *rettv);
|
||||
static void f_split(typval_T *argvars, typval_T *rettv);
|
||||
static void f_sqrt(typval_T *argvars, typval_T *rettv);
|
||||
static void f_str2float(typval_T *argvars, typval_T *rettv);
|
||||
static void f_str2nr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strchars(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strftime(typval_T *argvars, typval_T *rettv);
|
||||
static void f_stridx(typval_T *argvars, typval_T *rettv);
|
||||
static void f_string(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strlen(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strpart(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strridx(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strtrans(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv);
|
||||
static void f_strwidth(typval_T *argvars, typval_T *rettv);
|
||||
static void f_submatch(typval_T *argvars, typval_T *rettv);
|
||||
static void f_substitute(typval_T *argvars, typval_T *rettv);
|
||||
static void f_synID(typval_T *argvars, typval_T *rettv);
|
||||
static void f_synIDattr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_synIDtrans(typval_T *argvars, typval_T *rettv);
|
||||
static void f_synstack(typval_T *argvars, typval_T *rettv);
|
||||
static void f_synconcealed(typval_T *argvars, typval_T *rettv);
|
||||
static void f_system(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tabpagebuflist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tabpagenr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tabpagewinnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_taglist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tagfiles(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tempname(typval_T *argvars, typval_T *rettv);
|
||||
static void f_test(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tan(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tanh(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tolower(typval_T *argvars, typval_T *rettv);
|
||||
static void f_toupper(typval_T *argvars, typval_T *rettv);
|
||||
static void f_tr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_trunc(typval_T *argvars, typval_T *rettv);
|
||||
static void f_type(typval_T *argvars, typval_T *rettv);
|
||||
static void f_undofile(typval_T *argvars, typval_T *rettv);
|
||||
static void f_undotree(typval_T *argvars, typval_T *rettv);
|
||||
static void f_uniq(typval_T *argvars, typval_T *rettv);
|
||||
static void f_values(typval_T *argvars, typval_T *rettv);
|
||||
static void f_virtcol(typval_T *argvars, typval_T *rettv);
|
||||
static void f_visualmode(typval_T *argvars, typval_T *rettv);
|
||||
static void f_wildmenumode(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winbufnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_wincol(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winheight(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winline(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winnr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winrestcmd(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winrestview(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winsaveview(typval_T *argvars, typval_T *rettv);
|
||||
static void f_winwidth(typval_T *argvars, typval_T *rettv);
|
||||
static void f_writefile(typval_T *argvars, typval_T *rettv);
|
||||
static void f_xor(typval_T *argvars, typval_T *rettv);
|
||||
|
||||
static int list2fpos(typval_T *arg, pos_T *posp, int *fnump);
|
||||
static pos_T *var2fpos(typval_T *varp, int dollar_lnum, int *fnum);
|
||||
static int get_env_len(char_u **arg);
|
||||
static int get_id_len(char_u **arg);
|
||||
static int get_name_len(char_u **arg, char_u **alias, int evaluate,
|
||||
int verbose);
|
||||
static char_u *find_name_end(char_u *arg, char_u **expr_start, char_u *
|
||||
*expr_end,
|
||||
int flags);
|
||||
#define FNE_INCL_BR 1 /* find_name_end(): include [] in name */
|
||||
#define FNE_CHECK_START 2 /* find_name_end(): check name starts with
|
||||
valid character */
|
||||
static char_u *
|
||||
make_expanded_name(char_u *in_start, char_u *expr_start, char_u *
|
||||
expr_end,
|
||||
char_u *in_end);
|
||||
static int eval_isnamec(int c);
|
||||
static int eval_isnamec1(int c);
|
||||
static int get_var_tv(char_u *name, int len, typval_T *rettv,
|
||||
int verbose,
|
||||
int no_autoload);
|
||||
static int handle_subscript(char_u **arg, typval_T *rettv, int evaluate,
|
||||
int verbose);
|
||||
static void init_tv(typval_T *varp);
|
||||
static long get_tv_number(typval_T *varp);
|
||||
static linenr_T get_tv_lnum(typval_T *argvars);
|
||||
static linenr_T get_tv_lnum_buf(typval_T *argvars, buf_T *buf);
|
||||
static char_u *get_tv_string(typval_T *varp);
|
||||
static char_u *get_tv_string_buf(typval_T *varp, char_u *buf);
|
||||
static char_u *get_tv_string_buf_chk(typval_T *varp, char_u *buf);
|
||||
static dictitem_T *find_var(char_u *name, hashtab_T **htp,
|
||||
int no_autoload);
|
||||
static dictitem_T *find_var_in_ht(hashtab_T *ht, int htname,
|
||||
char_u *varname,
|
||||
int no_autoload);
|
||||
static hashtab_T *find_var_ht(char_u *name, char_u **varname);
|
||||
static void vars_clear_ext(hashtab_T *ht, int free_val);
|
||||
static void delete_var(hashtab_T *ht, hashitem_T *hi);
|
||||
static void list_one_var(dictitem_T *v, char_u *prefix, int *first);
|
||||
static void list_one_var_a(char_u *prefix, char_u *name, int type,
|
||||
char_u *string,
|
||||
int *first);
|
||||
static void set_var(char_u *name, typval_T *varp, int copy);
|
||||
static int var_check_ro(int flags, char_u *name);
|
||||
static int var_check_fixed(int flags, char_u *name);
|
||||
static int var_check_func_name(char_u *name, int new_var);
|
||||
static int valid_varname(char_u *varname);
|
||||
static int tv_check_lock(int lock, char_u *name);
|
||||
static int item_copy(typval_T *from, typval_T *to, int deep, int copyID);
|
||||
static char_u *find_option_end(char_u **arg, int *opt_flags);
|
||||
static char_u *trans_function_name(char_u **pp, int skip, int flags,
|
||||
funcdict_T *fd);
|
||||
static int eval_fname_script(char_u *p);
|
||||
static int eval_fname_sid(char_u *p);
|
||||
static void list_func_head(ufunc_T *fp, int indent);
|
||||
static ufunc_T *find_func(char_u *name);
|
||||
static int function_exists(char_u *name);
|
||||
static bool builtin_function(char_u *name, int len);
|
||||
static void func_do_profile(ufunc_T *fp);
|
||||
static void prof_sort_list(FILE *fd, ufunc_T **sorttab, int st_len,
|
||||
char *title,
|
||||
int prefer_self);
|
||||
static void prof_func_line(FILE *fd, int count, proftime_T *total,
|
||||
proftime_T *self,
|
||||
int prefer_self);
|
||||
static int
|
||||
prof_total_cmp(const void *s1, const void *s2);
|
||||
static int
|
||||
prof_self_cmp(const void *s1, const void *s2);
|
||||
static int script_autoload(char_u *name, int reload);
|
||||
static char_u *autoload_name(char_u *name);
|
||||
static void cat_func_name(char_u *buf, ufunc_T *fp);
|
||||
static void func_free(ufunc_T *fp);
|
||||
static void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars,
|
||||
typval_T *rettv, linenr_T firstline,
|
||||
linenr_T lastline,
|
||||
dict_T *selfdict);
|
||||
static int can_free_funccal(funccall_T *fc, int copyID);
|
||||
static void free_funccal(funccall_T *fc, int free_val);
|
||||
static void add_nr_var(dict_T *dp, dictitem_T *v, char *name,
|
||||
varnumber_T nr);
|
||||
static win_T *find_win_by_nr(typval_T *vp, tabpage_T *tp);
|
||||
static void getwinvar(typval_T *argvars, typval_T *rettv, int off);
|
||||
static int searchpair_cmn(typval_T *argvars, pos_T *match_pos);
|
||||
static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp);
|
||||
static void setwinvar(typval_T *argvars, typval_T *rettv, int off);
|
||||
|
||||
|
||||
|
||||
@ -1627,8 +1194,8 @@ void restore_funccal(void *vfc)
|
||||
* counted for the script/function itself.
|
||||
* Should always be called in pair with prof_child_exit().
|
||||
*/
|
||||
void prof_child_enter(tm)
|
||||
proftime_T *tm; /* place to store waittime */
|
||||
void prof_child_enter(proftime_T *tm /* place to store waittime */
|
||||
)
|
||||
{
|
||||
funccall_T *fc = current_funccal;
|
||||
|
||||
@ -1641,8 +1208,8 @@ proftime_T *tm; /* place to store waittime */
|
||||
* Take care of time spent in a child.
|
||||
* Should always be called after prof_child_enter().
|
||||
*/
|
||||
void prof_child_exit(tm)
|
||||
proftime_T *tm; /* where waittime was stored */
|
||||
void prof_child_exit(proftime_T *tm /* where waittime was stored */
|
||||
)
|
||||
{
|
||||
funccall_T *fc = current_funccal;
|
||||
|
||||
@ -3406,7 +2973,6 @@ void del_menutrans_vars(void)
|
||||
* get_user_var_name().
|
||||
*/
|
||||
|
||||
static char_u *cat_prefix_varname(int prefix, char_u *name);
|
||||
|
||||
static char_u *varnamebuf = NULL;
|
||||
static size_t varnamebuflen = 0;
|
||||
@ -7416,7 +6982,6 @@ static int non_zero_arg(typval_T *argvars)
|
||||
* Implementation of the built-in functions
|
||||
*/
|
||||
|
||||
static int get_float_arg(typval_T *argvars, float_T *f);
|
||||
|
||||
/*
|
||||
* Get the float value of "argvars[0]" into "f".
|
||||
@ -7653,7 +7218,6 @@ static void f_browsedir(typval_T *argvars, typval_T *rettv)
|
||||
rettv->v_type = VAR_STRING;
|
||||
}
|
||||
|
||||
static buf_T *find_buffer(typval_T *avar);
|
||||
|
||||
/*
|
||||
* Find a buffer by number or exact name.
|
||||
@ -7711,7 +7275,6 @@ static void f_bufloaded(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_number = (buf != NULL && buf->b_ml.ml_mfp != NULL);
|
||||
}
|
||||
|
||||
static buf_T *get_buf_tv(typval_T *tv, int curtab_only);
|
||||
|
||||
/*
|
||||
* Get buffer by number or pattern.
|
||||
@ -8814,8 +8377,6 @@ static void f_filewritable(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_number = os_file_is_writable(filename);
|
||||
}
|
||||
|
||||
static void findfilendir(typval_T *argvars, typval_T *rettv,
|
||||
int find_what);
|
||||
|
||||
static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
|
||||
{
|
||||
@ -8873,8 +8434,6 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
|
||||
rettv->vval.v_string = fresult;
|
||||
}
|
||||
|
||||
static void filter_map(typval_T *argvars, typval_T *rettv, int map);
|
||||
static int filter_map_one(typval_T *tv, char_u *expr, int map, int *remp);
|
||||
|
||||
/*
|
||||
* Implementation of map() and filter().
|
||||
@ -9120,7 +8679,6 @@ static void f_fnamemodify(typval_T *argvars, typval_T *rettv)
|
||||
free(fbuf);
|
||||
}
|
||||
|
||||
static void foldclosed_both(typval_T *argvars, typval_T *rettv, int end);
|
||||
|
||||
/*
|
||||
* "foldclosed()" function
|
||||
@ -9338,9 +8896,6 @@ static void f_get(typval_T *argvars, typval_T *rettv)
|
||||
copy_tv(tv, rettv);
|
||||
}
|
||||
|
||||
static void get_buffer_lines(buf_T *buf, linenr_T start, linenr_T end,
|
||||
int retlist,
|
||||
typval_T *rettv);
|
||||
|
||||
/*
|
||||
* Get line or list of lines from buffer "buf" into "rettv".
|
||||
@ -10542,8 +10097,6 @@ static void f_index(typval_T *argvars, typval_T *rettv)
|
||||
|
||||
static int inputsecret_flag = 0;
|
||||
|
||||
static void get_user_input(typval_T *argvars, typval_T *rettv,
|
||||
int inputdialog);
|
||||
|
||||
/*
|
||||
* This function is used by f_input() and f_inputdialog() functions. The third
|
||||
@ -10835,7 +10388,6 @@ static void f_islocked(typval_T *argvars, typval_T *rettv)
|
||||
clear_lval(&lv);
|
||||
}
|
||||
|
||||
static void dict_list(typval_T *argvars, typval_T *rettv, int what);
|
||||
|
||||
/*
|
||||
* Turn a dict into a list:
|
||||
@ -11124,7 +10676,6 @@ static void f_len(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
}
|
||||
|
||||
static void libcall_common(typval_T *argvars, typval_T *rettv, int type);
|
||||
|
||||
static void libcall_common(typval_T *argvars, typval_T *rettv, int type)
|
||||
{
|
||||
@ -11236,7 +10787,6 @@ static void f_localtime(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_number = (varnumber_T)time(NULL);
|
||||
}
|
||||
|
||||
static void get_maparg(typval_T *argvars, typval_T *rettv, int exact);
|
||||
|
||||
static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
{
|
||||
@ -11356,7 +10906,6 @@ static void f_mapcheck(typval_T *argvars, typval_T *rettv)
|
||||
get_maparg(argvars, rettv, FALSE);
|
||||
}
|
||||
|
||||
static void find_some_match(typval_T *argvars, typval_T *rettv, int start);
|
||||
|
||||
static void find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
{
|
||||
@ -11608,7 +11157,6 @@ static void f_matchstr(typval_T *argvars, typval_T *rettv)
|
||||
find_some_match(argvars, rettv, 2);
|
||||
}
|
||||
|
||||
static void max_min(typval_T *argvars, typval_T *rettv, int domax);
|
||||
|
||||
static void max_min(typval_T *argvars, typval_T *rettv, int domax)
|
||||
{
|
||||
@ -11677,7 +11225,6 @@ static void f_min(typval_T *argvars, typval_T *rettv)
|
||||
max_min(argvars, rettv, FALSE);
|
||||
}
|
||||
|
||||
static int mkdir_recurse(char_u *dir, int prot);
|
||||
|
||||
/*
|
||||
* Create the directory in which "dir" is located, and higher levels when
|
||||
@ -12142,7 +11689,6 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
|
||||
fclose(fd);
|
||||
}
|
||||
|
||||
static int list2proftime(typval_T *arg, proftime_T *tm);
|
||||
|
||||
/*
|
||||
* Convert a List to proftime_T.
|
||||
@ -12556,7 +12102,6 @@ static void f_reverse(typval_T *argvars, typval_T *rettv)
|
||||
#define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */
|
||||
#define SP_END 0x40 /* leave cursor at end of match */
|
||||
|
||||
static int get_search_arg(typval_T *varp, int *flagsp);
|
||||
|
||||
/*
|
||||
* Get flags for a search function.
|
||||
@ -13228,9 +12773,6 @@ static void f_setline(typval_T *argvars, typval_T *rettv)
|
||||
appended_lines_mark(lcount, added);
|
||||
}
|
||||
|
||||
static void set_qf_ll_list(win_T *wp, typval_T *list_arg,
|
||||
typval_T *action_arg,
|
||||
typval_T *rettv);
|
||||
|
||||
/*
|
||||
* Used by "setqflist()" and "setloclist()" functions
|
||||
@ -13589,16 +13131,11 @@ static void f_sinh(typval_T *argvars, typval_T *rettv)
|
||||
rettv->vval.v_float = 0.0;
|
||||
}
|
||||
|
||||
static int
|
||||
item_compare(const void *s1, const void *s2);
|
||||
static int
|
||||
item_compare2(const void *s1, const void *s2);
|
||||
|
||||
static int item_compare_ic;
|
||||
static char_u *item_compare_func;
|
||||
static dict_T *item_compare_selfdict;
|
||||
static int item_compare_func_err;
|
||||
static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort);
|
||||
#define ITEM_COMPARE_FAIL 999
|
||||
|
||||
/*
|
||||
@ -14637,7 +14174,6 @@ static void f_tabpagenr(typval_T *argvars, typval_T *rettv)
|
||||
}
|
||||
|
||||
|
||||
static int get_winnr(tabpage_T *tp, typval_T *argvar);
|
||||
|
||||
/*
|
||||
* Common code for tabpagewinnr() and winnr().
|
||||
@ -18088,12 +17624,13 @@ prof_sort_list (
|
||||
/*
|
||||
* Print the count and times for one function or function line.
|
||||
*/
|
||||
static void prof_func_line(fd, count, total, self, prefer_self)
|
||||
FILE *fd;
|
||||
int count;
|
||||
proftime_T *total;
|
||||
proftime_T *self;
|
||||
int prefer_self; /* when equal print only self time */
|
||||
static void prof_func_line(
|
||||
FILE *fd,
|
||||
int count,
|
||||
proftime_T *total,
|
||||
proftime_T *self,
|
||||
int prefer_self /* when equal print only self time */
|
||||
)
|
||||
{
|
||||
if (count > 0) {
|
||||
fprintf(fd, "%5d ", count);
|
||||
@ -19020,14 +18557,6 @@ int func_has_abort(void *cookie)
|
||||
return ((funccall_T *)cookie)->func->uf_flags & FC_ABORT;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
VAR_FLAVOUR_DEFAULT, /* doesn't start with uppercase */
|
||||
VAR_FLAVOUR_SESSION, /* starts with uppercase, some lower */
|
||||
VAR_FLAVOUR_VIMINFO /* all uppercase */
|
||||
} var_flavour_T;
|
||||
|
||||
static var_flavour_T var_flavour(char_u *varname);
|
||||
|
||||
static var_flavour_T var_flavour(char_u *varname)
|
||||
{
|
||||
char_u *p = varname;
|
||||
|
153
src/nvim/eval.h
153
src/nvim/eval.h
@ -1,152 +1,7 @@
|
||||
#ifndef NVIM_EVAL_H
|
||||
#define NVIM_EVAL_H
|
||||
/* eval.c */
|
||||
void eval_init(void);
|
||||
void eval_clear(void);
|
||||
char_u *func_name(void *cookie);
|
||||
linenr_T *func_breakpoint(void *cookie);
|
||||
int *func_dbg_tick(void *cookie);
|
||||
int func_level(void *cookie);
|
||||
int current_func_returned(void);
|
||||
void set_internal_string_var(char_u *name, char_u *value);
|
||||
int var_redir_start(char_u *name, int append);
|
||||
void var_redir_str(char_u *value, int value_len);
|
||||
void var_redir_stop(void);
|
||||
int eval_charconvert(char_u *enc_from, char_u *enc_to, char_u *
|
||||
fname_from,
|
||||
char_u *fname_to);
|
||||
int eval_printexpr(char_u *fname, char_u *args);
|
||||
void eval_diff(char_u *origfile, char_u *newfile, char_u *outfile);
|
||||
void eval_patch(char_u *origfile, char_u *difffile, char_u *outfile);
|
||||
int eval_to_bool(char_u *arg, int *error, char_u **nextcmd, int skip);
|
||||
char_u *eval_to_string_skip(char_u *arg, char_u **nextcmd, int skip);
|
||||
int skip_expr(char_u **pp);
|
||||
char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert);
|
||||
char_u *eval_to_string_safe(char_u *arg, char_u **nextcmd,
|
||||
int use_sandbox);
|
||||
int eval_to_number(char_u *expr);
|
||||
list_T *eval_spell_expr(char_u *badword, char_u *expr);
|
||||
int get_spellword(list_T *list, char_u **pp);
|
||||
typval_T *eval_expr(char_u *arg, char_u **nextcmd);
|
||||
int call_vim_function(char_u *func, int argc, char_u **argv, int safe,
|
||||
int str_arg_only,
|
||||
typval_T *rettv);
|
||||
long call_func_retnr(char_u *func, int argc, char_u **argv, int safe);
|
||||
void *call_func_retstr(char_u *func, int argc, char_u **argv, int safe);
|
||||
void *call_func_retlist(char_u *func, int argc, char_u **argv, int safe);
|
||||
void *save_funccal(void);
|
||||
void restore_funccal(void *vfc);
|
||||
void prof_child_enter(proftime_T *tm);
|
||||
void prof_child_exit(proftime_T *tm);
|
||||
int eval_foldexpr(char_u *arg, int *cp);
|
||||
void ex_let(exarg_T *eap);
|
||||
void list_add_watch(list_T *l, listwatch_T *lw);
|
||||
void list_rem_watch(list_T *l, listwatch_T *lwrem);
|
||||
void *eval_for_line(char_u *arg, int *errp, char_u **nextcmdp, int skip);
|
||||
int next_for_item(void *fi_void, char_u *arg);
|
||||
void free_for_info(void *fi_void);
|
||||
void set_context_for_expression(expand_T *xp, char_u *arg,
|
||||
cmdidx_T cmdidx);
|
||||
void ex_call(exarg_T *eap);
|
||||
void ex_unlet(exarg_T *eap);
|
||||
void ex_lockvar(exarg_T *eap);
|
||||
int do_unlet(char_u *name, int forceit);
|
||||
void del_menutrans_vars(void);
|
||||
char_u *get_user_var_name(expand_T *xp, int idx);
|
||||
list_T *list_alloc(void);
|
||||
void list_unref(list_T *l);
|
||||
void list_free(list_T *l, int recurse);
|
||||
listitem_T *listitem_alloc(void);
|
||||
void listitem_free(listitem_T *item);
|
||||
void listitem_remove(list_T *l, listitem_T *item);
|
||||
dictitem_T *dict_lookup(hashitem_T *hi);
|
||||
listitem_T *list_find(list_T *l, long n);
|
||||
char_u *list_find_str(list_T *l, long idx);
|
||||
void list_append(list_T *l, listitem_T *item);
|
||||
void list_append_tv(list_T *l, typval_T *tv);
|
||||
void list_append_dict(list_T *list, dict_T *dict);
|
||||
void list_append_string(list_T *l, char_u *str, int len);
|
||||
int list_insert_tv(list_T *l, typval_T *tv, listitem_T *item);
|
||||
void list_remove(list_T *l, listitem_T *item, listitem_T *item2);
|
||||
void list_insert(list_T *l, listitem_T *ni, listitem_T *item);
|
||||
int garbage_collect(void);
|
||||
void set_ref_in_ht(hashtab_T *ht, int copyID);
|
||||
void set_ref_in_list(list_T *l, int copyID);
|
||||
void set_ref_in_item(typval_T *tv, int copyID);
|
||||
dict_T *dict_alloc(void);
|
||||
void dict_unref(dict_T *d);
|
||||
void dict_free(dict_T *d, int recurse);
|
||||
dictitem_T *dictitem_alloc(char_u *key);
|
||||
void dictitem_free(dictitem_T *item);
|
||||
int dict_add(dict_T *d, dictitem_T *item);
|
||||
int dict_add_nr_str(dict_T *d, char *key, long nr, char_u *str);
|
||||
int dict_add_list(dict_T *d, char *key, list_T *list);
|
||||
dictitem_T *dict_find(dict_T *d, char_u *key, int len);
|
||||
char_u *get_dict_string(dict_T *d, char_u *key, int save);
|
||||
long get_dict_number(dict_T *d, char_u *key);
|
||||
char_u *get_function_name(expand_T *xp, int idx);
|
||||
char_u *get_expr_name(expand_T *xp, int idx);
|
||||
int func_call(char_u *name, typval_T *args, dict_T *selfdict,
|
||||
typval_T *rettv);
|
||||
void dict_extend(dict_T *d1, dict_T *d2, char_u *action);
|
||||
float_T vim_round(float_T f);
|
||||
long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir,
|
||||
char_u *skip, int flags, pos_T *match_pos,
|
||||
linenr_T lnum_stop,
|
||||
long time_limit);
|
||||
void set_vim_var_nr(int idx, long val);
|
||||
long get_vim_var_nr(int idx);
|
||||
char_u *get_vim_var_str(int idx);
|
||||
list_T *get_vim_var_list(int idx);
|
||||
void set_vim_var_char(int c);
|
||||
void set_vcount(long count, long count1, int set_prevcount);
|
||||
void set_vim_var_string(int idx, char_u *val, int len);
|
||||
void set_vim_var_list(int idx, list_T *val);
|
||||
void set_reg_var(int c);
|
||||
char_u *v_exception(char_u *oldval);
|
||||
char_u *v_throwpoint(char_u *oldval);
|
||||
char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
|
||||
void free_tv(typval_T *varp);
|
||||
void clear_tv(typval_T *varp);
|
||||
long get_tv_number_chk(typval_T *varp, int *denote);
|
||||
char_u *get_tv_string_chk(typval_T *varp);
|
||||
char_u *get_var_value(char_u *name);
|
||||
void new_script_vars(scid_T id);
|
||||
void init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope);
|
||||
void unref_var_dict(dict_T *dict);
|
||||
void vars_clear(hashtab_T *ht);
|
||||
void copy_tv(typval_T *from, typval_T *to);
|
||||
void ex_echo(exarg_T *eap);
|
||||
void ex_echohl(exarg_T *eap);
|
||||
void ex_execute(exarg_T *eap);
|
||||
void ex_function(exarg_T *eap);
|
||||
void free_all_functions(void);
|
||||
int translated_function_exists(char_u *name);
|
||||
char_u *get_expanded_name(char_u *name, int check);
|
||||
void func_dump_profile(FILE *fd);
|
||||
char_u *get_user_func_name(expand_T *xp, int idx);
|
||||
void ex_delfunction(exarg_T *eap);
|
||||
void func_unref(char_u *name);
|
||||
void func_ref(char_u *name);
|
||||
void ex_return(exarg_T *eap);
|
||||
int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv);
|
||||
void discard_pending_return(void *rettv);
|
||||
char_u *get_return_cmd(void *rettv);
|
||||
char_u *get_func_line(int c, void *cookie, int indent);
|
||||
void func_line_start(void *cookie);
|
||||
void func_line_exec(void *cookie);
|
||||
void func_line_end(void *cookie);
|
||||
int func_has_ended(void *cookie);
|
||||
int func_has_abort(void *cookie);
|
||||
int read_viminfo_varlist(vir_T *virp, int writing);
|
||||
void write_viminfo_varlist(FILE *fp);
|
||||
int store_session_globals(FILE *fd);
|
||||
void last_set_msg(scid_T scriptID);
|
||||
void ex_oldfiles(exarg_T *eap);
|
||||
int modify_fname(char_u *src, int *usedlen, char_u **fnamep,
|
||||
char_u **bufp,
|
||||
int *fnamelen);
|
||||
char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub,
|
||||
char_u *flags);
|
||||
|
||||
#endif /* NVIM_EVAL_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "eval.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_EVAL_H
|
||||
|
@ -62,19 +62,15 @@
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/shell.h"
|
||||
|
||||
static int linelen(int *has_tab);
|
||||
static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap,
|
||||
char_u *cmd, int do_in,
|
||||
int do_out);
|
||||
static char_u *viminfo_filename(char_u *);
|
||||
static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags);
|
||||
static int viminfo_encoding(vir_T *virp);
|
||||
static int read_viminfo_up_to_marks(vir_T *virp, int forceit,
|
||||
int writing);
|
||||
/*
|
||||
* Struct to hold the sign properties.
|
||||
*/
|
||||
typedef struct sign sign_T;
|
||||
|
||||
static int check_readonly(int *forceit, buf_T *buf);
|
||||
static void delbuf_msg(char_u *name);
|
||||
static int help_compare(const void *s1, const void *s2);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_cmds.c.generated.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ":ascii" and "ga".
|
||||
@ -293,8 +289,6 @@ typedef struct {
|
||||
long end_col_nr; /* ending column number */
|
||||
} sorti_T;
|
||||
|
||||
static int
|
||||
sort_compare(const void *s1, const void *s2);
|
||||
|
||||
static int sort_compare(const void *s1, const void *s2)
|
||||
{
|
||||
@ -1407,7 +1401,6 @@ void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname)
|
||||
}
|
||||
|
||||
|
||||
static int no_viminfo(void);
|
||||
static int viminfo_errcnt;
|
||||
|
||||
static int no_viminfo(void)
|
||||
@ -5290,8 +5283,6 @@ void ex_viusage(exarg_T *eap)
|
||||
do_cmdline_cmd((char_u *)"help normal-index");
|
||||
}
|
||||
|
||||
static void helptags_one(char_u *dir, char_u *ext, char_u *lang,
|
||||
int add_help_tags);
|
||||
|
||||
/*
|
||||
* ":helptags"
|
||||
@ -5606,11 +5597,6 @@ helptags_one (
|
||||
fclose(fd_tags); /* there is no check for an error... */
|
||||
}
|
||||
|
||||
/*
|
||||
* Struct to hold the sign properties.
|
||||
*/
|
||||
typedef struct sign sign_T;
|
||||
|
||||
struct sign
|
||||
{
|
||||
sign_T *sn_next; /* next sign in list */
|
||||
@ -5625,9 +5611,6 @@ struct sign
|
||||
static sign_T *first_sign = NULL;
|
||||
static int next_sign_typenr = 1;
|
||||
|
||||
static int sign_cmd_idx (char_u *begin_cmd, char_u *end_cmd);
|
||||
static void sign_list_defined (sign_T *sp);
|
||||
static void sign_undefine (sign_T *sp, sign_T *sp_prev);
|
||||
|
||||
static char *cmds[] = {
|
||||
"define",
|
||||
@ -6053,104 +6036,86 @@ void ex_sign(exarg_T *eap)
|
||||
/*
|
||||
* List one sign.
|
||||
*/
|
||||
static void
|
||||
sign_list_defined(sp)
|
||||
sign_T *sp;
|
||||
static void sign_list_defined(sign_T *sp)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *p;
|
||||
|
||||
smsg((char_u *)"sign %s", sp->sn_name);
|
||||
if (sp->sn_icon != NULL)
|
||||
{
|
||||
MSG_PUTS(" icon=");
|
||||
msg_outtrans(sp->sn_icon);
|
||||
MSG_PUTS(_(" (not supported)"));
|
||||
}
|
||||
if (sp->sn_text != NULL)
|
||||
{
|
||||
MSG_PUTS(" text=");
|
||||
msg_outtrans(sp->sn_text);
|
||||
}
|
||||
if (sp->sn_line_hl > 0)
|
||||
{
|
||||
MSG_PUTS(" linehl=");
|
||||
p = get_highlight_name(NULL, sp->sn_line_hl - 1);
|
||||
if (p == NULL)
|
||||
MSG_PUTS("NONE");
|
||||
else
|
||||
msg_puts(p);
|
||||
}
|
||||
if (sp->sn_text_hl > 0)
|
||||
{
|
||||
MSG_PUTS(" texthl=");
|
||||
p = get_highlight_name(NULL, sp->sn_text_hl - 1);
|
||||
if (p == NULL)
|
||||
MSG_PUTS("NONE");
|
||||
else
|
||||
msg_puts(p);
|
||||
}
|
||||
smsg((char_u *)"sign %s", sp->sn_name);
|
||||
if (sp->sn_icon != NULL) {
|
||||
MSG_PUTS(" icon=");
|
||||
msg_outtrans(sp->sn_icon);
|
||||
MSG_PUTS(_(" (not supported)"));
|
||||
}
|
||||
if (sp->sn_text != NULL) {
|
||||
MSG_PUTS(" text=");
|
||||
msg_outtrans(sp->sn_text);
|
||||
}
|
||||
if (sp->sn_line_hl > 0) {
|
||||
MSG_PUTS(" linehl=");
|
||||
p = get_highlight_name(NULL, sp->sn_line_hl - 1);
|
||||
if (p == NULL)
|
||||
MSG_PUTS("NONE");
|
||||
else
|
||||
msg_puts(p);
|
||||
}
|
||||
if (sp->sn_text_hl > 0) {
|
||||
MSG_PUTS(" texthl=");
|
||||
p = get_highlight_name(NULL, sp->sn_text_hl - 1);
|
||||
if (p == NULL)
|
||||
MSG_PUTS("NONE");
|
||||
else
|
||||
msg_puts(p);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Undefine a sign and free its memory.
|
||||
*/
|
||||
static void
|
||||
sign_undefine(sp, sp_prev)
|
||||
sign_T *sp;
|
||||
sign_T *sp_prev;
|
||||
static void sign_undefine(sign_T *sp, sign_T *sp_prev)
|
||||
{
|
||||
free(sp->sn_name);
|
||||
free(sp->sn_icon);
|
||||
free(sp->sn_text);
|
||||
if (sp_prev == NULL)
|
||||
first_sign = sp->sn_next;
|
||||
else
|
||||
sp_prev->sn_next = sp->sn_next;
|
||||
free(sp);
|
||||
free(sp->sn_name);
|
||||
free(sp->sn_icon);
|
||||
free(sp->sn_text);
|
||||
if (sp_prev == NULL)
|
||||
first_sign = sp->sn_next;
|
||||
else
|
||||
sp_prev->sn_next = sp->sn_next;
|
||||
free(sp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get highlighting attribute for sign "typenr".
|
||||
* If "line" is TRUE: line highl, if FALSE: text highl.
|
||||
*/
|
||||
int
|
||||
sign_get_attr(typenr, line)
|
||||
int typenr;
|
||||
int line;
|
||||
int sign_get_attr(int typenr, int line)
|
||||
{
|
||||
sign_T *sp;
|
||||
sign_T *sp;
|
||||
|
||||
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
|
||||
if (sp->sn_typenr == typenr)
|
||||
{
|
||||
if (line)
|
||||
{
|
||||
if (sp->sn_line_hl > 0)
|
||||
return syn_id2attr(sp->sn_line_hl);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sp->sn_text_hl > 0)
|
||||
return syn_id2attr(sp->sn_text_hl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
|
||||
if (sp->sn_typenr == typenr) {
|
||||
if (line) {
|
||||
if (sp->sn_line_hl > 0)
|
||||
return syn_id2attr(sp->sn_line_hl);
|
||||
} else {
|
||||
if (sp->sn_text_hl > 0)
|
||||
return syn_id2attr(sp->sn_text_hl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get text mark for sign "typenr".
|
||||
* Returns NULL if there isn't one.
|
||||
*/
|
||||
char_u *
|
||||
sign_get_text(typenr)
|
||||
int typenr;
|
||||
char_u * sign_get_text(int typenr)
|
||||
{
|
||||
sign_T *sp;
|
||||
sign_T *sp;
|
||||
|
||||
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
|
||||
if (sp->sn_typenr == typenr)
|
||||
return sp->sn_text;
|
||||
if (sp->sn_typenr == typenr)
|
||||
return sp->sn_text;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -6158,27 +6123,24 @@ sign_get_text(typenr)
|
||||
/*
|
||||
* Get the name of a sign by its typenr.
|
||||
*/
|
||||
char_u *
|
||||
sign_typenr2name(typenr)
|
||||
int typenr;
|
||||
char_u * sign_typenr2name(int typenr)
|
||||
{
|
||||
sign_T *sp;
|
||||
sign_T *sp;
|
||||
|
||||
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
|
||||
if (sp->sn_typenr == typenr)
|
||||
return sp->sn_name;
|
||||
return (char_u *)_("[Deleted]");
|
||||
for (sp = first_sign; sp != NULL; sp = sp->sn_next)
|
||||
if (sp->sn_typenr == typenr)
|
||||
return sp->sn_name;
|
||||
return (char_u *)_("[Deleted]");
|
||||
}
|
||||
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
/*
|
||||
* Undefine/free all signs.
|
||||
*/
|
||||
void
|
||||
free_signs()
|
||||
void free_signs()
|
||||
{
|
||||
while (first_sign != NULL)
|
||||
sign_undefine(first_sign, NULL);
|
||||
while (first_sign != NULL)
|
||||
sign_undefine(first_sign, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -6240,120 +6202,117 @@ char_u * get_sign_name(expand_T *xp, int idx)
|
||||
/*
|
||||
* Handle command line completion for :sign command.
|
||||
*/
|
||||
void
|
||||
set_context_in_sign_cmd(xp, arg)
|
||||
expand_T *xp;
|
||||
char_u *arg;
|
||||
void set_context_in_sign_cmd(expand_T *xp, char_u *arg)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *end_subcmd;
|
||||
char_u *last;
|
||||
int cmd_idx;
|
||||
char_u *begin_subcmd_args;
|
||||
char_u *p;
|
||||
char_u *end_subcmd;
|
||||
char_u *last;
|
||||
int cmd_idx;
|
||||
char_u *begin_subcmd_args;
|
||||
|
||||
/* Default: expand subcommands. */
|
||||
xp->xp_context = EXPAND_SIGN;
|
||||
expand_what = EXP_SUBCMD;
|
||||
xp->xp_pattern = arg;
|
||||
/* Default: expand subcommands. */
|
||||
xp->xp_context = EXPAND_SIGN;
|
||||
expand_what = EXP_SUBCMD;
|
||||
xp->xp_pattern = arg;
|
||||
|
||||
end_subcmd = skiptowhite(arg);
|
||||
if (*end_subcmd == NUL)
|
||||
/* expand subcmd name
|
||||
* :sign {subcmd}<CTRL-D>*/
|
||||
return;
|
||||
end_subcmd = skiptowhite(arg);
|
||||
if (*end_subcmd == NUL)
|
||||
/* expand subcmd name
|
||||
* :sign {subcmd}<CTRL-D>*/
|
||||
return;
|
||||
|
||||
cmd_idx = sign_cmd_idx(arg, end_subcmd);
|
||||
cmd_idx = sign_cmd_idx(arg, end_subcmd);
|
||||
|
||||
/* :sign {subcmd} {subcmd_args}
|
||||
* |
|
||||
* begin_subcmd_args */
|
||||
begin_subcmd_args = skipwhite(end_subcmd);
|
||||
p = skiptowhite(begin_subcmd_args);
|
||||
if (*p == NUL)
|
||||
/* :sign {subcmd} {subcmd_args}
|
||||
* |
|
||||
* begin_subcmd_args */
|
||||
begin_subcmd_args = skipwhite(end_subcmd);
|
||||
p = skiptowhite(begin_subcmd_args);
|
||||
if (*p == NUL)
|
||||
{
|
||||
/*
|
||||
* Expand first argument of subcmd when possible.
|
||||
* For ":jump {id}" and ":unplace {id}", we could
|
||||
* possibly expand the ids of all signs already placed.
|
||||
*/
|
||||
xp->xp_pattern = begin_subcmd_args;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
/*
|
||||
* Expand first argument of subcmd when possible.
|
||||
* For ":jump {id}" and ":unplace {id}", we could
|
||||
* possibly expand the ids of all signs already placed.
|
||||
*/
|
||||
xp->xp_pattern = begin_subcmd_args;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
case SIGNCMD_LIST:
|
||||
case SIGNCMD_UNDEFINE:
|
||||
/* :sign list <CTRL-D>
|
||||
* :sign undefine <CTRL-D> */
|
||||
expand_what = EXP_SIGN_NAMES;
|
||||
break;
|
||||
default:
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
return;
|
||||
case SIGNCMD_LIST:
|
||||
case SIGNCMD_UNDEFINE:
|
||||
/* :sign list <CTRL-D>
|
||||
* :sign undefine <CTRL-D> */
|
||||
expand_what = EXP_SIGN_NAMES;
|
||||
break;
|
||||
default:
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* expand last argument of subcmd */
|
||||
/* expand last argument of subcmd */
|
||||
|
||||
/* :sign define {name} {args}...
|
||||
* |
|
||||
* p */
|
||||
/* :sign define {name} {args}...
|
||||
* |
|
||||
* p */
|
||||
|
||||
/* Loop until reaching last argument. */
|
||||
do
|
||||
/* Loop until reaching last argument. */
|
||||
do
|
||||
{
|
||||
p = skipwhite(p);
|
||||
last = p;
|
||||
p = skiptowhite(p);
|
||||
} while (*p != NUL);
|
||||
|
||||
p = vim_strchr(last, '=');
|
||||
|
||||
/* :sign define {name} {args}... {last}=
|
||||
* | |
|
||||
* last p */
|
||||
if (p == NUL)
|
||||
{
|
||||
/* Expand last argument name (before equal sign). */
|
||||
xp->xp_pattern = last;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
p = skipwhite(p);
|
||||
last = p;
|
||||
p = skiptowhite(p);
|
||||
} while (*p != NUL);
|
||||
|
||||
p = vim_strchr(last, '=');
|
||||
|
||||
/* :sign define {name} {args}... {last}=
|
||||
* | |
|
||||
* last p */
|
||||
if (p == NUL)
|
||||
{
|
||||
/* Expand last argument name (before equal sign). */
|
||||
xp->xp_pattern = last;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
case SIGNCMD_DEFINE:
|
||||
expand_what = EXP_DEFINE;
|
||||
break;
|
||||
case SIGNCMD_PLACE:
|
||||
expand_what = EXP_PLACE;
|
||||
break;
|
||||
case SIGNCMD_JUMP:
|
||||
case SIGNCMD_UNPLACE:
|
||||
expand_what = EXP_UNPLACE;
|
||||
break;
|
||||
default:
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
case SIGNCMD_DEFINE:
|
||||
expand_what = EXP_DEFINE;
|
||||
break;
|
||||
case SIGNCMD_PLACE:
|
||||
expand_what = EXP_PLACE;
|
||||
break;
|
||||
case SIGNCMD_JUMP:
|
||||
case SIGNCMD_UNPLACE:
|
||||
expand_what = EXP_UNPLACE;
|
||||
break;
|
||||
default:
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Expand last argument value (after equal sign). */
|
||||
xp->xp_pattern = p + 1;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
/* Expand last argument value (after equal sign). */
|
||||
xp->xp_pattern = p + 1;
|
||||
switch (cmd_idx)
|
||||
{
|
||||
case SIGNCMD_DEFINE:
|
||||
if (STRNCMP(last, "texthl", p - last) == 0 ||
|
||||
STRNCMP(last, "linehl", p - last) == 0)
|
||||
xp->xp_context = EXPAND_HIGHLIGHT;
|
||||
else if (STRNCMP(last, "icon", p - last) == 0)
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
else
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
break;
|
||||
case SIGNCMD_PLACE:
|
||||
if (STRNCMP(last, "name", p - last) == 0)
|
||||
expand_what = EXP_SIGN_NAMES;
|
||||
else
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
break;
|
||||
default:
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
case SIGNCMD_DEFINE:
|
||||
if (STRNCMP(last, "texthl", p - last) == 0 ||
|
||||
STRNCMP(last, "linehl", p - last) == 0)
|
||||
xp->xp_context = EXPAND_HIGHLIGHT;
|
||||
else if (STRNCMP(last, "icon", p - last) == 0)
|
||||
xp->xp_context = EXPAND_FILES;
|
||||
else
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
break;
|
||||
case SIGNCMD_PLACE:
|
||||
if (STRNCMP(last, "name", p - last) == 0)
|
||||
expand_what = EXP_SIGN_NAMES;
|
||||
else
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
break;
|
||||
default:
|
||||
xp->xp_context = EXPAND_NOTHING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,75 +1,7 @@
|
||||
#ifndef NVIM_EX_CMDS_H
|
||||
#define NVIM_EX_CMDS_H
|
||||
/* ex_cmds.c */
|
||||
|
||||
void do_ascii(exarg_T *eap);
|
||||
void ex_align(exarg_T *eap);
|
||||
void ex_sort(exarg_T *eap);
|
||||
void ex_retab(exarg_T *eap);
|
||||
int do_move(linenr_T line1, linenr_T line2, linenr_T dest);
|
||||
void ex_copy(linenr_T line1, linenr_T line2, linenr_T n);
|
||||
void free_prev_shellcmd(void);
|
||||
void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in,
|
||||
int do_out);
|
||||
void do_shell(char_u *cmd, int flags);
|
||||
char_u *make_filter_cmd(char_u *cmd, char_u *itmp, char_u *otmp);
|
||||
void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname);
|
||||
int viminfo_error(char *errnum, char *message, char_u *line);
|
||||
int read_viminfo(char_u *file, int flags);
|
||||
void write_viminfo(char_u *file, int forceit);
|
||||
int viminfo_readline(vir_T *virp);
|
||||
char_u *viminfo_readstring(vir_T *virp, int off, int convert);
|
||||
void viminfo_writestring(FILE *fd, char_u *p);
|
||||
void do_fixdel(exarg_T *eap);
|
||||
void print_line_no_prefix(linenr_T lnum, int use_number, int list);
|
||||
void print_line(linenr_T lnum, int use_number, int list);
|
||||
int rename_buffer(char_u *new_fname);
|
||||
void ex_file(exarg_T *eap);
|
||||
void ex_update(exarg_T *eap);
|
||||
void ex_write(exarg_T *eap);
|
||||
int do_write(exarg_T *eap);
|
||||
int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *
|
||||
ffname,
|
||||
int other);
|
||||
void ex_wnext(exarg_T *eap);
|
||||
void do_wqall(exarg_T *eap);
|
||||
int not_writing(void);
|
||||
int getfile(int fnum, char_u *ffname, char_u *sfname, int setpm,
|
||||
linenr_T lnum,
|
||||
int forceit);
|
||||
int do_ecmd(int fnum, char_u *ffname, char_u *sfname, exarg_T *eap,
|
||||
linenr_T newlnum, int flags,
|
||||
win_T *oldwin);
|
||||
void ex_append(exarg_T *eap);
|
||||
void ex_change(exarg_T *eap);
|
||||
void ex_z(exarg_T *eap);
|
||||
int check_restricted(void);
|
||||
int check_secure(void);
|
||||
void do_sub(exarg_T *eap);
|
||||
int do_sub_msg(int count_only);
|
||||
void ex_global(exarg_T *eap);
|
||||
void global_exe(char_u *cmd);
|
||||
int read_viminfo_sub_string(vir_T *virp, int force);
|
||||
void write_viminfo_sub_string(FILE *fp);
|
||||
void free_old_sub(void);
|
||||
int prepare_tagpreview(int undo_sync);
|
||||
void ex_help(exarg_T *eap);
|
||||
char_u *check_help_lang(char_u *arg);
|
||||
int help_heuristic(char_u *matched_string, int offset, int wrong_case);
|
||||
int find_help_tags(char_u *arg, int *num_matches, char_u ***matches,
|
||||
int keep_lang);
|
||||
void fix_help_buffer(void);
|
||||
void ex_exusage(exarg_T *eap);
|
||||
void ex_viusage(exarg_T *eap);
|
||||
void ex_helptags(exarg_T *eap);
|
||||
void ex_sign(exarg_T *eap);
|
||||
int sign_get_attr(int typenr, int line);
|
||||
char_u *sign_get_text(int typenr);
|
||||
void *sign_get_image(int typenr);
|
||||
char_u *sign_typenr2name(int typenr);
|
||||
void free_signs(void);
|
||||
char_u *get_sign_name(expand_T *xp, int idx);
|
||||
void set_context_in_sign_cmd(expand_T *xp, char_u *arg);
|
||||
void ex_drop(exarg_T *eap);
|
||||
|
||||
#endif /* NVIM_EX_CMDS_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_cmds.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_EX_CMDS_H
|
||||
|
@ -46,8 +46,6 @@
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/shell.h"
|
||||
|
||||
static void cmd_source(char_u *fname, exarg_T *eap);
|
||||
|
||||
/* Growarray to store info about already sourced scripts.
|
||||
* Also store the dev/ino, so that we don't have to stat() each
|
||||
* script when going through the list. */
|
||||
@ -85,8 +83,33 @@ typedef struct sn_prl_S {
|
||||
proftime_T sn_prl_self; /* time spent in a line itself */
|
||||
} sn_prl_T;
|
||||
|
||||
/*
|
||||
* Structure used to store info for each sourced file.
|
||||
* It is shared between do_source() and getsourceline().
|
||||
* This is required, because it needs to be handed to do_cmdline() and
|
||||
* sourcing can be done recursively.
|
||||
*/
|
||||
struct source_cookie {
|
||||
FILE *fp; /* opened file for sourcing */
|
||||
char_u *nextline; /* if not NULL: line that was read ahead */
|
||||
int finished; /* ":finish" used */
|
||||
#if defined(USE_CRNL) || defined(USE_CR)
|
||||
int fileformat; /* EOL_UNKNOWN, EOL_UNIX or EOL_DOS */
|
||||
int error; /* TRUE if LF found after CR-LF */
|
||||
#endif
|
||||
linenr_T breakpoint; /* next line with breakpoint or zero */
|
||||
char_u *fname; /* name of sourced file */
|
||||
int dbg_tick; /* debug_tick when breakpoint was set */
|
||||
int level; /* top nesting level of sourced file */
|
||||
vimconv_T conv; /* type of conversion */
|
||||
};
|
||||
|
||||
# define PRL_ITEM(si, idx) (((sn_prl_T *)(si)->sn_prl_ga.ga_data)[(idx)])
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_cmds2.c.generated.h"
|
||||
#endif
|
||||
|
||||
static int debug_greedy = FALSE; /* batch mode debugging: don't save
|
||||
and restore typeahead. */
|
||||
|
||||
@ -389,10 +412,6 @@ static garray_T prof_ga = {0, 0, sizeof(struct debuggy), 4, NULL};
|
||||
#define DBG_FUNC 1
|
||||
#define DBG_FILE 2
|
||||
|
||||
static int dbg_parsearg(char_u *arg, garray_T *gap);
|
||||
static linenr_T debuggy_find(int file,char_u *fname, linenr_T after,
|
||||
garray_T *gap,
|
||||
int *fp);
|
||||
|
||||
/*
|
||||
* Parse the arguments of ":profile", ":breakadd" or ":breakdel" and put them
|
||||
@ -724,8 +743,7 @@ void dbg_breakpoint(char_u *name, linenr_T lnum)
|
||||
/*
|
||||
* Store the current time in "tm".
|
||||
*/
|
||||
void profile_start(tm)
|
||||
proftime_T *tm;
|
||||
void profile_start(proftime_T *tm)
|
||||
{
|
||||
gettimeofday(tm, NULL);
|
||||
}
|
||||
@ -733,8 +751,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Compute the elapsed time from "tm" till now and store in "tm".
|
||||
*/
|
||||
void profile_end(tm)
|
||||
proftime_T *tm;
|
||||
void profile_end(proftime_T *tm)
|
||||
{
|
||||
proftime_T now;
|
||||
|
||||
@ -750,8 +767,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Subtract the time "tm2" from "tm".
|
||||
*/
|
||||
void profile_sub(tm, tm2)
|
||||
proftime_T *tm, *tm2;
|
||||
void profile_sub(proftime_T *tm, proftime_T *tm2)
|
||||
{
|
||||
tm->tv_usec -= tm2->tv_usec;
|
||||
tm->tv_sec -= tm2->tv_sec;
|
||||
@ -765,8 +781,7 @@ proftime_T *tm, *tm2;
|
||||
* Return a string that represents the time in "tm".
|
||||
* Uses a static buffer!
|
||||
*/
|
||||
char * profile_msg(tm)
|
||||
proftime_T *tm;
|
||||
char * profile_msg(proftime_T *tm)
|
||||
{
|
||||
static char buf[50];
|
||||
|
||||
@ -777,9 +792,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Put the time "msec" past now in "tm".
|
||||
*/
|
||||
void profile_setlimit(msec, tm)
|
||||
long msec;
|
||||
proftime_T *tm;
|
||||
void profile_setlimit(long msec, proftime_T *tm)
|
||||
{
|
||||
if (msec <= 0) /* no limit */
|
||||
profile_zero(tm);
|
||||
@ -796,8 +809,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Return TRUE if the current time is past "tm".
|
||||
*/
|
||||
int profile_passed_limit(tm)
|
||||
proftime_T *tm;
|
||||
int profile_passed_limit(proftime_T *tm)
|
||||
{
|
||||
proftime_T now;
|
||||
|
||||
@ -811,8 +823,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Set the time in "tm" to zero.
|
||||
*/
|
||||
void profile_zero(tm)
|
||||
proftime_T *tm;
|
||||
void profile_zero(proftime_T *tm)
|
||||
{
|
||||
tm->tv_usec = 0;
|
||||
tm->tv_sec = 0;
|
||||
@ -824,10 +835,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Divide the time "tm" by "count" and store in "tm2".
|
||||
*/
|
||||
void profile_divide(tm, count, tm2)
|
||||
proftime_T *tm;
|
||||
proftime_T *tm2;
|
||||
int count;
|
||||
void profile_divide(proftime_T *tm, int count, proftime_T *tm2)
|
||||
{
|
||||
if (count == 0)
|
||||
profile_zero(tm2);
|
||||
@ -842,15 +850,12 @@ int count;
|
||||
/*
|
||||
* Functions for profiling.
|
||||
*/
|
||||
static void script_do_profile(scriptitem_T *si);
|
||||
static void script_dump_profile(FILE *fd);
|
||||
static proftime_T prof_wait_time;
|
||||
|
||||
/*
|
||||
* Add the time "tm2" to "tm".
|
||||
*/
|
||||
void profile_add(tm, tm2)
|
||||
proftime_T *tm, *tm2;
|
||||
void profile_add(proftime_T *tm, proftime_T *tm2)
|
||||
{
|
||||
tm->tv_usec += tm2->tv_usec;
|
||||
tm->tv_sec += tm2->tv_sec;
|
||||
@ -863,8 +868,7 @@ proftime_T *tm, *tm2;
|
||||
/*
|
||||
* Add the "self" time from the total time and the children's time.
|
||||
*/
|
||||
void profile_self(self, total, children)
|
||||
proftime_T *self, *total, *children;
|
||||
void profile_self(proftime_T *self, proftime_T *total, proftime_T *children)
|
||||
{
|
||||
/* Check that the result won't be negative. Can happen with recursive
|
||||
* calls. */
|
||||
@ -879,8 +883,7 @@ proftime_T *self, *total, *children;
|
||||
/*
|
||||
* Get the current waittime.
|
||||
*/
|
||||
void profile_get_wait(tm)
|
||||
proftime_T *tm;
|
||||
void profile_get_wait(proftime_T *tm)
|
||||
{
|
||||
*tm = prof_wait_time;
|
||||
}
|
||||
@ -888,8 +891,7 @@ proftime_T *tm;
|
||||
/*
|
||||
* Subtract the passed waittime since "tm" from "tma".
|
||||
*/
|
||||
void profile_sub_wait(tm, tma)
|
||||
proftime_T *tm, *tma;
|
||||
void profile_sub_wait(proftime_T *tm, proftime_T *tma)
|
||||
{
|
||||
proftime_T tm3 = prof_wait_time;
|
||||
|
||||
@ -900,8 +902,7 @@ proftime_T *tm, *tma;
|
||||
/*
|
||||
* Return TRUE if "tm1" and "tm2" are equal.
|
||||
*/
|
||||
int profile_equal(tm1, tm2)
|
||||
proftime_T *tm1, *tm2;
|
||||
int profile_equal(proftime_T *tm1, proftime_T *tm2)
|
||||
{
|
||||
return tm1->tv_usec == tm2->tv_usec && tm1->tv_sec == tm2->tv_sec;
|
||||
}
|
||||
@ -909,8 +910,7 @@ proftime_T *tm1, *tm2;
|
||||
/*
|
||||
* Return <0, 0 or >0 if "tm1" < "tm2", "tm1" == "tm2" or "tm1" > "tm2"
|
||||
*/
|
||||
int profile_cmp(tm1, tm2)
|
||||
const proftime_T *tm1, *tm2;
|
||||
int profile_cmp(const proftime_T *tm1, const proftime_T *tm2)
|
||||
{
|
||||
if (tm1->tv_sec == tm2->tv_sec)
|
||||
return tm2->tv_usec - tm1->tv_usec;
|
||||
@ -1055,8 +1055,9 @@ static void script_do_profile(scriptitem_T *si)
|
||||
/*
|
||||
* save time when starting to invoke another script or function.
|
||||
*/
|
||||
void script_prof_save(tm)
|
||||
proftime_T *tm; /* place to store wait time */
|
||||
void script_prof_save(
|
||||
proftime_T *tm /* place to store wait time */
|
||||
)
|
||||
{
|
||||
scriptitem_T *si;
|
||||
|
||||
@ -1071,8 +1072,7 @@ proftime_T *tm; /* place to store wait time */
|
||||
/*
|
||||
* Count time spent in children after invoking another script or function.
|
||||
*/
|
||||
void script_prof_restore(tm)
|
||||
proftime_T *tm;
|
||||
void script_prof_restore(proftime_T *tm)
|
||||
{
|
||||
scriptitem_T *si;
|
||||
|
||||
@ -1327,7 +1327,6 @@ int can_abandon(buf_T *buf, int forceit)
|
||||
|| forceit;
|
||||
}
|
||||
|
||||
static void add_bufnum(int *bufnrs, int *bufnump, int nr);
|
||||
|
||||
/*
|
||||
* Add a buffer number to "bufnrs", unless it's already there.
|
||||
@ -1486,11 +1485,6 @@ int buf_write_all(buf_T *buf, int forceit)
|
||||
* Code to handle the argument list.
|
||||
*/
|
||||
|
||||
static char_u *do_one_arg(char_u *str);
|
||||
static int do_arglist(char_u *str, int what, int after);
|
||||
static void alist_check_arg_idx(void);
|
||||
static int editing_arg_idx(win_T *win);
|
||||
static int alist_add_list(int count, char_u **files, int after);
|
||||
#define AL_SET 1
|
||||
#define AL_ADD 2
|
||||
#define AL_DEL 3
|
||||
@ -2202,7 +2196,6 @@ void ex_runtime(exarg_T *eap)
|
||||
source_runtime(eap->arg, eap->forceit);
|
||||
}
|
||||
|
||||
static void source_callback(char_u *fname, void *cookie);
|
||||
|
||||
static void source_callback(char_u *fname, void *cookie)
|
||||
{
|
||||
@ -2231,11 +2224,8 @@ int source_runtime(char_u *name, int all)
|
||||
* passed by reference in this case, setting it to NULL indicates that callback
|
||||
* has done its job.
|
||||
*/
|
||||
int do_in_runtimepath(name, all, callback, cookie)
|
||||
char_u *name;
|
||||
int all;
|
||||
void (*callback)(char_u *fname, void *ck);
|
||||
void *cookie;
|
||||
int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
|
||||
void *cookie)
|
||||
{
|
||||
char_u *rtp;
|
||||
char_u *np;
|
||||
@ -2354,26 +2344,6 @@ static void cmd_source(char_u *fname, exarg_T *eap)
|
||||
/*
|
||||
* ":source" and associated commands.
|
||||
*/
|
||||
/*
|
||||
* Structure used to store info for each sourced file.
|
||||
* It is shared between do_source() and getsourceline().
|
||||
* This is required, because it needs to be handed to do_cmdline() and
|
||||
* sourcing can be done recursively.
|
||||
*/
|
||||
struct source_cookie {
|
||||
FILE *fp; /* opened file for sourcing */
|
||||
char_u *nextline; /* if not NULL: line that was read ahead */
|
||||
int finished; /* ":finish" used */
|
||||
#if defined(USE_CRNL) || defined(USE_CR)
|
||||
int fileformat; /* EOL_UNKNOWN, EOL_UNIX or EOL_DOS */
|
||||
int error; /* TRUE if LF found after CR-LF */
|
||||
#endif
|
||||
linenr_T breakpoint; /* next line with breakpoint or zero */
|
||||
char_u *fname; /* name of sourced file */
|
||||
int dbg_tick; /* debug_tick when breakpoint was set */
|
||||
int level; /* top nesting level of sourced file */
|
||||
vimconv_T conv; /* type of conversion */
|
||||
};
|
||||
|
||||
/*
|
||||
* Return the address holding the next breakpoint line for a source cookie.
|
||||
@ -2399,7 +2369,6 @@ int source_level(void *cookie)
|
||||
return ((struct source_cookie *)cookie)->level;
|
||||
}
|
||||
|
||||
static char_u *get_one_sourceline(struct source_cookie *sp);
|
||||
|
||||
#if (defined(WIN32) && defined(FEAT_CSCOPE)) || defined(HAVE_FD_CLOEXEC)
|
||||
# define USE_FOPEN_NOINH
|
||||
@ -3200,9 +3169,7 @@ void do_finish(exarg_T *eap, int reanimate)
|
||||
* message for missing ":endif".
|
||||
* Return FALSE when not sourcing a file.
|
||||
*/
|
||||
int source_finished(fgetline, cookie)
|
||||
char_u *(*fgetline)(int, void *, int);
|
||||
void *cookie;
|
||||
int source_finished(LineGetter fgetline, void *cookie)
|
||||
{
|
||||
return getline_equal(fgetline, cookie, getsourceline)
|
||||
&& ((struct source_cookie *)getline_cookie(
|
||||
@ -3230,7 +3197,6 @@ void ex_checktime(exarg_T *eap)
|
||||
|
||||
#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
# define HAVE_GET_LOCALE_VAL
|
||||
static char *get_locale_val(int what);
|
||||
|
||||
static char *get_locale_val(int what)
|
||||
{
|
||||
|
@ -1,95 +1,11 @@
|
||||
#ifndef NVIM_EX_CMDS2_H
|
||||
#define NVIM_EX_CMDS2_H
|
||||
/* ex_cmds2.c */
|
||||
void do_debug(char_u *cmd);
|
||||
void ex_debug(exarg_T *eap);
|
||||
void dbg_check_breakpoint(exarg_T *eap);
|
||||
int dbg_check_skipped(exarg_T *eap);
|
||||
void ex_breakadd(exarg_T *eap);
|
||||
void ex_debuggreedy(exarg_T *eap);
|
||||
void ex_breakdel(exarg_T *eap);
|
||||
void ex_breaklist(exarg_T *eap);
|
||||
linenr_T dbg_find_breakpoint(int file, char_u *fname, linenr_T after);
|
||||
int has_profiling(int file, char_u *fname, int *fp);
|
||||
void dbg_breakpoint(char_u *name, linenr_T lnum);
|
||||
void profile_start(proftime_T *tm);
|
||||
void profile_end(proftime_T *tm);
|
||||
void profile_sub(proftime_T *tm, proftime_T *tm2);
|
||||
char *profile_msg(proftime_T *tm);
|
||||
void profile_setlimit(long msec, proftime_T *tm);
|
||||
int profile_passed_limit(proftime_T *tm);
|
||||
void profile_zero(proftime_T *tm);
|
||||
void profile_divide(proftime_T *tm, int count, proftime_T *tm2);
|
||||
void profile_add(proftime_T *tm, proftime_T *tm2);
|
||||
void profile_self(proftime_T *self, proftime_T *total,
|
||||
proftime_T *children);
|
||||
void profile_get_wait(proftime_T *tm);
|
||||
void profile_sub_wait(proftime_T *tm, proftime_T *tma);
|
||||
int profile_equal(proftime_T *tm1, proftime_T *tm2);
|
||||
int profile_cmp(const proftime_T *tm1, const proftime_T *tm2);
|
||||
void ex_profile(exarg_T *eap);
|
||||
char_u *get_profile_name(expand_T *xp, int idx);
|
||||
void set_context_in_profile_cmd(expand_T *xp, char_u *arg);
|
||||
void profile_dump(void);
|
||||
void script_prof_save(proftime_T *tm);
|
||||
void script_prof_restore(proftime_T *tm);
|
||||
void prof_inchar_enter(void);
|
||||
void prof_inchar_exit(void);
|
||||
int prof_def_func(void);
|
||||
int autowrite(buf_T *buf, int forceit);
|
||||
void autowrite_all(void);
|
||||
int check_changed(buf_T *buf, int flags);
|
||||
void dialog_changed(buf_T *buf, int checkall);
|
||||
int can_abandon(buf_T *buf, int forceit);
|
||||
int check_changed_any(int hidden);
|
||||
int check_fname(void);
|
||||
int buf_write_all(buf_T *buf, int forceit);
|
||||
void get_arglist(garray_T *gap, char_u *str);
|
||||
int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp,
|
||||
int wig);
|
||||
void check_arg_idx(win_T *win);
|
||||
void ex_args(exarg_T *eap);
|
||||
void ex_previous(exarg_T *eap);
|
||||
void ex_rewind(exarg_T *eap);
|
||||
void ex_last(exarg_T *eap);
|
||||
void ex_argument(exarg_T *eap);
|
||||
void do_argfile(exarg_T *eap, int argn);
|
||||
void ex_next(exarg_T *eap);
|
||||
void ex_argedit(exarg_T *eap);
|
||||
void ex_argadd(exarg_T *eap);
|
||||
void ex_argdelete(exarg_T *eap);
|
||||
void ex_listdo(exarg_T *eap);
|
||||
void ex_compiler(exarg_T *eap);
|
||||
void ex_runtime(exarg_T *eap);
|
||||
int source_runtime(char_u *name, int all);
|
||||
int do_in_runtimepath(char_u *name, int all,
|
||||
void (*callback)(char_u *fname, void *ck),
|
||||
void *cookie);
|
||||
void ex_options(exarg_T *eap);
|
||||
void ex_source(exarg_T *eap);
|
||||
linenr_T *source_breakpoint(void *cookie);
|
||||
int *source_dbg_tick(void *cookie);
|
||||
int source_level(void *cookie);
|
||||
int do_source(char_u *fname, int check_other, int is_vimrc);
|
||||
void ex_scriptnames(exarg_T *eap);
|
||||
void scriptnames_slash_adjust(void);
|
||||
char_u *get_scriptname(scid_T id);
|
||||
void free_scriptnames(void);
|
||||
char *fgets_cr(char *s, int n, FILE *stream);
|
||||
char_u *getsourceline(int c, void *cookie, int indent);
|
||||
void script_line_start(void);
|
||||
void script_line_exec(void);
|
||||
void script_line_end(void);
|
||||
void ex_scriptencoding(exarg_T *eap);
|
||||
void ex_finish(exarg_T *eap);
|
||||
void do_finish(exarg_T *eap, int reanimate);
|
||||
int source_finished(char_u *(*fgetline)(int, void *, int), void *cookie);
|
||||
void ex_checktime(exarg_T *eap);
|
||||
char_u *get_mess_lang(void);
|
||||
void set_lang_var(void);
|
||||
void ex_language(exarg_T *eap);
|
||||
void free_locales(void);
|
||||
char_u *get_lang_arg(expand_T *xp, int idx);
|
||||
char_u *get_locales(expand_T *xp, int idx);
|
||||
|
||||
#endif /* NVIM_EX_CMDS2_H */
|
||||
#include "nvim/ex_docmd.h"
|
||||
|
||||
typedef void (*DoInRuntimepathCB)(char_u *, void *);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_cmds2.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_EX_CMDS2_H
|
||||
|
@ -83,149 +83,61 @@ static garray_T ucmds = {0, 0, sizeof(ucmd_T), 4, NULL};
|
||||
#define USER_CMD(i) (&((ucmd_T *)(ucmds.ga_data))[i])
|
||||
#define USER_CMD_GA(gap, i) (&((ucmd_T *)((gap)->ga_data))[i])
|
||||
|
||||
static void do_ucmd(exarg_T *eap);
|
||||
static void ex_command(exarg_T *eap);
|
||||
static void ex_delcommand(exarg_T *eap);
|
||||
static char_u *get_user_command_name(int idx);
|
||||
/* Struct for storing a line inside a while/for loop */
|
||||
typedef struct {
|
||||
char_u *line; /* command line */
|
||||
linenr_T lnum; /* sourcing_lnum of the line */
|
||||
} wcmd_T;
|
||||
|
||||
/*
|
||||
* Structure used to store info for line position in a while or for loop.
|
||||
* This is required, because do_one_cmd() may invoke ex_function(), which
|
||||
* reads more lines that may come from the while/for loop.
|
||||
*/
|
||||
struct loop_cookie {
|
||||
garray_T *lines_gap; /* growarray with line info */
|
||||
int current_line; /* last read line from growarray */
|
||||
int repeating; /* TRUE when looping a second time */
|
||||
/* When "repeating" is FALSE use "getline" and "cookie" to get lines */
|
||||
char_u *(*getline)(int, void *, int);
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
|
||||
static char_u *do_one_cmd(char_u **, int, struct condstack *,
|
||||
char_u *(*fgetline)(int, void *, int),
|
||||
void *cookie);
|
||||
static void append_command(char_u *cmd);
|
||||
static char_u *find_command(exarg_T *eap, int *full);
|
||||
/* Struct to save a few things while debugging. Used in do_cmdline() only. */
|
||||
struct dbg_stuff {
|
||||
int trylevel;
|
||||
int force_abort;
|
||||
except_T *caught_stack;
|
||||
char_u *vv_exception;
|
||||
char_u *vv_throwpoint;
|
||||
int did_emsg;
|
||||
int got_int;
|
||||
int did_throw;
|
||||
int need_rethrow;
|
||||
int check_cstack;
|
||||
except_T *current_exception;
|
||||
};
|
||||
|
||||
static void ex_abbreviate(exarg_T *eap);
|
||||
static void ex_map(exarg_T *eap);
|
||||
static void ex_unmap(exarg_T *eap);
|
||||
static void ex_mapclear(exarg_T *eap);
|
||||
static void ex_abclear(exarg_T *eap);
|
||||
static void ex_autocmd(exarg_T *eap);
|
||||
static void ex_doautocmd(exarg_T *eap);
|
||||
static void ex_bunload(exarg_T *eap);
|
||||
static void ex_buffer(exarg_T *eap);
|
||||
static void ex_bmodified(exarg_T *eap);
|
||||
static void ex_bnext(exarg_T *eap);
|
||||
static void ex_bprevious(exarg_T *eap);
|
||||
static void ex_brewind(exarg_T *eap);
|
||||
static void ex_blast(exarg_T *eap);
|
||||
static char_u *getargcmd(char_u **);
|
||||
static char_u *skip_cmd_arg(char_u *p, int rembs);
|
||||
static int getargopt(exarg_T *eap);
|
||||
|
||||
static int check_more(int, int);
|
||||
static linenr_T get_address(char_u **, int skip, int to_other_file);
|
||||
static void get_flags(exarg_T *eap);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_docmd.c.generated.h"
|
||||
#endif
|
||||
|
||||
# define HAVE_EX_SCRIPT_NI
|
||||
static void ex_script_ni(exarg_T *eap);
|
||||
static char_u *invalid_range(exarg_T *eap);
|
||||
static void correct_range(exarg_T *eap);
|
||||
static char_u *replace_makeprg(exarg_T *eap, char_u *p,
|
||||
char_u **cmdlinep);
|
||||
static char_u *repl_cmdline(exarg_T *eap, char_u *src, int srclen,
|
||||
char_u *repl,
|
||||
char_u **cmdlinep);
|
||||
static void ex_highlight(exarg_T *eap);
|
||||
static void ex_colorscheme(exarg_T *eap);
|
||||
static void ex_quit(exarg_T *eap);
|
||||
static void ex_cquit(exarg_T *eap);
|
||||
static void ex_quit_all(exarg_T *eap);
|
||||
static void ex_close(exarg_T *eap);
|
||||
static void ex_win_close(int forceit, win_T *win, tabpage_T *tp);
|
||||
static void ex_only(exarg_T *eap);
|
||||
static void ex_resize(exarg_T *eap);
|
||||
static void ex_stag(exarg_T *eap);
|
||||
static void ex_tabclose(exarg_T *eap);
|
||||
static void ex_tabonly(exarg_T *eap);
|
||||
static void ex_tabnext(exarg_T *eap);
|
||||
static void ex_tabmove(exarg_T *eap);
|
||||
static void ex_tabs(exarg_T *eap);
|
||||
static void ex_pclose(exarg_T *eap);
|
||||
static void ex_ptag(exarg_T *eap);
|
||||
static void ex_pedit(exarg_T *eap);
|
||||
static void ex_hide(exarg_T *eap);
|
||||
static void ex_stop(exarg_T *eap);
|
||||
static void ex_exit(exarg_T *eap);
|
||||
static void ex_print(exarg_T *eap);
|
||||
static void ex_goto(exarg_T *eap);
|
||||
static void ex_preserve(exarg_T *eap);
|
||||
static void ex_recover(exarg_T *eap);
|
||||
static void ex_mode(exarg_T *eap);
|
||||
static void ex_wrongmodifier(exarg_T *eap);
|
||||
static void ex_find(exarg_T *eap);
|
||||
static void ex_open(exarg_T *eap);
|
||||
static void ex_edit(exarg_T *eap);
|
||||
# define ex_drop ex_ni
|
||||
# define ex_gui ex_nogui
|
||||
static void ex_nogui(exarg_T *eap);
|
||||
# define ex_tearoff ex_ni
|
||||
# define ex_popup ex_ni
|
||||
# define ex_simalt ex_ni
|
||||
# define gui_mch_find_dialog ex_ni
|
||||
# define gui_mch_replace_dialog ex_ni
|
||||
# define ex_helpfind ex_ni
|
||||
static void ex_swapname(exarg_T *eap);
|
||||
static void ex_syncbind(exarg_T *eap);
|
||||
static void ex_read(exarg_T *eap);
|
||||
static void ex_pwd(exarg_T *eap);
|
||||
static void ex_equal(exarg_T *eap);
|
||||
static void ex_sleep(exarg_T *eap);
|
||||
static void do_exmap(exarg_T *eap, int isabbrev);
|
||||
static void ex_winsize(exarg_T *eap);
|
||||
static void ex_wincmd(exarg_T *eap);
|
||||
#if defined(FEAT_GUI) || defined(UNIX) || defined(MSWIN)
|
||||
static void ex_winpos(exarg_T *eap);
|
||||
#else
|
||||
# define ex_winpos ex_ni
|
||||
#endif
|
||||
static void ex_operators(exarg_T *eap);
|
||||
static void ex_put(exarg_T *eap);
|
||||
static void ex_copymove(exarg_T *eap);
|
||||
static void ex_submagic(exarg_T *eap);
|
||||
static void ex_join(exarg_T *eap);
|
||||
static void ex_at(exarg_T *eap);
|
||||
static void ex_bang(exarg_T *eap);
|
||||
static void ex_undo(exarg_T *eap);
|
||||
static void ex_wundo(exarg_T *eap);
|
||||
static void ex_rundo(exarg_T *eap);
|
||||
static void ex_redo(exarg_T *eap);
|
||||
static void ex_later(exarg_T *eap);
|
||||
static void ex_redir(exarg_T *eap);
|
||||
static void ex_redraw(exarg_T *eap);
|
||||
static void ex_redrawstatus(exarg_T *eap);
|
||||
static void close_redir(void);
|
||||
static void ex_mkrc(exarg_T *eap);
|
||||
static void ex_mark(exarg_T *eap);
|
||||
static char_u *uc_fun_cmd(void);
|
||||
static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full,
|
||||
expand_T *xp,
|
||||
int *compl);
|
||||
static void ex_normal(exarg_T *eap);
|
||||
static void ex_startinsert(exarg_T *eap);
|
||||
static void ex_stopinsert(exarg_T *eap);
|
||||
static void ex_checkpath(exarg_T *eap);
|
||||
static void ex_findpat(exarg_T *eap);
|
||||
static void ex_psearch(exarg_T *eap);
|
||||
static void ex_tag(exarg_T *eap);
|
||||
static void ex_tag_cmd(exarg_T *eap, char_u *name);
|
||||
static char_u *arg_all(void);
|
||||
static int makeopens(FILE *fd, char_u *dirnow);
|
||||
static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp,
|
||||
int current_arg_idx);
|
||||
static void ex_loadview(exarg_T *eap);
|
||||
static char_u *get_view_file(int c);
|
||||
static int did_lcd; /* whether ":lcd" was produced for a session */
|
||||
static void ex_viminfo(exarg_T *eap);
|
||||
static void ex_behave(exarg_T *eap);
|
||||
static void ex_filetype(exarg_T *eap);
|
||||
static void ex_setfiletype(exarg_T *eap);
|
||||
static void ex_digraphs(exarg_T *eap);
|
||||
static void ex_set(exarg_T *eap);
|
||||
static void ex_nohlsearch(exarg_T *eap);
|
||||
static void ex_match(exarg_T *eap);
|
||||
static void ex_fold(exarg_T *eap);
|
||||
static void ex_foldopen(exarg_T *eap);
|
||||
static void ex_folddo(exarg_T *eap);
|
||||
#ifndef HAVE_WORKING_LIBINTL
|
||||
# define ex_language ex_ni
|
||||
#endif
|
||||
@ -279,49 +191,6 @@ static cmdidx_T cmdidxs[27] =
|
||||
|
||||
static char_u dollar_command[2] = {'$', 0};
|
||||
|
||||
|
||||
/* Struct for storing a line inside a while/for loop */
|
||||
typedef struct {
|
||||
char_u *line; /* command line */
|
||||
linenr_T lnum; /* sourcing_lnum of the line */
|
||||
} wcmd_T;
|
||||
|
||||
/*
|
||||
* Structure used to store info for line position in a while or for loop.
|
||||
* This is required, because do_one_cmd() may invoke ex_function(), which
|
||||
* reads more lines that may come from the while/for loop.
|
||||
*/
|
||||
struct loop_cookie {
|
||||
garray_T *lines_gap; /* growarray with line info */
|
||||
int current_line; /* last read line from growarray */
|
||||
int repeating; /* TRUE when looping a second time */
|
||||
/* When "repeating" is FALSE use "getline" and "cookie" to get lines */
|
||||
char_u *(*getline)(int, void *, int);
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
static char_u *get_loop_line(int c, void *cookie, int indent);
|
||||
static void store_loop_line(garray_T *gap, char_u *line);
|
||||
static void free_cmdlines(garray_T *gap);
|
||||
|
||||
/* Struct to save a few things while debugging. Used in do_cmdline() only. */
|
||||
struct dbg_stuff {
|
||||
int trylevel;
|
||||
int force_abort;
|
||||
except_T *caught_stack;
|
||||
char_u *vv_exception;
|
||||
char_u *vv_throwpoint;
|
||||
int did_emsg;
|
||||
int got_int;
|
||||
int did_throw;
|
||||
int need_rethrow;
|
||||
int check_cstack;
|
||||
except_T *current_exception;
|
||||
};
|
||||
|
||||
static void save_dbg_stuff(struct dbg_stuff *dsp);
|
||||
static void restore_dbg_stuff(struct dbg_stuff *dsp);
|
||||
|
||||
static void save_dbg_stuff(struct dbg_stuff *dsp)
|
||||
{
|
||||
dsp->trylevel = trylevel; trylevel = 0;
|
||||
@ -465,11 +334,9 @@ int do_cmdline_cmd(char_u *cmd)
|
||||
*
|
||||
* return FAIL if cmdline could not be executed, OK otherwise
|
||||
*/
|
||||
int do_cmdline(cmdline, fgetline, cookie, flags)
|
||||
char_u *cmdline;
|
||||
char_u *(*fgetline)(int, void *, int);
|
||||
void *cookie; /* argument for fgetline() */
|
||||
int flags;
|
||||
int do_cmdline(char_u *cmdline, LineGetter fgetline,
|
||||
void *cookie, /* argument for fgetline() */
|
||||
int flags)
|
||||
{
|
||||
char_u *next_cmdline; /* next cmd to execute */
|
||||
char_u *cmdline_copy = NULL; /* copy of cmd line */
|
||||
@ -1191,12 +1058,11 @@ static void free_cmdlines(garray_T *gap)
|
||||
* If "fgetline" is get_loop_line(), return TRUE if the getline it uses equals
|
||||
* "func". * Otherwise return TRUE when "fgetline" equals "func".
|
||||
*/
|
||||
int getline_equal(fgetline, cookie, func)
|
||||
char_u *(*fgetline)(int, void *, int);
|
||||
void *cookie; /* argument for fgetline() */
|
||||
char_u *(*func)(int, void *, int);
|
||||
int getline_equal(LineGetter fgetline,
|
||||
void *cookie, /* argument for fgetline() */
|
||||
LineGetter func)
|
||||
{
|
||||
char_u *(*gp)(int, void *, int);
|
||||
LineGetter gp;
|
||||
struct loop_cookie *cp;
|
||||
|
||||
/* When "fgetline" is "get_loop_line()" use the "cookie" to find the
|
||||
@ -1215,11 +1081,11 @@ char_u *(*func)(int, void *, int);
|
||||
* If "fgetline" is get_loop_line(), return the cookie used by the original
|
||||
* getline function. Otherwise return "cookie".
|
||||
*/
|
||||
void * getline_cookie(fgetline, cookie)
|
||||
char_u *(*fgetline)(int, void *, int);
|
||||
void *cookie; /* argument for fgetline() */
|
||||
void * getline_cookie(LineGetter fgetline,
|
||||
void *cookie /* argument for fgetline() */
|
||||
)
|
||||
{
|
||||
char_u *(*gp)(int, void *, int);
|
||||
LineGetter gp;
|
||||
struct loop_cookie *cp;
|
||||
|
||||
/* When "fgetline" is "get_loop_line()" use the "cookie" to find the
|
||||
@ -1250,14 +1116,12 @@ void *cookie; /* argument for fgetline() */
|
||||
*
|
||||
* This function may be called recursively!
|
||||
*/
|
||||
static char_u * do_one_cmd(cmdlinep, sourcing,
|
||||
cstack,
|
||||
fgetline, cookie)
|
||||
char_u **cmdlinep;
|
||||
int sourcing;
|
||||
struct condstack *cstack;
|
||||
char_u *(*fgetline)(int, void *, int);
|
||||
void *cookie; /*argument for fgetline() */
|
||||
static char_u * do_one_cmd(char_u **cmdlinep,
|
||||
int sourcing,
|
||||
struct condstack *cstack,
|
||||
LineGetter fgetline,
|
||||
void *cookie /* argument for fgetline() */
|
||||
)
|
||||
{
|
||||
char_u *p;
|
||||
linenr_T lnum;
|
||||
@ -3500,7 +3364,6 @@ static void correct_range(exarg_T *eap)
|
||||
}
|
||||
}
|
||||
|
||||
static char_u *skip_grep_pat(exarg_T *eap);
|
||||
|
||||
/*
|
||||
* For a ":vimgrep" or ":vimgrepadd" command return a pointer past the
|
||||
@ -4263,18 +4126,6 @@ char_u *get_command_name(expand_T *xp, int idx)
|
||||
return cmdnames[idx].cmd_name;
|
||||
}
|
||||
|
||||
static int uc_add_command(char_u *name, size_t name_len, char_u *rep,
|
||||
long argt, long def, int flags, int compl,
|
||||
char_u *compl_arg,
|
||||
int force);
|
||||
static void uc_list(char_u *name, size_t name_len);
|
||||
static int uc_scan_attr(char_u *attr, size_t len, long *argt, long *def,
|
||||
int *flags, int *compl,
|
||||
char_u **compl_arg);
|
||||
static char_u *uc_split_args(char_u *arg, size_t *lenp);
|
||||
static size_t uc_check_code(char_u *code, size_t len, char_u *buf,
|
||||
ucmd_T *cmd, exarg_T *eap, char_u **split_buf,
|
||||
size_t *split_len);
|
||||
|
||||
static int uc_add_command(char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int force)
|
||||
{
|
||||
@ -6642,8 +6493,7 @@ static void ex_wincmd(exarg_T *eap)
|
||||
/*
|
||||
* ":winpos".
|
||||
*/
|
||||
static void ex_winpos(eap)
|
||||
exarg_T *eap;
|
||||
static void ex_winpos(exarg_T *eap)
|
||||
{
|
||||
int x, y;
|
||||
char_u *arg = eap->arg;
|
||||
@ -8012,15 +7862,6 @@ char_u *expand_sfile(char_u *arg)
|
||||
return result;
|
||||
}
|
||||
|
||||
static int ses_winsizes(FILE *fd, int restore_size, win_T *tab_firstwin);
|
||||
static int ses_win_rec(FILE *fd, frame_T *fr);
|
||||
static frame_T *ses_skipframe(frame_T *fr);
|
||||
static int ses_do_frame(frame_T *fr);
|
||||
static int ses_do_win(win_T *wp);
|
||||
static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname,
|
||||
unsigned *flagp);
|
||||
static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp);
|
||||
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp);
|
||||
|
||||
/*
|
||||
* Write openfile commands for the current buffers to an .exrc file.
|
||||
|
@ -1,69 +1,9 @@
|
||||
#ifndef NVIM_EX_DOCMD_H
|
||||
#define NVIM_EX_DOCMD_H
|
||||
/* ex_docmd.c */
|
||||
void do_exmode(int improved);
|
||||
int do_cmdline_cmd(char_u *cmd);
|
||||
int do_cmdline(char_u *cmdline, char_u *
|
||||
(*fgetline)(int, void *, int), void *cookie,
|
||||
int flags);
|
||||
int getline_equal(char_u *
|
||||
(*fgetline)(int, void *, int), void *cookie, char_u *
|
||||
(*func)(int, void *, int));
|
||||
void *getline_cookie(char_u *(*fgetline)(int, void *, int), void *cookie);
|
||||
int checkforcmd(char_u **pp, char *cmd, int len);
|
||||
int modifier_len(char_u *cmd);
|
||||
int cmd_exists(char_u *name);
|
||||
char_u *set_one_cmd_context(expand_T *xp, char_u *buff);
|
||||
char_u *skip_range(char_u *cmd, int *ctx);
|
||||
void ex_ni(exarg_T *eap);
|
||||
int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp);
|
||||
void separate_nextcmd(exarg_T *eap);
|
||||
int ends_excmd(int c);
|
||||
char_u *find_nextcmd(char_u *p);
|
||||
char_u *check_nextcmd(char_u *p);
|
||||
char_u *get_command_name(expand_T *xp, int idx);
|
||||
void ex_comclear(exarg_T *eap);
|
||||
void ex_may_print(exarg_T *eap);
|
||||
void uc_clear(garray_T *gap);
|
||||
char_u *get_user_commands(expand_T *xp, int idx);
|
||||
char_u *get_user_cmd_flags(expand_T *xp, int idx);
|
||||
char_u *get_user_cmd_nargs(expand_T *xp, int idx);
|
||||
char_u *get_user_cmd_complete(expand_T *xp, int idx);
|
||||
int parse_compl_arg(char_u *value, int vallen, int *complp, long *argt,
|
||||
char_u **compl_arg);
|
||||
void not_exiting(void);
|
||||
void tabpage_close(int forceit);
|
||||
void tabpage_close_other(tabpage_T *tp, int forceit);
|
||||
void ex_all(exarg_T *eap);
|
||||
void alist_clear(alist_T *al);
|
||||
void alist_init(alist_T *al);
|
||||
void alist_unlink(alist_T *al);
|
||||
void alist_new(void);
|
||||
void alist_expand(int *fnum_list, int fnum_len);
|
||||
void alist_set(alist_T *al, int count, char_u **files, int use_curbuf,
|
||||
int *fnum_list,
|
||||
int fnum_len);
|
||||
void alist_add(alist_T *al, char_u *fname, int set_fnum);
|
||||
void alist_slash_adjust(void);
|
||||
void ex_splitview(exarg_T *eap);
|
||||
void tabpage_new(void);
|
||||
void do_exedit(exarg_T *eap, win_T *old_curwin);
|
||||
void free_cd_dir(void);
|
||||
void post_chdir(int local);
|
||||
void ex_cd(exarg_T *eap);
|
||||
void do_sleep(long msec);
|
||||
int vim_mkdir_emsg(char_u *name, int prot);
|
||||
FILE *open_exfile(char_u *fname, int forceit, char *mode);
|
||||
void update_topline_cursor(void);
|
||||
void exec_normal_cmd(char_u *cmd, int remap, int silent);
|
||||
int find_cmdline_var(char_u *src, int *usedlen);
|
||||
char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen,
|
||||
linenr_T *lnump, char_u **errormsg,
|
||||
int *escaped);
|
||||
char_u *expand_sfile(char_u *arg);
|
||||
int put_eol(FILE *fd);
|
||||
int put_line(FILE *fd, char *s);
|
||||
void dialog_msg(char_u *buff, char *format, char_u *fname);
|
||||
char_u *get_behave_arg(expand_T *xp, int idx);
|
||||
|
||||
#endif /* NVIM_EX_DOCMD_H */
|
||||
typedef char_u *(*LineGetter)(int, void *, int);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_docmd.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_EX_DOCMD_H
|
||||
|
@ -23,10 +23,10 @@
|
||||
#include "nvim/strings.h"
|
||||
|
||||
|
||||
static void free_msglist(struct msglist *l);
|
||||
static int throw_exception(void *, int, char_u *);
|
||||
static char_u *get_end_emsg(struct condstack *cstack);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_eval.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* Exception handling terms:
|
||||
*
|
||||
@ -66,10 +66,6 @@ static char_u *get_end_emsg(struct condstack *cstack);
|
||||
# define THROW_ON_INTERRUPT TRUE
|
||||
# define THROW_ON_INTERRUPT_TRUE
|
||||
|
||||
static void catch_exception(except_T *excp);
|
||||
static void finish_exception(except_T *excp);
|
||||
static void discard_exception(except_T *excp, int was_finished);
|
||||
static void report_pending(int action, int pending, void *value);
|
||||
|
||||
/*
|
||||
* When several errors appear in a row, setting "force_abort" is delayed until
|
||||
|
@ -118,42 +118,7 @@ struct cleanup_stuff {
|
||||
except_T *exception; /* exception value */
|
||||
};
|
||||
|
||||
/* ex_eval.c */
|
||||
int aborting(void);
|
||||
void update_force_abort(void);
|
||||
int should_abort(int retcode);
|
||||
int aborted_in_try(void);
|
||||
int cause_errthrow(char_u *mesg, int severe, int *ignore);
|
||||
void free_global_msglist(void);
|
||||
void do_errthrow(struct condstack *cstack, char_u *cmdname);
|
||||
int do_intthrow(struct condstack *cstack);
|
||||
char_u *get_exception_string(void *value, int type, char_u *cmdname,
|
||||
int *should_free);
|
||||
void discard_current_exception(void);
|
||||
void report_make_pending(int pending, void *value);
|
||||
void report_resume_pending(int pending, void *value);
|
||||
void report_discard_pending(int pending, void *value);
|
||||
void ex_if(exarg_T *eap);
|
||||
void ex_endif(exarg_T *eap);
|
||||
void ex_else(exarg_T *eap);
|
||||
void ex_while(exarg_T *eap);
|
||||
void ex_continue(exarg_T *eap);
|
||||
void ex_break(exarg_T *eap);
|
||||
void ex_endwhile(exarg_T *eap);
|
||||
void ex_throw(exarg_T *eap);
|
||||
void do_throw(struct condstack *cstack);
|
||||
void ex_try(exarg_T *eap);
|
||||
void ex_catch(exarg_T *eap);
|
||||
void ex_finally(exarg_T *eap);
|
||||
void ex_endtry(exarg_T *eap);
|
||||
void enter_cleanup(cleanup_T *csp);
|
||||
void leave_cleanup(cleanup_T *csp);
|
||||
int cleanup_conditionals(struct condstack *cstack, int searched_cond,
|
||||
int inclusive);
|
||||
void rewind_conditionals(struct condstack *cstack, int idx,
|
||||
int cond_type,
|
||||
int *cond_level);
|
||||
void ex_endfunction(exarg_T *eap);
|
||||
int has_loop_cmd(char_u *p);
|
||||
|
||||
#endif /* NVIM_EX_EVAL_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_eval.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_EX_EVAL_H
|
||||
|
@ -99,56 +99,26 @@ typedef struct hist_entry {
|
||||
char_u *hisstr; /* actual entry, separator char after the NUL */
|
||||
} histentry_T;
|
||||
|
||||
/*
|
||||
* Type used by call_user_expand_func
|
||||
*/
|
||||
typedef void *(*user_expand_func_T)(char_u *, int, char_u **, int);
|
||||
|
||||
static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL};
|
||||
static int hisidx[HIST_COUNT] = {-1, -1, -1, -1, -1}; /* lastused entry */
|
||||
static int hisnum[HIST_COUNT] = {0, 0, 0, 0, 0};
|
||||
/* identifying (unique) number of newest history entry */
|
||||
static int hislen = 0; /* actual length of history tables */
|
||||
|
||||
static int hist_char2type(int c);
|
||||
|
||||
static int in_history(int, char_u *, int, int, int);
|
||||
static int calc_hist_idx(int histype, int num);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_getln.c.generated.h"
|
||||
#endif
|
||||
|
||||
static int cmd_hkmap = 0; /* Hebrew mapping during command line */
|
||||
|
||||
static int cmd_fkmap = 0; /* Farsi mapping during command line */
|
||||
|
||||
static int cmdline_charsize(int idx);
|
||||
static void set_cmdspos(void);
|
||||
static void set_cmdspos_cursor(void);
|
||||
static void correct_cmdspos(int idx, int cells);
|
||||
static void alloc_cmdbuff(int len);
|
||||
static void realloc_cmdbuff(int len);
|
||||
static void draw_cmdline(int start, int len);
|
||||
static void save_cmdline(struct cmdline_info *ccp);
|
||||
static void restore_cmdline(struct cmdline_info *ccp);
|
||||
static int cmdline_paste(int regname, int literally, int remcr);
|
||||
static void cmdline_del(int from);
|
||||
static void redrawcmdprompt(void);
|
||||
static void cursorcmd(void);
|
||||
static int ccheck_abbr(int);
|
||||
static int nextwild(expand_T *xp, int type, int options, int escape);
|
||||
static void escape_fname(char_u **pp);
|
||||
static int showmatches(expand_T *xp, int wildmenu);
|
||||
static void set_expand_context(expand_T *xp);
|
||||
static int ExpandFromContext(expand_T *xp, char_u *, int *, char_u ***, int);
|
||||
static int expand_showtail(expand_T *xp);
|
||||
static int expand_shellcmd(char_u *filepat, int *num_file,
|
||||
char_u ***file,
|
||||
int flagsarg);
|
||||
static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file,
|
||||
char *dirname[]);
|
||||
static char_u *get_history_arg(expand_T *xp, int idx);
|
||||
static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch,
|
||||
int *num_file,
|
||||
char_u ***file);
|
||||
static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file);
|
||||
static void clear_hist_entry(histentry_T *hisptr);
|
||||
|
||||
static int ex_window(void);
|
||||
|
||||
static int sort_func_compare(const void *s1, const void *s2);
|
||||
|
||||
/*
|
||||
* getcmdline() - accept a command line starting with firstc.
|
||||
@ -3584,7 +3554,6 @@ expand_cmdline (
|
||||
/*
|
||||
* Cleanup matches for help tags: remove "@en" if "en" is the only language.
|
||||
*/
|
||||
static void cleanup_help_tags(int num_file, char_u **file);
|
||||
|
||||
static void cleanup_help_tags(int num_file, char_u **file)
|
||||
{
|
||||
@ -3797,14 +3766,14 @@ ExpandFromContext (
|
||||
*
|
||||
* Returns OK when no problems encountered, FAIL for error.
|
||||
*/
|
||||
int ExpandGeneric(xp, regmatch, num_file, file, func, escaped)
|
||||
expand_T *xp;
|
||||
regmatch_T *regmatch;
|
||||
int *num_file;
|
||||
char_u ***file;
|
||||
char_u *((*func)(expand_T *, int));
|
||||
/* returns a string from the list */
|
||||
int escaped;
|
||||
int ExpandGeneric(
|
||||
expand_T *xp,
|
||||
regmatch_T *regmatch,
|
||||
int *num_file,
|
||||
char_u ***file,
|
||||
CompleteListItemGetter func, /* returns a string from the list */
|
||||
int escaped
|
||||
)
|
||||
{
|
||||
int i;
|
||||
int count = 0;
|
||||
@ -3963,11 +3932,6 @@ expand_shellcmd (
|
||||
return OK;
|
||||
}
|
||||
|
||||
typedef void *(*user_expand_func_T)(char_u *, int, char_u **, int);
|
||||
static void * call_user_expand_func(user_expand_func_T user_expand_func,
|
||||
expand_T *xp, int *num_file,
|
||||
char_u ***file);
|
||||
|
||||
/*
|
||||
* Call "user_expand_func()" to invoke a user defined VimL function and return
|
||||
* the result (either a string or a List).
|
||||
@ -4483,7 +4447,6 @@ int get_history_idx(int histype)
|
||||
return history[histype][hisidx[histype]].hisnum;
|
||||
}
|
||||
|
||||
static struct cmdline_info *get_ccline_ptr(void);
|
||||
|
||||
/*
|
||||
* Get pointer to the command line info to use. cmdline_paste() may clear
|
||||
@ -4871,7 +4834,6 @@ static int viminfo_hisidx[HIST_COUNT] = {0, 0, 0, 0};
|
||||
static int viminfo_hislen[HIST_COUNT] = {0, 0, 0, 0};
|
||||
static int viminfo_add_at_front = FALSE;
|
||||
|
||||
static int hist_type2char(int type, int use_question);
|
||||
|
||||
/*
|
||||
* Translate a history type number to the associated character.
|
||||
|
@ -1,66 +1,11 @@
|
||||
#ifndef NVIM_EX_GETLN_H
|
||||
#define NVIM_EX_GETLN_H
|
||||
/* ex_getln.c */
|
||||
char_u *getcmdline(int firstc, long count, int indent);
|
||||
char_u *getcmdline_prompt(int firstc, char_u *prompt, int attr,
|
||||
int xp_context,
|
||||
char_u *xp_arg);
|
||||
int text_locked(void);
|
||||
void text_locked_msg(void);
|
||||
int curbuf_locked(void);
|
||||
int allbuf_locked(void);
|
||||
char_u *getexline(int c, void *cookie, int indent);
|
||||
char_u *getexmodeline(int promptc, void *cookie, int indent);
|
||||
void free_cmdline_buf(void);
|
||||
void putcmdline(int c, int shift);
|
||||
void unputcmdline(void);
|
||||
void put_on_cmdline(char_u *str, int len, int redraw);
|
||||
char_u *save_cmdline_alloc(void);
|
||||
void restore_cmdline_alloc(char_u *p);
|
||||
void cmdline_paste_str(char_u *s, int literally);
|
||||
void redrawcmdline(void);
|
||||
void redrawcmd(void);
|
||||
void compute_cmdrow(void);
|
||||
void gotocmdline(int clr);
|
||||
char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options,
|
||||
int mode);
|
||||
void ExpandInit(expand_T *xp);
|
||||
void ExpandCleanup(expand_T *xp);
|
||||
void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u *
|
||||
*files,
|
||||
int options);
|
||||
char_u *vim_strsave_fnameescape(char_u *fname, int shell);
|
||||
void tilde_replace(char_u *orig_pat, int num_files, char_u **files);
|
||||
char_u *sm_gettail(char_u *s);
|
||||
char_u *addstar(char_u *fname, int len, int context);
|
||||
void set_cmd_context(expand_T *xp, char_u *str, int len, int col);
|
||||
int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount,
|
||||
char_u ***matches);
|
||||
int ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file,
|
||||
char_u ***file, char_u *((*func)(expand_T *, int)),
|
||||
int escaped);
|
||||
char_u *globpath(char_u *path, char_u *file, int expand_options);
|
||||
void init_history(void);
|
||||
int get_histtype(char_u *name);
|
||||
void add_to_history(int histype, char_u *new_entry, int in_map, int sep);
|
||||
int get_history_idx(int histype);
|
||||
char_u *get_cmdline_str(void);
|
||||
int get_cmdline_pos(void);
|
||||
int set_cmdline_pos(int pos);
|
||||
int get_cmdline_type(void);
|
||||
char_u *get_history_entry(int histype, int idx);
|
||||
int clr_history(int histype);
|
||||
int del_history_entry(int histype, char_u *str);
|
||||
int del_history_idx(int histype, int idx);
|
||||
void remove_key_from_history(void);
|
||||
int get_list_range(char_u **str, int *num1, int *num2);
|
||||
void ex_history(exarg_T *eap);
|
||||
void prepare_viminfo_history(int asklen, int writing);
|
||||
int read_viminfo_history(vir_T *virp, int writing);
|
||||
void finish_viminfo_history(void);
|
||||
void write_viminfo_history(FILE *fp, int merge);
|
||||
void cmd_pchar(int c, int offset);
|
||||
int cmd_gchar(int offset);
|
||||
char_u *script_get(exarg_T *eap, char_u *cmd);
|
||||
|
||||
#endif /* NVIM_EX_GETLN_H */
|
||||
#include "nvim/ex_cmds.h"
|
||||
|
||||
typedef char_u *(*CompleteListItemGetter)(expand_T *, int);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ex_getln.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_EX_GETLN_H
|
||||
|
@ -54,27 +54,10 @@ const char_u farsi_text_5[] = {
|
||||
' ', YE_, _SIN, RE, ALEF_, _FE, '\0'
|
||||
};
|
||||
|
||||
static int toF_Xor_X_(int c);
|
||||
static int F_is_TyE(int c);
|
||||
static int F_is_TyC_TyD(int c);
|
||||
static int F_is_TyB_TyC_TyD(int src, int offset);
|
||||
static int toF_TyB(int c);
|
||||
static void put_curr_and_l_to_X(int c);
|
||||
static void put_and_redo(int c);
|
||||
static void chg_c_toX_orX(void);
|
||||
static void chg_c_to_X_orX_(void);
|
||||
static void chg_c_to_X_or_X(void);
|
||||
static void chg_l_to_X_orX_(void);
|
||||
static void chg_l_toXor_X(void);
|
||||
static void chg_r_to_Xor_X_(void);
|
||||
static int toF_leading(int c);
|
||||
static int toF_Rjoin(int c);
|
||||
static int canF_Ljoin(int c);
|
||||
static int canF_Rjoin(int c);
|
||||
static int F_isterm(int c);
|
||||
static int toF_ending(int c);
|
||||
static void lrswapbuf(char_u *buf, int len);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "farsi.c.generated.h"
|
||||
#endif
|
||||
/// Convert the given Farsi character into a _X or _X_ type
|
||||
///
|
||||
/// @param c The character to convert.
|
||||
|
@ -167,17 +167,8 @@ extern const char_u farsi_text_2[];
|
||||
extern const char_u farsi_text_3[];
|
||||
extern const char_u farsi_text_5[];
|
||||
|
||||
int toF_TyA(int c);
|
||||
int fkmap(int c);
|
||||
void conv_to_pvim(void);
|
||||
void conv_to_pstd(void);
|
||||
char_u *lrswap(char_u *ibuf);
|
||||
char_u *lrFswap(char_u *cmdbuf, int len);
|
||||
char_u *lrF_sub(char_u *ibuf);
|
||||
int cmdl_fkmap(int c);
|
||||
int F_isalpha(int c);
|
||||
int F_isdigit(int c);
|
||||
int F_ischar(int c);
|
||||
void farsi_fkey(cmdarg_T *cap);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "farsi.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_FARSI_H
|
||||
|
@ -185,20 +185,10 @@ typedef struct ff_search_ctx_T {
|
||||
} ff_search_ctx_T;
|
||||
|
||||
/* locally needed functions */
|
||||
static int ff_check_visited(ff_visited_T **, char_u *, char_u *);
|
||||
static void vim_findfile_free_visited_list
|
||||
(ff_visited_list_hdr_T **list_headp);
|
||||
static void ff_free_visited_list(ff_visited_T *vl);
|
||||
static ff_visited_list_hdr_T* ff_get_visited_list
|
||||
(char_u *, ff_visited_list_hdr_T **list_headp);
|
||||
static int ff_wc_equal(char_u *s1, char_u *s2);
|
||||
|
||||
static void ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr);
|
||||
static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx);
|
||||
static void ff_clear(ff_search_ctx_T *search_ctx);
|
||||
static void ff_free_stack_element(ff_stack_T *stack_ptr);
|
||||
static ff_stack_T *ff_create_stack_element(char_u *, char_u *, int, int);
|
||||
static int ff_path_in_stoplist(char_u *, int, char_u **);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "file_search.c.generated.h"
|
||||
#endif
|
||||
|
||||
static char_u e_pathtoolong[] = N_("E854: path too long for completion");
|
||||
|
||||
|
@ -1,23 +1,7 @@
|
||||
#ifndef NVIM_FILE_SEARCH_H
|
||||
#define NVIM_FILE_SEARCH_H
|
||||
|
||||
void *vim_findfile_init(char_u *path, char_u *filename, char_u *
|
||||
stopdirs, int level, int free_visited,
|
||||
int find_what, void *search_ctx_arg,
|
||||
int tagfile,
|
||||
char_u *rel_fname);
|
||||
char_u *vim_findfile_stopdir(char_u *buf);
|
||||
void vim_findfile_cleanup(void *ctx);
|
||||
char_u *vim_findfile(void *search_ctx_arg);
|
||||
void vim_findfile_free_visited(void *search_ctx_arg);
|
||||
char_u *find_file_in_path(char_u *ptr, int len, int options, int first,
|
||||
char_u *rel_fname);
|
||||
void free_findfile(void);
|
||||
char_u *find_directory_in_path(char_u *ptr, int len, int options,
|
||||
char_u *rel_fname);
|
||||
char_u *find_file_in_path_option(char_u *ptr, int len, int options,
|
||||
int first, char_u *path_option,
|
||||
int find_what, char_u *rel_fname,
|
||||
char_u *suffixes);
|
||||
|
||||
#endif /* NVIM_FILE_SEARCH_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "file_search.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_FILE_SEARCH_H
|
||||
|
@ -58,37 +58,89 @@
|
||||
#define BUFSIZE 8192 /* size of normal write buffer */
|
||||
#define SMBUFSIZE 256 /* size of emergency write buffer */
|
||||
|
||||
static char_u *next_fenc(char_u **pp);
|
||||
static char_u *readfile_charconvert(char_u *fname, char_u *fenc,
|
||||
int *fdp);
|
||||
static void check_marks_read(void);
|
||||
#ifdef UNIX
|
||||
static void set_file_time(char_u *fname, time_t atime, time_t mtime);
|
||||
#endif
|
||||
static int set_rw_fname(char_u *fname, char_u *sfname);
|
||||
static int msg_add_fileformat(int eol_type);
|
||||
static void msg_add_eol(void);
|
||||
static int check_mtime(buf_T *buf, FileInfo *file_info);
|
||||
static int time_differs(long t1, long t2);
|
||||
static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io,
|
||||
int force, buf_T *buf,
|
||||
exarg_T *eap);
|
||||
static int au_find_group(char_u *name);
|
||||
/*
|
||||
* The autocommands are stored in a list for each event.
|
||||
* Autocommands for the same pattern, that are consecutive, are joined
|
||||
* together, to avoid having to match the pattern too often.
|
||||
* The result is an array of Autopat lists, which point to AutoCmd lists:
|
||||
*
|
||||
* first_autopat[0] --> Autopat.next --> Autopat.next --> NULL
|
||||
* Autopat.cmds Autopat.cmds
|
||||
* | |
|
||||
* V V
|
||||
* AutoCmd.next AutoCmd.next
|
||||
* | |
|
||||
* V V
|
||||
* AutoCmd.next NULL
|
||||
* |
|
||||
* V
|
||||
* NULL
|
||||
*
|
||||
* first_autopat[1] --> Autopat.next --> NULL
|
||||
* Autopat.cmds
|
||||
* |
|
||||
* V
|
||||
* AutoCmd.next
|
||||
* |
|
||||
* V
|
||||
* NULL
|
||||
* etc.
|
||||
*
|
||||
* The order of AutoCmds is important, this is the order in which they were
|
||||
* defined and will have to be executed.
|
||||
*/
|
||||
typedef struct AutoCmd {
|
||||
char_u *cmd; /* The command to be executed (NULL
|
||||
when command has been removed) */
|
||||
char nested; /* If autocommands nest here */
|
||||
char last; /* last command in list */
|
||||
scid_T scriptID; /* script ID where defined */
|
||||
struct AutoCmd *next; /* Next AutoCmd in list */
|
||||
} AutoCmd;
|
||||
|
||||
# define AUGROUP_DEFAULT -1 /* default autocmd group */
|
||||
# define AUGROUP_ERROR -2 /* erroneous autocmd group */
|
||||
# define AUGROUP_ALL -3 /* all autocmd groups */
|
||||
typedef struct AutoPat {
|
||||
char_u *pat; /* pattern as typed (NULL when pattern
|
||||
has been removed) */
|
||||
regprog_T *reg_prog; /* compiled regprog for pattern */
|
||||
AutoCmd *cmds; /* list of commands to do */
|
||||
struct AutoPat *next; /* next AutoPat in AutoPat list */
|
||||
int group; /* group ID */
|
||||
int patlen; /* strlen() of pat */
|
||||
int buflocal_nr; /* !=0 for buffer-local AutoPat */
|
||||
char allow_dirs; /* Pattern may match whole path */
|
||||
char last; /* last pattern for apply_autocmds() */
|
||||
} AutoPat;
|
||||
|
||||
# define HAS_BW_FLAGS
|
||||
# define FIO_LATIN1 0x01 /* convert Latin1 */
|
||||
# define FIO_UTF8 0x02 /* convert UTF-8 */
|
||||
# define FIO_UCS2 0x04 /* convert UCS-2 */
|
||||
# define FIO_UCS4 0x08 /* convert UCS-4 */
|
||||
# define FIO_UTF16 0x10 /* convert UTF-16 */
|
||||
# define FIO_ENDIAN_L 0x80 /* little endian */
|
||||
# define FIO_NOCONVERT 0x2000 /* skip encoding conversion */
|
||||
# define FIO_UCSBOM 0x4000 /* check for BOM at start of file */
|
||||
# define FIO_ALL -1 /* allow all formats */
|
||||
/*
|
||||
* struct used to keep status while executing autocommands for an event.
|
||||
*/
|
||||
typedef struct AutoPatCmd {
|
||||
AutoPat *curpat; /* next AutoPat to examine */
|
||||
AutoCmd *nextcmd; /* next AutoCmd to execute */
|
||||
int group; /* group being used */
|
||||
char_u *fname; /* fname to match with */
|
||||
char_u *sfname; /* sfname to match with */
|
||||
char_u *tail; /* tail of fname */
|
||||
event_T event; /* current event */
|
||||
int arg_bufnr; /* initially equal to <abuf>, set to zero when
|
||||
buf is deleted */
|
||||
struct AutoPatCmd *next; /* chain of active apc-s for auto-invalidation*/
|
||||
} AutoPatCmd;
|
||||
|
||||
#define AUGROUP_DEFAULT -1 /* default autocmd group */
|
||||
#define AUGROUP_ERROR -2 /* erroneous autocmd group */
|
||||
#define AUGROUP_ALL -3 /* all autocmd groups */
|
||||
|
||||
#define HAS_BW_FLAGS
|
||||
#define FIO_LATIN1 0x01 /* convert Latin1 */
|
||||
#define FIO_UTF8 0x02 /* convert UTF-8 */
|
||||
#define FIO_UCS2 0x04 /* convert UCS-2 */
|
||||
#define FIO_UCS4 0x08 /* convert UCS-4 */
|
||||
#define FIO_UTF16 0x10 /* convert UTF-16 */
|
||||
#define FIO_ENDIAN_L 0x80 /* little endian */
|
||||
#define FIO_NOCONVERT 0x2000 /* skip encoding conversion */
|
||||
#define FIO_UCSBOM 0x4000 /* check for BOM at start of file */
|
||||
#define FIO_ALL -1 /* allow all formats */
|
||||
|
||||
/* When converting, a read() or write() may leave some bytes to be converted
|
||||
* for the next call. The value is guessed... */
|
||||
@ -121,19 +173,14 @@ struct bw_info {
|
||||
# endif
|
||||
};
|
||||
|
||||
static int buf_write_bytes(struct bw_info *ip);
|
||||
|
||||
static linenr_T readfile_linenr(linenr_T linecnt, char_u *p,
|
||||
char_u *endp);
|
||||
static int ucs2bytes(unsigned c, char_u **pp, int flags);
|
||||
static int need_conversion(char_u *fenc);
|
||||
static int get_fio_flags(char_u *ptr);
|
||||
static char_u *check_for_bom(char_u *p, long size, int *lenp, int flags);
|
||||
static int make_bom(char_u *buf, char_u *name);
|
||||
static int move_lines(buf_T *frombuf, buf_T *tobuf);
|
||||
#ifdef TEMPDIRNAMES
|
||||
static void vim_settempdir(char_u *tempdir);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "fileio.c.generated.h"
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#endif
|
||||
|
||||
|
||||
static char *e_auchangedbuf = N_(
|
||||
"E812: Autocommands changed buffer or buffer name");
|
||||
|
||||
@ -5364,59 +5411,6 @@ void forward_slash(char_u *fname)
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The autocommands are stored in a list for each event.
|
||||
* Autocommands for the same pattern, that are consecutive, are joined
|
||||
* together, to avoid having to match the pattern too often.
|
||||
* The result is an array of Autopat lists, which point to AutoCmd lists:
|
||||
*
|
||||
* first_autopat[0] --> Autopat.next --> Autopat.next --> NULL
|
||||
* Autopat.cmds Autopat.cmds
|
||||
* | |
|
||||
* V V
|
||||
* AutoCmd.next AutoCmd.next
|
||||
* | |
|
||||
* V V
|
||||
* AutoCmd.next NULL
|
||||
* |
|
||||
* V
|
||||
* NULL
|
||||
*
|
||||
* first_autopat[1] --> Autopat.next --> NULL
|
||||
* Autopat.cmds
|
||||
* |
|
||||
* V
|
||||
* AutoCmd.next
|
||||
* |
|
||||
* V
|
||||
* NULL
|
||||
* etc.
|
||||
*
|
||||
* The order of AutoCmds is important, this is the order in which they were
|
||||
* defined and will have to be executed.
|
||||
*/
|
||||
typedef struct AutoCmd {
|
||||
char_u *cmd; /* The command to be executed (NULL
|
||||
when command has been removed) */
|
||||
char nested; /* If autocommands nest here */
|
||||
char last; /* last command in list */
|
||||
scid_T scriptID; /* script ID where defined */
|
||||
struct AutoCmd *next; /* Next AutoCmd in list */
|
||||
} AutoCmd;
|
||||
|
||||
typedef struct AutoPat {
|
||||
char_u *pat; /* pattern as typed (NULL when pattern
|
||||
has been removed) */
|
||||
regprog_T *reg_prog; /* compiled regprog for pattern */
|
||||
AutoCmd *cmds; /* list of commands to do */
|
||||
struct AutoPat *next; /* next AutoPat in AutoPat list */
|
||||
int group; /* group ID */
|
||||
int patlen; /* strlen() of pat */
|
||||
int buflocal_nr; /* !=0 for buffer-local AutoPat */
|
||||
char allow_dirs; /* Pattern may match whole path */
|
||||
char last; /* last pattern for apply_autocmds() */
|
||||
} AutoPat;
|
||||
|
||||
static struct event_name {
|
||||
char *name; /* event name */
|
||||
event_T event; /* event number */
|
||||
@ -5522,22 +5516,6 @@ static AutoPat *first_autopat[NUM_EVENTS] =
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* struct used to keep status while executing autocommands for an event.
|
||||
*/
|
||||
typedef struct AutoPatCmd {
|
||||
AutoPat *curpat; /* next AutoPat to examine */
|
||||
AutoCmd *nextcmd; /* next AutoCmd to execute */
|
||||
int group; /* group being used */
|
||||
char_u *fname; /* fname to match with */
|
||||
char_u *sfname; /* sfname to match with */
|
||||
char_u *tail; /* tail of fname */
|
||||
event_T event; /* current event */
|
||||
int arg_bufnr; /* initially equal to <abuf>, set to zero when
|
||||
buf is deleted */
|
||||
struct AutoPatCmd *next; /* chain of active apc-s for auto-invalidation*/
|
||||
} AutoPatCmd;
|
||||
|
||||
static AutoPatCmd *active_apc_list = NULL; /* stack of active autocommands */
|
||||
|
||||
/*
|
||||
@ -5553,24 +5531,6 @@ static int current_augroup = AUGROUP_DEFAULT;
|
||||
|
||||
static int au_need_clean = FALSE; /* need to delete marked patterns */
|
||||
|
||||
static void show_autocmd(AutoPat *ap, event_T event);
|
||||
static void au_remove_pat(AutoPat *ap);
|
||||
static void au_remove_cmds(AutoPat *ap);
|
||||
static void au_cleanup(void);
|
||||
static int au_new_group(char_u *name);
|
||||
static void au_del_group(char_u *name);
|
||||
static event_T event_name2nr(char_u *start, char_u **end);
|
||||
static char_u *event_nr2name(event_T event);
|
||||
static char_u *find_end_event(char_u *arg, int have_group);
|
||||
static int event_ignored(event_T event);
|
||||
static int au_get_grouparg(char_u **argp);
|
||||
static int do_autocmd_event(event_T event, char_u *pat, int nested,
|
||||
char_u *cmd, int forceit,
|
||||
int group);
|
||||
static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
|
||||
int force, int group, buf_T *buf,
|
||||
exarg_T *eap);
|
||||
static void auto_next_pat(AutoPatCmd *apc, int stop_at_last);
|
||||
|
||||
|
||||
static event_T last_event;
|
||||
@ -7803,10 +7763,7 @@ file_pat_to_reg_pat (
|
||||
* Version of read() that retries when interrupted by EINTR (possibly
|
||||
* by a SIGWINCH).
|
||||
*/
|
||||
long read_eintr(fd, buf, bufsize)
|
||||
int fd;
|
||||
void *buf;
|
||||
size_t bufsize;
|
||||
long read_eintr(int fd, void *buf, size_t bufsize)
|
||||
{
|
||||
long ret;
|
||||
|
||||
@ -7822,10 +7779,7 @@ size_t bufsize;
|
||||
* Version of write() that retries when interrupted by EINTR (possibly
|
||||
* by a SIGWINCH).
|
||||
*/
|
||||
long write_eintr(fd, buf, bufsize)
|
||||
int fd;
|
||||
void *buf;
|
||||
size_t bufsize;
|
||||
long write_eintr(int fd, void *buf, size_t bufsize)
|
||||
{
|
||||
long ret = 0;
|
||||
long wlen;
|
||||
|
@ -17,76 +17,7 @@ typedef struct {
|
||||
char_u *globaldir; /* saved value of globaldir */
|
||||
} aco_save_T;
|
||||
|
||||
/* fileio.c */
|
||||
void filemess(buf_T *buf, char_u *name, char_u *s, int attr);
|
||||
int readfile(char_u *fname, char_u *sfname, linenr_T from,
|
||||
linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap,
|
||||
int flags);
|
||||
void prep_exarg(exarg_T *eap, buf_T *buf);
|
||||
void set_file_options(int set_options, exarg_T *eap);
|
||||
void set_forced_fenc(exarg_T *eap);
|
||||
int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start,
|
||||
linenr_T end, exarg_T *eap, int append, int forceit,
|
||||
int reset_changed,
|
||||
int filtering);
|
||||
void msg_add_fname(buf_T *buf, char_u *fname);
|
||||
void msg_add_lines(int insert_space, long lnum, off_t nchars);
|
||||
void shorten_fnames(int force);
|
||||
char_u *modname(char_u *fname, char_u *ext, int prepend_dot);
|
||||
int vim_fgets(char_u *buf, int size, FILE *fp);
|
||||
int tag_fgets(char_u *buf, int size, FILE *fp);
|
||||
int vim_rename(char_u *from, char_u *to);
|
||||
int check_timestamps(int focus);
|
||||
int buf_check_timestamp(buf_T *buf, int focus);
|
||||
void buf_reload(buf_T *buf, int orig_mode);
|
||||
void buf_store_file_info(buf_T *buf, FileInfo *file_info);
|
||||
void write_lnum_adjust(linenr_T offset);
|
||||
void vim_deltempdir(void);
|
||||
char_u *vim_tempname(int extra_char);
|
||||
void forward_slash(char_u *fname);
|
||||
void aubuflocal_remove(buf_T *buf);
|
||||
int au_has_group(char_u *name);
|
||||
void do_augroup(char_u *arg, int del_group);
|
||||
void free_all_autocmds(void);
|
||||
int check_ei(void);
|
||||
char_u *au_event_disable(char *what);
|
||||
void au_event_restore(char_u *old_ei);
|
||||
void do_autocmd(char_u *arg, int forceit);
|
||||
int do_doautocmd(char_u *arg, int do_msg);
|
||||
void ex_doautoall(exarg_T *eap);
|
||||
int check_nomodeline(char_u **argp);
|
||||
void aucmd_prepbuf(aco_save_T *aco, buf_T *buf);
|
||||
void aucmd_restbuf(aco_save_T *aco);
|
||||
int apply_autocmds(event_T event, char_u *fname, char_u *fname_io,
|
||||
int force,
|
||||
buf_T *buf);
|
||||
int apply_autocmds_retval(event_T event, char_u *fname, char_u *fname_io,
|
||||
int force, buf_T *buf,
|
||||
int *retval);
|
||||
int has_cursorhold(void);
|
||||
int trigger_cursorhold(void);
|
||||
int has_cursormoved(void);
|
||||
int has_cursormovedI(void);
|
||||
int has_textchanged(void);
|
||||
int has_textchangedI(void);
|
||||
int has_insertcharpre(void);
|
||||
void block_autocmds(void);
|
||||
void unblock_autocmds(void);
|
||||
char_u *getnextac(int c, void *cookie, int indent);
|
||||
int has_autocmd(event_T event, char_u *sfname, buf_T *buf);
|
||||
char_u *get_augroup_name(expand_T *xp, int idx);
|
||||
char_u *set_context_in_autocmd(expand_T *xp, char_u *arg, int doautocmd);
|
||||
char_u *get_event_name(expand_T *xp, int idx);
|
||||
int autocmd_supported(char_u *name);
|
||||
int au_exists(char_u *arg);
|
||||
int match_file_pat(char_u *pattern, regprog_T *prog, char_u *fname,
|
||||
char_u *sfname, char_u *tail,
|
||||
int allow_dirs);
|
||||
int match_file_list(char_u *list, char_u *sfname, char_u *ffname);
|
||||
char_u *file_pat_to_reg_pat(char_u *pat, char_u *pat_end,
|
||||
char *allow_dirs,
|
||||
int no_bslash);
|
||||
long read_eintr(int fd, void *buf, size_t bufsize);
|
||||
long write_eintr(int fd, void *buf, size_t bufsize);
|
||||
|
||||
#endif /* NVIM_FILEIO_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "fileio.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_FILEIO_H
|
||||
|
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".
|
||||
|
@ -13,53 +13,8 @@ typedef struct foldinfo {
|
||||
line */
|
||||
} foldinfo_T;
|
||||
|
||||
void copyFoldingState(win_T *wp_from, win_T *wp_to);
|
||||
int hasAnyFolding(win_T *win);
|
||||
int hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp);
|
||||
int hasFoldingWin(win_T *win, linenr_T lnum, linenr_T *firstp,
|
||||
linenr_T *lastp, int cache,
|
||||
foldinfo_T *infop);
|
||||
int foldLevel(linenr_T lnum);
|
||||
int lineFolded(win_T *win, linenr_T lnum);
|
||||
long foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop);
|
||||
int foldmethodIsManual(win_T *wp);
|
||||
int foldmethodIsIndent(win_T *wp);
|
||||
int foldmethodIsExpr(win_T *wp);
|
||||
int foldmethodIsMarker(win_T *wp);
|
||||
int foldmethodIsSyntax(win_T *wp);
|
||||
int foldmethodIsDiff(win_T *wp);
|
||||
void closeFold(linenr_T lnum, long count);
|
||||
void closeFoldRecurse(linenr_T lnum);
|
||||
void opFoldRange(linenr_T first, linenr_T last, int opening,
|
||||
int recurse,
|
||||
int had_visual);
|
||||
void openFold(linenr_T lnum, long count);
|
||||
void openFoldRecurse(linenr_T lnum);
|
||||
void foldOpenCursor(void);
|
||||
void newFoldLevel(void);
|
||||
void foldCheckClose(void);
|
||||
int foldManualAllowed(int create);
|
||||
void foldCreate(linenr_T start, linenr_T end);
|
||||
void deleteFold(linenr_T start, linenr_T end, int recursive,
|
||||
int had_visual);
|
||||
void clearFolding(win_T *win);
|
||||
void foldUpdate(win_T *wp, linenr_T top, linenr_T bot);
|
||||
void foldUpdateAll(win_T *win);
|
||||
int foldMoveTo(int updown, int dir, long count);
|
||||
void foldInitWin(win_T *new_win);
|
||||
int find_wl_entry(win_T *win, linenr_T lnum);
|
||||
void foldAdjustVisual(void);
|
||||
void foldAdjustCursor(void);
|
||||
void cloneFoldGrowArray(garray_T *from, garray_T *to);
|
||||
void deleteFoldRecurse(garray_T *gap);
|
||||
void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2,
|
||||
long amount,
|
||||
long amount_after);
|
||||
int getDeepestNesting(void);
|
||||
char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume,
|
||||
foldinfo_T *foldinfo,
|
||||
char_u *buf);
|
||||
void foldtext_cleanup(char_u *str);
|
||||
int put_folds(FILE *fd, win_T *wp);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "fold.h.generated.h"
|
||||
#endif
|
||||
#endif /* NVIM_FOLD_H */
|
||||
|
@ -1,5 +1,20 @@
|
||||
#ifndef NVIM_FUNC_ATTR_H
|
||||
#define NVIM_FUNC_ATTR_H
|
||||
// If DEFINE_FUNC_ATTRIBUTES macro is not defined then all function attributes
|
||||
// are defined as empty values.
|
||||
//
|
||||
// If DO_NOT_DEFINE_EMPTY_ATTRIBUTES then empty macros are not defined. Thus
|
||||
// undefined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES
|
||||
// leaves file with untouched FUNC_ATTR_* macros. This variant is used for
|
||||
// scripts/gendeclarations.lua.
|
||||
//
|
||||
// Empty macros are used for *.c files. (undefined DEFINE_FUNC_ATTRIBUTES and
|
||||
// undefined DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
|
||||
//
|
||||
// Macros defined as __attribute__((*)) are used by generated header files.
|
||||
// (defined DEFINE_FUNC_ATTRIBUTES and undefined
|
||||
// DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
|
||||
//
|
||||
// Defined DEFINE_FUNC_ATTRIBUTES and defined DO_NOT_DEFINE_EMPTY_ATTRIBUTES is
|
||||
// not used by anything.
|
||||
|
||||
// gcc and clang expose their version as follows:
|
||||
//
|
||||
@ -21,90 +36,140 @@
|
||||
// $ gcc -E -dM - </dev/null
|
||||
// $ echo | clang -dM -E -
|
||||
|
||||
#ifdef __GNUC__
|
||||
// place defines for all gnulikes here, for now that's gcc, clang and
|
||||
// intel.
|
||||
#ifdef FUNC_ATTR_MALLOC
|
||||
#undef FUNC_ATTR_MALLOC
|
||||
#endif
|
||||
|
||||
// place these after the argument list of the function declaration
|
||||
// (not definition), like so:
|
||||
// void myfunc(void) FUNC_ATTR_ALWAYS_INLINE;
|
||||
#define FUNC_ATTR_MALLOC __attribute__((malloc))
|
||||
#define FUNC_ATTR_ALLOC_ALIGN(x) __attribute__((alloc_align(x)))
|
||||
#define FUNC_ATTR_PURE __attribute__ ((pure))
|
||||
#define FUNC_ATTR_CONST __attribute__((const))
|
||||
#define FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#define FUNC_ATTR_ALWAYS_INLINE __attribute__((always_inline))
|
||||
#define FUNC_ATTR_UNUSED __attribute__((unused))
|
||||
#ifdef FUNC_ATTR_ALLOC_SIZE
|
||||
#undef FUNC_ATTR_ALLOC_SIZE
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
// clang only
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
// intel only
|
||||
#else
|
||||
#define GCC_VERSION \
|
||||
(__GNUC__ * 10000 + \
|
||||
__GNUC_MINOR__ * 100 + \
|
||||
__GNUC_PATCHLEVEL__)
|
||||
// gcc only
|
||||
#define FUNC_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||
#define FUNC_ATTR_ALLOC_SIZE_PROD(x,y) __attribute__((alloc_size(x,y)))
|
||||
#define FUNC_ATTR_NONNULL_ALL __attribute__((nonnull))
|
||||
#define FUNC_ATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#if GCC_VERSION >= 40900
|
||||
#define FUNC_ATTR_NONNULL_RET __attribute__((returns_nonnull))
|
||||
#ifdef FUNC_ATTR_ALLOC_SIZE_PROD
|
||||
#undef FUNC_ATTR_ALLOC_SIZE_PROD
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_ALLOC_ALIGN
|
||||
#undef FUNC_ATTR_ALLOC_ALIGN
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_PURE
|
||||
#undef FUNC_ATTR_PURE
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_CONST
|
||||
#undef FUNC_ATTR_CONST
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
#undef FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_ALWAYS_INLINE
|
||||
#undef FUNC_ATTR_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_UNUSED
|
||||
#undef FUNC_ATTR_UNUSED
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_NONNULL_ALL
|
||||
#undef FUNC_ATTR_NONNULL_ALL
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_NONNULL_ARG
|
||||
#undef FUNC_ATTR_NONNULL_ARG
|
||||
#endif
|
||||
|
||||
#ifdef FUNC_ATTR_NONNULL_RET
|
||||
#undef FUNC_ATTR_NONNULL_RET
|
||||
#endif
|
||||
|
||||
#ifdef DEFINE_FUNC_ATTRIBUTES
|
||||
#ifdef __GNUC__
|
||||
// place defines for all gnulikes here, for now that's gcc, clang and
|
||||
// intel.
|
||||
|
||||
// place these after the argument list of the function declaration
|
||||
// (not definition), like so:
|
||||
// void myfunc(void) FUNC_ATTR_ALWAYS_INLINE;
|
||||
#define FUNC_ATTR_MALLOC __attribute__((malloc))
|
||||
#define FUNC_ATTR_ALLOC_ALIGN(x) __attribute__((alloc_align(x)))
|
||||
#define FUNC_ATTR_PURE __attribute__ ((pure))
|
||||
#define FUNC_ATTR_CONST __attribute__((const))
|
||||
#define FUNC_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#define FUNC_ATTR_ALWAYS_INLINE __attribute__((always_inline))
|
||||
#define FUNC_ATTR_UNUSED __attribute__((unused))
|
||||
|
||||
#ifdef __clang__
|
||||
// clang only
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
// intel only
|
||||
#else
|
||||
#define GCC_VERSION \
|
||||
(__GNUC__ * 10000 + \
|
||||
__GNUC_MINOR__ * 100 + \
|
||||
__GNUC_PATCHLEVEL__)
|
||||
// gcc only
|
||||
#define FUNC_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
|
||||
#define FUNC_ATTR_ALLOC_SIZE_PROD(x,y) __attribute__((alloc_size(x,y)))
|
||||
#define FUNC_ATTR_NONNULL_ALL __attribute__((nonnull))
|
||||
#define FUNC_ATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#if GCC_VERSION >= 40900
|
||||
#define FUNC_ATTR_NONNULL_RET __attribute__((returns_nonnull))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// define function attributes that haven't been defined for this specific
|
||||
// compiler.
|
||||
#ifndef DO_NOT_DEFINE_EMPTY_ATTRIBUTES
|
||||
// define function attributes that haven't been defined for this specific
|
||||
// compiler.
|
||||
|
||||
#ifndef FUNC_ATTR_MALLOC
|
||||
#define FUNC_ATTR_MALLOC
|
||||
#ifndef FUNC_ATTR_MALLOC
|
||||
#define FUNC_ATTR_MALLOC
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALLOC_SIZE
|
||||
#define FUNC_ATTR_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALLOC_SIZE_PROD
|
||||
#define FUNC_ATTR_ALLOC_SIZE_PROD(x,y)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALLOC_ALIGN
|
||||
#define FUNC_ATTR_ALLOC_ALIGN(x)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_PURE
|
||||
#define FUNC_ATTR_PURE
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_CONST
|
||||
#define FUNC_ATTR_CONST
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
#define FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALWAYS_INLINE
|
||||
#define FUNC_ATTR_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_UNUSED
|
||||
#define FUNC_ATTR_UNUSED
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_NONNULL_ALL
|
||||
#define FUNC_ATTR_NONNULL_ALL
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_NONNULL_ARG
|
||||
#define FUNC_ATTR_NONNULL_ARG(...)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_NONNULL_RET
|
||||
#define FUNC_ATTR_NONNULL_RET
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALLOC_SIZE
|
||||
#define FUNC_ATTR_ALLOC_SIZE(x)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALLOC_SIZE_PROD
|
||||
#define FUNC_ATTR_ALLOC_SIZE_PROD(x,y)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALLOC_ALIGN
|
||||
#define FUNC_ATTR_ALLOC_ALIGN(x)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_PURE
|
||||
#define FUNC_ATTR_PURE
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_CONST
|
||||
#define FUNC_ATTR_CONST
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
#define FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_ALWAYS_INLINE
|
||||
#define FUNC_ATTR_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_UNUSED
|
||||
#define FUNC_ATTR_UNUSED
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_NONNULL_ALL
|
||||
#define FUNC_ATTR_NONNULL_ALL
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_NONNULL_ARG
|
||||
#define FUNC_ATTR_NONNULL_ARG(...)
|
||||
#endif
|
||||
|
||||
#ifndef FUNC_ATTR_NONNULL_RET
|
||||
#define FUNC_ATTR_NONNULL_RET
|
||||
#endif
|
||||
|
||||
#endif // NVIM_FUNC_ATTR_H
|
||||
|
@ -15,6 +15,10 @@
|
||||
// #include "nvim/globals.h"
|
||||
#include "nvim/memline.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "garray.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Clear an allocated growing array.
|
||||
void ga_clear(garray_T *gap)
|
||||
{
|
||||
@ -110,6 +114,7 @@ void ga_remove_duplicate_strings(garray_T *gap)
|
||||
///
|
||||
/// @returns the concatenated strings
|
||||
char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
const size_t nelem = (size_t) gap->ga_len;
|
||||
const char **strings = gap->ga_data;
|
||||
@ -143,7 +148,7 @@ char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
||||
/// @param gap
|
||||
///
|
||||
/// @returns the concatenated strings
|
||||
char_u* ga_concat_strings(const garray_T *gap)
|
||||
char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
return ga_concat_strings_sep(gap, ",");
|
||||
}
|
||||
@ -177,7 +182,7 @@ void ga_append(garray_T *gap, char c)
|
||||
gap->ga_len++;
|
||||
}
|
||||
|
||||
#if defined(UNIX) || defined(WIN3264)
|
||||
#if defined(UNIX) || defined(WIN3264) || defined(PROTO)
|
||||
|
||||
/// Append the text in "gap" below the cursor line and clear "gap".
|
||||
///
|
||||
|
@ -18,16 +18,7 @@ typedef struct growarray {
|
||||
|
||||
#define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0)
|
||||
|
||||
void ga_clear(garray_T *gap);
|
||||
void ga_clear_strings(garray_T *gap);
|
||||
void ga_init(garray_T *gap, int itemsize, int growsize);
|
||||
void ga_grow(garray_T *gap, int n);
|
||||
char_u *ga_concat_strings_sep(const garray_T *gap, const char *sep)
|
||||
FUNC_ATTR_NONNULL_RET;
|
||||
char_u *ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET;
|
||||
void ga_remove_duplicate_strings(garray_T *gap);
|
||||
void ga_concat(garray_T *gap, const char_u *restrict s);
|
||||
void ga_append(garray_T *gap, char c);
|
||||
void append_ga_line(garray_T *gap);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "garray.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_GARRAY_H
|
||||
|
@ -147,25 +147,9 @@ static char_u noremapbuf_init[TYPELEN_INIT]; /* initial typebuf.tb_noremap */
|
||||
|
||||
static int last_recorded_len = 0; /* number of last recorded chars */
|
||||
|
||||
static char_u *get_buffcont(buffheader_T *, int);
|
||||
static void add_buff(buffheader_T *, char_u *, long n);
|
||||
static void add_num_buff(buffheader_T *, long);
|
||||
static void add_char_buff(buffheader_T *, int);
|
||||
static int read_readbuffers(int advance);
|
||||
static int read_readbuf(buffheader_T *buf, int advance);
|
||||
static void start_stuff(void);
|
||||
static int read_redo(int, int);
|
||||
static void copy_redo(int);
|
||||
static void init_typebuf(void);
|
||||
static void gotchars(char_u *, int);
|
||||
static void may_sync_undo(void);
|
||||
static void closescript(void);
|
||||
static int vgetorpeek(int);
|
||||
static void map_free(mapblock_T **);
|
||||
static void validate_maphash(void);
|
||||
static void showmap(mapblock_T *mp, int local);
|
||||
static char_u *eval_map_expr(char_u *str, int c);
|
||||
static bool is_user_input(int k);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "getchar.c.generated.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Free and clear a buffer.
|
||||
|
@ -1,77 +1,7 @@
|
||||
#ifndef NVIM_GETCHAR_H
|
||||
#define NVIM_GETCHAR_H
|
||||
/* getchar.c */
|
||||
void free_buff(buffheader_T *buf);
|
||||
char_u *get_recorded(void);
|
||||
char_u *get_inserted(void);
|
||||
int stuff_empty(void);
|
||||
int readbuf1_empty(void);
|
||||
void typeahead_noflush(int c);
|
||||
void flush_buffers(int flush_typeahead);
|
||||
void ResetRedobuff(void);
|
||||
void CancelRedo(void);
|
||||
void saveRedobuff(void);
|
||||
void restoreRedobuff(void);
|
||||
void AppendToRedobuff(char_u *s);
|
||||
void AppendToRedobuffLit(char_u *str, int len);
|
||||
void AppendCharToRedobuff(int c);
|
||||
void AppendNumberToRedobuff(long n);
|
||||
void stuffReadbuff(char_u *s);
|
||||
void stuffReadbuffLen(char_u *s, long len);
|
||||
void stuffReadbuffSpec(char_u *s);
|
||||
void stuffcharReadbuff(int c);
|
||||
void stuffnumReadbuff(long n);
|
||||
int start_redo(long count, int old_redo);
|
||||
int start_redo_ins(void);
|
||||
void stop_redo_ins(void);
|
||||
int ins_typebuf(char_u *str, int noremap, int offset, int nottyped,
|
||||
int silent);
|
||||
void ins_char_typebuf(int c);
|
||||
int typebuf_changed(int tb_change_cnt);
|
||||
int typebuf_typed(void);
|
||||
int typebuf_maplen(void);
|
||||
void del_typebuf(int len, int offset);
|
||||
void alloc_typebuf(void);
|
||||
void free_typebuf(void);
|
||||
void save_typebuf(void);
|
||||
void save_typeahead(tasave_T *tp);
|
||||
void restore_typeahead(tasave_T *tp);
|
||||
void openscript(char_u *name, int directly);
|
||||
void close_all_scripts(void);
|
||||
int using_script(void);
|
||||
void before_blocking(void);
|
||||
void updatescript(int c);
|
||||
int vgetc(void);
|
||||
int safe_vgetc(void);
|
||||
int plain_vgetc(void);
|
||||
int vpeekc(void);
|
||||
int vpeekc_nomap(void);
|
||||
int vpeekc_any(void);
|
||||
int char_avail(void);
|
||||
void vungetc(int c);
|
||||
int inchar(char_u *buf, int maxlen, long wait_time, int tb_change_cnt);
|
||||
int fix_input_buffer(char_u *buf, int len, int script);
|
||||
int input_available(void);
|
||||
int do_map(int maptype, char_u *arg, int mode, int abbrev);
|
||||
int get_map_mode(char_u **cmdp, int forceit);
|
||||
void map_clear(char_u *cmdp, char_u *arg, int forceit, int abbr);
|
||||
void map_clear_int(buf_T *buf, int mode, int local, int abbr);
|
||||
char_u *map_mode_to_chars(int mode);
|
||||
int map_to_exists(char_u *str, char_u *modechars, int abbr);
|
||||
int map_to_exists_mode(char_u *rhs, int mode, int abbr);
|
||||
char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg,
|
||||
int forceit, int isabbrev, int isunmap,
|
||||
cmdidx_T cmdidx);
|
||||
int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file);
|
||||
int check_abbr(int c, char_u *ptr, int col, int mincol);
|
||||
char_u *vim_strsave_escape_csi(char_u *p);
|
||||
void vim_unescape_csi(char_u *p);
|
||||
int makemap(FILE *fd, buf_T *buf);
|
||||
int put_escstr(FILE *fd, char_u *strstart, int what);
|
||||
void check_map_keycodes(void);
|
||||
char_u *check_map(char_u *keys, int mode, int exact, int ign_mod,
|
||||
int abbr, mapblock_T **mp_ptr,
|
||||
int *local_ptr);
|
||||
void add_map(char_u *map, int mode);
|
||||
|
||||
#endif /* NVIM_GETCHAR_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "getchar.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_GETCHAR_H
|
||||
|
@ -173,23 +173,79 @@ typedef struct {
|
||||
int ff; /* seen form feed character */
|
||||
} prt_pos_T;
|
||||
|
||||
static char_u *parse_list_options(char_u *option_str,
|
||||
option_table_T *table,
|
||||
int table_size);
|
||||
struct prt_mediasize_S {
|
||||
char *name;
|
||||
float width; /* width and height in points for portrait */
|
||||
float height;
|
||||
};
|
||||
|
||||
static long_u darken_rgb(long_u rgb);
|
||||
static long_u prt_get_term_color(int colorindex);
|
||||
static void prt_set_fg(long_u fg);
|
||||
static void prt_set_bg(long_u bg);
|
||||
static void prt_set_font(int bold, int italic, int underline);
|
||||
static void prt_line_number(prt_settings_T *psettings, int page_line,
|
||||
linenr_T lnum);
|
||||
static void prt_header(prt_settings_T *psettings, int pagenum,
|
||||
linenr_T lnum);
|
||||
static void prt_message(char_u *s);
|
||||
static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line,
|
||||
prt_pos_T *ppos);
|
||||
static void prt_get_attr(int hl_id, prt_text_attr_T* pattr, int modec);
|
||||
/* PS font names, must be in Roman, Bold, Italic, Bold-Italic order */
|
||||
struct prt_ps_font_S {
|
||||
int wx;
|
||||
int uline_offset;
|
||||
int uline_width;
|
||||
int bbox_min_y;
|
||||
int bbox_max_y;
|
||||
char *(ps_fontname[4]);
|
||||
};
|
||||
|
||||
/* Structures to map user named encoding and mapping to PS equivalents for
|
||||
* building CID font name */
|
||||
struct prt_ps_encoding_S {
|
||||
char *encoding;
|
||||
char *cmap_encoding;
|
||||
int needs_charset;
|
||||
};
|
||||
|
||||
struct prt_ps_charset_S {
|
||||
char *charset;
|
||||
char *cmap_charset;
|
||||
int has_charset;
|
||||
};
|
||||
|
||||
/* Collections of encodings and charsets for multi-byte printing */
|
||||
struct prt_ps_mbfont_S {
|
||||
int num_encodings;
|
||||
struct prt_ps_encoding_S *encodings;
|
||||
int num_charsets;
|
||||
struct prt_ps_charset_S *charsets;
|
||||
char *ascii_enc;
|
||||
char *defcs;
|
||||
};
|
||||
|
||||
struct prt_ps_resource_S {
|
||||
char_u name[64];
|
||||
char_u filename[MAXPATHL + 1];
|
||||
int type;
|
||||
char_u title[256];
|
||||
char_u version[256];
|
||||
};
|
||||
|
||||
struct prt_dsc_comment_S {
|
||||
char *string;
|
||||
int len;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct prt_dsc_line_S {
|
||||
int type;
|
||||
char_u *string;
|
||||
int len;
|
||||
};
|
||||
|
||||
/* Static buffer to read initial comments in a resource file, some can have a
|
||||
* couple of KB of comments! */
|
||||
#define PRT_FILE_BUFFER_LEN (2048)
|
||||
struct prt_resfile_buffer_S {
|
||||
char_u buffer[PRT_FILE_BUFFER_LEN];
|
||||
int len;
|
||||
int line_start;
|
||||
int line_end;
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "hardcopy.c.generated.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Parse 'printoptions' and set the flags in "printer_opts".
|
||||
@ -888,12 +944,6 @@ static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T
|
||||
#define PRT_PS_DEFAULT_FONTSIZE (10)
|
||||
#define PRT_PS_DEFAULT_BUFFER_SIZE (80)
|
||||
|
||||
struct prt_mediasize_S {
|
||||
char *name;
|
||||
float width; /* width and height in points for portrait */
|
||||
float height;
|
||||
};
|
||||
|
||||
#define PRT_MEDIASIZE_LEN (sizeof(prt_mediasize) / \
|
||||
sizeof(struct prt_mediasize_S))
|
||||
|
||||
@ -915,16 +965,6 @@ static struct prt_mediasize_S prt_mediasize[] =
|
||||
{"tabloid", 792.0, 1224.0}
|
||||
};
|
||||
|
||||
/* PS font names, must be in Roman, Bold, Italic, Bold-Italic order */
|
||||
struct prt_ps_font_S {
|
||||
int wx;
|
||||
int uline_offset;
|
||||
int uline_width;
|
||||
int bbox_min_y;
|
||||
int bbox_max_y;
|
||||
char *(ps_fontname[4]);
|
||||
};
|
||||
|
||||
#define PRT_PS_FONT_ROMAN (0)
|
||||
#define PRT_PS_FONT_BOLD (1)
|
||||
#define PRT_PS_FONT_OBLIQUE (2)
|
||||
@ -951,20 +991,6 @@ static struct prt_ps_font_S prt_ps_mb_font =
|
||||
/* Pointer to current font set being used */
|
||||
static struct prt_ps_font_S* prt_ps_font;
|
||||
|
||||
/* Structures to map user named encoding and mapping to PS equivalents for
|
||||
* building CID font name */
|
||||
struct prt_ps_encoding_S {
|
||||
char *encoding;
|
||||
char *cmap_encoding;
|
||||
int needs_charset;
|
||||
};
|
||||
|
||||
struct prt_ps_charset_S {
|
||||
char *charset;
|
||||
char *cmap_charset;
|
||||
int has_charset;
|
||||
};
|
||||
|
||||
|
||||
#define CS_JIS_C_1978 (0x01)
|
||||
#define CS_JIS_X_1983 (0x02)
|
||||
@ -1103,16 +1129,6 @@ static struct prt_ps_charset_S k_charsets[] =
|
||||
{"ISO10646", "UniKS", CS_KR_ISO10646}
|
||||
};
|
||||
|
||||
/* Collections of encodings and charsets for multi-byte printing */
|
||||
struct prt_ps_mbfont_S {
|
||||
int num_encodings;
|
||||
struct prt_ps_encoding_S *encodings;
|
||||
int num_charsets;
|
||||
struct prt_ps_charset_S *charsets;
|
||||
char *ascii_enc;
|
||||
char *defcs;
|
||||
};
|
||||
|
||||
static struct prt_ps_mbfont_S prt_ps_mbfonts[] =
|
||||
{
|
||||
{
|
||||
@ -1149,14 +1165,6 @@ static struct prt_ps_mbfont_S prt_ps_mbfonts[] =
|
||||
}
|
||||
};
|
||||
|
||||
struct prt_ps_resource_S {
|
||||
char_u name[64];
|
||||
char_u filename[MAXPATHL + 1];
|
||||
int type;
|
||||
char_u title[256];
|
||||
char_u version[256];
|
||||
};
|
||||
|
||||
/* Types of PS resource file currently used */
|
||||
#define PRT_RESOURCE_TYPE_PROCSET (0)
|
||||
#define PRT_RESOURCE_TYPE_ENCODING (1)
|
||||
@ -1204,18 +1212,6 @@ static char *prt_resource_types[] =
|
||||
#define PRT_DSC_VERSION "%%Version:"
|
||||
#define PRT_DSC_ENDCOMMENTS "%%EndComments:"
|
||||
|
||||
struct prt_dsc_comment_S {
|
||||
char *string;
|
||||
int len;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct prt_dsc_line_S {
|
||||
int type;
|
||||
char_u *string;
|
||||
int len;
|
||||
};
|
||||
|
||||
|
||||
#define SIZEOF_CSTR(s) (sizeof(s) - 1)
|
||||
static struct prt_dsc_comment_S prt_dsc_table[] =
|
||||
@ -1227,60 +1223,6 @@ static struct prt_dsc_comment_S prt_dsc_table[] =
|
||||
PRT_DSC_ENDCOMMENTS_TYPE}
|
||||
};
|
||||
|
||||
static void prt_write_file_raw_len(char_u *buffer, int bytes);
|
||||
static void prt_write_file(char_u *buffer);
|
||||
static void prt_write_file_len(char_u *buffer, int bytes);
|
||||
static void prt_write_string(char *s);
|
||||
static void prt_write_int(int i);
|
||||
static void prt_write_boolean(int b);
|
||||
static void prt_def_font(char *new_name, char *encoding, int height,
|
||||
char *font);
|
||||
static void prt_real_bits(double real, int precision, int *pinteger,
|
||||
int *pfraction);
|
||||
static void prt_write_real(double val, int prec);
|
||||
static void prt_def_var(char *name, double value, int prec);
|
||||
static void prt_flush_buffer(void);
|
||||
static void prt_resource_name(char_u *filename, void *cookie);
|
||||
static int prt_find_resource(char *name, struct prt_ps_resource_S *resource);
|
||||
static int prt_open_resource(struct prt_ps_resource_S *resource);
|
||||
static int prt_check_resource(struct prt_ps_resource_S *resource,
|
||||
char_u *version);
|
||||
static void prt_dsc_start(void);
|
||||
static void prt_dsc_noarg(char *comment);
|
||||
static void prt_dsc_textline(char *comment, char *text);
|
||||
static void prt_dsc_text(char *comment, char *text);
|
||||
static void prt_dsc_ints(char *comment, int count, int *ints);
|
||||
static void prt_dsc_requirements(int duplex, int tumble, int collate,
|
||||
int color,
|
||||
int num_copies);
|
||||
static void prt_dsc_docmedia(char *paper_name, double width,
|
||||
double height, double weight, char *colour,
|
||||
char *type);
|
||||
static void prt_dsc_resources(char *comment, char *type, char *strings);
|
||||
static void prt_dsc_font_resource(char *resource,
|
||||
struct prt_ps_font_S *ps_font);
|
||||
static float to_device_units(int idx, double physsize, int def_number);
|
||||
static void prt_page_margins(double width, double height, double *left,
|
||||
double *right, double *top,
|
||||
double *bottom);
|
||||
static void prt_font_metrics(int font_scale);
|
||||
static int prt_get_cpl(void);
|
||||
static int prt_get_lpp(void);
|
||||
static int prt_add_resource(struct prt_ps_resource_S *resource);
|
||||
static int prt_resfile_next_line(void);
|
||||
static int prt_resfile_strncmp(int offset, char *string, int len);
|
||||
static int prt_resfile_skip_nonws(int offset);
|
||||
static int prt_resfile_skip_ws(int offset);
|
||||
static int prt_next_dsc(struct prt_dsc_line_S *p_dsc_line);
|
||||
static void prt_build_cid_fontname(int font, char_u *name, int name_len);
|
||||
static void prt_def_cidfont(char *new_name, int height, char *cidfont);
|
||||
static void prt_dup_cidfont(char *original_name, char *new_name);
|
||||
static int prt_match_encoding(char *p_encoding,
|
||||
struct prt_ps_mbfont_S *p_cmap,
|
||||
struct prt_ps_encoding_S **pp_mbenc);
|
||||
static int prt_match_charset(char *p_charset,
|
||||
struct prt_ps_mbfont_S *p_cmap,
|
||||
struct prt_ps_charset_S **pp_mbchar);
|
||||
|
||||
/*
|
||||
* Variables for the output PostScript file.
|
||||
@ -1615,16 +1557,6 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
|
||||
#define PSLF (0x0a)
|
||||
#define PSCR (0x0d)
|
||||
|
||||
/* Static buffer to read initial comments in a resource file, some can have a
|
||||
* couple of KB of comments! */
|
||||
#define PRT_FILE_BUFFER_LEN (2048)
|
||||
struct prt_resfile_buffer_S {
|
||||
char_u buffer[PRT_FILE_BUFFER_LEN];
|
||||
int len;
|
||||
int line_start;
|
||||
int line_end;
|
||||
};
|
||||
|
||||
static struct prt_resfile_buffer_S prt_resfile;
|
||||
|
||||
static int prt_resfile_next_line(void)
|
||||
|
@ -70,24 +70,8 @@ typedef struct {
|
||||
|
||||
#define PRINT_NUMBER_WIDTH 8
|
||||
|
||||
char_u *parse_printoptions(void);
|
||||
char_u *parse_printmbfont(void);
|
||||
int prt_header_height(void);
|
||||
int prt_use_number(void);
|
||||
int prt_get_unit(int idx);
|
||||
void ex_hardcopy(exarg_T *eap);
|
||||
void mch_print_cleanup(void);
|
||||
int mch_print_init(prt_settings_T *psettings, char_u *jobname,
|
||||
int forceit);
|
||||
int mch_print_begin(prt_settings_T *psettings);
|
||||
void mch_print_end(prt_settings_T *psettings);
|
||||
int mch_print_end_page(void);
|
||||
int mch_print_begin_page(char_u *str);
|
||||
int mch_print_blank_page(void);
|
||||
void mch_print_start_line(int margin, int page_line);
|
||||
int mch_print_text_out(char_u *p, int len);
|
||||
void mch_print_set_font(int iBold, int iItalic, int iUnderline);
|
||||
void mch_print_set_bg(long_u bgcol);
|
||||
void mch_print_set_fg(long_u fgcol);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "hardcopy.h.generated.h"
|
||||
#endif
|
||||
#endif /* NVIM_HARDCOPY_H */
|
||||
|
@ -30,7 +30,9 @@
|
||||
// Magic value for algorithm that walks through the array.
|
||||
#define PERTURB_SHIFT 5
|
||||
|
||||
static int hash_may_resize(hashtab_T *ht, size_t minitems);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "hashtab.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Initialize an empty hash table.
|
||||
void hash_init(hashtab_T *ht)
|
||||
|
@ -66,18 +66,7 @@ typedef struct hashtable_S {
|
||||
hashitem_T ht_smallarray[HT_INIT_SIZE]; /// initial array
|
||||
} hashtab_T;
|
||||
|
||||
// hashtab.c
|
||||
void hash_init(hashtab_T *ht);
|
||||
void hash_clear(hashtab_T *ht);
|
||||
void hash_clear_all(hashtab_T *ht, unsigned int off);
|
||||
hashitem_T *hash_find(hashtab_T *ht, char_u *key);
|
||||
hashitem_T *hash_lookup(hashtab_T *ht, char_u *key, hash_T hash);
|
||||
void hash_debug_results(void);
|
||||
int hash_add(hashtab_T *ht, char_u *key);
|
||||
int hash_add_item(hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash);
|
||||
void hash_remove(hashtab_T *ht, hashitem_T *hi);
|
||||
void hash_lock(hashtab_T *ht);
|
||||
void hash_unlock(hashtab_T *ht);
|
||||
hash_T hash_hash(char_u *key);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "hashtab.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_HASHTAB_H
|
||||
|
@ -33,45 +33,9 @@
|
||||
#endif
|
||||
#include "nvim/if_cscope_defs.h"
|
||||
|
||||
static void cs_usage_msg(csid_e x);
|
||||
static int cs_add(exarg_T *eap);
|
||||
static void cs_stat_emsg(char *fname);
|
||||
static int cs_add_common(char *, char *, char *);
|
||||
static int cs_check_for_connections(void);
|
||||
static int cs_check_for_tags(void);
|
||||
static int cs_cnt_connections(void);
|
||||
static void cs_reading_emsg(int idx);
|
||||
static int cs_cnt_matches(int idx);
|
||||
static char * cs_create_cmd(char *csoption, char *pattern);
|
||||
static int cs_create_connection(int i);
|
||||
static void do_cscope_general(exarg_T *eap, int make_split);
|
||||
static void cs_file_results(FILE *, int *);
|
||||
static void cs_fill_results(char *, int, int *, char ***,
|
||||
char ***, int *);
|
||||
static int cs_find(exarg_T *eap);
|
||||
static int cs_find_common(char *opt, char *pat, int, int, int,
|
||||
char_u *cmdline);
|
||||
static int cs_help(exarg_T *eap);
|
||||
static void clear_csinfo(int i);
|
||||
static int cs_insert_filelist(char *, char *, char *, FileInfo *file_info);
|
||||
static int cs_kill(exarg_T *eap);
|
||||
static void cs_kill_execute(int, char *);
|
||||
static cscmd_T * cs_lookup_cmd(exarg_T *eap);
|
||||
static char * cs_make_vim_style_matches(char *, char *,
|
||||
char *, char *);
|
||||
static char * cs_manage_matches(char **, char **, int, mcmd_e);
|
||||
static char * cs_parse_results(int cnumber, char *buf,
|
||||
int bufsize, char **context,
|
||||
char **linenumber,
|
||||
char **search);
|
||||
static char * cs_pathcomponents(char *path);
|
||||
static void cs_print_tags_priv(char **, char **, int);
|
||||
static int cs_read_prompt(int);
|
||||
static void cs_release_csp(int, int freefnpp);
|
||||
static int cs_reset(exarg_T *eap);
|
||||
static char * cs_resolve_file(int, char *);
|
||||
static int cs_show(exarg_T *eap);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "if_cscope.c.generated.h"
|
||||
#endif
|
||||
|
||||
static csinfo_T * csinfo = NULL;
|
||||
static int csinfo_size = 0; /* number of items allocated in
|
||||
@ -1275,8 +1239,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags,
|
||||
*
|
||||
* find cscope command in command table
|
||||
*/
|
||||
static cscmd_T * cs_lookup_cmd(eap)
|
||||
exarg_T *eap;
|
||||
static cscmd_T * cs_lookup_cmd(exarg_T *eap)
|
||||
{
|
||||
cscmd_T *cmdp;
|
||||
char *stok;
|
||||
|
@ -1,16 +1,7 @@
|
||||
#ifndef NVIM_IF_CSCOPE_H
|
||||
#define NVIM_IF_CSCOPE_H
|
||||
/* if_cscope.c */
|
||||
char_u *get_cscope_name(expand_T *xp, int idx);
|
||||
void set_context_in_cscope_cmd(expand_T *xp, char_u *arg,
|
||||
cmdidx_T cmdidx);
|
||||
void do_cscope(exarg_T *eap);
|
||||
void do_scscope(exarg_T *eap);
|
||||
void do_cstag(exarg_T *eap);
|
||||
int cs_fgets(char_u *buf, int size);
|
||||
void cs_free_tags(void);
|
||||
void cs_print_tags(void);
|
||||
int cs_connection(int num, char_u *dbpath, char_u *ppath);
|
||||
void cs_end(void);
|
||||
|
||||
#endif /* NVIM_IF_CSCOPE_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "if_cscope.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_IF_CSCOPE_H
|
||||
|
@ -12,8 +12,10 @@
|
||||
#include "nvim/strings.h"
|
||||
#include "nvim/undo.h"
|
||||
|
||||
static int lisp_match(char_u *p);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "indent.c.generated.h"
|
||||
#endif
|
||||
|
||||
// Count the size (in window cells) of the indent in the current line.
|
||||
int get_indent(void)
|
||||
|
@ -1,14 +1,9 @@
|
||||
#ifndef NVIM_INDENT_H
|
||||
#define NVIM_INDENT_H
|
||||
|
||||
#include "nvim/vim.h"
|
||||
int get_indent(void);
|
||||
int get_indent_lnum(linenr_T lnum);
|
||||
int get_indent_buf(buf_T *buf, linenr_T lnum);
|
||||
int get_indent_str(char_u *ptr, int ts);
|
||||
int set_indent(int size, int flags);
|
||||
int copy_indent(int size, char_u *src);
|
||||
int get_number_indent(linenr_T lnum);
|
||||
int inindent(int extra);
|
||||
int get_expr_indent(void);
|
||||
int get_lisp_indent(void);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "indent.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_INDENT_H
|
||||
|
@ -13,9 +13,10 @@
|
||||
#include "nvim/strings.h"
|
||||
|
||||
|
||||
static char_u *skip_string(char_u *p);
|
||||
static pos_T *ind_find_start_comment(void);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "indent_c.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* Find the start of a comment, not knowing if we are in a comment right now.
|
||||
* Search starts at w_cursor.lnum and goes backwards.
|
||||
@ -109,7 +110,6 @@ static char_u *skip_string(char_u *p)
|
||||
* Below "XXX" means that this function may unlock the current line.
|
||||
*/
|
||||
|
||||
int cin_is_cinword(char_u *line);
|
||||
|
||||
/*
|
||||
* Return TRUE if the string "line" starts with a word from 'cinwords'.
|
||||
@ -139,41 +139,6 @@ int cin_is_cinword(char_u *line)
|
||||
}
|
||||
|
||||
|
||||
static char_u *cin_skipcomment(char_u *);
|
||||
static int cin_nocode(char_u *);
|
||||
static pos_T *find_line_comment(void);
|
||||
static int cin_islabel_skip(char_u **);
|
||||
static int cin_isdefault(char_u *);
|
||||
static char_u *after_label(char_u *l);
|
||||
static int get_indent_nolabel(linenr_T lnum);
|
||||
static int skip_label(linenr_T, char_u **pp);
|
||||
static int cin_first_id_amount(void);
|
||||
static int cin_get_equal_amount(linenr_T lnum);
|
||||
static int cin_ispreproc(char_u *);
|
||||
static int cin_ispreproc_cont(char_u **pp, linenr_T *lnump);
|
||||
static int cin_iscomment(char_u *);
|
||||
static int cin_islinecomment(char_u *);
|
||||
static int cin_isterminated(char_u *, int, int);
|
||||
static int cin_isinit(void);
|
||||
static int cin_isfuncdecl(char_u **, linenr_T, linenr_T);
|
||||
static int cin_isif(char_u *);
|
||||
static int cin_iselse(char_u *);
|
||||
static int cin_isdo(char_u *);
|
||||
static int cin_iswhileofdo(char_u *, linenr_T);
|
||||
static int cin_is_if_for_while_before_offset(char_u *line, int *poffset);
|
||||
static int cin_iswhileofdo_end(int terminated);
|
||||
static int cin_isbreak(char_u *);
|
||||
static int cin_is_cpp_baseclass(colnr_T *col);
|
||||
static int get_baseclass_amount(int col);
|
||||
static int cin_ends_in(char_u *, char_u *, char_u *);
|
||||
static int cin_starts_with(char_u *s, char *word);
|
||||
static int cin_skip2pos(pos_T *trypos);
|
||||
static pos_T *find_start_brace(void);
|
||||
static pos_T *find_match_paren(int);
|
||||
static int corr_ind_maxparen(pos_T *startpos);
|
||||
static int find_last_paren(char_u *l, int start, int end);
|
||||
static int find_match(int lookfor, linenr_T ourscope);
|
||||
static int cin_is_cpp_namespace(char_u *);
|
||||
|
||||
/*
|
||||
* Skip over white space and C comments within the line.
|
||||
|
@ -1,12 +1,9 @@
|
||||
#ifndef NVIM_INDENT_C_H
|
||||
#define NVIM_INDENT_C_H
|
||||
|
||||
#include "nvim/vim.h"
|
||||
int cin_islabel(void);
|
||||
int cin_iscase(char_u *s, int strict);
|
||||
int cin_isscopedecl(char_u *s);
|
||||
int cin_is_cinword(char_u *line);
|
||||
int get_c_indent(void);
|
||||
void do_c_expr_indent(void);
|
||||
void parse_cino(buf_T *buf);
|
||||
pos_T * find_start_comment(int ind_maxcomment);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "indent_c.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_INDENT_C_H
|
||||
|
@ -498,18 +498,8 @@ enum key_extra {
|
||||
*/
|
||||
#define MAX_KEY_CODE_LEN 6
|
||||
|
||||
int name_to_mod_mask(int c);
|
||||
int simplify_key(int key, int *modifiers);
|
||||
int handle_x_keys(int key);
|
||||
char_u *get_special_key_name(int c, int modifiers);
|
||||
int trans_special(char_u **srcp, char_u *dst, int keycode);
|
||||
int find_special_key(char_u **srcp, int *modp, int keycode,
|
||||
int keep_x_key);
|
||||
int extract_modifiers(int key, int *modp);
|
||||
int find_special_key_in_table(int c);
|
||||
int get_special_key_code(char_u *name);
|
||||
char_u *get_key_name(int i);
|
||||
int get_mouse_button(int code, int *is_click, int *is_drag);
|
||||
int get_pseudo_mouse_code(int button, int is_click, int is_drag);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "keymap.h.generated.h"
|
||||
#endif
|
||||
#endif /* NVIM_KEYMAP_H */
|
||||
|
@ -16,16 +16,12 @@
|
||||
#define USR_LOG_FILE "$HOME/.nvimlog"
|
||||
|
||||
|
||||
static FILE *open_log_file(void);
|
||||
static bool do_log_to_file(FILE *log_file, int log_level,
|
||||
const char *func_name, int line_num,
|
||||
const char* fmt, ...);
|
||||
static bool v_do_log_to_file(FILE *log_file, int log_level,
|
||||
const char *func_name, int line_num,
|
||||
const char* fmt, va_list args);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "log.c.generated.h"
|
||||
#endif
|
||||
|
||||
bool do_log(int log_level, const char *func_name, int line_num,
|
||||
const char* fmt, ...)
|
||||
const char* fmt, ...) FUNC_ATTR_UNUSED
|
||||
{
|
||||
FILE *log_file = open_log_file();
|
||||
|
||||
|
@ -10,9 +10,6 @@
|
||||
#define WARNING_LOG_LEVEL 2
|
||||
#define ERROR_LOG_LEVEL 3
|
||||
|
||||
bool do_log(int log_level, const char *func_name, int line_num,
|
||||
const char* fmt, ...) FUNC_ATTR_UNUSED;
|
||||
|
||||
#define DLOG(...)
|
||||
#define ILOG(...)
|
||||
#define WLOG(...)
|
||||
@ -53,5 +50,7 @@ bool do_log(int log_level, const char *func_name, int line_num,
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "log.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_LOG_H
|
||||
|
||||
|
@ -99,39 +99,15 @@ typedef struct {
|
||||
#define EDIT_QF 4 /* start in quickfix mode */
|
||||
|
||||
#if defined(UNIX) && !defined(NO_VIM_MAIN)
|
||||
static int file_owned(char *fname);
|
||||
#endif
|
||||
static void mainerr(int, char_u *);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "main.c.generated.h"
|
||||
#endif
|
||||
#ifndef NO_VIM_MAIN
|
||||
static void main_msg(char *s);
|
||||
static void usage(void);
|
||||
static int get_number_arg(char_u *p, int *idx, int def);
|
||||
# if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
|
||||
static void init_locale(void);
|
||||
# endif
|
||||
static void parse_command_name(mparm_T *parmp);
|
||||
static bool parse_char_i(char_u **input, char val);
|
||||
static bool parse_string(char_u **input, char* val, int len);
|
||||
static void command_line_scan(mparm_T *parmp);
|
||||
static void init_params(mparm_T *parmp, int argc, char **argv);
|
||||
static void init_startuptime(mparm_T *parmp);
|
||||
static void allocate_generic_buffers(void);
|
||||
static void check_and_set_isatty(mparm_T *parmp);
|
||||
static char_u* get_fname(mparm_T *parmp);
|
||||
static void set_window_layout(mparm_T *parmp);
|
||||
static void load_plugins(void);
|
||||
static void handle_quickfix(mparm_T *parmp);
|
||||
static void handle_tag(char_u *tagname);
|
||||
static void check_tty(mparm_T *parmp);
|
||||
static void read_stdin(void);
|
||||
static void create_windows(mparm_T *parmp);
|
||||
static void edit_buffers(mparm_T *parmp);
|
||||
static void exe_pre_commands(mparm_T *parmp);
|
||||
static void exe_commands(mparm_T *parmp);
|
||||
static void source_startup_scripts(mparm_T *parmp);
|
||||
static void main_start_gui(void);
|
||||
# if defined(HAS_SWAP_EXISTS_ACTION)
|
||||
static void check_swap_exists_action(void);
|
||||
# endif
|
||||
#endif /* NO_VIM_MAIN */
|
||||
|
||||
@ -971,10 +947,7 @@ static bool parse_char_i(char_u **input, char val)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool parse_string(input, val, len)
|
||||
char_u **input;
|
||||
char *val;
|
||||
int len;
|
||||
static bool parse_string(char_u **input, char *val, int len)
|
||||
{
|
||||
if (STRNICMP(*input, val, len) == 0) {
|
||||
*input += len;
|
||||
@ -2273,7 +2246,6 @@ static void check_swap_exists_action(void)
|
||||
#endif
|
||||
|
||||
#if defined(STARTUPTIME) || defined(PROTO)
|
||||
static void time_diff(struct timeval *then, struct timeval *now);
|
||||
|
||||
static struct timeval prev_timeval;
|
||||
|
||||
|
@ -3,14 +3,7 @@
|
||||
|
||||
#include "nvim/normal.h"
|
||||
|
||||
void main_loop(int cmdwin, int noexmode);
|
||||
void getout(int exitval);
|
||||
int process_env(char_u *env, int is_viminit);
|
||||
void mainerr_arg_missing(char_u *str);
|
||||
void time_push(void *tv_rel, void *tv_start);
|
||||
void time_pop(void *tp);
|
||||
void time_msg(char *mesg, void *tv_start);
|
||||
char_u *eval_client_expr_to_string(char_u *expr);
|
||||
char_u *serverConvert(char_u *client_enc, char_u *data, char_u **tofree);
|
||||
|
||||
#endif /* NVIM_MAIN_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "main.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MAIN_H
|
||||
|
@ -44,4 +44,3 @@ MAP_DECLS(uint64_t, ptr_t)
|
||||
kh_foreach_value(map->table, value, block)
|
||||
|
||||
#endif // NVIM_MAP_H
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef NVIM_MAP_DEFS_H
|
||||
#define NVIM_MAP_DEFS_H
|
||||
|
||||
|
||||
#include "nvim/lib/khash.h"
|
||||
|
||||
typedef const char * cstr_t;
|
||||
@ -11,4 +10,3 @@ typedef void * ptr_t;
|
||||
#define PMap(T) Map(T, ptr_t)
|
||||
|
||||
#endif // NVIM_MAP_DEFS_H
|
||||
|
||||
|
@ -51,13 +51,10 @@
|
||||
#define EXTRA_MARKS 10 /* marks 0-9 */
|
||||
static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; /* marks with file nr */
|
||||
|
||||
static void fname2fnum(xfmark_T *fm);
|
||||
static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf);
|
||||
static char_u *mark_line(pos_T *mp, int lead_len);
|
||||
static void show_one_mark(int, char_u *, pos_T *, char_u *, int current);
|
||||
static void cleanup_jumplist(void);
|
||||
static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "mark.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* Set named mark "c" at current cursor position.
|
||||
* Returns OK on success, FAIL if bad name given.
|
||||
@ -1328,7 +1325,6 @@ int removable(char_u *name)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void write_one_mark(FILE *fp_out, int c, pos_T *pos);
|
||||
|
||||
/*
|
||||
* Write all the named marks for all buffers.
|
||||
|
@ -5,38 +5,7 @@
|
||||
#include "nvim/mark_defs.h"
|
||||
#include "nvim/pos.h"
|
||||
|
||||
/* mark.c */
|
||||
int setmark(int c);
|
||||
int setmark_pos(int c, pos_T *pos, int fnum);
|
||||
void setpcmark(void);
|
||||
void checkpcmark(void);
|
||||
pos_T *movemark(int count);
|
||||
pos_T *movechangelist(int count);
|
||||
pos_T *getmark_buf(buf_T *buf, int c, int changefile);
|
||||
pos_T *getmark(int c, int changefile);
|
||||
pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum);
|
||||
pos_T *getnextmark(pos_T *startpos, int dir, int begin_line);
|
||||
void fmarks_check_names(buf_T *buf);
|
||||
int check_mark(pos_T *pos);
|
||||
void clrallmarks(buf_T *buf);
|
||||
char_u *fm_getname(fmark_T *fmark, int lead_len);
|
||||
void do_marks(exarg_T *eap);
|
||||
void ex_delmarks(exarg_T *eap);
|
||||
void ex_jumps(exarg_T *eap);
|
||||
void ex_changes(exarg_T *eap);
|
||||
void mark_adjust(linenr_T line1, linenr_T line2, long amount,
|
||||
long amount_after);
|
||||
void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount,
|
||||
long col_amount);
|
||||
void copy_jumplist(win_T *from, win_T *to);
|
||||
void free_jumplist(win_T *wp);
|
||||
void set_last_cursor(win_T *win);
|
||||
void free_all_marks(void);
|
||||
int read_viminfo_filemark(vir_T *virp, int force);
|
||||
void write_viminfo_filemarks(FILE *fp);
|
||||
int removable(char_u *name);
|
||||
int write_viminfo_marks(FILE *fp_out);
|
||||
void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof,
|
||||
int flags);
|
||||
|
||||
#endif /* NVIM_MARK_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "mark.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MARK_H
|
||||
|
@ -98,16 +98,21 @@
|
||||
|
||||
# define WINBYTE BYTE
|
||||
|
||||
static int enc_canon_search(char_u *name);
|
||||
static int dbcs_char2len(int c);
|
||||
static int dbcs_char2bytes(int c, char_u *buf);
|
||||
static int dbcs_ptr2len(char_u *p);
|
||||
static int dbcs_ptr2len_len(char_u *p, int size);
|
||||
static int utf_ptr2cells_len(char_u *p, int size);
|
||||
static int dbcs_char2cells(int c);
|
||||
static int dbcs_ptr2cells_len(char_u *p, int size);
|
||||
static int dbcs_ptr2char(char_u *p);
|
||||
static int utf_safe_read_char_adv(char_u **s, size_t *n);
|
||||
typedef struct {
|
||||
int rangeStart;
|
||||
int rangeEnd;
|
||||
int step;
|
||||
int offset;
|
||||
} convertStruct;
|
||||
|
||||
struct interval {
|
||||
long first;
|
||||
long last;
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "mbyte.c.generated.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Lookup table to quickly get the length in bytes of a UTF-8 character from
|
||||
@ -909,12 +914,6 @@ static int dbcs_ptr2len_len(char_u *p, int size)
|
||||
return len;
|
||||
}
|
||||
|
||||
struct interval {
|
||||
long first;
|
||||
long last;
|
||||
};
|
||||
static int intable(struct interval *table, size_t size, int c);
|
||||
|
||||
/*
|
||||
* Return TRUE if "c" is in "table[size / sizeof(struct interval)]".
|
||||
*/
|
||||
@ -2170,12 +2169,6 @@ int utf_class(int c)
|
||||
* range from 0x41 to 0x5a inclusive, stepping by 1, are changed to
|
||||
* folded/upper/lower by adding 32.
|
||||
*/
|
||||
typedef struct {
|
||||
int rangeStart;
|
||||
int rangeEnd;
|
||||
int step;
|
||||
int offset;
|
||||
} convertStruct;
|
||||
|
||||
static convertStruct foldCase[] =
|
||||
{
|
||||
@ -2337,8 +2330,6 @@ static convertStruct foldCase[] =
|
||||
{0x10400,0x10427,1,40}
|
||||
};
|
||||
|
||||
static int utf_convert(int a, convertStruct table[], int tableSize);
|
||||
static int utf_strnicmp(char_u *s1, char_u *s2, size_t n1, size_t n2);
|
||||
|
||||
/*
|
||||
* Generic conversion function for case operations.
|
||||
@ -3299,7 +3290,6 @@ int mb_fix_col(int col, int row)
|
||||
return col;
|
||||
}
|
||||
|
||||
static int enc_alias_search(char_u *name);
|
||||
|
||||
/*
|
||||
* Skip the Vim specific head of a 'encoding' name.
|
||||
@ -3457,9 +3447,6 @@ char_u * enc_locale()
|
||||
|
||||
# if defined(USE_ICONV) || defined(PROTO)
|
||||
|
||||
static char_u *
|
||||
iconv_string(vimconv_T *vcp, char_u *str, int slen, int *unconvlenp,
|
||||
int *resultlenp);
|
||||
|
||||
/*
|
||||
* Call iconv_open() with a check if iconv() works properly (there are broken
|
||||
@ -3734,10 +3721,7 @@ void iconv_end()
|
||||
* Afterwards invoke with "from" and "to" equal to NULL to cleanup.
|
||||
* Return FAIL when conversion is not supported, OK otherwise.
|
||||
*/
|
||||
int convert_setup(vcp, from, to)
|
||||
vimconv_T *vcp;
|
||||
char_u *from;
|
||||
char_u *to;
|
||||
int convert_setup(vimconv_T *vcp, char_u *from, char_u *to)
|
||||
{
|
||||
return convert_setup_ext(vcp, from, TRUE, to, TRUE);
|
||||
}
|
||||
@ -3746,12 +3730,8 @@ int convert_setup(vcp, from, to)
|
||||
* As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
|
||||
* "from" unicode charsets be considered utf-8. Same for "to".
|
||||
*/
|
||||
int convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8)
|
||||
vimconv_T *vcp;
|
||||
char_u *from;
|
||||
int from_unicode_is_utf8;
|
||||
char_u *to;
|
||||
int to_unicode_is_utf8;
|
||||
int convert_setup_ext(vimconv_T *vcp, char_u *from, int from_unicode_is_utf8,
|
||||
char_u *to, int to_unicode_is_utf8)
|
||||
{
|
||||
int from_prop;
|
||||
int to_prop;
|
||||
@ -3822,10 +3802,7 @@ int convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8)
|
||||
* The input and output are not NUL terminated!
|
||||
* Returns the length after conversion.
|
||||
*/
|
||||
int convert_input(ptr, len, maxlen)
|
||||
char_u *ptr;
|
||||
int len;
|
||||
int maxlen;
|
||||
int convert_input(char_u *ptr, int len, int maxlen)
|
||||
{
|
||||
return convert_input_safe(ptr, len, maxlen, NULL, NULL);
|
||||
}
|
||||
@ -3836,12 +3813,8 @@ int convert_input(ptr, len, maxlen)
|
||||
* end return that as an allocated string in "restp" and set "*restlenp" to
|
||||
* the length. If "restp" is NULL it is not used.
|
||||
*/
|
||||
int convert_input_safe(ptr, len, maxlen, restp, restlenp)
|
||||
char_u *ptr;
|
||||
int len;
|
||||
int maxlen;
|
||||
char_u **restp;
|
||||
int *restlenp;
|
||||
int convert_input_safe(char_u *ptr, int len, int maxlen, char_u **restp,
|
||||
int *restlenp)
|
||||
{
|
||||
char_u *d;
|
||||
int dlen = len;
|
||||
@ -3874,10 +3847,7 @@ int convert_input_safe(ptr, len, maxlen, restp, restlenp)
|
||||
* Illegal chars are often changed to "?", unless vcp->vc_fail is set.
|
||||
* When something goes wrong, NULL is returned and "*lenp" is unchanged.
|
||||
*/
|
||||
char_u * string_convert(vcp, ptr, lenp)
|
||||
vimconv_T *vcp;
|
||||
char_u *ptr;
|
||||
int *lenp;
|
||||
char_u * string_convert(vimconv_T *vcp, char_u *ptr, int *lenp)
|
||||
{
|
||||
return string_convert_ext(vcp, ptr, lenp, NULL);
|
||||
}
|
||||
@ -3887,11 +3857,8 @@ char_u * string_convert(vcp, ptr, lenp)
|
||||
* an incomplete sequence at the end it is not converted and "*unconvlenp" is
|
||||
* set to the number of remaining bytes.
|
||||
*/
|
||||
char_u * string_convert_ext(vcp, ptr, lenp, unconvlenp)
|
||||
vimconv_T *vcp;
|
||||
char_u *ptr;
|
||||
int *lenp;
|
||||
int *unconvlenp;
|
||||
char_u * string_convert_ext(vimconv_T *vcp, char_u *ptr, int *lenp,
|
||||
int *unconvlenp)
|
||||
{
|
||||
char_u *retval = NULL;
|
||||
char_u *d;
|
||||
|
@ -1,87 +1,7 @@
|
||||
#ifndef NVIM_MBYTE_H
|
||||
#define NVIM_MBYTE_H
|
||||
/* mbyte.c */
|
||||
int enc_canon_props(char_u *name);
|
||||
char_u *mb_init(void);
|
||||
int bomb_size(void);
|
||||
void remove_bom(char_u *s);
|
||||
int mb_get_class(char_u *p);
|
||||
int mb_get_class_buf(char_u *p, buf_T *buf);
|
||||
int dbcs_class(unsigned lead, unsigned trail);
|
||||
int latin_char2len(int c);
|
||||
int latin_char2bytes(int c, char_u *buf);
|
||||
int latin_ptr2len(char_u *p);
|
||||
int latin_ptr2len_len(char_u *p, int size);
|
||||
int utf_char2cells(int c);
|
||||
int latin_ptr2cells(char_u *p);
|
||||
int utf_ptr2cells(char_u *p);
|
||||
int dbcs_ptr2cells(char_u *p);
|
||||
int latin_ptr2cells_len(char_u *p, int size);
|
||||
int latin_char2cells(int c);
|
||||
int mb_string2cells(char_u *p, int len);
|
||||
int latin_off2cells(unsigned off, unsigned max_off);
|
||||
int dbcs_off2cells(unsigned off, unsigned max_off);
|
||||
int utf_off2cells(unsigned off, unsigned max_off);
|
||||
int latin_ptr2char(char_u *p);
|
||||
int utf_ptr2char(char_u *p);
|
||||
int mb_ptr2char_adv(char_u **pp);
|
||||
int mb_cptr2char_adv(char_u **pp);
|
||||
int arabic_combine(int one, int two);
|
||||
int arabic_maycombine(int two);
|
||||
int utf_composinglike(char_u *p1, char_u *p2);
|
||||
int utfc_ptr2char(char_u *p, int *pcc);
|
||||
int utfc_ptr2char_len(char_u *p, int *pcc, int maxlen);
|
||||
int utfc_char2bytes(int off, char_u *buf);
|
||||
int utf_ptr2len(char_u *p);
|
||||
int utf_byte2len(int b);
|
||||
int utf_ptr2len_len(char_u *p, int size);
|
||||
int utfc_ptr2len(char_u *p);
|
||||
int utfc_ptr2len_len(char_u *p, int size);
|
||||
int utf_char2len(int c);
|
||||
int utf_char2bytes(int c, char_u *buf);
|
||||
int utf_iscomposing(int c);
|
||||
int utf_printable(int c);
|
||||
int utf_class(int c);
|
||||
int utf_fold(int a);
|
||||
int utf_toupper(int a);
|
||||
int utf_islower(int a);
|
||||
int utf_tolower(int a);
|
||||
int utf_isupper(int a);
|
||||
int mb_strnicmp(char_u *s1, char_u *s2, size_t nn);
|
||||
void show_utf8(void);
|
||||
int latin_head_off(char_u *base, char_u *p);
|
||||
int dbcs_head_off(char_u *base, char_u *p);
|
||||
int dbcs_screen_head_off(char_u *base, char_u *p);
|
||||
int utf_head_off(char_u *base, char_u *p);
|
||||
void mb_copy_char(char_u **fp, char_u **tp);
|
||||
int mb_off_next(char_u *base, char_u *p);
|
||||
int mb_tail_off(char_u *base, char_u *p);
|
||||
void utf_find_illegal(void);
|
||||
void mb_adjust_cursor(void);
|
||||
void mb_adjustpos(buf_T *buf, pos_T *lp);
|
||||
char_u *mb_prevptr(char_u *line, char_u *p);
|
||||
int mb_charlen(char_u *str);
|
||||
int mb_charlen_len(char_u *str, int len);
|
||||
char_u *mb_unescape(char_u **pp);
|
||||
int mb_lefthalve(int row, int col);
|
||||
int mb_fix_col(int col, int row);
|
||||
char_u *enc_skip(char_u *p);
|
||||
char_u *enc_canonize(char_u *enc);
|
||||
char_u *enc_locale(void);
|
||||
void *my_iconv_open(char_u *to, char_u *from);
|
||||
int iconv_enabled(int verbose);
|
||||
void iconv_end(void);
|
||||
void im_set_active(int active);
|
||||
int im_get_status(void);
|
||||
int convert_setup(vimconv_T *vcp, char_u *from, char_u *to);
|
||||
int convert_setup_ext(vimconv_T *vcp, char_u *from,
|
||||
int from_unicode_is_utf8, char_u *to,
|
||||
int to_unicode_is_utf8);
|
||||
int convert_input(char_u *ptr, int len, int maxlen);
|
||||
int convert_input_safe(char_u *ptr, int len, int maxlen, char_u **restp,
|
||||
int *restlenp);
|
||||
char_u *string_convert(vimconv_T *vcp, char_u *ptr, int *lenp);
|
||||
char_u *string_convert_ext(vimconv_T *vcp, char_u *ptr, int *lenp,
|
||||
int *unconvlenp);
|
||||
|
||||
#endif /* NVIM_MBYTE_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "mbyte.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MBYTE_H
|
||||
|
@ -50,30 +50,10 @@
|
||||
|
||||
static long_u total_mem_used = 0; /* total memory used for memfiles */
|
||||
|
||||
static void mf_ins_hash(memfile_T *, bhdr_T *);
|
||||
static void mf_rem_hash(memfile_T *, bhdr_T *);
|
||||
static bhdr_T *mf_find_hash(memfile_T *, blocknr_T);
|
||||
static void mf_ins_used(memfile_T *, bhdr_T *);
|
||||
static void mf_rem_used(memfile_T *, bhdr_T *);
|
||||
static bhdr_T *mf_release(memfile_T *, int);
|
||||
static bhdr_T *mf_alloc_bhdr(memfile_T *, int);
|
||||
static void mf_free_bhdr(bhdr_T *);
|
||||
static void mf_ins_free(memfile_T *, bhdr_T *);
|
||||
static bhdr_T *mf_rem_free(memfile_T *);
|
||||
static int mf_read(memfile_T *, bhdr_T *);
|
||||
static int mf_write(memfile_T *, bhdr_T *);
|
||||
static int mf_write_block(memfile_T *mfp, bhdr_T *hp, off_t offset,
|
||||
unsigned size);
|
||||
static int mf_trans_add(memfile_T *, bhdr_T *);
|
||||
static void mf_do_open(memfile_T *, char_u *, int);
|
||||
static void mf_hash_init(mf_hashtab_T *);
|
||||
static void mf_hash_free(mf_hashtab_T *);
|
||||
static void mf_hash_free_all(mf_hashtab_T *);
|
||||
static mf_hashitem_T *mf_hash_find(mf_hashtab_T *, blocknr_T);
|
||||
static void mf_hash_add_item(mf_hashtab_T *, mf_hashitem_T *);
|
||||
static void mf_hash_rem_item(mf_hashtab_T *, mf_hashitem_T *);
|
||||
static void mf_hash_grow(mf_hashtab_T *);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memfile.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* The functions for using a memfile:
|
||||
*
|
||||
|
@ -4,22 +4,7 @@
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/memfile_defs.h"
|
||||
|
||||
/* memfile.c */
|
||||
memfile_T *mf_open(char_u *fname, int flags);
|
||||
int mf_open_file(memfile_T *mfp, char_u *fname);
|
||||
void mf_close(memfile_T *mfp, int del_file);
|
||||
void mf_close_file(buf_T *buf, int getlines);
|
||||
void mf_new_page_size(memfile_T *mfp, unsigned new_size);
|
||||
bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count);
|
||||
bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, int page_count);
|
||||
void mf_put(memfile_T *mfp, bhdr_T *hp, int dirty, int infile);
|
||||
void mf_free(memfile_T *mfp, bhdr_T *hp);
|
||||
int mf_sync(memfile_T *mfp, int flags);
|
||||
void mf_set_dirty(memfile_T *mfp);
|
||||
int mf_release_all(void);
|
||||
blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr);
|
||||
void mf_set_ffname(memfile_T *mfp);
|
||||
void mf_fullname(memfile_T *mfp);
|
||||
int mf_need_trans(memfile_T *mfp);
|
||||
|
||||
#endif /* NVIM_MEMFILE_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memfile.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MEMFILE_H
|
||||
|
@ -236,32 +236,9 @@ typedef enum {
|
||||
, UB_SAME_DIR /* update the B0_SAME_DIR flag */
|
||||
} upd_block0_T;
|
||||
|
||||
static int ml_check_b0_id(ZERO_BL *b0p);
|
||||
static void ml_upd_block0(buf_T *buf, upd_block0_T what);
|
||||
static void set_b0_fname(ZERO_BL *, buf_T *buf);
|
||||
static void set_b0_dir_flag(ZERO_BL *b0p, buf_T *buf);
|
||||
static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf);
|
||||
static time_t swapfile_info(char_u *);
|
||||
static int recov_file_names(char_u **, char_u *, int prepend_dot);
|
||||
static int ml_append_int(buf_T *, linenr_T, char_u *, colnr_T, int, int);
|
||||
static int ml_delete_int(buf_T *, linenr_T, int);
|
||||
static char_u *findswapname(buf_T *, char_u **, char_u *);
|
||||
static void ml_flush_line(buf_T *);
|
||||
static bhdr_T *ml_new_data(memfile_T *, int, int);
|
||||
static bhdr_T *ml_new_ptr(memfile_T *);
|
||||
static bhdr_T *ml_find_line(buf_T *, linenr_T, int);
|
||||
static int ml_add_stack(buf_T *);
|
||||
static void ml_lineadd(buf_T *, int);
|
||||
static int b0_magic_wrong(ZERO_BL *);
|
||||
#ifdef CHECK_INODE
|
||||
static int fnamecmp_ino(char_u *, char_u *, long);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memline.c.generated.h"
|
||||
#endif
|
||||
static void long_to_char(long, char_u *);
|
||||
static long char_to_long(char_u *);
|
||||
#if defined(UNIX) || defined(WIN3264)
|
||||
static char_u *make_percent_swname(char_u *dir, char_u *name);
|
||||
#endif
|
||||
static void ml_updatechunk(buf_T *buf, long line, long len, int updtype);
|
||||
|
||||
/*
|
||||
* Open a new memline for "buf".
|
||||
@ -3186,7 +3163,6 @@ get_file_in_dir (
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void attention_message(buf_T *buf, char_u *fname);
|
||||
|
||||
/*
|
||||
* Print the ATTENTION message: info about an existing swap file.
|
||||
@ -3237,7 +3213,6 @@ attention_message (
|
||||
--no_wait_return;
|
||||
}
|
||||
|
||||
static int do_swapexists(buf_T *buf, char_u *fname);
|
||||
|
||||
/*
|
||||
* Trigger the SwapExists autocommands.
|
||||
|
@ -2,39 +2,8 @@
|
||||
#define NVIM_MEMLINE_H
|
||||
|
||||
#include "nvim/types.h"
|
||||
#include "nvim/func_attr.h"
|
||||
|
||||
int ml_open(buf_T *buf);
|
||||
void ml_setname(buf_T *buf);
|
||||
void ml_open_files(void);
|
||||
void ml_open_file(buf_T *buf);
|
||||
void check_need_swap(int newfile);
|
||||
void ml_close(buf_T *buf, int del_file);
|
||||
void ml_close_all(int del_file);
|
||||
void ml_close_notmod(void);
|
||||
void ml_timestamp(buf_T *buf);
|
||||
void ml_recover(void);
|
||||
int recover_names(char_u *fname, int list, int nr, char_u **fname_out);
|
||||
void ml_sync_all(int check_file, int check_char);
|
||||
void ml_preserve(buf_T *buf, int message);
|
||||
char_u *ml_get(linenr_T lnum);
|
||||
char_u *ml_get_pos(pos_T *pos);
|
||||
char_u *ml_get_buf(buf_T *buf, linenr_T lnum, int will_change);
|
||||
int ml_line_alloced(void);
|
||||
int ml_append(linenr_T lnum, char_u *line, colnr_T len, int newfile);
|
||||
int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len,
|
||||
int newfile);
|
||||
int ml_replace(linenr_T lnum, char_u *line, int copy);
|
||||
int ml_delete(linenr_T lnum, int message);
|
||||
void ml_setmarked(linenr_T lnum);
|
||||
linenr_T ml_firstmarked(void);
|
||||
void ml_clearmarked(void);
|
||||
int resolve_symlink(char_u *fname, char_u *buf);
|
||||
char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf,
|
||||
char_u *dir_name);
|
||||
char_u *get_file_in_dir(char_u *fname, char_u *dname);
|
||||
void ml_setflags(buf_T *buf);
|
||||
long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp);
|
||||
void goto_byte(long cnt);
|
||||
|
||||
#endif /* NVIM_MEMLINE_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memline.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MEMLINE_H
|
||||
|
@ -41,7 +41,9 @@
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/os/os.h"
|
||||
|
||||
static void try_to_free_memory();
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memory.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Try to free memory. Used when trying to recover from out of memory errors.
|
||||
/// @see {xmalloc}
|
||||
@ -71,7 +73,7 @@ static void try_to_free_memory()
|
||||
/// @see {try_to_free_memory}
|
||||
/// @param size
|
||||
/// @return pointer to allocated space. NULL if out of memory
|
||||
void *try_malloc(size_t size)
|
||||
void *try_malloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1)
|
||||
{
|
||||
void *ret = malloc(size);
|
||||
|
||||
@ -94,7 +96,7 @@ void *try_malloc(size_t size)
|
||||
/// @see {try_malloc}
|
||||
/// @param size
|
||||
/// @return pointer to allocated space. NULL if out of memory
|
||||
void *verbose_try_malloc(size_t size)
|
||||
void *verbose_try_malloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1)
|
||||
{
|
||||
void *ret = try_malloc(size);
|
||||
if (!ret) {
|
||||
@ -112,6 +114,7 @@ void *verbose_try_malloc(size_t size)
|
||||
/// @param size
|
||||
/// @return pointer to allocated space. Never NULL
|
||||
void *xmalloc(size_t size)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
void *ret = try_malloc(size);
|
||||
|
||||
@ -129,6 +132,7 @@ void *xmalloc(size_t size)
|
||||
/// @param size
|
||||
/// @return pointer to allocated space. Never NULL
|
||||
void *xcalloc(size_t count, size_t size)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE_PROD(1, 2) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
void *ret = calloc(count, size);
|
||||
|
||||
@ -155,6 +159,7 @@ void *xcalloc(size_t count, size_t size)
|
||||
/// @param size
|
||||
/// @return pointer to reallocated space. Never NULL
|
||||
void *xrealloc(void *ptr, size_t size)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALLOC_SIZE(2) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
void *ret = realloc(ptr, size);
|
||||
|
||||
@ -296,6 +301,7 @@ size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t size)
|
||||
/// @param str 0-terminated string that will be copied
|
||||
/// @return pointer to a copy of the string
|
||||
char *xstrdup(const char *str)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
char *ret = strdup(str);
|
||||
|
||||
@ -317,6 +323,7 @@ char *xstrdup(const char *str)
|
||||
/// @param str 0-terminated string that will be copied
|
||||
/// @return pointer to a copy of the string
|
||||
char *xstrndup(const char *str, size_t len)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
char *p = memchr(str, '\0', len);
|
||||
return xmemdupz(str, p ? (size_t)(p - str) : len);
|
||||
|
@ -1,43 +1,10 @@
|
||||
#ifndef NVIM_MEMORY_H
|
||||
#define NVIM_MEMORY_H
|
||||
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/types.h"
|
||||
#include <stddef.h>
|
||||
#include "nvim/vim.h"
|
||||
|
||||
void *try_malloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
|
||||
void *verbose_try_malloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
|
||||
void *xmalloc(size_t size)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
void *xcalloc(size_t count, size_t size)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE_PROD(1, 2) FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
void *xrealloc(void *ptr, size_t size)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALLOC_SIZE(2) FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
void *xmallocz(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
void *xmemdupz(const void *data, size_t len) FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
char * xstrdup(const char *str)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
char * xstrndup(const char *str, size_t len)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
char *xstpcpy(char *restrict dst, const char *restrict src);
|
||||
|
||||
char *xstpncpy(char *restrict dst, const char *restrict src, size_t maxlen);
|
||||
|
||||
size_t xstrlcpy(char *restrict dst, const char *restrict src, size_t size);
|
||||
|
||||
void *xmemdup(const void *data, size_t len)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_RET;
|
||||
|
||||
void do_outofmem_msg(size_t size);
|
||||
void free_all_mem(void);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "memory.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MEMORY_H
|
||||
|
@ -32,29 +32,13 @@
|
||||
|
||||
#define MENUDEPTH 10 /* maximum depth of menus */
|
||||
|
||||
static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *);
|
||||
static int menu_nable_recurse(vimmenu_T *menu, char_u *name, int modes,
|
||||
int enable);
|
||||
static int remove_menu(vimmenu_T **, char_u *, int, int silent);
|
||||
static void free_menu(vimmenu_T **menup);
|
||||
static void free_menu_string(vimmenu_T *, int);
|
||||
static int show_menus(char_u *, int);
|
||||
static void show_menus_recursive(vimmenu_T *, int, int);
|
||||
static int menu_name_equal(char_u *name, vimmenu_T *menu);
|
||||
static int menu_namecmp(char_u *name, char_u *mname);
|
||||
static int get_menu_cmd_modes(char_u *, int, int *, int *);
|
||||
static char_u *popup_mode_name(char_u *name, int idx);
|
||||
static char_u *menu_text(char_u *text, int *mnemonic, char_u **actext);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "menu.c.generated.h"
|
||||
#endif
|
||||
|
||||
|
||||
static int menu_is_hidden(char_u *name);
|
||||
static int menu_is_tearoff(char_u *name);
|
||||
|
||||
static char_u *menu_skip_part(char_u *p);
|
||||
static char_u *menutrans_lookup(char_u *name, int len);
|
||||
static void menu_unescape_name(char_u *p);
|
||||
|
||||
static char_u *menu_translate_tab_and_shift(char_u *arg_start);
|
||||
|
||||
/* The character for each menu mode */
|
||||
static char_u menu_mode_chars[] = {'n', 'v', 's', 'o', 'i', 'c', 't'};
|
||||
|
@ -48,18 +48,8 @@ struct VimMenu {
|
||||
vimmenu_T *next; /* Next item in menu */
|
||||
};
|
||||
|
||||
void ex_menu(exarg_T *eap);
|
||||
char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg,
|
||||
int forceit);
|
||||
char_u *get_menu_name(expand_T *xp, int idx);
|
||||
char_u *get_menu_names(expand_T *xp, int idx);
|
||||
char_u *menu_name_skip(char_u *name);
|
||||
int menu_is_menubar(char_u *name);
|
||||
int menu_is_popup(char_u *name);
|
||||
int menu_is_toolbar(char_u *name);
|
||||
int menu_is_separator(char_u *name);
|
||||
void ex_emenu(exarg_T *eap);
|
||||
vimmenu_T *gui_find_menu(char_u *path_name);
|
||||
void ex_menutranslate(exarg_T *eap);
|
||||
|
||||
#endif /* NVIM_MENU_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "menu.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MENU_H
|
||||
|
@ -38,59 +38,24 @@
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/event.h"
|
||||
|
||||
static int other_sourcing_name(void);
|
||||
static char_u *get_emsg_source(void);
|
||||
static char_u *get_emsg_lnum(void);
|
||||
static void add_msg_hist(char_u *s, int len, int attr);
|
||||
static void hit_return_msg(void);
|
||||
static void msg_home_replace_attr(char_u *fname, int attr);
|
||||
static char_u *screen_puts_mbyte(char_u *s, int l, int attr);
|
||||
static void msg_puts_attr_len(char_u *str, int maxlen, int attr);
|
||||
static void msg_puts_display(char_u *str, int maxlen, int attr,
|
||||
int recurse);
|
||||
static void msg_scroll_up(void);
|
||||
static void inc_msg_scrolled(void);
|
||||
static void store_sb_text(char_u **sb_str, char_u *s, int attr,
|
||||
int *sb_col,
|
||||
int finish);
|
||||
static void t_puts(int *t_col, char_u *t_s, char_u *s, int attr);
|
||||
static void msg_puts_printf(char_u *str, int maxlen);
|
||||
static int do_more_prompt(int typed_char);
|
||||
static void msg_screen_putchar(int c, int attr);
|
||||
static int msg_check_screen(void);
|
||||
static void redir_write(char_u *s, int maxlen);
|
||||
/*
|
||||
* To be able to scroll back at the "more" and "hit-enter" prompts we need to
|
||||
* store the displayed text and remember where screen lines start.
|
||||
*/
|
||||
typedef struct msgchunk_S msgchunk_T;
|
||||
struct msgchunk_S {
|
||||
msgchunk_T *sb_next;
|
||||
msgchunk_T *sb_prev;
|
||||
char sb_eol; /* TRUE when line ends after this text */
|
||||
int sb_msg_col; /* column in which text starts */
|
||||
int sb_attr; /* text attributes */
|
||||
char_u sb_text[1]; /* text to be displayed, actually longer */
|
||||
};
|
||||
|
||||
/// Allocates memory for dialog string & for storing hotkeys
|
||||
///
|
||||
/// Finds the size of memory required for the confirm_msg & for storing hotkeys
|
||||
/// and then allocates the memory for them.
|
||||
/// has_hotkey array is also filled-up.
|
||||
///
|
||||
/// @param message Message which will be part of the confirm_msg
|
||||
/// @param buttons String containing button names
|
||||
/// @param[out] has_hotkey A element in this array is set to true if
|
||||
/// corresponding button has a hotkey
|
||||
///
|
||||
/// @return Pointer to memory allocated for storing hotkeys
|
||||
static char_u * console_dialog_alloc(const char_u *message,
|
||||
char_u *buttons,
|
||||
bool has_hotkey[]);
|
||||
|
||||
/// Copies hotkeys & dialog message into the memory allocated for it
|
||||
///
|
||||
/// @param message Message which will be part of the confirm_msg
|
||||
/// @param buttons String containing button names
|
||||
/// @param default_button_idx Number of default button
|
||||
/// @param has_hotkey A element in this array is true if corresponding button
|
||||
/// has a hotkey
|
||||
/// @param[out] hotkeys_ptr Pointer to the memory location where hotkeys will be copied
|
||||
static void copy_hotkeys_and_msg(const char_u *message, char_u *buttons,
|
||||
int default_button_idx, const bool has_hotkey[],
|
||||
char_u *hotkeys_ptr);
|
||||
|
||||
static char_u *msg_show_console_dialog(char_u *message, char_u *buttons,
|
||||
int dfltbutton);
|
||||
static int confirm_msg_used = FALSE; /* displaying confirm_msg */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "message.c.generated.h"
|
||||
#endif
|
||||
static char_u *confirm_msg = NULL; /* ":confirm" message */
|
||||
static char_u *confirm_msg_tail; /* tail of confirm_msg */
|
||||
|
||||
@ -352,7 +317,6 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
||||
* Note: Caller of smgs() and smsg_attr() must check the resulting string is
|
||||
* shorter than IOSIZE!!!
|
||||
*/
|
||||
int vim_snprintf(char *str, size_t str_m, char *fmt, ...);
|
||||
|
||||
int smsg(char_u *s, ...)
|
||||
{
|
||||
@ -1845,24 +1809,8 @@ static void inc_msg_scrolled(void)
|
||||
++msg_scrolled;
|
||||
}
|
||||
|
||||
/*
|
||||
* To be able to scroll back at the "more" and "hit-enter" prompts we need to
|
||||
* store the displayed text and remember where screen lines start.
|
||||
*/
|
||||
typedef struct msgchunk_S msgchunk_T;
|
||||
struct msgchunk_S {
|
||||
msgchunk_T *sb_next;
|
||||
msgchunk_T *sb_prev;
|
||||
char sb_eol; /* TRUE when line ends after this text */
|
||||
int sb_msg_col; /* column in which text starts */
|
||||
int sb_attr; /* text attributes */
|
||||
char_u sb_text[1]; /* text to be displayed, actually longer */
|
||||
};
|
||||
|
||||
static msgchunk_T *last_msgchunk = NULL; /* last displayed text */
|
||||
|
||||
static msgchunk_T *msg_sb_start(msgchunk_T *mps);
|
||||
static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp);
|
||||
|
||||
static int do_clear_sb_text = FALSE; /* clear text on next msg */
|
||||
|
||||
@ -2274,7 +2222,7 @@ static int do_more_prompt(int typed_char)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if defined(USE_MCH_ERRMSG) || defined(PROTO)
|
||||
#if defined(USE_MCH_ERRMSG)
|
||||
|
||||
#ifdef mch_errmsg
|
||||
# undef mch_errmsg
|
||||
@ -2817,7 +2765,6 @@ do_dialog (
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int copy_char(char_u *from, char_u *to, int lowercase);
|
||||
|
||||
/*
|
||||
* Copy one character from "*from" to "*to", taking care of multi-byte
|
||||
@ -2854,6 +2801,18 @@ copy_char (
|
||||
#define HAS_HOTKEY_LEN 30
|
||||
#define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1)
|
||||
|
||||
/// Allocates memory for dialog string & for storing hotkeys
|
||||
///
|
||||
/// Finds the size of memory required for the confirm_msg & for storing hotkeys
|
||||
/// and then allocates the memory for them.
|
||||
/// has_hotkey array is also filled-up.
|
||||
///
|
||||
/// @param message Message which will be part of the confirm_msg
|
||||
/// @param buttons String containing button names
|
||||
/// @param[out] has_hotkey A element in this array is set to true if
|
||||
/// corresponding button has a hotkey
|
||||
///
|
||||
/// @return Pointer to memory allocated for storing hotkeys
|
||||
static char_u * console_dialog_alloc(const char_u *message,
|
||||
char_u *buttons,
|
||||
bool has_hotkey[])
|
||||
@ -2924,6 +2883,14 @@ static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfl
|
||||
return hotk;
|
||||
}
|
||||
|
||||
/// Copies hotkeys & dialog message into the memory allocated for it
|
||||
///
|
||||
/// @param message Message which will be part of the confirm_msg
|
||||
/// @param buttons String containing button names
|
||||
/// @param default_button_idx Number of default button
|
||||
/// @param has_hotkey A element in this array is true if corresponding button
|
||||
/// has a hotkey
|
||||
/// @param[out] hotkeys_ptr Pointer to the memory location where hotkeys will be copied
|
||||
static void copy_hotkeys_and_msg(const char_u *message, char_u *buttons,
|
||||
int default_button_idx, const bool has_hotkey[],
|
||||
char_u *hotkeys_ptr)
|
||||
|
@ -1,85 +1,7 @@
|
||||
#ifndef NVIM_MESSAGE_H
|
||||
#define NVIM_MESSAGE_H
|
||||
/* message.c */
|
||||
int msg(char_u *s);
|
||||
int verb_msg(char_u *s);
|
||||
int msg_attr(char_u *s, int attr);
|
||||
int msg_attr_keep(char_u *s, int attr, int keep);
|
||||
char_u *msg_strtrunc(char_u *s, int force);
|
||||
void trunc_string(char_u *s, char_u *buf, int room, int buflen);
|
||||
void reset_last_sourcing(void);
|
||||
void msg_source(int attr);
|
||||
int emsg_not_now(void);
|
||||
int emsg(char_u *s);
|
||||
int emsg2(char_u *s, char_u *a1);
|
||||
void emsg_invreg(int name);
|
||||
char_u *msg_trunc_attr(char_u *s, int force, int attr);
|
||||
char_u *msg_may_trunc(int force, char_u *s);
|
||||
int delete_first_msg(void);
|
||||
void ex_messages(exarg_T *eap);
|
||||
void msg_end_prompt(void);
|
||||
void wait_return(int redraw);
|
||||
void set_keep_msg(char_u *s, int attr);
|
||||
void set_keep_msg_from_hist(void);
|
||||
void msg_start(void);
|
||||
void msg_starthere(void);
|
||||
void msg_putchar(int c);
|
||||
void msg_putchar_attr(int c, int attr);
|
||||
void msg_outnum(long n);
|
||||
void msg_home_replace(char_u *fname);
|
||||
void msg_home_replace_hl(char_u *fname);
|
||||
int msg_outtrans(char_u *str);
|
||||
int msg_outtrans_attr(char_u *str, int attr);
|
||||
int msg_outtrans_len(char_u *str, int len);
|
||||
char_u *msg_outtrans_one(char_u *p, int attr);
|
||||
int msg_outtrans_len_attr(char_u *msgstr, int len, int attr);
|
||||
void msg_make(char_u *arg);
|
||||
int msg_outtrans_special(char_u *strstart, int from);
|
||||
char_u *str2special_save(char_u *str, int is_lhs);
|
||||
char_u *str2special(char_u **sp, int from);
|
||||
void str2specialbuf(char_u *sp, char_u *buf, int len);
|
||||
void msg_prt_line(char_u *s, int list);
|
||||
void msg_puts(char_u *s);
|
||||
void msg_puts_title(char_u *s);
|
||||
void msg_puts_long_attr(char_u *longstr, int attr);
|
||||
void msg_puts_long_len_attr(char_u *longstr, int len, int attr);
|
||||
void msg_puts_attr(char_u *s, int attr);
|
||||
void may_clear_sb_text(void);
|
||||
void clear_sb_text(void);
|
||||
void show_sb_text(void);
|
||||
void msg_sb_eol(void);
|
||||
int msg_use_printf(void);
|
||||
#ifdef USE_MCH_ERRMSG
|
||||
void mch_errmsg(char *str);
|
||||
void mch_msg(char *str);
|
||||
#endif
|
||||
void msg_moremsg(int full);
|
||||
void repeat_message(void);
|
||||
void msg_clr_eos(void);
|
||||
void msg_clr_eos_force(void);
|
||||
void msg_clr_cmdline(void);
|
||||
int msg_end(void);
|
||||
void msg_check(void);
|
||||
int redirecting(void);
|
||||
void verbose_enter(void);
|
||||
void verbose_leave(void);
|
||||
void verbose_enter_scroll(void);
|
||||
void verbose_leave_scroll(void);
|
||||
void verbose_stop(void);
|
||||
int verbose_open(void);
|
||||
void give_warning(char_u *message, int hl);
|
||||
void msg_advance(int col);
|
||||
int do_dialog(int type, char_u *title, char_u *message, char_u *buttons,
|
||||
int dfltbutton, char_u *textfield,
|
||||
int ex_cmd);
|
||||
void display_confirm_msg(void);
|
||||
int vim_dialog_yesno(int type, char_u *title, char_u *message, int dflt);
|
||||
int vim_dialog_yesnocancel(int type, char_u *title, char_u *message,
|
||||
int dflt);
|
||||
int vim_dialog_yesnoallcancel(int type, char_u *title, char_u *message,
|
||||
int dflt);
|
||||
char_u *do_browse(int flags, char_u *title, char_u *dflt, char_u *ext,
|
||||
char_u *initdir, char_u *filter,
|
||||
buf_T *buf);
|
||||
|
||||
#endif /* NVIM_MESSAGE_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "message.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MESSAGE_H
|
||||
|
@ -52,10 +52,10 @@
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/shell.h"
|
||||
static char_u *vim_version_dir(char_u *vimdir);
|
||||
static char_u *remove_tail(char_u *p, char_u *pend, char_u *name);
|
||||
static void init_users(void);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "misc1.c.generated.h"
|
||||
#endif
|
||||
/* All user names (for ~user completion as done by shell). */
|
||||
static garray_T ga_users;
|
||||
|
||||
@ -1855,11 +1855,6 @@ void changed_int(void)
|
||||
need_maketitle = TRUE; /* set window title later */
|
||||
}
|
||||
|
||||
static void changedOneline(buf_T *buf, linenr_T lnum);
|
||||
static void changed_lines_buf(buf_T *buf, linenr_T lnum, linenr_T lnume,
|
||||
long xtra);
|
||||
static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume,
|
||||
long xtra);
|
||||
|
||||
/*
|
||||
* Changed bytes within a single line for the current buffer.
|
||||
|
@ -3,72 +3,7 @@
|
||||
|
||||
#include "nvim/vim.h"
|
||||
|
||||
int open_line(int dir, int flags, int second_line_indent);
|
||||
int get_leader_len(char_u *line, char_u **flags, int backward,
|
||||
int include_space);
|
||||
int get_last_leader_offset(char_u *line, char_u **flags);
|
||||
int plines(linenr_T lnum);
|
||||
int plines_win(win_T *wp, linenr_T lnum, int winheight);
|
||||
int plines_nofill(linenr_T lnum);
|
||||
int plines_win_nofill(win_T *wp, linenr_T lnum, int winheight);
|
||||
int plines_win_nofold(win_T *wp, linenr_T lnum);
|
||||
int plines_win_col(win_T *wp, linenr_T lnum, long column);
|
||||
int plines_m_win(win_T *wp, linenr_T first, linenr_T last);
|
||||
void ins_bytes(char_u *p);
|
||||
void ins_bytes_len(char_u *p, int len);
|
||||
void ins_char(int c);
|
||||
void ins_char_bytes(char_u *buf, int charlen);
|
||||
void ins_str(char_u *s);
|
||||
int del_char(int fixpos);
|
||||
int del_chars(long count, int fixpos);
|
||||
int del_bytes(long count, int fixpos_arg, int use_delcombine);
|
||||
void truncate_line(int fixpos);
|
||||
void del_lines(long nlines, int undo);
|
||||
int gchar_pos(pos_T *pos);
|
||||
char_u *skip_to_option_part(char_u *p);
|
||||
void changed(void);
|
||||
void changed_int(void);
|
||||
void changed_bytes(linenr_T lnum, colnr_T col);
|
||||
void appended_lines(linenr_T lnum, long count);
|
||||
void appended_lines_mark(linenr_T lnum, long count);
|
||||
void deleted_lines(linenr_T lnum, long count);
|
||||
void deleted_lines_mark(linenr_T lnum, long count);
|
||||
void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume,
|
||||
long xtra);
|
||||
void unchanged(buf_T *buf, int ff);
|
||||
void check_status(buf_T *buf);
|
||||
void change_warning(int col);
|
||||
int ask_yesno(char_u *str, int direct);
|
||||
int is_mouse_key(int c);
|
||||
int get_keystroke(void);
|
||||
int get_number(int colon, int *mouse_used);
|
||||
int prompt_for_number(int *mouse_used);
|
||||
void msgmore(long n);
|
||||
void beep_flush(void);
|
||||
void vim_beep(void);
|
||||
void init_homedir(void);
|
||||
void free_homedir(void);
|
||||
void free_users(void);
|
||||
char_u *expand_env_save(char_u *src);
|
||||
char_u *expand_env_save_opt(char_u *src, int one);
|
||||
void expand_env(char_u *src, char_u *dst, int dstlen);
|
||||
void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, int esc,
|
||||
int one,
|
||||
char_u *startstr);
|
||||
char_u *vim_getenv(char_u *name, int *mustfree);
|
||||
void vim_setenv(char_u *name, char_u *val);
|
||||
char_u *get_env_name(expand_T *xp, int idx);
|
||||
char_u *get_users(expand_T *xp, int idx);
|
||||
int match_user(char_u *name);
|
||||
void home_replace(buf_T *buf, char_u *src, char_u *dst, int dstlen,
|
||||
int one);
|
||||
char_u *home_replace_save(buf_T *buf, char_u *src);
|
||||
void prepare_to_exit(void);
|
||||
void preserve_exit(void);
|
||||
void line_breakcheck(void);
|
||||
void fast_breakcheck(void);
|
||||
char_u *get_cmd_output(char_u *cmd, char_u *infile, int flags);
|
||||
void FreeWild(int count, char_u **files);
|
||||
int goto_im(void);
|
||||
|
||||
#endif /* NVIM_MISC1_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "misc1.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MISC1_H
|
||||
|
@ -52,6 +52,9 @@
|
||||
#include "nvim/os/os.h"
|
||||
#include "nvim/os/shell.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "misc2.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* Return TRUE if in the current mode we need to use virtual.
|
||||
*/
|
||||
|
@ -4,34 +4,7 @@
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/os/shell.h"
|
||||
|
||||
/* misc2.c */
|
||||
int virtual_active(void);
|
||||
int inc(pos_T *lp);
|
||||
int incl(pos_T *lp);
|
||||
int dec(pos_T *lp);
|
||||
int decl(pos_T *lp);
|
||||
int csh_like_shell(void);
|
||||
int copy_option_part(char_u **option, char_u *buf, int maxlen,
|
||||
char *sep_chars);
|
||||
int get_fileformat(buf_T *buf);
|
||||
int get_fileformat_force(buf_T *buf, exarg_T *eap);
|
||||
void set_fileformat(int t, int opt_flags);
|
||||
int default_fileformat(void);
|
||||
int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg);
|
||||
int get_real_state(void);
|
||||
int vim_chdirfile(char_u *fname);
|
||||
int illegal_slash(char *name);
|
||||
int vim_chdir(char_u *new_dir);
|
||||
int emsg3(char_u *s, char_u *a1, char_u *a2);
|
||||
int emsgn(char_u *s, int64_t n);
|
||||
int emsgu(char_u *s, uint64_t n);
|
||||
int get2c(FILE *fd);
|
||||
int get3c(FILE *fd);
|
||||
int get4c(FILE *fd);
|
||||
time_t get8ctime(FILE *fd);
|
||||
char_u *read_string(FILE *fd, int cnt);
|
||||
int put_bytes(FILE *fd, long_u nr, int len);
|
||||
void put_time(FILE *fd, time_t the_time);
|
||||
int has_non_ascii(char_u *s);
|
||||
|
||||
#endif /* NVIM_MISC2_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "misc2.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MISC2_H
|
||||
|
@ -31,25 +31,16 @@
|
||||
#include "nvim/screen.h"
|
||||
#include "nvim/strings.h"
|
||||
|
||||
static void comp_botline(win_T *wp);
|
||||
static void redraw_for_cursorline(win_T *wp);
|
||||
static int scrolljump_value(void);
|
||||
static int check_top_offset(void);
|
||||
static void curs_rows(win_T *wp, int do_botline);
|
||||
static void validate_botline_win(win_T *wp);
|
||||
static void validate_cheight(void);
|
||||
|
||||
typedef struct {
|
||||
linenr_T lnum; /* line number */
|
||||
int fill; /* filler lines */
|
||||
int height; /* height of added line */
|
||||
} lineoff_T;
|
||||
|
||||
static void topline_back(lineoff_T *lp);
|
||||
static void botline_forw(lineoff_T *lp);
|
||||
static void botline_topline(lineoff_T *lp);
|
||||
static void topline_botline(lineoff_T *lp);
|
||||
static void max_topfill(void);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "move.c.generated.h"
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Compute wp->w_botline for the current wp->w_topline. Can be called after
|
||||
@ -1775,7 +1766,6 @@ void cursor_correct(void)
|
||||
curwin->w_valid |= VALID_TOPLINE;
|
||||
}
|
||||
|
||||
static void get_scroll_overlap(lineoff_T *lp, int dir);
|
||||
|
||||
/*
|
||||
* move screen 'count' pages up or down and update screen
|
||||
|
@ -1,43 +1,7 @@
|
||||
#ifndef NVIM_MOVE_H
|
||||
#define NVIM_MOVE_H
|
||||
/* move.c */
|
||||
void update_topline_redraw(void);
|
||||
void update_topline(void);
|
||||
void update_curswant(void);
|
||||
void check_cursor_moved(win_T *wp);
|
||||
void changed_window_setting(void);
|
||||
void changed_window_setting_win(win_T *wp);
|
||||
void set_topline(win_T *wp, linenr_T lnum);
|
||||
void changed_cline_bef_curs(void);
|
||||
void changed_cline_bef_curs_win(win_T *wp);
|
||||
void changed_line_abv_curs(void);
|
||||
void changed_line_abv_curs_win(win_T *wp);
|
||||
void validate_botline(void);
|
||||
void invalidate_botline(void);
|
||||
void invalidate_botline_win(win_T *wp);
|
||||
void approximate_botline_win(win_T *wp);
|
||||
int cursor_valid(void);
|
||||
void validate_cursor(void);
|
||||
void validate_virtcol(void);
|
||||
void validate_virtcol_win(win_T *wp);
|
||||
void validate_cursor_col(void);
|
||||
int win_col_off(win_T *wp);
|
||||
int curwin_col_off(void);
|
||||
int win_col_off2(win_T *wp);
|
||||
int curwin_col_off2(void);
|
||||
void curs_columns(int may_scroll);
|
||||
void scrolldown(long line_count, int byfold);
|
||||
void scrollup(long line_count, int byfold);
|
||||
void check_topfill(win_T *wp, int down);
|
||||
void scrolldown_clamp(void);
|
||||
void scrollup_clamp(void);
|
||||
void scroll_cursor_top(int min_scroll, int always);
|
||||
void set_empty_rows(win_T *wp, int used);
|
||||
void scroll_cursor_bot(int min_scroll, int set_topbot);
|
||||
void scroll_cursor_halfway(int atend);
|
||||
void cursor_correct(void);
|
||||
int onepage(int dir, long count);
|
||||
void halfpage(int flag, linenr_T Prenum);
|
||||
void do_check_cursorbind(void);
|
||||
|
||||
#endif /* NVIM_MOVE_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "move.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_MOVE_H
|
||||
|
@ -67,119 +67,15 @@ static int VIsual_mode_orig = NUL; /* saved Visual mode */
|
||||
|
||||
static int restart_VIsual_select = 0;
|
||||
|
||||
static void set_vcount_ca(cmdarg_T *cap, int *set_prevcount);
|
||||
static int
|
||||
nv_compare(const void *s1, const void *s2);
|
||||
static int find_command(int cmdchar);
|
||||
static void op_colon(oparg_T *oap);
|
||||
static void op_function(oparg_T *oap);
|
||||
static void find_start_of_word(pos_T *);
|
||||
static void find_end_of_word(pos_T *);
|
||||
static int get_mouse_class(char_u *p);
|
||||
static void prep_redo_cmd(cmdarg_T *cap);
|
||||
static void prep_redo(int regname, long, int, int, int, int, int);
|
||||
static int checkclearop(oparg_T *oap);
|
||||
static int checkclearopq(oparg_T *oap);
|
||||
static void clearop(oparg_T *oap);
|
||||
static void clearopbeep(oparg_T *oap);
|
||||
static void unshift_special(cmdarg_T *cap);
|
||||
static void del_from_showcmd(int);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "normal.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* nv_*(): functions called to handle Normal and Visual mode commands.
|
||||
* n_*(): functions called to handle Normal mode commands.
|
||||
* v_*(): functions called to handle Visual mode commands.
|
||||
*/
|
||||
static void nv_ignore(cmdarg_T *cap);
|
||||
static void nv_nop(cmdarg_T *cap);
|
||||
static void nv_error(cmdarg_T *cap);
|
||||
static void nv_help(cmdarg_T *cap);
|
||||
static void nv_addsub(cmdarg_T *cap);
|
||||
static void nv_page(cmdarg_T *cap);
|
||||
static void nv_gd(oparg_T *oap, int nchar, int thisblock);
|
||||
static int nv_screengo(oparg_T *oap, int dir, long dist);
|
||||
static void nv_mousescroll(cmdarg_T *cap);
|
||||
static void nv_mouse(cmdarg_T *cap);
|
||||
static void nv_scroll_line(cmdarg_T *cap);
|
||||
static void nv_zet(cmdarg_T *cap);
|
||||
static void nv_exmode(cmdarg_T *cap);
|
||||
static void nv_colon(cmdarg_T *cap);
|
||||
static void nv_ctrlg(cmdarg_T *cap);
|
||||
static void nv_ctrlh(cmdarg_T *cap);
|
||||
static void nv_clear(cmdarg_T *cap);
|
||||
static void nv_ctrlo(cmdarg_T *cap);
|
||||
static void nv_hat(cmdarg_T *cap);
|
||||
static void nv_Zet(cmdarg_T *cap);
|
||||
static void nv_ident(cmdarg_T *cap);
|
||||
static void nv_tagpop(cmdarg_T *cap);
|
||||
static void nv_scroll(cmdarg_T *cap);
|
||||
static void nv_right(cmdarg_T *cap);
|
||||
static void nv_left(cmdarg_T *cap);
|
||||
static void nv_up(cmdarg_T *cap);
|
||||
static void nv_down(cmdarg_T *cap);
|
||||
static void nv_gotofile(cmdarg_T *cap);
|
||||
static void nv_end(cmdarg_T *cap);
|
||||
static void nv_dollar(cmdarg_T *cap);
|
||||
static void nv_search(cmdarg_T *cap);
|
||||
static void nv_next(cmdarg_T *cap);
|
||||
static void normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt);
|
||||
static void nv_csearch(cmdarg_T *cap);
|
||||
static void nv_brackets(cmdarg_T *cap);
|
||||
static void nv_percent(cmdarg_T *cap);
|
||||
static void nv_brace(cmdarg_T *cap);
|
||||
static void nv_mark(cmdarg_T *cap);
|
||||
static void nv_findpar(cmdarg_T *cap);
|
||||
static void nv_undo(cmdarg_T *cap);
|
||||
static void nv_kundo(cmdarg_T *cap);
|
||||
static void nv_Replace(cmdarg_T *cap);
|
||||
static void nv_vreplace(cmdarg_T *cap);
|
||||
static void v_swap_corners(int cmdchar);
|
||||
static void nv_replace(cmdarg_T *cap);
|
||||
static void n_swapchar(cmdarg_T *cap);
|
||||
static void nv_cursormark(cmdarg_T *cap, int flag, pos_T *pos);
|
||||
static void v_visop(cmdarg_T *cap);
|
||||
static void nv_subst(cmdarg_T *cap);
|
||||
static void nv_abbrev(cmdarg_T *cap);
|
||||
static void nv_optrans(cmdarg_T *cap);
|
||||
static void nv_gomark(cmdarg_T *cap);
|
||||
static void nv_pcmark(cmdarg_T *cap);
|
||||
static void nv_regname(cmdarg_T *cap);
|
||||
static void nv_visual(cmdarg_T *cap);
|
||||
static void n_start_visual_mode(int c);
|
||||
static void nv_window(cmdarg_T *cap);
|
||||
static void nv_suspend(cmdarg_T *cap);
|
||||
static void nv_g_cmd(cmdarg_T *cap);
|
||||
static void n_opencmd(cmdarg_T *cap);
|
||||
static void nv_dot(cmdarg_T *cap);
|
||||
static void nv_redo(cmdarg_T *cap);
|
||||
static void nv_Undo(cmdarg_T *cap);
|
||||
static void nv_tilde(cmdarg_T *cap);
|
||||
static void nv_operator(cmdarg_T *cap);
|
||||
static void set_op_var(int optype);
|
||||
static void nv_lineop(cmdarg_T *cap);
|
||||
static void nv_home(cmdarg_T *cap);
|
||||
static void nv_pipe(cmdarg_T *cap);
|
||||
static void nv_bck_word(cmdarg_T *cap);
|
||||
static void nv_wordcmd(cmdarg_T *cap);
|
||||
static void nv_beginline(cmdarg_T *cap);
|
||||
static void adjust_cursor(oparg_T *oap);
|
||||
static void adjust_for_sel(cmdarg_T *cap);
|
||||
static int unadjust_for_sel(void);
|
||||
static void nv_select(cmdarg_T *cap);
|
||||
static void nv_goto(cmdarg_T *cap);
|
||||
static void nv_normal(cmdarg_T *cap);
|
||||
static void nv_esc(cmdarg_T *oap);
|
||||
static void nv_edit(cmdarg_T *cap);
|
||||
static void invoke_edit(cmdarg_T *cap, int repl, int cmd, int startln);
|
||||
static void nv_object(cmdarg_T *cap);
|
||||
static void nv_record(cmdarg_T *cap);
|
||||
static void nv_at(cmdarg_T *cap);
|
||||
static void nv_halfpage(cmdarg_T *cap);
|
||||
static void nv_join(cmdarg_T *cap);
|
||||
static void nv_put(cmdarg_T *cap);
|
||||
static void nv_open(cmdarg_T *cap);
|
||||
static void nv_cursorhold(cmdarg_T *cap);
|
||||
static void nv_event(cmdarg_T *cap);
|
||||
|
||||
static char *e_noident = N_("E349: No identifier under cursor");
|
||||
|
||||
@ -2938,7 +2834,6 @@ static char_u old_showcmd_buf[SHOWCMD_BUFLEN]; /* For push_showcmd() */
|
||||
static int showcmd_is_clear = TRUE;
|
||||
static int showcmd_visual = FALSE;
|
||||
|
||||
static void display_showcmd(void);
|
||||
|
||||
void clear_showcmd(void)
|
||||
{
|
||||
|
@ -56,31 +56,8 @@ typedef struct cmdarg_S {
|
||||
#define CA_COMMAND_BUSY 1 /* skip restarting edit() once */
|
||||
#define CA_NO_ADJ_OP_END 2 /* don't adjust operator end */
|
||||
|
||||
void init_normal_cmds(void);
|
||||
void normal_cmd(oparg_T *oap, int toplevel);
|
||||
void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank);
|
||||
int do_mouse(oparg_T *oap, int c, int dir, long count, int fixindent);
|
||||
void check_visual_highlight(void);
|
||||
void end_visual_mode(void);
|
||||
void reset_VIsual_and_resel(void);
|
||||
void reset_VIsual(void);
|
||||
int find_ident_under_cursor(char_u **string, int find_type);
|
||||
int find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol,
|
||||
char_u **string,
|
||||
int find_type);
|
||||
void clear_showcmd(void);
|
||||
int add_to_showcmd(int c);
|
||||
void add_to_showcmd_c(int c);
|
||||
void push_showcmd(void);
|
||||
void pop_showcmd(void);
|
||||
void do_check_scrollbind(int check);
|
||||
void check_scrollbind(linenr_T topline_diff, long leftcol_diff);
|
||||
int find_decl(char_u *ptr, int len, int locally, int thisblock,
|
||||
int searchflags);
|
||||
void scroll_redraw(int up, long count);
|
||||
void do_nv_ident(int c1, int c2);
|
||||
int get_visual_text(cmdarg_T *cap, char_u **pp, int *lenp);
|
||||
void start_selection(void);
|
||||
void may_start_select(int c);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "normal.h.generated.h"
|
||||
#endif
|
||||
#endif /* NVIM_NORMAL_H */
|
||||
|
@ -90,30 +90,10 @@ struct block_def {
|
||||
colnr_T start_char_vcols; /* number of vcols of pre-block char */
|
||||
};
|
||||
|
||||
static void shift_block(oparg_T *oap, int amount);
|
||||
static void block_insert(oparg_T *oap, char_u *s, int b_insert,
|
||||
struct block_def*bdp);
|
||||
static int stuff_yank(int, char_u *);
|
||||
static void put_reedit_in_typebuf(int silent);
|
||||
static int put_in_typebuf(char_u *s, int esc, int colon,
|
||||
int silent);
|
||||
static void stuffescaped(char_u *arg, int literally);
|
||||
static void mb_adjust_opend(oparg_T *oap);
|
||||
static void free_yank(long);
|
||||
static void free_yank_all(void);
|
||||
static void yank_copy_line(struct block_def *bd, long y_idx);
|
||||
static void dis_msg(char_u *p, int skip_esc);
|
||||
static char_u *skip_comment(char_u *line, int process,
|
||||
int include_space,
|
||||
int *is_comment);
|
||||
static void block_prep(oparg_T *oap, struct block_def *, linenr_T, int);
|
||||
static void str_to_reg(struct yankreg *y_ptr, int type, char_u *str,
|
||||
long len,
|
||||
long blocklen);
|
||||
static int ends_in_white(linenr_T lnum);
|
||||
static int same_leader(linenr_T lnum, int, char_u *, int, char_u *);
|
||||
static int fmt_check_par(linenr_T, int *, char_u **, int do_comments);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ops.c.generated.h"
|
||||
#endif
|
||||
/*
|
||||
* The names of operators.
|
||||
* IMPORTANT: Index must correspond with defines in vim.h!!!
|
||||
@ -566,9 +546,7 @@ static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def
|
||||
/*
|
||||
* op_reindent - handle reindenting a block of lines.
|
||||
*/
|
||||
void op_reindent(oap, how)
|
||||
oparg_T *oap;
|
||||
int (*how)(void);
|
||||
void op_reindent(oparg_T *oap, Indenter how)
|
||||
{
|
||||
long i;
|
||||
char_u *l;
|
||||
@ -778,7 +756,7 @@ void *
|
||||
get_register (
|
||||
int name,
|
||||
int copy /* make a copy, if FALSE make register empty. */
|
||||
)
|
||||
) FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
get_yank_register(name, 0);
|
||||
|
||||
@ -1861,7 +1839,6 @@ int op_replace(oparg_T *oap, int c)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int swapchars(int op_type, pos_T *pos, int length);
|
||||
|
||||
/*
|
||||
* Handle the (non-standard vi) tilde operator. Also for "gu", "gU" and "g?".
|
||||
@ -4193,7 +4170,6 @@ static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int i
|
||||
bdp->textstart = pstart;
|
||||
}
|
||||
|
||||
static void reverse_line(char_u *s);
|
||||
|
||||
static void reverse_line(char_u *s)
|
||||
{
|
||||
@ -4903,9 +4879,6 @@ void clear_oparg(oparg_T *oap)
|
||||
memset(oap, 0, sizeof(oparg_T));
|
||||
}
|
||||
|
||||
static long line_count_info(char_u *line, long *wc, long *cc,
|
||||
long limit,
|
||||
int eol_size);
|
||||
|
||||
/*
|
||||
* Count the number of bytes, characters and "words" in a line.
|
||||
|
@ -4,63 +4,9 @@
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/types.h"
|
||||
|
||||
/* ops.c */
|
||||
int get_op_type(int char1, int char2);
|
||||
int op_on_lines(int op);
|
||||
int get_op_char(int optype);
|
||||
int get_extra_op_char(int optype);
|
||||
void op_shift(oparg_T *oap, int curs_top, int amount);
|
||||
void shift_line(int left, int round, int amount, int call_changed_bytes);
|
||||
void op_reindent(oparg_T *oap, int (*how)(void));
|
||||
int get_expr_register(void);
|
||||
void set_expr_line(char_u *new_line);
|
||||
char_u *get_expr_line(void);
|
||||
char_u *get_expr_line_src(void);
|
||||
int valid_yank_reg(int regname, int writing);
|
||||
void get_yank_register(int regname, int writing);
|
||||
void *get_register(int name, int copy) FUNC_ATTR_NONNULL_RET;
|
||||
void put_register(int name, void *reg);
|
||||
int yank_register_mline(int regname);
|
||||
int do_record(int c);
|
||||
int do_execreg(int regname, int colon, int addcr, int silent);
|
||||
int insert_reg(int regname, int literally);
|
||||
int get_spec_reg(int regname, char_u **argp, int *allocated, int errmsg);
|
||||
int cmdline_paste_reg(int regname, int literally, int remcr);
|
||||
int op_delete(oparg_T *oap);
|
||||
int op_replace(oparg_T *oap, int c);
|
||||
void op_tilde(oparg_T *oap);
|
||||
int swapchar(int op_type, pos_T *pos);
|
||||
void op_insert(oparg_T *oap, long count1);
|
||||
int op_change(oparg_T *oap);
|
||||
void init_yank(void);
|
||||
void clear_registers(void);
|
||||
int op_yank(oparg_T *oap, int deleting, int mess);
|
||||
void do_put(int regname, int dir, long count, int flags);
|
||||
void adjust_cursor_eol(void);
|
||||
int preprocs_left(void);
|
||||
int get_register_name(int num);
|
||||
void ex_display(exarg_T *eap);
|
||||
int do_join(long count,
|
||||
int insert_space,
|
||||
int save_undo,
|
||||
int use_formatoptions,
|
||||
bool setmark);
|
||||
void op_format(oparg_T *oap, int keep_cursor);
|
||||
void op_formatexpr(oparg_T *oap);
|
||||
int fex_format(linenr_T lnum, long count, int c);
|
||||
void format_lines(linenr_T line_count, int avoid_fex);
|
||||
int paragraph_start(linenr_T lnum);
|
||||
int do_addsub(int command, linenr_T Prenum1);
|
||||
int read_viminfo_register(vir_T *virp, int force);
|
||||
void write_viminfo_registers(FILE *fp);
|
||||
char_u get_reg_type(int regname, long *reglen);
|
||||
char_u *get_reg_contents(int regname, int allowexpr, int expr_src);
|
||||
void write_reg_contents(int name, char_u *str, int maxlen,
|
||||
int must_append);
|
||||
void write_reg_contents_ex(int name, char_u *str, int maxlen,
|
||||
int must_append, int yank_type,
|
||||
long block_len);
|
||||
void clear_oparg(oparg_T *oap);
|
||||
void cursor_pos_info(void);
|
||||
typedef int (*Indenter)(void);
|
||||
|
||||
#endif /* NVIM_OPS_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "ops.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_OPS_H
|
||||
|
@ -1838,59 +1838,9 @@ static char *(p_fdm_values[]) = {"manual", "expr", "marker", "indent", "syntax",
|
||||
static char *(p_fcl_values[]) = {"all", NULL};
|
||||
static char *(p_cot_values[]) = {"menu", "menuone", "longest", "preview", NULL};
|
||||
|
||||
static void set_option_default(int, int opt_flags, int compatible);
|
||||
static void set_options_default(int opt_flags);
|
||||
static char_u *term_bg_default(void);
|
||||
static void did_set_option(int opt_idx, int opt_flags, int new_value);
|
||||
static char_u *illegal_char(char_u *, int);
|
||||
static int string_to_key(char_u *arg);
|
||||
static char_u *check_cedit(void);
|
||||
static void did_set_title(int icon);
|
||||
static char_u *option_expand(int opt_idx, char_u *val);
|
||||
static void didset_options(void);
|
||||
static void check_string_option(char_u **pp);
|
||||
static long_u *insecure_flag(int opt_idx, int opt_flags);
|
||||
static void set_string_option_global(int opt_idx, char_u **varp);
|
||||
static char_u *set_string_option(int opt_idx, char_u *value,
|
||||
int opt_flags);
|
||||
static char_u *did_set_string_option(int opt_idx, char_u **varp,
|
||||
int new_value_alloced,
|
||||
char_u *oldval, char_u *errbuf,
|
||||
int opt_flags);
|
||||
static char_u *set_chars_option(char_u **varp);
|
||||
static int int_cmp(const void *a, const void *b);
|
||||
static char_u *compile_cap_prog(synblock_T *synblock);
|
||||
static void set_option_scriptID_idx(int opt_idx, int opt_flags, int id);
|
||||
static char_u *set_bool_option(int opt_idx, char_u *varp, int value,
|
||||
int opt_flags);
|
||||
static char_u *set_num_option(int opt_idx, char_u *varp, long value,
|
||||
char_u *errbuf, size_t errbuflen,
|
||||
int opt_flags);
|
||||
static void check_redraw(long_u flags);
|
||||
static int findoption(char_u *);
|
||||
static int find_key_option(char_u *);
|
||||
static void showoptions(int all, int opt_flags);
|
||||
static int optval_default(struct vimoption *, char_u *varp);
|
||||
static void showoneopt(struct vimoption *, int opt_flags);
|
||||
static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep,
|
||||
int expand);
|
||||
static int put_setnum(FILE *fd, char *cmd, char *name, long *valuep);
|
||||
static int put_setbool(FILE *fd, char *cmd, char *name, int value);
|
||||
static int istermoption(struct vimoption *);
|
||||
static char_u *get_varp_scope(struct vimoption *p, int opt_flags);
|
||||
static char_u *get_varp(struct vimoption *);
|
||||
static void option_value2string(struct vimoption *, int opt_flags);
|
||||
static int wc_use_keyname(char_u *varp, long *wcp);
|
||||
static void langmap_init(void);
|
||||
static void langmap_set(void);
|
||||
static void paste_option_changed(void);
|
||||
static void compatible_set(void);
|
||||
static void fill_breakat_flags(void);
|
||||
static int opt_strings_flags(char_u *val, char **values,
|
||||
unsigned *flagp,
|
||||
int list);
|
||||
static int check_opt_strings(char_u *val, char **values, int);
|
||||
static int check_opt_wim(void);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "option.c.generated.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the options, first part.
|
||||
@ -3688,7 +3638,6 @@ static long_u *insecure_flag(int opt_idx, int opt_flags)
|
||||
return &options[opt_idx].flags;
|
||||
}
|
||||
|
||||
static void redraw_titles(void);
|
||||
|
||||
/*
|
||||
* Redraw the window title and/or tab page text later.
|
||||
@ -7572,7 +7521,6 @@ typedef struct {
|
||||
} langmap_entry_T;
|
||||
|
||||
static garray_T langmap_mapga;
|
||||
static void langmap_set_entry(int from, int to);
|
||||
|
||||
/*
|
||||
* Search for an entry in "langmap_mapga" for "from". If found set the "to"
|
||||
|
@ -1,81 +1,7 @@
|
||||
#ifndef NVIM_OPTION_H
|
||||
#define NVIM_OPTION_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* option.c */
|
||||
void set_init_1(void);
|
||||
void set_string_default(char *name, char_u *val);
|
||||
void set_number_default(char *name, long val);
|
||||
void free_all_options(void);
|
||||
void set_init_2(void);
|
||||
void set_init_3(void);
|
||||
void set_helplang_default(char_u *lang);
|
||||
void set_title_defaults(void);
|
||||
int do_set(char_u *arg, int opt_flags);
|
||||
void set_options_bin(int oldval, int newval, int opt_flags);
|
||||
int get_viminfo_parameter(int type);
|
||||
char_u *find_viminfo_parameter(int type);
|
||||
void check_options(void);
|
||||
void check_buf_options(buf_T *buf);
|
||||
void free_string_option(char_u *p);
|
||||
void clear_string_option(char_u **pp);
|
||||
void set_term_option_alloced(char_u **p);
|
||||
int was_set_insecurely(char_u *opt, int opt_flags);
|
||||
void set_string_option_direct(char_u *name, int opt_idx, char_u *val,
|
||||
int opt_flags,
|
||||
int set_sid);
|
||||
char_u *check_colorcolumn(win_T *wp);
|
||||
char_u *check_stl_option(char_u *s);
|
||||
int get_option_value(char_u *name, long *numval, char_u **stringval,
|
||||
int opt_flags);
|
||||
int get_option_value_strict(char *name,
|
||||
int64_t *numval,
|
||||
char **stringval,
|
||||
int opt_type,
|
||||
void *from);
|
||||
char_u *option_iter_next(void **option, int opt_type);
|
||||
char_u *set_option_value(char_u *name, long number, char_u *string,
|
||||
int opt_flags);
|
||||
char_u *get_term_code(char_u *tname);
|
||||
char_u *get_highlight_default(void);
|
||||
char_u *get_encoding_default(void);
|
||||
int makeset(FILE *fd, int opt_flags, int local_only);
|
||||
int makefoldset(FILE *fd);
|
||||
void clear_termoptions(void);
|
||||
void free_termoptions(void);
|
||||
void free_one_termoption(char_u *var);
|
||||
void set_term_defaults(void);
|
||||
void comp_col(void);
|
||||
void unset_global_local_option(char *name, void *from);
|
||||
char_u *get_equalprg(void);
|
||||
void win_copy_options(win_T *wp_from, win_T *wp_to);
|
||||
void copy_winopt(winopt_T *from, winopt_T *to);
|
||||
void check_win_options(win_T *win);
|
||||
void check_winopt(winopt_T *wop);
|
||||
void clear_winopt(winopt_T *wop);
|
||||
void buf_copy_options(buf_T *buf, int flags);
|
||||
void reset_modifiable(void);
|
||||
void set_iminsert_global(void);
|
||||
void set_imsearch_global(void);
|
||||
void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags);
|
||||
int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file,
|
||||
char_u ***file);
|
||||
int ExpandOldSetting(int *num_file, char_u ***file);
|
||||
int langmap_adjust_mb(int c);
|
||||
int has_format_option(int x);
|
||||
int shortmess(int x);
|
||||
void vimrc_found(char_u *fname, char_u *envname);
|
||||
void change_compatible(int on);
|
||||
int option_was_set(char_u *name);
|
||||
void reset_option_was_set(char_u *name);
|
||||
int can_bs(int what);
|
||||
void save_file_ff(buf_T *buf);
|
||||
int file_ff_differs(buf_T *buf, int ignore_empty);
|
||||
int check_ff_value(char_u *p);
|
||||
long get_sw_value(buf_T *buf);
|
||||
long get_sts_value(void);
|
||||
void find_mps_values(int *initc, int *findc, int *backwards,
|
||||
int switchit);
|
||||
|
||||
#endif /* NVIM_OPTION_H */
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "option.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_OPTION_H
|
||||
|
@ -38,16 +38,9 @@ static PMap(uint64_t) *channels = NULL;
|
||||
static PMap(cstr_t) *event_strings = NULL;
|
||||
static msgpack_sbuffer msgpack_event_buffer;
|
||||
|
||||
static void job_out(RStream *rstream, void *data, bool eof);
|
||||
static void job_err(RStream *rstream, void *data, bool eof);
|
||||
static void parse_msgpack(RStream *rstream, void *data, bool eof);
|
||||
static void send_event(Channel *channel, char *type, typval_T *data);
|
||||
static void broadcast_event(char *type, typval_T *data);
|
||||
static void unsubscribe(Channel *channel, char *event);
|
||||
static void close_channel(Channel *channel);
|
||||
static void close_cb(uv_handle_t *handle);
|
||||
static WBuffer *serialize_event(char *type, typval_T *data);
|
||||
static Channel *register_channel(void);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/channel.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Initializes the module
|
||||
void channel_init()
|
||||
|
@ -8,18 +8,7 @@
|
||||
|
||||
#define EVENT_MAXLEN 512
|
||||
|
||||
void channel_init(void);
|
||||
|
||||
void channel_teardown(void);
|
||||
|
||||
void channel_from_stream(uv_stream_t *stream);
|
||||
|
||||
void channel_from_job(char **argv);
|
||||
|
||||
bool channel_send_event(uint64_t id, char *type, typval_T *data);
|
||||
|
||||
void channel_subscribe(uint64_t id, char *event);
|
||||
|
||||
void channel_unsubscribe(uint64_t id, char *event);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/channel.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_OS_CHANNEL_H
|
||||
|
@ -20,11 +20,12 @@
|
||||
#define _destroy_event(x) // do nothing
|
||||
KLIST_INIT(Event, Event, _destroy_event)
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/event.c.generated.h"
|
||||
#endif
|
||||
static klist_t(Event) *event_queue;
|
||||
static uv_timer_t timer;
|
||||
static uv_prepare_t timer_prepare;
|
||||
static void timer_cb(uv_timer_t *handle);
|
||||
static void timer_prepare_cb(uv_prepare_t *);
|
||||
|
||||
void event_init()
|
||||
{
|
||||
|
@ -7,12 +7,7 @@
|
||||
#include "nvim/os/event_defs.h"
|
||||
#include "nvim/os/job_defs.h"
|
||||
|
||||
void event_init(void);
|
||||
void event_teardown(void);
|
||||
bool event_poll(int32_t ms);
|
||||
bool event_is_pending(void);
|
||||
void event_push(Event event);
|
||||
void event_process(void);
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/event.h.generated.h"
|
||||
#endif
|
||||
#endif // NVIM_OS_EVENT_H
|
||||
|
||||
|
@ -8,8 +8,9 @@
|
||||
#include "nvim/path.h"
|
||||
#include "nvim/strings.h"
|
||||
|
||||
static bool is_executable(const char_u *name);
|
||||
static bool is_executable_in_path(const char_u *name);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/fs.c.generated.h"
|
||||
#endif
|
||||
|
||||
// Many fs functions from libuv return that value on success.
|
||||
static const int kLibuvSuccess = 0;
|
||||
@ -349,4 +350,3 @@ bool os_file_info_id_equal(FileInfo *file_info_1, FileInfo *file_info_2)
|
||||
return file_info_1->stat.st_ino == file_info_2->stat.st_ino
|
||||
&& file_info_1->stat.st_dev == file_info_2->stat.st_dev;
|
||||
}
|
||||
|
||||
|
@ -25,12 +25,11 @@ typedef enum {
|
||||
static RStream *read_stream;
|
||||
static bool eof = false, started_reading = false;
|
||||
|
||||
static InbufPollResult inbuf_poll(int32_t ms);
|
||||
static void stderr_switch(void);
|
||||
static void read_cb(RStream *rstream, void *data, bool eof);
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "os/input.c.generated.h"
|
||||
#endif
|
||||
// Helper function used to push bytes from the 'event' key sequence partially
|
||||
// between calls to os_inchar when maxlen < 3
|
||||
static int push_event_key(uint8_t *buf, int maxlen);
|
||||
|
||||
void input_init()
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user