509 luaL_argcheck(L, xpu->state == XPSpre, 1, "invalid parser state"); |
509 luaL_argcheck(L, xpu->state == XPSpre, 1, "invalid parser state"); |
510 XML_SetEncoding(xpu->parser, encoding); |
510 XML_SetEncoding(xpu->parser, encoding); |
511 return 0; |
511 return 0; |
512 } |
512 } |
513 |
513 |
|
514 static int lxp_stop (lua_State *L) { |
|
515 lxp_userdata *xpu = checkparser(L, 1); |
|
516 lua_pushboolean(L, XML_StopParser(xpu->parser, XML_FALSE) == XML_STATUS_OK); |
|
517 return 1; |
|
518 } |
514 |
519 |
515 static const struct luaL_reg lxp_meths[] = { |
520 static const struct luaL_reg lxp_meths[] = { |
516 {"parse", lxp_parse}, |
521 {"parse", lxp_parse}, |
517 {"close", lxp_close}, |
522 {"close", lxp_close}, |
518 {"__gc", parser_gc}, |
523 {"__gc", parser_gc}, |
519 {"pos", lxp_pos}, |
524 {"pos", lxp_pos}, |
520 {"setencoding", lxp_setencoding}, |
525 {"setencoding", lxp_setencoding}, |
521 {"getcallbacks", getcallbacks}, |
526 {"getcallbacks", getcallbacks}, |
522 {"getbase", getbase}, |
527 {"getbase", getbase}, |
523 {"setbase", setbase}, |
528 {"setbase", setbase}, |
|
529 {"stop", lxp_stop}, |
524 {NULL, NULL} |
530 {NULL, NULL} |
525 }; |
531 }; |
526 |
532 |
527 static const struct luaL_reg lxp_funcs[] = { |
533 static const struct luaL_reg lxp_funcs[] = { |
528 {"new", lxp_make_parser}, |
534 {"new", lxp_make_parser}, |