diff options
author | Laurent Napias <[email protected]> | 2019-06-29 10:49:33 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-07-03 15:04:19 +0200 |
commit | d7195c1d58c93398efd3567ed69558b657e7b74b (patch) | |
tree | 2a37db47816a37eb01d95d5933de9c1e079ed599 /src | |
parent | 87d647ad3be67c033dbb6aa80cfcdd4cbce3a42d (diff) | |
download | mate-calc-d7195c1d58c93398efd3567ed69558b657e7b74b.tar.bz2 mate-calc-d7195c1d58c93398efd3567ed69558b657e7b74b.tar.xz |
Remove trailing whitespaces
Diffstat (limited to 'src')
-rw-r--r-- | src/currency-manager.c | 12 | ||||
-rw-r--r-- | src/currency-manager.h | 2 | ||||
-rw-r--r-- | src/mate-calc-cmd.c | 6 | ||||
-rw-r--r-- | src/math-buttons.c | 52 | ||||
-rw-r--r-- | src/math-converter.c | 14 | ||||
-rw-r--r-- | src/math-display.c | 2 | ||||
-rw-r--r-- | src/math-equation.c | 42 | ||||
-rw-r--r-- | src/math-preferences.c | 4 | ||||
-rw-r--r-- | src/math-variable-popup.c | 6 | ||||
-rw-r--r-- | src/math-variables.c | 12 | ||||
-rw-r--r-- | src/math-window.c | 2 | ||||
-rw-r--r-- | src/mp-convert.c | 8 | ||||
-rw-r--r-- | src/mp-equation.c | 4 | ||||
-rw-r--r-- | src/mp-equation.h | 4 | ||||
-rw-r--r-- | src/mp-serializer.c | 8 | ||||
-rw-r--r-- | src/mp-serializer.h | 2 | ||||
-rw-r--r-- | src/mp-trigonometric.c | 4 | ||||
-rw-r--r-- | src/mp.c | 28 | ||||
-rw-r--r-- | src/mp.h | 2 | ||||
-rw-r--r-- | src/test-mp-equation.c | 32 | ||||
-rw-r--r-- | src/test-mp.c | 26 | ||||
-rw-r--r-- | src/unit-category.c | 4 | ||||
-rw-r--r-- | src/unit-category.h | 2 | ||||
-rw-r--r-- | src/unit-manager.c | 12 | ||||
-rw-r--r-- | src/unit-manager.h | 2 | ||||
-rw-r--r-- | src/unit.c | 2 | ||||
-rw-r--r-- | src/unit.h | 2 |
27 files changed, 148 insertions, 148 deletions
diff --git a/src/currency-manager.c b/src/currency-manager.c index d48f99a..40e87a7 100644 --- a/src/currency-manager.c +++ b/src/currency-manager.c @@ -274,7 +274,7 @@ download_file(CurrencyManager *manager, gchar *uri, gchar *filename, GAsyncReady g_file_copy_async(source, dest, G_FILE_COPY_OVERWRITE, G_PRIORITY_DEFAULT, NULL, NULL, NULL, callback, manager); g_object_unref(source); - g_object_unref(dest); + g_object_unref(dest); } @@ -287,10 +287,10 @@ load_imf_rates(CurrencyManager *manager) GError *error = NULL; int i; gboolean result, in_data = FALSE; - struct + struct { const gchar *name, *symbol; - } name_map[] = + } name_map[] = { {"Algerian dinar", "DZD"}, {"Australian dollar", "AUD"}, @@ -365,7 +365,7 @@ load_imf_rates(CurrencyManager *manager) gchar *line, **tokens; line = g_strchug(lines[i]); - + /* Start after first blank line, stop on next */ if (line[0] == '\0') { if (!in_data) { @@ -494,7 +494,7 @@ load_ecb_rates(CurrencyManager *manager) if (!document) g_warning("Couldn't parse ECB rate file %s", filename); g_free (filename); - if (!document) + if (!document) return; xpath_ctx = xmlXPathNewContext(document); @@ -564,7 +564,7 @@ load_rates(CurrencyManager *manager) loaded_rates = TRUE; g_signal_emit(manager, signals[UPDATED], 0); - + return TRUE; } diff --git a/src/currency-manager.h b/src/currency-manager.h index c5e8e91..6ed0c30 100644 --- a/src/currency-manager.h +++ b/src/currency-manager.h @@ -13,7 +13,7 @@ #include "currency.h" #include "mp.h" - + G_BEGIN_DECLS #define CURRENCY_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), currency_manager_get_type(), CurrencyManager)) diff --git a/src/mate-calc-cmd.c b/src/mate-calc-cmd.c index 9c424af..b4fb301 100644 --- a/src/mate-calc-cmd.c +++ b/src/mate-calc-cmd.c @@ -29,17 +29,17 @@ solve(const char *equation) MPEquationOptions options; MPNumber z; gchar *result_str = NULL; - + memset(&options, 0, sizeof(options)); options.base = 10; options.wordlen = 32; options.angle_units = MP_DEGREES; - + ret = mp_equation_parse(equation, &options, &z, NULL); if (ret == PARSER_ERR_MP) fprintf(stderr, "Error %s\n", mp_get_error()); - else if (ret) + else if (ret) fprintf(stderr, "Error %d\n", ret); else { result_str = mp_serializer_to_string(result_serializer, &z); diff --git a/src/math-buttons.c b/src/math-buttons.c index 3f9be51..7437369 100644 --- a/src/math-buttons.c +++ b/src/math-buttons.c @@ -323,7 +323,7 @@ set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, const char static void set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gint value) { - GObject *object; + GObject *object; object = gtk_builder_get_object(ui, object_name); if (object) g_object_set_data(object, name, GINT_TO_POINTER(value)); @@ -369,7 +369,7 @@ update_bit_panel(MathButtons *buttons) if (!buttons->priv->bit_panel) return; - + enabled = math_equation_get_number(buttons->priv->equation, &x); if (enabled) { @@ -385,7 +385,7 @@ update_bit_panel(MathButtons *buttons) gtk_widget_set_sensitive(buttons->priv->bit_panel, enabled); gtk_widget_set_sensitive(buttons->priv->base_label, enabled); - + if (!enabled) return; @@ -399,7 +399,7 @@ update_bit_panel(MathButtons *buttons) gtk_label_set_text(GTK_LABEL(buttons->priv->bit_labels[i]), label); } - base = math_equation_get_base(buttons->priv->equation); + base = math_equation_get_base(buttons->priv->equation); label = g_string_new(""); if (base != 8) { if (label->len != 0) @@ -453,7 +453,7 @@ base_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons) GtkTreeModel *model; GtkTreeIter iter; gboolean valid; - + if (buttons->priv->mode != PROGRAMMING) return; @@ -513,7 +513,7 @@ load_mode(MathButtons *buttons, ButtonMode mode) panel = &buttons->priv->prog_panel; break; } - + if (*panel) goto out; @@ -544,7 +544,7 @@ load_mode(MathButtons *buttons, ButtonMode mode) if (button_data[i].tooltip) gtk_widget_set_tooltip_text(button, _(button_data[i].tooltip)); - + atk_object_set_name(gtk_widget_get_accessible(button), button_data[i].widget_name); } @@ -574,7 +574,7 @@ load_mode(MathButtons *buttons, ButtonMode mode) buffer[len] = '\0'; gtk_button_set_label(GTK_BUTTON(widget), buffer); } - + widget = GET_WIDGET(builder, "calc_superscript_button"); if (widget) { buttons->priv->superscript_toggles = g_list_append(buttons->priv->superscript_toggles, widget); @@ -666,7 +666,7 @@ load_mode(MathButtons *buttons, ButtonMode mode) gtk_builder_connect_signals(builder, buttons); display_changed_cb(buttons->priv->equation, NULL, buttons); - + out: return *panel; } @@ -684,7 +684,7 @@ converter_changed_cb(MathConverter *converter, MathButtons *buttons) } else { math_equation_set_source_units(buttons->priv->equation, unit_get_name(from_unit)); - math_equation_set_target_units(buttons->priv->equation, unit_get_name(to_unit)); + math_equation_set_target_units(buttons->priv->equation, unit_get_name(to_unit)); } g_object_unref(from_unit); @@ -703,7 +703,7 @@ load_buttons(MathButtons *buttons) if (!buttons->priv->converter) { buttons->priv->converter = math_converter_new(buttons->priv->equation); g_signal_connect(buttons->priv->converter, "changed", G_CALLBACK(converter_changed_cb), buttons); - gtk_box_pack_start(GTK_BOX(buttons), GTK_WIDGET(buttons->priv->converter), FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(buttons), GTK_WIDGET(buttons->priv->converter), FALSE, TRUE, 0); } panel = load_mode(buttons, buttons->priv->mode); @@ -725,12 +725,12 @@ void math_buttons_set_mode(MathButtons *buttons, ButtonMode mode) { g_return_if_fail(buttons != NULL); - + if (buttons->priv->mode == mode) return; buttons->priv->mode = mode; - + if (mode == PROGRAMMING) math_equation_set_base(buttons->priv->equation, buttons->priv->programming_base); else @@ -802,7 +802,7 @@ G_MODULE_EXPORT void subtract_cb(GtkWidget *widget, MathButtons *buttons) { - math_equation_insert_subtract(buttons->priv->equation); + math_equation_insert_subtract(buttons->priv->equation); } @@ -880,7 +880,7 @@ memory_cb(GtkWidget *widget, MathButtons *buttons) popup = math_variable_popup_new(buttons->priv->equation); gtk_window_set_transient_for(GTK_WINDOW(popup), GTK_WINDOW(gtk_widget_get_toplevel(widget))); - gtk_widget_get_allocation(widget, &allocation); + gtk_widget_get_allocation(widget, &allocation); gdk_window_get_root_coords(gtk_widget_get_window(widget), allocation.x, allocation.y, &x, &y); gtk_window_move(GTK_WINDOW(popup), x, y); gtk_widget_show(GTK_WIDGET(popup)); @@ -969,7 +969,7 @@ shift_right_cb(GtkWidget *widget, MathButtons *buttons) } } - popup_button_menu(widget, GTK_MENU(buttons->priv->shift_right_menu)); + popup_button_menu(widget, GTK_MENU(buttons->priv->shift_right_menu)); } @@ -988,10 +988,10 @@ function_cb(GtkWidget *widget, MathButtons *buttons) if (!buttons->priv->function_menu) { gint i; GtkWidget *menu; - struct + struct { gchar *name, *function; - } functions[] = + } functions[] = { { /* Tooltip for the integer component button */ N_("Integer Component"), "int " }, @@ -1013,7 +1013,7 @@ function_cb(GtkWidget *widget, MathButtons *buttons) for (i = 0; functions[i].name != NULL; i++) { GtkWidget *item; - + item = gtk_menu_item_new_with_label(_(functions[i].name)); g_object_set_data(G_OBJECT(item), "function", g_strdup(functions[i].function)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); @@ -1022,7 +1022,7 @@ function_cb(GtkWidget *widget, MathButtons *buttons) } } - popup_button_menu(widget, GTK_MENU(buttons->priv->function_menu)); + popup_button_menu(widget, GTK_MENU(buttons->priv->function_menu)); } static void @@ -1040,10 +1040,10 @@ const_cb(GtkWidget *widget, MathButtons *buttons) if (!buttons->priv->const_menu) { gint i; GtkWidget *menu; - struct + struct { gchar *name, *constant, *tooltip; - } constants[] = + } constants[] = { { /* Tooltip for the c₀ component button */ N_("Velocity of Light"), "c₀", N_("299,792,458 m/s") }, @@ -1071,7 +1071,7 @@ const_cb(GtkWidget *widget, MathButtons *buttons) for (i = 0; constants[i].name != NULL; i++) { GtkWidget *item; - + item = gtk_menu_item_new_with_label(_(constants[i].name)); gtk_widget_set_tooltip_text(item, _(constants[i].tooltip)); g_object_set_data(G_OBJECT(item), "const", g_strdup(constants[i].constant)); @@ -1081,7 +1081,7 @@ const_cb(GtkWidget *widget, MathButtons *buttons) } } - popup_button_menu(widget, GTK_MENU(buttons->priv->const_menu)); + popup_button_menu(widget, GTK_MENU(buttons->priv->const_menu)); } void factorize_cb(GtkWidget *widget, MathButtons *buttons); @@ -1199,7 +1199,7 @@ character_code_dialog_response_cb(GtkWidget *dialog, gint response_id, MathButto text = gtk_entry_get_text(GTK_ENTRY(buttons->priv->character_code_entry)); - if (response_id == GTK_RESPONSE_OK) { + if (response_id == GTK_RESPONSE_OK) { MPNumber x; int i = 0; @@ -1303,7 +1303,7 @@ number_mode_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *bu { GList *i; NumberMode mode; - + mode = math_equation_get_number_mode(equation); for (i = buttons->priv->superscript_toggles; i; i = i->next) { diff --git a/src/math-converter.c b/src/math-converter.c index d5c637c..fa06a09 100644 --- a/src/math-converter.c +++ b/src/math-converter.c @@ -136,7 +136,7 @@ update_from_model(MathConverter *converter) UnitCategory *category = iter->data; GtkTreeIter parent; const GList *unit_iter; - + gtk_tree_store_append(from_model, &parent, NULL); gtk_tree_store_set(from_model, &parent, 0, unit_category_get_display_name(category), 1, category, -1); @@ -198,14 +198,14 @@ iter_is_unit(GtkTreeModel *model, GtkTreeIter *iter, Unit *unit) Unit *u; gtk_tree_model_get(model, iter, 2, &u, -1); - + if (!u) return FALSE; g_object_unref(u); if (u == unit) return TRUE; - + return FALSE; } @@ -217,7 +217,7 @@ set_active_unit(GtkComboBox *combo, GtkTreeIter *iter, Unit *unit) GtkTreeIter child_iter; model = gtk_combo_box_get_model(combo); - + if (iter && iter_is_unit(model, iter, unit)) { gtk_combo_box_set_active_iter(combo, iter); return TRUE; @@ -225,12 +225,12 @@ set_active_unit(GtkComboBox *combo, GtkTreeIter *iter, Unit *unit) if (!gtk_tree_model_iter_children(model, &child_iter, iter)) return FALSE; - + do { if (set_active_unit(combo, &child_iter, unit)) return TRUE; } while (gtk_tree_model_iter_next(model, &child_iter)); - + return FALSE; } @@ -327,7 +327,7 @@ from_combobox_changed_cb(GtkWidget *combo, MathConverter *converter) /* Select the first possible unit */ gtk_combo_box_set_active(GTK_COMBO_BOX(converter->priv->to_combo), 0); - g_object_unref(category); + g_object_unref(category); g_object_unref(unit); } diff --git a/src/math-display.c b/src/math-display.c index e7ce8c3..9669a0e 100644 --- a/src/math-display.c +++ b/src/math-display.c @@ -477,7 +477,7 @@ math_display_class_init(MathDisplayClass *klass) } -static void +static void math_display_init(MathDisplay *display) { display->priv = math_display_get_instance_private (display); diff --git a/src/math-equation.c b/src/math-equation.c index c8bca64..3b0e4d8 100644 --- a/src/math-equation.c +++ b/src/math-equation.c @@ -43,7 +43,7 @@ enum { PROP_SOURCE_CURRENCY, PROP_TARGET_CURRENCY, PROP_SOURCE_UNITS, - PROP_TARGET_UNITS, + PROP_TARGET_UNITS, PROP_SERIALIZER }; @@ -84,7 +84,7 @@ struct MathEquationPrivate GList *undo_stack; /* History of expression mode states */ GList *redo_stack; gboolean in_undo_operation; - + gboolean in_reformat; gboolean in_delete; @@ -124,7 +124,7 @@ static void get_ans_offsets(MathEquation *equation, gint *start, gint *end) { GtkTextIter iter; - + if (!equation->priv->ans_start) { *start = *end = -1; return; @@ -268,7 +268,7 @@ reformat_separators(MathEquation *equation) offset--; } else - last_is_tsep = TRUE; + last_is_tsep = TRUE; } else { in_number = in_radix = FALSE; @@ -319,7 +319,7 @@ get_current_state(MathEquation *equation) state->can_super_minus = equation->priv->can_super_minus; state->entered_multiply = equation->priv->state.entered_multiply; state->status = g_strdup(equation->priv->state.status); - + return state; } @@ -353,7 +353,7 @@ math_equation_push_undo_stack(MathEquation *equation) equation->priv->redo_stack = NULL; state = get_current_state(equation); - equation->priv->undo_stack = g_list_prepend(equation->priv->undo_stack, state); + equation->priv->undo_stack = g_list_prepend(equation->priv->undo_stack, state); } @@ -382,7 +382,7 @@ static void apply_state(MathEquation *equation, MathEquationState *state) { GtkTextIter cursor; - + /* Disable undo detection */ equation->priv->in_undo_operation = TRUE; @@ -765,7 +765,7 @@ math_equation_set_status(MathEquation *equation, const gchar *status) g_free(equation->priv->state.status); equation->priv->state.status = g_strdup(status); - g_object_notify(G_OBJECT(equation), "status"); + g_object_notify(G_OBJECT(equation), "status"); } @@ -790,7 +790,7 @@ math_equation_is_result(MathEquation *equation) { char *text; gboolean result; - + g_return_val_if_fail(equation != NULL, FALSE); text = math_equation_get_equation(equation); @@ -839,7 +839,7 @@ math_equation_get_equation(MathEquation *equation) next_is_digit = g_unichar_isdigit(g_utf8_get_char(g_utf8_next_char(read_iter))); /* Replace ans text with variable */ - if (offset == ans_start) { + if (offset == ans_start) { g_string_append(eq_text, "ans"); read_iter = g_utf8_offset_to_pointer(read_iter, ans_end - ans_start - 1); offset += ans_end - ans_start - 1; @@ -940,7 +940,7 @@ void math_equation_store(MathEquation *equation, const gchar *name) { MPNumber t; - + g_return_if_fail(equation != NULL); g_return_if_fail(name != NULL); @@ -1109,7 +1109,7 @@ variable_is_defined(const char *name, void *data) for (c = lower_name; *c; c++) *c = tolower(*c); - if (strcmp(lower_name, "rand") == 0 || + if (strcmp(lower_name, "rand") == 0 || strcmp(lower_name, "ans") == 0) { g_free(lower_name); return 1; @@ -1579,7 +1579,7 @@ math_equation_get_property(GObject *object, g_value_set_string(value, self->priv->state.status); break; case PROP_DISPLAY: - text = math_equation_get_display(self); + text = math_equation_get_display(self); g_value_set_string(value, text); g_free(text); break; @@ -1736,7 +1736,7 @@ math_equation_class_init(MathEquationClass *klass) g_param_spec_int("base", "base", "Default number base (derived from number-format)", - 2, 16, 10, + 2, 16, 10, G_PARAM_READWRITE)); g_object_class_install_property(object_class, PROP_WORD_SIZE, @@ -1800,10 +1800,10 @@ pre_insert_text_cb(MathEquation *equation, { gunichar c; gint cursor; - + if (equation->priv->in_reformat) return; - + /* If following a delete then have already pushed undo stack (GtkTextBuffer doesn't indicate replace operations so we have to infer them) */ if (!equation->priv->in_delete) @@ -1826,7 +1826,7 @@ pre_insert_text_cb(MathEquation *equation, offset = gtk_text_iter_get_offset(location); get_ans_offsets(equation, &ans_start, &ans_end); - + /* Inserted inside ans */ if (offset > ans_start && offset < ans_end) clear_ans(equation, TRUE); @@ -1837,7 +1837,7 @@ pre_insert_text_cb(MathEquation *equation, static gboolean on_delete(MathEquation *equation) { - equation->priv->in_delete = FALSE; + equation->priv->in_delete = FALSE; return FALSE; } @@ -1847,7 +1847,7 @@ pre_delete_range_cb(MathEquation *equation, GtkTextIter *start, GtkTextIter *end, gpointer user_data) -{ +{ if (equation->priv->in_reformat) return; @@ -1863,7 +1863,7 @@ pre_delete_range_cb(MathEquation *equation, start_offset = gtk_text_iter_get_offset(start); end_offset = gtk_text_iter_get_offset(end); get_ans_offsets(equation, &ans_start, &ans_end); - + /* Deleted part of ans */ if (start_offset < ans_end && end_offset > ans_start) clear_ans(equation, TRUE); @@ -1924,7 +1924,7 @@ math_equation_init(MathEquation *equation) equation->priv = math_equation_get_instance_private (equation); g_signal_connect(equation, "insert-text", G_CALLBACK(pre_insert_text_cb), equation); - g_signal_connect(equation, "delete-range", G_CALLBACK(pre_delete_range_cb), equation); + g_signal_connect(equation, "delete-range", G_CALLBACK(pre_delete_range_cb), equation); g_signal_connect_after(equation, "insert-text", G_CALLBACK(insert_text_cb), equation); g_signal_connect_after(equation, "delete-range", G_CALLBACK(delete_range_cb), equation); diff --git a/src/math-preferences.c b/src/math-preferences.c index adbd58e..33565d9 100644 --- a/src/math-preferences.c +++ b/src/math-preferences.c @@ -35,7 +35,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (MathPreferencesDialog, math_preferences, GTK_TYPE_DI MathPreferencesDialog * math_preferences_dialog_new(MathEquation *equation) -{ +{ return g_object_new(math_preferences_get_type(), "equation", equation, NULL); } @@ -210,7 +210,7 @@ word_size_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *di static void angle_unit_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog) { - set_combo_box_from_int(GET_WIDGET(dialog->priv->ui, "angle_unit_combobox"), math_equation_get_angle_units(equation)); + set_combo_box_from_int(GET_WIDGET(dialog->priv->ui, "angle_unit_combobox"), math_equation_get_angle_units(equation)); g_settings_set_enum(g_settings_var, "angle-units", math_equation_get_angle_units(equation)); } diff --git a/src/math-variable-popup.c b/src/math-variable-popup.c index 787d13e..fee5526 100644 --- a/src/math-variable-popup.c +++ b/src/math-variable-popup.c @@ -72,7 +72,7 @@ variable_name_changed_cb(GtkWidget *widget, MathVariablePopup *popup) const gchar *text = gtk_entry_get_text(GTK_ENTRY(popup->priv->variable_name_entry)); gtk_widget_set_sensitive(popup->priv->add_variable_button, text[0] != '\0'); } - + static void add_variable_cb(GtkWidget *widget, MathVariablePopup *popup) @@ -102,7 +102,7 @@ save_variable_cb(GtkWidget *widget, MathVariablePopup *popup) MPNumber z; name = g_object_get_data(G_OBJECT(widget), "variable_name"); - if (math_equation_get_number(popup->priv->equation, &z)) + if (math_equation_get_number(popup->priv->equation, &z)) math_variables_set(math_equation_get_variables(popup->priv->equation), name, &z); else if (math_equation_is_result(popup->priv->equation)) math_variables_set(math_equation_get_variables(popup->priv->equation), name, math_equation_get_answer(popup->priv->equation)); @@ -118,7 +118,7 @@ delete_variable_cb(GtkWidget *widget, MathVariablePopup *popup) { const gchar *name; - name = g_object_get_data(G_OBJECT(widget), "variable_name"); + name = g_object_get_data(G_OBJECT(widget), "variable_name"); math_variables_delete(math_equation_get_variables(popup->priv->equation), name); gtk_widget_destroy(gtk_widget_get_toplevel(widget)); diff --git a/src/math-variables.c b/src/math-variables.c index b8e57cf..225ca9c 100644 --- a/src/math-variables.c +++ b/src/math-variables.c @@ -37,24 +37,24 @@ registers_load(MathVariables *variables) { FILE *f; char line[1024]; - + f = fopen(variables->priv->file_name, "r"); if (!f) return; - + g_hash_table_remove_all(variables->priv->registers); while (fgets(line, 1024, f) != NULL) { char *name, *value; MPNumber *t; - + value = strchr(line, '='); if (!value) continue; *value = '\0'; value = value + 1; - + name = g_strstrip(line); value = g_strstrip(value); @@ -83,7 +83,7 @@ registers_save(MathVariables *variables) f = fopen(variables->priv->file_name, "w"); if (!f) return; - + g_hash_table_iter_init(&iter, variables->priv->registers); while (g_hash_table_iter_next(&iter, &key, &val)) { @@ -107,7 +107,7 @@ math_variables_get_names(MathVariables *variables) gpointer key; gint i = 0; gchar **names; - + g_return_val_if_fail(variables != NULL, NULL); names = g_malloc0(sizeof(gchar *) * (g_hash_table_size(variables->priv->registers) + 1)); diff --git a/src/math-window.c b/src/math-window.c index de7045f..95e749e 100644 --- a/src/math-window.c +++ b/src/math-window.c @@ -466,7 +466,7 @@ create_gui(MathWindow *window) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6); gtk_container_set_border_width(GTK_CONTAINER(vbox), 6); - gtk_box_pack_start(GTK_BOX(main_vbox), vbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(main_vbox), vbox, TRUE, TRUE, 0); gtk_widget_show(vbox); scrolled_window = gtk_scrolled_window_new(NULL, NULL); diff --git a/src/mp-convert.c b/src/mp-convert.c index 1052351..f41c874 100644 --- a/src/mp-convert.c +++ b/src/mp-convert.c @@ -288,7 +288,7 @@ mp_cast_to_int(const MPNumber *x) { int i; int64_t z = 0, v; - + /* |x| <= 1 */ if (x->sign == 0 || x->exponent <= 0) return 0; @@ -299,7 +299,7 @@ mp_cast_to_int(const MPNumber *x) t = z; z = z * MP_BASE + x->fraction[i]; - + /* Check for overflow */ if (z <= t) return 0; @@ -329,7 +329,7 @@ mp_cast_to_unsigned_int(const MPNumber *x) { int i; uint64_t z = 0, v; - + /* x <= 1 */ if (x->sign <= 0 || x->exponent <= 0) return 0; @@ -340,7 +340,7 @@ mp_cast_to_unsigned_int(const MPNumber *x) t = z; z = z * MP_BASE + x->fraction[i]; - + /* Check for overflow */ if (z <= t) return 0; diff --git a/src/mp-equation.c b/src/mp-equation.c index 112078d..c50646e 100644 --- a/src/mp-equation.c +++ b/src/mp-equation.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2004-2008 Sami Pietila * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -66,7 +66,7 @@ get_variable(ParserState *state, const char *name, MPNumber *z) else if (strcmp(name, "mₚ") == 0) mp_set_from_string("0.000000000000000000000000001672621898", 10, z); /* proton mass */ else if (strcmp(name, "Nₐ") == 0) - mp_set_from_string("602214086000000000000000", 10, z); /* Avogrado constant */ + mp_set_from_string("602214086000000000000000", 10, z); /* Avogrado constant */ else if (state->options->get_variable) result = state->options->get_variable(name, z, state->options->callback_data); else diff --git a/src/mp-equation.h b/src/mp-equation.h index d6c0f24..d7eddd3 100644 --- a/src/mp-equation.h +++ b/src/mp-equation.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2004-2008 Sami Pietila * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -41,7 +41,7 @@ typedef struct { /* Data to pass to callbacks */ void *callback_data; - + /* Function to check if a variable is defined */ int (*variable_is_defined)(const char *name, void *data); diff --git a/src/mp-serializer.c b/src/mp-serializer.c index 413d844..4067016 100644 --- a/src/mp-serializer.c +++ b/src/mp-serializer.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2010 Robin Sonefors * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -263,7 +263,7 @@ mp_cast_to_exponential_string_real(MpSerializer *serializer, const MPNumber *x, fixed = mp_cast_to_string(serializer, &mantissa, n_digits); g_string_append(string, fixed); g_free(fixed); - + return exponent; } @@ -273,7 +273,7 @@ append_exponent(GString *string, int exponent) { const gchar *super_digits[] = {"⁰", "¹", "²", "³", "⁴", "⁵", "⁶", "⁷", "⁸", "⁹"}; gchar *super_value, *c; - + if (exponent == 0) return; @@ -593,7 +593,7 @@ mp_serializer_class_init(MpSerializerClass *klass) g_param_spec_int("base", "base", "Default number base", - 2, 16, 10, + 2, 16, 10, G_PARAM_READWRITE)); } diff --git a/src/mp-serializer.h b/src/mp-serializer.h index 63e5937..edd8bc8 100644 --- a/src/mp-serializer.h +++ b/src/mp-serializer.h @@ -1,7 +1,7 @@ /* * Copyright (C) 2010 Robin Sonefors * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later diff --git a/src/mp-trigonometric.c b/src/mp-trigonometric.c index 3ad60c4..72aba0c 100644 --- a/src/mp-trigonometric.c +++ b/src/mp-trigonometric.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -419,7 +419,7 @@ mp_atan(const MPNumber *x, MPAngleUnit unit, MPNumber *z) break; q *= 2; - + /* t = t / (√(t² + 1) + 1) */ mp_multiply(&t2, &t2, z); mp_add_integer(z, 1, z); @@ -211,8 +211,8 @@ mp_imaginary_component(const MPNumber *x, MPNumber *z) z->sign = x->im_sign; z->exponent = x->im_exponent; memcpy(z->fraction, x->im_fraction, sizeof(int) * MP_SIZE); - - /* Clear (old) imaginary component */ + + /* Clear (old) imaginary component */ z->im_sign = 0; z->im_exponent = 0; memset(z->im_fraction, 0, sizeof(int) * MP_SIZE); @@ -234,7 +234,7 @@ mp_add_real(const MPNumber *x, int y_sign, const MPNumber *y, MPNumber *z) z->sign = y_sign; return; } - /* x + 0 = x */ + /* x + 0 = x */ else if (mp_is_zero(y)) { mp_set_from_mp(x, z); return; @@ -458,7 +458,7 @@ mp_sgn(const MPNumber *x, MPNumber *z) else if (mp_is_negative(x)) mp_set_from_integer(-1, z); else - mp_set_from_integer(1, z); + mp_set_from_integer(1, z); } void @@ -837,7 +837,7 @@ bool mp_is_integer(const MPNumber *x) { MPNumber t1, t2, t3; - + if (mp_is_complex(x)) return false; @@ -1306,7 +1306,7 @@ void mp_logarithm(int64_t n, const MPNumber *x, MPNumber *z) { MPNumber t1, t2; - + /* log(0) undefined */ if (mp_is_zero(x)) { /* Translators: Error displayed when attempting to take logarithm of zero */ @@ -1336,7 +1336,7 @@ mp_multiply_real(const MPNumber *x, const MPNumber *y, MPNumber *z) int c, i, xi; MPNumber r; - /* x*0 = 0*y = 0 */ + /* x*0 = 0*y = 0 */ if (x->sign == 0 || y->sign == 0) { mp_set_from_integer(0, z); return; @@ -1421,7 +1421,7 @@ mp_multiply_real(const MPNumber *x, const MPNumber *y, MPNumber *z) /* Clear complex part */ z->im_sign = 0; z->im_exponent = 0; - memset(z->im_fraction, 0, sizeof(int) * MP_SIZE); + memset(z->im_fraction, 0, sizeof(int) * MP_SIZE); /* NORMALIZE AND ROUND RESULT */ // FIXME: Use stack variable because of mp_normalize brokeness @@ -1448,11 +1448,11 @@ mp_multiply(const MPNumber *x, const MPNumber *y, MPNumber *z) mp_imaginary_component(x, &im_x); mp_real_component(y, &real_y); mp_imaginary_component(y, &im_y); - + mp_multiply_real(&real_x, &real_y, &t1); mp_multiply_real(&im_x, &im_y, &t2); mp_subtract(&t1, &t2, &real_z); - + mp_multiply_real(&real_x, &im_y, &t1); mp_multiply_real(&im_x, &real_y, &t2); mp_add(&t1, &t2, &im_z); @@ -1577,7 +1577,7 @@ mp_multiply_integer_real(const MPNumber *x, int64_t y, MPNumber *z) z->im_sign = 0; z->im_exponent = 0; - memset(z->im_fraction, 0, sizeof(int) * MP_SIZE); + memset(z->im_fraction, 0, sizeof(int) * MP_SIZE); mp_normalize(z); } @@ -1673,7 +1673,7 @@ mp_pwr(const MPNumber *x, const MPNumber *y, MPNumber *z) return; }*/ - /* 0^y = 0, 0^-y undefined */ + /* 0^y = 0, 0^-y undefined */ if (mp_is_zero(x)) { mp_set_from_integer(0, z); if (y->sign < 0) @@ -1750,7 +1750,7 @@ mp_reciprocal_real(const MPNumber *x, MPNumber *z) void mp_reciprocal(const MPNumber *x, MPNumber *z) -{ +{ if (mp_is_complex(x)) { MPNumber t1, t2; MPNumber real_x, im_x; @@ -2007,7 +2007,7 @@ mp_xpowy_integer(const MPNumber *x, int64_t n, MPNumber *z) mp_set_from_integer(0, z); return; } - + /* x^1 = x */ if (n == 1) { mp_set_from_mp(x, z); @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later diff --git a/src/test-mp-equation.c b/src/test-mp-equation.c index d05cc12..ee461aa 100644 --- a/src/test-mp-equation.c +++ b/src/test-mp-equation.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -125,25 +125,25 @@ test_conversions() options.wordlen = 32; options.angle_units = MP_DEGREES; options.convert = do_convert; - + /* Angle units */ //test("π radians in degrees", "180", 0); test("100 gradians in degrees", "90", 0); /* Length */ - test("1 meter in mm", "1000", 0); + test("1 meter in mm", "1000", 0); test("1m in mm", "1000", 0); test("1 inch in cm", "2.54", 0); /* Area */ test("1m² in mm²", "1000000", 0); - + /* Volume */ - test("1m³ in mm³", "1000000000", 0); + test("1m³ in mm³", "1000000000", 0); /* Weight */ test("1 kg in pounds", "2.204622622", 0); - + /* Duration */ test("1 minute in seconds", "60", 0); test("1s in ms", "1000", 0); @@ -176,7 +176,7 @@ get_variable(const char *name, MPNumber *z, void *data) mp_set_from_integer (3, z); return 1; } - return 0; + return 0; } @@ -191,7 +191,7 @@ test_equations() memset(&options, 0, sizeof(options)); options.wordlen = 32; options.angle_units = MP_DEGREES; - options.variable_is_defined = variable_is_defined; + options.variable_is_defined = variable_is_defined; options.get_variable = get_variable; options.set_variable = set_variable; @@ -251,7 +251,7 @@ test_equations() test("١٢٣٤٥٦٧٨٩٠", "1234567890", 0); test("۱۲۳۴۵۶۷۸۹۰", "1234567890", 0); -/* +/* //test("2A", "2000000000000000", 0); test("2T", "2000000000000", 0); test("2G", "2000000000", 0); @@ -291,7 +291,7 @@ test_equations() test("2y", "6", 0); test("y2", "", PARSER_ERR_INVALID); test("y 2", "", PARSER_ERR_INVALID); - test("2z", "", PARSER_ERR_UNKNOWN_VARIABLE); + test("2z", "", PARSER_ERR_UNKNOWN_VARIABLE); test("z2", "", PARSER_ERR_UNKNOWN_VARIABLE); test("z 2", "", PARSER_ERR_UNKNOWN_VARIABLE); test("z(2)", "", PARSER_ERR_UNKNOWN_VARIABLE); @@ -445,7 +445,7 @@ test_equations() test("8 mod 7", "1", 0); test("−1 mod 7", "6", 0); - test("sgn 0", "0", 0); + test("sgn 0", "0", 0); test("sgn 3", "1", 0); test("sgn −3", "−1", 0); test("⌊3⌋", "3", 0); @@ -561,16 +561,16 @@ test_equations() test("i", "i", 0); test("−i", "−i", 0); test("2i", "2i", 0); - test("1+i", "1+i", 0); + test("1+i", "1+i", 0); test("i+1", "1+i", 0); - test("1−i", "1−i", 0); + test("1−i", "1−i", 0); test("i−1", "−1+i", 0); test("i×i", "−1", 0); test("i÷i", "1", 0); test("1÷i", "−i", 0); test("|i|", "1", 0); test("|3+4i|", "5", 0); - test("arg 0", "", PARSER_ERR_MP); + test("arg 0", "", PARSER_ERR_MP); test("arg 1", "0", 0); test("arg (1+i)", "45", 0); test("arg i", "90", 0); @@ -597,9 +597,9 @@ test_equations() test("1 and 1", "1", 0); test("3 and 5", "1", 0); - test("0 or 0", "0", 0); + test("0 or 0", "0", 0); test("1 or 0", "1", 0); - test("0 or 1", "1", 0); + test("0 or 1", "1", 0); test("1 or 1", "1", 0); test("3 or 5", "7", 0); diff --git a/src/test-mp.c b/src/test-mp.c index 126b2df..fa7408f 100644 --- a/src/test-mp.c +++ b/src/test-mp.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -144,11 +144,11 @@ static void test_mp() { MPNumber zero, one, minus_one; - + mp_set_from_integer(0, &zero); mp_set_from_integer(1, &one); mp_set_from_integer(-1, &minus_one); - + try("mp_is_zero(-1)", mp_is_zero(&minus_one), false); try("mp_is_zero(0)", mp_is_zero(&zero), true); try("mp_is_zero(1)", mp_is_zero(&one), false); @@ -183,17 +183,17 @@ test_mp() try("mp_is_equal(1, 0)", mp_is_equal(&one, &zero), false); try("mp_is_equal(1, 1)", mp_is_equal(&one, &one), true); - try("mp_is_greater_than(0, -1)", mp_is_greater_than (&zero, &minus_one), true); + try("mp_is_greater_than(0, -1)", mp_is_greater_than (&zero, &minus_one), true); try("mp_is_greater_than(0, 0)", mp_is_greater_than (&zero, &zero), false); try("mp_is_greater_than(0, 1)", mp_is_greater_than (&zero, &one), false); - try("mp_is_greater_than(1, -1)", mp_is_greater_than (&one, &minus_one), true); + try("mp_is_greater_than(1, -1)", mp_is_greater_than (&one, &minus_one), true); try("mp_is_greater_than(1, 0)", mp_is_greater_than (&one, &zero), true); try("mp_is_greater_than(1, 1)", mp_is_greater_than (&one, &one), false); - try("mp_is_greater_than(-1, -1)", mp_is_greater_than (&minus_one, &minus_one), false); + try("mp_is_greater_than(-1, -1)", mp_is_greater_than (&minus_one, &minus_one), false); try("mp_is_greater_than(-1, 0)", mp_is_greater_than (&minus_one, &zero), false); try("mp_is_greater_than(-1, 1)", mp_is_greater_than (&minus_one, &one), false); - try("mp_is_greater_equal(0, -1)", mp_is_greater_equal (&zero, &minus_one), true); + try("mp_is_greater_equal(0, -1)", mp_is_greater_equal (&zero, &minus_one), true); try("mp_is_greater_equal(0, 0)", mp_is_greater_equal (&zero, &zero), true); try("mp_is_greater_equal(0, 1)", mp_is_greater_equal (&zero, &one), false); try("mp_is_greater_equal(1, -1)", mp_is_greater_equal (&one, &minus_one), true); @@ -203,23 +203,23 @@ test_mp() try("mp_is_greater_equal(-1, 0)", mp_is_greater_equal (&minus_one, &zero), false); try("mp_is_greater_equal(-1, 1)", mp_is_greater_equal (&minus_one, &one), false); - try("mp_is_less_than(0, -1)", mp_is_less_than (&zero, &minus_one), false); + try("mp_is_less_than(0, -1)", mp_is_less_than (&zero, &minus_one), false); try("mp_is_less_than(0, 0)", mp_is_less_than (&zero, &zero), false); try("mp_is_less_than(0, 1)", mp_is_less_than (&zero, &one), true); - try("mp_is_less_than(1, -1)", mp_is_less_than (&one, &minus_one), false); + try("mp_is_less_than(1, -1)", mp_is_less_than (&one, &minus_one), false); try("mp_is_less_than(1, 0)", mp_is_less_than (&one, &zero), false); try("mp_is_less_than(1, 1)", mp_is_less_than (&one, &one), false); - try("mp_is_less_than(-1, -1)", mp_is_less_than (&minus_one, &minus_one), false); + try("mp_is_less_than(-1, -1)", mp_is_less_than (&minus_one, &minus_one), false); try("mp_is_less_than(-1, 0)", mp_is_less_than (&minus_one, &zero), true); try("mp_is_less_than(-1, 1)", mp_is_less_than (&minus_one, &one), true); - try("mp_is_less_equal(0, -1)", mp_is_less_equal (&zero, &minus_one), false); + try("mp_is_less_equal(0, -1)", mp_is_less_equal (&zero, &minus_one), false); try("mp_is_less_equal(0, 0)", mp_is_less_equal (&zero, &zero), true); try("mp_is_less_equal(0, 1)", mp_is_less_equal (&zero, &one), true); - try("mp_is_less_equal(1, -1)", mp_is_less_equal (&one, &minus_one), false); + try("mp_is_less_equal(1, -1)", mp_is_less_equal (&one, &minus_one), false); try("mp_is_less_equal(1, 0)", mp_is_less_equal (&one, &zero), false); try("mp_is_less_equal(1, 1)", mp_is_less_equal (&one, &one), true); - try("mp_is_less_equal(-1, -1)", mp_is_less_equal (&minus_one, &minus_one), true); + try("mp_is_less_equal(-1, -1)", mp_is_less_equal (&minus_one, &minus_one), true); try("mp_is_less_equal(-1, 0)", mp_is_less_equal (&minus_one, &zero), true); try("mp_is_less_equal(-1, 1)", mp_is_less_equal (&minus_one, &one), true); } diff --git a/src/unit-category.c b/src/unit-category.c index 875ea58..b8fa303 100644 --- a/src/unit-category.c +++ b/src/unit-category.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -72,7 +72,7 @@ unit_category_get_unit_by_name(UnitCategory *category, const gchar *name) if (strcmp(unit_get_name(unit), name) == 0) return unit; } - + return NULL; } diff --git a/src/unit-category.h b/src/unit-category.h index fc2c739..c5e699c 100644 --- a/src/unit-category.h +++ b/src/unit-category.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later diff --git a/src/unit-manager.c b/src/unit-manager.c index cf1e441..01f3c16 100644 --- a/src/unit-manager.c +++ b/src/unit-manager.c @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -175,7 +175,7 @@ UnitCategory * unit_manager_get_category(UnitManager *manager, const gchar *category) { GList *iter; - + g_return_val_if_fail(manager != NULL, NULL); g_return_val_if_fail(category != NULL, NULL); @@ -205,7 +205,7 @@ unit_manager_get_unit_by_name(UnitManager *manager, const gchar *name) return u; } - return NULL; + return NULL; } @@ -216,7 +216,7 @@ unit_manager_get_unit_by_symbol(UnitManager *manager, const gchar *symbol) Unit *u; g_return_val_if_fail(manager != NULL, NULL); - g_return_val_if_fail(symbol != NULL, NULL); + g_return_val_if_fail(symbol != NULL, NULL); for (iter = manager->priv->categories; iter; iter = iter->next) { UnitCategory *c = iter->data; @@ -225,7 +225,7 @@ unit_manager_get_unit_by_symbol(UnitManager *manager, const gchar *symbol) return u; } - return NULL; + return NULL; } @@ -249,7 +249,7 @@ unit_manager_convert_by_symbol(UnitManager *manager, const MPNumber *x, const ch if (x_units && z_units && unit_category_convert(c, x, x_units, z_units, z)) return TRUE; } - + return FALSE; } diff --git a/src/unit-manager.h b/src/unit-manager.h index db1b4f2..dbedfd3 100644 --- a/src/unit-manager.h +++ b/src/unit-manager.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later @@ -1,7 +1,7 @@ /* * Copyright (C) 1987-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright (C) 2008-2011 Robert Ancell. - * + * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 2 of the License, or (at your option) any later |