diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-06-22 16:50:40 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-06-22 16:50:40 +0800 |
| commit | cd2b60b101a398cb9356d746364e70eaed1860f1 (patch) | |
| tree | a1fe71b76faabc4883f16905a94164ce5c23e692 /src/lua/lua.h | |
| parent | 88c1052e700f38cf3d8ad82d469da4c487760b7e (diff) | |
| download | yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.tar.gz yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.tar.bz2 yuescript-cd2b60b101a398cb9356d746364e70eaed1860f1.zip | |
add support for local variable declared with attribute 'close' and 'const' for Lua 5.4.
Diffstat (limited to '')
| -rw-r--r-- | src/lua/lua.h (renamed from src/lua-5.3/lua.h) | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/src/lua-5.3/lua.h b/src/lua/lua.h index c236e36..b348c14 100644 --- a/src/lua-5.3/lua.h +++ b/src/lua/lua.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 roberto Exp $ | 2 | ** $Id: lua.h $ |
| 3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
| 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
| @@ -17,13 +17,15 @@ | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | #define LUA_VERSION_MAJOR "5" | 19 | #define LUA_VERSION_MAJOR "5" |
| 20 | #define LUA_VERSION_MINOR "3" | 20 | #define LUA_VERSION_MINOR "4" |
| 21 | #define LUA_VERSION_NUM 503 | 21 | #define LUA_VERSION_RELEASE "0" |
| 22 | #define LUA_VERSION_RELEASE "5" | 22 | |
| 23 | #define LUA_VERSION_NUM 504 | ||
| 24 | #define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 0) | ||
| 23 | 25 | ||
| 24 | #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR | 26 | #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR |
| 25 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE | 27 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE |
| 26 | #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2018 Lua.org, PUC-Rio" | 28 | #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2020 Lua.org, PUC-Rio" |
| 27 | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" | 29 | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" |
| 28 | 30 | ||
| 29 | 31 | ||
| @@ -49,8 +51,7 @@ | |||
| 49 | #define LUA_ERRRUN 2 | 51 | #define LUA_ERRRUN 2 |
| 50 | #define LUA_ERRSYNTAX 3 | 52 | #define LUA_ERRSYNTAX 3 |
| 51 | #define LUA_ERRMEM 4 | 53 | #define LUA_ERRMEM 4 |
| 52 | #define LUA_ERRGCMM 5 | 54 | #define LUA_ERRERR 5 |
| 53 | #define LUA_ERRERR 6 | ||
| 54 | 55 | ||
| 55 | 56 | ||
| 56 | typedef struct lua_State lua_State; | 57 | typedef struct lua_State lua_State; |
| @@ -71,7 +72,7 @@ typedef struct lua_State lua_State; | |||
| 71 | #define LUA_TUSERDATA 7 | 72 | #define LUA_TUSERDATA 7 |
| 72 | #define LUA_TTHREAD 8 | 73 | #define LUA_TTHREAD 8 |
| 73 | 74 | ||
| 74 | #define LUA_NUMTAGS 9 | 75 | #define LUA_NUMTYPES 9 |
| 75 | 76 | ||
| 76 | 77 | ||
| 77 | 78 | ||
| @@ -124,6 +125,13 @@ typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); | |||
| 124 | typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); | 125 | typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); |
| 125 | 126 | ||
| 126 | 127 | ||
| 128 | /* | ||
| 129 | ** Type for warning functions | ||
| 130 | */ | ||
| 131 | typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont); | ||
| 132 | |||
| 133 | |||
| 134 | |||
| 127 | 135 | ||
| 128 | /* | 136 | /* |
| 129 | ** generic extra include file | 137 | ** generic extra include file |
| @@ -145,11 +153,12 @@ extern const char lua_ident[]; | |||
| 145 | LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); | 153 | LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); |
| 146 | LUA_API void (lua_close) (lua_State *L); | 154 | LUA_API void (lua_close) (lua_State *L); |
| 147 | LUA_API lua_State *(lua_newthread) (lua_State *L); | 155 | LUA_API lua_State *(lua_newthread) (lua_State *L); |
| 156 | LUA_API int (lua_resetthread) (lua_State *L); | ||
| 148 | 157 | ||
| 149 | LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); | 158 | LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); |
| 150 | 159 | ||
| 151 | 160 | ||
| 152 | LUA_API const lua_Number *(lua_version) (lua_State *L); | 161 | LUA_API lua_Number (lua_version) (lua_State *L); |
| 153 | 162 | ||
| 154 | 163 | ||
| 155 | /* | 164 | /* |
| @@ -182,7 +191,7 @@ LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); | |||
| 182 | LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); | 191 | LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); |
| 183 | LUA_API int (lua_toboolean) (lua_State *L, int idx); | 192 | LUA_API int (lua_toboolean) (lua_State *L, int idx); |
| 184 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); | 193 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); |
| 185 | LUA_API size_t (lua_rawlen) (lua_State *L, int idx); | 194 | LUA_API lua_Unsigned (lua_rawlen) (lua_State *L, int idx); |
| 186 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); | 195 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); |
| 187 | LUA_API void *(lua_touserdata) (lua_State *L, int idx); | 196 | LUA_API void *(lua_touserdata) (lua_State *L, int idx); |
| 188 | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); | 197 | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); |
| @@ -247,9 +256,9 @@ LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); | |||
| 247 | LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); | 256 | LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); |
| 248 | 257 | ||
| 249 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); | 258 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); |
| 250 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); | 259 | LUA_API void *(lua_newuserdatauv) (lua_State *L, size_t sz, int nuvalue); |
| 251 | LUA_API int (lua_getmetatable) (lua_State *L, int objindex); | 260 | LUA_API int (lua_getmetatable) (lua_State *L, int objindex); |
| 252 | LUA_API int (lua_getuservalue) (lua_State *L, int idx); | 261 | LUA_API int (lua_getiuservalue) (lua_State *L, int idx, int n); |
| 253 | 262 | ||
| 254 | 263 | ||
| 255 | /* | 264 | /* |
| @@ -263,7 +272,7 @@ LUA_API void (lua_rawset) (lua_State *L, int idx); | |||
| 263 | LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); | 272 | LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); |
| 264 | LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); | 273 | LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); |
| 265 | LUA_API int (lua_setmetatable) (lua_State *L, int objindex); | 274 | LUA_API int (lua_setmetatable) (lua_State *L, int objindex); |
| 266 | LUA_API void (lua_setuservalue) (lua_State *L, int idx); | 275 | LUA_API int (lua_setiuservalue) (lua_State *L, int idx, int n); |
| 267 | 276 | ||
| 268 | 277 | ||
| 269 | /* | 278 | /* |
| @@ -288,7 +297,8 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); | |||
| 288 | */ | 297 | */ |
| 289 | LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, | 298 | LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, |
| 290 | lua_KFunction k); | 299 | lua_KFunction k); |
| 291 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); | 300 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg, |
| 301 | int *nres); | ||
| 292 | LUA_API int (lua_status) (lua_State *L); | 302 | LUA_API int (lua_status) (lua_State *L); |
| 293 | LUA_API int (lua_isyieldable) (lua_State *L); | 303 | LUA_API int (lua_isyieldable) (lua_State *L); |
| 294 | 304 | ||
| @@ -296,6 +306,13 @@ LUA_API int (lua_isyieldable) (lua_State *L); | |||
| 296 | 306 | ||
| 297 | 307 | ||
| 298 | /* | 308 | /* |
| 309 | ** Warning-related functions | ||
| 310 | */ | ||
| 311 | LUA_API void (lua_setwarnf) (lua_State *L, lua_WarnFunction f, void *ud); | ||
| 312 | LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont); | ||
| 313 | |||
| 314 | |||
| 315 | /* | ||
| 299 | ** garbage-collection function and options | 316 | ** garbage-collection function and options |
| 300 | */ | 317 | */ |
| 301 | 318 | ||
| @@ -308,8 +325,10 @@ LUA_API int (lua_isyieldable) (lua_State *L); | |||
| 308 | #define LUA_GCSETPAUSE 6 | 325 | #define LUA_GCSETPAUSE 6 |
| 309 | #define LUA_GCSETSTEPMUL 7 | 326 | #define LUA_GCSETSTEPMUL 7 |
| 310 | #define LUA_GCISRUNNING 9 | 327 | #define LUA_GCISRUNNING 9 |
| 328 | #define LUA_GCGEN 10 | ||
| 329 | #define LUA_GCINC 11 | ||
| 311 | 330 | ||
| 312 | LUA_API int (lua_gc) (lua_State *L, int what, int data); | 331 | LUA_API int (lua_gc) (lua_State *L, int what, ...); |
| 313 | 332 | ||
| 314 | 333 | ||
| 315 | /* | 334 | /* |
| @@ -328,6 +347,7 @@ LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); | |||
| 328 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | 347 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); |
| 329 | LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | 348 | LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); |
| 330 | 349 | ||
| 350 | LUA_API void (lua_toclose) (lua_State *L, int idx); | ||
| 331 | 351 | ||
| 332 | 352 | ||
| 333 | /* | 353 | /* |
| @@ -377,7 +397,7 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
| 377 | 397 | ||
| 378 | /* | 398 | /* |
| 379 | ** {============================================================== | 399 | ** {============================================================== |
| 380 | ** compatibility macros for unsigned conversions | 400 | ** compatibility macros |
| 381 | ** =============================================================== | 401 | ** =============================================================== |
| 382 | */ | 402 | */ |
| 383 | #if defined(LUA_COMPAT_APIINTCASTS) | 403 | #if defined(LUA_COMPAT_APIINTCASTS) |
| @@ -387,6 +407,13 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
| 387 | #define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) | 407 | #define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) |
| 388 | 408 | ||
| 389 | #endif | 409 | #endif |
| 410 | |||
| 411 | #define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1) | ||
| 412 | #define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1) | ||
| 413 | #define lua_setuservalue(L,idx) lua_setiuservalue(L,idx,1) | ||
| 414 | |||
| 415 | #define LUA_NUMTAGS LUA_NUMTYPES | ||
| 416 | |||
| 390 | /* }============================================================== */ | 417 | /* }============================================================== */ |
| 391 | 418 | ||
| 392 | /* | 419 | /* |
| @@ -437,6 +464,7 @@ LUA_API lua_Hook (lua_gethook) (lua_State *L); | |||
| 437 | LUA_API int (lua_gethookmask) (lua_State *L); | 464 | LUA_API int (lua_gethookmask) (lua_State *L); |
| 438 | LUA_API int (lua_gethookcount) (lua_State *L); | 465 | LUA_API int (lua_gethookcount) (lua_State *L); |
| 439 | 466 | ||
| 467 | LUA_API int (lua_setcstacklimit) (lua_State *L, unsigned int limit); | ||
| 440 | 468 | ||
| 441 | struct lua_Debug { | 469 | struct lua_Debug { |
| 442 | int event; | 470 | int event; |
| @@ -444,6 +472,7 @@ struct lua_Debug { | |||
| 444 | const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ | 472 | const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ |
| 445 | const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ | 473 | const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ |
| 446 | const char *source; /* (S) */ | 474 | const char *source; /* (S) */ |
| 475 | size_t srclen; /* (S) */ | ||
| 447 | int currentline; /* (l) */ | 476 | int currentline; /* (l) */ |
| 448 | int linedefined; /* (S) */ | 477 | int linedefined; /* (S) */ |
| 449 | int lastlinedefined; /* (S) */ | 478 | int lastlinedefined; /* (S) */ |
| @@ -451,6 +480,8 @@ struct lua_Debug { | |||
| 451 | unsigned char nparams;/* (u) number of parameters */ | 480 | unsigned char nparams;/* (u) number of parameters */ |
| 452 | char isvararg; /* (u) */ | 481 | char isvararg; /* (u) */ |
| 453 | char istailcall; /* (t) */ | 482 | char istailcall; /* (t) */ |
| 483 | unsigned short ftransfer; /* (r) index of first value transferred */ | ||
| 484 | unsigned short ntransfer; /* (r) number of transferred values */ | ||
| 454 | char short_src[LUA_IDSIZE]; /* (S) */ | 485 | char short_src[LUA_IDSIZE]; /* (S) */ |
| 455 | /* private part */ | 486 | /* private part */ |
| 456 | struct CallInfo *i_ci; /* active function */ | 487 | struct CallInfo *i_ci; /* active function */ |
| @@ -460,7 +491,7 @@ struct lua_Debug { | |||
| 460 | 491 | ||
| 461 | 492 | ||
| 462 | /****************************************************************************** | 493 | /****************************************************************************** |
| 463 | * Copyright (C) 1994-2018 Lua.org, PUC-Rio. | 494 | * Copyright (C) 1994-2020 Lua.org, PUC-Rio. |
| 464 | * | 495 | * |
| 465 | * Permission is hereby granted, free of charge, to any person obtaining | 496 | * Permission is hereby granted, free of charge, to any person obtaining |
| 466 | * a copy of this software and associated documentation files (the | 497 | * a copy of this software and associated documentation files (the |
