int luaopen_sax(lua_State* lua) { #ifdef LUA_SANDBOX lua_newtable(lua); lsb_add_serialize_function(lua, serialize_sax); lsb_add_output_function(lua, output_sax); lua_replace(lua, LUA_ENVIRONINDEX); #endif // LUA_SANDBOX /* We're registering sax_equal separately since it's the only way to make lua * aware that it's exactly the same function each time * (otherwise it doesn't get called on different object types) */ lua_pushcfunction(lua, sax_equal); reg_class(lua, mozsvc_sax_window, saxlib_win); reg_class(lua, mozsvc_sax_word, saxlib_word); lua_newtable(lua); luaL_register(lua, NULL, saxlib_f); reg_module(lua, mozsvc_sax_word_suffix, sax_new_word); reg_module(lua, mozsvc_sax_win_suffix, sax_new_window); lua_pushvalue(lua, -1); lua_setfield(lua, LUA_GLOBALSINDEX, mozsvc_sax_table); return 1; }
int WINAPI WinMain( HINSTANCE hi, HINSTANCE /*hi_prev*/, LPSTR /*cmd_line*/, int /*show_cmd*/ ) { reg_class(hi); /* Create hidden window. */ /*HWND hw = */ create_wnd(hi); /* Message pump */ MSG msg; /* Remember to quit when GetMessage gets a quit message. */ //TODO: figure out this binary/trinary thing with getmessage return value (on error) while(GetMessage(&msg, NULL, 0, 0)) { // if(TranslateAccelerator(cal_wnd->getHWnd(), hAccel, &msg)) { // continue; // } TranslateMessage(&msg); DispatchMessage(&msg); } unreg_class(hi); return msg.wParam; }