diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-10-23 11:10:19 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-10-23 11:10:19 -0300 |
commit | b93f3b00bb76cddbf600eb399849fb0c01d197fd (patch) | |
tree | 0956d95c1485780a89f759b83e5f4f51dd4ab523 | |
parent | 4c32d9300c77a70b7c20b2eebda40e97541e3f01 (diff) | |
download | lua-b93f3b00bb76cddbf600eb399849fb0c01d197fd.tar.gz lua-b93f3b00bb76cddbf600eb399849fb0c01d197fd.tar.bz2 lua-b93f3b00bb76cddbf600eb399849fb0c01d197fd.zip |
Added function 'luaL_buffsub'
-rw-r--r-- | lauxlib.h | 2 | ||||
-rw-r--r-- | manual/manual.of | 26 |
2 files changed, 19 insertions, 9 deletions
@@ -185,6 +185,8 @@ struct luaL_Buffer { | |||
185 | 185 | ||
186 | #define luaL_addsize(B,s) ((B)->n += (s)) | 186 | #define luaL_addsize(B,s) ((B)->n += (s)) |
187 | 187 | ||
188 | #define luaL_buffsub(B,s) ((B)->n -= (s)) | ||
189 | |||
188 | LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); | 190 | LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); |
189 | LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); | 191 | LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); |
190 | LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); | 192 | LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); |
diff --git a/manual/manual.of b/manual/manual.of index 3d79e7e2..00ab4cd5 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -5005,10 +5005,9 @@ const void luaL_addgsub (luaL_Buffer *B, const char *s, | |||
5005 | const char *p, const char *r);| | 5005 | const char *p, const char *r);| |
5006 | @apii{0,0,m} | 5006 | @apii{0,0,m} |
5007 | 5007 | ||
5008 | Adds a copy of the string @id{s} to the buffer @id{B}, | 5008 | Adds a copy of the string @id{s} to the buffer @id{B} @seeC{luaL_Buffer}, |
5009 | replacing any occurrence of the string @id{p} | 5009 | replacing any occurrence of the string @id{p} |
5010 | with the string @id{r}. | 5010 | with the string @id{r}. |
5011 | @seeC{luaL_Buffer}. | ||
5012 | 5011 | ||
5013 | } | 5012 | } |
5014 | 5013 | ||
@@ -5025,7 +5024,7 @@ The string can contain @x{embedded zeros}. | |||
5025 | @APIEntry{void luaL_addsize (luaL_Buffer *B, size_t n);| | 5024 | @APIEntry{void luaL_addsize (luaL_Buffer *B, size_t n);| |
5026 | @apii{?,?,-} | 5025 | @apii{?,?,-} |
5027 | 5026 | ||
5028 | Adds to the buffer @id{B} @seeC{luaL_Buffer} | 5027 | Adds to the buffer @id{B} |
5029 | a string of length @id{n} previously copied to the | 5028 | a string of length @id{n} previously copied to the |
5030 | buffer area @seeC{luaL_prepbuffer}. | 5029 | buffer area @seeC{luaL_prepbuffer}. |
5031 | 5030 | ||
@@ -5157,26 +5156,26 @@ plus the final string on its top. | |||
5157 | @APIEntry{char *luaL_buffaddr (luaL_Buffer *B);| | 5156 | @APIEntry{char *luaL_buffaddr (luaL_Buffer *B);| |
5158 | @apii{0,0,-} | 5157 | @apii{0,0,-} |
5159 | 5158 | ||
5160 | Returns the address of the current contents of buffer @id{B}. | 5159 | Returns the address of the current contents of buffer @id{B} |
5161 | Note that any addition to the buffer may invalidate this address. | ||
5162 | @seeC{luaL_Buffer}. | 5160 | @seeC{luaL_Buffer}. |
5161 | Note that any addition to the buffer may invalidate this address. | ||
5163 | 5162 | ||
5164 | } | 5163 | } |
5165 | 5164 | ||
5166 | @APIEntry{void luaL_buffinit (lua_State *L, luaL_Buffer *B);| | 5165 | @APIEntry{void luaL_buffinit (lua_State *L, luaL_Buffer *B);| |
5167 | @apii{0,0,-} | 5166 | @apii{0,0,-} |
5168 | 5167 | ||
5169 | Initializes a buffer @id{B}. | 5168 | Initializes a buffer @id{B} |
5170 | This function does not allocate any space; | ||
5171 | the buffer must be declared as a variable | ||
5172 | @seeC{luaL_Buffer}. | 5169 | @seeC{luaL_Buffer}. |
5170 | This function does not allocate any space; | ||
5171 | the buffer must be declared as a variable. | ||
5173 | 5172 | ||
5174 | } | 5173 | } |
5175 | 5174 | ||
5176 | @APIEntry{size_t luaL_bufflen (luaL_Buffer *B);| | 5175 | @APIEntry{size_t luaL_bufflen (luaL_Buffer *B);| |
5177 | @apii{0,0,-} | 5176 | @apii{0,0,-} |
5178 | 5177 | ||
5179 | Returns the length of the current contents of buffer @id{B}. | 5178 | Returns the length of the current contents of buffer @id{B} |
5180 | @seeC{luaL_Buffer}. | 5179 | @seeC{luaL_Buffer}. |
5181 | 5180 | ||
5182 | } | 5181 | } |
@@ -5189,6 +5188,15 @@ Equivalent to the sequence | |||
5189 | 5188 | ||
5190 | } | 5189 | } |
5191 | 5190 | ||
5191 | @APIEntry{void luaL_buffsub (luaL_Buffer *B, int n);| | ||
5192 | @apii{0,0,-} | ||
5193 | |||
5194 | Removes @id{n} bytes from the the buffer @id{B} | ||
5195 | @seeC{luaL_Buffer}. | ||
5196 | The buffer must have at least that many bytes. | ||
5197 | |||
5198 | } | ||
5199 | |||
5192 | @APIEntry{int luaL_callmeta (lua_State *L, int obj, const char *e);| | 5200 | @APIEntry{int luaL_callmeta (lua_State *L, int obj, const char *e);| |
5193 | @apii{0,0|1,e} | 5201 | @apii{0,0|1,e} |
5194 | 5202 | ||