Skip to content

Commit f858428

Browse files
committed
Updeted vim to version 8.1 + bug fixes
1 parent 3fa0e42 commit f858428

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+3681
-2208
lines changed

build_vim_xcframework.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ln -s Frameworks_iOS Frameworks
1515
make distclean
1616
# 1) configure
1717
# --enable-terminal
18-
./configure vim_cv_toupper_broken=no vim_cv_terminfo=no vim_cv_tgetent=zero vim_cv_memmove_handles_overlap=no vim_cv_memcpy_handles_overlap=no vim_cv_bcopy_handles_overlap=no vim_cv_tty_group=world vim_cv_stat_ignores_slash=yes vim_cv_getcwd_broken=no LUA_PREFIX=${PWD} vi_cv_path_plain_lua=/usr/bin/lua vi_cv_version_plain_lua=5.3.4 --with-tlib=ncurses --with-features=big --enable-luainterp --enable-python3interp --with-python3-command=python3 CC=clang CXX=clang++ CFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -fembed-bitcode -DDYNAMIC_PYTHON3" CPPFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -DDYNAMIC_PYTHON3" CXXFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -fembed-bitcode -DDYNAMIC_PYTHON3" LDFLAGS="-shared -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -F$FRAMEWORKS -framework ios_system " --build=x86_64-apple-darwin --host=armv7-apple-darwin
18+
./configure vim_cv_toupper_broken=no vim_cv_terminfo=no vim_cv_tgetent=zero vim_cv_memmove_handles_overlap=no vim_cv_memcpy_handles_overlap=no vim_cv_bcopy_handles_overlap=no vim_cv_tty_group=world vim_cv_stat_ignores_slash=yes vim_cv_getcwd_broken=no LUA_PREFIX=${PWD} vi_cv_path_plain_lua=/usr/bin/lua vi_cv_version_plain_lua=5.4.4 --with-tlib=ncurses --with-features=big --enable-luainterp --enable-python3interp --with-python3-command=python3 CC=clang CXX=clang++ CFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -fembed-bitcode -DDYNAMIC_PYTHON3" CPPFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -DDYNAMIC_PYTHON3" CXXFLAGS="-DEXITFREE -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -fembed-bitcode -DDYNAMIC_PYTHON3" LDFLAGS="-shared -arch arm64 -O2 -miphoneos-version-min=14.0 -isysroot $IOS_SDKROOT -F$FRAMEWORKS -framework ios_system " --build=x86_64-apple-darwin --host=armv7-apple-darwin
1919

2020
# 2) make. This creates ./src/vim, a Mach-O 64-bit dynamically linked shared library for arm64.
2121
make

include/lapi.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp $
2+
** $Id: lapi.h $
33
** Auxiliary functions from Lua API
44
** See Copyright Notice in lua.h
55
*/
@@ -11,14 +11,39 @@
1111
#include "llimits.h"
1212
#include "lstate.h"
1313

14+
15+
/* Increments 'L->top', checking for stack overflows */
1416
#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \
1517
"stack overflow");}
1618

19+
20+
/*
21+
** If a call returns too many multiple returns, the callee may not have
22+
** stack space to accommodate all results. In this case, this macro
23+
** increases its stack space ('L->ci->top').
24+
*/
1725
#define adjustresults(L,nres) \
18-
{ if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
26+
{ if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
27+
1928

29+
/* Ensure the stack has at least 'n' elements */
2030
#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \
2131
"not enough elements in the stack")
2232

2333

34+
/*
35+
** To reduce the overhead of returning from C functions, the presence of
36+
** to-be-closed variables in these functions is coded in the CallInfo's
37+
** field 'nresults', in a way that functions with no to-be-closed variables
38+
** with zero, one, or "all" wanted results have no overhead. Functions
39+
** with other number of wanted results, as well as functions with
40+
** variables to be closed, have an extra check.
41+
*/
42+
43+
#define hastocloseCfunc(n) ((n) < LUA_MULTRET)
44+
45+
/* Map [-1, inf) (range of 'nresults') into (-inf, -2] */
46+
#define codeNresults(n) (-(n) - 3)
47+
#define decodeNresults(n) (-(n) - 3)
48+
2449
#endif

include/lauxlib.h

Lines changed: 60 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp $
2+
** $Id: lauxlib.h $
33
** Auxiliary functions for building Lua libraries
44
** See Copyright Notice in lua.h
55
*/
@@ -12,9 +12,17 @@
1212
#include <stddef.h>
1313
#include <stdio.h>
1414

15+
#include "luaconf.h"
1516
#include "lua.h"
17+
#include "ios_error.h"
1618

1719

20+
/* global table */
21+
#define LUA_GNAME "_G"
22+
23+
24+
typedef struct luaL_Buffer luaL_Buffer;
25+
1826

1927
/* extra error code for 'luaL_loadfilex' */
2028
#define LUA_ERRFILE (LUA_ERRERR+1)
@@ -44,6 +52,7 @@ LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
4452
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
4553
LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
4654
LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg);
55+
LUALIB_API int (luaL_typeerror) (lua_State *L, int arg, const char *tname);
4756
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg,
4857
size_t *l);
4958
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg,
@@ -73,6 +82,7 @@ LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def,
7382
LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
7483
LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
7584

