Classes | Macros | Typedefs | Enumerations | Functions | Variables
lstrlib.c File Reference
#include "lprefix.h"
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
Include dependency graph for lstrlib.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cD
 
union  Ftypes
 
struct  GMatchState
 
union  Header
 
struct  MatchState
 
struct  str_Writer
 

Macros

#define CAP_POSITION   (-2)
 
#define CAP_UNFINISHED   (-1)
 
#define L_ESC   '%'
 
#define L_FMTFLAGS   "-+ #0"
 
#define lstrlib_c
 
#define LUA_LIB
 
#define LUA_MAXCAPTURES   32
 
#define LUAL_PACKPADBYTE   0x00
 
#define MAX_FORMAT   32
 
#define MAX_ITEM   120
 
#define MAX_ITEMF   (110 + l_floatatt(MAX_10_EXP))
 
#define MAX_SIZET   ((size_t)(~(size_t)0))
 
#define MAXALIGN   (offsetof(struct cD, u))
 
#define MAXCCALLS   200
 
#define MAXINTSIZE   16
 
#define MAXSIZE   (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX))
 
#define MC   ((1 << NB) - 1)
 
#define NB   CHAR_BIT
 
#define SPECIALS   "^$*+?.([%-"
 
#define SZINT   ((int)sizeof(lua_Integer))
 
#define uchar(c)   ((unsigned char)(c))
 

Typedefs

typedef union Ftypes Ftypes
 
typedef struct GMatchState GMatchState
 
typedef struct Header Header
 
typedef enum KOption KOption
 
typedef struct MatchState MatchState
 

Enumerations

enum  KOption {
  Kint, Kuint, Kfloat, Kchar,
  Kstring, Kzstr, Kpadding, Kpaddalign,
  Knop
}
 

Functions

static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, const char *e)
 
static int add_value (MatchState *ms, luaL_Buffer *b, const char *s, const char *e, int tr)
 
static void addlenmod (char *form, const char *lenmod)
 
static void addliteral (lua_State *L, luaL_Buffer *b, int arg)
 
static void addquoted (luaL_Buffer *b, const char *s, size_t len)
 
static int arith (lua_State *L, int op, const char *mtname)
 
static int arith_add (lua_State *L)
 
static int arith_div (lua_State *L)
 
static int arith_idiv (lua_State *L)
 
static int arith_mod (lua_State *L)
 
static int arith_mul (lua_State *L)
 
static int arith_pow (lua_State *L)
 
static int arith_sub (lua_State *L)
 
static int arith_unm (lua_State *L)
 
static int capture_to_close (MatchState *ms)
 
static int check_capture (MatchState *ms, int l)
 
static const char * classend (MatchState *ms, const char *p)
 
static void copywithendian (volatile char *dest, volatile const char *src, int size, int islittle)
 
static void createmetatable (lua_State *L)
 
static int digit (int c)
 
static const char * end_capture (MatchState *ms, const char *s, const char *p)
 
static size_t get_onecapture (MatchState *ms, int i, const char *s, const char *e, const char **cap)
 
static KOption getdetails (Header *h, size_t totalsize, const char **fmt, int *psize, int *ntoalign)
 
static size_t getendpos (lua_State *L, int arg, lua_Integer def, size_t len)
 
static int getnum (const char **fmt, int df)
 
static int getnumlimit (Header *h, const char **fmt, int df)
 
static KOption getoption (Header *h, const char **fmt, int *size)
 
static int gmatch (lua_State *L)
 
static int gmatch_aux (lua_State *L)
 
static void initheader (lua_State *L, Header *h)
 
static const char * lmemfind (const char *s1, size_t l1, const char *s2, size_t l2)
 
LUAMOD_API int luaopen_string (lua_State *L)
 
static const char * match (MatchState *ms, const char *s, const char *p)
 
static const char * match_capture (MatchState *ms, const char *s, int l)
 
static int match_class (int c, int cl)
 
static const char * matchbalance (MatchState *ms, const char *s, const char *p)
 
static int matchbracketclass (int c, const char *p, const char *ec)
 
