GnuCash  4.8a-80-g9825132ea+
xlate.pl
Go to the documentation of this file.
1 #! /usr/bin/perl
2 
13 
14 @files = <STDIN>;
15 
16 # print @files;
17 
18 foreach (@files)
19 {
20  chop;
21  $afile= $_;
22  open (AF, $afile);
23  open (OF, "> " . $afile . ".tmp");
24 
25  while (<AF>)
26  {
27 
28  if (0) {
29  s/GNCBook/QofBook/g;
30  s/gnc_book_not_saved/qof_book_not_saved/g;
31  s/gnc_book_get_guid/qof_book_get_guid/g;
32  s/BookList/QofBookList/g;
33  s/gnc_book_get_slots/qof_book_get_slots/g;
34  s/gnc_book_set_guid/qof_book_set_guid/g;
35  s/gnc_book_new/qof_book_new/g;
36 
37 
38  s/GncObject_t/QofObject/g;
39  s/gncObjectLookup/qof_object_lookup/g;
40  s/gncObjectRegister/qof_object_register/g;
41  s/gncObjectGetTypeLabel/qof_object_get_type_label/g;
42  s/gncObjectRegisterBackend/qof_object_register_backend/g;
43  s/gncObjectLookupBackend/qof_object_lookup_backend/g;
44  s/gncObjectForeachBackend/qof_object_foreach_backend/g;
45  s/gncObjectInitialize/qof_object_initialize/g;
46 
47  s/gncObjectShutdown/qof_object_shutdown/g;
48  s/gncObjectBookBegin/qof_object_book_begin/g;
49  s/gncObjectBookEnd/qof_object_book_end/g;
50  s/gncObjectIsDirty/qof_object_is_dirty/g;
51  s/gncObjectMarkClean/qof_object_mark_clean/g;
52 
53  s/gncObjectForeachType/qof_object_foreach_type/g;
54  s/gncObjectForeach/qof_object_foreach/g;
55  s/gncObjectPrintable/qof_object_printable/g;
56 
57  s/foreachTypeCB/QofForeachTypeCB/g;
58  s/foreachBackendTypeCB/QofForeachBackendTypeCB/g;
59 
60  s/gncQueryStringPredicate/qof_query_string_predicate/g;
61  s/gncQueryDatePredicate/qof_query_date_predicate/g;
62  s/gncQueryNumericPredicate/qof_query_numeric_predicate/g;
63  s/gncQueryGUIDPredicate/qof_query_guid_predicate/g;
64  s/gncQueryInt32Predicate/qof_query_int32_predicate/g;
65  s/gncQueryInt64Predicate/qof_query_int64_predicate/g;
66  s/gncQueryDoublePredicate/qof_query_double_predicate/g;
67  s/gncQueryBooleanPredicate/qof_query_boolean_predicate/g;
68  s/gncQueryCharPredicate/qof_query_char_predicate/g;
69  s/gncQueryKVPPredicate/qof_query_kvp_predicate/g;
70  s/gncQueryCorePredicateFree/qof_query_core_predicate_free/g;
71 
72  s/COMPARE_LT/QOF_COMPARE_LT/g;
73  s/COMPARE_LTE/QOF_COMPARE_LTE/g;
74  s/COMPARE_EQUAL/QOF_COMPARE_EQUAL/g;
75  s/COMPARE_GT/QOF_COMPARE_GT/g;
76  s/COMPARE_GTE/QOF_COMPARE_GTE/g;
77  s/COMPARE_NEQ/QOF_COMPARE_NEQ/g;
78 
79  s/STRING_MATCH_NORMAL/QOF_STRING_MATCH_NORMAL/g;
80  s/STRING_MATCH_CASEINSENSITIVE/QOF_STRING_MATCH_CASEINSENSITIVE/g;
81 
82  s/DATE_MATCH_NORMAL/QOF_DATE_MATCH_NORMAL/g;
83  s/DATE_MATCH_ROUNDED/QOF_DATE_MATCH_ROUNDED/g;
84 
85  s/NUMERIC_MATCH_ANY/QOF_NUMERIC_MATCH_ANY/g;
86  s/NUMERIC_MATCH_CREDIT/QOF_NUMERIC_MATCH_CREDIT/g;
87  s/NUMERIC_MATCH_DEBIT/QOF_NUMERIC_MATCH_DEBIT/g;
88 
89  s/GUID_MATCH_ANY/QOF_GUID_MATCH_ANY/g;
90  s/GUID_MATCH_NONE/QOF_GUID_MATCH_NONE/g;
91  s/GUID_MATCH_NULL/QOF_GUID_MATCH_NULL/g;
92  s/GUID_MATCH_ALL/QOF_GUID_MATCH_ALL/g;
93  s/GUID_MATCH_LIST_ANY/QOF_GUID_MATCH_LIST_ANY/g;
94 
95  s/CHAR_MATCH_ANY/QOF_CHAR_MATCH_ANY/g;
96  s/CHAR_MATCH_NONE/QOF_CHAR_MATCH_NONE/g;
97 
98  s/char_match_t/QofCharMatch/g;
99  s/guid_match_t/QofGuidMatch/g;
100  s/numeric_match_t/QofNumericMatch/g;
101  s/date_match_t/QofDateMatch/g;
102  s/string_match_t/QofStringMatch/g;
103  s/query_compare_t/QofQueryCompare/g;
104 
105  s/gncQueryCoreInit/qof_query_core_init/g;
106  s/gncQueryCoreShutdown/qof_query_core_shutdown/g;
107  s/gncQueryCoreGetPredicate/qof_query_core_get_predicate/g;
108  s/gncQueryCoreGetCompare/qof_query_core_get_compare/g;
109 
110  s/gncQueryCorePredicateEqual/qof_query_core_predicate_equal/g;
111 
112  s/QUERY_AND/QOF_QUERY_AND/g;
113  s/QUERY_OR/QOF_QUERY_OR/g;
114  s/QUERY_NAND/QOF_QUERY_NAND/g;
115  s/QUERY_NOR/QOF_QUERY_NOR/g;
116  s/QUERY_XOR/QOF_QUERY_XOR/g;
117  s/QUERY_PARAM_BOOK/QOF_PARAM_BOOK/g;
118  s/QUERY_PARAM_GUID/QOF_PARAM_GUID/g;
119  s/QUERY_PARAM_ACTIVE/QOF_PARAM_ACTIVE/g;
120 
121  s/QUERYCORE_INT64/QOF_QUERYCORE_INT64/g;
122  s/QUERYCORE_STRING/QOF_QUERYCORE_STRING/g;
123  s/QUERYCORE_GUID/QOF_QUERYCORE_GUID/g;
124  s/QUERYCORE_DATE/QOF_QUERYCORE_DATE/g;
125  s/QUERYCORE_BOOLEAN/QOF_QUERYCORE_BOOLEAN/g;
126  s/QUERYCORE_NUMERIC/QOF_QUERYCORE_NUMERIC/g;
127 
128  s/gncQueryBuildParamList/qof_query_build_param_list/g;
129  s/gncQueryCreateFor/qof_query_create_for/g;
130  s/gncQueryCreate/qof_query_create/g;
131  s/gncQueryDestroy/qof_query_destroy/g;
132  s/gncQuerySearchFor/qof_query_search_for/g;
133  s/gncQuerySetBook/qof_query_set_book/g;
134  s/gncQueryAddTerm/qof_query_add_term/g;
135  s/gncQueryAddGUIDMatch/qof_query_add_guid_match/g;
136  s/gncQueryAddGUIDListMatch/qof_query_add_guid_list_match/g;
137  s/gncQueryAddBooleanMatch/qof_query_add_boolean_match/g;
138  s/gncQueryRun/qof_query_run/g;
139  s/gncQueryLastRun/qof_query_last_run/g;
140  s/gncQueryClear/qof_query_clear/g;
141  s/gncQueryPurgeTerms/qof_query_purge_terms/g;
142  s/gncQueryHasTerms/qof_query_has_terms/g;
143  s/gncQueryNumTerms/qof_query_num_terms/g;
144  s/gncQueryHasTermType/qof_query_has_term_type/g;
145  s/gncQueryCopy/qof_query_copy/g;
146  s/gncQueryInvert/qof_query_invert/g;
147  s/gncQueryMerge/qof_query_merge/g;
148  s/gncQueryMergeInPlace/qof_query_merges_ins_place/g;
149  s/gncQuerySetSortOrder/qof_query_set_sort_order/g;
150  s/gncQuerySetSortOptions/qof_query_set_sort_options/g;
151  s/gncQuerySetSortIncreasing/qof_query_set_sort_increasing/g;
152  s/gncQuerySetMaxResults/qof_query_set_max_results/g;
153  s/gncQueryEqual/qof_query_equal/g;
154  s/gncQueryPrint/qof_query_print/g;
155  s/gncQueryGetSearchFor/qof_query_get_search_for/g;
156  s/gncQueryGetBooks/qof_query_get_books/g;
157 
158  s/gncQueryNewInit/qof_query_new_init/g;
159  s/gncQueryNewShutdown/qof_query_new_shutdown/g;
160  s/gncQueryGetMaxResults/qof_query_get_max_results/g;
161  s/gncQueryGetTerms/qof_query_get_terms/g;
162  s/gncQueryTermGetParamPath/qof_query_term_get_param_path/g;
163  s/gncQueryTermGetPredData/qof_query_term_get_pred_data/g;
164  s/gncQueryTermIsInverted/qof_query_term_is_inverted/g;
165  s/gncQueryGetSorts/qof_query_get_sorts/g;
166  s/gncQuerySortGetParamPath/qof_query_sort_get_param_path/g;
167  s/gncQuerySortGetSortOptions/qof_query_sort_get_sort_options/g;
168  s/gncQuerySortGetIncreasing/qof_query_sort_get_increasing/g;
169 
170  s/QuerySort/QofSortFunc/g;
171  s/QueryTerm_t/QofQueryTerm/g;
172  s/SortFunc_t/QofQuerySort/g;
173 
174  s/querynew_s/_QofQuery/g;
175  s/QueryNew/QofQuery/g;
176  s/QueryOp/QofQueryOp/g;
177  s/query_new_term/_QofQueryTerm/g;
178  s/query_new_sort/_QofQuerySort/g;
179 
180  s/query_object_def/_QofParam/g;
181  s/QueryObjectDef/QofParam/g;
182 
183  s/QueryAccess/QofAccessFunc/g;
184 
185  s/gncQueryObjectRegister/qof_class_register/g;
186  s/gncQueryObjectParameterType/qof_class_get_parameter_type/g;
187  s/gncQueryObjectGetParameterGetter/qof_class_get_parameter_getter/g;
188  s/gncQueryObjectGetParameter/qof_class_get_parameter/g;
189  s/gncQueryObjectInit/qof_class_init/g;
190  s/gncQueryObjectShutdown/qof_class_shutdown/g;
191  s/gncQueryObjectDefaultSort/qof_class_get_default_sort/g;
192 
193  s/xaccGUIDNULL/guid_null/g;
194  s/xaccGUIDMalloc/guid_malloc/g;
195  s/xaccGUIDFree/guid_free/g;
196 
197  s/GNCIdTypeConst/QofIdTypeConst/g;
198  s/GNCIdType/QofIdType/g;
199  s/GNCEntityTable/QofInstanceTable/g;
200  s/xaccGUIDTypeEntityTable/qof_guid_type/g;
201 
202  s/xaccEntityTableNew/qof_instance_new/g;
203  s/xaccEntityTableDestroy/qof_instance_destroy/g;
204  s/xaccGUIDNewEntityTable/qof_instance_guid_new/g;
205  s/xaccLookupEntity/qof_instance_lookup/g;
206  s/xaccStoreEntity/qof_instance_store/g;
207  s/xaccRemoveEntity/qof_instance_remove/g;
208  s/xaccForeachEntity/qof_instance_foreach/g;
209 
210  s/foreachObjectCB/QofInstanceForeachCB/g;
211  s/GNC_OBJECT_VERSION/QOF_OBJECT_VERSION/g;
212 
213  s/GNCSession/QofSession/g;
214  s/gnc_session/qof_session/g;
215  s/GNCPercentageFunc/QofPercentageFunc/g;
216  s/gnc_get_current_session/qof_session_get_current_session/g;
217  s/gnc_set_current_session/qof_session_set_current_session/g;
218 
219  s/ Backend/ QofBackend/g;
220  s/\(Backend/\(QofBackend/g;
221  s/GNCBackendError/QofBackendError/g;
222  s/GNCBePercentageFunc/QofBePercentageFunc/g;
223  s/xaccBackendSetError/qof_backend_set_error/g;
224  s/xaccBackendGetError/qof_backend_get_error/g;
225  s/xaccBackendSetMessage/qof_backend_set_message/g;
226  s/xaccBackendGetMessage/qof_backend_get_message/g;
227  s/xaccInitBackend/qof_backend_init/g;
228 
229  s/GNCId\.h/qofid\.h/g;
230  s/gncObject\.h/qofobject\.h/g;
231  s/QueryCore\.h/qofquerycore\.h/g;
232  s/QofQuery\.h/qofquery\.h/g;
233  s/QueryObject\.h/qofqueryobject\.h/g;
234 
235 
236  s/kvp_frame /KvpFrame /g;
237  s/kvp_frame* /KvpFrame* /g;
238  s/kvp_value /KvpValue /g;
239  s/kvp_value* /KvpValue* /g;
240  s/kvp_value_t/KvpValueType/g;
241 
242  s/QofQof/Qof/g;
243  s/QOF_QOF/QOF/g;
244 
245  s/getDateFormatString/qof_date_format_get_string/g;
246  s/getDateTextFormatString/qof_date_format_get_format/g;
247  s/getDateFormat/qof_date_format_get/g;
248  s/setDateFormat/qof_date_format_set/g;
249  s/DateFormat/QofDateFormat/g;
250  s/printDateSecs/qof_print_date_buff/g;
251  s/printDate/qof_print_date_dmy_buff/g;
252  s/printGDate/qof_print_gdate/g;
253  s/xaccPrintDateSecs/qof_print_date/g;
254  s/scanDate/qof_scan_date/g;
255  s/DATE_FORMAT_US/QOF_DATE_FORMAT_US/g;
256  s/DATE_FORMAT_UK/QOF_DATE_FORMAT_UK/g;
257  s/DATE_FORMAT_CE/QOF_DATE_FORMAT_CE/g;
258  s/DATE_FORMAT_ISO/QOF_DATE_FORMAT_ISO/g;
259  s/DATE_FORMAT_LOCALE/QOF_DATE_FORMAT_LOCALE/g;
260  s/DATE_FORMAT_CUSTOM/QOF_DATE_FORMAT_CUSTOM/g;
261 
262  }
263 
264  print OF $_;
265  }
266  close OF;
267  close AF;
268 
269  $rn = "mv " . $afile . ".tmp " . $afile;
270  system ($rn);
271 }
272