static void init_stock_hash (void) { if (stock_hash == NULL) { stock_hash = g_hash_table_new (g_str_hash, g_str_equal); real_add (builtin_items, G_N_ELEMENTS (builtin_items), FALSE, TRUE); } if (translate_hash == NULL) { translate_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); gtk_stock_set_translate_func (GETTEXT_PACKAGE, sgettext_swapped, "Stock label", NULL); gtk_stock_set_translate_func (GETTEXT_PACKAGE "-navigation", sgettext_swapped, "Stock label, navigation", NULL); gtk_stock_set_translate_func (GETTEXT_PACKAGE "-media", sgettext_swapped, "Stock label, media", NULL); } }
/** * gtk_stock_add_static: * @items: (array length=n_items): a #GtkStockItem or array of #GtkStockItem * @n_items: number of items * * Same as gtk_stock_add(), but doesn't copy @items, so * @items must persist until application exit. * **/ void gtk_stock_add_static (const GtkStockItem *items, guint n_items) { g_return_if_fail (items != NULL); real_add (items, n_items, FALSE); }
void operator_real() { double result; char in[USHRT_MAX]; printf("Entre com o 1º valor: "); scanf("%s", in); printf("\n"); result = atof(in); int keep_going = 1; while (keep_going) { switch (menu_real()) { case 1: // Add printf("Entre com o próximo valor: "); scanf("%s", in); printf("\n"); real_add(&result, atof(in)); break; case 2: // Subtract printf("Entre com o próximo valor: "); scanf("%s", in); printf("\n"); real_subtract(&result, atof(in)); break; case 3: // Multiply printf("Entre com o próximo valor: "); scanf("%s", in); printf("\n"); real_multiply(&result, atof(in)); break; case 4: // Power while (1) { printf("Entre com o próximo valor: "); scanf("%s", in); printf("\n"); double original = result; real_power(&result, atof(in)); if (isnan(result)) { result = original; printf("Valor inválido!\n\n"); } else break; } break; case 5: // Divide while (1) { printf("Entre com o próximo valor: "); scanf("%s", in); printf("\n"); if (atof(in) == 0) printf("Valor inválido!\n\n"); else break; } real_divide(&result, atof(in)); break; default: keep_going = 0; break; } printf("Resultado: %lg\n\n", result); } }