summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/buttons-programming.ui1369
-rw-r--r--src/currency-manager.c20
-rw-r--r--src/currency.c8
-rw-r--r--src/financial.c51
-rw-r--r--src/mate-calc-cmd.c6
-rw-r--r--src/mate-calc.c8
-rw-r--r--src/math-buttons.c83
-rw-r--r--src/math-converter.c19
-rw-r--r--src/math-display.c9
-rw-r--r--src/math-equation.c153
-rw-r--r--src/math-history-entry.c49
-rw-r--r--src/math-history-entry.h7
-rw-r--r--src/math-history.c43
-rw-r--r--src/math-history.h7
-rw-r--r--src/math-preferences.c22
-rw-r--r--src/math-variable-popup.c12
-rw-r--r--src/math-variables.c10
-rw-r--r--src/math-window.c30
-rw-r--r--src/meson.build120
-rw-r--r--src/mp-binary.c11
-rw-r--r--src/mp-convert.c22
-rw-r--r--src/mp-equation.c7
-rw-r--r--src/mp-serializer.c62
-rw-r--r--src/mp-trigonometric.c13
-rw-r--r--src/mp.c309
-rw-r--r--src/mp.h24
-rw-r--r--src/parser.c2
-rw-r--r--src/parserfunc.c2
-rw-r--r--src/parserfunc.h2
-rw-r--r--src/test-mp-equation.c111
-rw-r--r--src/test-mp.c8
-rw-r--r--src/unit-category.c12
-rw-r--r--src/unit-category.h2
-rw-r--r--src/unit-manager.c11
-rw-r--r--src/unit.c15
-rw-r--r--src/unittest.c766
-rw-r--r--src/unittest.h24
-rw-r--r--src/utility.h1
39 files changed, 1381 insertions, 2051 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 24b8a2e..4ef161a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,9 +4,7 @@ noinst_PROGRAMS = test-mp test-mp-equation
TESTS = test-mp test-mp-equation
AM_CPPFLAGS = \
- -DVERSION=\""$(VERSION)"\" \
-DLOCALE_DIR=\""$(localedir)"\" \
- -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
$(WARN_CFLAGS) \
$(MATE_CALC_CFLAGS)
diff --git a/src/buttons-programming.ui b/src/buttons-programming.ui
index d084867..27bdc99 100644
--- a/src/buttons-programming.ui
+++ b/src/buttons-programming.ui
@@ -1,37 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkDialog" id="character_code_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
+ <property name="can-focus">False</property>
+ <property name="border-width">6</property>
<property name="title" translatable="yes" comments="Title of insert character code dialog">Insert Character Code</property>
<property name="resizable">False</property>
- <property name="icon_name">accessories-calculator</property>
- <property name="type_hint">dialog</property>
+ <property name="icon-name">accessories-calculator</property>
+ <property name="type-hint">dialog</property>
<signal name="delete-event" handler="character_code_dialog_delete_cb" swapped="no"/>
<signal name="response" handler="character_code_dialog_response_cb" swapped="no"/>
- <child>
- <placeholder/>
- </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
+ <property name="spacing">12</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
+ <property name="can-focus">False</property>
+ <property name="layout-style">end</property>
<child>
<object class="GtkButton" id="button9">
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="can-default">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -43,10 +41,10 @@
<object class="GtkButton" id="button8">
<property name="label" translatable="yes" comments="Insert ASCII dialog: Button to insert selected character">_Insert</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="can-default">True</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -58,22 +56,23 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox21">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
+ <property name="can-focus">False</property>
+ <property name="border-width">5</property>
+ <property name="spacing">12</property>
<child>
<object class="GtkLabel" id="label39">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" comments="Insert ASCII dialog: Label before character entry">Ch_aracter:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">character_code_entry</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">character_code_entry</property>
</object>
<packing>
<property name="expand">False</property>
@@ -84,16 +83,13 @@
<child>
<object class="GtkEntry" id="character_code_entry">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">1</property>
- <property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
+ <property name="can-focus">True</property>
+ <property name="max-length">1</property>
<signal name="activate" handler="character_code_dialog_activate_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -112,26 +108,23 @@
</action-widgets>
</object>
<object class="GtkWindow" id="window1">
- <property name="can_focus">False</property>
- <child>
- <placeholder/>
- </child>
+ <property name="can-focus">False</property>
<child>
<object class="GtkBox" id="button_panel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="hbox1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkComboBox" id="base_combo">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="focus_on_click">False</property>
+ <property name="can-focus">False</property>
+ <property name="focus-on-click">False</property>
</object>
<packing>
<property name="expand">False</property>
@@ -142,7 +135,7 @@
<child>
<object class="GtkLabel" id="base_label">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" comments="Example content">FF₁₆ 256₁₀</property>
<property name="xalign">1</property>
</object>
@@ -162,1473 +155,1474 @@
<child>
<object class="GtkAlignment" id="bit_panel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
+ <!-- n-columns=39 n-rows=4 -->
<object class="GtkGrid" id="bit_table">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<child>
<object class="GtkEventBox" id="bit_eventbox_1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_6">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_6">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">7</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_7">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_7">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">8</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">8</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_8">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_8">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">10</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">10</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_9">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_9">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">11</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">11</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_10">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_10">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">12</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">12</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_11">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_11">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">13</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">13</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_12">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_12">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">15</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">15</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_13">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_13">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">16</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">16</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_14">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_14">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">17</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">17</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_15">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_15">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">18</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">18</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_31">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_31">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">38</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">38</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_30">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_30">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">37</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">37</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_29">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_29">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">36</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">36</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_28">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_28">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">35</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">35</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_27">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_27">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">33</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">33</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_26">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_26">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">32</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">32</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_25">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_25">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">31</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">31</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_24">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_24">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">30</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">30</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_23">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_23">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">28</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">28</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_22">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_22">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">27</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">27</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_21">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_21">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">26</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">26</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_20">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_20">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">25</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">25</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_19">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_19">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">23</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">23</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_18">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_18">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">22</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">22</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_17">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_17">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">21</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">21</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_16">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_16">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">20</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">20</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bit_marker_label2">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">32</property>
<property name="justify">center</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">38</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">38</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bit_marker_label5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">0</property>
<property name="justify">center</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">38</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">38</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_33">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_33">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_34">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_34">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_35">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_35">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_36">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_36">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_37">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_37">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_38">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_38">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">7</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_39">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_39">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">8</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">8</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_40">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_40">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">10</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">10</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_41">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_41">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">11</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">11</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_42">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_42">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">12</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">12</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_43">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_43">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">13</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">13</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_44">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_44">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">15</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">15</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_45">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_45">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">16</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">16</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_46">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_46">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">17</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">17</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_47">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_47">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">18</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">18</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_48">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_48">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">20</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">20</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_49">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_49">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">21</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">21</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_50">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_50">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">22</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">22</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_51">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_51">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">23</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">23</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_52">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_52">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">25</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">25</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_53">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_53">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">26</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">26</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_54">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_54">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">27</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">27</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_55">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_55">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">28</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">28</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_56">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_56">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">30</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">30</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_57">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_57">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">31</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">31</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_58">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_58">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">32</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">32</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_59">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_59">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">33</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">33</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_60">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_60">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">35</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">35</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_61">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_61">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">36</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">36</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_62">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_62">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">37</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">37</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_63">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_63">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">38</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">38</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bit_marker_label1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">47</property>
<property name="justify">center</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">20</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">20</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bit_marker_label4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">15</property>
<property name="justify">center</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">20</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">20</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label25">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label26">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">9</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">9</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label27">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">14</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">14</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label28">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">19</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">19</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label29">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">24</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">24</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label30">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">29</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">29</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label31">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">34</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">34</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label32">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label33">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">9</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">9</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label34">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">14</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">14</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label35">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">19</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">19</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label36">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">24</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">24</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label37">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">29</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">29</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label38">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> </property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">34</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">34</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_0">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_0">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bit_marker_label0">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">63</property>
<property name="justify">center</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="bit_maker_label3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">31</property>
<property name="justify">center</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkEventBox" id="bit_eventbox_32">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<signal name="button-press-event" handler="bit_toggle_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="bit_label_32">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label"> 0</property>
<property name="xalign">0</property>
</object>
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
@@ -1857,48 +1851,49 @@
</packing>
</child>
<child>
+ <!-- n-columns=10 n-rows=5 -->
<object class="GtkGrid" id="advanced_panel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_homogeneous">True</property>
- <property name="column_homogeneous">True</property>
+ <property name="can-focus">False</property>
+ <property name="row-homogeneous">True</property>
+ <property name="column-homogeneous">True</property>
<child>
<object class="GtkButton" id="calc_root_button">
<property name="label">√</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">7</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_logarithm_button">
<property name="label">log</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">7</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_factor_button">
<property name="label">fact</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="factorize_cb" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="calc_factor_button-atkobject">
@@ -1907,39 +1902,39 @@
</child>
</object>
<packing>
- <property name="left_attach">7</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_natural_logarithm_button">
<property name="label">ln</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">8</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">8</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_abs_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">|&lt;i&gt;x&lt;/i&gt;|</property>
- <property name="use_markup">True</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child internal-child="accessible">
@@ -1949,329 +1944,329 @@
</child>
</object>
<packing>
- <property name="left_attach">9</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">9</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_integer_portion_button">
<property name="label">int</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">9</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">9</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_fractional_portion_button">
<property name="label">frac</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">9</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">9</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_divide_button">
<property name="label">÷</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_multiply_button">
<property name="label">×</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_subtract_button">
<property name="label">−</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="subtract_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_add_button">
<property name="label">+</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_result_button">
<property name="label" translatable="yes" comments="Label on the solve button (clicking this solves the displayed calculation)">=</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="solve_cb" swapped="no"/>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_clear_button">
<property name="label" translatable="yes">Clear</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="clear_cb" swapped="no"/>
<style>
<class name="destructive-action"/>
</style>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_1_button">
<property name="label">1</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_2_button">
<property name="label">2</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_3_button">
<property name="label">3</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_5_button">
<property name="label">5</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_6_button">
<property name="label">6</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_7_button">
<property name="label">7</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_9_button">
<property name="label">9</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_10_button">
<property name="label">A</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_11_button">
<property name="label">B</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_13_button">
<property name="label">D</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_14_button">
<property name="label">E</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_15_button">
<property name="label">F</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="calc_superscript_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="set_superscript_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">↑n</property>
- <property name="use_markup">True</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child internal-child="accessible">
@@ -2281,41 +2276,41 @@
</child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_numeric_point_button">
<property name="label" comments="Label is set in gtk.c to comply with LC flags">.</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="numeric_point_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">2</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">2</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_memory_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="memory_cb" swapped="no"/>
<child>
<object class="GtkBox" id="hbox20">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label23">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes" comments="The label on the memory button">x</property>
</object>
<packing>
@@ -2327,8 +2322,8 @@
<child>
<object class="GtkArrow" id="arrow14">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">down</property>
+ <property name="can-focus">False</property>
+ <property name="arrow-type">down</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2345,116 +2340,116 @@
</child>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">3</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_xor_button">
<property name="label">XOR</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_or_button">
<property name="label">OR</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_and_button">
<property name="label">AND</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_modulus_divide_button">
<property name="label">mod</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_start_group_button">
<property name="label">(</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">4</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">4</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_end_group_button">
<property name="label">)</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">5</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_shift_left_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="shift_left_cb" swapped="no"/>
<child>
<object class="GtkBox" id="hbox11">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="label">&lt;</property>
</object>
<packing>
@@ -2466,8 +2461,8 @@
<child>
<object class="GtkArrow" id="arrow5">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">down</property>
+ <property name="can-focus">False</property>
+ <property name="arrow-type">down</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2484,26 +2479,26 @@
</child>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_shift_right_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="shift_right_cb" swapped="no"/>
<child>
<object class="GtkBox" id="hbox10">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="label">&gt;</property>
</object>
<packing>
@@ -2515,8 +2510,8 @@
<child>
<object class="GtkArrow" id="arrow4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">down</property>
+ <property name="can-focus">False</property>
+ <property name="arrow-type">down</property>
</object>
<packing>
<property name="expand">False</property>
@@ -2533,57 +2528,38 @@
</child>
</object>
<packing>
- <property name="left_attach">7</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_character_button">
- <property name="label">á</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="insert_character_code_cb" swapped="no"/>
- <child internal-child="accessible">
- <object class="AtkObject" id="calc_character_button-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the insert character button">Insert Character</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">8</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_not_button">
<property name="label">NOT</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_factorial_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="label14">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">&lt;i&gt;x&lt;/i&gt;!</property>
- <property name="use_markup">True</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child internal-child="accessible">
@@ -2593,23 +2569,23 @@
</child>
</object>
<packing>
- <property name="left_attach">8</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">8</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_inverse_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sup&gt;−1&lt;/sup&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use-markup">True</property>
<property name="justify">center</property>
</object>
</child>
@@ -2620,23 +2596,23 @@
</child>
</object>
<packing>
- <property name="left_attach">9</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">9</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_x_pow_y_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="x_pow_y_label">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">&lt;i&gt;x&lt;/i&gt;&lt;sup&gt;&lt;i&gt;y&lt;/i&gt;&lt;/sup&gt;</property>
- <property name="use_markup">True</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child internal-child="accessible">
@@ -2646,68 +2622,53 @@
</child>
</object>
<packing>
- <property name="left_attach">8</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">8</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_ones_complement_button">
<property name="label">ones</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">6</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">6</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_twos_complement_button">
<property name="label">twos</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="button_cb" swapped="no"/>
- </object>
- <packing>
- <property name="left_attach">7</property>
- <property name="top_attach">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="calc_trunc_button">
- <property name="label">trunc</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="button_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">8</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">7</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="calc_subscript_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
<signal name="clicked" handler="set_subscript_cb" swapped="no"/>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label">↓n</property>
- <property name="use_markup">True</property>
+ <property name="use-markup">True</property>
</object>
</child>
<child internal-child="accessible">
@@ -2717,74 +2678,96 @@
</child>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_12_button">
<property name="label">C</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_8_button">
<property name="label">8</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_4_button">
<property name="label">4</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="calc_0_button">
<property name="label">0</property>
- <property name="width_request">50</property>
+ <property name="width-request">50</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="focus_on_click">False</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <property name="use-underline">True</property>
<signal name="clicked" handler="digit_cb" swapped="no"/>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="calc_character_button">
+ <property name="label">á</property>
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="focus-on-click">False</property>
+ <property name="receives-default">True</property>
+ <signal name="clicked" handler="insert_character_code_cb" swapped="no"/>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="calc_character_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" comments="Accessible name for the insert character button">Insert Character</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left-attach">8</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">True</property>
diff --git a/src/currency-manager.c b/src/currency-manager.c
index 5ffffa4..5445881 100644
--- a/src/currency-manager.c
+++ b/src/currency-manager.c
@@ -14,6 +14,7 @@
#include <glib/gstdio.h>
#include <gio/gio.h>
#include <libxml/tree.h>
+#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include <glib/gi18n.h>
@@ -101,7 +102,6 @@ struct CurrencyManagerPrivate
G_DEFINE_TYPE_WITH_PRIVATE (CurrencyManager, currency_manager, G_TYPE_OBJECT);
-
enum {
UPDATED,
LAST_SIGNAL
@@ -110,7 +110,6 @@ static guint signals[LAST_SIGNAL] = { 0, };
static CurrencyManager *default_currency_manager = NULL;
-
CurrencyManager *
currency_manager_get_default(void)
{
@@ -131,7 +130,6 @@ currency_manager_get_default(void)
return default_currency_manager;
}
-
GList *
currency_manager_get_currencies(CurrencyManager *manager)
{
@@ -139,7 +137,6 @@ currency_manager_get_currencies(CurrencyManager *manager)
return manager->priv->currencies;
}
-
Currency *
currency_manager_get_currency(CurrencyManager *manager, const gchar *name)
{
@@ -165,7 +162,6 @@ currency_manager_get_currency(CurrencyManager *manager, const gchar *name)
return NULL;
}
-
static char *
get_imf_rate_filepath(void)
{
@@ -175,7 +171,6 @@ get_imf_rate_filepath(void)
NULL);
}
-
static char *
get_ecb_rate_filepath(void)
{
@@ -185,7 +180,6 @@ get_ecb_rate_filepath(void)
NULL);
}
-
static Currency *
add_currency(CurrencyManager *manager, const gchar *short_name)
{
@@ -205,7 +199,6 @@ add_currency(CurrencyManager *manager, const gchar *short_name)
return c;
}
-
/* A file needs to be redownloaded if it doesn't exist, or is too old.
* When an error occur, it probably won't hurt to try to download again.
*/
@@ -226,7 +219,6 @@ file_needs_update(gchar *filename, double max_age)
return FALSE;
}
-
static void
download_imf_cb(GObject *object, GAsyncResult *result, gpointer user_data)
{
@@ -242,7 +234,6 @@ download_imf_cb(GObject *object, GAsyncResult *result, gpointer user_data)
load_rates(manager);
}
-
static void
download_ecb_cb(GObject *object, GAsyncResult *result, gpointer user_data)
{
@@ -258,7 +249,6 @@ download_ecb_cb(GObject *object, GAsyncResult *result, gpointer user_data)
load_rates(manager);
}
-
static void
download_file(CurrencyManager *manager, gchar *uri, gchar *filename, GAsyncReadyCallback callback)
{
@@ -277,7 +267,6 @@ download_file(CurrencyManager *manager, gchar *uri, gchar *filename, GAsyncReady
g_object_unref(dest);
}
-
static void
load_imf_rates(CurrencyManager *manager)
{
@@ -414,7 +403,6 @@ load_imf_rates(CurrencyManager *manager)
g_strfreev(lines);
}
-
static void
set_ecb_rate(CurrencyManager *manager, xmlNodePtr node, Currency *eur_rate)
{
@@ -455,7 +443,6 @@ set_ecb_rate(CurrencyManager *manager, xmlNodePtr node, Currency *eur_rate)
xmlFree(value);
}
-
static void
set_ecb_fixed_rate(CurrencyManager *manager, const gchar *name, const gchar *value, Currency *eur_rate)
{
@@ -473,7 +460,6 @@ set_ecb_fixed_rate(CurrencyManager *manager, const gchar *name, const gchar *val
mp_clear(&v);
}
-
static void
load_ecb_rates(CurrencyManager *manager)
{
@@ -538,7 +524,6 @@ load_ecb_rates(CurrencyManager *manager)
xmlCleanupParser();
}
-
static gboolean
load_rates(CurrencyManager *manager)
{
@@ -575,7 +560,6 @@ load_rates(CurrencyManager *manager)
return TRUE;
}
-
const MPNumber *
currency_manager_get_value(CurrencyManager *manager, const gchar *currency)
{
@@ -611,7 +595,6 @@ currency_manager_get_value(CurrencyManager *manager, const gchar *currency)
return NULL;
}
-
static void
currency_manager_class_init(CurrencyManagerClass *klass)
{
@@ -625,7 +608,6 @@ currency_manager_class_init(CurrencyManagerClass *klass)
G_TYPE_NONE, 0);
}
-
static void
currency_manager_init(CurrencyManager *manager)
{
diff --git a/src/currency.c b/src/currency.c
index a6295ee..6829267 100644
--- a/src/currency.c
+++ b/src/currency.c
@@ -25,7 +25,6 @@ struct CurrencyPrivate
G_DEFINE_TYPE_WITH_PRIVATE (Currency, currency, G_TYPE_OBJECT);
-
Currency *
currency_new(const gchar *name,
const gchar *display_name,
@@ -41,7 +40,6 @@ currency_new(const gchar *name,
return currency;
}
-
const gchar *
currency_get_name(Currency *currency)
{
@@ -49,7 +47,6 @@ currency_get_name(Currency *currency)
return currency->priv->name;
}
-
const gchar *
currency_get_display_name(Currency *currency)
{
@@ -57,7 +54,6 @@ currency_get_display_name(Currency *currency)
return currency->priv->display_name;
}
-
const gchar *
currency_get_symbol(Currency *currency)
{
@@ -65,7 +61,6 @@ currency_get_symbol(Currency *currency)
return currency->priv->symbol;
}
-
void
currency_set_value(Currency *currency, MPNumber *value)
{
@@ -74,7 +69,6 @@ currency_set_value(Currency *currency, MPNumber *value)
mp_set_from_mp (value, &currency->priv->value);
}
-
const MPNumber *
currency_get_value(Currency *currency)
{
@@ -82,13 +76,11 @@ currency_get_value(Currency *currency)
return &currency->priv->value;
}
-
static void
currency_class_init(CurrencyClass *klass)
{
}
-
static void
currency_init(Currency *currency)
{
diff --git a/src/financial.c b/src/financial.c
index 337ff93..8bb208d 100644
--- a/src/financial.c
+++ b/src/financial.c
@@ -15,7 +15,7 @@
#include "mp.h"
static void
-calc_ctrm(MathEquation *equation, MPNumber *t, MPNumber *pint, MPNumber *fv, MPNumber *pv)
+calc_ctrm(MPNumber *t, MPNumber *pint, MPNumber *fv, MPNumber *pv)
{
/* Cterm - pint (periodic interest rate).
@@ -41,7 +41,6 @@ calc_ctrm(MathEquation *equation, MPNumber *t, MPNumber *pint, MPNumber *fv, MPN
mp_clear(&MP4);
}
-
static void
calc_ddb(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *life, MPNumber *period)
{
@@ -60,15 +59,14 @@ calc_ddb(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *life, MP
*
*/
- int i;
- int len;
+ long len;
MPNumber MPbv = mp_new();
MPNumber MP1 = mp_new();
MPNumber MP2 = mp_new();
mp_set_from_integer(0, &MPbv);
len = mp_to_integer(period);
- for (i = 0; i < len; i++) {
+ for (long i = 0; i < len; i++) {
mp_subtract(cost, &MPbv, &MP1);
mp_multiply_integer(&MP1, 2, &MP2);
mp_divide(&MP2, life, t);
@@ -86,9 +84,8 @@ calc_ddb(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *life, MP
mp_clear(&MP2);
}
-
static void
-calc_fv(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNumber *n)
+calc_fv(MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNumber *n)
{
/* Fv - pmt (periodic payment).
@@ -115,9 +112,8 @@ calc_fv(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNu
mp_clear(&MP4);
}
-
static void
-calc_gpm(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *margin)
+calc_gpm(MPNumber *t, MPNumber *cost, MPNumber *margin)
{
/* Gpm - cost (cost of sale).
@@ -137,9 +133,8 @@ calc_gpm(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *margin)
mp_clear(&MP2);
}
-
static void
-calc_pmt(MathEquation *equation, MPNumber *t, MPNumber *prin, MPNumber *pint, MPNumber *n)
+calc_pmt(MPNumber *t, MPNumber *prin, MPNumber *pint, MPNumber *n)
{
/* Pmt - prin (principal).
@@ -168,9 +163,8 @@ calc_pmt(MathEquation *equation, MPNumber *t, MPNumber *prin, MPNumber *pint, MP
mp_clear(&MP4);
}
-
static void
-calc_pv(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNumber *n)
+calc_pv(MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNumber *n)
{
/* Pv - pmt (periodic payment).
@@ -199,9 +193,8 @@ calc_pv(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNu
mp_clear(&MP4);
}
-
static void
-calc_rate(MathEquation *equation, MPNumber *t, MPNumber *fv, MPNumber *pv, MPNumber *n)
+calc_rate(MPNumber *t, MPNumber *fv, MPNumber *pv, MPNumber *n)
{
/* Rate - fv (future value).
@@ -228,9 +221,8 @@ calc_rate(MathEquation *equation, MPNumber *t, MPNumber *fv, MPNumber *pv, MPNum
mp_clear(&MP4);
}
-
static void
-calc_sln(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *salvage, MPNumber *life)
+calc_sln(MPNumber *t, MPNumber *cost, MPNumber *salvage, MPNumber *life)
{
/* Sln - cost (cost of the asset).
@@ -246,9 +238,8 @@ calc_sln(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *salvage,
mp_clear(&MP1);
}
-
static void
-calc_syd(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *salvage, MPNumber *life, MPNumber *period)
+calc_syd(MPNumber *t, MPNumber *cost, MPNumber *salvage, MPNumber *life, MPNumber *period)
{
/* Syd - cost (cost of the asset).
@@ -281,9 +272,8 @@ calc_syd(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *salvage,
mp_clear(&MP4);
}
-
static void
-calc_term(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *fv, MPNumber *pint)
+calc_term(MPNumber *t, MPNumber *pmt, MPNumber *fv, MPNumber *pint)
{
/* Term - pmt (periodic payment).
@@ -312,41 +302,40 @@ calc_term(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *fv, MPNu
mp_clear(&MP4);
}
-
void
do_finc_expression(MathEquation *equation, int function, MPNumber *arg1, MPNumber *arg2, MPNumber *arg3, MPNumber *arg4)
{
MPNumber result = mp_new();
switch (function) {
case FINC_CTRM_DIALOG:
- calc_ctrm(equation, &result, arg1, arg2, arg3);
+ calc_ctrm(&result, arg1, arg2, arg3);
break;
case FINC_DDB_DIALOG:
calc_ddb(equation, &result, arg1, arg2, arg3);
break;
case FINC_FV_DIALOG:
- calc_fv(equation, &result, arg1, arg2, arg3);
+ calc_fv(&result, arg1, arg2, arg3);
break;
case FINC_GPM_DIALOG:
- calc_gpm(equation, &result, arg1, arg2);
+ calc_gpm(&result, arg1, arg2);
break;
case FINC_PMT_DIALOG:
- calc_pmt(equation, &result, arg1, arg2, arg3);
+ calc_pmt(&result, arg1, arg2, arg3);
break;
case FINC_PV_DIALOG:
- calc_pv(equation, &result, arg1, arg2, arg3);
+ calc_pv(&result, arg1, arg2, arg3);
break;
case FINC_RATE_DIALOG:
- calc_rate(equation, &result, arg1, arg2, arg3);
+ calc_rate(&result, arg1, arg2, arg3);
break;
case FINC_SLN_DIALOG:
- calc_sln(equation, &result, arg1, arg2, arg3);
+ calc_sln(&result, arg1, arg2, arg3);
break;
case FINC_SYD_DIALOG:
- calc_syd(equation, &result, arg1, arg2, arg3, arg4);
+ calc_syd(&result, arg1, arg2, arg3, arg4);
break;
case FINC_TERM_DIALOG:
- calc_term(equation, &result, arg1, arg2, arg3);
+ calc_term(&result, arg1, arg2, arg3);
break;
}
math_equation_set_number(equation, &result);
diff --git a/src/mate-calc-cmd.c b/src/mate-calc-cmd.c
index cf8db3d..842eab5 100644
--- a/src/mate-calc-cmd.c
+++ b/src/mate-calc-cmd.c
@@ -49,7 +49,6 @@ solve(const char *equation)
mp_clear(&z);
}
-
/* Adjust user input equation string before solving it. */
static void
str_adjust(char *str)
@@ -67,10 +66,9 @@ str_adjust(char *str)
}
int
-main(int argc, char **argv)
+main(void)
{
char *equation, *line;
- size_t nbytes = MAXLINE;
/* Seed random number generator. */
srand48((long) time((time_t *) 0));
@@ -82,7 +80,7 @@ main(int argc, char **argv)
equation = (char *) malloc(MAXLINE * sizeof(char));
while (1) {
printf("> ");
- line = fgets(equation, nbytes, stdin);
+ line = fgets(equation, MAXLINE, stdin);
if (line != NULL)
str_adjust(equation);
diff --git a/src/mate-calc.c b/src/mate-calc.c
index b12ab79..da95462 100644
--- a/src/mate-calc.c
+++ b/src/mate-calc.c
@@ -9,6 +9,10 @@
* license.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -32,14 +36,12 @@ version(const gchar *progname)
fprintf(stderr, "%1$s %2$s\n", progname, VERSION);
}
-
static int
do_convert(const MPNumber *x, const char *x_units, const char *z_units, MPNumber *z, void *data)
{
return unit_manager_convert_by_symbol(unit_manager_get_default(), x, x_units, z_units, z);
}
-
static void
solve(const char *equation)
{
@@ -73,7 +75,6 @@ solve(const char *equation)
}
}
-
static void
usage(const gchar *progname, gboolean show_application, gboolean show_gtk)
{
@@ -119,7 +120,6 @@ usage(const gchar *progname, gboolean show_application, gboolean show_gtk)
}
}
-
static void
get_options(int argc, char *argv[])
{
diff --git a/src/math-buttons.c b/src/math-buttons.c
index 64d929c..19195aa 100644
--- a/src/math-buttons.c
+++ b/src/math-buttons.c
@@ -69,9 +69,6 @@ G_DEFINE_TYPE_WITH_PRIVATE (MathButtons, math_buttons, GTK_TYPE_BOX);
#define GET_WIDGET(ui, name) \
GTK_WIDGET(gtk_builder_get_object((ui), (name)))
-#define WM_WIDTH_FACTOR 10
-#define WM_HEIGHT_FACTOR 30
-
typedef enum
{
NUMBER,
@@ -97,8 +94,12 @@ static ButtonData button_data[] = {
{"eulers_number", "e", NUMBER,
/* Tooltip for the Euler's Number button */
N_("Euler’s Number")},
- {"imaginary", "i", NUMBER, NULL},
- {"numeric_point", NULL, NUMBER, NULL},
+ {"imaginary", "i", NUMBER,
+ /* Tooltip for the imaginary number button */
+ N_("Imaginary unit")},
+ {"numeric_point", NULL, NUMBER,
+ /* Tooltip for the numeric point button */
+ N_("Decimal point")},
{"subscript", NULL, NUMBER_BOLD,
/* Tooltip for the subscript button */
N_("Subscript mode [Alt]")},
@@ -222,9 +223,6 @@ static ButtonData button_data[] = {
{"twos_complement", "twos ", FUNCTION,
/* Tooltip for the two's complement button */
N_("Two's Complement")},
- {"trunc", "trunc ", FUNCTION,
- /* Tooltip for the truncate button */
- N_("Truncate")},
{"start_group", "(", GROUP,
/* Tooltip for the start group button */
N_("Start Group [(]")},
@@ -303,7 +301,6 @@ static char *finc_dialog_fields[][5] = {
{NULL, NULL, NULL, NULL, NULL}
};
-
MathButtons *
math_buttons_new(MathEquation *equation)
{
@@ -319,7 +316,6 @@ set_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, const char
g_object_set_data(object, name, GINT_TO_POINTER(value));
}
-
static void
set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gint value)
{
@@ -329,7 +325,6 @@ set_int_data(GtkBuilder *ui, const gchar *object_name, const gchar *name, gint v
g_object_set_data(object, name, GINT_TO_POINTER(value));
}
-
static void
load_finc_dialogs(MathButtons *buttons)
{
@@ -356,11 +351,10 @@ load_finc_dialogs(MathButtons *buttons)
}
}
-
static void
update_bit_panel(MathButtons *buttons)
{
- MPNumber x = mp_new();
+ MPNumber x;
gboolean enabled;
guint64 bits;
int i;
@@ -370,6 +364,7 @@ update_bit_panel(MathButtons *buttons)
if (!buttons->priv->bit_panel)
return;
+ x = mp_new();
enabled = math_equation_get_number(buttons->priv->equation, &x);
if (enabled) {
@@ -390,7 +385,10 @@ update_bit_panel(MathButtons *buttons)
gtk_widget_set_sensitive(buttons->priv->base_label, enabled);
if (!enabled)
+ {
+ mp_clear(&x);
return;
+ }
for (i = 0; i < MAXBITS; i++) {
const gchar *bin_label;
@@ -428,14 +426,12 @@ update_bit_panel(MathButtons *buttons)
mp_clear(&x);
}
-
static void
display_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons)
{
update_bit_panel(buttons);
}
-
static void
base_combobox_changed_cb(GtkWidget *combo, MathButtons *buttons)
{
@@ -450,7 +446,6 @@ base_combobox_changed_cb(GtkWidget *combo, MathButtons *buttons)
math_buttons_set_programming_base(buttons, value);
}
-
static void
base_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons)
{
@@ -479,7 +474,6 @@ base_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons)
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(buttons->priv->base_combo), &iter);
}
-
static GtkWidget *
load_mode(MathButtons *buttons, ButtonMode mode)
{
@@ -548,8 +542,6 @@ 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);
}
/* Set special button data */
@@ -675,7 +667,6 @@ out:
return *panel;
}
-
static void
converter_changed_cb(MathConverter *converter, MathButtons *buttons)
{
@@ -695,7 +686,6 @@ converter_changed_cb(MathConverter *converter, MathButtons *buttons)
g_object_unref(to_unit);
}
-
static void
load_buttons(MathButtons *buttons)
{
@@ -724,7 +714,6 @@ load_buttons(MathButtons *buttons)
gtk_widget_show(panel);
}
-
void
math_buttons_set_mode(MathButtons *buttons, ButtonMode mode)
{
@@ -759,14 +748,12 @@ math_buttons_set_mode(MathButtons *buttons, ButtonMode mode)
g_object_notify(G_OBJECT(buttons), "mode");
}
-
ButtonMode
math_buttons_get_mode(MathButtons *buttons)
{
return buttons->priv->mode;
}
-
void
math_buttons_set_programming_base(MathButtons *buttons, gint base)
{
@@ -783,7 +770,6 @@ math_buttons_set_programming_base(MathButtons *buttons, gint base)
math_equation_set_base(buttons->priv->equation, base);
}
-
gint
math_buttons_get_programming_base(MathButtons *buttons)
{
@@ -791,7 +777,6 @@ math_buttons_get_programming_base(MathButtons *buttons)
return buttons->priv->programming_base;
}
-
void exponent_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -800,7 +785,6 @@ exponent_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_insert_exponent(buttons->priv->equation);
}
-
void subtract_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -809,7 +793,6 @@ subtract_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_insert_subtract(buttons->priv->equation);
}
-
void button_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -818,7 +801,6 @@ button_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_insert(buttons->priv->equation, g_object_get_data(G_OBJECT(widget), "calc_text"));
}
-
void solve_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -827,7 +809,6 @@ solve_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_solve(buttons->priv->equation);
}
-
void clear_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -836,7 +817,6 @@ clear_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_clear(buttons->priv->equation);
}
-
void delete_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -845,7 +825,6 @@ delete_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_delete(buttons->priv->equation);
}
-
void undo_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -854,7 +833,6 @@ undo_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_undo(buttons->priv->equation);
}
-
static void
shift_cb(GtkWidget *widget, MathButtons *buttons)
{
@@ -871,7 +849,6 @@ popup_button_menu(GtkWidget *widget, GtkMenu *menu)
NULL);
}
-
void memory_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -890,7 +867,6 @@ memory_cb(GtkWidget *widget, MathButtons *buttons)
gtk_widget_show(GTK_WIDGET(popup));
}
-
void shift_left_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -905,17 +881,16 @@ shift_left_cb(GtkWidget *widget, MathButtons *buttons)
for (i = 1; i < 16; i++) {
GtkWidget *item, *label;
- gchar *format, *text;
+ gchar *text;
if (i < 10) {
/* Left Shift Popup: Menu item to shift left by n places (n < 10) */
- format = ngettext("_%d place", "_%d places", i);
+ text = g_strdup_printf(ngettext("_%d place", "_%d places", i), i);
}
else {
/* Left Shift Popup: Menu item to shift left by n places (n >= 10) */
- format = ngettext("%d place", "%d places", i);
+ text = g_strdup_printf(ngettext("%d place", "%d places", i), i);
}
- text = g_strdup_printf(format, i);
label = gtk_label_new_with_mnemonic(text);
item = gtk_menu_item_new();
@@ -933,7 +908,6 @@ shift_left_cb(GtkWidget *widget, MathButtons *buttons)
popup_button_menu(widget, GTK_MENU(buttons->priv->shift_left_menu));
}
-
void shift_right_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -948,17 +922,16 @@ shift_right_cb(GtkWidget *widget, MathButtons *buttons)
for (i = 1; i < 16; i++) {
GtkWidget *item, *label;
- gchar *format, *text;
+ gchar *text;
if (i < 10) {
/* Right Shift Popup: Menu item to shift right by n places (n < 10) */
- format = ngettext("_%d place", "_%d places", i);
+ text = g_strdup_printf(ngettext("_%d place", "_%d places", i), i);
}
else {
/* Right Shift Popup: Menu item to shift right by n places (n >= 10) */
- format = ngettext("%d place", "%d places", i);
+ text = g_strdup_printf(ngettext("%d place", "%d places", i), i);
}
- text = g_strdup_printf(format, i);
label = gtk_label_new_with_mnemonic(text);
item = gtk_menu_item_new();
@@ -976,14 +949,12 @@ shift_right_cb(GtkWidget *widget, MathButtons *buttons)
popup_button_menu(widget, GTK_MENU(buttons->priv->shift_right_menu));
}
-
static void
insert_function_cb(GtkWidget *widget, MathButtons *buttons)
{
math_equation_insert(buttons->priv->equation, g_object_get_data(G_OBJECT(widget), "function"));
}
-
void function_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1035,7 +1006,6 @@ insert_const_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_insert(buttons->priv->equation, g_object_get_data(G_OBJECT(widget), "const"));
}
-
void const_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1096,7 +1066,6 @@ factorize_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_factorize(buttons->priv->equation);
}
-
void digit_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1105,7 +1074,6 @@ digit_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_insert_digit(buttons->priv->equation, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "calc_digit")));
}
-
void numeric_point_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1114,8 +1082,6 @@ numeric_point_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_insert_numeric_point(buttons->priv->equation);
}
-
-
void finc_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1128,7 +1094,6 @@ finc_cb(GtkWidget *widget, MathButtons *buttons)
gtk_widget_hide(GTK_WIDGET(GET_WIDGET(buttons->priv->financial_ui, name)));
}
-
void insert_character_code_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1137,7 +1102,6 @@ insert_character_code_cb(GtkWidget *widget, MathButtons *buttons)
gtk_window_present(GTK_WINDOW(buttons->priv->character_code_dialog));
}
-
void finc_activate_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1164,7 +1128,6 @@ finc_activate_cb(GtkWidget *widget, MathButtons *buttons)
}
}
-
void finc_response_cb(GtkWidget *widget, gint response_id, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1198,7 +1161,6 @@ finc_response_cb(GtkWidget *widget, gint response_id, MathButtons *buttons)
}
}
-
void character_code_dialog_response_cb(GtkWidget *dialog, gint response_id, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1228,7 +1190,6 @@ character_code_dialog_response_cb(GtkWidget *dialog, gint response_id, MathButto
gtk_widget_hide(dialog);
}
-
void character_code_dialog_activate_cb(GtkWidget *entry, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1237,7 +1198,6 @@ character_code_dialog_activate_cb(GtkWidget *entry, MathButtons *buttons)
character_code_dialog_response_cb(buttons->priv->character_code_dialog, GTK_RESPONSE_OK, buttons);
}
-
gboolean character_code_dialog_delete_cb(GtkWidget *dialog, GdkEvent *event, MathButtons *buttons);
G_MODULE_EXPORT
gboolean
@@ -1247,7 +1207,6 @@ character_code_dialog_delete_cb(GtkWidget *dialog, GdkEvent *event, MathButtons
return TRUE;
}
-
gboolean bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, MathButtons *buttons);
G_MODULE_EXPORT
gboolean
@@ -1257,7 +1216,6 @@ bit_toggle_cb(GtkWidget *event_box, GdkEventButton *event, MathButtons *buttons)
return TRUE;
}
-
static void
remove_trailing_spaces(MathButtons *buttons)
{
@@ -1273,7 +1231,6 @@ remove_trailing_spaces(MathButtons *buttons)
}
}
-
void set_superscript_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1289,7 +1246,6 @@ set_superscript_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_set_number_mode(buttons->priv->equation, NORMAL);
}
-
void set_subscript_cb(GtkWidget *widget, MathButtons *buttons);
G_MODULE_EXPORT
void
@@ -1305,7 +1261,6 @@ set_subscript_cb(GtkWidget *widget, MathButtons *buttons)
math_equation_set_number_mode(buttons->priv->equation, NORMAL);
}
-
static void
number_mode_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *buttons)
{
@@ -1324,7 +1279,6 @@ number_mode_changed_cb(MathEquation *equation, GParamSpec *spec, MathButtons *bu
}
}
-
static void
math_buttons_set_property(GObject *object,
guint prop_id,
@@ -1358,7 +1312,6 @@ math_buttons_set_property(GObject *object,
}
}
-
static void
math_buttons_get_property(GObject *object,
guint prop_id,
@@ -1385,7 +1338,6 @@ math_buttons_get_property(GObject *object,
}
}
-
static void
math_buttons_class_init(MathButtonsClass *klass)
{
@@ -1428,7 +1380,6 @@ math_buttons_class_init(MathButtonsClass *klass)
G_PARAM_READWRITE));
}
-
static void
math_buttons_init(MathButtons *buttons)
{
diff --git a/src/math-converter.c b/src/math-converter.c
index 10d5336..a94f986 100644
--- a/src/math-converter.c
+++ b/src/math-converter.c
@@ -32,13 +32,11 @@ struct MathConverterPrivate
GtkWidget *result_label;
};
-
G_DEFINE_TYPE_WITH_PRIVATE (MathConverter, math_converter, GTK_TYPE_BOX);
static void display_changed_cb(MathEquation *equation, GParamSpec *spec, MathConverter *converter);
static void update_from_model(MathConverter *converter);
-
MathConverter *
math_converter_new(MathEquation *equation)
{
@@ -49,7 +47,6 @@ math_converter_new(MathEquation *equation)
return converter;
}
-
static gboolean
convert_equation(MathConverter *converter, const MPNumber *x, MPNumber *z)
{
@@ -77,7 +74,6 @@ convert_equation(MathConverter *converter, const MPNumber *x, MPNumber *z)
return result;
}
-
static void
update_result_label(MathConverter *converter)
{
@@ -116,14 +112,12 @@ update_result_label(MathConverter *converter)
mp_clear(&z);
}
-
static void
display_changed_cb(MathEquation *equation, GParamSpec *spec, MathConverter *converter)
{
update_result_label(converter);
}
-
static void
update_from_model(MathConverter *converter)
{
@@ -169,7 +163,6 @@ update_from_model(MathConverter *converter)
gtk_combo_box_set_model(GTK_COMBO_BOX(converter->priv->from_combo), GTK_TREE_MODEL(from_model));
}
-
void
math_converter_set_category(MathConverter *converter, const gchar *category)
{
@@ -186,7 +179,6 @@ math_converter_set_category(MathConverter *converter, const gchar *category)
update_from_model(converter);
}
-
const gchar *
math_converter_get_category(MathConverter *converter)
{
@@ -194,9 +186,8 @@ math_converter_get_category(MathConverter *converter)
return converter->priv->category;
}
-
static gboolean
-iter_is_unit(GtkTreeModel *model, GtkTreeIter *iter, Unit *unit)
+iter_is_unit(GtkTreeModel *model, GtkTreeIter *iter, const Unit *unit)
{
Unit *u;
@@ -212,7 +203,6 @@ iter_is_unit(GtkTreeModel *model, GtkTreeIter *iter, Unit *unit)
return FALSE;
}
-
static gboolean
set_active_unit(GtkComboBox *combo, GtkTreeIter *iter, Unit *unit)
{
@@ -237,7 +227,6 @@ set_active_unit(GtkComboBox *combo, GtkTreeIter *iter, Unit *unit)
return FALSE;
}
-
void
math_converter_set_conversion(MathConverter *converter, /*const gchar *category,*/ const gchar *unit_a, const gchar *unit_b)
{
@@ -270,7 +259,6 @@ math_converter_set_conversion(MathConverter *converter, /*const gchar *category,
set_active_unit(GTK_COMBO_BOX(converter->priv->to_combo), NULL, ub);
}
-
void
math_converter_get_conversion(MathConverter *converter, Unit **from_unit, Unit **to_unit)
{
@@ -287,7 +275,6 @@ math_converter_get_conversion(MathConverter *converter, Unit **from_unit, Unit *
gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(converter->priv->to_combo)), &to_iter, 2, to_unit, -1);
}
-
static void
math_converter_class_init(MathConverterClass *klass)
{
@@ -301,7 +288,6 @@ math_converter_class_init(MathConverterClass *klass)
G_TYPE_NONE, 0);
}
-
static void
from_combobox_changed_cb(GtkWidget *combo, MathConverter *converter)
{
@@ -334,7 +320,6 @@ from_combobox_changed_cb(GtkWidget *combo, MathConverter *converter)
g_object_unref(unit);
}
-
static void
to_combobox_changed_cb(GtkWidget *combo, MathConverter *converter)
{
@@ -344,7 +329,6 @@ to_combobox_changed_cb(GtkWidget *combo, MathConverter *converter)
g_signal_emit(converter, signals[CHANGED], 0);
}
-
static void
from_cell_data_func(GtkCellLayout *cell_layout,
GtkCellRenderer *cell,
@@ -355,7 +339,6 @@ from_cell_data_func(GtkCellLayout *cell_layout,
g_object_set(cell, "sensitive", !gtk_tree_model_iter_has_child(tree_model, iter), NULL);
}
-
static void
currency_updated_cb(CurrencyManager *manager, MathConverter *converter)
{
diff --git a/src/math-display.c b/src/math-display.c
index 7a24838..b0f3e0e 100644
--- a/src/math-display.c
+++ b/src/math-display.c
@@ -42,21 +42,18 @@ math_display_new()
return g_object_new(math_display_get_type(), "equation", math_equation_new(), NULL);
}
-
MathDisplay *
math_display_new_with_equation(MathEquation *equation)
{
return g_object_new(math_display_get_type(), "equation", equation, NULL);
}
-
MathEquation *
math_display_get_equation(MathDisplay *display)
{
return display->priv->equation;
}
-
static gboolean
display_key_press_cb(GtkWidget *widget, GdkEventKey *event, MathDisplay *display)
{
@@ -294,7 +291,6 @@ display_key_press_cb(GtkWidget *widget, GdkEventKey *event, MathDisplay *display
return FALSE;
}
-
static gboolean
key_press_cb(MathDisplay *display, GdkEventKey *event)
{
@@ -303,7 +299,6 @@ key_press_cb(MathDisplay *display, GdkEventKey *event)
return result;
}
-
static void
status_changed_cb(MathEquation *equation, GParamSpec *spec, MathDisplay *display)
{
@@ -414,7 +409,6 @@ create_gui(MathDisplay *display)
status_changed_cb(display->priv->equation, NULL, display);
}
-
static void
math_display_set_property(GObject *object,
guint prop_id,
@@ -436,7 +430,6 @@ math_display_set_property(GObject *object,
}
}
-
static void
math_display_get_property(GObject *object,
guint prop_id,
@@ -457,7 +450,6 @@ math_display_get_property(GObject *object,
}
}
-
static void
math_display_class_init(MathDisplayClass *klass)
{
@@ -475,7 +467,6 @@ math_display_class_init(MathDisplayClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
-
static void
math_display_init(MathDisplay *display)
{
diff --git a/src/math-equation.c b/src/math-equation.c
index 9b46e73..2ce3ab8 100644
--- a/src/math-equation.c
+++ b/src/math-equation.c
@@ -49,8 +49,6 @@ enum {
static GType number_mode_type, number_format_type, angle_unit_type;
-#define MAX_DIGITS 512
-
/* Expression mode state */
typedef struct {
MPNumber ans; /* Previously calculated answer */
@@ -105,21 +103,18 @@ typedef struct {
G_DEFINE_TYPE_WITH_PRIVATE (MathEquation, math_equation, GTK_TYPE_TEXT_BUFFER);
-
MathEquation *
math_equation_new()
{
return g_object_new(math_equation_get_type(), NULL);
}
-
MathVariables *
math_equation_get_variables(MathEquation *equation)
{
return equation->priv->variables;
}
-
static void
get_ans_offsets(MathEquation *equation, gint *start, gint *end)
{
@@ -136,7 +131,6 @@ get_ans_offsets(MathEquation *equation, gint *start, gint *end)
*end = gtk_text_iter_get_offset(&iter);
}
-
static void
reformat_ans(MathEquation *equation)
{
@@ -175,7 +169,6 @@ reformat_ans(MathEquation *equation)
g_free(ans_text);
}
-
static gint
count_digits(MathEquation *equation, const gchar *text)
{
@@ -202,7 +195,6 @@ count_digits(MathEquation *equation, const gchar *text)
return count;
}
-
static void
reformat_separators(MathEquation *equation)
{
@@ -281,7 +273,6 @@ reformat_separators(MathEquation *equation)
equation->priv->in_undo_operation = FALSE;
}
-
static void
reformat_display(MathEquation *equation)
{
@@ -290,8 +281,9 @@ reformat_display(MathEquation *equation)
/* Add/remove thousands separators */
reformat_separators(equation);
-}
+ g_signal_emit_by_name(equation, "display-changed");
+}
static MathEquationState *
get_current_state(MathEquation *equation)
@@ -324,7 +316,6 @@ get_current_state(MathEquation *equation)
return state;
}
-
static void
free_state(MathEquationState *state)
{
@@ -333,7 +324,6 @@ free_state(MathEquationState *state)
g_free(state);
}
-
static void
math_equation_push_undo_stack(MathEquation *equation)
{
@@ -357,7 +347,6 @@ math_equation_push_undo_stack(MathEquation *equation)
equation->priv->undo_stack = g_list_prepend(equation->priv->undo_stack, state);
}
-
static void
clear_ans(MathEquation *equation, gboolean remove_tag)
{
@@ -378,7 +367,6 @@ clear_ans(MathEquation *equation, gboolean remove_tag)
equation->priv->ans_end = NULL;
}
-
static void
apply_state(MathEquation *equation, MathEquationState *state)
{
@@ -411,7 +399,6 @@ apply_state(MathEquation *equation, MathEquationState *state)
equation->priv->in_undo_operation = FALSE;
}
-
void
math_equation_copy(MathEquation *equation)
{
@@ -428,7 +415,6 @@ math_equation_copy(MathEquation *equation)
g_free(text);
}
-
static void
on_paste(GtkClipboard *clipboard, const gchar *text, gpointer data)
{
@@ -437,7 +423,6 @@ on_paste(GtkClipboard *clipboard, const gchar *text, gpointer data)
math_equation_insert(equation, text);
}
-
void
math_equation_paste(MathEquation *equation)
{
@@ -445,7 +430,6 @@ math_equation_paste(MathEquation *equation)
gtk_clipboard_request_text(gtk_clipboard_get(GDK_NONE), on_paste, equation);
}
-
void
math_equation_undo(MathEquation *equation)
{
@@ -472,7 +456,6 @@ math_equation_undo(MathEquation *equation)
free_state(state);
}
-
void
math_equation_redo(MathEquation *equation)
{
@@ -499,7 +482,6 @@ math_equation_redo(MathEquation *equation)
free_state(state);
}
-
gunichar
math_equation_get_digit_text(MathEquation *equation, guint digit)
{
@@ -509,7 +491,6 @@ math_equation_get_digit_text(MathEquation *equation, guint digit)
return equation->priv->digits[digit];
}
-
void
math_equation_set_accuracy(MathEquation *equation, gint accuracy)
{
@@ -522,7 +503,6 @@ math_equation_set_accuracy(MathEquation *equation, gint accuracy)
g_object_notify(G_OBJECT(equation), "accuracy");
}
-
gint
math_equation_get_accuracy(MathEquation *equation)
{
@@ -531,7 +511,6 @@ math_equation_get_accuracy(MathEquation *equation)
return mp_serializer_get_trailing_digits(equation->priv->serializer);
}
-
void
math_equation_set_show_thousands_separators(MathEquation *equation, gboolean visible)
{
@@ -545,7 +524,6 @@ math_equation_set_show_thousands_separators(MathEquation *equation, gboolean vis
g_object_notify(G_OBJECT(equation), "show-thousands-separators");
}
-
gboolean
math_equation_get_show_thousands_separators(MathEquation *equation)
{
@@ -553,7 +531,6 @@ math_equation_get_show_thousands_separators(MathEquation *equation)
return mp_serializer_get_show_thousands_separators(equation->priv->serializer);
}
-
void
math_equation_set_show_trailing_zeroes(MathEquation *equation, gboolean visible)
{
@@ -567,7 +544,6 @@ math_equation_set_show_trailing_zeroes(MathEquation *equation, gboolean visible)
g_object_notify(G_OBJECT(equation), "show-trailing-zeroes");
}
-
gboolean
math_equation_get_show_trailing_zeroes(MathEquation *equation)
{
@@ -575,7 +551,6 @@ math_equation_get_show_trailing_zeroes(MathEquation *equation)
return mp_serializer_get_show_trailing_zeroes(equation->priv->serializer);
}
-
void
math_equation_set_number_format(MathEquation *equation, MpDisplayFormat format)
{
@@ -589,7 +564,6 @@ math_equation_set_number_format(MathEquation *equation, MpDisplayFormat format)
g_object_notify(G_OBJECT(equation), "number-format");
}
-
MpDisplayFormat
math_equation_get_number_format(MathEquation *equation)
{
@@ -597,7 +571,6 @@ math_equation_get_number_format(MathEquation *equation)
return mp_serializer_get_number_format(equation->priv->serializer);
}
-
void
math_equation_set_base(MathEquation *equation, gint base)
{
@@ -611,7 +584,6 @@ math_equation_set_base(MathEquation *equation, gint base)
g_object_notify(G_OBJECT(equation), "base");
}
-
gint
math_equation_get_base(MathEquation *equation)
{
@@ -619,7 +591,6 @@ math_equation_get_base(MathEquation *equation)
return mp_serializer_get_base(equation->priv->serializer);
}
-
void
math_equation_set_word_size(MathEquation *equation, gint word_size)
{
@@ -632,7 +603,6 @@ math_equation_set_word_size(MathEquation *equation, gint word_size)
g_object_notify(G_OBJECT(equation), "word-size");
}
-
gint
math_equation_get_word_size(MathEquation *equation)
{
@@ -640,7 +610,6 @@ math_equation_get_word_size(MathEquation *equation)
return equation->priv->word_size;
}
-
void
math_equation_set_angle_units(MathEquation *equation, MPAngleUnit angle_units)
{
@@ -653,7 +622,6 @@ math_equation_set_angle_units(MathEquation *equation, MPAngleUnit angle_units)
g_object_notify(G_OBJECT(equation), "angle-units");
}
-
MPAngleUnit
math_equation_get_angle_units(MathEquation *equation)
{
@@ -661,7 +629,6 @@ math_equation_get_angle_units(MathEquation *equation)
return equation->priv->angle_units;
}
-
void
math_equation_set_source_currency(MathEquation *equation, const gchar *currency)
{
@@ -676,7 +643,6 @@ math_equation_set_source_currency(MathEquation *equation, const gchar *currency)
math_equation_get_source_currency(equation));
}
-
const gchar *
math_equation_get_source_currency(MathEquation *equation)
{
@@ -684,7 +650,6 @@ math_equation_get_source_currency(MathEquation *equation)
return equation->priv->source_currency;
}
-
void
math_equation_set_target_currency(MathEquation *equation, const gchar *currency)
{
@@ -699,7 +664,6 @@ math_equation_set_target_currency(MathEquation *equation, const gchar *currency)
math_equation_get_target_currency(equation));
}
-
const gchar *
math_equation_get_target_currency(MathEquation *equation)
{
@@ -707,7 +671,6 @@ math_equation_get_target_currency(MathEquation *equation)
return equation->priv->target_currency;
}
-
void
math_equation_set_source_units(MathEquation *equation, const gchar *units)
{
@@ -730,7 +693,6 @@ math_equation_get_source_units(MathEquation *equation)
return equation->priv->source_units;
}
-
void
math_equation_set_target_units(MathEquation *equation, const gchar *units)
{
@@ -746,7 +708,6 @@ math_equation_set_target_units(MathEquation *equation, const gchar *units)
math_equation_get_target_units(equation));
}
-
const gchar *
math_equation_get_target_units(MathEquation *equation)
{
@@ -754,7 +715,6 @@ math_equation_get_target_units(MathEquation *equation)
return equation->priv->target_units;
}
-
void
math_equation_set_status(MathEquation *equation, const gchar *status)
{
@@ -769,7 +729,6 @@ math_equation_set_status(MathEquation *equation, const gchar *status)
g_object_notify(G_OBJECT(equation), "status");
}
-
const gchar *
math_equation_get_status(MathEquation *equation)
{
@@ -777,7 +736,6 @@ math_equation_get_status(MathEquation *equation)
return equation->priv->state.status;
}
-
gboolean
math_equation_is_empty(MathEquation *equation)
{
@@ -785,7 +743,6 @@ math_equation_is_empty(MathEquation *equation)
return gtk_text_buffer_get_char_count(GTK_TEXT_BUFFER(equation)) == 0;
}
-
gboolean
math_equation_is_result(MathEquation *equation)
{
@@ -801,7 +758,6 @@ math_equation_is_result(MathEquation *equation)
return result;
}
-
gchar *
math_equation_get_display(MathEquation *equation)
{
@@ -813,7 +769,6 @@ math_equation_get_display(MathEquation *equation)
return gtk_text_buffer_get_text(GTK_TEXT_BUFFER(equation), &start, &end, FALSE);
}
-
gchar *
math_equation_get_equation(MathEquation *equation)
{
@@ -867,7 +822,6 @@ math_equation_get_equation(MathEquation *equation)
return text;
}
-
gboolean
math_equation_get_number(MathEquation *equation, MPNumber *z)
{
@@ -889,7 +843,6 @@ math_equation_get_number(MathEquation *equation, MPNumber *z)
}
}
-
MpSerializer *
math_equation_get_serializer(MathEquation *equation)
{
@@ -897,7 +850,6 @@ math_equation_get_serializer(MathEquation *equation)
return equation->priv->serializer;
}
-
void
math_equation_set_number_mode(MathEquation *equation, NumberMode mode)
{
@@ -912,7 +864,6 @@ math_equation_set_number_mode(MathEquation *equation, NumberMode mode)
g_object_notify(G_OBJECT(equation), "number-mode");
}
-
NumberMode
math_equation_get_number_mode(MathEquation *equation)
{
@@ -920,7 +871,6 @@ math_equation_get_number_mode(MathEquation *equation)
return equation->priv->number_mode;
}
-
gboolean
math_equation_in_solve(MathEquation *equation)
{
@@ -928,7 +878,6 @@ math_equation_in_solve(MathEquation *equation)
return equation->priv->in_solve;
}
-
const MPNumber *
math_equation_get_answer(MathEquation *equation)
{
@@ -936,7 +885,6 @@ math_equation_get_answer(MathEquation *equation)
return &equation->priv->state.ans;
}
-
void
math_equation_store(MathEquation *equation, const gchar *name)
{
@@ -952,7 +900,6 @@ math_equation_store(MathEquation *equation, const gchar *name)
mp_clear(&t);
}
-
void
math_equation_recall(MathEquation *equation, const gchar *name)
{
@@ -961,7 +908,6 @@ math_equation_recall(MathEquation *equation, const gchar *name)
math_equation_insert(equation, name);
}
-
void
math_equation_set(MathEquation *equation, const gchar *text)
{
@@ -971,6 +917,22 @@ math_equation_set(MathEquation *equation, const gchar *text)
clear_ans(equation, FALSE);
}
+static void
+math_equation_set_with_history(MathEquation *equation, const gchar *text)
+{
+ MathEquationState *state;
+ MPNumber x = mp_new();
+
+ math_equation_get_number(equation, &x);
+ math_equation_set(equation, text);
+
+ /* Notify history */
+ state = get_current_state(equation);
+ g_signal_emit_by_name(equation, "history", state->expression, &x);
+
+ free_state(state);
+ mp_clear(&x);
+}
void
math_equation_set_number(MathEquation *equation, const MPNumber *x)
@@ -984,7 +946,7 @@ math_equation_set_number(MathEquation *equation, const MPNumber *x)
/* Notify history */
state = get_current_state(equation);
- g_signal_emit_by_name(equation, "history", state->expression, x, mp_serializer_get_base(equation->priv->serializer));
+ g_signal_emit_by_name(equation, "history", state->expression, x);
/* Show the number in the user chosen format */
text = mp_serializer_to_string(equation->priv->serializer, x);
@@ -1004,7 +966,6 @@ math_equation_set_number(MathEquation *equation, const MPNumber *x)
free_state(state);
}
-
void
math_equation_insert(MathEquation *equation, const gchar *text)
{
@@ -1034,7 +995,6 @@ math_equation_insert(MathEquation *equation, const gchar *text)
gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(equation), text, -1);
}
-
void
math_equation_insert_digit(MathEquation *equation, guint digit)
{
@@ -1057,7 +1017,6 @@ math_equation_insert_digit(MathEquation *equation, guint digit)
math_equation_insert(equation, subscript_digits[digit]);
}
-
void
math_equation_insert_numeric_point(MathEquation *equation)
{
@@ -1071,7 +1030,6 @@ math_equation_insert_numeric_point(MathEquation *equation)
math_equation_insert(equation, buffer);
}
-
void
math_equation_insert_number(MathEquation *equation, const MPNumber *x)
{
@@ -1085,7 +1043,6 @@ math_equation_insert_number(MathEquation *equation, const MPNumber *x)
g_free(text);
}
-
void
math_equation_insert_exponent(MathEquation *equation)
{
@@ -1094,7 +1051,6 @@ math_equation_insert_exponent(MathEquation *equation)
math_equation_set_number_mode(equation, SUPERSCRIPT);
}
-
void
math_equation_insert_subtract(MathEquation *equation)
{
@@ -1109,7 +1065,6 @@ math_equation_insert_subtract(MathEquation *equation)
}
}
-
static int
variable_is_defined(const char *name, void *data)
{
@@ -1130,7 +1085,6 @@ variable_is_defined(const char *name, void *data)
return math_variables_get(equation->priv->variables, name) != NULL;
}
-
static int
get_variable(const char *name, MPNumber *z, void *data)
{
@@ -1159,7 +1113,6 @@ get_variable(const char *name, MPNumber *z, void *data)
return result;
}
-
static void
set_variable(const char *name, const MPNumber *x, void *data)
{
@@ -1168,14 +1121,12 @@ set_variable(const char *name, const MPNumber *x, void *data)
math_variables_set(equation->priv->variables, name, x);
}
-
static int
convert(const MPNumber *x, const char *x_units, const char *z_units, MPNumber *z, void *data)
{
return unit_manager_convert_by_symbol(unit_manager_get_default(), x, x_units, z_units, z);
}
-
static int
parse(MathEquation *equation, const char *text, MPNumber *z, char **error_token)
{
@@ -1194,7 +1145,6 @@ parse(MathEquation *equation, const char *text, MPNumber *z, char **error_token)
return mp_equation_parse(text, &options, z, error_token);
}
-
/*
* Executed in separate thread. It is thus not a good idea to write to anything
* in MathEquation but the async queue from here.
@@ -1225,7 +1175,6 @@ math_equation_solve_real(gpointer data)
n_brackets--;
}
-
result = parse(equation, equation_text->str, &z, &error_token);
g_string_free(equation_text, TRUE);
@@ -1278,7 +1227,6 @@ math_equation_solve_real(gpointer data)
return NULL;
}
-
static gboolean
math_equation_show_in_progress(gpointer data)
{
@@ -1288,7 +1236,6 @@ math_equation_show_in_progress(gpointer data)
return false;
}
-
static gboolean
math_equation_look_for_answer(gpointer data)
{
@@ -1313,7 +1260,7 @@ math_equation_look_for_answer(gpointer data)
g_slice_free(MPNumber, result->number_result);
}
else if (result->text_result != NULL) {
- math_equation_set(equation, result->text_result);
+ math_equation_set_with_history(equation, result->text_result);
g_free(result->text_result);
}
g_slice_free(SolveData, result);
@@ -1321,7 +1268,6 @@ math_equation_look_for_answer(gpointer data)
return false;
}
-
void
math_equation_solve(MathEquation *equation)
{
@@ -1350,30 +1296,48 @@ math_equation_solve(MathEquation *equation)
g_timeout_add(100, math_equation_show_in_progress, equation);
}
-
static gpointer
math_equation_factorize_real(gpointer data)
{
GString *text;
- GList *factors, *factor;
+ GList *factors, *factor, *next_factor;
MPNumber x = mp_new();
MathEquation *equation = MATH_EQUATION(data);
SolveData *result = g_slice_new0(SolveData);
+ MpDisplayFormat format = mp_serializer_get_number_format(equation->priv->serializer);
+ mp_serializer_set_number_format(equation->priv->serializer, MP_DISPLAY_FORMAT_FIXED);
math_equation_get_number(equation, &x);
factors = mp_factorize(&x);
text = g_string_new("");
- for (factor = factors; factor; factor = factor->next) {
+ int e = 1;
+ for (factor = factors; factor != NULL; factor = factor->next)
+ {
gchar *temp;
MPNumber *n;
n = factor->data;
+ next_factor = factor->next;
+ if (next_factor != NULL && mp_compare(n, next_factor->data) == 0)
+ {
+ e++;
+ continue;
+ }
temp = mp_serializer_to_string(equation->priv->serializer, n);
g_string_append(text, temp);
+
+ if (e > 1)
+ {
+ g_string_append(text, "^");
+ g_string_append_printf(text, "%d", e);
+ }
if (factor->next)
- g_string_append(text, "×");
+ g_string_append(text, " × ");
+
+ e = 1;
+
mp_clear(n);
g_slice_free(MPNumber, n);
g_free(temp);
@@ -1385,10 +1349,11 @@ math_equation_factorize_real(gpointer data)
g_string_free(text, TRUE);
mp_clear(&x);
+ mp_serializer_set_number_format(equation->priv->serializer, format);
+
return NULL;
}
-
void
math_equation_factorize(MathEquation *equation)
{
@@ -1415,7 +1380,6 @@ math_equation_factorize(MathEquation *equation)
g_timeout_add(100, math_equation_show_in_progress, equation);
}
-
void
math_equation_delete(MathEquation *equation)
{
@@ -1433,7 +1397,6 @@ math_equation_delete(MathEquation *equation)
gtk_text_buffer_delete(GTK_TEXT_BUFFER(equation), &start, &end);
}
-
void
math_equation_backspace(MathEquation *equation)
{
@@ -1452,7 +1415,6 @@ math_equation_backspace(MathEquation *equation)
}
}
-
void
math_equation_clear(MathEquation *equation)
{
@@ -1463,7 +1425,6 @@ math_equation_clear(MathEquation *equation)
clear_ans(equation, FALSE);
}
-
void
math_equation_shift(MathEquation *equation, gint count)
{
@@ -1484,7 +1445,6 @@ math_equation_shift(MathEquation *equation, gint count)
mp_clear(&z);
}
-
void
math_equation_toggle_bit(MathEquation *equation, guint bit)
{
@@ -1522,7 +1482,6 @@ math_equation_toggle_bit(MathEquation *equation, guint bit)
mp_clear(&x);
}
-
static void
math_equation_set_property(GObject *object,
guint prop_id,
@@ -1582,7 +1541,6 @@ math_equation_set_property(GObject *object,
}
}
-
static void
math_equation_get_property(GObject *object,
guint prop_id,
@@ -1653,7 +1611,6 @@ math_equation_get_property(GObject *object,
}
}
-
static void
math_equation_constructed(GObject *object)
{
@@ -1665,7 +1622,6 @@ math_equation_constructed(GObject *object)
MATH_EQUATION(object)->priv->ans_tag = gtk_text_buffer_create_tag(GTK_TEXT_BUFFER(object), NULL, "weight", PANGO_WEIGHT_BOLD, NULL);
}
-
static void
math_equation_class_init(MathEquationClass *klass)
{
@@ -1809,7 +1765,7 @@ math_equation_class_init(MathEquationClass *klass)
MP_TYPE_SERIALIZER,
G_PARAM_READABLE));
- GType param_types[3] = {G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT};
+ GType param_types[2] = {G_TYPE_STRING, G_TYPE_POINTER};
g_signal_newv("history",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
@@ -1818,10 +1774,20 @@ math_equation_class_init(MathEquationClass *klass)
NULL,
NULL,
G_TYPE_NONE,
- 3,
+ 2,
param_types);
-}
+ g_signal_new ("display-changed",
+ G_TYPE_FROM_CLASS(klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ NULL,
+ G_TYPE_NONE,
+ 0,
+ NULL);
+}
static void
pre_insert_text_cb(MathEquation *equation,
@@ -1865,7 +1831,6 @@ pre_insert_text_cb(MathEquation *equation,
}
}
-
static gboolean
on_delete(MathEquation *equation)
{
@@ -1873,7 +1838,6 @@ on_delete(MathEquation *equation)
return FALSE;
}
-
static void
pre_delete_range_cb(MathEquation *equation,
GtkTextIter *start,
@@ -1902,7 +1866,6 @@ pre_delete_range_cb(MathEquation *equation,
}
}
-
static void
insert_text_cb(MathEquation *equation,
GtkTextIter *location,
@@ -1921,7 +1884,6 @@ insert_text_cb(MathEquation *equation,
g_object_notify(G_OBJECT(equation), "display");
}
-
static void
delete_range_cb(MathEquation *equation,
GtkTextIter *start,
@@ -1940,7 +1902,6 @@ delete_range_cb(MathEquation *equation,
g_object_notify(G_OBJECT(equation), "display");
}
-
static void
math_equation_init(MathEquation *equation)
{
diff --git a/src/math-history-entry.c b/src/math-history-entry.c
index 8277f88..5557e4b 100644
--- a/src/math-history-entry.c
+++ b/src/math-history-entry.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 MATE developers
+ * Copyright (C) 2020-2021 MATE developers
*
* 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
@@ -20,6 +20,7 @@ struct MathHistoryEntryPrivate
{
MathEquation *equation;
+ MPNumber *number;
GtkWidget *equation_label;
GtkWidget *answer_label;
};
@@ -59,33 +60,39 @@ equation_clicked_cb (GtkWidget *widget, GdkEventButton *eventbutton, MathHistory
}
void
-math_history_entry_insert_entry(MathHistoryEntry *history_entry, const gchar *equation, const gchar *answer_four_digits, const gchar *answer_nine_digits)
+math_history_entry_insert_entry(MathHistoryEntry *history_entry, const gchar *equation, MPNumber *answer, MpSerializer *serializer)
{
#define get_widget(x) GTK_WIDGET(gtk_builder_get_object(builder, x))
- GtkBuilder *builder = NULL;
+ GtkBuilder *builder;
GtkWidget *grid;
- GError *error = NULL;
-
- builder = gtk_builder_new();
- if(gtk_builder_add_from_resource (builder, UI_HISTORY_ENTRY_RESOURCE_PATH, &error) == 0)
- {
- g_warning("Error loading history-entry UI: %s", error->message);
- g_clear_error(&error);
- return;
- }
+
+ mp_set_from_mp(answer, history_entry->priv->number);
+
+ builder = gtk_builder_new_from_resource(UI_HISTORY_ENTRY_RESOURCE_PATH);
grid = get_widget("grid");
gtk_container_add(GTK_CONTAINER(history_entry), grid);
history_entry->priv->equation_label = get_widget("equation_label");
history_entry->priv->answer_label = get_widget("answer_label");
gtk_widget_set_tooltip_text(history_entry->priv->equation_label, equation);
- gtk_widget_set_tooltip_text(history_entry->priv->answer_label, answer_nine_digits);
gtk_label_set_text(GTK_LABEL(history_entry->priv->equation_label), equation);
- gtk_label_set_text(GTK_LABEL(history_entry->priv->answer_label), answer_four_digits);
gtk_builder_connect_signals(builder, history_entry);
g_object_unref(builder);
#undef get_widget
+
+ math_history_entry_redisplay(history_entry, serializer);
+}
+
+void
+math_history_entry_redisplay(MathHistoryEntry *history_entry, MpSerializer *serializer)
+{
+ gchar *answer = mp_serializer_to_string(serializer, history_entry->priv->number);
+
+ gtk_widget_set_tooltip_text(history_entry->priv->answer_label, answer);
+ gtk_label_set_text(GTK_LABEL(history_entry->priv->answer_label), answer);
+
+ g_free(answer);
}
gchar *
@@ -95,12 +102,26 @@ math_history_entry_get_equation(MathHistoryEntry *history_entry)
}
static void
+math_history_entry_finalize(GObject *object)
+{
+ MathHistoryEntry *self = MATH_HISTORY_ENTRY (object);
+
+ mp_free(self->priv->number);
+
+ G_OBJECT_CLASS (math_history_entry_parent_class)->finalize (object);
+}
+
+static void
math_history_entry_class_init(MathHistoryEntryClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+ object_class->finalize = math_history_entry_finalize;
}
static void
math_history_entry_init(MathHistoryEntry *history_entry)
{
history_entry->priv = math_history_entry_get_instance_private(history_entry);
+ history_entry->priv->number = mp_new_ptr();
}
diff --git a/src/math-history-entry.h b/src/math-history-entry.h
index 2133ade..4a9261e 100644
--- a/src/math-history-entry.h
+++ b/src/math-history-entry.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 MATE developers
+ * Copyright (C) 2020-2021 MATE developers
*
* 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
@@ -42,7 +42,10 @@ MathHistoryEntry *
math_history_entry_new(MathEquation *equation);
void
-math_history_entry_insert_entry(MathHistoryEntry *history_entry, const gchar *equation, const gchar *answer_four_digits, const gchar *answer_nine_digits);
+math_history_entry_insert_entry(MathHistoryEntry *history_entry, const gchar *equation, MPNumber *answer, MpSerializer *serializer);
+
+void
+math_history_entry_redisplay(MathHistoryEntry *history_entry, MpSerializer *serializer);
gchar *
math_history_entry_get_equation(MathHistoryEntry *history_entry);
diff --git a/src/math-history.c b/src/math-history.c
index 403a04f..b547371 100644
--- a/src/math-history.c
+++ b/src/math-history.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 MATE developers
+ * Copyright (C) 2020-2021 MATE developers
*
* 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
@@ -20,7 +20,7 @@ struct MathHistoryPrivate
{
MathEquation *equation;
- gchar *last_answer;
+ MpSerializer *serializer;
gchar *last_equation;
int current; /* 0 is the first entry, rows-1 the most recent entry */
int rows;
@@ -52,42 +52,27 @@ scroll_bottom_cb(MathHistory *history, gpointer data)
}
void
-math_history_insert_entry (MathHistory *history, char *equation, MPNumber *answer, int number_base)
+math_history_insert_entry (MathHistory *history, char *equation, MPNumber *answer)
{
- MathHistoryEntry *entry = math_history_entry_new(history->priv->equation);
-
- MpSerializer *serializer_four = mp_serializer_new(MP_DISPLAY_FORMAT_AUTOMATIC, number_base, 4);
- MpSerializer *serializer_nine = mp_serializer_new(MP_DISPLAY_FORMAT_AUTOMATIC, number_base, 9);
-
- gchar *answer_four_digits = mp_serializer_to_string(serializer_four, answer);
- gchar *answer_nine_digits = mp_serializer_to_string(serializer_nine, answer);
-
- if (g_strcmp0(history->priv->last_answer, answer_nine_digits) == 0 &&
- g_strcmp0(history->priv->last_equation, equation) == 0 &&
- history->priv->rows >= 1)
+ if (g_strcmp0(history->priv->last_equation, equation) == 0 && history->priv->rows >= 1)
{
- g_free(answer_four_digits);
- g_free(answer_nine_digits);
return;
}
- math_history_entry_insert_entry(entry, equation, answer_four_digits, answer_nine_digits);
+ MathHistoryEntry *entry = math_history_entry_new(history->priv->equation);
+
+ math_history_entry_insert_entry(entry, equation, answer, history->priv->serializer);
gtk_list_box_insert(GTK_LIST_BOX(history->priv->listbox), GTK_WIDGET(entry), -1);
gtk_widget_set_can_focus(GTK_WIDGET(entry), FALSE);
gtk_widget_show(GTK_WIDGET(entry));
- g_free(history->priv->last_answer);
g_free(history->priv->last_equation);
- history->priv->last_answer = g_strdup(answer_nine_digits);
history->priv->last_equation = g_strdup(equation);
history->priv->rows++;
history->priv->current = history->priv->rows;
g_signal_emit_by_name(history, "row-added");
-
- g_free(answer_four_digits);
- g_free(answer_nine_digits);
}
void
@@ -123,6 +108,18 @@ math_history_get_current(MathHistory *history)
return history->priv->current;
}
+void
+math_history_set_serializer(MathHistory *history, MpSerializer *serializer)
+{
+ history->priv->serializer = serializer;
+
+ GList *children, *iter;
+ children = gtk_container_get_children(GTK_CONTAINER(history->priv->listbox));
+ for (iter = children; iter != NULL; iter = g_list_next(iter))
+ math_history_entry_redisplay(MATH_HISTORY_ENTRY(iter->data), serializer);
+ g_list_free(children);
+}
+
static void
math_history_class_init(MathHistoryClass *klass)
{
@@ -147,9 +144,9 @@ math_history_init(MathHistory *history)
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(history), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(history), GTK_CORNER_TOP_LEFT);
+ history->priv->serializer = NULL;
history->priv->current = 0;
history->priv->rows = 0;
- history->priv->last_answer = g_strdup("");
history->priv->last_equation = g_strdup("");
history->priv->listbox = gtk_list_box_new();
diff --git a/src/math-history.h b/src/math-history.h
index 87dab7a..17088d6 100644
--- a/src/math-history.h
+++ b/src/math-history.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 MATE developers
+ * Copyright (C) 2020-2021 MATE developers
*
* 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
@@ -43,7 +43,7 @@ MathHistory *
math_history_new(MathEquation *equation);
void
-math_history_insert_entry(MathHistory *history, char *equation, MPNumber *answer, int number_base);
+math_history_insert_entry(MathHistory *history, char *equation, MPNumber *answer);
gpointer
math_history_get_entry_at(MathHistory *history, int index);
@@ -57,6 +57,9 @@ math_history_get_current(MathHistory *history);
void
math_history_clear(MathHistory *history);
+void
+math_history_set_serializer(MathHistory *history, MpSerializer *serializer);
+
G_END_DECLS
#endif /* MATH_HISTORY_VIEW_H */
diff --git a/src/math-preferences.c b/src/math-preferences.c
index 33565d9..41e43a6 100644
--- a/src/math-preferences.c
+++ b/src/math-preferences.c
@@ -14,7 +14,6 @@
#include "math-preferences.h"
#include "utility.h"
-
enum {
PROP_0,
PROP_EQUATION
@@ -32,21 +31,18 @@ G_DEFINE_TYPE_WITH_PRIVATE (MathPreferencesDialog, math_preferences, GTK_TYPE_DI
#define GET_WIDGET(ui, name) \
GTK_WIDGET(gtk_builder_get_object(ui, name))
-
MathPreferencesDialog *
math_preferences_dialog_new(MathEquation *equation)
{
return g_object_new(math_preferences_get_type(), "equation", equation, NULL);
}
-
static void
preferences_response_cb(GtkWidget *widget, gint id)
{
gtk_widget_hide(widget);
}
-
static gboolean
preferences_dialog_delete_cb(GtkWidget *widget, GdkEvent *event)
{
@@ -54,7 +50,6 @@ preferences_dialog_delete_cb(GtkWidget *widget, GdkEvent *event)
return TRUE;
}
-
void number_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog);
G_MODULE_EXPORT
void
@@ -70,7 +65,6 @@ number_format_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialo
math_equation_set_number_format(dialog->priv->equation, value);
}
-
void angle_unit_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog);
G_MODULE_EXPORT
void
@@ -86,7 +80,6 @@ angle_unit_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
math_equation_set_angle_units(dialog->priv->equation, value);
}
-
void word_size_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog);
G_MODULE_EXPORT
void
@@ -102,7 +95,6 @@ word_size_combobox_changed_cb(GtkWidget *combo, MathPreferencesDialog *dialog)
math_equation_set_word_size(dialog->priv->equation, value);
}
-
void decimal_places_spin_change_value_cb(GtkWidget *spin, MathPreferencesDialog *dialog);
G_MODULE_EXPORT
void
@@ -114,7 +106,6 @@ decimal_places_spin_change_value_cb(GtkWidget *spin, MathPreferencesDialog *dial
math_equation_set_accuracy(dialog->priv->equation, value);
}
-
void thousands_separator_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog);
G_MODULE_EXPORT
void
@@ -126,7 +117,6 @@ thousands_separator_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *di
math_equation_set_show_thousands_separators(dialog->priv->equation, value);
}
-
void trailing_zeroes_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog);
G_MODULE_EXPORT
void
@@ -138,7 +128,6 @@ trailing_zeroes_check_toggled_cb(GtkWidget *check, MathPreferencesDialog *dialog
math_equation_set_show_trailing_zeroes(dialog->priv->equation, value);
}
-
static void
set_combo_box_from_int(GtkWidget *combo, int value)
{
@@ -163,7 +152,6 @@ set_combo_box_from_int(GtkWidget *combo, int value)
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter);
}
-
static void
accuracy_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
{
@@ -172,7 +160,6 @@ accuracy_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dia
g_settings_set_int(g_settings_var, "accuracy", math_equation_get_accuracy(equation));
}
-
static void
show_thousands_separators_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
{
@@ -181,7 +168,6 @@ show_thousands_separators_cb(MathEquation *equation, GParamSpec *spec, MathPrefe
g_settings_set_boolean(g_settings_var, "show-thousands", math_equation_get_show_thousands_separators(equation));
}
-
static void
show_trailing_zeroes_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
{
@@ -190,7 +176,6 @@ show_trailing_zeroes_cb(MathEquation *equation, GParamSpec *spec, MathPreference
g_settings_set_boolean(g_settings_var, "show-zeroes", math_equation_get_show_trailing_zeroes(equation));
}
-
static void
number_format_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
{
@@ -198,7 +183,6 @@ number_format_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog
g_settings_set_enum(g_settings_var, "number-format", math_equation_get_number_format(equation));
}
-
static void
word_size_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
{
@@ -206,7 +190,6 @@ word_size_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *di
g_settings_set_int(g_settings_var, "word-size", math_equation_get_word_size(equation));
}
-
static void
angle_unit_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *dialog)
{
@@ -214,7 +197,6 @@ angle_unit_cb(MathEquation *equation, GParamSpec *spec, MathPreferencesDialog *d
g_settings_set_enum(g_settings_var, "angle-units", math_equation_get_angle_units(equation));
}
-
static void
create_gui(MathPreferencesDialog *dialog)
{
@@ -335,7 +317,6 @@ create_gui(MathPreferencesDialog *dialog)
angle_unit_cb(dialog->priv->equation, NULL, dialog);
}
-
static void
math_preferences_set_property(GObject *object,
guint prop_id,
@@ -357,7 +338,6 @@ math_preferences_set_property(GObject *object,
}
}
-
static void
math_preferences_get_property(GObject *object,
guint prop_id,
@@ -378,7 +358,6 @@ math_preferences_get_property(GObject *object,
}
}
-
static void
math_preferences_class_init(MathPreferencesDialogClass *klass)
{
@@ -396,7 +375,6 @@ math_preferences_class_init(MathPreferencesDialogClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
-
static void
math_preferences_init(MathPreferencesDialog *dialog)
{
diff --git a/src/math-variable-popup.c b/src/math-variable-popup.c
index 26bc4f5..0a78455 100644
--- a/src/math-variable-popup.c
+++ b/src/math-variable-popup.c
@@ -35,14 +35,12 @@ math_variable_popup_new(MathEquation *equation)
return g_object_new(math_variable_popup_get_type(), "equation", equation, NULL);
}
-
static void
variable_focus_out_event_cb(GtkWidget *widget, GdkEventFocus *event, MathVariablePopup *popup)
{
gtk_widget_destroy(widget);
}
-
static void
insert_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
{
@@ -54,7 +52,6 @@ insert_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
gtk_widget_destroy(gtk_widget_get_toplevel(widget));
}
-
static gboolean
variable_name_key_press_cb(GtkWidget *widget, GdkEventKey *event, MathVariablePopup *popup)
{
@@ -65,7 +62,6 @@ variable_name_key_press_cb(GtkWidget *widget, GdkEventKey *event, MathVariablePo
return FALSE;
}
-
static void
variable_name_changed_cb(GtkWidget *widget, MathVariablePopup *popup)
{
@@ -73,7 +69,6 @@ variable_name_changed_cb(GtkWidget *widget, MathVariablePopup *popup)
gtk_widget_set_sensitive(popup->priv->add_variable_button, text[0] != '\0');
}
-
static void
add_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
{
@@ -95,7 +90,6 @@ add_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
mp_clear(&z);
}
-
static void
save_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
{
@@ -114,7 +108,6 @@ save_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
mp_clear(&z);
}
-
static void
delete_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
{
@@ -126,7 +119,6 @@ delete_variable_cb(GtkWidget *widget, MathVariablePopup *popup)
gtk_widget_destroy(gtk_widget_get_toplevel(widget));
}
-
static GtkWidget *
make_variable_entry(MathVariablePopup *popup, const gchar *name, const MPNumber *value, gboolean writable)
{
@@ -184,7 +176,6 @@ make_variable_entry(MathVariablePopup *popup, const gchar *name, const MPNumber
return hbox;
}
-
static void
math_variable_popup_set_property(GObject *object,
guint prop_id,
@@ -248,7 +239,6 @@ math_variable_popup_set_property(GObject *object,
}
}
-
static void
math_variable_popup_get_property(GObject *object,
guint prop_id,
@@ -269,7 +259,6 @@ math_variable_popup_get_property(GObject *object,
}
}
-
static void
math_variable_popup_class_init(MathVariablePopupClass *klass)
{
@@ -287,7 +276,6 @@ math_variable_popup_class_init(MathVariablePopupClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
-
static void
math_variable_popup_init(MathVariablePopup *popup)
{
diff --git a/src/math-variables.c b/src/math-variables.c
index b44b387..3eddc4d 100644
--- a/src/math-variables.c
+++ b/src/math-variables.c
@@ -14,7 +14,6 @@
#include "math-variables.h"
#include "mp-serializer.h"
-
struct MathVariablesPrivate
{
gchar *file_name;
@@ -24,14 +23,12 @@ struct MathVariablesPrivate
G_DEFINE_TYPE_WITH_PRIVATE (MathVariables, math_variables, G_TYPE_OBJECT);
-
MathVariables *
math_variables_new()
{
return g_object_new (math_variables_get_type(), NULL);
}
-
static void
registers_load(MathVariables *variables)
{
@@ -71,7 +68,6 @@ registers_load(MathVariables *variables)
fclose(f);
}
-
static void
registers_save(MathVariables *variables)
{
@@ -102,7 +98,6 @@ registers_save(MathVariables *variables)
fclose(f);
}
-
// FIXME: Sort
gchar **
math_variables_get_names(MathVariables *variables)
@@ -128,7 +123,6 @@ math_variables_get_names(MathVariables *variables)
return names;
}
-
void
math_variables_set(MathVariables *variables, const char *name, const MPNumber *value)
{
@@ -145,7 +139,6 @@ math_variables_set(MathVariables *variables, const char *name, const MPNumber *v
registers_save(variables);
}
-
MPNumber *
math_variables_get(MathVariables *variables, const char *name)
{
@@ -154,7 +147,6 @@ math_variables_get(MathVariables *variables, const char *name)
return g_hash_table_lookup(variables->priv->registers, name);
}
-
void
math_variables_delete(MathVariables *variables, const char *name)
{
@@ -164,13 +156,11 @@ math_variables_delete(MathVariables *variables, const char *name)
registers_save(variables);
}
-
static void
math_variables_class_init (MathVariablesClass *klass)
{
}
-
static void
math_variables_init(MathVariables *variables)
{
diff --git a/src/math-window.c b/src/math-window.c
index e872f4f..320f83b 100644
--- a/src/math-window.c
+++ b/src/math-window.c
@@ -9,6 +9,10 @@
* license.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -82,7 +86,6 @@ math_window_get_equation(MathWindow *window)
return window->priv->equation;
}
-
MathDisplay *
math_window_get_display(MathWindow *window)
{
@@ -90,7 +93,6 @@ math_window_get_display(MathWindow *window)
return window->priv->display;
}
-
MathButtons *
math_window_get_buttons(MathWindow *window)
{
@@ -365,14 +367,14 @@ static void about_cb(GtkWidget* widget, MathWindow* window)
"version", VERSION,
"title", _("About MATE Calculator"),
"copyright", _("Copyright \xc2\xa9 1986–2010 The GCalctool authors\n"
- "Copyright \xc2\xa9 2011-2020 MATE developers"),
+ "Copyright \xc2\xa9 2011-2021 MATE developers"),
"license", license_trans,
"comments", comments,
"authors", authors,
"documenters", documenters,
"translator_credits", _("translator-credits"),
"wrap-license", TRUE,
- "website", "http://mate-desktop.org",
+ "website", PACKAGE_URL,
"icon-name", "accessories-calculator",
"logo-icon-name", "accessories-calculator",
NULL);
@@ -389,7 +391,6 @@ scroll_changed_cb(GtkAdjustment *adjustment, MathWindow *window)
gtk_adjustment_set_value(adjustment, gtk_adjustment_get_upper(adjustment) - gtk_adjustment_get_page_size(adjustment));
}
-
static void
scroll_value_changed_cb(GtkAdjustment *adjustment, MathWindow *window)
{
@@ -440,10 +441,17 @@ static GtkWidget *add_menu(GtkWidget *menu_bar, const gchar *name)
}
static void
-update_history_cb (MathEquation *equation, char *answer, MPNumber *number, int number_base, gpointer data)
+update_history_cb (MathEquation *equation, char *equation_string, MPNumber *answer, MathWindow *window)
{ /* Recieves signal emitted by a MathEquation object for updating history */
- MathWindow *window = MATH_WINDOW(data);
- math_history_insert_entry (window->priv->history, answer, number, number_base); /* Sends current equation and answer for updating History-View */
+ math_history_insert_entry (window->priv->history, equation_string, answer); /* Sends current equation string and answer for updating History-View */
+}
+
+static void
+history_set_serializer_cb(MathEquation *equation, MathWindow *window)
+{
+ MpSerializer *serializer = math_equation_get_serializer(equation);
+
+ math_history_set_serializer(window->priv->history, serializer);
}
static void quit_cb(GtkWidget* widget, MathWindow* window)
@@ -595,6 +603,8 @@ create_gui(MathWindow *window)
g_signal_connect(window->priv->equation, "history", G_CALLBACK(update_history_cb), window);
g_signal_connect(window, "notify::show-history", G_CALLBACK(show_history_cb), NULL);
show_history_cb(window, NULL);
+ g_signal_connect(window->priv->equation, "display-changed", G_CALLBACK(history_set_serializer_cb), window);
+ history_set_serializer_cb(window->priv->equation, window);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(window->priv->history), TRUE, TRUE, 0);
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
@@ -617,7 +627,6 @@ create_gui(MathWindow *window)
gtk_widget_show(GTK_WIDGET(window->priv->buttons));
}
-
static void
math_window_set_property(GObject *object,
guint prop_id,
@@ -642,7 +651,6 @@ math_window_set_property(GObject *object,
}
}
-
static void
math_window_get_property(GObject *object,
guint prop_id,
@@ -666,7 +674,6 @@ math_window_get_property(GObject *object,
}
}
-
static void
math_window_class_init(MathWindowClass *klass)
{
@@ -700,7 +707,6 @@ math_window_class_init(MathWindowClass *klass)
G_TYPE_NONE, 0);
}
-
static void
math_window_init(MathWindow *window)
{
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..bb183cd
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,120 @@
+src = []
+src_cmd = []
+test_mp_src = []
+test_mp_eq_src = []
+
+enums = []
+
+enums += gnome.mkenums('types',
+ sources: 'mp-serializer.h',
+ c_template: 'mp-enums.c.template',
+ h_template: 'mp-enums.h.template')
+
+ui_files = files(
+ 'buttons-advanced.ui',
+ 'buttons-basic.ui',
+ 'buttons-financial.ui',
+ 'preferences.ui'
+)
+
+ui_resources = gnome.compile_resources(
+ 'ui_resources',
+ 'org.mate.calculator.gresource.xml',
+ source_dir: 'src'
+)
+
+src += [
+ 'mate-calc.c',
+ 'currency-manager.c',
+ 'currency.c',
+ 'financial.c',
+ 'lexer.c',
+ 'math-buttons.c',
+ 'math-converter.c',
+ 'math-display.c',
+ 'math-equation.c',
+ 'math-history.c',
+ 'math-history-entry.c',
+ 'math-preferences.c',
+ 'math-variable-popup.c',
+ 'math-variables.c',
+ 'math-window.c',
+ 'mp-binary.c',
+ 'mp-convert.c',
+ 'mp-equation.c',
+ 'mp-trigonometric.c',
+ 'mp-serializer.c',
+ 'mp.c',
+ 'parser.c',
+ 'parserfunc.c',
+ 'prelexer.c',
+ 'unit-category.c',
+ 'unit-manager.c',
+ 'unit.c',
+ enums,
+ ui_resources
+]
+
+src_cmd += [
+ 'mate-calc-cmd.c',
+ 'currency.c',
+ 'currency-manager.c',
+ 'mp.c',
+ 'mp-binary.c',
+ 'mp-convert.c',
+ 'mp-equation.c',
+ 'mp-serializer.c',
+ 'mp-trigonometric.c',
+ 'unit.c',
+ 'unit-category.c',
+ 'unit-manager.c',
+ 'prelexer.c',
+ 'lexer.c',
+ 'parserfunc.c',
+ 'parser.c',
+ enums
+]
+
+test_mp_src += [
+ 'test-mp.c',
+ 'mp.c',
+ 'mp-convert.c',
+ 'mp-trigonometric.c'
+]
+
+test_mp_eq_src += [
+ 'test-mp-equation.c',
+ 'currency.c',
+ 'currency-manager.c',
+ 'mp.c',
+ 'mp-convert.c',
+ 'mp-binary.c',
+ enums,
+ 'mp-equation.c',
+ 'mp-serializer.c',
+ 'mp-trigonometric.c',
+ 'unit.c',
+ 'unit-category.c',
+ 'unit-manager.c',
+ 'prelexer.c',
+ 'lexer.c',
+ 'parserfunc.c',
+ 'parser.c',
+]
+
+executable('mate-calc', src, include_directories: top_inc,
+ dependencies : [gio, glib, gobject,gtk, libxml, mpc, mpfr],
+ link_args: '-rdynamic',
+ install : true,
+ install_dir : get_option('bindir'))
+
+executable('mate-calc-cmd', src_cmd, include_directories: top_inc,
+ dependencies : [gio, libxml, mpc, mpfr],
+ install : true,
+ install_dir : get_option('bindir'))
+
+executable('test-mp', test_mp_src, include_directories: top_inc,
+ dependencies : [gio, libxml, mpc, mpfr])
+
+executable('test-mp-equation', test_mp_eq_src, include_directories: top_inc,
+ dependencies: [gio, libxml, mpc, mpfr])
diff --git a/src/mp-binary.c b/src/mp-binary.c
index 800724c..046bd92 100644
--- a/src/mp-binary.c
+++ b/src/mp-binary.c
@@ -30,7 +30,6 @@ static int hex_to_int(char digit)
return 0;
}
-
static gchar *
to_hex_string(const MPNumber *x)
{
@@ -44,7 +43,6 @@ to_hex_string(const MPNumber *x)
return result;
}
-
static void
mp_bitwise(const MPNumber *x, const MPNumber *y, int (*bitwise_operator)(int, int), MPNumber *z, int wordlen)
{
@@ -88,13 +86,11 @@ mp_bitwise(const MPNumber *x, const MPNumber *y, int (*bitwise_operator)(int, in
g_free(text2);
}
-
static int mp_bitwise_and(int v1, int v2) { return v1 & v2; }
static int mp_bitwise_or(int v1, int v2) { return v1 | v2; }
static int mp_bitwise_xor(int v1, int v2) { return v1 ^ v2; }
static int mp_bitwise_not(int v1, int dummy) { return v1 ^ 0xF; }
-
bool
mp_is_overflow (const MPNumber *x, int wordlen)
{
@@ -109,7 +105,6 @@ mp_is_overflow (const MPNumber *x, int wordlen)
return is_overflow;
}
-
void
mp_and(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
@@ -122,7 +117,6 @@ mp_and(const MPNumber *x, const MPNumber *y, MPNumber *z)
mp_bitwise(x, y, mp_bitwise_and, z, 0);
}
-
void
mp_or(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
@@ -135,7 +129,6 @@ mp_or(const MPNumber *x, const MPNumber *y, MPNumber *z)
mp_bitwise(x, y, mp_bitwise_or, z, 0);
}
-
void
mp_xor(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
@@ -148,7 +141,6 @@ mp_xor(const MPNumber *x, const MPNumber *y, MPNumber *z)
mp_bitwise(x, y, mp_bitwise_xor, z, 0);
}
-
void
mp_not(const MPNumber *x, int wordlen, MPNumber *z)
{
@@ -166,7 +158,6 @@ mp_not(const MPNumber *x, int wordlen, MPNumber *z)
mp_clear(&temp);
}
-
void
mp_shift(const MPNumber *x, int count, MPNumber *z)
{
@@ -192,7 +183,6 @@ mp_shift(const MPNumber *x, int count, MPNumber *z)
mp_clear(&multiplier);
}
-
void
mp_ones_complement(const MPNumber *x, int wordlen, MPNumber *z)
{
@@ -203,7 +193,6 @@ mp_ones_complement(const MPNumber *x, int wordlen, MPNumber *z)
mp_clear(&t);
}
-
void
mp_twos_complement(const MPNumber *x, int wordlen, MPNumber *z)
{
diff --git a/src/mp-convert.c b/src/mp-convert.c
index ef1a770..5f097c8 100644
--- a/src/mp-convert.c
+++ b/src/mp-convert.c
@@ -24,30 +24,26 @@ mp_set_from_mp(const MPNumber *x, MPNumber *z)
mpc_set(z->num, x->num, MPC_RNDNN);
}
-
void
mp_set_from_double(double dx, MPNumber *z)
{
mpc_set_d(z->num, dx, MPC_RNDNN);
}
-
void
-mp_set_from_integer(int64_t x, MPNumber *z)
+mp_set_from_integer(long x, MPNumber *z)
{
mpc_set_si(z->num, x, MPC_RNDNN);
}
-
void
-mp_set_from_unsigned_integer(uint64_t x, MPNumber *z)
+mp_set_from_unsigned_integer(ulong x, MPNumber *z)
{
mpc_set_ui(z->num, x, MPC_RNDNN);
}
-
void
-mp_set_from_fraction(int64_t numerator, int64_t denominator, MPNumber *z)
+mp_set_from_fraction(long numerator, long denominator, MPNumber *z)
{
if (denominator < 0) {
numerator = -numerator;
@@ -59,7 +55,6 @@ mp_set_from_fraction(int64_t numerator, int64_t denominator, MPNumber *z)
mp_divide_integer(z, denominator, z);
}
-
void
mp_set_from_polar(const MPNumber *r, MPAngleUnit unit, const MPNumber *theta, MPNumber *z)
{
@@ -88,14 +83,13 @@ mp_set_from_random(MPNumber *z)
mp_set_from_double(drand48(), z);
}
-int64_t
+long
mp_to_integer(const MPNumber *x)
{
return mpfr_get_si(mpc_realref(x->num), MPFR_RNDN);
}
-
-uint64_t
+ulong
mp_to_unsigned_integer(const MPNumber *x)
{
return mpfr_get_ui(mpc_realref(x->num), MPFR_RNDN);
@@ -116,7 +110,8 @@ mp_to_double(const MPNumber *x)
static int
char_val(char **c, int base)
{
- int i, j, value, offset;
+ int i, j, value;
+ size_t offset;
const char *digits[][10] = {{"٠", "١", "٢", "٣", "٤", "٥", "٦", "٧", "٨", "٩"},
{"〇", "〡", "〢", "〣", "〤", "〥", "〦", "〧", "〨", "〩"},
{"۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"},
@@ -181,7 +176,6 @@ char_val(char **c, int base)
return value;
}
-
static int
ends_with(const char *start, const char *end, const char *word)
{
@@ -193,7 +187,6 @@ ends_with(const char *start, const char *end, const char *word)
return strncmp(end - word_len, word, word_len) == 0;
}
-
// FIXME: Doesn't handle errors well (e.g. trailing space)
static bool
set_from_sexagesimal(const char *str, int length, MPNumber *z)
@@ -224,7 +217,6 @@ set_from_sexagesimal(const char *str, int length, MPNumber *z)
return false;
}
-
bool
mp_set_from_string(const char *str, int default_base, MPNumber *z)
{
diff --git a/src/mp-equation.c b/src/mp-equation.c
index df9d872..0c9e204 100644
--- a/src/mp-equation.c
+++ b/src/mp-equation.c
@@ -37,7 +37,6 @@ variable_is_defined(ParserState *state, const char *name)
return 0;
}
-
static int
get_variable(ParserState *state, const char *name, MPNumber *z)
{
@@ -103,7 +102,6 @@ set_variable(ParserState *state, const char *name, const MPNumber *x)
// i.e. numbers+letters = variable or function depending on following arg
// letters+numbers = numbers+letters+numbers = function
-
int
sub_atoi(const char *data)
{
@@ -143,7 +141,6 @@ super_atoi(const char *data)
return sign * value;
}
-
static int
function_is_defined(ParserState *state, const char *name)
{
@@ -188,7 +185,6 @@ function_is_defined(ParserState *state, const char *name)
return 0;
}
-
static int
get_function(ParserState *state, const char *name, const MPNumber *x, MPNumber *z)
{
@@ -280,7 +276,6 @@ get_function(ParserState *state, const char *name, const MPNumber *x, MPNumber *
return result;
}
-
static int
convert(ParserState *state, const MPNumber *x, const char *x_units, const char *z_units, MPNumber *z)
{
@@ -290,7 +285,6 @@ convert(ParserState *state, const MPNumber *x, const char *x_units, const char *
return 0;
}
-
MPErrorCode
mp_equation_parse(const char *expression, MPEquationOptions *options, MPNumber *result, char **error_token)
{
@@ -336,7 +330,6 @@ mp_equation_parse(const char *expression, MPEquationOptions *options, MPNumber *
return PARSER_ERR_NONE;
}
-
const char *
mp_error_code_to_string(MPErrorCode error_code)
{
diff --git a/src/mp-serializer.c b/src/mp-serializer.c
index 3967cbc..4c04f64 100644
--- a/src/mp-serializer.c
+++ b/src/mp-serializer.c
@@ -41,7 +41,6 @@ struct MpSerializerPrivate
gint tsep_count; /* Number of digits between separator. */
};
-
G_DEFINE_TYPE_WITH_PRIVATE (MpSerializer, mp_serializer, G_TYPE_OBJECT);
MpSerializer *
@@ -54,7 +53,6 @@ mp_serializer_new(MpDisplayFormat format, int base, int trailing_digits)
return serializer;
}
-
static void
mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolean force_sign, int *n_digits, GString *string)
{
@@ -63,7 +61,8 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
MPNumber integer_component = mp_new();
MPNumber fractional_component = mp_new();
MPNumber temp = mp_new();
- int i, last_non_zero;
+ int i;
+ gsize last_non_zero;
if (mp_is_negative(x))
mp_abs(x, &number);
@@ -88,11 +87,11 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
/* Write out the integer component least significant digit to most */
mp_set_from_mp(&integer_component, &temp);
i = 0;
+ MPNumber t = mp_new();
+ MPNumber t2 = mp_new();
+ MPNumber t3 = mp_new();
do {
- MPNumber t = mp_new();
- MPNumber t2 = mp_new();
- MPNumber t3 = mp_new();
- int64_t d;
+ long d;
if (serializer->priv->base == 10 && serializer->priv->show_tsep && i == serializer->priv->tsep_count) {
g_string_prepend_unichar(string, serializer->priv->tsep);
@@ -118,10 +117,10 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
(*n_digits)++;
mp_set_from_mp(&t, &temp);
- mp_clear(&t);
- mp_clear(&t2);
- mp_clear(&t3);
} while (!mp_is_zero(&temp));
+ mp_clear(&t);
+ mp_clear(&t2);
+ mp_clear(&t3);
last_non_zero = string->len;
@@ -129,9 +128,9 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
/* Write out the fractional component */
mp_set_from_mp(&fractional_component, &temp);
+ MPNumber digit = mp_new();
for (i = serializer->priv->trailing_digits; i > 0 && !mp_is_zero(&temp); i--) {
int d;
- MPNumber digit = mp_new();
mp_multiply_integer(&temp, base, &temp);
mp_floor(&temp, &digit);
@@ -142,8 +141,8 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
if(d != 0)
last_non_zero = string->len;
mp_subtract(&temp, &digit, &temp);
- mp_clear(&digit);
}
+ mp_clear(&digit);
/* Strip trailing zeroes */
if (!serializer->priv->show_zeroes || serializer->priv->trailing_digits == 0)
@@ -179,7 +178,6 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
mp_clear(&temp);
}
-
static gchar *
mp_to_string(MpSerializer *serializer, const MPNumber *x, int *n_digits)
{
@@ -242,7 +240,6 @@ mp_to_string(MpSerializer *serializer, const MPNumber *x, int *n_digits)
return result;
}
-
static int
mp_to_exponential_string_real(MpSerializer *serializer, const MPNumber *x, GString *string, gboolean eng_format, int *n_digits)
{
@@ -306,7 +303,6 @@ mp_to_exponential_string_real(MpSerializer *serializer, const MPNumber *x, GStri
return exponent;
}
-
static void
append_exponent(GString *string, int exponent)
{
@@ -328,7 +324,6 @@ append_exponent(GString *string, int exponent)
g_free (super_value);
}
-
static gchar *
mp_to_exponential_string(MpSerializer *serializer, const MPNumber *x, gboolean eng_format, int *n_digits)
{
@@ -391,7 +386,6 @@ mp_to_exponential_string(MpSerializer *serializer, const MPNumber *x, gboolean e
return result;
}
-
gchar *
mp_serializer_to_string(MpSerializer *serializer, const MPNumber *x)
{
@@ -417,133 +411,114 @@ mp_serializer_to_string(MpSerializer *serializer, const MPNumber *x)
}
}
-
gboolean
mp_serializer_from_string(MpSerializer *serializer, const gchar *str, MPNumber *z)
{
return mp_set_from_string(str, serializer->priv->base, z);
}
-
void
mp_serializer_set_base(MpSerializer *serializer, gint base)
{
serializer->priv->base = base;
}
-
int
mp_serializer_get_base(MpSerializer *serializer)
{
return serializer->priv->base;
}
-
void
mp_serializer_set_radix(MpSerializer *serializer, gunichar radix)
{
serializer->priv->radix = radix;
}
-
gunichar
mp_serializer_get_radix(MpSerializer *serializer)
{
return serializer->priv->radix;
}
-
void
mp_serializer_set_thousands_separator(MpSerializer *serializer, gunichar separator)
{
serializer->priv->tsep = separator;
}
-
gunichar
mp_serializer_get_thousands_separator(MpSerializer *serializer)
{
return serializer->priv->tsep;
}
-
gint
mp_serializer_get_thousands_separator_count(MpSerializer *serializer)
{
return serializer->priv->tsep_count;
}
-
void
mp_serializer_set_show_thousands_separators(MpSerializer *serializer, gboolean visible)
{
serializer->priv->show_tsep = visible;
}
-
gboolean
mp_serializer_get_show_thousands_separators(MpSerializer *serializer)
{
return serializer->priv->show_tsep;
}
-
void
mp_serializer_set_show_trailing_zeroes(MpSerializer *serializer, gboolean visible)
{
serializer->priv->show_zeroes = visible;
}
-
gboolean
mp_serializer_get_show_trailing_zeroes(MpSerializer *serializer)
{
return serializer->priv->show_zeroes;
}
-
int
mp_serializer_get_leading_digits(MpSerializer *serializer)
{
return serializer->priv->leading_digits;
}
-
void
mp_serializer_set_leading_digits(MpSerializer *serializer, int leading_digits)
{
serializer->priv->leading_digits = leading_digits;
}
-
int
mp_serializer_get_trailing_digits(MpSerializer *serializer)
{
return serializer->priv->trailing_digits;
}
-
void
mp_serializer_set_trailing_digits(MpSerializer *serializer, int trailing_digits)
{
serializer->priv->trailing_digits = trailing_digits;
}
-
MpDisplayFormat
mp_serializer_get_number_format(MpSerializer *serializer)
{
return serializer->priv->format;
}
-
void
mp_serializer_set_number_format(MpSerializer *serializer, MpDisplayFormat format)
{
serializer->priv->format = format;
}
-
static void
mp_serializer_set_property(GObject *object,
guint prop_id,
@@ -568,7 +543,6 @@ mp_serializer_set_property(GObject *object,
}
}
-
static void
mp_serializer_get_property(GObject *object,
guint prop_id,
@@ -593,7 +567,6 @@ mp_serializer_get_property(GObject *object,
}
}
-
static void
mp_serializer_class_init(MpSerializerClass *klass)
{
@@ -632,18 +605,23 @@ mp_serializer_class_init(MpSerializerClass *klass)
G_PARAM_READWRITE));
}
-
static void
mp_serializer_init(MpSerializer *serializer)
{
- gchar *radix, *tsep;
+ gchar *radix, *utf8_radix, *tsep;
serializer->priv = mp_serializer_get_instance_private (serializer);
radix = nl_langinfo(RADIXCHAR);
- serializer->priv->radix = radix ? g_utf8_get_char(g_locale_to_utf8(radix, -1, NULL, NULL, NULL)) : '.';
+ utf8_radix = g_locale_to_utf8(radix, -1, NULL, NULL, NULL);
+ serializer->priv->radix = radix ? g_utf8_get_char(utf8_radix) : '.';
+ g_free(utf8_radix);
tsep = nl_langinfo(THOUSEP);
if (tsep && tsep[0] != '\0')
- serializer->priv->tsep = g_utf8_get_char(g_locale_to_utf8(tsep, -1, NULL, NULL, NULL));
+ {
+ gchar *utf8_tsep = g_locale_to_utf8(tsep, -1, NULL, NULL, NULL);
+ serializer->priv->tsep = g_utf8_get_char(utf8_tsep);
+ g_free(utf8_tsep);
+ }
else
serializer->priv->tsep = ' ';
serializer->priv->tsep_count = 3;
diff --git a/src/mp-trigonometric.c b/src/mp-trigonometric.c
index 622d2dd..70838f8 100644
--- a/src/mp-trigonometric.c
+++ b/src/mp-trigonometric.c
@@ -71,7 +71,6 @@ convert_from_radians(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mpfr_clear(scale);
}
-
void
mp_get_pi (MPNumber *z)
{
@@ -79,7 +78,6 @@ mp_get_pi (MPNumber *z)
mpfr_set_zero(mpc_imagref(z->num), 0);
}
-
void
mp_sin(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -90,7 +88,6 @@ mp_sin(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mpc_sin(z->num, z->num, MPC_RNDNN);
}
-
void
mp_cos(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -101,7 +98,6 @@ mp_cos(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mpc_cos(z->num, z->num, MPC_RNDNN);
}
-
void
mp_tan(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -135,7 +131,6 @@ mp_tan(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mp_clear(&t1);
}
-
void
mp_asin(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -160,7 +155,6 @@ mp_asin(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mp_clear(&x_min);
}
-
void
mp_acos(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -185,7 +179,6 @@ mp_acos(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mp_clear(&x_min);
}
-
void
mp_atan(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -211,35 +204,30 @@ mp_atan(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mp_clear(&minus_i);
}
-
void
mp_sinh(const MPNumber *x, MPNumber *z)
{
mpc_sinh(z->num, x->num, MPC_RNDNN);
}
-
void
mp_cosh(const MPNumber *x, MPNumber *z)
{
mpc_cosh(z->num, x->num, MPC_RNDNN);
}
-
void
mp_tanh(const MPNumber *x, MPNumber *z)
{
mpc_tanh(z->num, x->num, MPC_RNDNN);
}
-
void
mp_asinh(const MPNumber *x, MPNumber *z)
{
mpc_asinh(z->num, x->num, MPC_RNDNN);
}
-
void
mp_acosh(const MPNumber *x, MPNumber *z)
{
@@ -260,7 +248,6 @@ mp_acosh(const MPNumber *x, MPNumber *z)
mp_clear(&t);
}
-
void
mp_atanh(const MPNumber *x, MPNumber *z)
{
diff --git a/src/mp.c b/src/mp.c
index 30f69f4..31a84d4 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -37,14 +37,12 @@ mperr(const char *format, ...)
mp_error = strdup(text);
}
-
const char *
mp_get_error()
{
return mp_error;
}
-
void mp_clear_error()
{
if (mp_error)
@@ -52,7 +50,6 @@ void mp_clear_error()
mp_error = NULL;
}
-
MPNumber
mp_new(void)
{
@@ -61,6 +58,14 @@ mp_new(void)
return z;
}
+MPNumber
+mp_new_from_unsigned_integer(ulong x)
+{
+ MPNumber z;
+ mpc_init2(z.num, PRECISION);
+ mpc_set_ui(z.num, x, MPC_RNDNN);
+ return z;
+}
MPNumber *
mp_new_ptr(void)
@@ -70,7 +75,6 @@ mp_new_ptr(void)
return z;
}
-
void
mp_clear(MPNumber *z)
{
@@ -78,7 +82,6 @@ mp_clear(MPNumber *z)
mpc_clear(z->num);
}
-
void
mp_free(MPNumber *z)
{
@@ -89,7 +92,6 @@ mp_free(MPNumber *z)
}
}
-
void
mp_get_eulers(MPNumber *z)
{
@@ -99,14 +101,12 @@ mp_get_eulers(MPNumber *z)
mpfr_set_zero(mpc_imagref(z->num), 0);
}
-
void
mp_get_i(MPNumber *z)
{
mpc_set_si_si(z->num, 0, 1, MPC_RNDNN);
}
-
void
mp_abs(const MPNumber *x, MPNumber *z)
{
@@ -114,7 +114,6 @@ mp_abs(const MPNumber *x, MPNumber *z)
mpc_abs(mpc_realref(z->num), x->num, MPC_RNDNN);
}
-
void
mp_arg(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
{
@@ -136,21 +135,18 @@ mp_arg(const MPNumber *x, MPAngleUnit unit, MPNumber *z)
mpfr_abs(mpc_realref(z->num), mpc_realref(z->num), MPFR_RNDN);
}
-
void
mp_conjugate(const MPNumber *x, MPNumber *z)
{
mpc_conj(z->num, x->num, MPC_RNDNN);
}
-
void
mp_real_component(const MPNumber *x, MPNumber *z)
{
mpc_set_fr(z->num, mpc_realref(x->num), MPC_RNDNN);
}
-
void
mp_imaginary_component(const MPNumber *x, MPNumber *z)
{
@@ -163,9 +159,8 @@ mp_add(const MPNumber *x, const MPNumber *y, MPNumber *z)
mpc_add(z->num, x->num, y->num, MPC_RNDNN);
}
-
void
-mp_add_integer(const MPNumber *x, int64_t y, MPNumber *z)
+mp_add_integer(const MPNumber *x, long y, MPNumber *z)
{
mpc_add_si(z->num, x->num, y, MPC_RNDNN);
}
@@ -196,7 +191,6 @@ mp_fractional_component(const MPNumber *x, MPNumber *z)
mpfr_frac(mpc_realref(z->num), mpc_realref(x->num), MPFR_RNDN);
}
-
void
mp_fractional_part(const MPNumber *x, MPNumber *z)
{
@@ -206,7 +200,6 @@ mp_fractional_part(const MPNumber *x, MPNumber *z)
mp_clear(&f);
}
-
void
mp_floor(const MPNumber *x, MPNumber *z)
{
@@ -214,7 +207,6 @@ mp_floor(const MPNumber *x, MPNumber *z)
mpfr_floor(mpc_realref(z->num), mpc_realref(x->num));
}
-
void
mp_ceiling(const MPNumber *x, MPNumber *z)
{
@@ -222,7 +214,6 @@ mp_ceiling(const MPNumber *x, MPNumber *z)
mpfr_ceil(mpc_realref(z->num), mpc_realref(x->num));
}
-
void
mp_round(const MPNumber *x, MPNumber *z)
{
@@ -250,7 +241,7 @@ mp_divide(const MPNumber *x, const MPNumber *y, MPNumber *z)
}
void
-mp_divide_integer(const MPNumber *x, int64_t y, MPNumber *z)
+mp_divide_integer(const MPNumber *x, long y, MPNumber *z)
{
MPNumber t1 = mp_new();
@@ -268,7 +259,6 @@ mp_is_integer(const MPNumber *x)
return mpfr_integer_p(mpc_realref(x->num)) != 0;
}
-
bool
mp_is_positive_integer(const MPNumber *x)
{
@@ -278,7 +268,6 @@ mp_is_positive_integer(const MPNumber *x)
return mpfr_sgn(mpc_realref(x->num)) >= 0 && mp_is_integer(x);
}
-
bool
mp_is_natural(const MPNumber *x)
{
@@ -288,14 +277,12 @@ mp_is_natural(const MPNumber *x)
return mpfr_sgn(mpc_realref(x->num)) > 0 && mp_is_integer(x);
}
-
bool
mp_is_complex(const MPNumber *x)
{
return !mpfr_zero_p(mpc_imagref(x->num));
}
-
bool
mp_is_equal(const MPNumber *x, const MPNumber *y)
{
@@ -303,7 +290,6 @@ mp_is_equal(const MPNumber *x, const MPNumber *y)
return MPC_INEX_RE(res) == 0 && MPC_INEX_IM(res) == 0;
}
-
void
mp_epowy(const MPNumber *x, MPNumber *z)
{
@@ -323,21 +309,18 @@ mp_is_negative(const MPNumber *x)
return mpfr_sgn(mpc_realref(x->num)) < 0;
}
-
bool
mp_is_greater_equal(const MPNumber *x, const MPNumber *y)
{
return mp_compare(x, y) >= 0;
}
-
bool
mp_is_greater_than(const MPNumber *x, const MPNumber *y)
{
return mp_compare(x, y) > 0;
}
-
bool
mp_is_less_equal(const MPNumber *x, const MPNumber *y)
{
@@ -378,9 +361,8 @@ mp_ln(const MPNumber *x, MPNumber *z)
mpfr_abs(mpc_imagref(z->num), mpc_imagref(z->num), MPFR_RNDN);
}
-
void
-mp_logarithm(int64_t n, const MPNumber *x, MPNumber *z)
+mp_logarithm(long n, const MPNumber *x, MPNumber *z)
{
/* log(0) undefined */
if (mp_is_zero(x))
@@ -406,39 +388,41 @@ mp_multiply(const MPNumber *x, const MPNumber *y, MPNumber *z)
mpc_mul(z->num, x->num, y->num, MPC_RNDNN);
}
-
void
-mp_multiply_integer(const MPNumber *x, int64_t y, MPNumber *z)
+mp_multiply_integer(const MPNumber *x, long y, MPNumber *z)
{
- mpc_mul_si(z->num, x->num, (long) y, MPC_RNDNN);
+ mpc_mul_si(z->num, x->num, y, MPC_RNDNN);
}
-
void
mp_invert_sign(const MPNumber *x, MPNumber *z)
{
mpc_neg(z->num, x->num, MPC_RNDNN);
}
-
void
mp_reciprocal(const MPNumber *x, MPNumber *z)
{
- mpc_set_si(z->num, 1, MPC_RNDNN);
- mpc_fr_div(z->num, mpc_realref(z->num), x->num, MPC_RNDNN);
+ mpc_t temp;
+ mpc_init2(temp, PRECISION);
+ mpc_set_ui(temp, 1, MPC_RNDNN);
+ mpc_fr_div(z->num, mpc_realref(temp), x->num, MPC_RNDNN);
+ mpc_clear(temp);
}
void
-mp_root(const MPNumber *x, int64_t n, MPNumber *z)
+mp_root(const MPNumber *x, long n, MPNumber *z)
{
- uint64_t p;
+ ulong p;
if (n < 0)
{
- if (n == INT64_MIN)
- p = (uint64_t) INT64_MAX + 1;
+ mpc_ui_div(z->num, 1, x->num, MPC_RNDNN);
+
+ if (n == LONG_MIN)
+ p = (ulong) LONG_MAX + 1;
else
- p = -n;
+ p = (ulong) -n;
}
else if (n > 0)
{
@@ -453,28 +437,26 @@ mp_root(const MPNumber *x, int64_t n, MPNumber *z)
}
if (!mp_is_complex(x) && (!mp_is_negative(x) || (p & 1) == 1))
{
- mpfr_rootn_ui(mpc_realref(z->num), mpc_realref(z->num), (uint64_t) p, MPFR_RNDN);
+ mpfr_rootn_ui(mpc_realref(z->num), mpc_realref(z->num), p, MPFR_RNDN);
mpfr_set_zero(mpc_imagref(z->num), MPFR_RNDN);
}
else
{
mpfr_t tmp;
mpfr_init2(tmp, PRECISION);
- mpfr_set_ui(tmp, (uint64_t) p, MPFR_RNDN);
+ mpfr_set_ui(tmp, p, MPFR_RNDN);
mpfr_ui_div(tmp, 1, tmp, MPFR_RNDN);
mpc_pow_fr(z->num, z->num, tmp, MPC_RNDNN);
mpfr_clear(tmp);
}
}
-
void
mp_sqrt(const MPNumber *x, MPNumber *z)
{
mp_root(x, 2, z);
}
-
void
mp_factorial(const MPNumber *x, MPNumber *z)
{
@@ -508,13 +490,12 @@ mp_factorial(const MPNumber *x, MPNumber *z)
else
{
/* Convert to integer - if couldn't be converted then the factorial would be too big anyway */
- int64_t value = mp_to_integer(x);
+ ulong value = mp_to_unsigned_integer(x);
mpfr_fac_ui(mpc_realref(z->num), value, MPFR_RNDN);
mpfr_set_zero(mpc_imagref(z->num), MPFR_RNDN);
}
}
-
void
mp_modulus_divide(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
@@ -542,7 +523,6 @@ mp_modulus_divide(const MPNumber *x, const MPNumber *y, MPNumber *z)
mp_clear(&t2);
}
-
void
mp_modular_exponentiation(const MPNumber *x, const MPNumber *y, const MPNumber *p, MPNumber *z)
{
@@ -586,7 +566,6 @@ mp_modular_exponentiation(const MPNumber *x, const MPNumber *y, const MPNumber *
mp_clear(&tmp);
}
-
void
mp_xpowy(const MPNumber *x, const MPNumber *y, MPNumber *z)
{
@@ -614,9 +593,8 @@ mp_xpowy(const MPNumber *x, const MPNumber *y, MPNumber *z)
mpc_pow(z->num, x->num, y->num, MPC_RNDNN);
}
-
void
-mp_xpowy_integer(const MPNumber *x, int64_t n, MPNumber *z)
+mp_xpowy_integer(const MPNumber *x, long n, MPNumber *z)
{
/* 0^-n invalid */
if (mp_is_zero(x) && n < 0)
@@ -626,7 +604,7 @@ mp_xpowy_integer(const MPNumber *x, int64_t n, MPNumber *z)
return;
}
- mpc_pow_si(z->num, x->num, (long) n, MPC_RNDNN);
+ mpc_pow_si(z->num, x->num, n, MPC_RNDNN);
}
void
@@ -663,6 +641,204 @@ mp_zeta(const MPNumber *x, MPNumber *z)
mp_clear(&one);
}
+/***********************************************************************/
+/** FACTORIZATION **/
+/***********************************************************************/
+
+/**
+ * mp_is_pprime uses the Miller-Rabin primality test to decide
+ * whether or not a number is probable prime.
+ * For special values of @n and @rounds it can be deterministic,
+ * but in general the probability of declaring @n as prime if it
+ * is not is at most 4^(-@rounds).
+ * @n has to be odd.
+ * Returns TRUE if @n is probable prime and FALSE otherwise.
+ */
+static bool
+mp_is_pprime(MPNumber *n, ulong rounds)
+{
+ MPNumber tmp = mp_new();
+ MPNumber two = mp_new_from_unsigned_integer(2);
+ ulong l = 0;
+ bool is_pprime = TRUE;
+
+ /* Write t := n-1 = 2^l * q with q odd */
+ MPNumber q = mp_new();
+ MPNumber t = mp_new();
+ mp_add_integer(n, -1, &t);
+ mp_set_from_mp(&t, &q);
+ do
+ {
+ mp_divide_integer(&q, 2, &q);
+ mp_modulus_divide(&q, &two, &tmp);
+ l++;
+ } while (mp_is_zero(&tmp));
+
+ /* @rounds Miller-Rabin tests to bases a = 2,3,...,@rounds+1 */
+ MPNumber one = mp_new_from_unsigned_integer(1);
+ MPNumber a = mp_new_from_unsigned_integer(1);
+ MPNumber b = mp_new();
+
+ for (ulong i = 1; (i < mp_to_integer(&t)) && (i <= rounds+1); i++)
+ {
+ mp_add_integer(&a, 1, &a);
+ mp_modular_exponentiation(&a, &q, n, &b);
+ if (mp_compare(&one, &b) == 0 || mp_compare(&t, &b) == 0)
+ {
+ continue;
+ }
+
+ bool is_witness = FALSE;
+ for (long j = 1; j < l; j++)
+ {
+ mp_modular_exponentiation(&b, &two, n, &b);
+ if (mp_compare(&b, &t) == 0)
+ {
+ is_witness = TRUE;
+ break;
+ }
+ }
+
+ if (!is_witness)
+ {
+ is_pprime = FALSE;
+ break;
+ }
+ }
+
+ mp_clear(&t);
+ mp_clear(&q);
+ mp_clear(&a);
+ mp_clear(&b);
+ mp_clear(&one);
+ mp_clear(&two);
+ mp_clear(&tmp);
+
+ return is_pprime;
+}
+
+/**
+ * Sets z = gcd(a,b) where gcd(a,b) is the greatest common divisor of @a and @b.
+ */
+static void
+mp_gcd (const MPNumber *a, const MPNumber *b, MPNumber *z)
+{
+ MPNumber null = mp_new_from_unsigned_integer(0);
+ MPNumber t1 = mp_new();
+ MPNumber t2 = mp_new();
+
+ mp_set_from_mp(a, z);
+ mp_set_from_mp(b, &t2);
+
+ while (mp_compare(&t2, &null) != 0)
+ {
+ mp_set_from_mp(&t2, &t1);
+ mp_modulus_divide(z, &t2, &t2);
+ mp_set_from_mp(&t1, z);
+ }
+
+ mp_clear(&null);
+ mp_clear(&t1);
+ mp_clear(&t2);
+}
+
+/**
+ * mp_pollard_rho searches a divisor of @n using Pollard's rho algorithm.
+ * @i is the start value of the pseudorandom sequence which is generated
+ * by the polynomial x^2+1 mod n.
+ *
+ * Returns TRUE if a divisor was found and stores the divisor in z.
+ * Returns FALSE otherwise.
+ */
+static bool
+mp_pollard_rho (const MPNumber *n, ulong i, MPNumber *z)
+{
+ MPNumber one = mp_new_from_unsigned_integer(1);
+ MPNumber two = mp_new_from_unsigned_integer(2);
+ MPNumber x = mp_new_from_unsigned_integer(i);
+ MPNumber y = mp_new_from_unsigned_integer(2);
+ MPNumber d = mp_new_from_unsigned_integer(1);
+
+ while (mp_compare(&d, &one) == 0)
+ {
+ mp_modular_exponentiation(&x, &two, n, &x);
+ mp_add(&x, &one, &x);
+
+ mp_modular_exponentiation(&y, &two, n, &y);
+ mp_add(&y, &one, &y);
+
+ mp_modular_exponentiation(&y, &two, n, &y);
+ mp_add(&y, &one, &y);
+
+ mp_subtract(&x, &y,z);
+ mp_abs(z, z);
+ mp_gcd(z, n, &d);
+ }
+
+ if (mp_compare(&d, n) == 0)
+ {
+ mp_clear(&one);
+ mp_clear(&two);
+ mp_clear(&x);
+ mp_clear(&y);
+ mp_clear(&d);
+
+ return FALSE;
+ }
+ else
+ {
+ mp_set_from_mp(&d, z);
+
+ mp_clear(&one);
+ mp_clear(&two);
+ mp_clear(&x);
+ mp_clear(&y);
+ mp_clear(&d);
+
+ return TRUE;
+ }
+}
+
+/**
+ * find_big_prime_factor acts as driver function for mp_pollard_rho which
+ * is run as long as a prime factor is found.
+ * On success sets @z to a prime factor of @n.
+ */
+static void
+find_big_prime_factor (const MPNumber *n, MPNumber *z)
+{
+ MPNumber tmp = mp_new();
+ ulong i = 2;
+
+ while (TRUE)
+ {
+ while (mp_pollard_rho (n, i, &tmp) == FALSE)
+ {
+ i++;
+ }
+
+ if (!mp_is_pprime(&tmp, 50))
+ {
+ mp_divide(n, &tmp, &tmp);
+ }
+ else
+ break;
+ }
+
+ mp_set_from_mp(&tmp, z);
+ mp_clear(&tmp);
+}
+
+/**
+ * mp_factorize tries to factorize the value of @x.
+ * If @x < 2^64 it calls mp_factorize_unit64 which deals in integers
+ * and should be fast enough for most values.
+ * If @x > 2^64 the approach to find factors of @x is as follows:
+ * - Try to divide @x by prime numbers 2,3,5,7,.. up to min(2^13, sqrt(x))
+ * - Use Pollard rho to find prime factors > 2^13.
+ * Returns a pointer to a GList with all prime factors of @x which needs to
+ * be freed.
+ */
GList*
mp_factorize(const MPNumber *x)
{
@@ -709,8 +885,7 @@ mp_factorize(const MPNumber *x)
return list;
}
- MPNumber divisor = mp_new();
- mp_set_from_integer(2, &divisor);
+ MPNumber divisor = mp_new_from_unsigned_integer(2);
while (TRUE)
{
mp_divide(&value, &divisor, &tmp);
@@ -726,10 +901,13 @@ mp_factorize(const MPNumber *x)
break;
}
- MPNumber root = mp_new();
mp_set_from_integer(3, &divisor);
+
+ MPNumber root = mp_new();
mp_sqrt(&value, &root);
- while (mp_is_less_equal(&divisor, &root))
+ uint64_t max_trial_division = (uint64_t) (1 << 10);
+ uint64_t iter = 0;
+ while (mp_is_less_equal(&divisor, &root) && (iter++ < max_trial_division))
{
mp_divide(&value, &divisor, &tmp);
if (mp_is_integer(&tmp))
@@ -743,8 +921,22 @@ mp_factorize(const MPNumber *x)
}
else
{
- mp_add_integer(&divisor, 2, &tmp);
- mp_set_from_mp(&tmp, &divisor);
+ mp_add_integer(&divisor, 2, &divisor);
+ }
+ }
+
+ while (!mp_is_pprime(&value, 50))
+ {
+ find_big_prime_factor (&value, &divisor);
+
+ mp_divide(&value, &divisor, &tmp);
+ if (mp_is_integer(&tmp))
+ {
+ mp_set_from_mp(&tmp, &value);
+ mp_set_from_mp(&divisor, factor);
+ list = g_list_append(list, factor);
+ factor = g_slice_alloc0(sizeof(MPNumber));
+ mpc_init2(factor->num, PRECISION);
}
}
@@ -763,7 +955,6 @@ mp_factorize(const MPNumber *x)
if (mp_is_negative(x))
mp_invert_sign(list->data, list->data);
- /* MPNumbers in GList will be freed in math_equation_factorize_real */
mp_clear(&value);
mp_clear(&tmp);
mp_clear(&divisor);
diff --git a/src/mp.h b/src/mp.h
index 3e03089..437f6f7 100644
--- a/src/mp.h
+++ b/src/mp.h
@@ -69,6 +69,8 @@ void mperr(const char *format, ...) __attribute__((format(printf, 1, 2)))
/* Returns initialized MPNumber object */
MPNumber mp_new(void);
+MPNumber mp_new_from_unsigned_integer(ulong x);
+
MPNumber* mp_new_ptr(void);
void mp_clear(MPNumber *z);
@@ -137,7 +139,7 @@ void mp_invert_sign(const MPNumber *x, MPNumber *z);
void mp_add(const MPNumber *x, const MPNumber *y, MPNumber *z);
/* Sets z = x + y */
-void mp_add_integer(const MPNumber *x, int64_t y, MPNumber *z);
+void mp_add_integer(const MPNumber *x, long y, MPNumber *z);
/* Sets z = x − y */
void mp_subtract(const MPNumber *x, const MPNumber *y, MPNumber *z);
@@ -146,13 +148,13 @@ void mp_subtract(const MPNumber *x, const MPNumber *y, MPNumber *z);
void mp_multiply(const MPNumber *x, const MPNumber *y, MPNumber *z);
/* Sets z = x × y */
-void mp_multiply_integer(const MPNumber *x, int64_t y, MPNumber *z);
+void mp_multiply_integer(const MPNumber *x, long y, MPNumber *z);
/* Sets z = x ÷ y */
void mp_divide(const MPNumber *x, const MPNumber *y, MPNumber *z);
/* Sets z = x ÷ y */
-void mp_divide_integer(const MPNumber *x, int64_t y, MPNumber *z);
+void mp_divide_integer(const MPNumber *x, long y, MPNumber *z);
/* Sets z = 1 ÷ x */
void mp_reciprocal(const MPNumber *, MPNumber *);
@@ -181,7 +183,7 @@ void mp_round(const MPNumber *x, MPNumber *z);
void mp_ln(const MPNumber *x, MPNumber *z);
/* Sets z = log_n x */
-void mp_logarithm(int64_t n, const MPNumber *x, MPNumber *z);
+void mp_logarithm(long n, const MPNumber *x, MPNumber *z);
/* Sets z = π */
void mp_get_pi(MPNumber *z);
@@ -193,7 +195,7 @@ void mp_get_eulers(MPNumber *z);
void mp_get_i(MPNumber *z);
/* Sets z = n√x */
-void mp_root(const MPNumber *x, int64_t n, MPNumber *z);
+void mp_root(const MPNumber *x, long n, MPNumber *z);
/* Sets z = √x */
void mp_sqrt(const MPNumber *x, MPNumber *z);
@@ -211,7 +213,7 @@ void mp_modular_exponentiation(const MPNumber *x, const MPNumber *y, const MPNum
void mp_xpowy(const MPNumber *x, const MPNumber *y, MPNumber *z);
/* Sets z = x^y */
-void mp_xpowy_integer(const MPNumber *x, int64_t y, MPNumber *z);
+void mp_xpowy_integer(const MPNumber *x, long y, MPNumber *z);
/* Sets z = e^x */
void mp_epowy(const MPNumber *x, MPNumber *z);
@@ -231,13 +233,13 @@ void mp_set_from_float(float x, MPNumber *z);
void mp_set_from_double(double x, MPNumber *z);
/* Sets z = x */
-void mp_set_from_integer(int64_t x, MPNumber *z);
+void mp_set_from_integer(long x, MPNumber *z);
/* Sets z = x */
-void mp_set_from_unsigned_integer(uint64_t x, MPNumber *z);
+void mp_set_from_unsigned_integer(ulong x, MPNumber *z);
/* Sets z = numerator ÷ denominator */
-void mp_set_from_fraction(int64_t numerator, int64_t denominator, MPNumber *z);
+void mp_set_from_fraction(long numerator, long denominator, MPNumber *z);
/* Sets z = r(cos theta + i sin theta) */
void mp_set_from_polar(const MPNumber *r, MPAngleUnit unit, const MPNumber *theta, MPNumber *z);
@@ -260,10 +262,10 @@ float mp_to_float(const MPNumber *x);
double mp_to_double(const MPNumber *x);
/* Returns x as a native integer */
-int64_t mp_to_integer(const MPNumber *x);
+long mp_to_integer(const MPNumber *x);
/* Returns x as a native unsigned integer */
-uint64_t mp_to_unsigned_integer(const MPNumber *x);
+ulong mp_to_unsigned_integer(const MPNumber *x);
/* Sets z = sin x */
void mp_sin(const MPNumber *x, MPAngleUnit unit, MPNumber *z);
diff --git a/src/parser.c b/src/parser.c
index b8cc98f..8ab4c3c 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -347,7 +347,7 @@ p_check_variable(ParserState* state, gchar* name)
for(c = name; *c != '\0'; c = next)
{
next = utf8_next_char(c);
- snprintf(buffer, next - c + 1, "%s", c);
+ snprintf(buffer, (size_t) (next - c + 1), "%s", c);
if(!(*(state->get_variable))(state, buffer, &temp))
{
result = 0;
diff --git a/src/parserfunc.c b/src/parserfunc.c
index c63ff96..6f27daf 100644
--- a/src/parserfunc.c
+++ b/src/parserfunc.c
@@ -584,7 +584,7 @@ void*
pf_do_x_pow_y_int(ParseNode* self)
{
MPNumber* val;
- gint pow;
+ long pow;
MPNumber* ans = mp_new_ptr();
val = (MPNumber*) (*(self->left->evaluate))(self->left);
diff --git a/src/parserfunc.h b/src/parserfunc.h
index cf049b0..d794839 100644
--- a/src/parserfunc.h
+++ b/src/parserfunc.h
@@ -1,4 +1,4 @@
-#ifndef PAESERFUNC_H
+#ifndef PARSERFUNC_H
#define PARSERFUNC_H
#include "parser.h"
diff --git a/src/test-mp-equation.c b/src/test-mp-equation.c
index adf6c06..5d480df 100644
--- a/src/test-mp-equation.c
+++ b/src/test-mp-equation.c
@@ -33,7 +33,6 @@ static int passes = 0;
static void pass(const char *format, ...) __attribute__((format(printf, 1, 2)));
static void fail(const char *format, ...) __attribute__((format(printf, 1, 2)));
-
static void pass(const char *format, ...)
{
/* va_list args;
@@ -59,7 +58,6 @@ static void fail(const char *format, ...)
fails++;
}
-
static const char *
error_code_to_string(MPErrorCode error)
{
@@ -72,7 +70,6 @@ error_code_to_string(MPErrorCode error)
return error_string;
}
-
static void
Test(char *expression, char *expected, int expected_error, int trailing_digits)
{
@@ -113,14 +110,12 @@ Test(char *expression, char *expected, int expected_error, int trailing_digits)
mp_clear(&result);
}
-
static int
do_convert(const MPNumber *x, const char *x_units, const char *z_units, MPNumber *z, void *data)
{
return unit_manager_convert_by_symbol(unit_manager_get_default(), x, x_units, z_units, z);
}
-
static void
test_conversions(void)
{
@@ -161,6 +156,105 @@ test_conversions(void)
test("0 K in degC", "−273.15", 0);
}
+static void try(const char* string, bool result, bool expected)
+{
+ if ((result && !expected) || (!result && expected))
+ {
+ fail("%s -> %s, expected %s", string, expected ? "true" : "false", result ? "true" : "false");
+ }
+ else
+ {
+ pass("%s -> %s", string, result ? "true" : "false");
+ }
+}
+
+static void test_mp()
+{
+ MPNumber zero = mp_new();
+ MPNumber one = mp_new();
+ MPNumber minus_one = mp_new();
+ 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);
+
+ try("mp_is_negative(-1)", mp_is_negative(&minus_one), true);
+ try("mp_is_negative(0)", mp_is_negative(&zero), false);
+ try("mp_is_negative(1)", mp_is_negative(&one), false);
+
+ try("mp_is_integer(-1)", mp_is_integer(&minus_one), true);
+ try("mp_is_integer(0)", mp_is_integer(&zero), true);
+ try("mp_is_integer(1)", mp_is_integer(&one), true);
+
+ try("mp_is_positive_integer(-1)", mp_is_positive_integer(&minus_one), false);
+ try("mp_is_positive_integer(0)", mp_is_positive_integer(&zero), true);
+ try("mp_is_positive_integer(1)", mp_is_positive_integer(&one), true);
+
+ try("mp_is_natural(-1)", mp_is_natural(&minus_one), false);
+ try("mp_is_natural(0)", mp_is_natural(&zero), false);
+ try("mp_is_natural(1)", mp_is_natural(&one), true);
+
+ try("mp_is_complex(-1)", mp_is_complex(&minus_one), false);
+ try("mp_is_complex(0)", mp_is_complex(&zero), false);
+ try("mp_is_complex(1)", mp_is_complex(&one), false);
+
+ try("mp_is_equal(-1, -1)", mp_is_equal(&minus_one, &minus_one), true);
+ try("mp_is_equal(-1, 0)", mp_is_equal(&minus_one, &zero), false);
+ try("mp_is_equal(-1, 1)", mp_is_equal(&minus_one, &one), false);
+ try("mp_is_equal(0, -1)", mp_is_equal(&zero, &minus_one), false);
+ try("mp_is_equal(0, 0)", mp_is_equal(&zero, &zero), true);
+ try("mp_is_equal(0, 1)", mp_is_equal(&zero, &one), false);
+ try("mp_is_equal(1, -1)", mp_is_equal(&one, &minus_one), false);
+ 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, 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, 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, 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, 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);
+ try("mp_is_greater_equal(1, 0)", mp_is_greater_equal (&one, &zero), true);
+ try("mp_is_greater_equal(1, 1)", mp_is_greater_equal (&one, &one), true);
+ try("mp_is_greater_equal(-1, -1)", mp_is_greater_equal (&minus_one, &minus_one), true);
+ 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, 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, 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, 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, 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, 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, 0)", mp_is_less_equal (&minus_one, &zero), true);
+ try("mp_is_less_equal(-1, 1)", mp_is_less_equal (&minus_one, &one), true);
+
+ mp_clear(&zero);
+ mp_clear(&one);
+ mp_clear(&minus_one);
+}
static int
variable_is_defined(const char *name, void *data)
@@ -168,7 +262,6 @@ variable_is_defined(const char *name, void *data)
return strcmp (name, "x") == 0 || strcmp (name, "y") == 0;
}
-
static int
get_variable(const char *name, MPNumber *z, void *data)
{
@@ -183,7 +276,6 @@ get_variable(const char *name, MPNumber *z, void *data)
return 0;
}
-
static void
set_variable(const char *name, const MPNumber *x, void *data)
{
@@ -476,6 +568,7 @@ test_equations(void)
test("2^0.5", "1.414213562", 0);
test("₃√−8", "−2", 0);
test("(−8)^(1÷3)", "−2", 0);
+ test("e^-2^-5", "0.969233234", 0);
test("0 mod 7", "0", 0);
test("6 mod 7", "6", 0);
@@ -680,12 +773,12 @@ test_equations(void)
//test("¬¬10₂", "10₂", 0);
}
-
int
-main (int argc, char **argv)
+main (void)
{
setlocale(LC_ALL, "C");
+ test_mp();
test_conversions();
test_equations();
if (fails == 0)
diff --git a/src/test-mp.c b/src/test-mp.c
index c66185c..f367093 100644
--- a/src/test-mp.c
+++ b/src/test-mp.c
@@ -27,7 +27,6 @@ static int passes = 0;
static void pass(const char *format, ...) __attribute__((format(printf, 1, 2)));
static void fail(const char *format, ...) __attribute__((format(printf, 1, 2)));
-
static void pass(const char *format, ...)
{
/* va_list args;
@@ -53,7 +52,6 @@ static void fail(const char *format, ...)
fails++;
}
-
static void
print_number(MPNumber *x)
{
@@ -86,7 +84,6 @@ test_integer(int number)
mp_clear(&t);
}
-
static void
test_numbers(void)
{
@@ -119,7 +116,6 @@ test_numbers(void)
test_string("16384.00006103515625");
}
-
static void
try(const char *string, bool result, bool expected)
{
@@ -129,7 +125,6 @@ try(const char *string, bool result, bool expected)
pass("%s -> %s", string, result ? "true" : "false");
}
-
static void
test_mp(void)
{
@@ -219,9 +214,8 @@ test_mp(void)
mp_clear(&minus_one);
}
-
int
-main (int argc, char **argv)
+main (void)
{
setlocale(LC_ALL, "C");
diff --git a/src/unit-category.c b/src/unit-category.c
index 72f50d5..a19b68b 100644
--- a/src/unit-category.c
+++ b/src/unit-category.c
@@ -22,7 +22,6 @@ struct UnitCategoryPrivate
G_DEFINE_TYPE_WITH_PRIVATE (UnitCategory, unit_category, G_TYPE_OBJECT);
-
UnitCategory *
unit_category_new(const gchar *name, const gchar *display_name)
{
@@ -32,7 +31,6 @@ unit_category_new(const gchar *name, const gchar *display_name)
return category;
}
-
const gchar *
unit_category_get_name(UnitCategory *category)
{
@@ -40,7 +38,6 @@ unit_category_get_name(UnitCategory *category)
return category->priv->name;
}
-
const gchar *
unit_category_get_display_name(UnitCategory *category)
{
@@ -48,7 +45,6 @@ unit_category_get_display_name(UnitCategory *category)
return category->priv->display_name;
}
-
void
unit_category_add_unit(UnitCategory *category, Unit *unit)
{
@@ -57,7 +53,6 @@ unit_category_add_unit(UnitCategory *category, Unit *unit)
category->priv->units = g_list_append(category->priv->units, g_object_ref(unit));
}
-
Unit *
unit_category_get_unit_by_name(UnitCategory *category, const gchar *name)
{
@@ -76,7 +71,6 @@ unit_category_get_unit_by_name(UnitCategory *category, const gchar *name)
return NULL;
}
-
Unit *
unit_category_get_unit_by_symbol(UnitCategory *category, const gchar *symbol)
{
@@ -94,7 +88,6 @@ unit_category_get_unit_by_symbol(UnitCategory *category, const gchar *symbol)
return NULL;
}
-
const GList *
unit_category_get_units(UnitCategory *category)
{
@@ -102,9 +95,8 @@ unit_category_get_units(UnitCategory *category)
return category->priv->units;
}
-
gboolean
-unit_category_convert(UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z)
+unit_category_convert(const UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z)
{
g_return_val_if_fail (category != NULL, FALSE);
g_return_val_if_fail (x_units != NULL, FALSE);
@@ -126,13 +118,11 @@ unit_category_convert(UnitCategory *category, const MPNumber *x, Unit *x_units,
return TRUE;
}
-
static void
unit_category_class_init(UnitCategoryClass *klass)
{
}
-
static void
unit_category_init(UnitCategory *category)
{
diff --git a/src/unit-category.h b/src/unit-category.h
index c5e699c..76c375b 100644
--- a/src/unit-category.h
+++ b/src/unit-category.h
@@ -49,7 +49,7 @@ void unit_category_add_unit(UnitCategory *category, Unit *unit);
const GList *unit_category_get_units(UnitCategory *category);
-gboolean unit_category_convert(UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z);
+gboolean unit_category_convert(const UnitCategory *category, const MPNumber *x, Unit *x_units, Unit *z_units, MPNumber *z);
G_END_DECLS
diff --git a/src/unit-manager.c b/src/unit-manager.c
index cb81045..91ec8b6 100644
--- a/src/unit-manager.c
+++ b/src/unit-manager.c
@@ -22,17 +22,14 @@ struct UnitManagerPrivate
G_DEFINE_TYPE_WITH_PRIVATE (UnitManager, unit_manager, G_TYPE_OBJECT);
-
static UnitManager *default_unit_manager = NULL;
-
static gint
compare_currencies(gconstpointer a, gconstpointer b)
{
return strcmp(currency_get_display_name((Currency *)a), currency_get_display_name((Currency *)b));
}
-
UnitManager *
unit_manager_get_default(void)
{
@@ -145,7 +142,6 @@ unit_manager_get_default(void)
return default_unit_manager;
}
-
UnitCategory *
unit_manager_add_category(UnitManager *manager, const gchar *name, const gchar *display_name)
{
@@ -162,7 +158,6 @@ unit_manager_add_category(UnitManager *manager, const gchar *name, const gchar *
return category;
}
-
const GList *
unit_manager_get_categories(UnitManager *manager)
{
@@ -170,7 +165,6 @@ unit_manager_get_categories(UnitManager *manager)
return manager->priv->categories;
}
-
UnitCategory *
unit_manager_get_category(UnitManager *manager, const gchar *category)
{
@@ -188,7 +182,6 @@ unit_manager_get_category(UnitManager *manager, const gchar *category)
return NULL;
}
-
Unit *
unit_manager_get_unit_by_name(UnitManager *manager, const gchar *name)
{
@@ -208,7 +201,6 @@ unit_manager_get_unit_by_name(UnitManager *manager, const gchar *name)
return NULL;
}
-
Unit *
unit_manager_get_unit_by_symbol(UnitManager *manager, const gchar *symbol)
{
@@ -228,7 +220,6 @@ unit_manager_get_unit_by_symbol(UnitManager *manager, const gchar *symbol)
return NULL;
}
-
gboolean
unit_manager_convert_by_symbol(UnitManager *manager, const MPNumber *x, const char *x_symbol, const char *z_symbol, MPNumber *z)
{
@@ -253,13 +244,11 @@ unit_manager_convert_by_symbol(UnitManager *manager, const MPNumber *x, const ch
return FALSE;
}
-
static void
unit_manager_class_init(UnitManagerClass *klass)
{
}
-
static void
unit_manager_init(UnitManager *manager)
{
diff --git a/src/unit.c b/src/unit.c
index 8f33a10..35dcca5 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -29,7 +29,6 @@ struct UnitPrivate
G_DEFINE_TYPE_WITH_PRIVATE (Unit, unit, G_TYPE_OBJECT);
-
Unit *
unit_new(const gchar *name,
const gchar *display_name,
@@ -49,13 +48,12 @@ unit_new(const gchar *name,
unit->priv->to_function = g_strdup(to_function);
symbol_names = g_strsplit(symbols, ",", 0);
for (i = 0; symbol_names[i]; i++)
- unit->priv->symbols = g_list_append(unit->priv->symbols, g_strdup(symbol_names[i]));
+ unit->priv->symbols = g_list_append(unit->priv->symbols, symbol_names[i]);
g_free(symbol_names);
return unit;
}
-
const gchar *
unit_get_name(Unit *unit)
{
@@ -63,7 +61,6 @@ unit_get_name(Unit *unit)
return unit->priv->name;
}
-
const gchar *
unit_get_display_name(Unit *unit)
{
@@ -71,7 +68,6 @@ unit_get_display_name(Unit *unit)
return unit->priv->display_name;
}
-
gboolean
unit_matches_symbol(Unit *unit, const gchar *symbol)
{
@@ -89,7 +85,6 @@ unit_matches_symbol(Unit *unit, const gchar *symbol)
return FALSE;
}
-
const GList *
unit_get_symbols(Unit *unit)
{
@@ -97,14 +92,12 @@ unit_get_symbols(Unit *unit)
return unit->priv->symbols;
}
-
static int
variable_is_defined(const char *name, void *data)
{
return TRUE;
}
-
static int
get_variable(const char *name, MPNumber *z, void *data)
{
@@ -113,7 +106,6 @@ get_variable(const char *name, MPNumber *z, void *data)
return TRUE;
}
-
static gboolean
solve_function(const gchar *function, const MPNumber *x, MPNumber *z)
{
@@ -135,7 +127,6 @@ solve_function(const gchar *function, const MPNumber *x, MPNumber *z)
return TRUE;
}
-
gboolean
unit_convert_from(Unit *unit, const MPNumber *x, MPNumber *z)
{
@@ -157,7 +148,6 @@ unit_convert_from(Unit *unit, const MPNumber *x, MPNumber *z)
}
}
-
gboolean
unit_convert_to(Unit *unit, const MPNumber *x, MPNumber *z)
{
@@ -179,7 +169,6 @@ unit_convert_to(Unit *unit, const MPNumber *x, MPNumber *z)
}
}
-
gchar *
unit_format(Unit *unit, MPNumber *x)
{
@@ -195,13 +184,11 @@ unit_format(Unit *unit, MPNumber *x)
return text;
}
-
static void
unit_class_init(UnitClass *klass)
{
}
-
static void
unit_init(Unit *unit)
{
diff --git a/src/unittest.c b/src/unittest.c
deleted file mode 100644
index 5039115..0000000
--- a/src/unittest.c
+++ /dev/null
@@ -1,766 +0,0 @@
-/* Copyright (c) 2008-2009 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, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "unittest.h"
-#include "mp-equation.h"
-
-static MPEquationOptions options;
-
-static int fails = 0;
-
-/* If we're not using GNU C, elide __attribute__ */
-#ifndef __GNUC__
- #define __attribute__(x) /*NOTHING*/
-#endif
-
-static void pass(const char* format, ...) __attribute__((format(printf, 1, 2)));
-static void fail(const char* format, ...) __attribute__((format(printf, 1, 2)));
-
-static void pass(const char* format, ...)
-{
- va_list args;
-
- printf(" PASS: ");
- va_start(args, format);
- vprintf(format, args);
- va_end(args);
- printf("\n");
-}
-
-static void fail(const char* format, ...)
-{
- va_list args;
-
- printf("*FAIL: ");
- va_start(args, format);
- vprintf(format, args);
- va_end(args);
- printf("\n");
- fails++;
-}
-
-
-static const char* error_code_to_string(MPErrorCode error)
-{
- static char error_string[1024];
-
- if (error != PARSER_ERR_MP)
- {
- return mp_error_code_to_string(error);
- }
-
- snprintf(error_string, 1024, "PARSER_ERR_MP(\"%s\")", mp_get_error());
- return error_string;
-}
-
-
-static void test(char* expression, char* expected, int expected_error)
-{
- MPErrorCode error;
- MPNumber result = mp_new();
- char result_str[1024] = "";
-
- error = mp_equation_parse(expression, &options, &result, NULL);
-
- if (error == 0)
- {
- mp_cast_to_string(&result, options.base, options.base, 9, 1, result_str, 1024);
-
- if (expected_error != 0)
- {
- fail("'%s' -> %s, expected error %s", expression, result_str, error_code_to_string(expected_error));
- }
- else if(strcmp(result_str, expected) != 0)
- {
- fail("'%s' -> '%s', expected '%s'", expression, result_str, expected);
- }
- else
- {
- pass("'%s' -> '%s'", expression, result_str);
- }
- }
- else
- {
- if (error == expected_error)
- {
- pass("'%s' -> error %s", expression, error_code_to_string(error));
- }
- else
- {
- fail("'%s' -> error %s, expected error %s", expression, error_code_to_string(error), error_code_to_string(expected_error));
- }
- }
- mp_clear(result);
-}
-
-
-static void test_conversions()
-{
- memset(&options, 0, sizeof(options));
- options.base = 10;
- options.wordlen = 32;
- options.angle_units = MP_DEGREES;
-
- /* Length */
- 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);
-
- /* Weight */
- test("1 kg in pounds", "2.204622622", 0);
-
- /* Time */
- test("1 minute in seconds", "60", 0);
-}
-
-
-static int variable_is_defined(const char* name, void* data)
-{
- return strcmp (name, "x") == 0 || strcmp (name, "y") == 0;
-}
-
-
-static int get_variable(const char* name, MPNumber* z, void* data)
-{
- if (strcmp (name, "x") == 0)
- {
- mp_set_from_integer (2, z);
- return 1;
- }
-
- if (strcmp (name, "y") == 0)
- {
- mp_set_from_integer (3, z);
- return 1;
- }
-
- return 0;
-}
-
-
-static void set_variable(const char* name, const MPNumber* x, void* data)
-{
- /* nothing */
-}
-
-static void test_equations()
-{
- memset(&options, 0, sizeof(options));
- options.base = 10;
- options.wordlen = 32;
- options.angle_units = MP_DEGREES;
- options.variable_is_defined = variable_is_defined;
- options.get_variable = get_variable;
- options.set_variable = set_variable;
-
- options.base = 2;
- test("2₁₀", "10", 0);
-
- options.base = 8;
- test("16434824₁₀", "76543210", 0);
-
- options.base = 16;
- test("FF", "FF", 0);
- test("18364758544493064720₁₀", "FEDCBA9876543210", 0);
-
- options.base = 10;
- test("0₂", "0", 0); test("0₈", "0", 0); test("0", "0", 0); test("0₁₆", "0", 0);
- test("1₂", "1", 0); test("1₈", "1", 0); test("1", "1", 0); test("1₁₆", "1", 0);
- test("2₂", "", PARSER_ERR_INVALID); test("2₈", "2", 0); test("2", "2", 0); test("2₁₆", "2", 0);
- test("3₂", "", PARSER_ERR_INVALID); test("3₈", "3", 0); test("3", "3", 0); test("3₁₆", "3", 0);
- test("4₂", "", PARSER_ERR_INVALID); test("4₈", "4", 0); test("4", "4", 0); test("4₁₆", "4", 0);
- test("5₂", "", PARSER_ERR_INVALID); test("5₈", "5", 0); test("5", "5", 0); test("5₁₆", "5", 0);
- test("6₂", "", PARSER_ERR_INVALID); test("6₈", "6", 0); test("6", "6", 0); test("6₁₆", "6", 0);
- test("7₂", "", PARSER_ERR_INVALID); test("7₈", "7", 0); test("7", "7", 0); test("7₁₆", "7", 0);
- test("8₂", "", PARSER_ERR_INVALID); test("8₈", "", PARSER_ERR_INVALID); test("8", "8", 0); test("8₁₆", "8", 0);
- test("9₂", "", PARSER_ERR_INVALID); test("9₈", "", PARSER_ERR_INVALID); test("9", "9", 0); test("9₁₆", "9", 0);
- test("A₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("A₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("A", "", PARSER_ERR_UNKNOWN_VARIABLE); test("A₁₆", "10", 0);
- test("B₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("B₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("B", "", PARSER_ERR_UNKNOWN_VARIABLE); test("B₁₆", "11", 0);
- test("C₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("C₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("C", "", PARSER_ERR_UNKNOWN_VARIABLE); test("C₁₆", "12", 0);
- test("D₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("D₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("D", "", PARSER_ERR_UNKNOWN_VARIABLE); test("D₁₆", "13", 0);
- test("E₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("E₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("E", "", PARSER_ERR_UNKNOWN_VARIABLE); test("E₁₆", "14", 0);
- test("F₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("F₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("F", "", PARSER_ERR_UNKNOWN_VARIABLE); test("F₁₆", "15", 0);
- test("a₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("a₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("a", "", PARSER_ERR_UNKNOWN_VARIABLE); test("a₁₆", "10", 0);
- test("b₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("b₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("b", "", PARSER_ERR_UNKNOWN_VARIABLE); test("b₁₆", "11", 0);
- test("c₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("c₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("c", "", PARSER_ERR_UNKNOWN_VARIABLE); test("c₁₆", "12", 0);
- test("d₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("d₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("d", "", PARSER_ERR_UNKNOWN_VARIABLE); test("d₁₆", "13", 0);
- test("e₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("e₈", "", PARSER_ERR_UNKNOWN_VARIABLE); /* e is a built-in variable */ test("e₁₆", "14", 0);
- test("f₂", "", PARSER_ERR_UNKNOWN_VARIABLE); test("f₈", "", PARSER_ERR_UNKNOWN_VARIABLE); test("f", "", PARSER_ERR_UNKNOWN_VARIABLE); test("f₁₆", "15", 0);
-
- test("+1", "1", 0);
- test("−1", "−1", 0);
- test("+ 1", "1", 0); // FIXME: Should this be allowed?
- test("− 1", "−1", 0); // FIXME: Should this be allowed?
- test("++1", "1", PARSER_ERR_INVALID);
- test("−−1", "1", 0);
- test("255", "255", 0);
- test("256", "256", 0);
- test("½", "0.5", 0);
- test("1½", "1.5", 0);
- test("0°", "0", 0);
- test("1°", "1", 0);
- test("0°30'", "0.5", 0);
- //test("0°0.1'", "1", 0); // FIXME: Not yet supported
- test("0°0'1\"", "0.000277778", 0);
- test("0°0'0.1\"", "0.000027778", 0);
- test("1.00", "1", 0);
- test("1.01", "1.01", 0);
-
- test("١٢٣٤٥٦٧٨٩٠", "1234567890", 0);
- test("۱۲۳۴۵۶۷۸۹۰", "1234567890", 0);
-
-/*
- //test("2A", "2000000000000000", 0);
- test("2T", "2000000000000", 0);
- test("2G", "2000000000", 0);
- test("2M", "2000000", 0);
- test("2k", "2000", 0);
- test("2c", "0.02", 0);
- test("2d", "0.2", 0);
- test("2c", "0.02", 0);
- test("2m", "0.002", 0);
- test("2u", "0.000002", 0);
- test("2µ", "0.000002", 0);
- test("2n", "0.000000002", 0);
- //test("2p", "0.000000000002", 0); // FIXME: Need to print out significant figures, not decimal places
- //test("2f", "0.000000000000002", 0); // FIXME: Need to print out significant figures, not decimal places
- //test("2A3", "2300000000000000", 0);
- test("2T3", "2300000000000", 0);
- test("2G3", "2300000000", 0);
- test("2M3", "2300000", 0);
- test("2k3", "2300", 0);
- test("2c3", "0.023", 0);
- test("2d3", "0.23", 0);
- test("2c3", "0.023", 0);
- test("2m3", "0.0023", 0);
- test("2u3", "0.0000023", 0);
- test("2µ3", "0.0000023", 0);
- //test("2n3", "0.0000000023", 0); // FIXME: Need to print out significant figures, not decimal places
- //test("2p3", "0.0000000000023", 0); // FIXME: Need to print out significant figures, not decimal places
- //test("2f3", "0.0000000000000023", 0); // FIXME: Need to print out significant figures, not decimal places
-*/
-
- test("2×10^3", "2000", 0);
- test("2×10^−3", "0.002", 0);
-
- test("x", "2", 0);
- test("y", "3", 0);
- test("z", "", PARSER_ERR_UNKNOWN_VARIABLE);
- test("2y", "6", 0);
- test("y2", "", PARSER_ERR_INVALID);
- test("y 2", "", PARSER_ERR_INVALID);
- 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);
- test("y²", "9", 0);
- test("2y²", "18", 0);
- test("x×y", "6", 0);
- test("xy", "6", 0);
- test("yx", "6", 0);
- test("2xy", "12", 0);
- test("x²y", "12", 0);
- test("xy²", "18", 0);
- test("(xy)²", "36", 0);
- test("2x²y", "24", 0);
- test("2xy²", "36", 0);
- test("2x²y²", "72", 0);
- test("x²yx²y", "144", 0);
- test("x³+2x²−5", "11", 0);
- test("2(x+3y)", "22", 0);
- test("x(x+3y)", "22", 0);
- test("(x+3y)(2x-4y)", "−88", 0);
- test("2x²+2xy−12y²", "−88", 0);
-
- test("π", "3.141592654", 0);
- test("e", "2.718281828", 0);
-
- test("z=99", "99", 0);
- test("longname=99", "99", 0);
- //test("e=99", "", PARSER_ERR_BUILTIN_VARIABLE);
-
- test("0+0", "0", 0);
- test("1+1", "2", 0);
- test("1+4", "5", 0);
- test("4+1", "5", 0);
- test("40000+0.001", "40000.001", 0);
- test("0.001+40000", "40000.001", 0);
- test("2-3", "−1", 0);
- test("2−3", "−1", 0);
- test("3−2", "1", 0);
- test("40000−0.001", "39999.999", 0);
- test("0.001−40000", "−39999.999", 0);
- test("2*3", "6", 0);
- test("2×3", "6", 0);
- test("−2×3", "−6", 0);
- test("2×−3", "−6", 0);
- test("−2×−3", "6", 0);
- test("6/3", "2", 0);
- test("6÷3", "2", 0);
- test("1÷2", "0.5", 0);
- test("−6÷3", "−2", 0);
- test("6÷−3", "−2", 0);
- test("−6÷−3", "2", 0);
- test("(−3)÷(−6)", "0.5", 0);
- test("2÷2", "1", 0);
- test("1203÷1", "1203", 0);
- test("−0÷32352.689", "0", 0);
- test("1÷4", "0.25", 0);
- test("1÷3", "0.333333333", 0);
- test("2÷3", "0.666666667", 0);
- test("1÷0", "", PARSER_ERR_MP);
- test("0÷0", "", PARSER_ERR_MP);
-
- /* Precision */
- test("1000000000000000−1000000000000000", "0", 0);
- test("1000000000000000÷1000000000000000", "1", 0);
- test("1000000000000000×0.000000000000001", "1", 0);
-
- /* Order of operations */
- test("1−0.9−0.1", "0", 0);
- test("1+2×3", "7", 0);
- test("1+(2×3)", "7", 0);
- test("(1+2)×3", "9", 0);
- test("(1+2×3)", "7", 0);
-
- /* Percentage */
- test("100%", "1", 0);
- test("1%", "0.01", 0);
- test("100+1%", "101", 0);
- test("100−1%", "99", 0);
- test("100×1%", "1", 0);
- test("100÷1%", "10000", 0);
-
- /* Factorial */
- test("0!", "1", 0);
- test("1!", "1", 0);
- test("5!", "120", 0);
- test("69!", "171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000", 0);
- test("0.1!", "", PARSER_ERR_MP);
- test("−1!", "−1", 0);
- test("(−1)!", "", PARSER_ERR_MP);
- test("−(1!)", "−1", 0);
-
- /* Powers */
- test("2²", "4", 0);
- test("2³", "8", 0);
- test("2¹⁰", "1024", 0);
- test("(1+2)²", "9", 0);
- test("(x)²", "4", 0);
- test("|1−3|²", "4", 0);
- test("|x|²", "4", 0);
- test("0^0", "1", 0);
- test("2^0", "1", 0);
- test("2^1", "2", 0);
- test("2^2", "4", 0);
- test("2⁻¹", "0.5", 0);
- //test("2⁻", "", PARSER_ERR_MP); // FIXME: Maybe an error in bison?
- test("2^−1", "0.5", 0);
- test("2^(−1)", "0.5", 0);
- test("x⁻¹", "0.5", 0);
- test("−10^2", "−100", 0);
- test("(−10)^2", "100", 0);
- test("−(10^2)", "−100", 0);
- test("2^100", "1267650600228229401496703205376", 0);
- test("4^3^2", "262144", 0);
- test("4^(3^2)", "262144", 0);
- test("(4^3)^2", "4096", 0);
- test("√4", "2", 0);
- test("√4−2", "0", 0);
- test("∛8", "2", 0);
- test("∜16", "2", 0);
- test("₃√8", "2", 0);
- test("₁₀√1024", "2", 0);
- test("√(2+2)", "2", 0);
- test("2√4", "4", 0);
- test("2×√4", "4", 0);
- test("Sqrt(4)", "2", 0);
- test("Sqrt(2)", "1.414213562", 0);
- test("4^0.5", "2", 0);
- test("2^0.5", "1.414213562", 0);
- test("₃√−8", "−2", 0);
- test("(−8)^(1÷3)", "−2", 0);
-
- test("0 mod 7", "0", 0);
- test("6 mod 7", "6", 0);
- test("7 mod 7", "0", 0);
- test("8 mod 7", "1", 0);
- test("−1 mod 7", "6", 0);
-
- test("sgn 0", "0", 0);
- test("sgn 3", "1", 0);
- test("sgn −3", "−1", 0);
- test("⌊3⌋", "3", 0);
- test("⌈3⌉", "3", 0);
- test("[3]", "3", 0);
- test("⌊−3⌋", "−3", 0);
- test("⌈−3⌉", "−3", 0);
- test("[−3]", "−3", 0);
- test("⌊3.2⌋", "3", 0);
- test("⌈3.2⌉", "4", 0);
- test("[3.2]", "3", 0);
- test("⌊−3.2⌋", "−4", 0);
- test("⌈−3.2⌉", "−3", 0);
- test("[−3.2]", "−3", 0);
- test("⌊3.5⌋", "3", 0);
- test("⌈3.5⌉", "4", 0);
- test("[3.5]", "4", 0);
- test("⌊−3.5⌋", "−4", 0);
- test("⌈−3.5⌉", "−3", 0);
- test("[−3.5]", "−4", 0);
- test("⌊3.7⌋", "3", 0);
- test("⌈3.7⌉", "4", 0);
- test("[3.7]", "4", 0);
- test("⌊−3.7⌋", "−4", 0);
- test("⌈−3.7⌉", "−3", 0);
- test("[−3.7]", "−4", 0);
- test("{3.2}", "0.2", 0);
- test("{−3.2}", "0.8", 0);
-
- test("|1|", "1", 0);
- test("|−1|", "1", 0);
- test("|3−5|", "2", 0);
- test("|x|", "2", 0);
- test("abs 1", "1", 0);
- test("abs (−1)", "1", 0);
-
- test("log 0", "", PARSER_ERR_MP);
- test("log 1", "0", 0);
- test("log 2", "0.301029996", 0);
- test("log 10", "1", 0);
- test("log₁₀ 10", "1", 0);
- test("log₂ 2", "1", 0);
- test("2 log 2", "0.602059991", 0);
-
- test("ln 0", "", PARSER_ERR_MP);
- test("ln 1", "0", 0);
- test("ln 2", "0.693147181", 0);
- test("ln e", "1", 0);
- test("2 ln 2", "1.386294361", 0);
-
- options.angle_units = MP_DEGREES;
- test("sin 0", "0", 0);
- test("sin 45 − 1÷√2", "0", 0);
- test("sin 20 + sin(−20)", "0", 0);
- test("sin 90", "1", 0);
- test("sin 180", "0", 0);
- test("2 sin 90", "2", 0);
- test("sin²45", "0.5", 0);
-
- test("cos 0", "1", 0);
- test("cos 45 − 1÷√2", "0", 0);
- test("cos 20 − cos (−20)", "0", 0);
- test("cos 90", "0", 0);
- test("cos 180", "−1", 0);
- test("2 cos 0", "2", 0);
- test("cos²45", "0.5", 0);
-
- test("tan 0", "0", 0);
- test("tan 10 − sin 10÷cos 10", "0", 0);
- test("tan 90", "", PARSER_ERR_MP);
- test("tan 10", "0.176326981", 0);
- test("tan²10", "0.031091204", 0);
-
- test("cos⁻¹ 0", "90", 0);
- test("cos⁻¹ 1", "0", 0);
- test("cos⁻¹ (−1)", "180", 0);
- test("cos⁻¹ (1÷√2)", "45", 0);
-
- test("sin⁻¹ 0", "0", 0);
- test("sin⁻¹ 1", "90", 0);
- test("sin⁻¹ (−1)", "−90", 0);
- test("sin⁻¹ (1÷√2)", "45", 0);
-
- test("cosh 0", "1", 0);
- test("cosh 10 − (e^10 + e^−10)÷2", "0", 0);
-
- test("sinh 0", "0", 0);
- test("sinh 10 − (e^10 − e^−10)÷2", "0", 0);
- test("sinh (−10) + sinh 10", "0", 0);
-
- test("cosh² (−5) − sinh² (−5)", "1", 0);
- test("tanh 0", "0", 0);
- test("tanh 10 − sinh 10 ÷ cosh 10", "0", 0);
-
- test("atanh 0", "0", 0);
- test("atanh (1÷10) − 0.5 ln(11÷9)", "0", 0);
-
- options.angle_units = MP_DEGREES;
- test("sin 90", "1", 0);
-
- options.angle_units = MP_RADIANS;
- test("sin (π÷2)", "1", 0); // FIXME: Shouldn't need brackets
-
- options.angle_units = MP_GRADIANS;
- test("sin 100", "1", 0);
-
- /* Complex numbers */
- options.angle_units = MP_DEGREES;
- test("i", "i", 0);
- test("−i", "−i", 0);
- test("2i", "2i", 0);
- test("1+i", "1+i", 0);
- test("i+1", "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 1", "0", 0);
- test("arg (1+i)", "45", 0);
- test("arg i", "90", 0);
- test("arg (−1+i)", "135", 0);
- test("arg −1", "180", 0);
- test("arg (1+−i)", "−45", 0);
- test("arg −i", "−90", 0);
- test("arg (−1−i)", "−135", 0);
- test("i⁻¹", "−i", 0);
- test("√−1", "i", 0);
- test("(−1)^0.5", "i", 0);
- test("√−4", "2i", 0);
- test("e^iπ", "−1", 0);
- test("log (−10) − (1 + πi÷ln(10))", "0", 0);
- test("ln (−e) − (1 + πi)", "0", 0);
- test("sin(iπ÷4) − i×sinh(π÷4)", "0", 0);
- test("cos(iπ÷4) − cosh(π÷4)", "0", 0);
-
- /* Boolean */
- test("0 and 0", "0", 0);
- test("1 and 0", "0", 0);
- test("0 and 1", "0", 0);
- test("1 and 1", "1", 0);
- test("3 and 5", "1", 0);
-
- test("0 or 0", "0", 0);
- test("1 or 0", "1", 0);
- test("0 or 1", "1", 0);
- test("1 or 1", "1", 0);
- test("3 or 5", "7", 0);
-
- test("0 xor 0", "0", 0);
- test("1 xor 0", "1", 0);
- test("0 xor 1", "1", 0);
- test("1 xor 1", "0", 0);
- test("3 xor 5", "6", 0);
-
- options.base = 16;
- test("ones 1", "FFFFFFFE", 0);
- test("ones 7FFFFFFF", "80000000", 0);
- test("twos 1", "FFFFFFFF", 0);
- test("twos 7FFFFFFF", "80000001", 0);
- test("~7A₁₆", "FFFFFF85", 0);
-
- options.base = 2;
- options.wordlen = 4;
- test("1100∧1010", "1000", 0);
- test("1100∨1010", "1110", 0);
- test("1100⊻1010", "110", 0);
- test("1100⊕1010", "110", 0);
- //test("1100⊼1010", "0111", 0);
- //test("1100⊽1010", "0001", 0);
- //options.wordlen = 2;
- //test("¬01₂", "10₂", 0);
- //test("¬¬10₂", "10₂", 0);
-}
-
-
-static void print_number(MPNumber* x)
-{
- mpc_out_str(stdout, 10, 5, x->num, MPC_RNDNN);
-}
-
-static void test_string(const char* number)
-{
- MPNumber t = mp_new();
-
- mp_set_from_string(number, 10, &t);
-
- printf("MPNumber(%s) -> {", number);
- print_number(&t);
- printf("}\n");
- mp_clear(&t);
-}
-
-static void test_integer(int number)
-{
- MPNumber t = mp_new();
-
- mp_set_from_integer(number, &t);
-
- printf("MPNumber(%d) -> {", number);
- print_number(&t);
- printf("}\n");
- mp_clear(&t);
-}
-
-static void test_numbers()
-{
- test_integer(0);
- test_integer(1);
- test_integer(-1);
- test_integer(2);
- test_integer(9999);
- test_integer(10000);
- test_integer(10001);
- test_integer(2147483647);
-
- test_string("0");
- test_string("1");
- test_string("-1");
- test_string("16383");
- test_string("16384");
- test_string("16385");
- test_string("268435456");
-
- test_string("0.1");
- test_string("0.5");
- test_string("0.25");
- test_string("0.125");
- test_string("0.0625");
- test_string("0.00006103515625");
- test_string("0.000030517578125");
-
- test_string("1.00006103515625");
- test_string("16384.00006103515625");
-}
-
-
-static void try(const char* string, bool result, bool expected)
-{
- if ((result && !expected) || (!result && expected))
- {
- fail("%s -> %s, expected %s", string, expected ? "true" : "false", result ? "true" : "false");
- }
- else
- {
- pass("%s -> %s", string, result ? "true" : "false");
- }
-}
-
-
-static void test_mp()
-{
- MPNumber zero = mp_new();
- MPNumber one = mp_new();
- MPNumber minus_one = mp_new();
- 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);
-
- try("mp_is_negative(-1)", mp_is_negative(&minus_one), true);
- try("mp_is_negative(0)", mp_is_negative(&zero), false);
- try("mp_is_negative(1)", mp_is_negative(&one), false);
-
- try("mp_is_integer(-1)", mp_is_integer(&minus_one), true);
- try("mp_is_integer(0)", mp_is_integer(&zero), true);
- try("mp_is_integer(1)", mp_is_integer(&one), true);
-
- try("mp_is_positive_integer(-1)", mp_is_positive_integer(&minus_one), false);
- try("mp_is_positive_integer(0)", mp_is_positive_integer(&zero), true);
- try("mp_is_positive_integer(1)", mp_is_positive_integer(&one), true);
-
- try("mp_is_natural(-1)", mp_is_natural(&minus_one), false);
- try("mp_is_natural(0)", mp_is_natural(&zero), false);
- try("mp_is_natural(1)", mp_is_natural(&one), true);
-
- try("mp_is_complex(-1)", mp_is_complex(&minus_one), false);
- try("mp_is_complex(0)", mp_is_complex(&zero), false);
- try("mp_is_complex(1)", mp_is_complex(&one), false);
-
- try("mp_is_equal(-1, -1)", mp_is_equal(&minus_one, &minus_one), true);
- try("mp_is_equal(-1, 0)", mp_is_equal(&minus_one, &zero), false);
- try("mp_is_equal(-1, 1)", mp_is_equal(&minus_one, &one), false);
- try("mp_is_equal(0, -1)", mp_is_equal(&zero, &minus_one), false);
- try("mp_is_equal(0, 0)", mp_is_equal(&zero, &zero), true);
- try("mp_is_equal(0, 1)", mp_is_equal(&zero, &one), false);
- try("mp_is_equal(1, -1)", mp_is_equal(&one, &minus_one), false);
- 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, 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, 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, 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, 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);
- try("mp_is_greater_equal(1, 0)", mp_is_greater_equal (&one, &zero), true);
- try("mp_is_greater_equal(1, 1)", mp_is_greater_equal (&one, &one), true);
- try("mp_is_greater_equal(-1, -1)", mp_is_greater_equal (&minus_one, &minus_one), true);
- 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, 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, 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, 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, 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, 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, 0)", mp_is_less_equal (&minus_one, &zero), true);
- try("mp_is_less_equal(-1, 1)", mp_is_less_equal (&minus_one, &one), true);
-
- mp_clear(&zero);
- mp_clear(&one);
- mp_clear(&minus_one);
-}
-
-
-void unittest()
-{
- test_mp();
- test_numbers();
- test_conversions();
- test_equations();
- exit(fails > 0 ? 1 : 0);
-}
diff --git a/src/unittest.h b/src/unittest.h
deleted file mode 100644
index 5101b20..0000000
--- a/src/unittest.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2008-2009 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, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef UNITTEST_H
-#define UNITTEST_H
-
-void unittest(void);
-
-#endif /* UNITTEST_H */
diff --git a/src/utility.h b/src/utility.h
index 91745ed..15d40b2 100644
--- a/src/utility.h
+++ b/src/utility.h
@@ -2,6 +2,7 @@
#define UTILITY_H
#include <glib/gi18n.h>
+#include "config.h"
extern GSettings *g_settings_var;