AboutLUA source codeThe analysis learning tutorial is the content to be introduced in this article, mainly to learnLuaFor details about the source code, see this article.
The original text is in English and can be translated into Chinese at a time. Hope you can give me some advice on bina prawns.
- Ldebug. c-debugging interface: including the lua_sethook/lua_gethook/lua_gethookcount function that accesses the debugging hook.
- Lua_getstatck/lua_getlocal/lua_setlocal), check the bytecode function luaG_checkopenop/luaG_checkcode ),
- And the function luaG_typeerror/luaG_concaterror/luaG_aritherror/luaG_ordererror/luaG_errormsg/luaG_runerror) that throws errors)
- Lzio. c-a common input stream interface with a buffer
- Lmem. c-memory management interface. Two functions, luaM_realloc and luaM_growaux _, are implemented by encapsulating the memory allocation function.
- Lgc. c-memory management of the Garbage Collector)
- Lstate. c-global context. Including lua_newstate/lua_close and LUA thread functions (luaE_newthread/luaE_freethread)
- Lobject. c-some general functions for Lua objects. Including data type to String Conversion Function, pure data equality test function luaO_rawequalObj), and log base 2luaO_log2)
- Lstring. c-string table stores all string sets operated by Lua)
- Lfunc. c-auxiliary functions for packaging prototype and Closure
- Ltable. c-Lua table implements hash)
- Lcode. c-Lua code generator. Used by lparser. c
- Llex. c-This method analyzer. Used by lparser. c
- Lparser. c-Lua syntax checker
- Lundump. c-load the pre-compiled Lua code block. The luaU_undump function loads a pre-compiled code block. The luaU_header (internal function used by luaU_undump) is used to check the function header.
- Ldump. c-Save the pre-compiled Lua code block. The luaU_dump function displays a function using the pre-compiled code string;
- Lopcodes. c-Lua VM operator. Define the names and information of all operators (saved in two tables: luaP_opnames and luaP_opmodes)
- Lvm. c-Lua virtual machine. Execute the bytecode luaV_execute ). Some functions that may be used by lapi. c, such as luaV_concat, are also exposed)
- The stack and call structure of ldos. c-Lua. Control function call luaD_call/luaD_pcall), stack growth, collaborative Code Synchronization
- Ltm. c-Method for marking primitives. Implementation of Object Access primitive methods (javashods)
- Lbaselib. c-basic function library
- Lstrlib. c-string Library
- Ltable. c-table operation Library
- Lmathlib. c-Math Library
- Loslib. c-operating system related libraries
- Liolib. c-Input Database
- Loadlib. c-module library implements the require function and package function)
- Ldblib. c-debugging Library
- Lapi. c-Lua API. Implement the Lua c api (lua _ * function) Set
- Lauxlib. c-define all luaL _ * function sets
- Linit. c-implement the luaL_openlibs method to facilitate loading the above modules in c Language
- Lua. c-Lua independent interpreter
- Print. c-defines "PrintFunction? "Function, used to print the bytecode in the function to be used by the-l parameter in luac. c)
- The luac. c-Lua compiler saves bytecode to a file and can also list bytecode)
The prefix of a external symbol indicates the module it comes from:
The prefix of the external symbol indicates which file the external symbol comes from:
- luaA_ - lapi.c
- luaB_ - lbaselib.c
- luaC_ - lgc.c
- luaD_ - ldo.c
- luaE_ - lstate.c
- luaF_ - lfunc.c
- luaG_ - ldebug.c
- luaH_ - ltable.c
- luaI_ - lauxlib.c
- luaK_ - lcode.c
- luaL_ - lauxlib.c/h, linit.c (public functions)
- luaM_ - lmem.c
- luaO_ - lobject.c
- luaP_ - lopcodes.c
- luaS_ - lstring.c
- luaT_ - ltm.c
- luaU_ - lundump.c
- luaV_ - lvm.c
- luaX_ - llex.c
- luaY_ - lparser.c
- luaZ_ - lzio.c
- lua_? - lapi.c/h + luaconf.h, debug.c
- luai_ - luaconf.h
- luaopen_ - luaconf.h + libraries (lbaselib.c, ldblib.c, liolib.c, lmathlib.c, loadlib.c, loslib.c, lstrlib.c, ltablib.c)
Summary: AboutLUA source codeThe content of the analysis and learning course has been introduced. I hope this article will help you!