static const char * max_expand (MatchState *ms, const char *s, const char *p, const char *ep)
 
static const char * min_expand (MatchState *ms, const char *s, const char *p, const char *ep)
 
static int nospecials (const char *p, size_t l)
 
static void packint (luaL_Buffer *b, lua_Unsigned n, int islittle, int size, int neg)
 
static size_t posrelatI (lua_Integer pos, size_t len)
 
static void prepstate (MatchState *ms, lua_State *L, const char *s, size_t ls, const char *p, size_t lp)
 
static int push_captures (MatchState *ms, const char *s, const char *e)
 
static void push_onecapture (MatchState *ms, int i, const char *s, const char *e)
 
static int quotefloat (lua_State *L, char *buff, lua_Number n)
 
static void reprepstate (MatchState *ms)
 
static const char * scanformat (lua_State *L, const char *strfrmt, char *form)
 
static int singlematch (MatchState *ms, const char *s, const char *p, const char *ep)
 
static const char * start_capture (MatchState *ms, const char *s, const char *p, int what)
 
static int str_byte (lua_State *L)
 
static int str_char (lua_State *L)
 
static int str_dump (lua_State *L)
 
static int str_find (lua_State *L)
 
static int str_find_aux (lua_State *L, int find)
 
static int str_format (lua_State *L)
 
static int str_gsub (lua_State *L)
 
static int str_len (lua_State *L)
 
static int str_lower (lua_State *L)
 
static int str_match (lua_State *L)
 
static int str_pack (lua_State *L)
 
static int str_packsize (lua_State *L)
 
static int str_rep (lua_State *L)
 
static int str_reverse (lua_State *L)
 
static int str_sub (lua_State *L)
 
static int str_unpack (lua_State *L)
 
static int str_upper (lua_State *L)
 
static int tonum (lua_State *L, int arg)
 
static void trymt (lua_State *L, const char *mtname)
 
static lua_Integer unpackint (lua_State *L, const char *str, int islittle, int size, int issigned)
 
static int writer (lua_State *L, const void *b, size_t size, void *ud)
 

Variables

union {
   int   dummy
 
