| --- gnome-calculator-3.33.2/lib/windows.c 1969-12-31 19:00:00.000000000 -0500 |
| +++ gnome-calculator-3.33.2/lib/windows.c 2019-06-15 20:47:07.556692600 -0400 |
| @@ -0,0 +1,23 @@ |
| +#include <string.h> |
| +#include <winnls.h> |
| + |
| +char * |
| +locale_get_tsep () |
| +{ |
| + char tmp[4]; |
| + |
| + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, (LPTSTR)&tmp, 4); |
| + |
| + return strdup(&tmp); |
| +} |
| + |
| +char * |
| +locale_get_decimal () |
| +{ |
| + char tmp[4]; |
| + |
| + GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, (LPTSTR)&tmp, 4); |
| + |
| + return strdup(&tmp); |
| +} |
| + |
| --- gnome-calculator-3.33.2/lib/meson.build.orig 2019-06-15 11:07:07.646632600 -0400 |
| +++ gnome-calculator-3.33.2/lib/meson.build 2019-06-15 12:05:00.736013300 -0400 |
| @@ -1,17 +1,36 @@ |
| -libcalculator_sources = [ |
| - 'currency.vala', |
| - 'equation.vala', |
| - 'equation-lexer.vala', |
| - 'equation-parser.vala', |
| - 'financial.vala', |
| - 'function-manager.vala', |
| - 'math-equation.vala', |
| - 'math-function.vala', |
| - 'math-variables.vala', |
| - 'number.vala', |
| - 'serializer.vala', |
| - 'unit.vala', |
| -] |
| +if target_machine.system() == 'windows' |
| + libcalculator_sources = [ |
| + 'currency.vala', |
| + 'equation.vala', |
| + 'equation-lexer.vala', |
| + 'equation-parser.vala', |
| + 'financial.vala', |
| + 'function-manager.vala', |
| + 'math-equation.vala', |
| + 'math-function.vala', |
| + 'math-variables.vala', |
| + 'number.vala', |
| + 'serializer.vala', |
| + 'unit.vala', |
| + 'windows.c', |
| + ] |
| +else |
| + libcalculator_sources = [ |
| + 'currency.vala', |
| + 'equation.vala', |
| + 'equation-lexer.vala', |
| + 'equation-parser.vala', |
| + 'financial.vala', |
| + 'function-manager.vala', |
| + 'math-equation.vala', |
| + 'math-function.vala', |
| + 'math-variables.vala', |
| + 'number.vala', |
| + 'serializer.vala', |
| + 'unit.vala', |
| + ] |
| +endif |
| + |
| |
| libcalculator_vala_flags = [ |
| '--target-glib', glib_min_version, |
| --- gnome-calculator-3.33.2/lib/math-equation.vala.orig 2019-05-21 02:44:58.000000000 -0400 |
| +++ gnome-calculator-3.33.2/lib/math-equation.vala 2019-06-15 18:58:56.555893000 -0400 |
| @@ -9,6 +9,9 @@ |
| * license. |
| */ |
| |
| +extern string locale_get_tsep (); |
| +extern string locale_get_decimal (); |
| + |
| public enum NumberMode |
| { |
| NORMAL, |
| @@ -495,7 +498,8 @@ public class MathEquation : Gtk.SourceBu |
| get_bounds (out start, out end); |
| |
| var text = get_text (start, end, false); |
| - var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP); |
| + string tsep_string; |
| + tsep_string = locale_get_tsep (); |
| if (tsep_string == null || tsep_string == "") |
| tsep_string = " "; |
| text = text.replace (tsep_string, ""); |
| --- gnome-calculator-3.33.2/lib/serializer.vala.orig 2019-05-21 02:44:58.000000000 -0400 |
| +++ gnome-calculator-3.33.2/lib/serializer.vala 2019-06-15 12:42:46.177283100 -0400 |
| @@ -37,7 +40,8 @@ public class Serializer : Object |
| |
| public Serializer (DisplayFormat format, int number_base, int trailing_digits) |
| { |
| - var radix_string = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR); |
| + string radix_string; |
| + radix_string = locale_get_decimal (); |
| if (radix_string != null && radix_string != "") { |
| var radix_utf8 = radix_string.locale_to_utf8 (-1, null, null); |
| if (radix_utf8 != null) |
| @@ -47,7 +51,8 @@ public class Serializer : Object |
| } |
| else |
| radix = '.'; |
| - var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP); |
| + string tsep_string; |
| + tsep_string = locale_get_tsep (); |
| if (tsep_string != null && tsep_string != "") { |
| var tsep_utf8 = tsep_string.locale_to_utf8 (-1, null, null); |
| if (tsep_utf8 != null) |
| --- gnome-calculator-3.33.2/search-provider/meson.build.orig 2019-06-15 13:02:31.058364900 -0400 |
| +++ gnome-calculator-3.33.2/search-provider/meson.build 2019-06-15 13:09:04.245449500 -0400 |
| @@ -1,6 +1,13 @@ |
| -search_provider_sources = [ |
| - 'search-provider.vala', |
| -] |
| +if target_machine.system() == 'windows' |
| + search_provider_sources = [ |
| + 'search-provider.vala', |
| + join_paths(meson.source_root(), 'lib', 'windows.c'), |
| + ] |
| +else |
| + search_provider_sources = [ |
| + 'search-provider.vala', |
| + ] |
| +endif |
| |
| search_provider_deps = [ |
| gio, |
| --- gnome-calculator-3.33.2/search-provider/search-provider.vala.orig 2019-05-21 02:44:58.000000000 -0400 |
| +++ gnome-calculator-3.33.2/search-provider/search-provider.vala 2019-06-15 13:46:17.030735000 -0400 |
| @@ -10,6 +10,9 @@ |
| * license. |
| */ |
| |
| +extern string locale_get_tsep (); |
| +extern string locale_get_decimal (); |
| + |
| [DBus (name = "org.gnome.Shell.SearchProvider2")] |
| public class SearchProvider : Object |
| { |
| @@ -87,11 +90,13 @@ public class SearchProvider : Object |
| |
| cancel(); |
| |
| - var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP); |
| + string tsep_string; |
| + tsep_string = locale_get_tsep (); |
| if (tsep_string == null || tsep_string == "") |
| tsep_string = " "; |
| |
| - var decimal = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR); |
| + string decimal; |
| + decimal = locale_get_decimal (); |
| if (decimal == null) |
| decimal = ""; |
| |
| --- gnome-calculator-3.33.2/src/gcalccmd.vala.orig 2019-05-21 02:44:58.000000000 -0400 |
| +++ gnome-calculator-3.33.2/src/gcalccmd.vala 2019-06-15 20:23:09.606660800 -0400 |
| @@ -9,17 +9,22 @@ |
| * license. |
| */ |
| |
| +extern string locale_get_tsep (); |
| +extern string locale_get_decimal (); |
| + |
| private const int MAXLINE = 1024; |
| |
| private static Serializer result_serializer; |
| |
| static void solve (string equation) |
| { |
| - var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP); |
| + string tsep_string; |
| + tsep_string = locale_get_tsep (); |
| if (tsep_string == null || tsep_string == "") |
| tsep_string = " "; |
| |
| - var decimal = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR); |
| + string decimal; |
| + decimal = locale_get_decimal (); |
| if (decimal == null) |
| decimal = ""; |
| |
| @@ -65,7 +70,7 @@ public static int main (string[] args) |
| |
| if (args.length == 2) { |
| solve (args[1]); |
| - return Posix.EXIT_SUCCESS; |
| + return 0; |
| } |
| |
| var buffer = new char[1024]; |
| @@ -88,5 +93,5 @@ public static int main (string[] args) |
| if (requires_new_line) |
| stdout.printf ("\n"); |
| |
| - return Posix.EXIT_SUCCESS; |
| + return 0; |
| } |
| --- gnome-calculator-3.33.2/src/gnome-calculator.vala.orig 2019-05-21 02:44:58.000000000 -0400 |
| +++ gnome-calculator-3.33.2/src/gnome-calculator.vala 2019-06-15 19:12:31.282749100 -0400 |
| @@ -9,6 +9,9 @@ |
| * license. |
| */ |
| |
| +extern string locale_get_tsep (); |
| +extern string locale_get_decimal (); |
| + |
| public class Calculator : Gtk.Application |
| { |
| private Settings settings; |
| @@ -198,17 +201,19 @@ public class Calculator : Gtk.Applicatio |
| { |
| /* NOTE: Is not translated so can be easily parsed */ |
| stderr.printf ("%1$s %2$s\n", program_name, VERSION); |
| - return Posix.EXIT_SUCCESS; |
| + return 0; |
| } |
| |
| if (options.contains ("solve")) |
| { |
| var solve_equation = (string) options.lookup_value ("solve", VariantType.STRING); |
| - var tsep_string = Posix.nl_langinfo (Posix.NLItem.THOUSEP); |
| + string tsep_string; |
| + tsep_string = locale_get_tsep (); |
| if (tsep_string == null || tsep_string == "") |
| tsep_string = " "; |
| |
| - var decimal = Posix.nl_langinfo (Posix.NLItem.RADIXCHAR); |
| + string decimal; |
| + decimal = locale_get_decimal (); |
| if (decimal == null) |
| decimal = ""; |
| |
| @@ -230,21 +235,21 @@ public class Calculator : Gtk.Applicatio |
| var eq_result = serializer.to_string (result); |
| if (serializer.error != null) { |
| stderr.printf (serializer.error); |
| - return Posix.EXIT_FAILURE; |
| + return 1; |
| } |
| |
| stdout.printf ("%s\n", eq_result); |
| - return Posix.EXIT_SUCCESS; |
| + return 0; |
| } |
| else if (error == ErrorCode.MP) |
| { |
| stderr.printf ("Error: %s\n", (Number.error != null) ? Number.error : error_token); |
| - return Posix.EXIT_FAILURE; |
| + return 1; |
| } |
| else |
| { |
| stderr.printf ("Error: %s\n", mp_error_code_to_string (error)); |
| - return Posix.EXIT_FAILURE; |
| + return 1; |
| } |
| } |
| |
| --- gnome-calculator-3.33.2/src/meson.build.orig 2019-05-21 02:44:58.000000000 -0400 |
| +++ gnome-calculator-3.33.2/src/meson.build 2019-06-15 18:39:53.708515600 -0400 |
| @@ -1,15 +1,30 @@ |
| # gnome-calculator executable |
| -gnome_calculator_vala_sources = [ |
| - 'gnome-calculator.vala', |
| - 'math-buttons.vala', |
| - 'math-converter.vala', |
| - 'math-display.vala', |
| - 'math-preferences.vala', |
| - 'math-function-popover.vala', |
| - 'math-variable-popover.vala', |
| - 'math-window.vala', |
| - 'math-history.vala', |
| -] |
| +if target_machine.system() == 'windows' |
| + gnome_calculator_vala_sources = [ |
| + 'gnome-calculator.vala', |
| + 'math-buttons.vala', |
| + 'math-converter.vala', |
| + 'math-display.vala', |
| + 'math-preferences.vala', |
| + 'math-function-popover.vala', |
| + 'math-variable-popover.vala', |
| + 'math-window.vala', |
| + 'math-history.vala', |
| + join_paths(meson.source_root(), 'lib', 'windows.c'), |
| + ] |
| +else |
| + gnome_calculator_vala_sources = [ |
| + 'gnome-calculator.vala', |
| + 'math-buttons.vala', |
| + 'math-converter.vala', |
| + 'math-display.vala', |
| + 'math-preferences.vala', |
| + 'math-function-popover.vala', |
| + 'math-variable-popover.vala', |
| + 'math-window.vala', |
| + 'math-history.vala', |
| + ] |
| +endif |
| |
| gnome_calculator_resource_files = files('gnome-calculator.gresource.xml') |
| gnome_calculator_resources = gnome.compile_resources('org.gnome.Calculator', gnome_calculator_resource_files) |
| @@ -57,9 +72,16 @@ executable('gnome-calculator', gnome_cal |
| |
| |
| # gcalccmd executable |
| -gcalccmd_sources = [ |
| - 'gcalccmd.vala', |
| -] |
| +if target_machine.system() == 'windows' |
| + gcalccmd_sources = [ |
| + 'gcalccmd.vala', |
| + join_paths(meson.source_root(), 'lib', 'windows.c'), |
| + ] |
| +else |
| + gcalccmd_sources = [ |
| + 'gcalccmd.vala', |
| + ] |
| +endif |
| |
| gcalccmd_deps = [ |
| gio, |