diff options
-rw-r--r-- | lauxlib.h | 2 | ||||
-rw-r--r-- | lgc.c | 2 | ||||
-rw-r--r-- | lopcodes.h | 2 | ||||
-rw-r--r-- | lutf8lib.c | 2 | ||||
-rw-r--r-- | manual/manual.of | 54 |
5 files changed, 56 insertions, 6 deletions
@@ -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 | ||
22 | typedef struct luaL_Buffer luaL_Buffer; | 22 | typedef struct luaL_Buffer luaL_Buffer; |
@@ -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 | */ |
@@ -195,7 +195,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ | |||
195 | 195 | ||
196 | typedef enum { | 196 | typedef enum { |
197 | /*---------------------------------------------------------------------- | 197 | /*---------------------------------------------------------------------- |
198 | name args description | 198 | name args description |
199 | ------------------------------------------------------------------------*/ | 199 | ------------------------------------------------------------------------*/ |
200 | OP_MOVE,/* A B R[A] := R[B] */ | 200 | OP_MOVE,/* A B R[A] := R[B] */ |
201 | OP_LOADI,/* A sBx R[A] := sBx */ | 201 | OP_LOADI,/* A sBx R[A] := sBx */ |
@@ -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 |
32 | typedef unsigned int utfint; | 32 | typedef unsigned int utfint; |
33 | #else | 33 | #else |
34 | typedef unsigned long utfint; | 34 | typedef 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 | |||
62 | This section describes the basic concepts of the language. | 64 | This 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 | ||
66 | Lua is a dynamically typed language. | 70 | Lua 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 | |||
573 | Lua performs automatic memory management. | 579 | Lua performs automatic memory management. |
574 | This means that | 580 | This means that |
575 | you do not have to worry about allocating memory for new objects | 581 | you do not have to worry about allocating memory for new objects |
@@ -597,6 +603,8 @@ or @Lid{collectgarbage} in Lua. | |||
597 | You can also use these functions to control | 603 | You can also use these functions to control |
598 | the collector directly (e.g., to stop and restart it). | 604 | the 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 | ||
602 | In incremental mode, | 610 | In 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 | |||
937 | This section describes the lexis, the syntax, and the semantics of Lua. | 947 | This section describes the lexis, the syntax, and the semantics of Lua. |
938 | In other words, | 948 | In other words, |
939 | this section describes | 949 | this section describes |
@@ -951,6 +961,8 @@ and other terminal symbols are shown like @bnfter{=}. | |||
951 | The complete syntax of Lua can be found in @refsec{BNF} | 961 | The complete syntax of Lua can be found in @refsec{BNF} |
952 | at the end of this manual. | 962 | at the end of this manual. |
953 | 963 | ||
964 | } | ||
965 | |||
954 | @sect2{lexical| @title{Lexical Conventions} | 966 | @sect2{lexical| @title{Lexical Conventions} |
955 | 967 | ||
956 | Lua is a @x{free-form} language. | 968 | Lua 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 | |||
1178 | Lua supports an almost conventional set of @x{statements}, | 1192 | Lua supports an almost conventional set of @x{statements}, |
1179 | similar to those in other conventional languages. | 1193 | similar to those in other conventional languages. |
1180 | This set includes | 1194 | This set includes |
1181 | blocks, assignments, control structures, function calls, | 1195 | blocks, assignments, control structures, function calls, |
1182 | and variable declarations. | 1196 | and variable declarations. |
1183 | 1197 | ||
1198 | } | ||
1199 | |||
1184 | @sect3{@title{Blocks} | 1200 | @sect3{@title{Blocks} |
1185 | 1201 | ||
1186 | A @x{block} is a list of statements, | 1202 | A @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 | |||
1610 | The basic expressions in Lua are the following: | 1628 | The 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} |
1682 | or @nil if @id{f} does not return any values.) | 1700 | or @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} |
2305 | This section describes the @N{C API} for Lua, that is, | 2326 | This section describes the @N{C API} for Lua, that is, |
2306 | the set of @N{C functions} available to the host program to communicate | 2327 | 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}, | |||
2337 | which creates a Lua state from scratch and returns a pointer | 2358 | which creates a Lua state from scratch and returns a pointer |
2338 | to the @emph{main thread} in the new state. | 2359 | to 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 | |||
2343 | Lua uses a @emph{virtual stack} to pass values to and from C. | 2368 | Lua uses a @emph{virtual stack} to pass values to and from C. |
2344 | Each element in this stack represents a Lua value | 2369 | Each 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}) |
2371 | and index @M{-n} represents the first element. | 2396 | and 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 | |||
2514 | Internally, Lua uses the C @id{longjmp} facility to handle errors. | 2542 | Internally, 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++; |
2516 | search for @id{LUAI_THROW} in the source code for details.) | 2544 | search for @id{LUAI_THROW} in the source code for details.) |
@@ -2559,6 +2587,8 @@ However, there is no guarantee about stack space. | |||
2559 | To push anything on the stack, | 2587 | To push anything on the stack, |
2560 | the panic function must first check the available space @see{stacksize}. | 2588 | the 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{ |
3627 | int lua_pcallk (lua_State *L, | 3655 | int 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} |
4979 | The @def{auxiliary library} provides several convenient functions | 5009 | The @def{auxiliary library} provides several convenient functions |
4980 | to interface C with Lua. | 5010 | to interface C with Lua. |
@@ -5009,6 +5039,9 @@ you should not use these functions for other stack values. | |||
5009 | Functions called @id{luaL_check*} | 5039 | Functions called @id{luaL_check*} |
5010 | always raise an error if the check is not satisfied. | 5040 | always 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 | ||
5014 | Here we list all functions and types from the auxiliary library | 5047 | 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. | |||
5933 | @C{-------------------------------------------------------------------------} | 5966 | @C{-------------------------------------------------------------------------} |
5934 | @sect1{libraries| @title{The Standard Libraries} | 5967 | @sect1{libraries| @title{The Standard Libraries} |
5935 | 5968 | ||
5969 | @simplesect{ | ||
5970 | |||
5936 | The standard Lua libraries provide useful functions | 5971 | The standard Lua libraries provide useful functions |
5937 | that are implemented @N{in C} through the @N{C API}. | 5972 | that are implemented @N{in C} through the @N{C API}. |
5938 | Some of these functions provide essential services to the language | 5973 | Some of these functions provide essential services to the language |
@@ -6004,6 +6039,9 @@ the host program can open them individually by using | |||
6004 | and @defid{luaopen_debug} (for the debug library). | 6039 | and @defid{luaopen_debug} (for the debug library). |
6005 | These functions are declared in @defid{lualib.h}. | 6040 | These 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 | ||
6009 | The basic library provides core functions to Lua. | 6047 | The 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 | |||
6837 | This library provides generic functions for string manipulation, | 6877 | This library provides generic functions for string manipulation, |
6838 | such as finding and extracting substrings, and pattern matching. | 6878 | such as finding and extracting substrings, and pattern matching. |
6839 | When indexing a string in Lua, the first character is at @N{position 1} | 6879 | 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. | |||
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 | |||
7193 | Patterns in Lua are described by regular strings, | 7237 | Patterns in Lua are described by regular strings, |
7194 | which are interpreted as patterns by the pattern-matching functions | 7238 | which 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}. | |||
7199 | This section describes the syntax and the meaning | 7243 | This 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:} |
7203 | A @def{character class} is used to represent a set of characters. | 7249 | A @def{character class} is used to represent a set of characters. |
7204 | The following combinations are allowed in describing a character class: | 7250 | The 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 | |||
8913 | Here we list the incompatibilities that you may find when moving a program | 8961 | Here we list the incompatibilities that you may find when moving a program |
8914 | from @N{Lua 5.3} to @N{Lua 5.4}. | 8962 | from @N{Lua 5.3} to @N{Lua 5.4}. |
8915 | 8963 | ||
@@ -8942,6 +8990,8 @@ precompiled chunks are not compatible between different Lua versions. | |||
8942 | The standard paths in the official distribution may | 8990 | The standard paths in the official distribution may |
8943 | change between versions. | 8991 | change 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 | ||