   char   little
 
nativeendian = {1}
 
static const luaL_Reg stringmetamethods []
 
static const luaL_Reg strlib []
 

Macro Definition Documentation

#define CAP_POSITION   (-2)

Definition at line 353 of file lstrlib.c.

#define CAP_UNFINISHED   (-1)

Definition at line 352 of file lstrlib.c.

#define L_ESC   '%'

Definition at line 380 of file lstrlib.c.

#define L_FMTFLAGS   "-+ #0"

Definition at line 1091 of file lstrlib.c.

#define lstrlib_c

Definition at line 7 of file lstrlib.c.

#define LUA_LIB

Definition at line 8 of file lstrlib.c.

#define LUA_MAXCAPTURES   32

Definition at line 35 of file lstrlib.c.

#define LUAL_PACKPADBYTE   0x00

Definition at line 1329 of file lstrlib.c.

#define MAX_FORMAT   32

Definition at line 1098 of file lstrlib.c.

#define MAX_ITEM   120

Definition at line 1086 of file lstrlib.c.

#define MAX_ITEMF   (110 + l_floatatt(MAX_10_EXP))

Definition at line 1075 of file lstrlib.c.

#define MAX_SIZET   ((size_t)(~(size_t)0))

Definition at line 47 of file lstrlib.c.

#define MAXALIGN   (offsetof(struct cD, u))

Definition at line 1358 of file lstrlib.c.

#define MAXCCALLS   200

Definition at line 376 of file lstrlib.c.

#define MAXINTSIZE   16

Definition at line 1333 of file lstrlib.c.

#define MAXSIZE   (sizeof(size_t) < sizeof(int) ? MAX_SIZET : (size_t)(INT_MAX))

Definition at line 49 of file lstrlib.c.

#define MC   ((1 << NB) - 1)

Definition at line 1339 of file lstrlib.c.

#define NB   CHAR_BIT

Definition at line 1336 of file lstrlib.c.

#define SPECIALS   "^$*+?.([%-"

Definition at line 381 of file lstrlib.c.

#define SZINT   ((int)sizeof(lua_Integer))

Definition at line 1342 of file lstrlib.c.

#define uchar (   c)    ((unsigned char)(c))

Definition at line 40 of file lstrlib.c.

Typedef Documentation

typedef union Ftypes Ftypes
typedef struct GMatchState GMatchState
typedef struct Header Header
typedef enum KOption KOption
typedef struct MatchState MatchState

Enumeration Type Documentation

enum KOption
Enumerator
Kint 
Kuint 
Kfloat 
Kchar 
Kstring 
Kzstr 
Kpadding 
Kpaddalign 
Knop 

Definition at line 1385 of file lstrlib.c.

Function Documentation

static void add_s ( MatchState ms,
luaL_Buffer b,
const char *  s,
const char *  e 
)
static

Definition at line 868 of file lstrlib.c.

static int add_value ( MatchState ms,
luaL_Buffer b,
const char *  s,
const char *  e,
int  tr 
)
static

Definition at line 903 of file lstrlib.c.

static void addlenmod ( char *  form,
const char *  lenmod 
)
static

Definition at line 1214 of file lstrlib.c.

static void addliteral ( lua_State L,
luaL_Buffer b,
int  arg 
)
static

Definition at line 1154 of file lstrlib.c.

static void addquoted ( luaL_Buffer b,
const char *  s,
size_t  len 
)
static

Definition at line 1101 of file lstrlib.c.

static int arith ( lua_State L,
int  op,
const char *  mtname 
)
static

Definition at line 286 of file lstrlib.c.

static int arith_add ( lua_State L)
static

Definition at line 295 of file lstrlib.c.

static int arith_div ( lua_State L)
static

Definition at line 315 of file lstrlib.c.

static int arith_idiv ( lua_State L)
static

Definition at line 319 of file lstrlib.c.

static int arith_mod ( lua_State L)
static

Definition at line 307 of file lstrlib.c.

static int arith_mul ( lua_State L)
static

Definition at line 303 of file lstrlib.c.

static int arith_pow ( lua_State L)
static

Definition at line 311 of file lstrlib.c.

static int arith_sub ( lua_State L)
static

Definition at line 299 of file lstrlib.c.

static int arith_unm ( lua_State L)
static

Definition at line 323 of file lstrlib.c.

static int capture_to_close ( MatchState ms)
static

Definition at line 392 of file lstrlib.c.

static int check_capture ( MatchState ms,
int  l 
)
static

Definition at line 384 of file lstrlib.c.

static const char* classend ( MatchState ms,
const char *  p 
)
static

Definition at line 400 of file lstrlib.c.

static void copywithendian ( volatile char *  dest,
volatile const char *  src,
int  size,
int  islittle 
)
static

Definition at line 1538 of file lstrlib.c.

static void createmetatable ( lua_State L)
static

Definition at line 1783 of file lstrlib.c.

static int digit ( int  c)
static

Definition at line 1402 of file lstrlib.c.

static const char* end_capture ( MatchState ms,
const char *  s,
const char *  p 
)
static

Definition at line 545 of file lstrlib.c.

static size_t get_onecapture ( MatchState ms,
int  i,
const char *  s,
const char *  e,
const char **  cap 
)
static

Definition at line 699 of file lstrlib.c.

static KOption getdetails ( Header h,
size_t  totalsize,
const char **  fmt,
int *  psize,
int *  ntoalign 
)
static

Definition at line 1490 of file lstrlib.c.

static size_t getendpos ( lua_State L,
int  arg,
lua_Integer  def,
size_t  len 
)
static

Definition at line 87 of file lstrlib.c.

static int getnum ( const char **  fmt,
int  df 
)
static

Definition at line 1404 of file lstrlib.c.

static int getnumlimit ( Header h,
const char **  fmt,
int  df 
)
static

Definition at line 1421 of file lstrlib.c.

static KOption getoption ( Header h,
const char **  fmt,
int *  size 
)
static

Definition at line 1443 of file lstrlib.c.

static int gmatch ( lua_State L)
static

Definition at line 851 of file lstrlib.c.

static int gmatch_aux ( lua_State L)
static

Definition at line 835 of file lstrlib.c.

static void initheader ( lua_State L,
Header h 
)
static

Definition at line 1433 of file lstrlib.c.

static const char* lmemfind ( const char *  s1,
size_t  l1,
const char *  s2,
size_t  l2 
)
static

Definition at line 670 of file lstrlib.c.

LUAMOD_API int luaopen_string ( lua_State L)

Definition at line 1800 of file lstrlib.c.

static const char * match ( MatchState ms,
const char *  s,
const char *  p 
)
static

Definition at line 567 of file lstrlib.c.

static const char* match_capture ( MatchState ms,
const char *  s,
int  l 
)
static

Definition at line 556 of file lstrlib.c.

static int match_class ( int  c,
int  cl 
)
static

Definition at line 424 of file lstrlib.c.

static const char* matchbalance ( MatchState ms,
const char *  s,
const char *  p 
)
static

Definition at line 483 of file lstrlib.c.

static int matchbracketclass ( int  c,
const char *  p,
const char *  ec 
)
static

Definition at line 444 of file lstrlib.c.

static const char* max_expand ( MatchState ms,
const char *  s,
const char *  p,
const char *  ep 
)
static

Definition at line 503 of file lstrlib.c.

static const char* min_expand ( MatchState ms,
const char *  s,
const char *  p,
const char *  ep 
)
static

Definition at line 518 of file lstrlib.c.

static int nospecials ( const char *  p,
size_t  l 
)
static

Definition at line 743 of file lstrlib.c.

static void packint ( luaL_Buffer b,
lua_Unsigned  n,
int  islittle,
int  size,
int  neg 
)
static

Definition at line 1517 of file lstrlib.c.

static size_t posrelatI ( lua_Integer  pos,
size_t  len 
)
static

Definition at line 71 of file lstrlib.c.

static void prepstate ( MatchState ms,
lua_State L,
const char *  s,
size_t  ls,
const char *  p,
size_t  lp 
)
static

Definition at line 754 of file lstrlib.c.

static int push_captures ( MatchState ms,
const char *  s,
const char *  e 
)
static

Definition at line 732 of file lstrlib.c.

static void push_onecapture ( MatchState ms,
int  i,
const char *  s,
const char *  e 
)
static

Definition at line 722 of file lstrlib.c.

static int quotefloat ( lua_State L,
char *  buff,
lua_Number  n 
)
static

Definition at line 1130 of file lstrlib.c.

static void reprepstate ( MatchState ms)
static

Definition at line 764 of file lstrlib.c.

static const char* scanformat ( lua_State L,
const char *  strfrmt,
char *  form 
)
static

Definition at line 1189 of file lstrlib.c.

static int singlematch ( MatchState ms,
const char *  s,
const char *  p,
const char *  ep 
)
static

Definition at line 467 of file lstrlib.c.

static const char* start_capture ( MatchState ms,
const char *  s,
const char *  p,
int  what 
)
static

Definition at line 531 of file lstrlib.c.

static int str_byte ( lua_State L)
static

Definition at line 176 of file lstrlib.c.

static int str_char ( lua_State L)
static

Definition at line 194 of file lstrlib.c.

static int str_dump ( lua_State L)
static

Definition at line 232 of file lstrlib.c.

static int str_find ( lua_State L)
static

Definition at line 816 of file lstrlib.c.

static int str_find_aux ( lua_State L,
int  find 
)
static

Definition at line 770 of file lstrlib.c.

static int str_format ( lua_State L)
static

Definition at line 1224 of file lstrlib.c.

static int str_gsub ( lua_State L)
static

Definition at line 939 of file lstrlib.c.

static int str_len ( lua_State L)
static

Definition at line 55 of file lstrlib.c.

static int str_lower ( lua_State L)
static

Definition at line 124 of file lstrlib.c.

static int str_match ( lua_State L)
static

Definition at line 821 of file lstrlib.c.

static int str_pack ( lua_State L)
static

Definition at line 1552 of file lstrlib.c.

static int str_packsize ( lua_State L)
static

Definition at line 1639 of file lstrlib.c.

static int str_rep ( lua_State L)
static

Definition at line 150 of file lstrlib.c.

static int str_reverse ( lua_State L)
static

Definition at line 112 of file lstrlib.c.

static int str_sub ( lua_State L)
static

Definition at line 100 of file lstrlib.c.

static int str_unpack ( lua_State L)
static

Definition at line 1693 of file lstrlib.c.

static int str_upper ( lua_State L)
static

Definition at line 137 of file lstrlib.c.

static int tonum ( lua_State L,
int  arg 
)
static

Definition at line 263 of file lstrlib.c.

static void trymt ( lua_State L,
const char *  mtname 
)
static

Definition at line 276 of file lstrlib.c.

static lua_Integer unpackint ( lua_State L,
const char *  str,
int  islittle,
int  size,
int  issigned 
)
static

Definition at line 1667 of file lstrlib.c.

static int writer ( lua_State L,
const void *  b,
size_t  size,
void *  ud 
)
static

Definition at line 221 of file lstrlib.c.

Variable Documentation

int dummy

Definition at line 1347 of file lstrlib.c.

char little

Definition at line 1348 of file lstrlib.c.

const { ... } nativeendian
const luaL_Reg stringmetamethods[]
static
Initial value:
= {
{"__add", arith_add},
{"__sub", arith_sub},
{"__mul", arith_mul},
{"__mod", arith_mod},
{"__pow", arith_pow},
{"__div", arith_div},
{"__idiv", arith_idiv},
{"__unm", arith_unm},
{"__index", NULL},
{NULL, NULL}
}
static int arith_sub(lua_State *L)
Definition: lstrlib.c:299
static int arith_div(lua_State *L)
Definition: lstrlib.c:315
static int arith_idiv(lua_State *L)
Definition: lstrlib.c:319
static int arith_add(lua_State *L)
Definition: lstrlib.c:295
static int arith_pow(lua_State *L)
Definition: lstrlib.c:311
static int arith_mul(lua_State *L)
Definition: lstrlib.c:303
static int arith_mod(lua_State *L)
Definition: lstrlib.c:307
static int arith_unm(lua_State *L)
Definition: lstrlib.c:323

Definition at line 328 of file lstrlib.c.

const luaL_Reg strlib[]
static
Initial value:
= {
{"byte", str_byte},
{"char", str_char},
{"dump", str_dump},
{"find", str_find},
{"format", str_format},
{"gmatch", gmatch},
{"gsub", str_gsub},
{"len", str_len},
{"lower", str_lower},
{"match", str_match},
{"rep", str_rep},
{"reverse", str_reverse},
{"sub", str_sub},
{"upper", str_upper},
{"pack", str_pack},
{"packsize", str_packsize},
{"unpack", str_unpack},
{NULL, NULL}
}
static int str_format(lua_State *L)
Definition: lstrlib.c:1224
static int str_char(lua_State *L)
Definition: lstrlib.c:194
static int str_dump(lua_State *L)
Definition: lstrlib.c:232
static int str_match(lua_State *L)
Definition: lstrlib.c:821
static int str_gsub(lua_State *L)
Definition: lstrlib.c:939
static int str_find(lua_State *L)
Definition: lstrlib.c:816
static int str_packsize(lua_State *L)
Definition: lstrlib.c:1639
static int str_upper(lua_State *L)
Definition: lstrlib.c:137
static int str_pack(lua_State *L)
Definition: lstrlib.c:1552
static int str_unpack(lua_State *L)
Definition: lstrlib.c:1693
static int str_reverse(lua_State *L)
Definition: lstrlib.c:112
static int str_len(lua_State *L)
Definition: lstrlib.c:55
static int gmatch(lua_State *L)
Definition: lstrlib.c:851
static int str_sub(lua_State *L)
Definition: lstrlib.c:100
static int str_lower(lua_State *L)
Definition: lstrlib.c:124
static int str_rep(lua_State *L)
Definition: lstrlib.c:150
static int str_byte(lua_State *L)
Definition: lstrlib.c:176

Definition at line 1761 of file lstrlib.c.



plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 04:02:48