summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-04-13 13:42:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-04-13 13:42:40 -0300
commit9e0a8475cdd53af664b807c4f0c4d53088a7faf2 (patch)
tree7648cce11d1929d77b8713877026ecbe36bf7fb0
parent7ccc6d8290143009d2bab8f4330bbf443fc25846 (diff)
downloadlua-github-9e0a8475cdd53af664b807c4f0c4d53088a7faf2.tar.gz
Added 'simplesect' sections to the manual
'simplesect' encloses the introductory text of sections with subsections, so that each section either is all text or is all subsections. (This commit also corrects a small brace error in the manual and extra spaces/tabs in some other files.)
-rw-r--r--lauxlib.h2
-rw-r--r--lgc.c2
-rw-r--r--lopcodes.h2
-rw-r--r--lutf8lib.c2
-rw-r--r--manual/manual.of54
5 files changed, 56 insertions, 6 deletions
diff --git a/lauxlib.h b/lauxlib.h
index b34b3805..59fef6af 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -16,7 +16,7 @@
/* global table */
-#define LUA_GNAME "_G"
+#define LUA_GNAME "_G"
typedef struct luaL_Buffer luaL_Buffer;
diff --git a/lgc.c b/lgc.c
index e788843c..f26c921a 100644
--- a/lgc.c
+++ b/lgc.c
@@ -152,7 +152,7 @@ static GCObject **getgclist (GCObject *o) {
** and its key is not marked, mark its entry as dead. This allows the
** collection of the key, but keeps its entry in the table (its removal
** could break a chain). The main feature of a dead key is that it must
-** be different from any other value, to do not disturb searches.
+** be different from any other value, to do not disturb searches.
** Other places never manipulate dead keys, because its associated empty
** value is enough to signal that the entry is logically empty.
*/
diff --git a/lopcodes.h b/lopcodes.h
index d755870f..d3a3f08e 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -195,7 +195,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
typedef enum {
/*----------------------------------------------------------------------
-name args description
+ name args description
------------------------------------------------------------------------*/
OP_MOVE,/* A B R[A] := R[B] */
OP_LOADI,/* A sBx R[A] := sBx */
diff --git a/lutf8lib.c b/lutf8lib.c
index e63a5a74..3b36a60e 100644
--- a/lutf8lib.c
+++ b/lutf8lib.c
@@ -29,7 +29,7 @@
** Integer type for decoded UTF-8 values; MAXUTF needs 31 bits.
*/
#if (UINT_MAX >> 30) >= 1
-typedef unsigned int utfint;
+typedef unsigned int utfint;
#else
typedef unsigned long utfint;
#endif
diff --git a/manual/manual.of b/manual/manual.of
index 3ba82b09..b237ad46 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -59,8 +59,12 @@ see Roberto's book, @emphx{Programming in Lua}.
@C{-------------------------------------------------------------------------}
@sect1{basic| @title{Basic Concepts}
+@simplesect{
+
This section describes the basic concepts of the language.
+}
+
@sect2{TypesSec| @title{Values and Types}
Lua is a dynamically typed language.
@@ -570,6 +574,8 @@ right after its creation.
@sect2{GC| @title{Garbage Collection}
+@simplesect{
+
Lua performs automatic memory management.
This means that
you do not have to worry about allocating memory for new objects
@@ -597,6 +603,8 @@ or @Lid{collectgarbage} in Lua.
You can also use these functions to control
the collector directly (e.g., to stop and restart it).
+}
+
@sect3{incmode| @title{Incremental Garbage Collection}
In incremental mode,
@@ -934,6 +942,8 @@ and @Lid{lua_yield}.
@C{-------------------------------------------------------------------------}
@sect1{language| @title{The Language}
+@simplesect{
+
This section describes the lexis, the syntax, and the semantics of Lua.
In other words,
this section describes
@@ -951,6 +961,8 @@ and other terminal symbols are shown like @bnfter{=}.
The complete syntax of Lua can be found in @refsec{BNF}
at the end of this manual.
+}
+
@sect2{lexical| @title{Lexical Conventions}
Lua is a @x{free-form} language.
@@ -1175,12 +1187,16 @@ the variable @id{_ENV} itself is never global @see{globalenv}.
@sect2{stats| @title{Statements}
+@simplesect{
+
Lua supports an almost conventional set of @x{statements},
similar to those in other conventional languages.
This set includes
blocks, assignments, control structures, function calls,
and variable declarations.
+}
+
@sect3{@title{Blocks}
A @x{block} is a list of statements,
@@ -1607,6 +1623,8 @@ in case of errors.
@sect2{expressions| @title{Expressions}
+@simplesect{
+
The basic expressions in Lua are the following:
@Produc{
@producname{exp}@producbody{prefixexp}
@@ -1681,6 +1699,7 @@ even if @id{f} returns several values.
(The value of @T{(f(x,y,z))} is the first value returned by @id{f}
or @nil if @id{f} does not return any values.)
+}
@sect3{arith| @title{Arithmetic Operators}
@@ -2301,6 +2320,8 @@ while all of them share the same @id{x}.
@C{-------------------------------------------------------------------------}
@sect1{API| @title{The Application Program Interface}
+@simplesect{
+
@index{C API}
This section describes the @N{C API} for Lua, that is,
the set of @N{C functions} available to the host program to communicate
@@ -2337,9 +2358,13 @@ every function in the library, except to @Lid{lua_newstate},
which creates a Lua state from scratch and returns a pointer
to the @emph{main thread} in the new state.
+}
+
@sect2{@title{The Stack}
+@simplesect{
+
Lua uses a @emph{virtual stack} to pass values to and from C.
Each element in this stack represents a Lua value
(@nil, number, string, etc.).
@@ -2370,6 +2395,7 @@ and
(that is, the element at @N{the top})
and index @M{-n} represents the first element.
+}
@sect3{stacksize| @title{Stack Size}
@@ -2511,6 +2537,8 @@ the @x{global environment}.
@sect2{C-error|@title{Error Handling in C}
+@simplesect{
+
Internally, Lua uses the C @id{longjmp} facility to handle errors.
(Lua will use exceptions if you compile it as C++;
search for @id{LUAI_THROW} in the source code for details.)
@@ -2559,6 +2587,8 @@ However, there is no guarantee about stack space.
To push anything on the stack,
the panic function must first check the available space @see{stacksize}.
+}
+
@sect3{statuscodes|@title{Status Codes}
@@ -3621,8 +3651,6 @@ The @Lid{lua_pcall} function returns one of the following status codes:
}
-}
-
@APIEntry{
int lua_pcallk (lua_State *L,
int nargs,
@@ -4975,6 +5003,8 @@ refer to the @id{n2}-th upvalue of the Lua closure at index @id{funcindex2}.
@C{-------------------------------------------------------------------------}
@sect1{@title{The Auxiliary Library}
+@simplesect{
+
@index{lauxlib.h}
The @def{auxiliary library} provides several convenient functions
to interface C with Lua.
@@ -5009,6 +5039,9 @@ you should not use these functions for other stack values.
Functions called @id{luaL_check*}
always raise an error if the check is not satisfied.
+}
+
+
@sect2{@title{Functions and Types}
Here we list all functions and types from the auxiliary library
@@ -5933,6 +5966,8 @@ This function is used to build a prefix for error messages.
@C{-------------------------------------------------------------------------}
@sect1{libraries| @title{The Standard Libraries}
+@simplesect{
+
The standard Lua libraries provide useful functions
that are implemented @N{in C} through the @N{C API}.
Some of these functions provide essential services to the language
@@ -6004,6 +6039,9 @@ the host program can open them individually by using
and @defid{luaopen_debug} (for the debug library).
These functions are declared in @defid{lualib.h}.
+}
+
+
@sect2{predefined| @title{Basic Functions}
The basic library provides core functions to Lua.
@@ -6834,6 +6872,8 @@ or @fail plus an error message if none succeeds.
@sect2{strlib| @title{String Manipulation}
+@simplesect{
+
This library provides generic functions for string manipulation,
such as finding and extracting substrings, and pattern matching.
When indexing a string in Lua, the first character is at @N{position 1}
@@ -7187,9 +7227,13 @@ The definition of what a lowercase letter is depends on the current locale.
}
+}
+
@sect3{pm| @title{Patterns}
+@simplesect{
+
Patterns in Lua are described by regular strings,
which are interpreted as patterns by the pattern-matching functions
@Lid{string.find},
@@ -7199,6 +7243,8 @@ and @Lid{string.match}.
This section describes the syntax and the meaning
(that is, what they match) of these strings.
+}
+
@sect4{@title{Character Class:}
A @def{character class} is used to represent a set of characters.
The following combinations are allowed in describing a character class:
@@ -8910,6 +8956,8 @@ is a more portable solution.
@sect1{incompat| @title{Incompatibilities with the Previous Version}
+@simplesect{
+
Here we list the incompatibilities that you may find when moving a program
from @N{Lua 5.3} to @N{Lua 5.4}.
@@ -8942,6 +8990,8 @@ precompiled chunks are not compatible between different Lua versions.
The standard paths in the official distribution may
change between versions.
+}
+
@sect2{@title{Incompatibilities in the Language}
@itemize{