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-9e0a8475cdd53af664b807c4f0c4d53088a7faf2.tar.gz
lua-9e0a8475cdd53af664b807c4f0c4d53088a7faf2.tar.bz2
lua-9e0a8475cdd53af664b807c4f0c4d53088a7faf2.zip
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 @@
16 16
17 17
18/* global table */ 18/* global table */
19#define LUA_GNAME "_G" 19#define LUA_GNAME "_G"
20 20
21 21
22typedef struct luaL_Buffer luaL_Buffer; 22typedef 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) {
152** and its key is not marked, mark its entry as dead. This allows the 152** and its key is not marked, mark its entry as dead. This allows the
153** collection of the key, but keeps its entry in the table (its removal 153** collection of the key, but keeps its entry in the table (its removal
154** could break a chain). The main feature of a dead key is that it must 154** could break a chain). The main feature of a dead key is that it must
155** be different from any other value, to do not disturb searches. 155** be different from any other value, to do not disturb searches.
156** Other places never manipulate dead keys, because its associated empty 156** Other places never manipulate dead keys, because its associated empty
157** value is enough to signal that the entry is logically empty. 157** value is enough to signal that the entry is logically empty.
158*/ 158*/
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 */
195 195
196typedef enum { 196typedef enum {
197/*---------------------------------------------------------------------- 197/*----------------------------------------------------------------------
198name args description 198 name args description
199------------------------------------------------------------------------*/ 199------------------------------------------------------------------------*/
200OP_MOVE,/* A B R[A] := R[B] */ 200OP_MOVE,/* A B R[A] := R[B] */
201OP_LOADI,/* A sBx R[A] := sBx */ 201OP_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 @@
29** Integer type for decoded UTF-8 values; MAXUTF needs 31 bits. 29** Integer type for decoded UTF-8 values; MAXUTF needs 31 bits.
30*/ 30*/
31#if (UINT_MAX >> 30) >= 1 31#if (UINT_MAX >> 30) >= 1
32typedef unsigned int utfint; 32typedef unsigned int utfint;
33#else 33#else
34typedef unsigned long utfint; 34typedef unsigned long utfint;
35#endif 35#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}.
59@C{-------------------------------------------------------------------------} 59@C{-------------------------------------------------------------------------}
60@sect1{basic| @title{Basic Concepts} 60@sect1{basic| @title{Basic Concepts}
61 61
62@simplesect{
63
62This section describes the basic concepts of the language. 64This section describes the basic concepts of the language.
63 65
66}
67
64@sect2{TypesSec| @title{Values and Types} 68@sect2{TypesSec| @title{Values and Types}
65 69
66Lua is a dynamically typed language. 70Lua is a dynamically typed language.
@@ -570,6 +574,8 @@ right after its creation.
570 574
571@sect2{GC| @title{Garbage Collection} 575@sect2{GC| @title{Garbage Collection}
572 576
577@simplesect{
578
573Lua performs automatic memory management. 579Lua performs automatic memory management.
574This means that 580This means that
575you do not have to worry about allocating memory for new objects 581you do not have to worry about allocating memory for new objects
@@ -597,6 +603,8 @@ or @Lid{collectgarbage} in Lua.
597You can also use these functions to control 603You can also use these functions to control
598the collector directly (e.g., to stop and restart it). 604the collector directly (e.g., to stop and restart it).
599 605
606}
607
600@sect3{incmode| @title{Incremental Garbage Collection} 608@sect3{incmode| @title{Incremental Garbage Collection}
601 609
602In incremental mode, 610In incremental mode,
@@ -934,6 +942,8 @@ and @Lid{lua_yield}.
934@C{-------------------------------------------------------------------------} 942@C{-------------------------------------------------------------------------}
935@sect1{language| @title{The Language} 943@sect1{language| @title{The Language}
936 944
945@simplesect{
946
937This section describes the lexis, the syntax, and the semantics of Lua. 947This section describes the lexis, the syntax, and the semantics of Lua.
938In other words, 948In other words,
939this section describes 949this section describes
@@ -951,6 +961,8 @@ and other terminal symbols are shown like @bnfter{=}.
951The complete syntax of Lua can be found in @refsec{BNF} 961The complete syntax of Lua can be found in @refsec{BNF}
952at the end of this manual. 962at the end of this manual.
953 963
964}
965
954@sect2{lexical| @title{Lexical Conventions} 966@sect2{lexical| @title{Lexical Conventions}
955 967
956Lua is a @x{free-form} language. 968Lua is a @x{free-form} language.
@@ -1175,12 +1187,16 @@ the variable @id{_ENV} itself is never global @see{globalenv}.
1175 1187
1176@sect2{stats| @title{Statements} 1188@sect2{stats| @title{Statements}
1177 1189
1190@simplesect{
1191
1178Lua supports an almost conventional set of @x{statements}, 1192Lua supports an almost conventional set of @x{statements},
1179similar to those in other conventional languages. 1193similar to those in other conventional languages.
1180This set includes 1194This set includes
1181blocks, assignments, control structures, function calls, 1195blocks, assignments, control structures, function calls,
1182and variable declarations. 1196and variable declarations.
1183 1197
1198}
1199
1184@sect3{@title{Blocks} 1200@sect3{@title{Blocks}
1185 1201
1186A @x{block} is a list of statements, 1202A @x{block} is a list of statements,
@@ -1607,6 +1623,8 @@ in case of errors.
1607 1623
1608@sect2{expressions| @title{Expressions} 1624@sect2{expressions| @title{Expressions}
1609 1625
1626@simplesect{
1627
1610The basic expressions in Lua are the following: 1628The basic expressions in Lua are the following:
1611@Produc{ 1629@Produc{
1612@producname{exp}@producbody{prefixexp} 1630@producname{exp}@producbody{prefixexp}
@@ -1681,6 +1699,7 @@ even if @id{f} returns several values.
1681(The value of @T{(f(x,y,z))} is the first value returned by @id{f} 1699(The value of @T{(f(x,y,z))} is the first value returned by @id{f}
1682or @nil if @id{f} does not return any values.) 1700or @nil if @id{f} does not return any values.)
1683 1701
1702}
1684 1703
1685 1704
1686@sect3{arith| @title{Arithmetic Operators} 1705@sect3{arith| @title{Arithmetic Operators}
@@ -2301,6 +2320,8 @@ while all of them share the same @id{x}.
2301@C{-------------------------------------------------------------------------} 2320@C{-------------------------------------------------------------------------}
2302@sect1{API| @title{The Application Program Interface} 2321@sect1{API| @title{The Application Program Interface}
2303 2322
2323@simplesect{
2324
2304@index{C API} 2325@index{C API}
2305This section describes the @N{C API} for Lua, that is, 2326This section describes the @N{C API} for Lua, that is,
2306the set of @N{C functions} available to the host program to communicate 2327the 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},
2337which creates a Lua state from scratch and returns a pointer 2358which creates a Lua state from scratch and returns a pointer
2338to the @emph{main thread} in the new state. 2359to the @emph{main thread} in the new state.
2339 2360
2361}
2362
2340 2363
2341@sect2{@title{The Stack} 2364@sect2{@title{The Stack}
2342 2365
2366@simplesect{
2367
2343Lua uses a @emph{virtual stack} to pass values to and from C. 2368Lua uses a @emph{virtual stack} to pass values to and from C.
2344Each element in this stack represents a Lua value 2369Each element in this stack represents a Lua value
2345(@nil, number, string, etc.). 2370(@nil, number, string, etc.).
@@ -2370,6 +2395,7 @@ and
2370(that is, the element at @N{the top}) 2395(that is, the element at @N{the top})
2371and index @M{-n} represents the first element. 2396and index @M{-n} represents the first element.
2372 2397
2398}
2373 2399
2374@sect3{stacksize| @title{Stack Size} 2400@sect3{stacksize| @title{Stack Size}
2375 2401
@@ -2511,6 +2537,8 @@ the @x{global environment}.
2511 2537
2512@sect2{C-error|@title{Error Handling in C} 2538@sect2{C-error|@title{Error Handling in C}
2513 2539
2540@simplesect{
2541
2514Internally, Lua uses the C @id{longjmp} facility to handle errors. 2542Internally, Lua uses the C @id{longjmp} facility to handle errors.
2515(Lua will use exceptions if you compile it as C++; 2543(Lua will use exceptions if you compile it as C++;
2516search for @id{LUAI_THROW} in the source code for details.) 2544search for @id{LUAI_THROW} in the source code for details.)
@@ -2559,6 +2587,8 @@ However, there is no guarantee about stack space.
2559To push anything on the stack, 2587To push anything on the stack,
2560the panic function must first check the available space @see{stacksize}. 2588the panic function must first check the available space @see{stacksize}.
2561 2589
2590}
2591
2562 2592
2563@sect3{statuscodes|@title{Status Codes} 2593@sect3{statuscodes|@title{Status Codes}
2564 2594
@@ -3621,8 +3651,6 @@ The @Lid{lua_pcall} function returns one of the following status codes:
3621 3651
3622} 3652}
3623 3653
3624}
3625
3626@APIEntry{ 3654@APIEntry{
3627int lua_pcallk (lua_State *L, 3655int lua_pcallk (lua_State *L,
3628 int nargs, 3656 int nargs,
@@ -4975,6 +5003,8 @@ refer to the @id{n2}-th upvalue of the Lua closure at index @id{funcindex2}.
4975@C{-------------------------------------------------------------------------} 5003@C{-------------------------------------------------------------------------}
4976@sect1{@title{The Auxiliary Library} 5004@sect1{@title{The Auxiliary Library}
4977 5005
5006@simplesect{
5007
4978@index{lauxlib.h} 5008@index{lauxlib.h}
4979The @def{auxiliary library} provides several convenient functions 5009The @def{auxiliary library} provides several convenient functions
4980to interface C with Lua. 5010to interface C with Lua.
@@ -5009,6 +5039,9 @@ you should not use these functions for other stack values.
5009Functions called @id{luaL_check*} 5039Functions called @id{luaL_check*}
5010always raise an error if the check is not satisfied. 5040always raise an error if the check is not satisfied.
5011 5041
5042}
5043
5044
5012@sect2{@title{Functions and Types} 5045@sect2{@title{Functions and Types}
5013 5046
5014Here we list all functions and types from the auxiliary library 5047Here 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.
5933@C{-------------------------------------------------------------------------} 5966@C{-------------------------------------------------------------------------}
5934@sect1{libraries| @title{The Standard Libraries} 5967@sect1{libraries| @title{The Standard Libraries}
5935 5968
5969@simplesect{
5970
5936The standard Lua libraries provide useful functions 5971The standard Lua libraries provide useful functions
5937that are implemented @N{in C} through the @N{C API}. 5972that are implemented @N{in C} through the @N{C API}.
5938Some of these functions provide essential services to the language 5973Some of these functions provide essential services to the language
@@ -6004,6 +6039,9 @@ the host program can open them individually by using
6004and @defid{luaopen_debug} (for the debug library). 6039and @defid{luaopen_debug} (for the debug library).
6005These functions are declared in @defid{lualib.h}. 6040These functions are declared in @defid{lualib.h}.
6006 6041
6042}
6043
6044
6007@sect2{predefined| @title{Basic Functions} 6045@sect2{predefined| @title{Basic Functions}
6008 6046
6009The basic library provides core functions to Lua. 6047The basic library provides core functions to Lua.
@@ -6834,6 +6872,8 @@ or @fail plus an error message if none succeeds.
6834 6872
6835@sect2{strlib| @title{String Manipulation} 6873@sect2{strlib| @title{String Manipulation}
6836 6874
6875@simplesect{
6876
6837This library provides generic functions for string manipulation, 6877This library provides generic functions for string manipulation,
6838such as finding and extracting substrings, and pattern matching. 6878such as finding and extracting substrings, and pattern matching.
6839When indexing a string in Lua, the first character is at @N{position 1} 6879When 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.
7187 7227
7188} 7228}
7189 7229
7230}
7231
7190 7232
7191@sect3{pm| @title{Patterns} 7233@sect3{pm| @title{Patterns}
7192 7234
7235@simplesect{
7236
7193Patterns in Lua are described by regular strings, 7237Patterns in Lua are described by regular strings,
7194which are interpreted as patterns by the pattern-matching functions 7238which are interpreted as patterns by the pattern-matching functions
7195@Lid{string.find}, 7239@Lid{string.find},
@@ -7199,6 +7243,8 @@ and @Lid{string.match}.
7199This section describes the syntax and the meaning 7243This section describes the syntax and the meaning
7200(that is, what they match) of these strings. 7244(that is, what they match) of these strings.
7201 7245
7246}
7247
7202@sect4{@title{Character Class:} 7248@sect4{@title{Character Class:}
7203A @def{character class} is used to represent a set of characters. 7249A @def{character class} is used to represent a set of characters.
7204The following combinations are allowed in describing a character class: 7250The following combinations are allowed in describing a character class:
@@ -8910,6 +8956,8 @@ is a more portable solution.
8910 8956
8911@sect1{incompat| @title{Incompatibilities with the Previous Version} 8957@sect1{incompat| @title{Incompatibilities with the Previous Version}
8912 8958
8959@simplesect{
8960
8913Here we list the incompatibilities that you may find when moving a program 8961Here we list the incompatibilities that you may find when moving a program
8914from @N{Lua 5.3} to @N{Lua 5.4}. 8962from @N{Lua 5.3} to @N{Lua 5.4}.
8915 8963
@@ -8942,6 +8990,8 @@ precompiled chunks are not compatible between different Lua versions.
8942The standard paths in the official distribution may 8990The standard paths in the official distribution may
8943change between versions. 8991change between versions.
8944 8992
8993}
8994
8945@sect2{@title{Incompatibilities in the Language} 8995@sect2{@title{Incompatibilities in the Language}
8946@itemize{ 8996@itemize{
8947 8997