void app_abort (gboolean no_interface, const gchar *abort_message) { #ifndef GIMP_CONSOLE_COMPILATION if (no_interface) #endif { g_print ("%s\n\n", abort_message); } #ifndef GIMP_CONSOLE_COMPILATION else { gui_abort (abort_message); } #endif app_exit (EXIT_FAILURE); }
GimpInitStatusFunc gui_init (Gimp *gimp, gboolean no_splash) { GimpInitStatusFunc status_callback = NULL; GdkScreen *screen; gchar *abort_message; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (the_gui_gimp == NULL, NULL); abort_message = gui_sanity_check (); if (abort_message) gui_abort (abort_message); the_gui_gimp = gimp; gui_unique_init (gimp); gimp_widgets_init (gui_help_func, gui_get_foreground_func, gui_get_background_func, NULL); g_type_class_ref (GIMP_TYPE_COLOR_SELECT); /* disable automatic startup notification */ gtk_window_set_auto_startup_notification (FALSE); gimp_dnd_init (gimp); themes_init (gimp); screen = gdk_screen_get_default (); gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (screen)); if (! no_splash) { splash_create (gimp->be_verbose); status_callback = splash_update; } g_signal_connect_after (gimp, "initialize", G_CALLBACK (gui_initialize_after_callback), NULL); g_signal_connect (gimp, "restore", G_CALLBACK (gui_restore_callback), NULL); g_signal_connect_after (gimp, "restore", G_CALLBACK (gui_restore_after_callback), NULL); g_signal_connect (gimp, "exit", G_CALLBACK (gui_exit_callback), NULL); g_signal_connect_after (gimp, "exit", G_CALLBACK (gui_exit_after_callback), NULL); return status_callback; }
GimpInitStatusFunc gui_init (Gimp *gimp, gboolean no_splash) { GimpInitStatusFunc status_callback = NULL; gchar *abort_message; g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (the_gui_gimp == NULL, NULL); abort_message = gui_sanity_check (); if (abort_message) gui_abort (abort_message); the_gui_gimp = gimp; /* TRANSLATORS: there is no need to translate this in GIMP. This uses * "gtk20" domain as a special trick to determine language direction, * but xgettext extracts it anyway mistakenly into GIMP po files. * Leave an empty string as translation. It does not matter. */ if (g_strcmp0 (dgettext ("gtk20", "default:LTR"), "default:RTL") == 0) /* Normally this should have been taken care of during command line * parsing as a post-parse hook of gtk_get_option_group(), using the * system locales. * But user config may have overriden the language, therefore we must * check the widget directions again. */ gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL); else gtk_widget_set_default_direction (GTK_TEXT_DIR_LTR); gui_unique_init (gimp); gimp_language_store_parser_init (); gimp_widgets_init (gui_help_func, gui_get_foreground_func, gui_get_background_func, NULL); g_type_class_ref (GIMP_TYPE_COLOR_SELECT); /* disable automatic startup notification */ gtk_window_set_auto_startup_notification (FALSE); gimp_dnd_init (gimp); themes_init (gimp); initial_monitor = gimp_get_monitor_at_pointer (&initial_screen); gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (initial_screen)); if (! no_splash) { splash_create (gimp->be_verbose, initial_screen, initial_monitor); status_callback = splash_update; } g_signal_connect_after (gimp, "initialize", G_CALLBACK (gui_initialize_after_callback), NULL); g_signal_connect (gimp, "restore", G_CALLBACK (gui_restore_callback), NULL); g_signal_connect_after (gimp, "restore", G_CALLBACK (gui_restore_after_callback), NULL); g_signal_connect (gimp, "exit", G_CALLBACK (gui_exit_callback), NULL); g_signal_connect_after (gimp, "exit", G_CALLBACK (gui_exit_after_callback), NULL); return status_callback; }
/* Replaces x with the nearest number to x in the direction of y. * * This implementation is not exactly right, but it should be good * enough for Executor 2. In particular, it doesn't handle * denormalized numbers well and it doesn't signal exceptions. * * Note that most SANE traps replace the dst operand with the * result. This one replaces the src operand (really!) */ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FnextX, uint8 *, x, uint8 *, y, unsigned short, sel) { CCRElement saved_ccc, saved_ccn, saved_ccv, saved_ccnz, saved_ccx; INTEGER x_class, y_class, x_class_swapped, y_class_swapped; x80_t x80_x; int byte_size; int x_sign, y_sign; boolean_t normalize_x80_p; ieee_t xv, yv; saved_ccnz = cpu_state.ccnz; saved_ccn = cpu_state.ccn; saved_ccc = cpu_state.ccc; saved_ccv = cpu_state.ccv; saved_ccx = cpu_state.ccx; /* Determine the classes of both X and Y. */ ROMlib_Fclassx (x, &x_class_swapped, sel); x_class = CW (x_class_swapped); ROMlib_Fclassx (y, &y_class_swapped, sel); y_class = CW (y_class_swapped); normalize_x80_p = FALSE; /* default, avoid gcc warnings. */ switch (sel & OPCODE_MASK) { case FX_OPERAND: xv = x80_to_ieee ((const x80_t *) x); yv = x80_to_ieee ((const x80_t *) y); normalize_x80_p = ((x[2] & 0x80) != 0); byte_size = 10; break; case FD_OPERAND: xv = f64_to_ieee ((const f64_t *) x); yv = f64_to_ieee ((const f64_t *) y); byte_size = 8; break; case FS_OPERAND: xv = f32_to_ieee ((const f32_t *) x); yv = f32_to_ieee ((const f32_t *) y); byte_size = 4; break; case FI_OPERAND: xv = CW (*(short *)x); yv = CW (*(short *)y); byte_size = 2; break; case FL_OPERAND: xv = CL(*(long *)x); yv = CL(*(long *)y); byte_size = 4; break; case FC_OPERAND: xv = comp_to_ieee ((const comp_t *) x); yv = comp_to_ieee ((const comp_t *) y); byte_size = 8; break; default: gui_abort (); xv = yv = 0; /* avoid gcc warnings */ goto done; } /* If either number is a NaN, the result is a NaN. Technically it * should be a quiet NaN and we should signal if a signaling * NaN made it here, but we don't do that yet. */ if (y_class == SNaN || y_class == QNaN) { memcpy (x, y, byte_size); goto done; } if (x_class == SNaN || x_class == QNaN) goto done; /* Compare x and y. */ ROMlib_Fx2X (x, &x80_x, sel & OPCODE_MASK); ROMlib_Fcmpx (y, &x80_x, sel & OPCODE_MASK); /* If x == y, just return x unchanged. */ if (!cpu_state.ccnz) goto done; /* Fetch the sign of x and y. */ x_sign = x[0] & 0x80; y_sign = y[0] & 0x80; if (x_class == ZeroNum) { memset (x, 0, byte_size); x[0] = y_sign; x[byte_size - 1] |= 1; /* smallest normalized number. */ } else /* x != 0 */ { if (!cpu_state.ccn ^ !x_sign) mp_increment_big_endian (x, byte_size); else { if (normalize_x80_p) x[2] &= 0x7F; /* make sure borrow goes through normalize bit */ mp_decrement_big_endian (x, byte_size); } /* Restore the sign in case of carry. */ x[0] = (x[0] & 0x7F) | x_sign; } /* Restore normalize bit, which may have gotten carried through or * borrowed through, etc. */ if (normalize_x80_p) x[2] |= 0x80; done: #if ERROR_SUPPORTED_P (ERROR_FLOATING_POINT) { ieee_t result; switch (sel & OPCODE_MASK) { case FX_OPERAND: result = x80_to_ieee ((const x80_t *) x); break; case FD_OPERAND: result = f64_to_ieee ((const f64_t *) x); break; case FS_OPERAND: result = f32_to_ieee ((const f32_t *) x); break; case FI_OPERAND: result = CW (*(short *)x); break; case FL_OPERAND: result = CL (*(long *)x); break; case FC_OPERAND: result = comp_to_ieee ((const comp_t *) x); break; default: gui_abort (); result = 0; } warning_floating_point ("nextafter(%.30f, %.30f) == %.30f", (double) xv, (double) yv, (double) result); } #endif /* ERROR_SUPPORTED_P (ERROR_FLOATING_POINT) */ cpu_state.ccnz = saved_ccnz; cpu_state.ccn = saved_ccn; cpu_state.ccc = saved_ccc; cpu_state.ccv = saved_ccv; cpu_state.ccx = saved_ccx; }