85+
7686
/* predefined references */
7787
#define LUA_NOREF (-2)
7888
#define LUA_REFNIL (-1)
@@ -93,8 +103,10 @@ LUALIB_API lua_State *(luaL_newstate) (void);
93103

94104
LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx);
95105

96-
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
97-
const char *r);
106+
LUALIB_API void (luaL_addgsub) (luaL_Buffer *b, const char *s,
107+
const char *p, const char *r);
108+
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s,
109+
const char *p, const char *r);
98110

99111
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
100112

@@ -120,7 +132,11 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
120132
(luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
121133

122134
#define luaL_argcheck(L, cond,arg,extramsg) \
123-
((void)((cond) || luaL_argerror(L, (arg), (extramsg))))
135+
((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg))))
136+
137+
#define luaL_argexpected(L,cond,arg,tname) \
138+
((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname))))
139+
124140
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
125141
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
126142

@@ -139,19 +155,54 @@ LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
139155
#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
140156

141157

158+
/*
159+
** Perform arithmetic operations on lua_Integer values with wrap-around
160+
** semantics, as the Lua core does.
161+
*/
162+
#define luaL_intop(op,v1,v2) \
163+
((lua_Integer)((lua_Unsigned)(v1) op (lua_Unsigned)(v2)))
164+
165+
166+
/* push the value used to represent failure/error */
167+
#define luaL_pushfail(L) lua_pushnil(L)
168+
169+
170+
/*
171+
** Internal assertions for in-house debugging
172+
*/
173+
#if !defined(lua_assert)
174+
175+
#if defined LUAI_ASSERT
176+
#include <assert.h>
177+
#define lua_assert(c) assert(c)
178+
#else
179+
#define lua_assert(c) ((void)0)
180+
#endif
181+
182+
#endif
183+
184+
185+
142186
/*
143187
** {======================================================
144188
** Generic Buffer manipulation
145189
** =======================================================
146190
*/
147191

148-
typedef struct luaL_Buffer {
192+
struct luaL_Buffer {
149193
char *b; /* buffer address */
150194
size_t size; /* buffer size */
151195
size_t n; /* number of characters in buffer */
152196
lua_State *L;
153-
char initb[LUAL_BUFFERSIZE]; /* initial buffer */
154-
} luaL_Buffer;
197+
union {
198+
LUAI_MAXALIGN; /* ensure maximum alignment for buffer */
199+
char b[LUAL_BUFFERSIZE]; /* initial buffer */
200+
} init;
201+
};
202+
203+
204+
#define luaL_bufflen(bf) ((bf)->n)
205+
#define luaL_buffaddr(bf) ((bf)->b)
155206

156207

157208
#define luaL_addchar(B,c) \
@@ -160,6 +211,8 @@ typedef struct luaL_Buffer {
160211

161212
#define luaL_addsize(B,s) ((B)->n += (s))
162213

214+
#define luaL_buffsub(B,s) ((B)->n -= (s))
215+
163216
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
164217
LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
165218
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
@@ -197,21 +250,6 @@ typedef struct luaL_Stream {
197250

198251
/* }====================================================== */
199252

200-
201-
202-
/* compatibility with old module system */
203-
#if defined(LUA_COMPAT_MODULE)
204-
205-
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
206-
int sizehint);
207-
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
208-
const luaL_Reg *l, int nup);
209-
210-
#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0))
211-
212-
#endif
213-
214-
215253
/*
216254
** {==================================================================
217255
** "Abstraction Layer" for basic report of messages and errors

include/lcode.h

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp $
2+
** $Id: lcode.h $
33
** Code generator for Lua
44
** See Copyright Notice in lua.h
55
*/
@@ -24,40 +24,53 @@
2424
** grep "ORDER OPR" if you change these enums (ORDER OP)
2525
*/
2626
typedef enum BinOpr {
27+
/* arithmetic operators */
2728
OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW,
28-
OPR_DIV,
29-
OPR_IDIV,
29+
OPR_DIV, OPR_IDIV,
30+
/* bitwise operators */
3031
OPR_BAND, OPR_BOR, OPR_BXOR,
3132
OPR_SHL, OPR_SHR,
33+
/* string operator */
3234
OPR_CONCAT,
35+
/* comparison operators */
3336
OPR_EQ, OPR_LT, OPR_LE,
3437
OPR_NE, OPR_GT, OPR_GE,
38+
/* logical operators */
3539
OPR_AND, OPR_OR,
3640
OPR_NOBINOPR
3741
} BinOpr;
3842

3943

44+
/* true if operation is foldable (that is, it is arithmetic or bitwise) */
45+
#define foldbinop(op) ((op) <= OPR_SHR)
46+
47+
48+
#define luaK_codeABC(fs,o,a,b,c) luaK_codeABCk(fs,o,a,b,c,0)
49+
50+
4051
typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
4152

4253

4354
/* get (pointer to) instruction of given 'expdesc' */
4455
#define getinstruction(fs,e) ((fs)->f->code[(e)->u.info])
4556

