예제 #1
0
파일: lxplib.c 프로젝트: WeyrSDev/gamecode3
static int lxp_setencoding (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  const char *encoding = luaL_checkstring(L, 2);
  luaL_argcheck(L, xpu->state == XPSpre, 1, "invalid parser state");
  XML_SetEncoding(xpu->parser, encoding);
  return 0;
}
예제 #2
0
파일: lxplib.c 프로젝트: WeyrSDev/gamecode3
static int lxp_pos (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  XML_Parser p = xpu->parser;
  lua_pushnumber(L, XML_GetCurrentLineNumber(p));
  lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1);
  lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1);
  return 3;
}
예제 #3
0
파일: lxplib.c 프로젝트: WeyrSDev/gamecode3
static int lxp_parse (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  size_t len;
  const char *s = luaL_optlstring(L, 2, NULL, &len);
  if (xpu->state == XPSfinished && s != NULL) {
    lua_pushnil(L);
    lua_pushliteral(L, "cannot parse - document is finished");
    return 2;
  }
  return parse_aux(L, xpu, s, len);
}
예제 #4
0
파일: lxplib.c 프로젝트: WeyrSDev/gamecode3
static int getcallbacks (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref);
  return 1;
}
예제 #5
0
파일: lxplib.c 프로젝트: WeyrSDev/gamecode3
static int getbase (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  lua_pushstring(L, XML_GetBase(xpu->parser));
  return 1;
}
예제 #6
0
파일: lxplib.c 프로젝트: WeyrSDev/gamecode3
static int setbase (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  if (XML_SetBase(xpu->parser, luaL_checkstring(L, 2)) == 0)
    luaL_error(L, "no memory to store base");
  return 0;
}
예제 #7
0
파일: lxplib.c 프로젝트: JohnCrash/edu
static int lxp_getcurrentbytecount (lua_State* L) {
  lxp_userdata *xpu = checkparser(L, 1);
  lua_pushinteger(L, XML_GetCurrentByteCount(xpu->parser));
  return 1;
}
예제 #8
0
파일: lxplib.c 프로젝트: JohnCrash/edu
static int lxp_stop (lua_State *L) {
  lxp_userdata *xpu = checkparser(L, 1);
  lua_pushboolean(L, XML_StopParser(xpu->parser, XML_FALSE) == XML_STATUS_OK);
  return 1;
}