| 1 |
|
| 2 |
|
| 3 |
t |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#include <glib.h> |
| 20 |
#include <glib/gi18n.h> |
| 21 |
|
| 22 |
#include <stdio.h> |
| 23 |
|
| 24 |
#include "error_strings.h" |
| 25 |
|
| 26 |
|
| 27 |
gchar *no_indata_expected_error = NULL; |
| 28 |
gchar *one_indata_expected_error = NULL; |
| 29 |
gchar *two_indata_expected_error = NULL; |
| 30 |
gchar *four_indata_expected_error = NULL; |
| 31 |
|
| 32 |
gchar *one_or_two_indata_expected_error = NULL; |
| 33 |
|
| 34 |
gchar *number_expected_as_indata_error = NULL; |
| 35 |
gchar *boolean_expected_as_indata_error = NULL; |
| 36 |
|
| 37 |
gchar *string_expected_as_indata_error = NULL; |
| 38 |
|
| 39 |
gchar *integer_greater_than_zero_expected_error = NULL; |
| 40 |
gchar *could_not_find_current_viewport_error = NULL; |
| 41 |
|
| 42 |
gchar *setting_viewport_failed_error = NULL; |
| 43 |
|
| 44 |
gchar *failed_string = NULL; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
int init_script_error_messages() |
| 50 |
{ |
| 51 |
#define ALLOCATE_ERROR_STRING _("Couldn't allocate error string!") |
| 52 |
|
| 53 |
no_indata_expected_error = g_strdup_printf(_("No indata expected")); |
| 54 |
if (!no_indata_expected_error) { |
| 55 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 56 |
printf("\n"); |
| 57 |
return -1; |
| 58 |
} |
| 59 |
|
| 60 |
one_indata_expected_error = g_strdup_printf(_("One indata expected")); |
| 61 |
if (!one_indata_expected_error) { |
| 62 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 63 |
printf("\n"); |
| 64 |
return -1; |
| 65 |
} |
| 66 |
|
| 67 |
two_indata_expected_error = g_strdup_printf(_("Two indata expected")); |
| 68 |
if (!two_indata_expected_error) { |
| 69 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 70 |
printf("\n"); |
| 71 |
return -1; |
| 72 |
} |
| 73 |
|
| 74 |
four_indata_expected_error = g_strdup_printf(_("Four indata expected")); |
| 75 |
if (!four_indata_expected_error) { |
| 76 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 77 |
printf("\n"); |
| 78 |
return -1; |
| 79 |
} |
| 80 |
|
| 81 |
one_or_two_indata_expected_error = g_strdup_printf(_("One or two indata expected")); |
| 82 |
if (!one_or_two_indata_expected_error) { |
| 83 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 84 |
printf("\n"); |
| 85 |
return -1; |
| 86 |
} |
| 87 |
|
| 88 |
number_expected_as_indata_error= |
| 89 |
g_strdup_printf(_("Number expected as indata")); |
| 90 |
if (!number_expected_as_indata_error) { |
| 91 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 92 |
printf("\n"); |
| 93 |
return -1; |
| 94 |
} |
| 95 |
|
| 96 |
boolean_expected_as_indata_error = |
| 97 |
g_strdup_printf(_("Boolean expected as indata")); |
| 98 |
if (!boolean_expected_as_indata_error) { |
| 99 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 100 |
printf("\n"); |
| 101 |
return -1; |
| 102 |
} |
| 103 |
|
| 104 |
string_expected_as_indata_error = |
| 105 |
g_strdup_printf(_("String expected as indata")); |
| 106 |
if (!string_expected_as_indata_error) { |
| 107 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 108 |
printf("\n"); |
| 109 |
return -1; |
| 110 |
} |
| 111 |
|
| 112 |
integer_greater_than_zero_expected_error = |
| 113 |
g_strdup_printf(_("Integer greater than zero expected")); |
| 114 |
if (!integer_greater_than_zero_expected_error) { |
| 115 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 116 |
printf("\n"); |
| 117 |
return -1; |
| 118 |
} |
| 119 |
|
| 120 |
could_not_find_current_viewport_error = |
| 121 |
g_strdup_printf(_("Could not find current viewport")); |
| 122 |
if (!could_not_find_current_viewport_error) { |
| 123 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 124 |
printf("\n"); |
| 125 |
return -1; |
| 126 |
} |
| 127 |
|
| 128 |
setting_viewport_failed_error = |
| 129 |
g_strdup_printf(_("Setting viewport failed")); |
| 130 |
if (!setting_viewport_failed_error) { |
| 131 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 132 |
printf("\n"); |
| 133 |
return -1; |
| 134 |
} |
| 135 |
|
| 136 |
failed_string = g_strdup_printf(_("Failed!")); |
| 137 |
if (!failed_string) { |
| 138 |
printf("%s", ALLOCATE_ERROR_STRING); |
| 139 |
printf("\n"); |
| 140 |
return -1; |
| 141 |
} |
| 142 |
|
| 143 |
return 0; |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
void done_script_error_messages() |
| 151 |
{ |
| 152 |
g_free(no_indata_expected_error); |
| 153 |
g_free(one_indata_expected_error); |
| 154 |
g_free(two_indata_expected_error); |
| 155 |
g_free(four_indata_expected_error); |
| 156 |
|
| 157 |
g_free(one_or_two_indata_expected_error); |
| 158 |
|
| 159 |
g_free(number_expected_as_indata_error); |
| 160 |
g_free(boolean_expected_as_indata_error); |
| 161 |
g_free(string_expected_as_indata_error); |
| 162 |
|
| 163 |
g_free(integer_greater_than_zero_expected_error); |
| 164 |
g_free(could_not_find_current_viewport_error); |
| 165 |
g_free(setting_viewport_failed_error); |
| 166 |
|
| 167 |
g_free(failed_string); |
| 168 |
} |