46-
#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
4757

4858
#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)
4959

5060
#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
5161

62+
LUAI_FUNC int luaK_code (FuncState *fs, Instruction i);
5263
LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
53-
LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
54-
LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k);
64+
LUAI_FUNC int luaK_codeAsBx (FuncState *fs, OpCode o, int A, int Bx);
65+
LUAI_FUNC int luaK_codeABCk (FuncState *fs, OpCode o, int A,
66+
int B, int C, int k);
67+
LUAI_FUNC int luaK_isKint (expdesc *e);
68+
LUAI_FUNC int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v);
5569
LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
5670
LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
5771
LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n);
5872
LUAI_FUNC void luaK_checkstack (FuncState *fs, int n);
59-
LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s);
60-
LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n);
73+
LUAI_FUNC void luaK_int (FuncState *fs, int reg, lua_Integer n);
6174
LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e);
6275
LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);
6376
LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e);
@@ -75,14 +88,17 @@ LUAI_FUNC int luaK_jump (FuncState *fs);
7588
LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);
7689
LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);
7790
LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);
78-
LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level);
7991
LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);
8092
LUAI_FUNC int luaK_getlabel (FuncState *fs);
8193
LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line);
8294
LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
8395
LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1,
8496
expdesc *v2, int line);
97+
LUAI_FUNC void luaK_settablesize (FuncState *fs, int pc,
98+
int ra, int asize, int hsize);
8599
LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
100+
LUAI_FUNC void luaK_finish (FuncState *fs);
101+
LUAI_FUNC l_noret luaK_semerror (LexState *ls, const char *msg);
86102

87103

88104
#endif

include/lctype.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp $
2+
** $Id: lctype.h $
33
** 'ctype' functions for Lua
44
** See Copyright Notice in lua.h
55
*/
@@ -13,7 +13,7 @@
1313
/*
1414
** WARNING: the functions defined here do not necessarily correspond
1515
** to the similar functions in the standard C ctype.h. They are
16-
** optimized for the specific needs of Lua
16+
** optimized for the specific needs of Lua.
1717
*/
1818

1919
#if !defined(LUA_USE_CTYPE)
@@ -61,14 +61,20 @@
6161
#define lisprint(c) testprop(c, MASK(PRINTBIT))
6262
#define lisxdigit(c) testprop(c, MASK(XDIGITBIT))
6363

64+
6465
/*
65-
** this 'ltolower' only works for alphabetic characters
66+
** In ASCII, this 'ltolower' is correct for alphabetic characters and
67+
** for '.'. That is enough for Lua needs. ('check_exp' ensures that
68+
** the character either is an upper-case letter or is unchanged by
69+
** the transformation, which holds for lower-case letters and '.'.)
6670
*/
67-
#define ltolower(c) ((c) | ('A' ^ 'a'))
71+
#define ltolower(c) \
72+
check_exp(('A' <= (c) && (c) <= 'Z') || (c) == ((c) | ('A' ^ 'a')), \
73+
(c) | ('A' ^ 'a'))
6874

6975

70-
/* two more entries for 0 and -1 (EOZ) */
71-
LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2];
76+
/* one entry for each character and for -1 (EOZ) */
77+
LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];)
7278

7379

7480
#else /* }{ */

include/ldebug.h

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp $
2+
** $Id: ldebug.h $
33
** Auxiliary functions from Debug Interface module
44
** See Copyright Notice in lua.h
55
*/
@@ -11,15 +11,39 @@
1111
#include "lstate.h"
1212

1313

14-
#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1)
14+
#define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1)
15+
16+
17+
/* Active Lua function (given call info) */
18+
#define ci_func(ci) (clLvalue(s2v((ci)->func)))
1519

16-
#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1)
1720

1821
#define resethookcount(L) (L->hookcount = L->basehookcount)
1922

23+
/*
24+
** mark for entries in 'lineinfo' array that has absolute information in
25+
** 'abslineinfo' array
26+
*/
27+
#define ABSLINEINFO (-0x80)
28+
29+
30+
/*
31+
** MAXimum number of successive Instructions WiTHout ABSolute line
32+
** information. (A power of two allows fast divisions.)
33+
*/
34+
#if !defined(MAXIWTHABS)
35+
#define MAXIWTHABS 128
36+
#endif
37+
2038

39+
LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc);
40+
LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n,
41+
StkId *pos);
2142
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
2243
const char *opname);
44+
LUAI_FUNC l_noret luaG_callerror (lua_State *L, const TValue *o);
45+
LUAI_FUNC l_noret luaG_forerror (lua_State *L, const TValue *o,
46+
const char *what);
2347
LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1,
2448
const TValue *p2);
2549
LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1,
@@ -33,7 +57,7 @@ LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...);
3357
LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg,
3458
TString *src, int line);
3559
LUAI_FUNC l_noret luaG_errormsg (lua_State *L);
36-
LUAI_FUNC void luaG_traceexec (lua_State *L);
60+
LUAI_FUNC int luaG_traceexec (lua_State *L, const Instruction *pc);
3761

3862

3963
#endif

0 commit comments

Comments
 (0)