Commit Graph

152 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
0acd55898d Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative
numerical types.
2024-07-27 13:32:59 -03:00
Roberto Ierusalimschy
781219dbe1 Small changes in casts from void* to functions
Macro moved to llimits.h, and casts from void* to lua_CFunction first
go through 'voidf' (a pointer to a function from void to void), a kind
of void* for functions.
2024-07-02 11:09:46 -03:00
Roberto Ierusalimschy
a08d82eb13 llimits.h being used by all Lua code
The definitions in llimits.h are useful not only for the core. That
header only defines types and '#define's, so libs and core still do
not share any real code/data.
2024-06-20 14:46:06 -03:00
Roberto Ierusalimschy
3507c3380f Small simplification in 'findloader'
Instead of allways adding a prefix for the next message, and then
removing it if there is no message, add the prefix after each message.
2024-04-03 16:01:23 -03:00
Roberto Ierusalimschy
1028f296a8 Default paths stored as external strings 2023-11-13 13:41:59 -03:00
Roberto Ierusalimschy
09f3c2372f Option '-l' discards version sufix from file name
Like 'require', the command-line option '-l' discards an optional
version suffix (everything after an hyphen) from a file name when
creating the module name.
2023-05-15 13:46:38 -03:00
Roberto Ierusalimschy
f3cfd5bf2b Details
Comments + manual + identation + asserts about stack limits that were
not allowing the use of the full stack
2022-04-01 13:55:44 -03:00
Roberto Ierusalimschy
59c88f846d Broadening the use of branch hints
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
2021-02-24 11:14:44 -03:00
Roberto Ierusalimschy
61a4e64a66 Back to old encoding of versions in binary files
(Undoing part of commit f53eabeed8.)  It is better to keep this encoding
stable, so that all Lua versions can read at least the version of a
binary file.
2020-05-06 14:19:08 -03:00
Roberto Ierusalimschy
a901c505ab Fixed warning about casts between function pointers
gcc now warns (with -Wextra) about casts between pointers to different
function types. The type 'void(*)(void)' works as a 'void*' for function
pointers, cleaning the warning.
2020-04-29 16:37:25 -03:00
Roberto Ierusalimschy
0ddc0f47bd Several details about 5.4.0 rc1
Corrected several small details: added 'const', adjusts in tabs x
spaces, removed unused #includes and #defines, misspellings, etc.
2020-04-23 14:48:15 -03:00
Roberto Ierusalimschy
ba9cd0d25a Change in the prefix of messages from searchers
The initial "\n\t" to properly indent a searcher message is being added
by 'findloader' when building the error message, instead of being
included in the original message by each searcher itself.
2019-10-24 10:49:44 -03:00
Roberto Ierusalimschy
7bd1e53753 Fixed a warning and other minor issues
Fixed some minor issues from the feedback for 5.4-beta rc1.
2019-10-04 16:17:04 -03:00
Roberto Ierusalimschy
b96b0b5abb Added macro 'luaL_pushfail'
The macro 'luaL_pushfail' documents all places in the standard libraries
that return nil to signal some kind of failure. It is defined as
'lua_pushnil'. The manual also got a notation (@fail) to document those
returns. The tests were changed to be agnostic regarding whether 'fail'
is 'nil' or 'false'.
2019-08-16 14:58:02 -03:00
Roberto Ierusalimschy
3c0d3c6fbe Avoid using addresses of static variables as unique keys
The addresses of static variables may be different for different
instances of Lua, making these instances incompatible if they use
these addresses as unique keys in the registry (or other tables).
2019-07-19 13:14:06 -03:00
Roberto Ierusalimschy
e888976bc6 Details (typos in comments) 2019-07-05 15:03:15 -03:00
Roberto Ierusalimschy
b14609032c Avoid the creation of too many strings in 'package'
Both when setting a path and searching for a file ('searchpath'),
this commit reduces the number of intermediate strings created
in Lua.
(For setting a path the change is not relevant, because this is
done only twice when loading the module. Anyway, it is a nice example
of how to use auxlib buffers to manipulate strings in the C API.)
2019-05-03 10:14:25 -03:00
Roberto Ierusalimschy
ed2872cd3b 'require' returns where module was found
The function 'require' returns the *loader data* as a second result.
For file searchers, this data is the path where they found the module.
2019-04-17 14:57:29 -03:00
Roberto Ierusalimschy
f99509581e Removed extra information from RCS keyword strings
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
2018-08-23 14:26:12 -03:00
Roberto Ierusalimschy
ccf6d098f6 'searchpath' creates less temporary strings
When creating error messages, package loaders may create dozens of
temporary strings (one or more for each tried template). This change
reduces the number of these strings, and avoid creating some of
them if the search is successful.
2018-07-09 13:29:08 -03:00
Roberto Ierusalimschy
34b00c16e2 removed compatibility code with older versions 2018-02-27 15:47:32 -03:00
Roberto Ierusalimschy
36cf8f3a3c Code should not change the stack level after the initialization of a
string buffer.
2017-12-13 10:51:42 -02:00
Roberto Ierusalimschy
94c1b3a8ee Handling of LUA_PATH/LUA_CPATH moved back to 'package' library
to avoid incompatibilites with previous releases
2017-01-12 15:14:26 -02:00
Roberto Ierusalimschy
b2aa2ba046 using constants for "_LOADED" and "PRELOAD" 2016-12-04 18:17:24 -02:00
Roberto Ierusalimschy
de3fd8ab83 Handling of LUA_PATH/LUA_CPATH moved from package library to stand
alone interpreter (so that 'lua.c' concentrates all handling of
environment variables)
2016-07-18 14:55:59 -03:00
Roberto Ierusalimschy
c5112f7b15 details (comments) 2015-11-23 09:30:45 -02:00
Roberto Ierusalimschy
374f6c4612 detail ('fopen' needs 'stdio.h') 2015-02-16 11:14:33 -02:00
Roberto Ierusalimschy
a9a4bf68b0 typo in comment 2015-01-13 11:18:04 -02:00
Roberto Ierusalimschy
0adfa773b9 new macro 'cast_func' adds '__extension__' (in gnu compilers) when
converting void* to function, to avoid warnings
2015-01-05 11:51:39 -02:00
Roberto Ierusalimschy
52c0f9575b uses return value from lua_getfield 2014-11-12 11:31:51 -02:00
Roberto Ierusalimschy
e320790154 using address instead of string for key for table 'CLIBS' in the
registry
2014-11-10 12:28:31 -02:00
Roberto Ierusalimschy
c49edc4566 keep "#include <windows.h>" in this file, but without the
previous requirement that it must be included before any other
header file (it doesn't seem to matter)
2014-11-03 13:11:10 -02:00
Roberto Ierusalimschy
28fdbcf393 added include for 'lprefix.h', for stuff that must be added before
any other header file
2014-11-02 17:19:04 -02:00
Roberto Ierusalimschy
aa1bd8876c comments 2014-10-27 16:05:37 -02:00
Roberto Ierusalimschy
bdf566a8a3 `name' in comments changed to 'name' 2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
f97c64d7bf macros 'LUA_QL'/'LUA_QL' deprecated 2014-10-17 13:28:21 -03:00
Roberto Ierusalimschy
3ccbae84d2 added some casts between integral types (to avoid warnings) 2014-07-29 13:01:00 -03:00
Roberto Ierusalimschy
255d59ed5e some janitorial work (comments, small refactoring) 2014-07-28 14:47:53 -03:00
Roberto Ierusalimschy
f14662fca6 detail (added placeholders for non-function fields to preallocate
space for them)
2014-07-16 10:56:14 -03:00
Roberto Ierusalimschy
a3addae036 lua_gettable and similars return type of gotten value 2014-03-12 17:57:40 -03:00
Roberto Ierusalimschy
c5fcba1a17 detail (changing some names of macros) 2013-10-07 11:20:31 -03:00
Roberto Ierusalimschy
b77a90681e typos in comments 2012-05-30 09:33:44 -03:00
Roberto Ierusalimschy
ec22fc963a detail (separate code to create 'searchers' table into a new function) 2012-04-26 16:38:52 -03:00
Roberto Ierusalimschy
b10dbe5c72 bug: C libraries must be unloaded after all other finalizers have run,
because a finalizer may use a C function from a C library
2012-04-11 13:35:32 -03:00
Roberto Ierusalimschy
e2fc2ce8df new way to handle -E option (write a mark in the registry to avoid
reading environment variables)
2011-12-12 14:34:03 -02:00
Roberto Ierusalimschy
7bcb2462e4 comments 2011-11-30 10:58:57 -02:00
Roberto Ierusalimschy
aea68e5c54 explicit option RTLD_LOCAL instead of 0 (Posix does not fix
a default for dlopen)
2011-11-28 15:27:51 -02:00
Roberto Ierusalimschy
5184ff2096 'LUA_DL_DLL' is not yet defined before the inclusion of 'lua.h' 2011-11-25 10:52:03 -02:00
Roberto Ierusalimschy
3105febf9a using Lua buffers to build error messages 2011-11-10 09:42:58 -02:00
Roberto Ierusalimschy
eef22fa4ce create error messages with a single concat, to avoid problems with
creating strings piecemeal
2011-11-09 17:11:20 -02:00