亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? lstrlib.c

?? lua 腳本編譯器, 解釋器, 1.115, 相當(dāng)于lua 5.1.4
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $** Standard library for string operations and pattern-matching** See Copyright Notice in lua.h*/#include <ctype.h>#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#define lstrlib_c#define LUA_LIB#include "lua.h"#include "lauxlib.h"#include "lualib.h"/* macro to `unsign' a character */#define uchar(c)        ((unsigned char)(c))static int str_len (lua_State *L) {  size_t l;  luaL_checklstring(L, 1, &l);  lua_pushinteger(L, l);  return 1;}static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {  /* relative string position: negative means back from end */  if (pos < 0) pos += (ptrdiff_t)len + 1;  return (pos >= 0) ? pos : 0;}static int str_sub (lua_State *L) {  size_t l;  const char *s = luaL_checklstring(L, 1, &l);  ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l);  ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l);  if (start < 1) start = 1;  if (end > (ptrdiff_t)l) end = (ptrdiff_t)l;  if (start <= end)    lua_pushlstring(L, s+start-1, end-start+1);  else lua_pushliteral(L, "");  return 1;}static int str_reverse (lua_State *L) {  size_t l;  luaL_Buffer b;  const char *s = luaL_checklstring(L, 1, &l);  luaL_buffinit(L, &b);  while (l--) luaL_addchar(&b, s[l]);  luaL_pushresult(&b);  return 1;}static int str_lower (lua_State *L) {  size_t l;  size_t i;  luaL_Buffer b;  const char *s = luaL_checklstring(L, 1, &l);  luaL_buffinit(L, &b);  for (i=0; i<l; i++)    luaL_addchar(&b, tolower(uchar(s[i])));  luaL_pushresult(&b);  return 1;}static int str_upper (lua_State *L) {  size_t l;  size_t i;  luaL_Buffer b;  const char *s = luaL_checklstring(L, 1, &l);  luaL_buffinit(L, &b);  for (i=0; i<l; i++)    luaL_addchar(&b, toupper(uchar(s[i])));  luaL_pushresult(&b);  return 1;}static int str_rep (lua_State *L) {  size_t l;  luaL_Buffer b;  const char *s = luaL_checklstring(L, 1, &l);  int n = luaL_checkint(L, 2);  luaL_buffinit(L, &b);  while (n-- > 0)    luaL_addlstring(&b, s, l);  luaL_pushresult(&b);  return 1;}static int str_byte (lua_State *L) {  size_t l;  const char *s = luaL_checklstring(L, 1, &l);  ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l);  ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l);  int n, i;  if (posi <= 0) posi = 1;  if ((size_t)pose > l) pose = l;  if (posi > pose) return 0;  /* empty interval; return no values */  n = (int)(pose -  posi + 1);  if (posi + n <= pose)  /* overflow? */    luaL_error(L, "string slice too long");  luaL_checkstack(L, n, "string slice too long");  for (i=0; i<n; i++)    lua_pushinteger(L, uchar(s[posi+i-1]));  return n;}static int str_char (lua_State *L) {  int n = lua_gettop(L);  /* number of arguments */  int i;  luaL_Buffer b;  luaL_buffinit(L, &b);  for (i=1; i<=n; i++) {    int c = luaL_checkint(L, i);    luaL_argcheck(L, uchar(c) == c, i, "invalid value");    luaL_addchar(&b, uchar(c));  }  luaL_pushresult(&b);  return 1;}static int writer (lua_State *L, const void* b, size_t size, void* B) {  (void)L;  luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);  return 0;}static int str_dump (lua_State *L) {  luaL_Buffer b;  luaL_checktype(L, 1, LUA_TFUNCTION);  lua_settop(L, 1);  luaL_buffinit(L,&b);  if (lua_dump(L, writer, &b) != 0)    luaL_error(L, "unable to dump given function");  luaL_pushresult(&b);  return 1;}/*** {======================================================** PATTERN MATCHING** =======================================================*/#define CAP_UNFINISHED	(-1)#define CAP_POSITION	(-2)typedef struct MatchState {  const char *src_init;  /* init of source string */  const char *src_end;  /* end (`\0') of source string */  lua_State *L;  int level;  /* total number of captures (finished or unfinished) */  struct {    const char *init;    ptrdiff_t len;  } capture[LUA_MAXCAPTURES];} MatchState;#define L_ESC		'%'#define SPECIALS	"^$*+?.([%-"static int check_capture (MatchState *ms, int l) {  l -= '1';  if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)    return luaL_error(ms->L, "invalid capture index");  return l;}static int capture_to_close (MatchState *ms) {  int level = ms->level;  for (level--; level>=0; level--)    if (ms->capture[level].len == CAP_UNFINISHED) return level;  return luaL_error(ms->L, "invalid pattern capture");}static const char *classend (MatchState *ms, const char *p) {  switch (*p++) {    case L_ESC: {      if (*p == '\0')        luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");      return p+1;    }    case '[': {      if (*p == '^') p++;      do {  /* look for a `]' */        if (*p == '\0')          luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");        if (*(p++) == L_ESC && *p != '\0')          p++;  /* skip escapes (e.g. `%]') */      } while (*p != ']');      return p+1;    }    default: {      return p;    }  }}static int match_class (int c, int cl) {  int res;  switch (tolower(cl)) {    case 'a' : res = isalpha(c); break;    case 'c' : res = iscntrl(c); break;    case 'd' : res = isdigit(c); break;    case 'l' : res = islower(c); break;    case 'p' : res = ispunct(c); break;    case 's' : res = isspace(c); break;    case 'u' : res = isupper(c); break;    case 'w' : res = isalnum(c); break;    case 'x' : res = isxdigit(c); break;    case 'z' : res = (c == 0); break;    default: return (cl == c);  }  return (islower(cl) ? res : !res);}static int matchbracketclass (int c, const char *p, const char *ec) {  int sig = 1;  if (*(p+1) == '^') {    sig = 0;    p++;  /* skip the `^' */  }  while (++p < ec) {    if (*p == L_ESC) {      p++;      if (match_class(c, uchar(*p)))        return sig;    }    else if ((*(p+1) == '-') && (p+2 < ec)) {      p+=2;      if (uchar(*(p-2)) <= c && c <= uchar(*p))        return sig;    }    else if (uchar(*p) == c) return sig;  }  return !sig;}static int singlematch (int c, const char *p, const char *ep) {  switch (*p) {    case '.': return 1;  /* matches any char */    case L_ESC: return match_class(c, uchar(*(p+1)));    case '[': return matchbracketclass(c, p, ep-1);    default:  return (uchar(*p) == c);  }}static const char *match (MatchState *ms, const char *s, const char *p);static const char *matchbalance (MatchState *ms, const char *s,                                   const char *p) {  if (*p == 0 || *(p+1) == 0)    luaL_error(ms->L, "unbalanced pattern");  if (*s != *p) return NULL;  else {    int b = *p;    int e = *(p+1);    int cont = 1;    while (++s < ms->src_end) {      if (*s == e) {        if (--cont == 0) return s+1;      }      else if (*s == b) cont++;    }  }  return NULL;  /* string ends out of balance */}static const char *max_expand (MatchState *ms, const char *s,                                 const char *p, const char *ep) {  ptrdiff_t i = 0;  /* counts maximum expand for item */  while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))    i++;  /* keeps trying to match with the maximum repetitions */  while (i>=0) {    const char *res = match(ms, (s+i), ep+1);    if (res) return res;    i--;  /* else didn't match; reduce 1 repetition to try again */  }  return NULL;}static const char *min_expand (MatchState *ms, const char *s,                                 const char *p, const char *ep) {  for (;;) {    const char *res = match(ms, s, ep+1);    if (res != NULL)      return res;    else if (s<ms->src_end && singlematch(uchar(*s), p, ep))      s++;  /* try with one more repetition */    else return NULL;  }}static const char *start_capture (MatchState *ms, const char *s,                                    const char *p, int what) {  const char *res;  int level = ms->level;  if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");  ms->capture[level].init = s;  ms->capture[level].len = what;  ms->level = level+1;  if ((res=match(ms, s, p)) == NULL)  /* match failed? */    ms->level--;  /* undo capture */  return res;}static const char *end_capture (MatchState *ms, const char *s,                                  const char *p) {  int l = capture_to_close(ms);  const char *res;  ms->capture[l].len = s - ms->capture[l].init;  /* close capture */  if ((res = match(ms, s, p)) == NULL)  /* match failed? */    ms->capture[l].len = CAP_UNFINISHED;  /* undo capture */  return res;}static const char *match_capture (MatchState *ms, const char *s, int l) {  size_t len;  l = check_capture(ms, l);  len = ms->capture[l].len;  if ((size_t)(ms->src_end-s) >= len &&      memcmp(ms->capture[l].init, s, len) == 0)    return s+len;  else return NULL;}static const char *match (MatchState *ms, const char *s, const char *p) {  init: /* using goto's to optimize tail recursion */  switch (*p) {    case '(': {  /* start capture */      if (*(p+1) == ')')  /* position capture? */        return start_capture(ms, s, p+2, CAP_POSITION);      else        return start_capture(ms, s, p+1, CAP_UNFINISHED);    }    case ')': {  /* end capture */      return end_capture(ms, s, p+1);    }    case L_ESC: {      switch (*(p+1)) {        case 'b': {  /* balanced string? */          s = matchbalance(ms, s, p+2);          if (s == NULL) return NULL;          p+=4; goto init;  /* else return match(ms, s, p+4); */        }        case 'f': {  /* frontier? */          const char *ep; char previous;          p += 2;          if (*p != '[')            luaL_error(ms->L, "missing " LUA_QL("[") " after "                               LUA_QL("%%f") " in pattern");          ep = classend(ms, p);  /* points to what is next */          previous = (s == ms->src_init) ? '\0' : *(s-1);          if (matchbracketclass(uchar(previous), p, ep-1) ||             !matchbracketclass(uchar(*s), p, ep-1)) return NULL;          p=ep; goto init;  /* else return match(ms, s, ep); */        }        default: {          if (isdigit(uchar(*(p+1)))) {  /* capture results (%0-%9)? */            s = match_capture(ms, s, uchar(*(p+1)));            if (s == NULL) return NULL;            p+=2; goto init;  /* else return match(ms, s, p+2) */          }          goto dflt;  /* case default */        }      }    }    case '\0': {  /* end of pattern */      return s;  /* match succeeded */    }    case '$': {      if (*(p+1) == '\0')  /* is the `$' the last char in pattern? */        return (s == ms->src_end) ? s : NULL;  /* check end of string */      else goto dflt;    }    default: dflt: {  /* it is a pattern item */      const char *ep = classend(ms, p);  /* points to what is next */      int m = s<ms->src_end && singlematch(uchar(*s), p, ep);      switch (*ep) {        case '?': {  /* optional */          const char *res;          if (m && ((res=match(ms, s+1, ep+1)) != NULL))            return res;          p=ep+1; goto init;  /* else return match(ms, s, ep+1); */        }        case '*': {  /* 0 or more repetitions */          return max_expand(ms, s, p, ep);        }        case '+': {  /* 1 or more repetitions */          return (m ? max_expand(ms, s+1, p, ep) : NULL);        }        case '-': {  /* 0 or more repetitions (minimum) */          return min_expand(ms, s, p, ep);        }        default: {          if (!m) return NULL;          s++; p=ep; goto init;  /* else return match(ms, s+1, ep); */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区av电影| 国产成人av电影在线| 欧美极品aⅴ影院| 欧美自拍偷拍一区| 国产精品亚洲一区二区三区妖精 | 精品人伦一区二区色婷婷| 国产乱子伦视频一区二区三区| 一区二区三区欧美久久| 久久中文字幕电影| 欧美精品一二三| 91麻豆国产福利在线观看| 国产在线看一区| 午夜视频久久久久久| 国产精品乱子久久久久| 日韩欧美亚洲国产另类| 欧美日韩国产大片| 色综合色综合色综合| 国产成人综合在线| 国内精品伊人久久久久av影院| 亚洲高清免费观看| 亚洲欧美韩国综合色| 国产精品久久久久一区二区三区共| 欧美日韩国产首页在线观看| 色婷婷一区二区三区四区| 成人性生交大片免费看在线播放| 另类成人小视频在线| 亚洲国产va精品久久久不卡综合| 亚洲欧美另类小说视频| 中文字幕一区二区三区四区| 国产情人综合久久777777| wwwwww.欧美系列| 欧美一区二区女人| 亚洲欧美在线aaa| 国产精品高潮呻吟| 国产视频亚洲色图| 久久久久久免费网| 久久综合久久综合久久综合| 精品久久久久久久久久久院品网| 9191国产精品| 欧美一区二区啪啪| 日韩天堂在线观看| 日韩一卡二卡三卡国产欧美| 欧美tk—视频vk| 精品国产欧美一区二区| 精品动漫一区二区三区在线观看| 欧美成人三级在线| 久久午夜羞羞影院免费观看| 337p日本欧洲亚洲大胆精品| 久久精品人人做人人爽人人| 日本一区二区三区在线不卡 | 日韩精品中文字幕在线一区| 日韩欧美一区在线| 26uuu国产电影一区二区| 精品成人一区二区三区| 国产亚洲视频系列| 国产精品不卡一区| 夜夜嗨av一区二区三区网页| 午夜成人在线视频| 久久91精品国产91久久小草| 国产乱子伦视频一区二区三区 | 日韩二区三区四区| 在线不卡中文字幕播放| 日韩欧美中文字幕公布| 26uuu欧美| 国产精品国产三级国产专播品爱网 | 亚洲国产成人av| 麻豆国产欧美日韩综合精品二区| 精东粉嫩av免费一区二区三区| 成人综合激情网| 色综合久久久久综合99| 欧美吻胸吃奶大尺度电影 | 国产视频911| 亚洲视频小说图片| 日韩av高清在线观看| 国产一区二区在线视频| 99re成人在线| 91精品一区二区三区在线观看| 久久婷婷一区二区三区| 亚洲婷婷国产精品电影人久久| 亚洲国产中文字幕在线视频综合| 丝袜美腿亚洲一区二区图片| 激情综合色综合久久综合| 色中色一区二区| 精品国产一区a| 综合久久久久久| 老汉av免费一区二区三区 | 日韩欧美电影一二三| 国产精品美女一区二区三区 | 日韩成人伦理电影在线观看| 国产馆精品极品| 欧美午夜精品一区二区三区| 久久精品无码一区二区三区| 亚洲一区国产视频| 国产91丝袜在线播放0| 欧美男男青年gay1069videost| 国产欧美日韩在线看| 日韩黄色小视频| 色吊一区二区三区| 欧美精品一区二区三区蜜桃视频| 亚洲日本va午夜在线影院| 激情伊人五月天久久综合| 在线亚洲欧美专区二区| 久久精品一区八戒影视| 日韩电影一区二区三区| 色综合久久综合| 国产精品乱码人人做人人爱| 日本欧美一区二区三区| 色噜噜久久综合| 中文字幕一区二区三区在线播放| 老司机精品视频在线| 欧美日韩精品免费| 日韩毛片在线免费观看| 国产成都精品91一区二区三| 欧美人狂配大交3d怪物一区| 亚洲男人天堂av| 国产suv一区二区三区88区| 欧美一级淫片007| 婷婷成人激情在线网| 91成人在线观看喷潮| 自拍偷拍欧美精品| 成人免费视频一区| 欧美刺激脚交jootjob| 日韩影院在线观看| 在线看日本不卡| 亚洲人成在线播放网站岛国| 风间由美性色一区二区三区| 久久精品这里都是精品| 极品美女销魂一区二区三区 | 欧美日韩中字一区| 亚洲欧美区自拍先锋| 91视频国产观看| 国产精品无遮挡| 丁香六月综合激情| 欧美激情一区在线观看| 国产在线不卡一区| 亚洲精品在线电影| 韩国三级中文字幕hd久久精品| 欧美一区国产二区| 日本三级亚洲精品| 欧美日韩精品免费观看视频| 丝袜美腿亚洲色图| 欧美精品在线视频| 蜜臀av在线播放一区二区三区| 欧美日韩精品免费| 免费成人你懂的| 精品国产乱子伦一区| 韩国视频一区二区| 日本一区二区三区四区| 99综合影院在线| 亚洲精品一卡二卡| 欧美日韩在线一区二区| 五月综合激情婷婷六月色窝| 欧美一卡在线观看| 久久精品国产99久久6| 精品少妇一区二区三区在线视频 | 国产一区久久久| 国产精品丝袜一区| caoporn国产精品| 一区二区三区精品在线观看| 欧美日韩视频在线观看一区二区三区| 天堂久久久久va久久久久| 欧美一级一级性生活免费录像| 国产一区视频在线看| 国产精品免费视频一区| a亚洲天堂av| 亚州成人在线电影| 欧美成人精品高清在线播放 | 91精品一区二区三区在线观看| 精品影视av免费| 国产精品日日摸夜夜摸av| 欧美在线短视频| 免费观看91视频大全| 国产片一区二区| 在线观看国产一区二区| 日本麻豆一区二区三区视频| 久久久久国色av免费看影院| 99久久99久久免费精品蜜臀| 午夜视频在线观看一区二区三区| 久久免费电影网| 91女神在线视频| 免费视频一区二区| 自拍偷拍国产精品| 欧美不卡一二三| 91一区二区三区在线观看| 秋霞影院一区二区| 国产精品成人一区二区三区夜夜夜| 欧美三级乱人伦电影| 国产精品中文字幕一区二区三区| 一区二区三区在线看| 久久这里都是精品| 欧洲国内综合视频| 国产精品一区二区黑丝| 亚洲va国产va欧美va观看| 久久久久99精品一区| 欧美日韩高清影院| 成人亚洲精品久久久久软件| 七七婷婷婷婷精品国产| 亚洲精品成人天堂一二三| 久久久一区二区三区捆绑**| 欧美日韩在线精品一区二区三区激情|