mirror of
https://github.com/lua/lua
synced 2024-11-22 12:51:30 +03:00
Details
Typos in comments and details in the manual.
This commit is contained in:
parent
b5c65705ca
commit
e15f1f2bb7
4
ldebug.c
4
ldebug.c
@ -659,7 +659,7 @@ static const char *funcnamefromcall (lua_State *L, CallInfo *ci,
|
||||
** Check whether pointer 'o' points to some value in the stack frame of
|
||||
** the current function and, if so, returns its index. Because 'o' may
|
||||
** not point to a value in this stack, we cannot compare it with the
|
||||
** region boundaries (undefined behaviour in ISO C).
|
||||
** region boundaries (undefined behavior in ISO C).
|
||||
*/
|
||||
static int instack (CallInfo *ci, const TValue *o) {
|
||||
int pos;
|
||||
@ -848,7 +848,7 @@ static int changedline (const Proto *p, int oldpc, int newpc) {
|
||||
if (p->lineinfo == NULL) /* no debug information? */
|
||||
return 0;
|
||||
if (newpc - oldpc < MAXIWTHABS / 2) { /* not too far apart? */
|
||||
int delta = 0; /* line diference */
|
||||
int delta = 0; /* line difference */
|
||||
int pc = oldpc;
|
||||
for (;;) {
|
||||
int lineinfo = p->lineinfo[++pc];
|
||||
|
2
llex.c
2
llex.c
@ -128,7 +128,7 @@ l_noret luaX_syntaxerror (LexState *ls, const char *msg) {
|
||||
** ensuring there is only one copy of each unique string. The table
|
||||
** here is used as a set: the string enters as the key, while its value
|
||||
** is irrelevant. We use the string itself as the value only because it
|
||||
** is a TValue readly available. Later, the code generation can change
|
||||
** is a TValue readily available. Later, the code generation can change
|
||||
** this value.
|
||||
*/
|
||||
TString *luaX_newstring (LexState *ls, const char *str, size_t l) {
|
||||
|
@ -82,7 +82,7 @@ typedef signed char ls_byte;
|
||||
#if defined(UINTPTR_MAX) /* even in C99 this type is optional */
|
||||
#define L_P2I uintptr_t
|
||||
#else /* no 'intptr'? */
|
||||
#define L_P2I uintmax_t /* use the largerst available integer */
|
||||
#define L_P2I uintmax_t /* use the largest available integer */
|
||||
#endif
|
||||
#else /* C89 option */
|
||||
#define L_P2I size_t
|
||||
|
@ -521,12 +521,12 @@ static l_noret jumpscopeerror (LexState *ls, Labeldesc *gt) {
|
||||
|
||||
/*
|
||||
** Solves the goto at index 'g' to given 'label' and removes it
|
||||
** from the list of pending goto's.
|
||||
** from the list of pending gotos.
|
||||
** If it jumps into the scope of some variable, raises an error.
|
||||
*/
|
||||
static void solvegoto (LexState *ls, int g, Labeldesc *label) {
|
||||
int i;
|
||||
Labellist *gl = &ls->dyd->gt; /* list of goto's */
|
||||
Labellist *gl = &ls->dyd->gt; /* list of gotos */
|
||||
Labeldesc *gt = &gl->arr[g]; /* goto to be resolved */
|
||||
lua_assert(eqstr(gt->name, label->name));
|
||||
if (l_unlikely(gt->nactvar < label->nactvar)) /* enter some scope? */
|
||||
@ -580,7 +580,7 @@ static int newgotoentry (LexState *ls, TString *name, int line, int pc) {
|
||||
/*
|
||||
** Solves forward jumps. Check whether new label 'lb' matches any
|
||||
** pending gotos in current block and solves them. Return true
|
||||
** if any of the goto's need to close upvalues.
|
||||
** if any of the gotos need to close upvalues.
|
||||
*/
|
||||
static int solvegotos (LexState *ls, Labeldesc *lb) {
|
||||
Labellist *gl = &ls->dyd->gt;
|
||||
@ -601,7 +601,7 @@ static int solvegotos (LexState *ls, Labeldesc *lb) {
|
||||
/*
|
||||
** Create a new label with the given 'name' at the given 'line'.
|
||||
** 'last' tells whether label is the last non-op statement in its
|
||||
** block. Solves all pending goto's to this new label and adds
|
||||
** block. Solves all pending gotos to this new label and adds
|
||||
** a close instruction if necessary.
|
||||
** Returns true iff it added a close instruction.
|
||||
*/
|
||||
|
@ -570,7 +570,7 @@ static const char *match_capture (MatchState *ms, const char *s, int l) {
|
||||
static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
if (l_unlikely(ms->matchdepth-- == 0))
|
||||
luaL_error(ms->L, "pattern too complex");
|
||||
init: /* using goto's to optimize tail recursion */
|
||||
init: /* using goto to optimize tail recursion */
|
||||
if (p != ms->p_end) { /* end of pattern? */
|
||||
switch (*p) {
|
||||
case '(': { /* start capture */
|
||||
|
2
lua.c
2
lua.c
@ -666,7 +666,7 @@ int main (int argc, char **argv) {
|
||||
l_message(argv[0], "cannot create state: not enough memory");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
lua_gc(L, LUA_GCSTOP); /* stop GC while buidling state */
|
||||
lua_gc(L, LUA_GCSTOP); /* stop GC while building state */
|
||||
lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */
|
||||
lua_pushinteger(L, argc); /* 1st argument */
|
||||
lua_pushlightuserdata(L, argv); /* 2nd argument */
|
||||
|
@ -20,7 +20,7 @@ making it ideal for configuration, scripting,
|
||||
and rapid prototyping.
|
||||
|
||||
Lua is implemented as a library, written in @emphx{clean C},
|
||||
the common subset of @N{Standard C} and C++.
|
||||
the common subset of @N{standard C} and C++.
|
||||
The Lua distribution includes a host program called @id{lua},
|
||||
which uses the Lua library to offer a complete,
|
||||
standalone Lua interpreter,
|
||||
@ -2963,7 +2963,7 @@ static void *l_alloc (void *ud, void *ptr, size_t osize,
|
||||
return realloc(ptr, nsize);
|
||||
}
|
||||
}
|
||||
Note that @N{Standard C} ensures
|
||||
Note that @N{ISO C} ensures
|
||||
that @T{free(NULL)} has no effect and that
|
||||
@T{realloc(NULL,size)} is equivalent to @T{malloc(size)}.
|
||||
|
||||
@ -5780,7 +5780,7 @@ with @id{tname} in the registry.
|
||||
|
||||
Creates a new Lua state.
|
||||
It calls @Lid{lua_newstate} with an
|
||||
allocator based on the @N{standard C} allocation functions
|
||||
allocator based on the @N{ISO C} allocation functions
|
||||
and then sets a warning function and a panic function @see{C-error}
|
||||
that print messages to the standard error output.
|
||||
|
||||
@ -6898,7 +6898,7 @@ including if necessary a path and an extension.
|
||||
@id{funcname} must be the exact name exported by the @N{C library}
|
||||
(which may depend on the @N{C compiler} and linker used).
|
||||
|
||||
This function is not supported by @N{Standard C}.
|
||||
This functionality is not supported by @N{ISO C}.
|
||||
As such, it is only available on some platforms
|
||||
(Windows, Linux, Mac OS X, Solaris, BSD,
|
||||
plus other Unix systems that support the @id{dlfcn} standard).
|
||||
|
Loading…
Reference in New Issue
Block a user