void ui_drawing_area_init(GtkWidget* widget, gpointer data) { // This is here because gtk cannot return XWindow that is proper // GLXRenderable until it is shown on screen so we have to postpone all // OpenGL and OpenCL stuff unitl window is drawn for the first time. core_subsystem_start(); if(sys_get_config()->project != NULL) { io_load_image(sys_get_config()->project); } gl_initialized = TRUE; }
int main(int argc, char **argv) { log_t* loghandle; void* libhandle; int retcode; struct sigaction sa_quit; handler_api_t handler_api; sys_config_t* system_config; system_config = sys_get_config(); mcp_parse_arguments(argc, argv, system_config); if(system_config->debug == LOG_NOFLAGS && util_file_stat(system_config->pidfile) != 0) { fprintf(stderr, "%s: PID file %s exists! Not starting.\n", argv[0], system_config->pidfile); exit(EXIT_FAILURE); } libhandle = dlopen(system_config->libfile, RTLD_NOW); if(!libhandle) { fprintf(stderr, "%s: Could not load handler library: %s\n", argv[0], dlerror()); exit(EXIT_FAILURE); } if(sys_initapi(libhandle, &handler_api) != 0) { fprintf(stderr, "%s: Specified handler library is invalid", argv[0]); dlclose(libhandle); exit(EXIT_FAILURE); } loghandle = log_open(system_config->logfile, system_config->debug); if(!loghandle) { fprintf(stderr, "%s: Could not open log file: %s\n", argv[0], MCPROXY_LOGFILE); dlclose(libhandle); exit(EXIT_FAILURE); } log_set_default(loghandle); if(system_config->debug == LOG_NOFLAGS) mcp_daemonize(); memset(&sa_quit, 0, sizeof(struct sigaction)); sa_quit.sa_handler = sig_quit; sigaction(SIGTERM, &sa_quit, NULL); sigaction(SIGINT, &sa_quit, NULL); if(system_config->debug == LOG_NOFLAGS) util_file_writepid(system_config->pidfile); retcode = core_main(system_config, &handler_api); log_close(loghandle); dlclose(libhandle); if(system_config->debug == LOG_NOFLAGS) unlink(system_config->pidfile); exit(retcode); }
void convolution_init() { //TODO: Move to some common function char *progdir = sys_get_config()->dir_clprogs; size_t path_len = strlen(progdir) + strlen(kernel_filename) + 2 * sizeof(char); char *progpath = malloc(sizeof(char) * path_len); sprintf(progpath, "%s/%s",progdir, kernel_filename); g_debug("convolution_init: %s", progpath); device_result_t err = device_kernel_create(sys_get_state()->context, progpath, "main", &kernel); free(progpath); if( err != DEVICE_OK ) { g_error("Error while creating convolution kernel"); } }