int main(int argc, char **argv) { const char *value; p_ply iply, oply; iply = ply_open("input.ply", NULL); if (!iply) return 1; if (!ply_read_header(iply)) return 1; oply = ply_create("output.ply", PLY_LITTLE_ENDIAN, NULL); if (!oply) return 1; if (!setup_callbacks(iply, oply)) return 1; /* pass comments and obj_infos from input to output */ value = NULL; while ((value = ply_get_next_comment(iply, value))) if (!ply_add_comment(oply, value)) return 1; value = NULL; while ((value = ply_get_next_obj_info(iply, value))) if (!ply_add_obj_info(oply, value)) return 1;; /* write output header */ if (!ply_write_header(oply)) return 1; /* read input file generating callbacks that pass data to output file */ if (!ply_read(iply)) return 1; /* close up, we are done */ if (!ply_close(iply)) return 1; if (!ply_close(oply)) return 1; return 0; }
int main(void) { // Create the GLFW window window = Window::create_window(640, 480); // Print OpenGL and GLSL versions print_versions(); // Setup callbacks setup_callbacks(); // Setup OpenGL settings, including lighting, materials, etc. setup_opengl_settings(); // Initialize objects/pointers for rendering Window::initialize_objects(); // Loop while GLFW window should stay open while (!glfwWindowShouldClose(window)) { // Main render display callback. Rendering of objects is done here. Window::display_callback(window); // Idle callback. Updating objects, etc. can be done here. Window::idle_callback(); } Window::clean_up(); // Destroy the window glfwDestroyWindow(window); // Terminate GLFW glfwTerminate(); exit(EXIT_SUCCESS); }
int main(int c, char**a) { #if DEBUG_TO_UDP strcpy(mdg_debug_log_target_ip, "77.66.11.94"); mdg_debug_log_target_port = 9999; mdg_debug_log_target = 0; #endif mdg_chat_output_fprintf("Welcome to TDG-lib chat demo.\n"); setup_callbacks(); chatclient_parse_cmd_args(c, a); if (c == 3) { // Use TCP based IO instead of stdIO io_port = atoi(a[2]); } if (c == 5) { // Server config from cmd-line args. configure_server(a[2], atoi(a[3]), a[4]); } // mdg_set_configuration(&mdg_configuration_test); // mdg_set_configuration(&mdg_configuration_tmdg82); // mdg_set_configuration(&mdg_configuration_localhost); // mdg_set_configuration(&mdg_configuration_prod01); // mdg_set_configuration(&mdg_configuration_danfoss_prod); // mdg_set_configuration(&mdg_configuration_danfoss_qa); load_demo_email(); if (client_email[0] == 0) { mdg_chat_output_fprintf("Please provide e-mail using \"/email [email protected]\"\n"); } mdg_chat_output_fprintf("Type \"/h\" for list of commands. All commands start with \"/\"\n"); mdg_demo_start(); return 0; }
/* given a format mode, an input file name and an output file name, * convert input file to output in given format mode */ int main(int argc, char **argv) { const char *value = NULL; e_ply_storage_mode storage_mode = PLY_LITTLE_ENDIAN; const char *iname = NULL, *oname = NULL; p_ply iply = NULL, oply = NULL; /* parse command line arguments */ parse_arguments(argc, argv, &storage_mode, &iname, &oname); /* open input file and make sure we parsed its header */ iply = ply_open(iname, NULL, 0, NULL); if (!iply) error("Unable to open file '%s'", iname); if (!ply_read_header(iply)) error("Failed reading '%s' header", iname); /* create output file */ oply = ply_create(oname, storage_mode, NULL, 0, NULL); if (!oply) error("Unable to create file '%s'", oname); /* create elements and properties in output file and * setup callbacks for them in input file */ setup_callbacks(iply, oply); /* pass comments and obj_infos from input to output */ value = NULL; while ((value = ply_get_next_comment(iply, value))) if (!ply_add_comment(oply, value)) error("Failed adding comments"); value = NULL; while ((value = ply_get_next_obj_info(iply, value))) if (!ply_add_obj_info(oply, value)) error("Failed adding comments"); /* write output header */ if (!ply_write_header(oply)) error("Failed writing '%s' header", oname); /* read input file generating callbacks that pass data to output file */ if (!ply_read(iply)) error("Conversion failed"); /* close up, we are done */ if (!ply_close(iply)) error("Error closing file '%s'", iname); if (!ply_close(oply)) error("Error closing file '%s'", oname); return 0; }
void CScriptEngine::init () { CScriptStorage::reinit (); luabind::open (lua()); setup_callbacks (); export_classes (lua()); setup_auto_load (); #ifdef DEBUG m_stack_is_ready = true; #endif #ifdef DEBUG # ifdef USE_DEBUGGER if( !debugger() || !debugger()->Active() ) # endif lua_sethook (lua(),lua_hook_call, LUA_MASKLINE|LUA_MASKCALL|LUA_MASKRET, 0); #endif bool save = m_reload_modules; m_reload_modules = true; process_file_if_exists ("_G",false); m_reload_modules = save; register_script_classes (); object_factory().register_script (); #ifdef XRGAME_EXPORTS load_common_scripts (); #endif m_stack_level = lua_gettop(lua()); }
/****************************************************************** * SPInit (DPWSOCKX.1) */ HRESULT WINAPI SPInit( LPSPINITDATA lpspData ) { WSADATA wsaData; DPWS_DATA dpwsData; TRACE( "Initializing library for %s (%s)\n", wine_dbgstr_guid(lpspData->lpGuid), debugstr_w(lpspData->lpszName) ); /* We only support TCP/IP service */ if ( !IsEqualGUID(lpspData->lpGuid, &DPSPGUID_TCPIP) ) { return DPERR_UNAVAILABLE; } /* Assign callback functions */ setup_callbacks( lpspData->lpCB ); /* Load Winsock 2.0 DLL */ if ( WSAStartup( MAKEWORD(2, 0), &wsaData ) != 0 ) { ERR( "WSAStartup() failed\n" ); return DPERR_UNAVAILABLE; } /* Initialize internal data */ memset( &dpwsData, 0, sizeof(DPWS_DATA) ); dpwsData.lpISP = lpspData->lpISP; IDirectPlaySP_SetSPData( lpspData->lpISP, &dpwsData, sizeof(DPWS_DATA), DPSET_LOCAL ); /* dplay needs to know the size of the header */ lpspData->dwSPHeaderSize = sizeof(DPSP_MSG_HEADER); return DP_OK; }
/*** * Main entrypoint of the emulator */ int main() { // first, initialize Vita2D printf("Starting CATSFC-libretro-VITA"); vita2d_init_advanced(8 * 1024 * 1024); // do some setup setup_input(); setup_callbacks(); setup_audio(); pl_psp_init("ux0:/data/CATSFC-libretro-VITA/"); // get the game ready if (InitMenu()) { DisplayMenu(); TrashMenu(); } // once emulation is complete, shut down and exit vita_cleanup(); sceKernelExitProcess(0); return 0; }
void CScriptEngine::init() { #ifdef USE_LUA_STUDIO bool lua_studio_connected = !!m_lua_studio_world; if (lua_studio_connected) m_lua_studio_world->remove (lua()); #endif // #ifdef USE_LUA_STUDIO CScriptStorage::reinit(); #ifdef USE_LUA_STUDIO if (m_lua_studio_world || strstr(Core.Params, "-lua_studio")) { if (!lua_studio_connected) try_connect_to_debugger (); else { #ifdef USE_LUAJIT_ONE jit_command (lua(), "debug=2"); jit_command (lua(), "off"); #else luaJIT_setmode(lua(), 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF); #endif m_lua_studio_world->add (lua()); } } #endif // #ifdef USE_LUA_STUDIO luabind::open(lua()); setup_callbacks(); export_classes(lua()); setup_auto_load(); #ifdef DEBUG m_stack_is_ready = true; #endif #ifndef USE_LUA_STUDIO # ifdef DEBUG # if defined(USE_DEBUGGER) && !defined(USE_LUA_STUDIO) if( !debugger() || !debugger()->Active() ) # endif // #if defined(USE_DEBUGGER) && !defined(USE_LUA_STUDIO) lua_sethook (lua(),lua_hook_call, LUA_MASKLINE|LUA_MASKCALL|LUA_MASKRET, 0); # endif // #ifdef DEBUG #endif // #ifndef USE_LUA_STUDIO // lua_sethook (lua(), lua_hook_call, LUA_MASKLINE|LUA_MASKCALL|LUA_MASKRET, 0); bool save = m_reload_modules; m_reload_modules = true; process_file_if_exists("_G", false); m_reload_modules = save; register_script_classes(); object_factory().register_script(); #ifdef XRGAME_EXPORTS load_common_scripts(); #endif m_stack_level = lua_gettop(lua()); }
static struct data get_data( struct source *src, off_t len ) { struct pf_source *s = (struct pf_source *)src; struct data res = { 0, 0, 0, NULL }; char *buffer = NULL; if( s->str ) { len = s->str->len; if( s->skip ) { if( s->skip >= (size_t)s->str->len ) { s->skip -= (size_t)s->str->len; res.len = -2; return res; } len -= s->skip; buffer = malloc( len ); memcpy( buffer, s->str->str+s->skip, len); } else { if( s->len > 0 ) { if( s->len < (size_t)len ) len = s->len; s->len -= len; if( !s->len ) s->s.eof = 1; } buffer = malloc( len ); memcpy( buffer, s->str->str, len ); } res.data = buffer; res.len = len; res.do_free = 1; free_string( s->str ); s->str = 0; setup_callbacks( src ); } else if( !s->len ) s->s.eof = 1; else /* No data available, but there should be in the future (no EOF, nor * out of the range of data to send as specified by the arguments to * source_stream_make) */ res.len = -2; return res; }
int buxton_open(BuxtonClient *client) { _BuxtonClient **c = (_BuxtonClient **)client; _BuxtonClient *cl = NULL; int bx_socket, r; struct sockaddr_un remote; size_t sock_name_len; if ((bx_socket = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { return -1; } remote.sun_family = AF_UNIX; sock_name_len = strlen(buxton_socket()) + 1; if (sock_name_len >= sizeof(remote.sun_path)) { buxton_log("Provided socket name: %s is too long, maximum allowed length is %d bytes\n", buxton_socket(), sizeof(remote.sun_path)); return -1; } strncpy(remote.sun_path, buxton_socket(), sock_name_len); r = connect(bx_socket, (struct sockaddr *)&remote, sizeof(remote)); if ( r == -1) { close(bx_socket); return -1; } if (fcntl(bx_socket, F_SETFL, O_NONBLOCK)) { close(bx_socket); return -1; } if (!setup_callbacks()) { close(bx_socket); return -1; } cl = malloc0(sizeof(_BuxtonClient)); if (!cl) { close(bx_socket); return -1; } cl->fd = bx_socket; *c = cl; return bx_socket; }
BOOL OpenNap_init(Protocol *p) { OpnPlugin *plugin; if (protocol_compat(p, LIBGIFTPROTO_MKVERSION(0, 11, 3))) return FALSE; OPN = p; if (!(plugin = malloc(sizeof(OpnPlugin)))) return FALSE; memset(plugin, 0, sizeof(OpnPlugin)); p->udata = plugin; p->version_str = strdup(VERSION); setup_callbacks(p); return TRUE; }