예제 #1
0
/* method r:dfa_exec (s, [st], [ef], [ovecsize], [wscount]) */
static void checkarg_dfa_exec (lua_State *L, TArgExec *argE, TPcre **ud) {
  *ud = check_ud (L);
  argE->text = luaL_checklstring (L, 2, &argE->textlen);
  argE->startoffset = get_startoffset (L, 3, argE->textlen);
  argE->eflags = luaL_optint (L, 4, ALG_EFLAGS_DFLT);
  argE->ovecsize = luaL_optint (L, 5, 100);
  argE->wscount = luaL_optint (L, 6, 50);
}
예제 #2
0
static int Posix_tostring (lua_State *L) {
  TPosix *ud = check_ud (L);
  if (ud->freed == 0)
    lua_pushfstring (L, "%s (%p)", REX_TYPENAME, (void*)ud);
  else
    lua_pushfstring (L, "%s (deleted)", REX_TYPENAME);
  return 1;
}
예제 #3
0
/* method r:aexec  (s, params, [st], [ef]) */
static void checkarg_atfind (lua_State *L, TArgExec *argE, TPosix **ud,
                             regaparams_t *argP) {
  *ud = check_ud (L);
  argE->text = luaL_checklstring (L, 2, &argE->textlen);
  checkarg_regaparams (L, 3, argP);
  argE->startoffset = get_startoffset (L, 4, argE->textlen);
  argE->eflags = luaL_optint (L, 5, ALG_EFLAGS_DFLT);
}
예제 #4
0
static int LOnig_tostring (lua_State *L) {
  TOnig *ud = check_ud (L);
  if (ud->reg)
    lua_pushfstring (L, "%s (%p)", REX_TYPENAME, (void*)ud);
  else
    lua_pushfstring (L, "%s (deleted)", REX_TYPENAME);
  return 1;
}
예제 #5
0
static int Posix_gc (lua_State *L) {
  TPosix *ud = check_ud (L);
  if (ud->freed == 0) {           /* precaution against "manual" __gc calling */
    ud->freed = 1;
    regfree (&ud->r);
    Lfree (L, ud->match, (ALG_NSUB(ud) + 1) * sizeof (regmatch_t));
  }
  return 0;
}
예제 #6
0
파일: lposix.c 프로젝트: kkabdol/GameCode4
static int Posix_gc (lua_State *L) {
    TPosix *ud = check_ud (L);
    if (ud->freed == 0) {           /* precaution against "manual" __gc calling */
        ud->freed = 1;
        regfree (&ud->r);
        free (ud->match);
    }
    return 0;
}
예제 #7
0
static int Gregex_gc (lua_State *L) {
  TGrgx *ud = check_ud (L);
  if (ud->freed == 0) {           /* precaution against "manual" __gc calling */
    ud->freed = 1;
    if (ud->pr) g_regex_unref (ud->pr);
    minfo_free (ud);
    gerror_free (ud);
  }
  return 0;
}
예제 #8
0
static int Gnu_gc (lua_State *L) {
  TGnu *ud = check_ud (L);
  if (ud->freed == 0) {           /* precaution against "manual" __gc calling */
    ud->freed = 1;
    regfree (&ud->r);
    free (ud->match.start);
    free (ud->match.end);
  }
  return 0;
}
예제 #9
0
static int Lpcre_gc (lua_State *L) {
  TPcre *ud = check_ud (L);
  if (ud->freed == 0) {           /* precaution against "manual" __gc calling */
    ud->freed = 1;
    if (ud->pr)      pcre_free (ud->pr);
    if (ud->extra)   pcre_free (ud->extra);
    if (ud->tables)  pcre_free ((void *)ud->tables);
    if (ud->match)   free (ud->match);
  }
  return 0;
}
예제 #10
0
static int LOnig_gc (lua_State *L) {
  TOnig *ud = check_ud (L);
  if (ud->reg) {           /* precaution against "manual" __gc calling */
    onig_free (ud->reg);
    ud->reg = NULL;
  }
  if (ud->region) {
    onig_region_free (ud->region, 1);
    ud->region = NULL;
  }
  return 0;
}
예제 #11
0
/* method r:dfa_exec (s, [st], [ef]) */
static void checkarg_dfa_exec (lua_State *L, TArgExec *argE, TGrgx **ud) {
  *ud = check_ud (L);
  argE->text = luaL_checklstring (L, 2, &argE->textlen);
  argE->startoffset = get_startoffset (L, 3, argE->textlen);
  argE->eflags = ALG_GETEFLAGS (L, 4);
}
예제 #12
0
static int Ltre_have_approx (lua_State *L) {
  TPosix *ud = check_ud (L);
  lua_pushboolean (L, tre_have_approx (&ud->r));
  return 1;
}
예제 #13
0
static int LOnig_capturecount (lua_State *L) {
  TOnig *ud = check_ud(L);
  lua_pushinteger(L, onig_number_of_captures(ud->reg));
  return 1;
}