summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormk5004.lee <mk5004.lee@samsung.com>2020-01-07 18:55:01 +0900
committermk5004.lee <mk5004.lee@samsung.com>2020-01-07 18:55:01 +0900
commit95d63b0dc8ea6ecba582da9cd32d2d4ee6b4be07 (patch)
tree133bc7e501bd500a98318de9e95ad8574d0ea989
parent8ddc350e3d74fdab74a0327033357d219b0d34e9 (diff)
parent63b6cb45a6df64c91dedc87f5cac039984de6068 (diff)
downloadwatchface-complication-tizen_5.0.tar.gz
watchface-complication-tizen_5.0.tar.bz2
watchface-complication-tizen_5.0.zip
Merge branch 'tizen' into tizen_5.0tizen_5.0
Change-Id: I735a846df1613221ed49d3c812fdfc8f4e95de2e Signed-off-by: mk5004.lee <mk5004.lee@samsung.com>
-rw-r--r--CMakeLists.txt5
-rw-r--r--doc/watchface-complication_doc.h2
-rw-r--r--mock/app_common.h43
-rw-r--r--mock/app_control_mock.h33
-rw-r--r--mock/aul_mock.h38
-rw-r--r--mock/cynara_mock.h117
-rw-r--r--mock/fff.h6493
-rw-r--r--mock/gio/gio.h164
-rw-r--r--mock/mock.cc105
-rw-r--r--mock/mock.h22
-rw-r--r--mock/mock_util.cc18
-rw-r--r--mock/mock_util.h30
-rw-r--r--mock/pkgmgr_mock.h70
-rw-r--r--mock/system_info_mock.h33
-rw-r--r--mock/tzplatform_config_mock.h37
-rw-r--r--packaging/libwatchface-complication.spec61
-rw-r--r--parser/complication_parser_plugin.cc855
-rw-r--r--parser/complication_parser_plugin_internal.cc42
-rw-r--r--parser/complication_plugins.txt2
-rw-r--r--scripts/504.watchface_complication_upgrade.sh97
-rw-r--r--unittest/CMakeLists.txt57
-rw-r--r--unittest/data/test.sql234
-rw-r--r--unittest/post_execution.sh4
-rw-r--r--unittest/pre_execution.sh9
-rw-r--r--unittest/res/org.tizen.gmock_comp_provider-1.0.0-arm.tpkbin32109 -> 0 bytes
-rw-r--r--unittest/res/org.tizen.gmock_comp_provider-1.0.0-x86.tpkbin32263 -> 0 bytes
-rw-r--r--unittest/res/org.tizen.gmock_comp_provider2-1.0.0-arm.tpkbin32192 -> 0 bytes
-rw-r--r--unittest/res/org.tizen.gmock_comp_provider2-1.0.0-x86.tpkbin32268 -> 0 bytes
-rw-r--r--unittest/src/test-complication-bundle.cc137
-rw-r--r--unittest/src/test-complication-provider.cc125
-rw-r--r--unittest/src/test-complication.cc452
-rw-r--r--unittest/src/test-design-element.cc63
-rw-r--r--unittest/src/test-editables-container.cc283
-rw-r--r--unittest/src/test-editables-manager.cc12
-rw-r--r--unittest/src/test-editor.cc124
-rw-r--r--unittest/src/test-main.cc57
-rw-r--r--unittest/src/test-received-editable.cc102
-rw-r--r--unittest/src/test-watchface-complication-provider.cc404
-rw-r--r--unittest/src/test-watchface-complication.cc668
-rw-r--r--unittest/src/test-watchface-editable.cc295
-rw-r--r--unittest/src/test-watchface-editor.cc252
-rw-r--r--watchface-common/include/watchface-common.h6
-rw-r--r--watchface-common/watchface-common-internal.h17
-rw-r--r--watchface-common/watchface-util.cc272
-rw-r--r--watchface-common/watchface-util.h41
-rw-r--r--watchface-complication-provider/complication-provider-event-interface.h6
-rw-r--r--watchface-complication-provider/complication-provider-implementation.h6
-rw-r--r--watchface-complication-provider/complication-provider.cc221
-rw-r--r--watchface-complication-provider/complication-provider.h9
-rw-r--r--watchface-complication-provider/include/watchface-complication-provider-internal.h6
-rw-r--r--watchface-complication-provider/include/watchface-complication-provider.h341
-rw-r--r--watchface-complication-provider/watchface-complication-provider.cc483
-rw-r--r--watchface-complication/CMakeLists.txt1
-rw-r--r--watchface-complication/complication-bundle.cc108
-rw-r--r--watchface-complication/complication-bundle.h50
-rw-r--r--watchface-complication/complication-connector-implementation.h13
-rw-r--r--watchface-complication/complication-connector.cc49
-rw-r--r--watchface-complication/complication-connector.h6
-rw-r--r--watchface-complication/complication-event-interface.h7
-rw-r--r--watchface-complication/complication-implementation.h19
-rw-r--r--watchface-complication/complication.cc447
-rw-r--r--watchface-complication/complication.h56
-rw-r--r--watchface-complication/db-manager.cc711
-rw-r--r--watchface-complication/db-manager.h11
-rw-r--r--watchface-complication/design-element-implementation.h12
-rw-r--r--watchface-complication/design-element.cc93
-rw-r--r--watchface-complication/design-element.h31
-rw-r--r--watchface-complication/editable-interface.h30
-rw-r--r--watchface-complication/editables-container-event-interface.h4
-rw-r--r--watchface-complication/editables-container-implementation.h9
-rw-r--r--watchface-complication/editables-container.cc219
-rw-r--r--watchface-complication/editables-container.h2
-rw-r--r--watchface-complication/editables-manager-implementation.h7
-rw-r--r--watchface-complication/editables-manager.cc91
-rw-r--r--watchface-complication/editables-manager.h15
-rw-r--r--watchface-complication/gdbus-mock.h89
-rw-r--r--watchface-complication/gdbus.h6
-rw-r--r--watchface-complication/include/watchface-complication.h354
-rw-r--r--watchface-complication/include/watchface-editable-internal.h16
-rw-r--r--watchface-complication/include/watchface-editable.h54
-rw-r--r--watchface-complication/package-manager-interface.h1
-rw-r--r--watchface-complication/package-manager-mock.h86
-rw-r--r--watchface-complication/package-manager.h4
-rw-r--r--watchface-complication/received-editable-implementation.h9
-rw-r--r--watchface-complication/received-editable.cc146
-rw-r--r--watchface-complication/received-editable.h29
-rw-r--r--watchface-complication/watchface-complication.cc405
-rw-r--r--watchface-complication/watchface-editable.cc423
-rw-r--r--watchface-editor/editables-editor-event-interface.h1
-rw-r--r--watchface-editor/editables-editor-implementation.h4
-rw-r--r--watchface-editor/editables-editor.cc139
-rw-r--r--watchface-editor/editables-editor.h5
-rw-r--r--watchface-editor/include/watchface-editor-internal.h34
-rw-r--r--watchface-editor/include/watchface-editor.h69
-rw-r--r--watchface-editor/watchface-editor.cc231
95 files changed, 13683 insertions, 3366 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index de87d83..103e3ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,3 +13,8 @@ ADD_DEPENDENCIES(watchface-editor watchface-complication)
ADD_DEPENDENCIES(watchface-complication-provider watchface-complication)
ADD_DEPENDENCIES(complication-parser watchface-complication)
ADD_DEPENDENCIES(watchface-complication_unittests watchface-complication-provider)
+
+ENABLE_TESTING()
+SET(COMPLICATION_UNIT_TESTS watchface-complication_unittests)
+ADD_TEST(NAME ${COMPLICATION_UNIT_TESTS} COMMAND ${COMPLICATION_UNIT_TESTS}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/unittest) \ No newline at end of file
diff --git a/doc/watchface-complication_doc.h b/doc/watchface-complication_doc.h
index 7e61062..3368f9b 100644
--- a/doc/watchface-complication_doc.h
+++ b/doc/watchface-complication_doc.h
@@ -37,7 +37,7 @@
* - http://tizen.org/feature/watch_app\n
* You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.
* To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
- * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ * More details on featuring your application can be found from <a href="https://docs.tizen.org/application/tizen-studio/native-tools/manifest-text-editor#feature-element"><b>Feature Element</b>.</a>
*/
/**
diff --git a/mock/app_common.h b/mock/app_common.h
new file mode 100644
index 0000000..f04746a
--- /dev/null
+++ b/mock/app_common.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_APP_COMMON_H_
+#define MOCK_APP_COMMON_H_
+
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ APP_ERROR_NONE = 0, /**< Successful */
+ APP_ERROR_INVALID_PARAMETER = -22, /**< Invalid parameter */
+ APP_ERROR_OUT_OF_MEMORY = -12, /**< Out of memory */
+ APP_ERROR_INVALID_CONTEXT = -0x01100000 | 0x01, /**< Invalid application context */
+ APP_ERROR_NO_SUCH_FILE = -2, /**< No such file or directory */
+ APP_ERROR_NOT_SUPPORTED = -3, /**< Not supported (Since 4.0) */
+ APP_ERROR_ALREADY_RUNNING = -4, /**< Application is already running */
+ APP_ERROR_PERMISSION_DENIED = -5, /**< Permission denied @if MOBILE (Since 2.3.1) @endif */
+} app_error_e;
+
+DECLARE_FAKE_VALUE_FUNC(int, app_get_name, char**);
+DECLARE_FAKE_VALUE_FUNC(char*, app_get_data_path);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_APP_COMMON_H_ */
diff --git a/mock/app_control_mock.h b/mock/app_control_mock.h
new file mode 100644
index 0000000..63a2b2a
--- /dev/null
+++ b/mock/app_control_mock.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_APP_CONTROL_H_
+#define MOCK_APP_CONTROL_H_
+
+#include <app_control.h>
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DECLARE_FAKE_VALUE_FUNC(int, app_control_send_launch_request, app_control_h,
+ app_control_reply_cb, void *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_APP_CONTROL_H_ */
diff --git a/mock/aul_mock.h b/mock/aul_mock.h
new file mode 100644
index 0000000..93f110f
--- /dev/null
+++ b/mock/aul_mock.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_AUL_H_
+#define MOCK_AUL_H_
+
+#include <sys/types.h>
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DECLARE_FAKE_VALUE_FUNC(int, aul_app_get_appid_bypid,
+ int, char *, int);
+DECLARE_FAKE_VALUE_FUNC(int, aul_complication_update_request, const char *,
+ const char *, uid_t);
+DECLARE_FAKE_VALUE_FUNC(int, aul_complication_launch_with_extra_data, const char *,
+ const char *, uid_t, const char *, char *);
+DECLARE_FAKE_VALUE_FUNC(int, aul_get_app_shared_resource_path_by_appid, const char *,
+ char **);
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_AUL_H_ */
diff --git a/mock/cynara_mock.h b/mock/cynara_mock.h
new file mode 100644
index 0000000..99fb9fe
--- /dev/null
+++ b/mock/cynara_mock.h
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_CYNARA_H_
+#define MOCK_CYNARA_H_
+
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void cynara;
+typedef void* cynara_configuration;
+
+/*! \brief indicating that API call was interrupted by user*/
+#define CYNARA_API_INTERRUPTED 4
+
+/*! \brief indicating access that cannot be resolved without further actions*/
+#define CYNARA_API_ACCESS_NOT_RESOLVED 3
+
+/*! \brief indicating access that was checked is allowed */
+#define CYNARA_API_ACCESS_ALLOWED 2
+
+/*! \brief indicating that access that was checked is denied */
+#define CYNARA_API_ACCESS_DENIED 1
+
+/*! \brief indicating the result of the one specific API is successful */
+#define CYNARA_API_SUCCESS 0
+
+/*! \brief indicating that value is not present in cache */
+#define CYNARA_API_CACHE_MISS -1
+
+/*! \brief indicating that pending requests reached maximum */
+#define CYNARA_API_MAX_PENDING_REQUESTS -2
+
+/*! \brief indicating system is running out of memory state */
+#define CYNARA_API_OUT_OF_MEMORY -3
+
+/*! \brief indicating the API's parameter is malformed */
+#define CYNARA_API_INVALID_PARAM -4
+
+/*! \brief indicating that service is not available */
+#define CYNARA_API_SERVICE_NOT_AVAILABLE -5
+
+/*! \brief indicating that provided method is not supported by library */
+#define CYNARA_API_METHOD_NOT_SUPPORTED -6
+
+/*! \brief cynara service does not allow to perform requested operation */
+#define CYNARA_API_OPERATION_NOT_ALLOWED -7
+
+/*! \brief cynara service failed to perform requested operation */
+#define CYNARA_API_OPERATION_FAILED -8
+
+/*! \brief cynara service hasn't found requested bucket */
+#define CYNARA_API_BUCKET_NOT_FOUND -9
+
+/*! \brief indicating an unknown error */
+#define CYNARA_API_UNKNOWN_ERROR -10
+
+/*! \brief indicating configuration error */
+#define CYNARA_API_CONFIGURATION_ERROR -11
+
+/*! \brief indicating invalid parameter in command-line */
+#define CYNARA_API_INVALID_COMMANDLINE_PARAM -12
+
+/*! \brief indicating that provided buffer is too short */
+#define CYNARA_API_BUFFER_TOO_SHORT -13
+
+/*! \brief indicating that database is corrupted */
+#define CYNARA_API_DATABASE_CORRUPTED -14
+
+/*! \brief indicating that user doesn't have enough permission to perform action */
+#define CYNARA_API_PERMISSION_DENIED -15
+
+
+enum cynara_client_creds {
+ CLIENT_METHOD_SMACK,
+ CLIENT_METHOD_PID,
+
+ CLIENT_METHOD_DEFAULT = 0xFFFF,
+};
+
+enum cynara_user_creds {
+ USER_METHOD_UID,
+ USER_METHOD_GID,
+
+ USER_METHOD_DEFAULT = 0xFFFF,
+};
+
+DECLARE_FAKE_VALUE_FUNC(int, cynara_initialize, cynara**,
+ const cynara_configuration*);
+DECLARE_FAKE_VALUE_FUNC(int, cynara_finish, cynara*);
+DECLARE_FAKE_VALUE_FUNC(int, cynara_check, cynara*,
+ const char*, const char*, const char*, const char*);
+DECLARE_FAKE_VALUE_FUNC(int, cynara_creds_gdbus_get_client, GDBusConnection*,
+ const gchar*, enum cynara_client_creds, gchar**);
+DECLARE_FAKE_VALUE_FUNC(int, cynara_creds_gdbus_get_user, GDBusConnection*,
+ const gchar*, enum cynara_user_creds, gchar**);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_CYNARA_H_ */
diff --git a/mock/fff.h b/mock/fff.h
new file mode 100644
index 0000000..f8d6d5f
--- /dev/null
+++ b/mock/fff.h
@@ -0,0 +1,6493 @@
+/*
+LICENSE
+
+The MIT License (MIT)
+
+Copyright (c) 2010 Michael Long
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+#ifndef FAKE_FUNCTIONS
+#define FAKE_FUNCTIONS
+
+#include <stdarg.h>
+#include <string.h> /* For memset and memcpy */
+
+#define FFF_MAX_ARGS (20u)
+#ifndef FFF_ARG_HISTORY_LEN
+ #define FFF_ARG_HISTORY_LEN (50u)
+#endif
+#ifndef FFF_CALL_HISTORY_LEN
+ #define FFF_CALL_HISTORY_LEN (50u)
+#endif
+/* -- INTERNAL HELPER MACROS -- */
+#define SET_RETURN_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
+ FUNCNAME##_fake.return_val_seq = ARRAY_POINTER; \
+ FUNCNAME##_fake.return_val_seq_len = ARRAY_LEN;
+#define SET_CUSTOM_FAKE_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
+ FUNCNAME##_fake.custom_fake_seq = ARRAY_POINTER; \
+ FUNCNAME##_fake.custom_fake_seq_len = ARRAY_LEN;
+
+/* Defining a function to reset a fake function */
+#define RESET_FAKE(FUNCNAME) { \
+ FUNCNAME##_reset(); \
+} \
+
+
+#define DECLARE_ARG(type, n, FUNCNAME) \
+ type arg##n##_val; \
+ type arg##n##_history[FFF_ARG_HISTORY_LEN];
+
+#define DECLARE_ALL_FUNC_COMMON \
+ unsigned int call_count; \
+ unsigned int arg_history_len; \
+ unsigned int arg_histories_dropped; \
+
+#define DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ RETURN_TYPE return_val_history[FFF_ARG_HISTORY_LEN];
+
+#define SAVE_ARG(FUNCNAME, n) \
+ memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
+
+#define ROOM_FOR_MORE_HISTORY(FUNCNAME) \
+ FUNCNAME##_fake.call_count < FFF_ARG_HISTORY_LEN
+
+#define SAVE_RET_HISTORY(FUNCNAME, RETVAL) \
+ if ((FUNCNAME##_fake.call_count - 1) < FFF_ARG_HISTORY_LEN) \
+ memcpy((void *)&FUNCNAME##_fake.return_val_history[FUNCNAME##_fake.call_count - 1], (const void *) &RETVAL, sizeof(RETVAL)); \
+
+#define SAVE_ARG_HISTORY(FUNCNAME, ARGN) \
+ memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
+
+#define HISTORY_DROPPED(FUNCNAME) \
+ FUNCNAME##_fake.arg_histories_dropped++
+
+#define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ RETURN_TYPE return_val; \
+ int return_val_seq_len; \
+ int return_val_seq_idx; \
+ RETURN_TYPE * return_val_seq; \
+
+#define DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ int custom_fake_seq_len; \
+ int custom_fake_seq_idx; \
+
+#define INCREMENT_CALL_COUNT(FUNCNAME) \
+ FUNCNAME##_fake.call_count++
+
+#define RETURN_FAKE_RESULT(FUNCNAME) \
+ if (FUNCNAME##_fake.return_val_seq_len){ /* then its a sequence */ \
+ if(FUNCNAME##_fake.return_val_seq_idx < FUNCNAME##_fake.return_val_seq_len) { \
+ SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx]) \
+ return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx++]; \
+ } \
+ SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]) \
+ return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]; /* return last element */ \
+ } \
+ SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val) \
+ return FUNCNAME##_fake.return_val; \
+
+#ifdef __cplusplus
+ #define FFF_EXTERN_C extern "C"{
+ #define FFF_END_EXTERN_C }
+#else /* ansi c */
+ #define FFF_EXTERN_C
+ #define FFF_END_EXTERN_C
+#endif /* cpp/ansi c */
+
+#define DEFINE_RESET_FUNCTION(FUNCNAME) \
+ void FUNCNAME##_reset(void){ \
+ memset(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake)); \
+ FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN; \
+ }
+/* -- END INTERNAL HELPER MACROS -- */
+
+typedef void (*fff_function_t)(void);
+typedef struct {
+ fff_function_t call_history[FFF_CALL_HISTORY_LEN];
+ unsigned int call_history_idx;
+} fff_globals_t;
+
+FFF_EXTERN_C
+extern fff_globals_t fff;
+FFF_END_EXTERN_C
+
+#define DEFINE_FFF_GLOBALS \
+ FFF_EXTERN_C \
+ fff_globals_t fff; \
+ FFF_END_EXTERN_C
+
+#define FFF_RESET_HISTORY() \
+ fff.call_history_idx = 0; \
+ memset(fff.call_history, 0, sizeof(fff.call_history));
+
+#define REGISTER_CALL(function) \
+ if(fff.call_history_idx < FFF_CALL_HISTORY_LEN) \
+ fff.call_history[fff.call_history_idx++] = (fff_function_t)function;
+
+#define DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(void); \
+ void(**custom_fake_seq)(void); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(void); \
+
+#define DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(void){ \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC0(FUNCNAME) \
+ DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
+ DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
+
+
+#define DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0); \
+
+#define DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+
+#define DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+
+#define DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+
+#define DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+
+#define DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+
+#define DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+
+#define DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+
+#define DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+
+#define DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+
+#define DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+
+#define DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+
+#define DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+
+#define DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+
+#define DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+
+#define DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+
+#define DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+
+#define DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+
+#define DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+
+#define DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+
+#define DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ SAVE_ARG(FUNCNAME, 19); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ SAVE_ARG_HISTORY(FUNCNAME, 19); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(void); \
+ RETURN_TYPE(**custom_fake_seq)(void); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(void); \
+
+#define DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(void){ \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0); \
+
+#define DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+
+#define DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+
+#define DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+
+#define DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+
+#define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+
+#define DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+
+#define DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+
+#define DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+
+#define DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+
+#define DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+
+#define DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+
+#define DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+
+#define DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+
+#define DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+
+#define DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+
+#define DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+
+#define DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+
+#define DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+
+#define DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+
+#define DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ SAVE_ARG(FUNCNAME, 19); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ SAVE_ARG_HISTORY(FUNCNAME, 19); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ FUNCNAME##_fake.custom_fake(arg0, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
+ void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg0); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg1); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg2); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg3); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg4); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg5); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg6); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg7); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg8); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg9); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg10); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg11); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg12); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg13); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg14); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg15); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg16); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg17); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
+ RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg18); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+
+/* MSVC expand macro fix */
+#define EXPAND(x) x
+
+#define PP_NARG_MINUS2(...) EXPAND(PP_NARG_MINUS2_(__VA_ARGS__, PP_RSEQ_N_MINUS2()))
+
+#define PP_NARG_MINUS2_(...) EXPAND(PP_ARG_MINUS2_N(__VA_ARGS__))
+
+#define PP_ARG_MINUS2_N(returnVal, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
+
+#define PP_RSEQ_N_MINUS2() 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+
+#define PP_NARG_MINUS1(...) EXPAND(PP_NARG_MINUS1_(__VA_ARGS__, PP_RSEQ_N_MINUS1()))
+
+#define PP_NARG_MINUS1_(...) EXPAND(PP_ARG_MINUS1_N(__VA_ARGS__))
+
+#define PP_ARG_MINUS1_N( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
+
+#define PP_RSEQ_N_MINUS1() 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+
+
+
+/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
+
+#define FAKE_VALUE_FUNC(...) EXPAND(FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VALUE_(N,...) EXPAND(FUNC_VALUE_N(N,__VA_ARGS__))
+
+#define FUNC_VALUE_N(N,...) EXPAND(FAKE_VALUE_FUNC ## N(__VA_ARGS__))
+
+
+#define FAKE_VOID_FUNC(...) EXPAND(FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VOID_(N,...) EXPAND(FUNC_VOID_N(N,__VA_ARGS__))
+
+#define FUNC_VOID_N(N,...) EXPAND(FAKE_VOID_FUNC ## N(__VA_ARGS__))
+
+
+#define FAKE_VALUE_FUNC_VARARG(...) EXPAND(FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VALUE_VARARG_(N,...) EXPAND(FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
+
+#define FUNC_VALUE_VARARG_N(N,...) EXPAND(FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+#define FAKE_VOID_FUNC_VARARG(...) EXPAND(FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VOID_VARARG_(N,...) EXPAND(FUNC_VOID_VARARG_N(N,__VA_ARGS__))
+
+#define FUNC_VOID_VARARG_N(N,...) EXPAND(FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+
+/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
+
+#define DECLARE_FAKE_VALUE_FUNC(...) EXPAND(DECLARE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_(N,...) EXPAND(DECLARE_FUNC_VALUE_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_N(N,...) EXPAND(DECLARE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
+
+
+#define DECLARE_FAKE_VOID_FUNC(...) EXPAND(DECLARE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_(N,...) EXPAND(DECLARE_FUNC_VOID_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_N(N,...) EXPAND(DECLARE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
+
+
+#define DECLARE_FAKE_VALUE_FUNC_VARARG(...) EXPAND(DECLARE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_VARARG_(N,...) EXPAND(DECLARE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_VARARG_N(N,...) EXPAND(DECLARE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+#define DECLARE_FAKE_VOID_FUNC_VARARG(...) EXPAND(DECLARE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_VARARG_(N,...) EXPAND(DECLARE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_VARARG_N(N,...) EXPAND(DECLARE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+
+/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
+
+#define DEFINE_FAKE_VALUE_FUNC(...) EXPAND(DEFINE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_(N,...) EXPAND(DEFINE_FUNC_VALUE_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_N(N,...) EXPAND(DEFINE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
+
+
+#define DEFINE_FAKE_VOID_FUNC(...) EXPAND(DEFINE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_(N,...) EXPAND(DEFINE_FUNC_VOID_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_N(N,...) EXPAND(DEFINE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
+
+
+#define DEFINE_FAKE_VALUE_FUNC_VARARG(...) EXPAND(DEFINE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_VARARG_(N,...) EXPAND(DEFINE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_VARARG_N(N,...) EXPAND(DEFINE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+#define DEFINE_FAKE_VOID_FUNC_VARARG(...) EXPAND(DEFINE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_VARARG_(N,...) EXPAND(DEFINE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_VARARG_N(N,...) EXPAND(DEFINE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+
+
+#endif /* FAKE_FUNCTIONS */
diff --git a/mock/gio/gio.h b/mock/gio/gio.h
new file mode 100644
index 0000000..85e70e3
--- /dev/null
+++ b/mock/gio/gio.h
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_GDBUS_H_
+#define MOCK_GDBUS_H_
+
+#include "mock.h"
+#include <glib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void GDBusConnection;
+typedef void GCancellable;
+typedef enum
+{
+ G_BUS_TYPE_STARTER = -1,
+ G_BUS_TYPE_NONE = 0,
+ G_BUS_TYPE_SYSTEM = 1,
+ G_BUS_TYPE_SESSION = 2
+} GBusType;
+typedef struct _GError GError;
+typedef char gchar;
+typedef short gshort;
+typedef long glong;
+typedef int gint;
+typedef gint gboolean;
+typedef unsigned char guchar;
+typedef unsigned short gushort;
+typedef unsigned long gulong;
+typedef unsigned int guint;
+
+typedef unsigned short guint16;
+typedef unsigned int guint32;
+
+typedef void* gpointer;
+typedef const void *gconstpointer;
+typedef guint32 GQuark;
+typedef int GDBusMessage;
+
+
+/**
+ * GBusNameOwnerFlags:
+ * @G_BUS_NAME_OWNER_FLAGS_NONE: No flags set.
+ * @G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT: Allow another message bus connection to claim the name.
+ * @G_BUS_NAME_OWNER_FLAGS_REPLACE: If another message bus connection owns the name and have
+ * specified #G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection.
+ * @G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE: Do not place message bus connection in a queue to own the name.
+ *
+ * Flags used in g_bus_own_name().
+ *
+ * Since: 2.26
+ */
+typedef enum
+{
+ G_BUS_NAME_OWNER_FLAGS_NONE = 0, /*< nick=none >*/
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT = (1<<0), /*< nick=allow-replacement >*/
+ G_BUS_NAME_OWNER_FLAGS_REPLACE = (1<<1), /*< nick=replace >*/
+ G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE = (1<<2) /*< nick=do-not-queue >*/
+} GBusNameOwnerFlags;
+typedef enum
+{
+ G_BUS_NAME_WATCHER_FLAGS_NONE = 0,
+ G_BUS_NAME_WATCHER_FLAGS_AUTO_START = (1<<0)
+} GBusNameWatcherFlags;
+
+typedef enum
+{
+ G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0,
+ G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1<<0)
+} GDBusSendMessageFlags;
+
+typedef enum /*< flags >*/
+{
+ G_DBUS_SIGNAL_FLAGS_NONE = 0,
+ G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE = (1<<0),
+ G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE = (1<<1),
+ G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH = (1<<2)
+} GDBusSignalFlags;
+
+typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+
+typedef void (*GBusNameLostCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+
+typedef void (*GBusNameAppearedCallback) (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data);
+
+typedef void (*GBusNameVanishedCallback) (GDBusConnection *connection,
+ const gchar *name,
+ gpointer user_data);
+typedef void (*GDestroyNotify) (gpointer data);
+typedef void (*GDBusSignalCallback) (GDBusConnection *connection,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data);
+
+DECLARE_FAKE_VALUE_FUNC(GDBusConnection *, g_bus_get_sync, GBusType,
+ GCancellable *, GError **);
+DECLARE_FAKE_VALUE_FUNC(guint, g_bus_own_name_on_connection,
+ GDBusConnection *, const gchar *, GBusNameOwnerFlags,
+ GBusNameAcquiredCallback, GBusNameLostCallback, gpointer,
+ GDestroyNotify);
+DECLARE_FAKE_VALUE_FUNC(gboolean, g_dbus_connection_emit_signal,
+ GDBusConnection *, const gchar *, const gchar *,
+ const gchar *, const gchar *, GVariant *, GError **);
+DECLARE_FAKE_VALUE_FUNC(guint, g_bus_watch_name,
+ GBusType, const gchar *, GBusNameWatcherFlags,
+ GBusNameAppearedCallback, GBusNameVanishedCallback, gpointer,
+ GDestroyNotify);
+
+DECLARE_FAKE_VALUE_FUNC(guint, g_bus_watch_name_on_connection,
+ GDBusConnection *, const gchar *, GBusNameWatcherFlags,
+ GBusNameAppearedCallback, GBusNameVanishedCallback, gpointer,
+ GDestroyNotify);
+
+DECLARE_FAKE_VALUE_FUNC(GDBusMessage *, g_dbus_message_new_method_call,
+ const gchar *, const gchar *, const gchar *, const gchar *);
+
+DECLARE_FAKE_VOID_FUNC(g_dbus_message_set_body, GDBusMessage *,
+ GVariant *);
+
+DECLARE_FAKE_VALUE_FUNC(GDBusMessage *, g_dbus_connection_send_message_with_reply_sync,
+ GDBusConnection *, GDBusMessage *, GDBusSendMessageFlags, gint,
+ volatile guint32 *, GCancellable *, GError **);
+DECLARE_FAKE_VOID_FUNC(g_object_unref, gpointer);
+DECLARE_FAKE_VALUE_FUNC(GVariant *, g_dbus_message_get_body, GDBusMessage *);
+DECLARE_FAKE_VOID_FUNC(g_dbus_connection_signal_unsubscribe, GDBusConnection *,
+ guint);
+
+DECLARE_FAKE_VOID_FUNC(g_bus_unwatch_name, guint);
+
+DECLARE_FAKE_VALUE_FUNC(guint, g_dbus_connection_signal_subscribe,
+ GDBusConnection *, const gchar *, const gchar *,
+ const gchar *, const gchar *, const gchar *,
+ GDBusSignalFlags, GDBusSignalCallback,
+ gpointer, GDestroyNotify);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_GDBUS_H_ */
diff --git a/mock/mock.cc b/mock/mock.cc
new file mode 100644
index 0000000..6ad8f92
--- /dev/null
+++ b/mock/mock.cc
@@ -0,0 +1,105 @@
+// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include "app_common.h"
+#include "app_control_mock.h"
+#include "tzplatform_config_mock.h"
+#include "aul_mock.h"
+#include "pkgmgr_mock.h"
+#include "gio/gio.h"
+#include "system_info_mock.h"
+#include "cynara_mock.h"
+
+DEFINE_FFF_GLOBALS;
+
+/* app_common */
+DEFINE_FAKE_VALUE_FUNC(int, app_get_name, char**);
+DEFINE_FAKE_VALUE_FUNC(char*, app_get_data_path);
+
+/* tzplatform */
+DEFINE_FAKE_VALUE_FUNC(const char*, tzplatform_mkpath,
+ enum tzplatform_variable, const char*);
+
+/* cynara */
+DEFINE_FAKE_VALUE_FUNC(int, cynara_initialize, cynara**,
+ const cynara_configuration*);
+DEFINE_FAKE_VALUE_FUNC(int, cynara_finish, cynara*);
+DEFINE_FAKE_VALUE_FUNC(int, cynara_check, cynara*,
+ const char*, const char*, const char*, const char*);
+DEFINE_FAKE_VALUE_FUNC(int, cynara_creds_gdbus_get_client, GDBusConnection*,
+ const gchar*, enum cynara_client_creds, gchar**);
+DEFINE_FAKE_VALUE_FUNC(int, cynara_creds_gdbus_get_user, GDBusConnection*,
+ const gchar*, enum cynara_user_creds, gchar**);
+
+/* gio */
+DEFINE_FAKE_VALUE_FUNC(GDBusConnection*, g_bus_get_sync, GBusType,
+ GCancellable*, GError**);
+DEFINE_FAKE_VALUE_FUNC(guint, g_bus_own_name_on_connection,
+ GDBusConnection*, const gchar*, GBusNameOwnerFlags,
+ GBusNameAcquiredCallback, GBusNameLostCallback, gpointer,
+ GDestroyNotify);
+DEFINE_FAKE_VALUE_FUNC(gboolean, g_dbus_connection_emit_signal,
+ GDBusConnection*, const gchar*, const gchar*,
+ const gchar*, const gchar*, GVariant*, GError**);
+DEFINE_FAKE_VALUE_FUNC(guint, g_bus_watch_name_on_connection,
+ GDBusConnection*, const gchar*, GBusNameWatcherFlags,
+ GBusNameAppearedCallback, GBusNameVanishedCallback, gpointer,
+ GDestroyNotify);
+DEFINE_FAKE_VALUE_FUNC(guint, g_bus_watch_name,
+ GBusType, const gchar*, GBusNameWatcherFlags,
+ GBusNameAppearedCallback, GBusNameVanishedCallback, gpointer,
+ GDestroyNotify);
+DEFINE_FAKE_VALUE_FUNC(GDBusMessage*, g_dbus_message_new_method_call,
+ const gchar*, const gchar*, const gchar*, const gchar*);
+DEFINE_FAKE_VOID_FUNC(g_bus_unwatch_name, guint);
+DEFINE_FAKE_VOID_FUNC(g_dbus_message_set_body, GDBusMessage *,
+ GVariant*);
+DEFINE_FAKE_VALUE_FUNC(GDBusMessage*, g_dbus_connection_send_message_with_reply_sync,
+ GDBusConnection*, GDBusMessage*, GDBusSendMessageFlags, gint,
+ volatile guint32*, GCancellable*, GError**);
+DEFINE_FAKE_VOID_FUNC(g_object_unref, gpointer);
+DEFINE_FAKE_VALUE_FUNC(GVariant*, g_dbus_message_get_body, GDBusMessage*);
+DEFINE_FAKE_VOID_FUNC(g_dbus_connection_signal_unsubscribe, GDBusConnection*,
+ guint);
+DEFINE_FAKE_VALUE_FUNC(guint, g_dbus_connection_signal_subscribe,
+ GDBusConnection*, const gchar*, const gchar*,
+ const gchar*, const gchar*, const gchar*,
+ GDBusSignalFlags, GDBusSignalCallback,
+ gpointer, GDestroyNotify);
+
+/* pkgmgr */
+DEFINE_FAKE_VALUE_FUNC(pkgmgr_client*, pkgmgr_client_new,
+ pkgmgr_client_type);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgr_client_free, pkgmgr_client*);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgr_client_listen_status, pkgmgr_client*,
+ pkgmgr_handler, void*);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_filter_foreach_appinfo,
+ pkgmgrinfo_appinfo_filter_h, pkgmgrinfo_app_list_cb, void*);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_get_appid, pkgmgrinfo_appinfo_h,
+ char**);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_get_disabled_appinfo,
+ const char*, pkgmgrinfo_appinfo_h*);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_destroy_appinfo,
+ pkgmgrinfo_appinfo_h);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_compare_usr_app_cert_info,
+ const char*, const char*, uid_t,
+ pkgmgrinfo_cert_compare_result_type_e*);
+
+/* aul */
+DEFINE_FAKE_VALUE_FUNC(int, aul_app_get_appid_bypid,
+ int, char*, int);
+DEFINE_FAKE_VALUE_FUNC(int, aul_complication_update_request, const char*,
+ const char*, uid_t);
+DEFINE_FAKE_VALUE_FUNC(int, aul_complication_launch_with_extra_data, const char*,
+ const char*, uid_t, const char*, char*);
+DEFINE_FAKE_VALUE_FUNC(int, aul_get_app_shared_resource_path_by_appid, const char*,
+ char**);
+
+/* system */
+DEFINE_FAKE_VALUE_FUNC(int, system_info_get_platform_bool,
+ const char*, bool*);
+
+/* app_control */
+DEFINE_FAKE_VALUE_FUNC(int, app_control_send_launch_request, app_control_h,
+ app_control_reply_cb, void*); \ No newline at end of file
diff --git a/mock/mock.h b/mock/mock.h
new file mode 100644
index 0000000..23adbd0
--- /dev/null
+++ b/mock/mock.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_MOCK_H__
+#define MOCK_MOCK_H__
+
+#include "fff.h"
+
+#endif // MOCK_MOCK_H__
diff --git a/mock/mock_util.cc b/mock/mock_util.cc
new file mode 100644
index 0000000..9a377cf
--- /dev/null
+++ b/mock/mock_util.cc
@@ -0,0 +1,18 @@
+// Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by a apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include <unistd.h>
+#include <iostream>
+
+#include "mock_util.h"
+
+const char* get_db_path() {
+ const char* path = "/opt/share/watchface-complication/complication_provider.db";
+ int ret = access(path, F_OK);
+ if(ret != -1) {
+ return path;
+ }
+
+ return "complication_provider.db";
+} \ No newline at end of file
diff --git a/mock/mock_util.h b/mock/mock_util.h
new file mode 100644
index 0000000..96a7e57
--- /dev/null
+++ b/mock/mock_util.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_UTIL_H_
+#define MOCK_UTIL_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+const char* get_db_path();
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_UTIL_H_ */
diff --git a/mock/pkgmgr_mock.h b/mock/pkgmgr_mock.h
new file mode 100644
index 0000000..caa703e
--- /dev/null
+++ b/mock/pkgmgr_mock.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_PKGMGR_H_
+#define MOCK_PKGMGR_H_
+#include <sys/types.h>
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void pkgmgr_client;
+
+typedef enum {
+ PMINFO_CERT_COMPARE_MATCH,
+ PMINFO_CERT_COMPARE_MISMATCH,
+ PMINFO_CERT_COMPARE_LHS_NO_CERT,
+ PMINFO_CERT_COMPARE_RHS_NO_CERT,
+ PMINFO_CERT_COMPARE_BOTH_NO_CERT,
+ PMINFO_CERT_COMPARE_ERROR,
+} pkgmgrinfo_cert_compare_result_type_e;
+
+typedef enum {
+ PC_REQUEST = 0,
+ PC_LISTENING,
+ PC_BROADCAST,
+} pkgmgr_client_type;
+typedef void *pkgmgrinfo_appinfo_filter_h;
+typedef void *pkgmgrinfo_appinfo_h;
+typedef int (*pkgmgr_handler)(uid_t target_uid, int req_id, const char *pkg_type,
+ const char *pkgid, const char *key,
+ const char *val, const void *pmsg, void *data);
+typedef int (*pkgmgrinfo_app_list_cb) (const pkgmgrinfo_appinfo_h handle,
+ void *user_data);
+
+DECLARE_FAKE_VALUE_FUNC(pkgmgr_client *, pkgmgr_client_new,
+ pkgmgr_client_type);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgr_client_free, pkgmgr_client *);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgr_client_listen_status, pkgmgr_client *,
+ pkgmgr_handler, void *);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_filter_foreach_appinfo,
+ pkgmgrinfo_appinfo_filter_h, pkgmgrinfo_app_list_cb, void *);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_get_appid, pkgmgrinfo_appinfo_h,
+ char **);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_get_disabled_appinfo,
+ const char *, pkgmgrinfo_appinfo_h *);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_appinfo_destroy_appinfo,
+ pkgmgrinfo_appinfo_h);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_compare_usr_app_cert_info,
+ const char *, const char *, uid_t,
+ pkgmgrinfo_cert_compare_result_type_e *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_PKGMGR_H_ */
diff --git a/mock/system_info_mock.h b/mock/system_info_mock.h
new file mode 100644
index 0000000..cd5e0a4
--- /dev/null
+++ b/mock/system_info_mock.h
@@ -0,0 +1,33 @@
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_SYSTEM_INFO_H_
+#define MOCK_SYSTEM_INFO_H_
+
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+DECLARE_FAKE_VALUE_FUNC(int, system_info_get_platform_bool,
+ const char *, bool *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_SYSTEM_INFO_H_ */ \ No newline at end of file
diff --git a/mock/tzplatform_config_mock.h b/mock/tzplatform_config_mock.h
new file mode 100644
index 0000000..848ae05
--- /dev/null
+++ b/mock/tzplatform_config_mock.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef MOCK_TZPLATFORM_CONFIG_H_
+#define MOCK_TZPLATFORM_CONFIG_H_
+
+#include "mock.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum tzplatform_variable {
+ USER = 0,
+ SYSTEM = 1,
+};
+
+DECLARE_FAKE_VALUE_FUNC(const char *, tzplatform_mkpath,
+ enum tzplatform_variable, const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MOCK_TZPLATFORM_CONFIG_H_ */
diff --git a/packaging/libwatchface-complication.spec b/packaging/libwatchface-complication.spec
index 69b86ef..4684d30 100644
--- a/packaging/libwatchface-complication.spec
+++ b/packaging/libwatchface-complication.spec
@@ -1,6 +1,6 @@
Name: libwatchface-complication
Summary: Library for developing the watchface complication
-Version: 2.0.22
+Version: 2.1.10
Release: 1
Group: Applications/Application Utility
License: Apache-2.0
@@ -29,13 +29,17 @@ BuildRequires: pkgconfig(capi-appfw-app-control)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-creds-gdbus)
BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(capi-base-utils-i18n)
%if 0%{?gcov:1}
-BuildRequires: lcov
+BuildRequires: lcov
+BuildRequires: zip
%endif
Requires: %{name}-provider
Requires: libwatchface-common
Recommends: amd-mod-complication
+%define upgrade_script_path /usr/share/upgrade/scripts
+
%description
API for creating a new watchface complication and managing it.
@@ -68,10 +72,15 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-DTZ_SYS_SHARE=/usr/share \
-DMAJORVER=${MAJORVER} \
-DFULLVER=%{version}
-make %{?jobs:-j%jobs}
+%__make %{?_smp_mflags}
+
+
+%if 0%{?gcov:1}
+mkdir -p gcov-obj
+find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
+%endif
%install
-rm -rf %{buildroot}
%make_install
mkdir -p %{buildroot}%{TZ_SYS_DB}
mkdir -p %{buildroot}%{_sysconfdir}/skel/.applications/dbspace
@@ -84,6 +93,23 @@ install -m 0644 .complication_provider.db-journal %{buildroot}%{TZ_SYS_DB}
install -m 0644 .complication_provider.db %{buildroot}%{_sysconfdir}/skel/.applications/dbspace
install -m 0644 .complication_provider.db-journal %{buildroot}%{_sysconfdir}/skel/.applications/dbspace
+%if 0%{?gcov:1}
+mkdir -p %{buildroot}%{_datadir}/gcov/obj
+install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+%endif
+
+mkdir -p %{buildroot}%{upgrade_script_path}
+cp -f scripts/504.watchface_complication_upgrade.sh %{buildroot}%{upgrade_script_path}
+
+%check
+ctest -V
+%if 0%{?gcov:1}
+lcov -c --ignore-errors graph --no-external -q -d . -o watchface-complication.info
+genhtml watchface-complication.info -o watchface-complication.out
+zip -r watchface-complication.zip watchface-complication.out
+install -m 0644 watchface-complication.zip %{buildroot}%{_datadir}/gcov/
+%endif
+
#################################################
# libwatchface-complication
#################################################
@@ -95,6 +121,7 @@ install -m 0644 .complication_provider.db-journal %{buildroot}%{_sysconfdir}/ske
%manifest %{name}.manifest
%attr(0644,root,root) %{_libdir}/%{name}.so.*
%license LICENSE
+%attr(0755,root,root) %{_datadir}/upgrade/scripts/504.watchface_complication_upgrade.sh
%files -n %{name}-devel
%{_includedir}/watchface-complication/*.h
@@ -252,14 +279,24 @@ GTest for watchface-complication
%files -n watchface-complication-unittests
%{_bindir}/watchface-complication_unittests
-%{_bindir}/pre_execution.sh
-%{_bindir}/post_execution.sh
-%attr(0755,root,root) %{_bindir}/pre_execution.sh
-%attr(0755,root,root) %{_bindir}/post_execution.sh
-/tmp/org.tizen.gmock_comp_provider-1.0.0-arm.tpk
-/tmp/org.tizen.gmock_comp_provider-1.0.0-x86.tpk
-/tmp/org.tizen.gmock_comp_provider2-1.0.0-arm.tpk
-/tmp/org.tizen.gmock_comp_provider2-1.0.0-x86.tpk
+/opt/share/watchface-complication/*
+
+
+#################################################
+# watchface-complication-gcov
+#################################################
+%if 0%{?gcov:1}
+%package gcov
+Summary: Simple string key-val dictionary ADT (gcov)
+Group: Application Framework/Testing
+
+%description gcov
+Simple string key-val dictionary ADT gcov objects
+%endif
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/*
+%endif
# End of a file
diff --git a/parser/complication_parser_plugin.cc b/parser/complication_parser_plugin.cc
index 10b73ef..5e7fea7 100644
--- a/parser/complication_parser_plugin.cc
+++ b/parser/complication_parser_plugin.cc
@@ -28,9 +28,14 @@
#include <pkgmgr-info.h>
#include <pkgmgr_installer_info.h>
#include <bundle.h>
+#include <bundle_cpp.h>
+
+#include <memory>
+#include <list>
#include "watchface-complication/include/watchface-complication-internal.h"
#include "watchface-complication/include/watchface-complication.h"
+#include "watchface-common/watchface-util.h"
#include "watchface-common/watchface-common-internal.h"
#include "parser/complication_parser_plugin_internal.h"
@@ -39,6 +44,7 @@
#define DEFAULT_LONG_TEXT "default-long-text"
#define DEFAULT_ICON "default-icon"
#define DEFAULT_TITLE "default-title"
+#define DEFAULT_TIMEZONE_ID "default-timezone-id"
#define DEFAULT_HOUR "default-hour"
#define DEFAULT_MINUTE "default-minute"
#define DEFAULT_SECOND "default-second"
@@ -48,6 +54,9 @@
#define DEFAULT_IMAGE "default-image"
#define DEFAULT_EXTRA_DATA "default-extra-data"
+using namespace std;
+using namespace tizen_base;
+using namespace watchface_complication;
struct support_event_tag_map {
const char* name;
@@ -83,6 +92,7 @@ static struct xml_to_bundle_key_map __budle_key_map[] = {
{DEFAULT_LONG_TEXT, LONG_TEXT_KEY},
{DEFAULT_ICON, ICON_KEY},
{DEFAULT_TITLE, TITLE_KEY},
+ {DEFAULT_TIMEZONE_ID, TIME_ZONE_ID_KEY},
{DEFAULT_HOUR, TIME_KEY},
{DEFAULT_MINUTE, TIME_KEY},
{DEFAULT_SECOND, TIME_KEY},
@@ -129,13 +139,13 @@ int complication_parser_plugin_fini(void) {
return 0;
}
-static char* _get_attribute(xmlNode* node, const char* name) {
+static string _get_attribute(xmlNode* node, const char* name) {
xmlChar* val;
- char* attr = NULL;
+ string attr = "";
val = xmlGetProp(node, (const xmlChar*)name);
if (val) {
- attr = strdup(reinterpret_cast<char*>(val));
+ attr = string(reinterpret_cast<char*>(val));
xmlFree(val);
}
@@ -231,6 +241,7 @@ static bool _is_valid_element(int type, char* element_name) {
break;
case WATCHFACE_COMPLICATION_TYPE_TIME :
if (strcmp(element_name, DEFAULT_SHORT_TEXT) != 0 &&
+ strcmp(element_name, DEFAULT_TIMEZONE_ID) != 0 &&
strcmp(element_name, DEFAULT_HOUR) != 0 &&
strcmp(element_name, DEFAULT_MINUTE) != 0 &&
strcmp(element_name, DEFAULT_SECOND) != 0 &&
@@ -247,7 +258,7 @@ static bool _is_valid_element(int type, char* element_name) {
}
static int _get_time_value(const char* time_type, const char* time_val,
- char* prev_value, char** default_value) {
+ string prev_value, char** default_value) {
time_t rawtime;
struct tm timeinfo;
@@ -256,10 +267,10 @@ static int _get_time_value(const char* time_type, const char* time_val,
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- if (prev_value == NULL)
+ if (prev_value.empty())
time(&rawtime);
else
- rawtime = strtol(prev_value, NULL, 10);
+ rawtime = stoi(prev_value);
localtime_r(&rawtime, &timeinfo);
if (strcmp(DEFAULT_HOUR, time_type) == 0) {
@@ -303,557 +314,454 @@ static int _get_time_value(const char* time_type, const char* time_val,
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-static int _parse_support_type(xmlNode* node, sqlite3* db, const char* pkgid,
- const char* appid, const char* providerid, int period, bool trusted) {
- int ret;
- int idx;
- int support_type = 0;
-
- xmlNode* tmp;
- xmlNode* tmpdata;
- sqlite3_stmt* stmt = NULL;
-
- bundle* default_data = NULL;
- bundle_raw* raw = NULL;
- int len = 0;
- const char* bundle_key;
- char* default_value = NULL;
- char* dup_val = NULL;
- char* prev_value;
-
- static const char query[] =
- "INSERT INTO complication_provider ( "
- "pkgid, appid, provider_id, trusted, period, "
- "support_type, default_data) "
- "VALUES (?, ?, ?, ?, ?, ?, ?)";
-
- if (node->children == NULL)
- return -1;
-
- ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
-
- for (tmp = node->children; tmp; tmp = tmp->next) {
- if (tmp->children == NULL
- || tmp->children->content == NULL)
- continue;
+static string _get_defalut_value(xmlNode* n_data, string prev_value,
+ const char* bundle_key) {
+ string default_value;
+ if (strcmp(bundle_key, TIME_KEY) == 0) {
+ char* dup_val = nullptr;
+ int ret = _get_time_value(
+ (const char*)n_data->name,
+ (const char*)n_data->children->content,
+ prev_value, &dup_val);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return "";
+
+ default_value = string(dup_val);
+ free(dup_val);
+ } else {
+ default_value =
+ string(reinterpret_cast<char*>(n_data->children->content));
+ }
+ return default_value;
+}
- support_type = _get_support_type_tag(tmp);
- if (!support_type) {
- LOGE("not supported type");
- goto out;
- }
+static string _make_raw_default_data(xmlNode* node, int support_type) {
+ try {
+ Bundle default_data;
+ xmlNode* n_data;
+ for (n_data = node->children; n_data; n_data = n_data->next) {
+ if (n_data->children == nullptr ||
+ n_data->children->content == nullptr)
+ continue;
+ if (!_is_valid_element(support_type, (char*)n_data->name))
+ return "";
+
+ const char* bundle_key = _get_bundle_key((const char*)n_data->name);
+ if (bundle_key == nullptr) {
+ LOGE("wrong element name (%s)", (const char*)n_data->name);
+ return "";
+ }
- default_data = bundle_create();
- if (default_data == NULL) {
- LOGE("bundle create error");
- goto out;
- }
+ string prev_value = default_data.GetString(bundle_key);
+ if (!prev_value.empty())
+ default_data.Delete(bundle_key);
- for (tmpdata = tmp->children; tmpdata; tmpdata = tmpdata->next) {
- if (tmpdata->children != NULL
- && tmpdata->children->content != NULL) {
- if (!_is_valid_element(support_type, (char*)tmpdata->name))
- goto out;
-
- bundle_key = _get_bundle_key((const char*)tmpdata->name);
- if (bundle_key == NULL) {
- LOGE("wrong element name (%s)", (const char*)tmpdata->name);
- goto out;
- }
-
- if (strcmp(bundle_key, TIME_KEY) == 0) {
- prev_value = NULL;
- bundle_get_str(default_data, TIME_KEY, &prev_value);
- ret = _get_time_value(
- (const char*)tmpdata->name,
- (const char*)tmpdata->children->content,
- prev_value, &dup_val);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
- goto out;
-
- default_value = dup_val;
- if (prev_value)
- bundle_del(default_data, TIME_KEY);
- } else {
- default_value = reinterpret_cast<char*>(tmpdata->children->content);
- }
-
- ret = bundle_add_str(default_data, bundle_key, default_value);
- free(dup_val);
- dup_val = NULL;
- if (ret != BUNDLE_ERROR_NONE) {
- LOGE("bundle add error : %d", ret);
- goto out;
- }
+ string val = _get_defalut_value(n_data, prev_value, bundle_key);
+ if (val.empty()) {
+ LOGE("fail to get default value");
+ return "";
}
- }
- ret = bundle_encode(default_data, &raw, &len);
- if (ret != BUNDLE_ERROR_NONE) {
- LOGE("bundle encode error %d", ret);
- goto out;
+ int ret = default_data.Add(bundle_key, val);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("bundle add error : %d", ret);
+ return "";
+ }
}
- idx = 1;
+ return string(reinterpret_cast<char*>(default_data.ToRaw().first.get()));
+ } catch (const std::exception& e) {
+ LOGE("Exception (%s)", e.what());
+ return "";
+ }
+}
- ret = sqlite3_bind_text(stmt, idx++, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+static bool _parse_support_type(xmlNode* node, shared_ptr<util::DBHelper>& db,
+ string providerid) {
- ret = sqlite3_bind_text(stmt, idx++, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ static const char query[] =
+ "INSERT INTO provider_support_types ( "
+ "provider_id, support_type, default_data) "
+ "VALUES (?, ?, ?)";
- ret = sqlite3_bind_text(stmt, idx++, providerid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (node->children == NULL)
+ return false;
- ret = sqlite3_bind_int(stmt, idx++, trusted ? 1 : 0);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_int() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Prepare(query))
+ return false;
- ret = sqlite3_bind_int(stmt, idx++, period);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_int() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ xmlNode* c_node;
+ for (c_node = node->children; c_node; c_node = c_node->next) {
+ if (c_node->children == NULL
+ || c_node->children->content == NULL)
+ continue;
- ret = sqlite3_bind_int(stmt, idx++, support_type);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_int() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
+ int support_type = _get_support_type_tag(c_node);
+ if (!support_type) {
+ LOGE("Wrong supported type");
+ return false;
}
- ret = sqlite3_bind_text(stmt, idx, (char*)raw, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Bind(1, providerid))
+ return false;
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("step error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Bind(2, support_type))
+ return false;
- ret = sqlite3_reset(stmt);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_reset() error: %d", ret);
- goto out;
- }
+ string raw_default_data = _make_raw_default_data(c_node, support_type);
+ if (raw_default_data.empty())
+ return false;
- sqlite3_clear_bindings(stmt);
+ if (!db->Bind(3, raw_default_data))
+ return false;
- if (raw) {
- free(raw);
- raw = NULL;
- }
+ if (db->Step() != SQLITE_DONE)
+ return false;
- if (default_data) {
- bundle_free(default_data);
- default_data = NULL;
- }
+ if (db->Reset() != SQLITE_OK)
+ return false;
}
- ret = 0;
-out:
- if (default_data)
- bundle_free(default_data);
-
- if (raw)
- free(raw);
-
- if (stmt)
- sqlite3_finalize(stmt);
-
- return ret;
+ return true;
}
-static int _parse_label(xmlNode* node, sqlite3* db, const char* providerid) {
- int ret;
- int idx;
- sqlite3_stmt* stmt = NULL;
- xmlChar* lang = NULL;
-
+static bool _parse_label(xmlNode* node, shared_ptr<util::DBHelper>& db,
+ string providerid) {
+ xmlChar* lang = nullptr;
static const char query[] =
"INSERT INTO provider_localized_info "
"(provider_id, locale, provider_label) "
"VALUES (?, ?, ?)";
- ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Prepare(query))
+ return false;
+
+ if (!db->Bind(1, providerid))
+ return false;
lang = xmlNodeGetLang(node);
+ if (lang) {
+ bool ret = db->Bind(2, reinterpret_cast<char*>(lang));
+ xmlFree(lang);
+ if (!ret)
+ return false;
+ } else {
+ if (!db->Bind(2, "No Locale"))
+ return false;
+ }
- idx = 1;
+ if (!db->Bind(3, reinterpret_cast<char*>(node->children->content)))
+ return false;
- ret = sqlite3_bind_text(stmt, idx++, providerid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (db->Step() != SQLITE_DONE)
+ return false;
- if (lang)
- ret = sqlite3_bind_text(stmt, idx++, reinterpret_cast<char*>(lang), -1,
- SQLITE_TRANSIENT);
- else
- ret = sqlite3_bind_text(stmt, idx++, "No Locale", -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (db->Reset() != SQLITE_OK)
+ return false;
+ return true;
+}
- ret = sqlite3_bind_text(stmt, idx, reinterpret_cast<char*>(node->children->content),
- -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+static bool _parse_icon(xmlNode* node, shared_ptr<util::DBHelper>& db,
+ string providerid) {
+ xmlChar* lang = nullptr;
+ static const char query[] =
+ "INSERT INTO provider_icon "
+ "(provider_id, locale, icon_path) "
+ "VALUES (?, ?, ?)";
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("step error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Prepare(query))
+ return false;
- ret = 0;
-out:
- if (stmt)
- sqlite3_finalize(stmt);
+ if (!db->Bind(1, providerid))
+ return false;
- if (lang)
+ lang = xmlNodeGetLang(node);
+ if (lang) {
+ bool ret = db->Bind(2, reinterpret_cast<char*>(lang));
xmlFree(lang);
+ if (!ret)
+ return false;
+ } else {
+ if (!db->Bind(2, "No Locale"))
+ return false;
+ }
+
+ if (!db->Bind(3, reinterpret_cast<char*>(node->children->content)))
+ return false;
- return ret;
+ if (db->Step() != SQLITE_DONE)
+ return false;
+
+ if (db->Reset() != SQLITE_OK)
+ return false;
+ return true;
}
-static int _parse_privilege(xmlNode* node, sqlite3* db,
- const char* providerid) {
- int ret;
- sqlite3_stmt* stmt = NULL;
+static bool _parse_privilege(xmlNode* node, shared_ptr<util::DBHelper>& db,
+ string providerid) {
xmlNode* tmp;
-
static const char query[] =
"INSERT INTO provider_privilege "
"(provider_id, privilege) "
"VALUES (?, ?)";
if (node->children == NULL)
- return -1;
-
- ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ return true;
+ if (!db->Prepare(query))
+ return false;
for (tmp = node->children; tmp; tmp = tmp->next) {
- if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"privilege")) {
- ret = sqlite3_bind_text(stmt, 1, providerid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, (char*)tmp->children->content, -1,
- SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("step error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
-
- ret = sqlite3_reset(stmt);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_reset() error: %d", ret);
- goto out;
- }
+ if (xmlStrcasecmp(tmp->name, (const xmlChar*)"privilege"))
+ continue;
- sqlite3_clear_bindings(stmt);
- }
+ if (!db->Bind(1, providerid))
+ return false;
+ if (!db->Bind(2, (char*)tmp->children->content))
+ return false;
+ if (db->Step() != SQLITE_DONE)
+ return false;
+ if (db->Reset() != SQLITE_OK)
+ return false;
}
- ret = 0;
-out:
- if (stmt)
- sqlite3_finalize(stmt);
-
- return ret;
+ return true;
}
-static int _parse_support_event(xmlNode* node, sqlite3* db,
- const char* providerid) {
- int ret;
- sqlite3_stmt* stmt = NULL;
- xmlNode* tmp;
+static bool _parse_support_event(xmlNode* node, shared_ptr<util::DBHelper>& db,
+ string providerid) {
+ if (node->children == nullptr)
+ return true;
+
int support_events = 0;
+ for (xmlNode* tmp = node->children; tmp; tmp = tmp->next) {
+ if (xmlStrcasecmp(tmp->name, (const xmlChar*)"event"))
+ continue;
+
+ int ret = _get_support_event_tag(tmp);
+ if (ret != 0)
+ support_events |= ret;
+ }
+
+ if (support_events == 0)
+ return true;
static const char query[] =
"INSERT INTO provider_support_events "
"(provider_id, support_events) "
"VALUES (?, ?)";
- if (node->children == NULL)
- return -1;
-
- for (tmp = node->children; tmp; tmp = tmp->next) {
- if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"event")) {
- ret = _get_support_event_tag(tmp);
- if (ret != 0)
- support_events |= ret;
- }
- }
-
- if (support_events != 0) {
- ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Prepare(query))
+ return false;
- ret = sqlite3_bind_text(stmt, 1, providerid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Bind(1, providerid))
+ return false;
- ret = sqlite3_bind_int(stmt, 2, support_events);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_int() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Bind(2, support_events))
+ return false;
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("step error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (db->Step() != SQLITE_DONE)
+ return false;
- ret = sqlite3_reset(stmt);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_reset() error: %d", ret);
- goto out;
- }
-
- sqlite3_clear_bindings(stmt);
- }
+ if (db->Reset() != SQLITE_OK)
+ return false;
- ret = 0;
-out:
- if (stmt)
- sqlite3_finalize(stmt);
-
- return ret;
+ return true;
}
-static int _parse_setup_appid(sqlite3* db, const char* providerid,
- const char* setup_appid) {
- int ret;
- sqlite3_stmt* stmt = NULL;
+static bool _insert_setup_appid(shared_ptr<util::DBHelper>& db,
+ string providerid, string setup_appid) {
static const char query[] =
"INSERT INTO provider_setup_appid "
"(provider_id, setup_appid) "
"VALUES (?, ?)";
- ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Prepare(query))
+ return false;
- ret = sqlite3_bind_text(stmt, 1, providerid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
- ret = sqlite3_bind_text(stmt, 2, setup_appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Bind(1, providerid))
+ return false;
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("step error: %s", sqlite3_errmsg(db));
- goto out;
- }
+ if (!db->Bind(2, setup_appid))
+ return false;
- ret = 0;
-out:
- if (stmt)
- sqlite3_finalize(stmt);
+ if (db->Step() != SQLITE_DONE)
+ return false;
- return ret;
+ if (db->Reset() != SQLITE_OK)
+ return false;
+
+ return true;
}
-static int _parse_complication(xmlNode* node, sqlite3* db, const char* pkgid,
- const char* appid, const char* providerid, const char* setup_appid, bool trusted) {
+static bool _insert_complication(shared_ptr<util::DBHelper>& db,
+ string pkgid, string appid, string providerid, bool trusted, int period) {
+ static const char query[] =
+ "INSERT INTO complication_provider ( "
+ "pkgid, appid, provider_id, trusted, period) "
+ "VALUES (?, ?, ?, ?, ?)";
+
+ if (!db->Prepare(query))
+ return false;
+
+ if (!db->Bind(1, pkgid))
+ return false;
+
+ if (!db->Bind(2, appid))
+ return false;
+
+ if (!db->Bind(3, providerid))
+ return false;
+
+ if (!db->Bind(4, trusted))
+ return false;
+
+ if (!db->Bind(5, period))
+ return false;
+
+ if (db->Step() != SQLITE_DONE)
+ return false;
+
+ if (db->Reset() != SQLITE_OK)
+ return false;
+ return true;
+}
+
+static bool _parse_complication(xmlNode* node, shared_ptr<util::DBHelper>& db,
+ string pkgid, string appid, string providerid, string setup_appid, bool trusted) {
int period = -1;
- xmlNode* tmp = NULL;
- xmlNode* support_type_node = NULL;
+ xmlNode* tmp = nullptr;
+ xmlNode* support_type_node = nullptr;
+ xmlNode* privilege_node = nullptr;
+ xmlNode* support_event_node = nullptr;
+ list<xmlNode*> label_list;
+ list<xmlNode*> icon_list;
if (node->children == NULL)
- return -1;
+ return false;
for (tmp = node->children; tmp; tmp = tmp->next) {
if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"support-type")) {
if (tmp->children == NULL)
- return -1;
+ return false;
support_type_node = tmp;
} else if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"period")) {
if (tmp->children == NULL
|| tmp->children->content == NULL)
- return -1;
+ return false;
period = atoi(reinterpret_cast<char*>(tmp->children->content));
if (period < 60)
period = 60;
} else if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"label")) {
- if (_parse_label(tmp, db, providerid)) {
- LOGE("parse label fail");
- return -1;
- }
+ label_list.push_back(tmp);
+ } else if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"icon")) {
+ icon_list.push_back(tmp);
} else if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"privileges")) {
- if (_parse_privilege(tmp, db, providerid)) {
- LOGE("parse privilege fail");
- return -1;
- }
+ privilege_node = tmp;
} else if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"support-event")) {
- if (_parse_support_event(tmp, db, providerid)) {
- LOGE("parse support event fail");
- return -1;
- }
+ support_event_node = tmp;
}
}
- if (!support_type_node) {
+ if (!_insert_complication(db, pkgid, appid, providerid, trusted, period)) {
LOGE("complication provider doesn't have support-type");
- return -1;
+ return false;
}
- if (setup_appid) {
- if (_parse_setup_appid(db, providerid, setup_appid)) {
- LOGE("parse setup appid fail");
- return -1;
- }
+ if (!support_type_node) {
+ LOGE("complication provider doesn't have support-type");
+ return false;
}
- if (_parse_support_type(support_type_node, db, pkgid,
- appid, providerid, period, trusted)) {
+ if (!_parse_support_type(support_type_node, db, providerid)) {
LOGE("parse support type fail");
- return -1;
+ return false;
}
- return 0;
-}
-
-static int _parse_service_application(xmlNode* node, const char* pkgid) {
- int result = -1;
- char* appid;
- char* providerid;
- char* setup_appid;
- char* trusted_str;
- bool trusted;
- xmlNode* tmp;
- sqlite3* db;
-
- appid = _get_attribute(node, "appid");
- if (appid == NULL)
- return -1;
+ if (privilege_node != nullptr &&
+ !_parse_privilege(privilege_node, db, providerid)) {
+ LOGE("parse privilege fail");
+ return false;
+ }
- db = open_db(_get_target_uid());
- if (db == NULL) {
- LOGE("failed to open db");
- goto out;
+ if (support_event_node != nullptr &&
+ !_parse_support_event(support_event_node, db, providerid)) {
+ LOGE("parse support event fail");
+ return false;
}
- if (sqlite3_exec(db, "BEGIN TRANSACTION", NULL, NULL, NULL)) {
- LOGE("begin transaction error");
- goto out;
+ for (auto& i : label_list) {
+ if (!_parse_label(i, db, providerid)) {
+ LOGE("parse label fail");
+ return false;
+ }
}
- for (tmp = node->children; tmp; tmp = tmp->next) {
- if (!xmlStrcasecmp(tmp->name, (const xmlChar*)"complication")) {
- providerid = _get_attribute(tmp, "provider-id");
- if (providerid == NULL) {
- LOGE("provider-id error");
+ for (auto& i : icon_list) {
+ if (!_parse_icon(i, db, providerid)) {
+ LOGE("parse icon fail");
+ return false;
+ }
+ }
- if (sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL))
- LOGE("rollback transaction error");
+ if (!setup_appid.empty()) {
+ if (!_insert_setup_appid(db, providerid, setup_appid)) {
+ LOGE("insert setup appid fail");
+ return false;
+ }
+ }
- goto out;
- }
+ return true;
+}
- setup_appid = _get_attribute(tmp, "setup-appid");
- trusted_str = _get_attribute(tmp, "trusted");
- if (trusted_str != NULL && strcasecmp(trusted_str, "true") == 0)
- trusted = true;
- else
- trusted = false;
+static bool _parse_service_application(xmlNode* node, const char* pkgid) {
+ bool trusted;
+ xmlNode* tmp;
+ shared_ptr<util::DBHelper> db = make_shared<util::DBHelper>();
- if (_parse_complication(tmp, db, pkgid, appid, providerid, setup_appid,
- trusted)) {
- LOGE("parse complication error");
+ string appid = _get_attribute(node, "appid");
+ if (appid.empty())
+ return false;
- if (sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL))
- LOGE("rollback transaction error");
+ if (!db->Open(SQLITE_OPEN_READWRITE))
+ return false;
- free(providerid);
+ if (!db->Exec("BEGIN TRANSACTION"))
+ return false;
- if (setup_appid)
- free(setup_appid);
- if (trusted_str)
- free(trusted_str);
+ for (tmp = node->children; tmp; tmp = tmp->next) {
+ if (xmlStrcasecmp(tmp->name, (const xmlChar*)"complication"))
+ continue;
- goto out;
- }
+ string providerid = _get_attribute(tmp, "provider-id");
+ if (providerid.empty()) {
+ LOGE("provider-id error");
+ if (!db->Exec("ROLLBACK TRANSACTION"))
+ return false;
+ }
- free(providerid);
+ string setup_appid = _get_attribute(tmp, "setup-appid");
+ string trusted_str = _get_attribute(tmp, "trusted");
+ if (!trusted_str.empty() && strcasecmp(trusted_str.c_str(), "true") == 0)
+ trusted = true;
+ else
+ trusted = false;
- if (setup_appid)
- free(setup_appid);
- if (trusted_str)
- free(trusted_str);
+ if (!_parse_complication(tmp, db, pkgid, appid, providerid, setup_appid,
+ trusted)) {
+ LOGE("parse complication error");
+ if (!db->Exec("ROLLBACK TRANSACTION"))
+ return false;
}
}
- if (sqlite3_exec(db, "END TRANSACTION", NULL, NULL, NULL)) {
- LOGE("end transaction error");
- goto out;
- }
-
- result = 0;
-out:
- if (db)
- sqlite3_close_v2(db);
+ if (!db->Exec("END TRANSACTION"))
+ return false;
- if (appid)
- free(appid);
-
- return result;
+ return true;
}
int complication_parser_plugin_parse_manifest(xmlDocPtr doc,
@@ -876,7 +784,7 @@ int complication_parser_plugin_parse_manifest(xmlDocPtr doc,
if (xmlStrcasecmp(tmp->name, (const xmlChar*)"service-application"))
continue;
- if (_parse_service_application(tmp, pkgid)) {
+ if (!_parse_service_application(tmp, pkgid)) {
LOGE("parse failed");
return -1;
}
@@ -885,93 +793,30 @@ int complication_parser_plugin_parse_manifest(xmlDocPtr doc,
return 0;
}
-static int _remove_complication(sqlite3* db, const char* pkgid) {
- int ret;
- unsigned int i;
- sqlite3_stmt* stmt = NULL;
-
- static const char* query[] = {
- "DELETE FROM provider_privilege WHERE provider_id IN "
- "(SELECT DISTINCT provider_id FROM complication_provider "
- "WHERE pkgid=?)",
- "DELETE FROM provider_localized_info WHERE provider_id IN "
- "(SELECT DISTINCT provider_id FROM complication_provider "
- "WHERE pkgid=?)",
- "DELETE FROM provider_setup_appid WHERE provider_id IN "
- "(SELECT DISTINCT provider_id FROM complication_provider "
- "WHERE pkgid=?)",
- "DELETE FROM provider_support_events WHERE provider_id IN "
- "(SELECT DISTINCT provider_id FROM complication_provider "
- "WHERE pkgid=?)",
- "DELETE FROM complication_provider WHERE pkgid=?"
- };
-
- for (i = 0; i < (sizeof(query) / sizeof(*query)); i++) {
- ret = sqlite3_prepare_v2(db, query[i], strlen(query[i]), &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("sqlite3_bind_text() error: %d(%s)", ret, sqlite3_errmsg(db));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_DONE) {
- LOGE("step error: %s", sqlite3_errmsg(db));
- goto out;
- }
-
- sqlite3_finalize(stmt);
- stmt = NULL;
- }
-
- ret = 0;
-
-out:
- if (stmt)
- sqlite3_finalize(stmt);
-
- return ret;
-}
-
int complication_parser_db_remove_complication(const char* pkgid) {
- int ret;
- sqlite3* db;
+ util::DBHelper db;
+ if (!db.Open(SQLITE_OPEN_READWRITE))
+ return -1;
- db = open_db(_get_target_uid());
- if (db == NULL)
+ if (!db.Exec("BEGIN TRANSACTION"))
return -1;
- ret = sqlite3_exec(db, "BEGIN TRANSACTION", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- LOGE("begin transaction error %d", ret);
- goto out;
+ if (!db.Prepare("DELETE FROM complication_provider WHERE pkgid=?")) {
+ if (!db.Exec("ROLLBACK TRANSACTION"))
+ return -1;
}
- if (_remove_complication(db, pkgid)) {
- LOGE("failed to remove complication provider");
-
- ret = sqlite3_exec(db, "ROLLBACK TRANSACTION", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- LOGE("rollback transaction error %d", ret);
- }
- goto out;
+ if (!db.Bind(1, pkgid)) {
+ if (!db.Exec("ROLLBACK TRANSACTION"))
+ return -1;
}
- ret = sqlite3_exec(db, "END TRANSACTION", NULL, NULL, NULL);
- if (ret != SQLITE_OK) {
- LOGE("begin transaction error %d", ret);
- goto out;
+ if (db.Step() != SQLITE_DONE) {
+ if (!db.Exec("ROLLBACK TRANSACTION"))
+ return -1;
}
- ret = 0;
-out:
- if (db)
- sqlite3_close_v2(db);
-
- return ret;
+ if (!db.Exec("END TRANSACTION"))
+ return -1;
+ return 0;
}
diff --git a/parser/complication_parser_plugin_internal.cc b/parser/complication_parser_plugin_internal.cc
index 929f188..ce67ee9 100644
--- a/parser/complication_parser_plugin_internal.cc
+++ b/parser/complication_parser_plugin_internal.cc
@@ -23,6 +23,7 @@
#include <dlog.h>
#include <tzplatform_config.h>
+#include "watchface-common/watchface-util.h"
#include "parser/complication_parser_plugin_internal.h"
#define BUSY_WAITING_USEC 50000 /* 0.05 sec */
@@ -41,40 +42,56 @@ CREATE TABLE IF NOT EXISTS complication_provider ( \
provider_id TEXT NOT NULL, \
trusted INTEGER DEFAULT 0, \
period INTEGER DEFAULT -1, \
+ PRIMARY KEY (provider_id) \
+); \
+CREATE TABLE IF NOT EXISTS provider_support_types ( \
+ provider_id TEXT NOT NULL, \
support_type INTEGER DEFAULT 0, \
default_data TEXT NOT NULL, \
- PRIMARY KEY (provider_id, support_type) \
+ UNIQUE (provider_id, support_type), \
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE \
); \
CREATE TABLE IF NOT EXISTS provider_localized_info ( \
provider_id TEXT NOT NULL, \
locale TEXT NOT NULL DEFAULT 'No Locale', \
provider_label TEXT, \
- PRIMARY KEY (provider_id, locale) \
+ UNIQUE (provider_id, locale), \
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE \
+); \
+CREATE TABLE IF NOT EXISTS provider_icon ( \
+ provider_id TEXT NOT NULL, \
+ locale TEXT NOT NULL DEFAULT 'No Locale', \
+ icon_path TEXT, \
+ UNIQUE (provider_id, locale), \
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE \
); \
CREATE TABLE IF NOT EXISTS provider_privilege ( \
provider_id TEXT NOT NULL, \
privilege TEXT NOT NULL, \
- PRIMARY KEY (provider_id, privilege) \
+ UNIQUE (provider_id, privilege) \
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE \
); \
CREATE TABLE IF NOT EXISTS provider_setup_appid ( \
provider_id TEXT NOT NULL, \
setup_appid TEXT, \
- PRIMARY KEY (provider_id) \
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE \
); \
CREATE TABLE IF NOT EXISTS provider_support_events ( \
provider_id TEXT NOT NULL, \
support_events INTEGER DEFAULT 1, \
- PRIMARY KEY (provider_id) \
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE \
); \
COMMIT TRANSACTION; "
-#define COMPLICATION_TBL_COUNT 5
+#define COMPLICATION_TBL_COUNT 7
static const char* _complication_table_list[COMPLICATION_TBL_COUNT] = {
"complication_provider",
+ "provider_icon",
"provider_localized_info",
"provider_privilege",
"provider_setup_appid",
- "provider_support_events"
+ "provider_support_events",
+ "provider_support_types"
};
static int _is_global(uid_t uid) {
@@ -123,8 +140,12 @@ static int _check_table_exist(sqlite3* db) {
return -1;
}
- while (sqlite3_step(stmt) == SQLITE_ROW
- && idx < COMPLICATION_TBL_COUNT) {
+ while (idx < COMPLICATION_TBL_COUNT) {
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_ROW) {
+ LOGW("fail to get row");
+ break;
+ }
val = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
if (val == nullptr) {
LOGW("name is nullptr");
@@ -136,11 +157,10 @@ static int _check_table_exist(sqlite3* db) {
idx++;
}
-
sqlite3_finalize(stmt);
if (idx != COMPLICATION_TBL_COUNT) {
- LOGE("table count not matched");
+ LOGE("table count not matched, %d, %d", idx, COMPLICATION_TBL_COUNT);
return -1;
}
diff --git a/parser/complication_plugins.txt b/parser/complication_plugins.txt
index a47aa1b..22b9d02 100644
--- a/parser/complication_plugins.txt
+++ b/parser/complication_plugins.txt
@@ -1 +1 @@
-type="tag";name="service-application";path="/etc/package-manager/parserlib/libcomplication-parser.so"
+type="tag";name="service-application";path="/etc/package-manager/parserlib/libcomplication-parser.so";vitalness="true"
diff --git a/scripts/504.watchface_complication_upgrade.sh b/scripts/504.watchface_complication_upgrade.sh
new file mode 100644
index 0000000..585b787
--- /dev/null
+++ b/scripts/504.watchface_complication_upgrade.sh
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+#-------------------------------------------------------#
+# watchface-complication patch for upgrade (4.0 -> 5.x) #
+#-------------------------------------------------------#
+
+# Macro
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+DB_DIR=/opt/dbspace
+DB_WATCHFACE_COMPLICATION=$DB_DIR/.complication_provider.db
+DB_USER_WATCHFACE_COMPLICATION=/opt/dbspace/user/5001/.complication_provider.db
+
+sqlite3 $DB_WATCHFACE_COMPLICATION << EOF
+
+PRAGMA user_version = 50;
+PRAGMA journal_mode = PERSIST;
+PRAGMA foreign_keys = ON;
+BEGIN EXCLUSIVE TRANSACTION;
+DROP TABLE IF EXISTS complication_provider;
+CREATE TABLE IF NOT EXISTS complication_provider (
+ pkgid TEXT NOT NULL,
+ appid TEXT NOT NULL,
+ provider_id TEXT NOT NULL,
+ trusted INTEGER DEFAULT 0,
+ period INTEGER DEFAULT -1,
+ PRIMARY KEY (provider_id)
+);
+
+DROP TABLE IF EXISTS provider_support_types;
+CREATE TABLE IF NOT EXISTS provider_support_types (
+ provider_id TEXT NOT NULL,
+ support_type INTEGER DEFAULT 0,
+ default_data TEXT NOT NULL,
+ UNIQUE (provider_id, support_type),
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+
+DROP TABLE IF EXISTS provider_localized_info;
+CREATE TABLE IF NOT EXISTS provider_localized_info (
+ provider_id TEXT NOT NULL,
+ locale TEXT NOT NULL DEFAULT 'No Locale',
+ provider_label TEXT,
+ UNIQUE (provider_id, locale),
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+
+DROP TABLE IF EXISTS provider_privilege;
+CREATE TABLE IF NOT EXISTS provider_privilege (
+ provider_id TEXT NOT NULL,
+ privilege TEXT NOT NULL,
+ UNIQUE (provider_id, privilege)
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+
+DROP TABLE IF EXISTS provider_setup_appid;
+CREATE TABLE IF NOT EXISTS provider_setup_appid (
+ provider_id TEXT NOT NULL,
+ setup_appid TEXT,
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+
+DROP TABLE IF EXISTS provider_support_events;
+CREATE TABLE IF NOT EXISTS provider_support_events (
+ provider_id TEXT NOT NULL,
+ support_events INTEGER DEFAULT 1,
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+COMMIT TRANSACTION;
+
+EOF
+
+# Create DB Path for default user
+mkdir -p /opt/dbspace/user/5001
+chmod 770 /opt/dbspace/user/5001
+chown owner:system_share /opt/dbspace/user/5001
+chsmack -a User::Home /opt/dbspace/user
+chsmack -a User::Home /opt/dbspace/user/5001
+
+# Copy DB
+cp $DB_WATCHFACE_COMPLICATION $DB_USER_WATCHFACE_COMPLICATION
+
+# Adjust Permission
+chmod 664 $DB_WATCHFACE_COMPLICATION
+chmod 664 $DB_WATCHFACE_COMPLICATION-journal
+
+chown owner:users $DB_WATCHFACE_COMPLICATION
+chown owner:users $DB_WATCHFACE_COMPLICATION-journal
+
+chsmack -a User::Home $DB_WATCHFACE_COMPLICATION
+chsmack -a User::Home $DB_WATCHFACE_COMPLICATION-journal
+
+chmod 666 $DB_USER_WATCHFACE_COMPLICATION
+chmod 666 $DB_USER_WATCHFACE_COMPLICATION-journal
+
+chsmack -a User::Home $DB_USER_WATCHFACE_COMPLICATION
+chsmack -a User::Home $DB_USER_WATCHFACE_COMPLICATION-journal \ No newline at end of file
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
index 2e68b79..69cc82d 100644
--- a/unittest/CMakeLists.txt
+++ b/unittest/CMakeLists.txt
@@ -3,10 +3,25 @@ PROJECT(watchface-complication_unittests CXX)
INCLUDE(FindPkgConfig)
pkg_check_modules(watchface-complication_unittests REQUIRED
- glib-2.0
- dlog
- gmock
- capi-appfw-app-control
+ glib-2.0
+ dlog
+ gmock
+ aul
+ capi-appfw-app-control
+ appsvc
+ capi-appfw-app-common
+ pkgmgr-installer
+ capi-system-info
+ gio-2.0
+ bundle
+ cynara-client
+ cynara-creds-gdbus
+ pkgmgr
+ pkgmgr-info
+ libtzplatform-config
+ sqlite3
+ libxml-2.0
+ capi-base-utils-i18n
)
FOREACH(flag ${watchface-complication_unittests_CFLAGS})
@@ -21,12 +36,25 @@ SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-common)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-common/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-complication/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-complication-provider/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-editor/include)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mock)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-complication/res)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-common COMMON_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-complication COMPLICATION_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-complication-provider COMPLICATION_PROVIDER_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../watchface-editor EDITOR_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock MOCK_SRCS)
AUX_SOURCE_DIRECTORY(src SOURCES)
ADD_EXECUTABLE(${PROJECT_NAME}
${SOURCES}
+ ${MOCK_SRCS}
+ ${COMMON_SOURCES}
+ ${COMPLICATION_SOURCES}
+ ${COMPLICATION_PROVIDER_SOURCES}
+ ${EDITOR_SOURCES}
)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watchface-complication_unittests_LDFLAGS}
@@ -38,10 +66,19 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watchface-complication_unittests_LDFLAGS
watchface-editor
)
+SET(TESTDB "complication_provider.db")
+SET(TARGET_TESTDB "complication-test-db")
+ADD_CUSTOM_COMMAND(OUTPUT ${TESTDB}
+ COMMAND sqlite3 ${TESTDB} < data/test.sql
+ COMMENT " Generate test database for ${PROJECT_NAME}"
+)
+ADD_CUSTOM_TARGET(${TARGET_TESTDB} DEPENDS ${TESTDB})
+ADD_DEPENDENCIES(${PROJECT_NAME} ${TARGET_TESTDB})
+
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/post_execution.sh DESTINATION /usr/bin/)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pre_execution.sh DESTINATION /usr/bin/)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.gmock_comp_provider-1.0.0-arm.tpk DESTINATION /tmp/)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.gmock_comp_provider-1.0.0-x86.tpk DESTINATION /tmp/)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.gmock_comp_provider2-1.0.0-arm.tpk DESTINATION /tmp/)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/res/org.tizen.gmock_comp_provider2-1.0.0-x86.tpk DESTINATION /tmp/)
+INSTALL(
+ FILES ${TESTDB}
+ PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
+ GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE WORLD_WRITE
+ DESTINATION /opt/share/watchface-complication/
+)
diff --git a/unittest/data/test.sql b/unittest/data/test.sql
new file mode 100644
index 0000000..2ec263f
--- /dev/null
+++ b/unittest/data/test.sql
@@ -0,0 +1,234 @@
+CREATE TABLE IF NOT EXISTS complication_provider (
+ pkgid TEXT NOT NULL,
+ appid TEXT NOT NULL,
+ provider_id TEXT NOT NULL,
+ trusted INTEGER DEFAULT 0,
+ period INTEGER DEFAULT -1,
+ PRIMARY KEY (provider_id)
+);
+CREATE TABLE IF NOT EXISTS provider_support_types (
+ provider_id TEXT NOT NULL,
+ support_type INTEGER DEFAULT 0,
+ default_data TEXT NOT NULL,
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+CREATE TABLE IF NOT EXISTS provider_localized_info (
+ provider_id TEXT NOT NULL,
+ locale TEXT NOT NULL DEFAULT 'No Locale',
+ provider_label TEXT,
+ UNIQUE (provider_id, locale),
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+CREATE TABLE IF NOT EXISTS provider_privilege (
+ provider_id TEXT NOT NULL,
+ privilege TEXT NOT NULL,
+ UNIQUE (provider_id, privilege)
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+CREATE TABLE IF NOT EXISTS provider_setup_appid (
+ provider_id TEXT NOT NULL,
+ setup_appid TEXT,
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+CREATE TABLE IF NOT EXISTS provider_support_events (
+ provider_id TEXT NOT NULL,
+ support_events INTEGER DEFAULT 1,
+ FOREIGN KEY (provider_id) REFERENCES complication_provider(provider_id) ON DELETE CASCADE
+);
+
+INSERT INTO complication_provider (
+ pkgid, appid, provider_id, trusted, period) VALUES (
+ 'org.tizen.gmock_comp_provider',
+ 'org.tizen.gmock_comp_provider',
+ 'org.tizen.gmock_comp_provider/test',
+ 0,
+ 1
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 2,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 4,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 8,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 16,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 32,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 64,
+ 'test'
+);
+
+INSERT INTO complication_provider (
+ pkgid, appid, provider_id, trusted, period) VALUES (
+ 'org.tizen.gmock_comp_provider2',
+ 'org.tizen.gmock_comp_provider2',
+ 'org.tizen.gmock_comp_provider2/test',
+ 0,
+ 1
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider2/test',
+ 2,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider2/test',
+ 4,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider2/test',
+ 8,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider2/test',
+ 16,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider2/test',
+ 32,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider2/test',
+ 64,
+ 'test'
+);
+
+INSERT INTO provider_setup_appid (
+ provider_id, setup_appid) VALUES (
+ 'org.tizen.gmock_comp_provider/test',
+ 'org.tizen.watchface-complication-native-utc'
+);
+
+INSERT INTO complication_provider (
+ pkgid, appid, provider_id, trusted, period) VALUES (
+ 'org.tizen.gmock_comp_provider3',
+ 'org.tizen.gmock_comp_provider3',
+ 'org.tizen.gmock_comp_provider3/test',
+ 0,
+ 1
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider3/test',
+ 2,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider3/test',
+ 4,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider3/test',
+ 8,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider3/test',
+ 16,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider3/test',
+ 32,
+ 'test'
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider3/test',
+ 64,
+ 'test'
+);
+
+INSERT INTO complication_provider (
+ pkgid, appid, provider_id, trusted, period) VALUES (
+ 'org.tizen.gmock_comp_provider4',
+ 'org.tizen.gmock_comp_provider4',
+ 'org.tizen.gmock_comp_provider4/test',
+ 0,
+ 1
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider4/test',
+ 2,
+ 'test'
+);
+
+INSERT INTO provider_privilege (
+ provider_id, privilege) VALUES (
+ 'org.tizen.gmock_comp_provider4/test',
+ 'http://tizen.org/privilege/datasharing'
+);
+
+INSERT INTO complication_provider (
+ pkgid, appid, provider_id, trusted, period) VALUES (
+ 'org.tizen.gmock_comp_provider5',
+ 'org.tizen.gmock_comp_provider5',
+ 'org.tizen.gmock_comp_provider5/test',
+ 1,
+ 1
+);
+
+INSERT INTO provider_support_types (
+ provider_id, support_type, default_data) VALUES (
+ 'org.tizen.gmock_comp_provider5/test',
+ 2,
+ 'test'
+); \ No newline at end of file
diff --git a/unittest/post_execution.sh b/unittest/post_execution.sh
deleted file mode 100644
index e0857f2..0000000
--- a/unittest/post_execution.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-su -c "pkgcmd -un org.tizen.gmock_comp_provider"
-su -c "pkgcmd -un org.tizen.gmock_comp_provider2" \ No newline at end of file
diff --git a/unittest/pre_execution.sh b/unittest/pre_execution.sh
deleted file mode 100644
index 94ebda4..0000000
--- a/unittest/pre_execution.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-if [ "$(echo $HOSTTYPE)" == "armv7l" ]; then
- su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.gmock_comp_provider-1.0.0-arm.tpk"
- su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.gmock_comp_provider2-1.0.0-arm.tpk"
-else
- su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.gmock_comp_provider-1.0.0-x86.tpk"
- su -c "pkgcmd -i -t tpk -p /tmp/org.tizen.gmock_comp_provider2-1.0.0-x86.tpk"
-fi \ No newline at end of file
diff --git a/unittest/res/org.tizen.gmock_comp_provider-1.0.0-arm.tpk b/unittest/res/org.tizen.gmock_comp_provider-1.0.0-arm.tpk
deleted file mode 100644
index 2fea692..0000000
--- a/unittest/res/org.tizen.gmock_comp_provider-1.0.0-arm.tpk
+++ /dev/null
Binary files differ
diff --git a/unittest/res/org.tizen.gmock_comp_provider-1.0.0-x86.tpk b/unittest/res/org.tizen.gmock_comp_provider-1.0.0-x86.tpk
deleted file mode 100644
index de02aee..0000000
--- a/unittest/res/org.tizen.gmock_comp_provider-1.0.0-x86.tpk
+++ /dev/null
Binary files differ
diff --git a/unittest/res/org.tizen.gmock_comp_provider2-1.0.0-arm.tpk b/unittest/res/org.tizen.gmock_comp_provider2-1.0.0-arm.tpk
deleted file mode 100644
index bf14670..0000000
--- a/unittest/res/org.tizen.gmock_comp_provider2-1.0.0-arm.tpk
+++ /dev/null
Binary files differ
diff --git a/unittest/res/org.tizen.gmock_comp_provider2-1.0.0-x86.tpk b/unittest/res/org.tizen.gmock_comp_provider2-1.0.0-x86.tpk
deleted file mode 100644
index 0360c54..0000000
--- a/unittest/res/org.tizen.gmock_comp_provider2-1.0.0-x86.tpk
+++ /dev/null
Binary files differ
diff --git a/unittest/src/test-complication-bundle.cc b/unittest/src/test-complication-bundle.cc
deleted file mode 100644
index dc8352e..0000000
--- a/unittest/src/test-complication-bundle.cc
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdbool.h>
-#include <stdexcept>
-#include <iostream>
-#include <glib.h>
-#include <dlog.h>
-
-#include <memory>
-#include <string>
-#include <list>
-
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "watchface-complication/complication-bundle.h"
-#include "watchface-complication/complication-connector.h"
-
-using namespace std;
-using namespace watchface_complication;
-
-class BUNDLE : public ::testing::Test {
- public:
- Bundle *b = nullptr;
- virtual void SetUp() {
- b = new Bundle();
- }
- virtual void TearDown() {
- delete b;
- }
-};
-
-TEST_F(BUNDLE, Create1)
-{
- EXPECT_NE(BUNDLE::b, nullptr);
-}
-
-TEST_F(BUNDLE, Create2)
-{
- int len = 0;
- bundle *data;
- bundle_raw *raw_data;
-
- data = bundle_create();
- bundle_encode(data, &raw_data, &len);
-
- Bundle *b = new Bundle(std::string(reinterpret_cast<char*>(raw_data)));
- EXPECT_NE(b, nullptr);
-
- bundle_free(data);
- free(raw_data);
- delete b;
-}
-
-TEST_F(BUNDLE, Create3)
-{
- bundle *data;
-
- data = bundle_create();
-
- Bundle *b = new Bundle(data);
- EXPECT_NE(b, nullptr);
-
- bundle_free(data);
- delete b;
-}
-
-TEST_F(BUNDLE, GetRaw)
-{
- EXPECT_NE(BUNDLE::b->GetConstRaw(), nullptr);
- EXPECT_NE(BUNDLE::b->GetRaw(), nullptr);
-}
-
-TEST_F(BUNDLE, ToString)
-{
- EXPECT_NE(BUNDLE::b->ToString(), "");
-}
-
-TEST_F(BUNDLE, Copy)
-{
- Bundle b;
- bundle_add_str(b.GetRaw(), "TEST_KEY", "TEST_VALUE");
-
- char* value;
- Bundle b2 = b;
- bundle_get_str(b2.GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
-}
-
-TEST_F(BUNDLE, Copy2)
-{
- Bundle b;
- bundle_add_str(b.GetRaw(), "TEST_KEY", "TEST_VALUE");
-
- char* value;
- Bundle b2;
- b2 = b;
- bundle_get_str(b2.GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
-}
-
-TEST_F(BUNDLE, Move)
-{
- Bundle b;
- bundle_add_str(b.GetRaw(), "TEST_KEY", "TEST_VALUE");
-
- char* value;
- Bundle b2 = std::move(b);
- bundle_get_str(b2.GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
-}
-
-TEST_F(BUNDLE, Move2)
-{
- Bundle b;
- bundle_add_str(b.GetRaw(), "TEST_KEY", "TEST_VALUE");
-
- char* value;
- Bundle b2;
- b2 = std::move(b);
- bundle_get_str(b2.GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
-} \ No newline at end of file
diff --git a/unittest/src/test-complication-provider.cc b/unittest/src/test-complication-provider.cc
index edbdd32..df14a0b 100644
--- a/unittest/src/test-complication-provider.cc
+++ b/unittest/src/test-complication-provider.cc
@@ -24,9 +24,109 @@
#include "watchface-complication-provider/complication-provider.h"
#include "watchface-complication-provider/include/watchface-complication-provider.h"
+#include "mock/tzplatform_config_mock.h"
+#include "mock/app_common.h"
+#include "mock/mock_util.h"
+#include "mock/pkgmgr_mock.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+#include "mock/cynara_mock.h"
using namespace std;
using namespace watchface_complication;
+namespace {
+
+const char* __fake_tzplatform_mkpath(
+ enum tzplatform_variable e, const char *name) {
+ return get_db_path();
+}
+
+int __cynara_initialize(
+ cynara** c, const cynara_configuration* conf) {
+ return 0;
+}
+
+int __cynara_finish(
+ cynara* c) {
+ return 0;
+}
+
+int __cynara_check(cynara* c, const char* client, const char* client_session,
+ const char* user,
+ const char* privilege) {
+ return CYNARA_API_ACCESS_ALLOWED;
+}
+
+int __cynara_creds_gdbus_get_user(GDBusConnection* connection,
+ const gchar* uniqueName, enum cynara_user_creds method, gchar** user) {
+ return CYNARA_API_SUCCESS;
+}
+
+int __cynara_creds_gdbus_get_client(GDBusConnection* connection,
+ const gchar* uniqueName, enum cynara_client_creds method, gchar** client) {
+ return CYNARA_API_SUCCESS;
+}
+
+gboolean __fake_g_dbus_connection_emit_signal(GDBusConnection * connection,
+ const gchar* destination_bus_name,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* signal_name,
+ GVariant* parameters,
+ GError** error) {
+ return TRUE;
+}
+
+guint __fake_signal_subscribe_on_update(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ return 1;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.gmock_comp_provider2");
+ return 0;
+}
+
+int __fake_aul_get_app_shared_resource_path_by_appid(const char* appid,
+ char** path) {
+ *path = strdup("/opt/usr/share/org.tizen.gmock_comp_provider2/");
+ return 0;
+}
+
+
+GDBusConnection* __fake_g_bus_get_sync(GBusType type,
+ GCancellable* cancel, GError** err) {
+ return (GDBusConnection*)calloc(1, 4);
+}
+
+guint __fake_g_bus_own_name_on_connection(GDBusConnection* conn,
+ const gchar* name, GBusNameOwnerFlags flags,
+ GBusNameAcquiredCallback acquire_cb,
+ GBusNameLostCallback lost_cb, gpointer user_data,
+ GDestroyNotify noti) {
+ return 1;
+}
+
+pkgmgr_client* __fake_pkgmgr_client_new(pkgmgr_client_type type) {
+ return (pkgmgr_client*)calloc(1, 4);
+}
+
+int __fake_pkgmgr_client_free(pkgmgr_client* ) {
+ return 0;
+}
+
+char* __fake_app_get_data_path() {
+ string path = "./";
+ return strdup(path.c_str());
+}
class WCP : public ::testing::Test {
public:
@@ -34,7 +134,26 @@ class WCP : public ::testing::Test {
string providerId = "org.tizen.gmock_comp_provider/test";
virtual void SetUp(){
- provider = new ComplicationProvider(providerId.c_str(), true);
+ tzplatform_mkpath_fake.custom_fake = __fake_tzplatform_mkpath;
+ g_bus_get_sync_fake.custom_fake = __fake_g_bus_get_sync;
+ pkgmgr_client_new_fake.custom_fake = __fake_pkgmgr_client_new;
+ pkgmgr_client_free_fake.custom_fake = __fake_pkgmgr_client_free;
+ g_bus_own_name_on_connection_fake.custom_fake = __fake_g_bus_own_name_on_connection;
+ app_get_data_path_fake.custom_fake = __fake_app_get_data_path;
+
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_signal_subscribe_on_update;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ aul_get_app_shared_resource_path_by_appid_fake.custom_fake =
+ __fake_aul_get_app_shared_resource_path_by_appid;
+ g_dbus_connection_emit_signal_fake.custom_fake =
+ __fake_g_dbus_connection_emit_signal;
+ cynara_initialize_fake.custom_fake = __cynara_initialize;
+ cynara_finish_fake.custom_fake = __cynara_finish;
+ cynara_check_fake.custom_fake = __cynara_check;
+ cynara_creds_gdbus_get_user_fake.custom_fake = __cynara_creds_gdbus_get_user;
+ cynara_creds_gdbus_get_client_fake.custom_fake = __cynara_creds_gdbus_get_client;
+
+ provider = new ComplicationProvider(providerId.c_str());
}
virtual void TearDown(){
delete provider;
@@ -48,11 +167,11 @@ TEST_F(WCP, Create)
TEST_F(WCP, GetProviderId)
{
- EXPECT_EQ(WCP::provider->GetProviderId(), providerId.c_str());
+ EXPECT_STREQ(WCP::provider->GetProviderId().c_str(), providerId.c_str());
}
-
TEST_F(WCP, NotifyUpdate)
{
WCP::provider->NotifyDataUpdate();
}
+} \ No newline at end of file
diff --git a/unittest/src/test-complication.cc b/unittest/src/test-complication.cc
index b1e3f4a..7544ca6 100644
--- a/unittest/src/test-complication.cc
+++ b/unittest/src/test-complication.cc
@@ -22,32 +22,50 @@
#include <memory>
#include <string>
#include <list>
+#include <iostream>
+#include <unistd.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "watchface-complication/complication.h"
+#include "mock/tzplatform_config_mock.h"
+#include "mock/app_common.h"
+#include "mock/mock_util.h"
+#include "mock/pkgmgr_mock.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+
using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
-
-GMainLoop *mainloop = NULL;
-unsigned int loop_timer = 0;
+namespace {
+GMainLoop* loop_ = NULL;
+unsigned int timer_ = 0;
+unsigned int event_timer__;
class WatchComplication : public Complication {
public:
+ enum TestType {
+ None,
+ Error,
+ Updated
+ };
WatchComplication(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type)
: Complication(id, supported_types, supported_event_types,
- default_provider_id, default_type, true) {
+ default_provider_id, default_type) {
}
void OnProviderError(const std::string& provider_id,
ComplicationType type, int error) override {
cout << "provider error : " << provider_id << "(" << error << ")" << endl;
- if (loop_timer == 0) {
- loop_timer = g_timeout_add(1000, [](gpointer user_data)->gboolean {
- g_main_loop_quit(mainloop);
- loop_timer = 0;
+ if (timer_ == 0 && test_type_ == Error) {
+ timer_ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ g_main_loop_quit(loop_);
+ timer_ = 0;
return G_SOURCE_REMOVE;
}, this);
}
@@ -55,26 +73,160 @@ class WatchComplication : public Complication {
if (error == WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE)
not_available_ = true;
}
+ void OnDataUpdated(const std::string& provider_id,
+ ComplicationType type,
+ const std::unique_ptr<Bundle>& data) {
+ cur_type_ = type;
+ if (timer_ == 0 && test_type_ == Updated) {
+ timer_ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ g_main_loop_quit(loop_);
+ timer_ = 0;
+ return G_SOURCE_REMOVE;
+ }, this);
+ }
+ }
+ void SetTestType(TestType type) {
+ test_type_ = type;
+ }
virtual ~WatchComplication() = default;
public:
+ TestType test_type_ = None;
unsigned int event_timer_ = 0;
bool not_available_ = false;
+ ComplicationType cur_type_ = NoData;
};
+const char* __fake_tzplatform_mkpath(
+ enum tzplatform_variable e, const char* name) {
+ return get_db_path();
+}
+
+GDBusConnection* __fake_g_bus_get_sync(GBusType type,
+ GCancellable* cancel, GError** err) {
+ return (GDBusConnection*)calloc(1, 4);
+}
+
+guint __fake_g_bus_own_name_on_connection(GDBusConnection* conn,
+ const gchar* name, GBusNameOwnerFlags flags,
+ GBusNameAcquiredCallback acquire_cb,
+ GBusNameLostCallback lost_cb, gpointer user_data,
+ GDestroyNotify noti) {
+ return 1;
+}
+
+pkgmgr_client* __fake_pkgmgr_client_new(pkgmgr_client_type type) {
+ return (pkgmgr_client*)calloc(1, 4);
+}
+
+int __fake_pkgmgr_client_free(pkgmgr_client* client) {
+ return 0;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.gmock_comp_provider2");
+ return 0;
+}
+
+char* __fake_app_get_data_path() {
+ string path = "./";
+ return strdup(path.c_str());
+}
+
+guint __fake_g_bus_watch_name_on_connection(GDBusConnection* connection,
+ const gchar* name,
+ GBusNameWatcherFlags flags,
+ GBusNameAppearedCallback name_appeared_handler,
+ GBusNameVanishedCallback name_vanished_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ name_appeared_handler(nullptr, "appear test", "test owner", user_data);
+ name_vanished_handler(nullptr, "vanish test", user_data);
+ return 1;
+}
+
+GDBusMessage* __fake_g_dbus_message_new_method_call(
+ const gchar* a, const gchar* b, const gchar* c, const gchar* d) {
+ return (GDBusMessage*)calloc(1, 4);
+}
+
+void __fake_g_dbus_message_set_body(GDBusMessage* m,
+ GVariant* a) {
+}
+
+GDBusMessage* __fake_g_dbus_connection_send_message_with_reply_sync(
+ GDBusConnection* conn, GDBusMessage* m, GDBusSendMessageFlags f, gint a,
+ volatile guint32* b, GCancellable* c, GError** d) {
+ return (GDBusMessage*)calloc(1, 4);
+}
+
+void __fake_g_object_unref(gpointer o) {
+}
+
+GVariant* __fake_g_dbus_message_get_body(GDBusMessage* m) {
+ return g_variant_new("(u)", 10);
+}
+void __fake_g_dbus_connection_signal_unsubscribe(GDBusConnection* c,
+ guint a) {
+}
+
+void __fake_g_bus_unwatch_name(guint a) {
+}
+
+guint __fake_g_dbus_connection_signal_subscribe(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ return 1;
+}
+
+int __fake_pkgmgrinfo_pkginfo_compare_usr_app_cert_info(const char* lhs_app_id,
+ const char* rhs_app_id, uid_t uid,
+ pkgmgrinfo_cert_compare_result_type_e* compare_result) {
+ *compare_result = PMINFO_CERT_COMPARE_MATCH;
+ return 0;
+}
+
class WC : public ::testing::Test {
public:
ComplicationType default_type = ShortText;
WatchComplication* complication = NULL;
- WatchComplication* complication2 = NULL;
string providerId = "org.tizen.gmock_comp_provider/test";
string providerId2 = "org.tizen.gmock_comp_provider2/test";
+ string providerId3 = "org.tizen.gmock_comp_provider3/test";
~WC() { }
- void RunMainLoop() {
- g_main_loop_run(mainloop);
+ void RunLoop() {
+ g_main_loop_run(loop_);
}
virtual void SetUp() {
- mainloop = g_main_loop_new(NULL, FALSE);
+ tzplatform_mkpath_fake.custom_fake = __fake_tzplatform_mkpath;
+ g_bus_get_sync_fake.custom_fake = __fake_g_bus_get_sync;
+ pkgmgr_client_new_fake.custom_fake = __fake_pkgmgr_client_new;
+ pkgmgr_client_free_fake.custom_fake = __fake_pkgmgr_client_free;
+ g_bus_own_name_on_connection_fake.custom_fake = __fake_g_bus_own_name_on_connection;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ app_get_data_path_fake.custom_fake = __fake_app_get_data_path;
+
+ g_bus_watch_name_on_connection_fake.custom_fake = __fake_g_bus_watch_name_on_connection;
+ g_dbus_message_new_method_call_fake.custom_fake = __fake_g_dbus_message_new_method_call;
+ g_dbus_message_set_body_fake.custom_fake = __fake_g_dbus_message_set_body;
+ g_dbus_connection_send_message_with_reply_sync_fake.custom_fake = __fake_g_dbus_connection_send_message_with_reply_sync;
+ g_object_unref_fake.custom_fake = __fake_g_object_unref;
+ g_dbus_message_get_body_fake.custom_fake = __fake_g_dbus_message_get_body;
+ g_dbus_connection_signal_unsubscribe_fake.custom_fake = __fake_g_dbus_connection_signal_unsubscribe;
+ g_bus_unwatch_name_fake.custom_fake = __fake_g_bus_unwatch_name;
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_g_dbus_connection_signal_subscribe;
+ pkgmgrinfo_pkginfo_compare_usr_app_cert_info_fake.custom_fake = __fake_pkgmgrinfo_pkginfo_compare_usr_app_cert_info;
+
+ loop_ = g_main_loop_new(NULL, FALSE);
complication = new WatchComplication(0, default_type, EventTap,
providerId.c_str(), ShortText);
complication->Init();
@@ -83,16 +235,16 @@ class WC : public ::testing::Test {
new IEditable::Highlight(
std::unique_ptr<IEditable::Geometry>(new IEditable::Geometry(0, 0, 100, 100)),
IEditable::EditableShapeType::Circle)));
-
- complication2 = new WatchComplication(1, default_type, EventTap,
- providerId2.c_str(), ShortText);
- complication2->Init();
}
virtual void TearDown() {
delete complication;
- delete complication2;
- g_main_loop_unref(mainloop);
- mainloop = NULL;
+ if (event_timer__ != 0) {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ }
+ g_main_loop_quit(loop_);
+ g_main_loop_unref(loop_);
+ loop_ = NULL;
}
};
@@ -144,8 +296,86 @@ TEST_F(WC, Key)
EXPECT_STREQ(WC::complication->GetProviderTypeKey(), "__PROVIDER_TYPE_KEY__");
}
+guint __fake_signal_subscribe_on_data_updated(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ Bundle b;
+ GVariant* parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider2/test",
+ ShortText,
+ 4,
+ b.ToRaw().first.get());
+ callback(nullptr, "org.tizen.gmock_comp_provider2",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters,
+ user_data);
+ parameters = g_variant_new("(s)", "org.tizen.gmock_comp_provider2/test");
+ callback(nullptr, "org.tizen.gmock_comp_provider2",
+ "test path",
+ "test interface",
+ "__COMP_NOTIFY_DATA_UPDATE__",
+ parameters,
+ user_data);
+ callback(nullptr, "org.tizen.gmock_comp_provider2",
+ "test path",
+ "test interface",
+ "__PROVIDER_READY__",
+ parameters,
+ user_data);
+ return 1;
+}
+
+TEST_F(WC, OnDataUpdated)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_signal_subscribe_on_data_updated;
+
+ WatchComplication* comp = new WatchComplication(4, default_type, EventTap,
+ providerId2.c_str(), ShortText);
+ comp->Init();
+ comp->SetTestType(WatchComplication::Updated);
+ EXPECT_EQ(comp->cur_type_, ShortText);
+ delete comp;
+}
+
+TEST_F(WC, OnEditableUpdated)
+{
+ WatchComplication* comp = new WatchComplication(4, default_type, EventTap,
+ providerId2.c_str(), ShortText);
+ comp->Init();
+ comp->OnEditableUpdated(0, IEditable::OnGoing);
+ EXPECT_EQ(comp->cur_type_, ShortText);
+ delete comp;
+}
+
+int __fake_aul_complication_update_request(const char* appid,
+ const char* provider_appid, uid_t uid) {
+ return 0;
+}
+
+gboolean __fake_g_dbus_connection_emit_signal(GDBusConnection* connection,
+ const gchar* destination_bus_name,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* signal_name,
+ GVariant* parameters,
+ GError** error) {
+ return TRUE;
+}
+
TEST_F(WC, SendDataUpdateRequest)
{
+ aul_complication_update_request_fake.custom_fake =
+ __fake_aul_complication_update_request;
+ g_dbus_connection_emit_signal_fake.custom_fake =
+ __fake_g_dbus_connection_emit_signal;
EXPECT_EQ(WC::complication->SendDataUpdateRequest(), 0);
}
@@ -154,56 +384,158 @@ TEST_F(WC, GetCurType)
EXPECT_EQ(WC::complication->GetCurType(), default_type);
}
+TEST_F(WC, GetComplicationId)
+{
+ EXPECT_EQ(WC::complication->GetComplicationId(), 0);
+}
+
+int __fake_aul_complication_launch_with_extra_data(const char* appid,
+ const char* provider_appid, uid_t uid, const char* key, char* value) {
+ return 0;
+}
+
+TEST_F(WC, TouchLaunch)
+{
+ aul_complication_launch_with_extra_data_fake.custom_fake =
+ __fake_aul_complication_launch_with_extra_data;
+ WatchComplication* comp = new WatchComplication(1, default_type, EventTap,
+ providerId2.c_str(), ShortText);
+ comp->Init();
+ EXPECT_EQ(comp->TouchLaunch(WATCHFACE_COMPLICATION_EVENT_TAP), 0);
+ delete comp;
+}
+
+TEST_F(WC, SetCandidates)
+{
+ WatchComplication* comp = new WatchComplication(1, default_type, EventTap,
+ providerId2.c_str(), ShortText);
+ comp->Init();
+ std::list<std::shared_ptr<Bundle>> candidates_list;
+ EXPECT_EQ(comp->SetCandidates(candidates_list), 0);
+ delete comp;
+}
+
TEST_F(WC, GetCurData)
{
- const Bundle* data = WC::complication->GetCurData();
- EXPECT_NE(data, nullptr);
+ shared_ptr<Bundle> data = WC::complication->GetCurData();
+ EXPECT_NE(data.get(), nullptr);
}
TEST_F(WC, GetNthData)
{
- const Bundle* data = WC::complication->GetNthData(0);
- EXPECT_NE(data, nullptr);
+ shared_ptr<Bundle> data = WC::complication->GetNthData(0);
+ EXPECT_NE(data.get(), nullptr);
+}
+
+int __fake_pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h,
+ pkgmgrinfo_app_list_cb cb, void* user_data) {
+ cb(nullptr, nullptr);
+ return 0;
+}
+
+int __fake_pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h info, char** appid) {
+ *appid = strdup("org.tizen.gmock_comp_provider2");
+ return 0;
+}
+
+int __fake_pkgmgrinfo_appinfo_get_disabled_appinfo(const char* appid,
+ pkgmgrinfo_appinfo_h* handle) {
+ return 0;
+}
+
+int __fake_pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h info) {
+ return 0;
+}
+
+int __fake_pkgmgr_client_listen_status(pkgmgr_client* client,
+ pkgmgr_handler handler, void* user_data) {
+ if (event_timer__ > 0)
+ g_source_remove(event_timer__);
+
+ event_timer__ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ pkgmgr_handler handler = reinterpret_cast<pkgmgr_handler>(user_data);
+ static int seq = 0;
+ if (seq++ % 2 == 0) {
+ cout << "diable" << endl;
+ handler(0, 0, "test", "org.tizen.gmock_comp_provider2",
+ "start", "disable_app", nullptr, nullptr);
+ } else {
+ cout << "diable done" << endl;
+ handler(0, 0, "test", "org.tizen.gmock_comp_provider2",
+ "end", "ok", nullptr, nullptr);
+ cout << "uninstall" << endl;
+ handler(0, 0, "test", "org.tizen.gmock_comp_provider2",
+ "start", "uninstall", nullptr, nullptr);
+ handler(0, 0, "test", "org.tizen.gmock_comp_provider2",
+ "end", "ok", nullptr, nullptr);
+ }
+ return G_SOURCE_CONTINUE;
+ }, reinterpret_cast<gpointer>(handler));
+ return 1;
}
TEST_F(WC, Disabled)
{
- std::list<std::unique_ptr<Bundle>> const& list = complication2->GetCandidates();
+ pkgmgrinfo_appinfo_destroy_appinfo_fake.custom_fake = __fake_pkgmgrinfo_appinfo_destroy_appinfo;
+ pkgmgrinfo_appinfo_get_disabled_appinfo_fake.custom_fake = __fake_pkgmgrinfo_appinfo_get_disabled_appinfo;
+ pkgmgr_client_listen_status_fake.custom_fake = __fake_pkgmgr_client_listen_status;
+ pkgmgrinfo_appinfo_get_appid_fake.custom_fake = __fake_pkgmgrinfo_appinfo_get_appid;
+ pkgmgrinfo_appinfo_filter_foreach_appinfo_fake.custom_fake = __fake_pkgmgrinfo_appinfo_filter_foreach_appinfo;
+ WatchComplication* comp = new WatchComplication(1, default_type, EventTap,
+ providerId2.c_str(), ShortText);
+ comp->Init();
+ std::list<std::shared_ptr<Bundle>> const& list = comp->GetCandidates();
for (unsigned int i = 0; i < list.size(); i++) {
- complication->SetCurDataIdx(i);
- if (strcmp(complication->GetCurProviderId(), "org.tizen.gmock_comp_provider/test") == 0)
+ comp->SetCurDataIdx(i);
+ if (comp->GetCurProviderId() == "org.tizen.gmock_comp_provider2/test")
break;
}
- WC::complication->not_available_ = false;
- complication->UpdateLastData();
- RunMainLoop();
- EXPECT_EQ(WC::complication->not_available_, true);
+ comp->not_available_ = false;
+ comp->UpdateLastData();
+ comp->SetTestType(WatchComplication::Error);
+ RunLoop();
+ EXPECT_EQ(comp->not_available_, true);
+ delete comp;
}
TEST_F(WC, DisabledRecovery)
{
- std::list<std::unique_ptr<Bundle>> const& list = complication2->GetCandidates();
+ pkgmgr_client_listen_status_fake.custom_fake = __fake_pkgmgr_client_listen_status;
+ pkgmgrinfo_appinfo_get_appid_fake.custom_fake = __fake_pkgmgrinfo_appinfo_get_appid;
+ pkgmgrinfo_appinfo_filter_foreach_appinfo_fake.custom_fake = __fake_pkgmgrinfo_appinfo_filter_foreach_appinfo;
+
+ WatchComplication* comp = new WatchComplication(4, default_type, EventTap,
+ providerId3.c_str(), ShortText);
+ comp->Init();
+ std::list<std::shared_ptr<Bundle>> const& list = comp->GetCandidates();
for (unsigned int i = 0; i < list.size(); i++) {
- complication2->SetCurDataIdx(i);
- if (strcmp(complication2->GetCurProviderId(), WC::providerId.c_str()) == 0)
+ comp->SetCurDataIdx(i);
+ if (comp->GetCurProviderId() == WC::providerId2)
break;
}
- RunMainLoop();
- EXPECT_EQ(strcmp(complication2->GetCurProviderId(), WC::providerId2.c_str()), 0);
+
+ WatchComplication* comp1 = new WatchComplication(5, default_type, EventTap,
+ providerId2.c_str(), ShortText);
+ comp1->Init();
+ comp->SetTestType(WatchComplication::Error);
+ comp1->SetTestType(WatchComplication::Error);
+ RunLoop();
+ EXPECT_STREQ(comp->GetCurProviderId().c_str(), WC::providerId3.c_str());
+ delete comp;
+ delete comp1;
}
TEST_F(WC, GetProviderId)
{
- const Bundle* data = WC::complication->GetCurData();
- const char* provider_id = WC::complication->GetProviderId(data);
- EXPECT_EQ(strcmp(complication->GetCurProviderId(), provider_id), 0);
+ shared_ptr<Bundle> data = WC::complication->GetCurData();
+ string provider_id = WC::complication->GetProviderId(*data);
+ EXPECT_STREQ(complication->GetCurProviderId().c_str(), provider_id.c_str());
}
TEST_F(WC, GetProviderType)
{
- const Bundle* data = WC::complication->GetCurData();
-
- EXPECT_EQ(WC::complication->GetProviderType(data), WC::complication->GetCurType());
+ shared_ptr<Bundle> data = WC::complication->GetCurData();
+ EXPECT_EQ(WC::complication->GetProviderType(*data), WC::complication->GetCurType());
}
TEST_F(WC, GetSetupAppId)
@@ -224,33 +556,27 @@ TEST_F(WC, GetPrivilegeErrorKey)
TEST_F(WC, SetContext)
{
- bundle* b = bundle_create();
- bundle_add_str(b, "TEST_KEY", "TEST_VALUE");
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
- Bundle* bundle = new Bundle(b);
- bundle_free(b);
WC::complication->SetContext(std::unique_ptr<Bundle>(bundle));
std::unique_ptr<Bundle>& ctx = WC::complication->GetContext();
- char* value;
- bundle_get_str(ctx.get()->GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
+ string value = ctx.get()->GetString("TEST_KEY");
+ EXPECT_STREQ(value.c_str(), "TEST_VALUE");
}
TEST_F(WC, GetLastContext)
{
- bundle* b = bundle_create();
- bundle_add_str(b, "TEST_KEY", "TEST_VALUE");
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
- Bundle* bundle = new Bundle(b);
- bundle_free(b);
WC::complication->SetContext(std::unique_ptr<Bundle>(bundle));
WC::complication->UpdateLastContext();
std::unique_ptr<Bundle>& ctx = WC::complication->GetLastContext();
- char* value;
- bundle_get_str(ctx.get()->GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
+ string value = ctx.get()->GetString("TEST_KEY");
+ EXPECT_STREQ(value.c_str(), "TEST_VALUE");
}
TEST_F(WC, DuplicateID)
@@ -275,7 +601,7 @@ TEST_F(WC, ApplyAllowedList)
int ret = WC::complication->ApplyAllowedList(std::move(allowed_list));
EXPECT_EQ(ret, WATCHFACE_COMPLICATION_ERROR_NONE);
- std::list<std::unique_ptr<Bundle>> const& list = complication->GetCandidates();
+ std::list<std::shared_ptr<Bundle>> const& list = complication->GetCandidates();
EXPECT_EQ(1, list.size());
}
@@ -288,6 +614,18 @@ TEST_F(WC, ClearAllowedList)
int ret = WC::complication->ClearAllowedList();
EXPECT_EQ(ret, WATCHFACE_COMPLICATION_ERROR_NONE);
- std::list<std::unique_ptr<Bundle>> const& list = complication->GetCandidates();
+ std::list<std::shared_ptr<Bundle>> const& list = complication->GetCandidates();
EXPECT_EQ(true, list.size() > 0);
+}
+
+TEST_F(WC, TrustedComplication)
+{
+ WatchComplication* trusted_comp =
+ new WatchComplication(100, ShortText, EventNone,
+ "org.tizen.gmock_comp_provider5/test", ShortText);
+ int ret = trusted_comp->Init();
+ EXPECT_EQ(ret, 0);
+ delete trusted_comp;
+}
+
} \ No newline at end of file
diff --git a/unittest/src/test-design-element.cc b/unittest/src/test-design-element.cc
index c058939..efd4127 100644
--- a/unittest/src/test-design-element.cc
+++ b/unittest/src/test-design-element.cc
@@ -13,30 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-#include <stdbool.h>
+#include <memory>
+#include <string>
+#include <list>
#include <stdexcept>
#include <iostream>
+
+#include <stdbool.h>
#include <glib.h>
#include <dlog.h>
-
-#include <memory>
-#include <string>
-#include <list>
+#include <bundle_cpp.h>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "watchface-complication/design-element.h"
-#include "watchface-complication/complication-bundle.h"
using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
class Element : public DesignElement {
public:
Element(int id, int cur_data_idx)
- : DesignElement(id, cur_data_idx, true){
+ : DesignElement(id, cur_data_idx){
SetLabel("Test");
SetHighlight(std::unique_ptr<IEditable::Highlight>(
new Highlight(
@@ -50,13 +50,13 @@ class Element : public DesignElement {
class DE : public ::testing::Test {
public:
Element* element = NULL;
- std::list<std::unique_ptr<Bundle>> candidatesList;
+ std::list<std::shared_ptr<Bundle>> candidates;
virtual void SetUp() {
- candidatesList.emplace_back(std::unique_ptr<Bundle>(new Bundle()));
+ candidates.emplace_back(std::shared_ptr<Bundle>(new Bundle()));
element = new Element(0, 0);
- element->SetCandidates(std::move(candidatesList));
+ element->SetCandidates(candidates);
}
virtual void TearDown() {
delete element;
@@ -79,17 +79,17 @@ TEST_F(DE, GetGeo)
TEST_F(DE, GetCandidates)
{
- std::list<std::unique_ptr<Bundle>> const& list = DE::element->GetCandidates();
+ std::list<std::shared_ptr<Bundle>> const& list = DE::element->GetCandidates();
EXPECT_NE(list.empty(), true);
}
TEST_F(DE, GetData)
{
- const Bundle* curData = DE::element->GetCurData();
- const Bundle* nthData = DE::element->GetNthData(0);
+ shared_ptr<Bundle> curData = DE::element->GetCurData();
+ shared_ptr<Bundle> nthData = DE::element->GetNthData(0);
- EXPECT_NE(curData->GetConstRaw(), nullptr);
- EXPECT_NE(nthData->GetConstRaw(), nullptr);
+ EXPECT_NE(curData->GetHandle(), nullptr);
+ EXPECT_NE(nthData->GetHandle(), nullptr);
}
TEST_F(DE, DataIdx)
@@ -115,6 +115,13 @@ TEST_F(DE, GetEditableId)
EXPECT_EQ(DE::element->GetEditableId(), 0);
}
+
+TEST_F(DE, SetEditableId)
+{
+ EXPECT_EQ(DE::element->SetEditableId(1), 0);
+ EXPECT_EQ(DE::element->GetEditableId(), 1);
+}
+
TEST_F(DE, State)
{
DE::element->SetState(IEditable::EditableState::Complete);
@@ -134,31 +141,23 @@ TEST_F(DE, GetSetupAppId)
TEST_F(DE, SetContext)
{
- bundle* b = bundle_create();
- bundle_add_str(b, "TEST_KEY", "TEST_VALUE");
-
- Bundle* bundle = new Bundle(b);
- bundle_free(b);
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
DE::element->SetContext(std::unique_ptr<Bundle>(bundle));
std::unique_ptr<Bundle>& ctx = DE::element->GetContext();
- char* value;
- bundle_get_str(ctx.get()->GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
+ string value = ctx.get()->GetString("TEST_KEY");
+ EXPECT_STREQ(value.c_str(), "TEST_VALUE");
}
TEST_F(DE, GetLastContext)
{
- bundle* b = bundle_create();
- bundle_add_str(b, "TEST_KEY", "TEST_VALUE");
-
- Bundle* bundle = new Bundle(b);
- bundle_free(b);
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
DE::element->SetContext(std::unique_ptr<Bundle>(bundle));
DE::element->UpdateLastContext();
std::unique_ptr<Bundle>& ctx = DE::element->GetLastContext();
- char* value;
- bundle_get_str(ctx.get()->GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
+ string value = ctx.get()->GetString("TEST_KEY");
+ EXPECT_STREQ(value.c_str(), "TEST_VALUE");
} \ No newline at end of file
diff --git a/unittest/src/test-editables-container.cc b/unittest/src/test-editables-container.cc
index ca5efb2..1e38c89 100644
--- a/unittest/src/test-editables-container.cc
+++ b/unittest/src/test-editables-container.cc
@@ -19,82 +19,139 @@
#include <iostream>
#include <glib.h>
#include <dlog.h>
+#include <unistd.h>
#include <memory>
#include <string>
#include <list>
+#include <vector>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
+#include "watchface-complication/design-element.h"
#include "watchface-complication/editables-container.h"
#include "watchface-complication/received-editable.h"
#include "watchface-complication/include/watchface-complication.h"
#include "watchface-complication/include/watchface-editable.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+#include "mock/pkgmgr_mock.h"
+
using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
+namespace {
+unsigned int event_timer__;
+GMainLoop* ec_loop_ = nullptr;
+class Element : public DesignElement {
+ public:
+ Element(int id, int cur_data_idx)
+ : DesignElement(id, cur_data_idx){
+ SetLabel("Test");
+ SetHighlight(std::unique_ptr<IEditable::Highlight>(
+ new Highlight(
+ std::unique_ptr<IEditable::Geometry>(
+ new IEditable::Geometry(0, 0, 100, 100)),
+ IEditable::EditableShapeType::Circle
+ )
+ ));
+ }
+
+ virtual ~Element() = default;
+};
class MyContainer : public EditablesContainer {
public:
- MyContainer()
- : EditablesContainer(true) {
+ MyContainer() : EditablesContainer() {
}
void OnUpdate(const IEditable& ed, int selected_idx,
IEditable::EditableState state) override {
+ is_updated_ = true;
}
void OnEditReady(const std::string& editor_id) override {
-
+ cout << "edit ready " << endl;
+ this->Add(std::shared_ptr<IEditable>(new Element(1, 0)), 0);
+ this->Add(std::shared_ptr<IEditable>(new Element(2, 0)), 1);
}
virtual ~MyContainer() = default;
+ public:
+ bool is_updated_ = false;
};
+int __fake_pkgmgr_client_listen_status(pkgmgr_client* client,
+ pkgmgr_handler handler, void* user_data) {
+ return 1;
+}
+
+guint __fake_g_dbus_connection_signal_subscribe(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ return 2;
+}
+
class EC : public ::testing::Test {
public:
MyContainer* container;
- ReceivedEditable* received;
+ shared_ptr<IEditable> received;
virtual void SetUp() {
- int len = 0;
- bundle* data;
- bundle_raw* raw_data;
-
- Bundle* candidate1 = new Bundle();
- Bundle* candidate2 = new Bundle();
- std::unique_ptr<const char*[]> array(new const char*[2]);
-
- data = bundle_create();
- bundle_add_str(data, "GEO_X", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_Y", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_W", std::to_string(100).c_str());
- bundle_add_str(data, "GEO_H", std::to_string(100).c_str());
- bundle_add_str(data, "SHAPE_TYPE", std::to_string(IEditable::EditableShapeType::Circle).c_str());
- bundle_add_str(data, "CUR_DATA_IDX", std::to_string(0).c_str());
- bundle_add_str(data, "NAME", "sample");
- bundle_add_str(data, "EDITABLE_ID", std::to_string(0).c_str());
- bundle_add_str(data, "SETUP_APPID", "");
-
- array.get()[0] = candidate1->ToString();
- array.get()[1] = candidate2->ToString();
-
- bundle_add_str_array(data, "CANDIDATES_LIST", array.get(), 2);
- bundle_encode(data, &raw_data, &len);
-
- received = new ReceivedEditable(std::string(reinterpret_cast<char*>(raw_data)));
- container = new MyContainer();
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_g_dbus_connection_signal_subscribe;
+ ec_loop_ = g_main_loop_new(nullptr, FALSE);
+ pkgmgr_client_listen_status_fake.custom_fake =
+ __fake_pkgmgr_client_listen_status;
+
+ Bundle data;
+ data.Add("GEO_X", std::to_string(0));
+ data.Add("GEO_Y", std::to_string(0));
+ data.Add("GEO_W", std::to_string(100));
+ data.Add("GEO_H", std::to_string(100));
+ data.Add("SHAPE_TYPE",
+ std::to_string(IEditable::EditableShapeType::Circle));
+ data.Add("CUR_DATA_IDX", std::to_string(0));
+ data.Add("NAME", "sample");
+ data.Add("EDITABLE_ID", std::to_string(0));
+ data.Add("SETUP_APPID", "");
+
+ Bundle candidate1;
+ Bundle candidate2;
+ vector<string> candidates_list;
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate1.ToRaw().first.get()));
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate2.ToRaw().first.get()));
+ data.Add("CANDIDATES_LIST", candidates_list);
- delete candidate1;
- delete candidate2;
- bundle_free(data);
- free(raw_data);
+ received = shared_ptr<IEditable>(new ReceivedEditable(
+ reinterpret_cast<char*>(data.ToRaw().first.get())));
+ container = new MyContainer();
}
virtual void TearDown() {
- delete received;
delete container;
+
+ if (event_timer__ != 0) {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ }
+ g_main_loop_quit(ec_loop_);
+ g_main_loop_unref(ec_loop_);
+ ec_loop_ = nullptr;
+ }
+ void RunLoop() {
+ g_main_loop_run(ec_loop_);
}
};
@@ -105,39 +162,123 @@ TEST_F(EC, Create)
TEST_F(EC, AddRemove)
{
- int len = 0;
- bundle* data;
- bundle_raw* raw_data;
-
- Bundle* candidate1 = new Bundle();
- Bundle* candidate2 = new Bundle();
- std::unique_ptr<const char*[]> array(new const char*[2]);
-
- data = bundle_create();
- bundle_add_str(data, "GEO_X", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_Y", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_W", std::to_string(100).c_str());
- bundle_add_str(data, "GEO_H", std::to_string(100).c_str());
- bundle_add_str(data, "SHAPE_TYPE", std::to_string(IEditable::EditableShapeType::Circle).c_str());
- bundle_add_str(data, "CUR_DATA_IDX", std::to_string(0).c_str());
- bundle_add_str(data, "NAME", "sample");
- bundle_add_str(data, "EDITABLE_ID", std::to_string(0).c_str());
- bundle_add_str(data, "SETUP_APPID", "");
-
- array.get()[0] = candidate1->ToString();
- array.get()[1] = candidate2->ToString();
- bundle_add_str_array(data, "CANDIDATES_LIST", array.get(), 2);
-
- bundle_encode(data, &raw_data, &len);
-
- ReceivedEditable* re = new ReceivedEditable(std::string(reinterpret_cast<char*>(raw_data)));
- std::shared_ptr<IEditable> ed = static_cast<std::shared_ptr<IEditable>>(re);
-
- delete candidate1;
- delete candidate2;
- bundle_free(data);
- free(raw_data);
-
- EXPECT_EQ(EC::container->Add(ed, 1), 0);
- EXPECT_EQ(EC::container->Remove(ed), 0);
+ EXPECT_EQ(EC::container->Add(received, 1), 0);
+ EXPECT_EQ(EC::container->Remove(received), 0);
+}
+
+guint __fake_signal_subscribe_on_update(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ if (event_timer__ != 0)
+ g_source_remove(event_timer__);
+
+ event_timer__ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+ Bundle b;
+ GVariant* parameters = g_variant_new("(s)", "org.tizen.editor");
+
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_READY__",
+ parameters);
+
+ parameters = g_variant_new("(iis)", 0, 0, b.ToRaw().first.get());
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_PREVIEW__",
+ parameters);
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_CANCEL__",
+ parameters);
+ parameters = g_variant_new("(iis)", 0, 0, b.ToRaw().first.get());
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_PREVIEW__",
+ parameters);
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_COMPLETE__",
+ parameters);
+ g_main_loop_quit(ec_loop_);
+
+ return G_SOURCE_CONTINUE;
+ }, reinterpret_cast<gpointer>(user_data));
+
+ return 1;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.editor");
+ return 0;
+}
+
+TEST_F(EC, OnUpdate)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_update;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ MyContainer* con = new MyContainer();
+ RunLoop();
+ EXPECT_EQ(con->is_updated_, true);
+ delete con;
+}
+
+
+gboolean __fake_g_dbus_connection_emit_signal(GDBusConnection* connection,
+ const gchar* destination_bus_name,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* signal_name,
+ GVariant* parameters,
+ GError** error) {
+ return TRUE;
}
+
+guint __fake_g_bus_watch_name_on_connection(GDBusConnection* connection,
+ const gchar* name,
+ GBusNameWatcherFlags flags,
+ GBusNameAppearedCallback name_appeared_handler,
+ GBusNameVanishedCallback name_vanished_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ name_appeared_handler(nullptr, "appear test", "test owner", user_data);
+ name_vanished_handler(nullptr, "vanish test", user_data);
+ return 1;
+}
+
+TEST_F(EC, RequestEdit)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_update;
+ g_dbus_connection_emit_signal_fake.custom_fake =
+ __fake_g_dbus_connection_emit_signal;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ g_bus_watch_name_on_connection_fake.custom_fake =
+ __fake_g_bus_watch_name_on_connection;
+ MyContainer* con = new MyContainer();
+ RunLoop();
+ EXPECT_EQ(con->RequestEdit(), 0);
+
+ delete con;
+}
+
+TEST_F(EC, IsExist)
+{
+ container->Add(std::shared_ptr<IEditable>(new Element(1, 0)), 0);
+ EXPECT_EQ(container->IsExist(7), false);
+}
+
+} \ No newline at end of file
diff --git a/unittest/src/test-editables-manager.cc b/unittest/src/test-editables-manager.cc
index 3feccdf..660a58e 100644
--- a/unittest/src/test-editables-manager.cc
+++ b/unittest/src/test-editables-manager.cc
@@ -30,6 +30,7 @@
#include "watchface-complication/editables-manager.h"
using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
class EDITABLES_MANAGER : public ::testing::Test {
@@ -42,14 +43,11 @@ class EDITABLES_MANAGER : public ::testing::Test {
TEST_F(EDITABLES_MANAGER, StoreContext)
{
- bundle* b = bundle_create();
- bundle_add_str(b, "TEST_KEY", "TEST_VALUE");
-
- Bundle bundle(b);
- bundle_free(b);
- EditablesManager::GetInst(true).StoreContext(10, "org.tizen.mock_provider/test",
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
+ EditablesManager::GetInst().StoreContext(10, "org.tizen.mock_provider/test",
bundle);
- int ret = EditablesManager::GetInst(true).DeleteContext(
+ int ret = EditablesManager::GetInst().DeleteContext(
10, "org.tizen.mock_provider/test");
EXPECT_EQ(ret, 0);
} \ No newline at end of file
diff --git a/unittest/src/test-editor.cc b/unittest/src/test-editor.cc
index 8d5fb23..9f60f5f 100644
--- a/unittest/src/test-editor.cc
+++ b/unittest/src/test-editor.cc
@@ -18,6 +18,7 @@
#include <stdexcept>
#include <iostream>
#include <glib.h>
+#include <vector>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
@@ -26,23 +27,49 @@
#include "watchface-complication/received-editable.h"
#include "watchface-complication/include/watchface-editable.h"
#include "watchface-editor/include/watchface-editor.h"
+#include "mock/cynara_mock.h"
using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
+int __cynara_initialize(
+ cynara** c, const cynara_configuration* conf) {
+ return 0;
+}
+
+int __cynara_finish(
+ cynara* c) {
+ return 0;
+}
+
+int __cynara_check(cynara* c, const char* client, const char* client_session,
+ const char* user,
+ const char* privilege) {
+ return CYNARA_API_ACCESS_ALLOWED;
+}
+
class WE : public ::testing::Test {
public:
EditablesEditor* editor;
+ ReceivedEditable* received;
virtual void SetUp(){
- editor = new EditablesEditor(true);
+ cynara_initialize_fake.custom_fake = __cynara_initialize;
+ cynara_finish_fake.custom_fake = __cynara_finish;
+ cynara_check_fake.custom_fake = __cynara_check;
+ received = nullptr;
+ editor = new EditablesEditor();
}
virtual void TearDown(){
- delete editor;
+ if (received)
+ delete received;
+ if (editor)
+ delete editor;
}
};
-void _on_request_edit_cb(const char *appid, editable_list_h list_h, void *user_data) {
+void _on_request_edit_cb(const char* appid, editable_list_h list_h, void* user_data) {
}
TEST_F(WE, Create)
@@ -53,75 +80,34 @@ TEST_F(WE, Create)
TEST_F(WE, EditPreview)
{
int cur_data_idx = 1;
- int len = 0;
- bundle* data;
- bundle_raw* raw_data;
-
- data = bundle_create();
- bundle_add_str(data, "GEO_X", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_Y", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_W", std::to_string(100).c_str());
- bundle_add_str(data, "GEO_H", std::to_string(100).c_str());
- bundle_add_str(data, "SHAPE_TYPE", std::to_string(IEditable::EditableShapeType::Circle).c_str());
- bundle_add_str(data, "CUR_DATA_IDX", std::to_string(0).c_str());
- bundle_add_str(data, "EDITABLE_ID", std::to_string(0).c_str());
- bundle_add_str(data, "NAME", "sample");
- bundle_add_str(data, "SETUP_APPID", "");
- bundle_encode(data, &raw_data, &len);
-
- ReceivedEditable* re = new ReceivedEditable(std::string(reinterpret_cast<char*>(raw_data)));
- IEditable* ed = static_cast<IEditable*>(re);
+ Bundle data;
+ data.Add("GEO_X", std::to_string(0));
+ data.Add("GEO_Y", std::to_string(0));
+ data.Add("GEO_W", std::to_string(100));
+ data.Add("GEO_H", std::to_string(100));
+ data.Add("SHAPE_TYPE",
+ std::to_string(IEditable::EditableShapeType::Circle));
+ data.Add("CUR_DATA_IDX", std::to_string(0));
+ data.Add("NAME", "sample");
+ data.Add("EDITABLE_ID", std::to_string(0));
+ data.Add("SETUP_APPID", "");
+
+ Bundle candidate1;
+ Bundle candidate2;
+ vector<string> candidates_list;
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate1.ToRaw().first.get()));
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate2.ToRaw().first.get()));
+ data.Add("CANDIDATES_LIST", candidates_list);
+
+ received = new ReceivedEditable(
+ reinterpret_cast<char*>(data.ToRaw().first.get()));
+ IEditable* ed = static_cast<IEditable*>(received);
EXPECT_EQ(WE::editor->EditPreview(*ed, cur_data_idx), WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY);
-
- delete re;
- bundle_free(data);
- free(raw_data);
}
TEST_F(WE, NotifyEditReady)
{
EXPECT_EQ(WE::editor->NotifyEditReady("sample_provider"), 0);
-}
-
-class WEL : public ::testing::Test {
- public:
- GList* editables = NULL;
- ReceivedEditable* received;
- bundle_raw* raw_data;
- int len = 0;
-
- virtual void SetUp(){
- Bundle* candidate1 = new Bundle();
- Bundle* candidate2 = new Bundle();
- std::unique_ptr<const char*[]> array(new const char*[2]);
-
- bundle* data = bundle_create();
- bundle_add_str(data, "GEO_X", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_Y", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_W", std::to_string(100).c_str());
- bundle_add_str(data, "GEO_H", std::to_string(100).c_str());
- bundle_add_str(data, "SHAPE_TYPE", std::to_string(IEditable::EditableShapeType::Circle).c_str());
- bundle_add_str(data, "CUR_DATA_IDX", std::to_string(0).c_str());
- bundle_add_str(data, "EDITABLE_ID", std::to_string(0).c_str());
- bundle_add_str(data, "NAME", "sample");
- bundle_add_str(data, "SETUP_APPID", "");
-
- array.get()[0] = candidate1->ToString();
- array.get()[1] = candidate2->ToString();
-
- bundle_add_str_array(data, "CANDIDATES_LIST", array.get(), 2);
-
- bundle_encode(data, &raw_data, &len);
- received = new ReceivedEditable(std::string(reinterpret_cast<char*>(raw_data)));
- editables = g_list_append(editables, received);
-
- delete candidate1;
- delete candidate2;
- bundle_free(data);
- free(raw_data);
- }
- virtual void TearDown(){
- delete received;
- g_list_free(editables);
- }
-}; \ No newline at end of file
+} \ No newline at end of file
diff --git a/unittest/src/test-main.cc b/unittest/src/test-main.cc
index c9223a4..d4aedfa 100644
--- a/unittest/src/test-main.cc
+++ b/unittest/src/test-main.cc
@@ -13,25 +13,74 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <glib.h>
+#include <sqlite3.h>
+#include <bundle.h>
+#include <iostream>
+
+#include "mock/mock_util.h"
+
+using namespace std;
+void UpdateDB() {
+ sqlite3* db = nullptr;
+ int ret = sqlite3_open_v2(get_db_path(),
+ &db, SQLITE_OPEN_READWRITE, NULL);
+ if (ret != SQLITE_OK) {
+ cout << sqlite3_errmsg(db) << endl;
+ return;
+ }
+
+ static const char query[] =
+ "UPDATE provider_support_types "
+ "SET default_data = ?";
+
+ sqlite3_stmt* stmt = nullptr;
+ ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ cout << "prepare error: " << "(" << sqlite3_errmsg(db) << ")" << endl;
+ sqlite3_finalize(stmt);
+ sqlite3_close_v2(db);
+ return;
+ }
+
+ bundle* default_data = bundle_create();
+ bundle_raw* raw = nullptr;
+ int len = 0;
+ ret = bundle_encode(default_data, &raw, &len);
+ ret = sqlite3_bind_text(stmt, 1,
+ reinterpret_cast<const char*>(raw), -1, SQLITE_TRANSIENT);
+ free(raw);
+ bundle_free(default_data);
+ if (ret != SQLITE_OK) {
+ cout << "bind error: " << ret << "(" << sqlite3_errmsg(db) << ")" << endl;
+ sqlite3_finalize(stmt);
+ sqlite3_close_v2(db);
+ return;
+ }
+
+ ret = sqlite3_step(stmt);
+ if (ret != SQLITE_DONE)
+ cout << "prepare error: " << ret << "(" << sqlite3_errmsg(db) << ")" << endl;
+ sqlite3_finalize(stmt);
+ sqlite3_close_v2(db);
+}
int main(int argc, char** argv){
int ret = -1;
- setenv("GCOV_PREFIX", "/tmp/", 1);
+ UpdateDB();
try {
testing::InitGoogleTest(&argc, argv);
} catch(...) {
- std::cout << "Exception occurred" << std::endl;
+ cout << "Exception occurred" << endl;
}
try {
ret = RUN_ALL_TESTS();
} catch (const ::testing::internal::GoogleTestFailureException& e) {
ret = -1;
- std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
+ cout << "GoogleTestFailureException was thrown:" << e.what() << endl;
}
return ret;
diff --git a/unittest/src/test-received-editable.cc b/unittest/src/test-received-editable.cc
index 75f7c57..447852f 100644
--- a/unittest/src/test-received-editable.cc
+++ b/unittest/src/test-received-editable.cc
@@ -19,11 +19,12 @@
#include <iostream>
#include <glib.h>
#include <dlog.h>
-#include <bundle.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
#include <list>
+#include <vector>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
@@ -31,43 +32,37 @@
#include "watchface-complication/received-editable.h"
using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
class RE : public ::testing::Test {
public:
ReceivedEditable* received;
- bundle* data;
- bundle_raw* raw_data;
- int len = 0;
virtual void SetUp() {
- Bundle* candidate1 = new Bundle();
- Bundle* candidate2 = new Bundle();
- std::unique_ptr<const char*[]> array(new const char*[2]);
-
- data = bundle_create();
-
- bundle_add_str(data, "GEO_X", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_Y", std::to_string(0).c_str());
- bundle_add_str(data, "GEO_W", std::to_string(100).c_str());
- bundle_add_str(data, "GEO_H", std::to_string(100).c_str());
- bundle_add_str(data, "SHAPE_TYPE", std::to_string(IEditable::EditableShapeType::Circle).c_str());
- bundle_add_str(data, "CUR_DATA_IDX", std::to_string(0).c_str());
- bundle_add_str(data, "EDITABLE_ID", std::to_string(0).c_str());
- bundle_add_str(data, "NAME", "sample");
- bundle_add_str(data, "SETUP_APPID", "");
-
- array.get()[0] = candidate1->ToString();
- array.get()[1] = candidate2->ToString();
-
- bundle_add_str_array(data, "CANDIDATES_LIST", array.get(), 2);
-
- bundle_encode(data, &raw_data, &len);
- received = new ReceivedEditable(std::string(reinterpret_cast<char*>(raw_data)));
-
- delete candidate1;
- delete candidate2;
- free(raw_data);
+ Bundle data;
+ data.Add("GEO_X", std::to_string(0).c_str());
+ data.Add("GEO_Y", std::to_string(0).c_str());
+ data.Add("GEO_W", std::to_string(100).c_str());
+ data.Add("GEO_H", std::to_string(100).c_str());
+ data.Add("SHAPE_TYPE",
+ std::to_string(IEditable::EditableShapeType::Circle).c_str());
+ data.Add("CUR_DATA_IDX", std::to_string(0).c_str());
+ data.Add("NAME", "sample");
+ data.Add("EDITABLE_ID", std::to_string(0).c_str());
+ data.Add("SETUP_APPID", "org.tizen.setup");
+
+ Bundle candidate1;
+ Bundle candidate2;
+ vector<string> candidates_list;
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate1.ToRaw().first.get()));
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate2.ToRaw().first.get()));
+ data.Add("CANDIDATES_LIST", candidates_list);
+
+ received = new ReceivedEditable(
+ reinterpret_cast<char*>(data.ToRaw().first.get()));
}
virtual void TearDown() {
delete received;
@@ -90,17 +85,17 @@ TEST_F(RE, GetGeometry)
TEST_F(RE, GetCandidates)
{
- std::list<std::unique_ptr<Bundle>> const& list = RE::received->GetCandidates();
+ std::list<std::shared_ptr<Bundle>> const& list = RE::received->GetCandidates();
EXPECT_NE(list.empty(), true);
}
TEST_F(RE, GetData)
{
- const Bundle* curData = RE::received->GetCurData();
- const Bundle* nthData = RE::received->GetNthData(1);
+ shared_ptr<Bundle> curData = RE::received->GetCurData();
+ shared_ptr<Bundle> nthData = RE::received->GetNthData(1);
- EXPECT_NE(curData->GetConstRaw(), nullptr);
- EXPECT_NE(nthData->GetConstRaw(), nullptr);
+ EXPECT_NE(curData->GetHandle(), nullptr);
+ EXPECT_NE(nthData->GetHandle(), nullptr);
}
TEST_F(RE, DataIdx)
@@ -139,18 +134,14 @@ TEST_F(RE, OnEditableUpdated)
TEST_F(RE, SetContext)
{
- bundle* b = bundle_create();
- bundle_add_str(b, "TEST_KEY", "TEST_VALUE");
-
- Bundle* bundle = new Bundle(b);
- bundle_free(b);
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
RE::received->SetContext(std::unique_ptr<Bundle>(bundle));
std::unique_ptr<Bundle>& ctx = RE::received->GetContext();
RE::received->UpdateLastContext();
- char* value;
- bundle_get_str(ctx.get()->GetRaw(), "TEST_KEY", &value);
- EXPECT_STREQ(value, "TEST_VALUE");
+ string value = ctx.get()->GetString("TEST_KEY");
+ EXPECT_STREQ(value.c_str(), "TEST_VALUE");
}
TEST_F(RE, SetHighlight)
@@ -176,3 +167,26 @@ TEST_F(RE, SetLabel)
RE::received->SetLabel("test label");
EXPECT_STREQ(RE::received->GetLabel().c_str(), "test label");
}
+
+TEST_F(RE, SetCurDataIdx)
+{
+ RE::received->SetCurDataIdx(1);
+ EXPECT_EQ(RE::received->GetCurDataIdx(), 1);
+}
+
+TEST_F(RE, GetSetupAppId)
+{
+ EXPECT_STREQ(RE::received->GetSetupAppId().c_str(), "org.tizen.setup");
+}
+
+TEST_F(RE, GetLastContext)
+{
+ Bundle* bundle = new Bundle();
+ bundle->Add("TEST_KEY", "TEST_VALUE");
+ RE::received->SetContext(std::unique_ptr<Bundle>(bundle));
+ RE::received->UpdateLastContext();
+
+ std::unique_ptr<Bundle>& last_ctx = RE::received->GetLastContext();
+ string value = last_ctx.get()->GetString("TEST_KEY");
+ EXPECT_STREQ(value.c_str(), "TEST_VALUE");
+}
diff --git a/unittest/src/test-watchface-complication-provider.cc b/unittest/src/test-watchface-complication-provider.cc
new file mode 100644
index 0000000..719e769
--- /dev/null
+++ b/unittest/src/test-watchface-complication-provider.cc
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <watchface-complication-provider.h>
+#include <watchface-complication-provider-internal.h>
+#include <app_control_internal.h>
+
+#include "watchface-complication/design-element.h"
+#include "watchface-complication/editables-container.h"
+#include "watchface-complication/received-editable.h"
+
+#include "mock/system_info_mock.h"
+#include "mock/tzplatform_config_mock.h"
+#include "mock/app_common.h"
+#include "mock/mock_util.h"
+#include "mock/pkgmgr_mock.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+#include "mock/cynara_mock.h"
+
+
+using namespace std;
+using namespace tizen_base;
+using namespace watchface_complication;
+namespace {
+
+unsigned int event_timer__;
+GMainLoop* loop_ = nullptr;
+int __fake_system_info_get_platform_bool(const char* key, bool* value) {
+ *value = true;
+ return 0;
+}
+
+int __cynara_initialize(
+ cynara** c, const cynara_configuration* conf) {
+ return 0;
+}
+
+int __cynara_finish(
+ cynara* c) {
+ return 0;
+}
+
+int __cynara_check(cynara* c, const char* client, const char* client_session,
+ const char* user,
+ const char* privilege) {
+ return CYNARA_API_ACCESS_ALLOWED;
+}
+
+int __cynara_creds_gdbus_get_user(GDBusConnection* connection,
+ const gchar* uniqueName, enum cynara_user_creds method, gchar** user) {
+ return CYNARA_API_SUCCESS;
+}
+
+int __cynara_creds_gdbus_get_client(GDBusConnection* connection,
+ const gchar* uniqueName, enum cynara_client_creds method, gchar** client) {
+ return CYNARA_API_SUCCESS;
+}
+
+gboolean __fake_g_dbus_connection_emit_signal(GDBusConnection * connection,
+ const gchar* destination_bus_name,
+ const gchar* object_path,
+ const gchar* interface_name,
+ const gchar* signal_name,
+ GVariant* parameters,
+ GError** error) {
+ return TRUE;
+}
+
+guint __fake_signal_subscribe_on_update(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ if (event_timer__ != 0)
+ g_source_remove(event_timer__);
+
+ event_timer__ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+ Bundle b;
+ string sender_name = "org.tizen.gmock_comp_provider2";
+ b.Add("context", "test");
+ GVariant* parameters = g_variant_new("(siis)",
+ "org.tizen.gmock_comp_provider2", 1, Icon, b.ToRaw().first.get());
+
+ rs->OnSignal(nullptr, sender_name,
+ "test path",
+ "test interface",
+ "__COMP_UPDATE_REQUEST__",
+ parameters);
+
+ if (g_main_loop_is_running(loop_))
+ g_main_loop_quit(loop_);
+
+ return G_SOURCE_CONTINUE;
+ }, reinterpret_cast<gpointer>(user_data));
+
+ return 1;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.gmock_comp_provider2");
+ return 0;
+}
+
+int __fake_aul_get_app_shared_resource_path_by_appid(const char* appid,
+ char** path) {
+ *path = strdup("/opt/usr/share/org.tizen.gmock_comp_provider2/");
+ return 0;
+}
+
+class CWCP : public ::testing::Test {
+ public:
+ void RunLoop() {
+ g_main_loop_run(loop_);
+ }
+ virtual void SetUp() {
+ system_info_get_platform_bool_fake.custom_fake = __fake_system_info_get_platform_bool;
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_signal_subscribe_on_update;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ aul_get_app_shared_resource_path_by_appid_fake.custom_fake =
+ __fake_aul_get_app_shared_resource_path_by_appid;
+ g_dbus_connection_emit_signal_fake.custom_fake =
+ __fake_g_dbus_connection_emit_signal;
+ cynara_initialize_fake.custom_fake = __cynara_initialize;
+ cynara_finish_fake.custom_fake = __cynara_finish;
+ cynara_check_fake.custom_fake = __cynara_check;
+ cynara_creds_gdbus_get_user_fake.custom_fake = __cynara_creds_gdbus_get_user;
+ cynara_creds_gdbus_get_client_fake.custom_fake = __cynara_creds_gdbus_get_client;
+ loop_ = g_main_loop_new(nullptr, FALSE);
+ }
+
+ virtual void TearDown(){
+ if (event_timer__ != 0) {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ }
+ g_main_loop_quit(loop_);
+ g_main_loop_unref(loop_);
+ loop_ = nullptr;
+ }
+};
+
+void _update_requested_cb(
+ const char* provider_id, const char* req_appid,
+ watchface_complication_type_e type, const bundle* context,
+ bundle* share_data, void* user_data) {
+ watchface_complication_provider_data_set_type(
+ share_data, WATCHFACE_COMPLICATION_TYPE_ICON);
+ watchface_complication_provider_data_set_icon_path(
+ share_data, "data/icon.png");
+}
+
+TEST_F(CWCP, watchface_complication_provider_add_update_requested_cb)
+{
+ int ret = watchface_complication_provider_add_update_requested_cb(
+ "org.tizen.gmock_comp_provider2/test",
+ _update_requested_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_complication_provider_notify_update(
+ "org.tizen.gmock_comp_provider2/test");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+ ret = watchface_complication_provider_remove_update_requested_cb(
+ "org.tizen.gmock_comp_provider2/test",
+ _update_requested_cb);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWCP, watchface_complication_provider_setup_reply_to_editor)
+{
+ app_control_h service;
+ app_control_create(&service);
+ app_control_add_extra_data(service,
+ "__SETUP_EDITOR_APPID_KEY__", "org.test.editor");
+ app_control_add_extra_data(service, "__SETUP_EDITABLE_ID_KEY__", "10");
+ bundle* context = bundle_create();
+
+ int ret = watchface_complication_provider_setup_reply_to_editor(
+ service, context);
+ bundle_free(context);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWCP, watchface_complication_provider_setup_is_editing)
+{
+ app_control_h service;
+ app_control_create(&service);
+ app_control_add_extra_data(service,
+ "__SETUP_EDITOR_APPID_KEY__", "org.test.editor");
+ app_control_add_extra_data(service, "__SETUP_EDITABLE_ID_KEY__", "10");
+
+ bool is_editing = false;
+ int ret = watchface_complication_provider_setup_is_editing(
+ service, &is_editing);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWCP, watchface_complication_provider_setup_get_context)
+{
+ app_control_h service;
+ app_control_create(&service);
+ app_control_add_extra_data(service,
+ "__SETUP_EDITOR_APPID_KEY__", "org.test.editor");
+ app_control_add_extra_data(service, "__SETUP_EDITABLE_ID_KEY__", "10");
+ bundle* context = bundle_create();
+
+ int ret = watchface_complication_provider_setup_get_context(
+ service, &context);
+ bundle_free(context);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWCP, watchface_complication_provider_data_set_type)
+{
+ bundle* shared = bundle_create();
+ int ret = watchface_complication_provider_data_set_type(
+ shared, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT);
+ bundle_free(shared);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWCP, watchface_complication_provider_data_is_valid)
+{
+ bundle* shared = bundle_create();
+ int ret = watchface_complication_provider_data_set_type(
+ shared, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ bool is_valid;
+ ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(is_valid, false);
+
+ watchface_complication_provider_data_set_type(
+ shared, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE);
+ watchface_complication_provider_data_set_ranged_value(
+ shared, 10.0, 0.0, 100.0);
+ ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(is_valid, true);
+
+ watchface_complication_provider_data_set_type(
+ shared, WATCHFACE_COMPLICATION_TYPE_TIME);
+ watchface_complication_provider_data_set_timestamp(shared, 10.0);
+ ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(is_valid, true);
+
+ watchface_complication_provider_data_set_type(
+ shared, WATCHFACE_COMPLICATION_TYPE_IMAGE);
+ watchface_complication_provider_data_set_image_path(shared, "res/data.png");
+ ret = watchface_complication_provider_data_is_valid(shared, &is_valid);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(is_valid, true);
+}
+
+TEST_F(CWCP, watchface_complication_provider_event_get_type)
+{
+ bundle* shared = bundle_create();
+ bundle_add_str(shared, "__AUL_COMPLICATION_MODE__", "true");
+
+ bundle* touch_data = bundle_create();
+ bundle_add_str(touch_data, "__TOUCH_LAUNCH_EVENT_KEY__", "2");
+
+ int str_len = 0;
+ bundle_raw* raw_data = NULL;
+ bundle_encode(touch_data, &raw_data, &str_len);
+ bundle_add_str(shared, "__TOUCH_LAUNCH_DATA_KEY__",
+ reinterpret_cast<const char*>(raw_data));
+
+ app_control_h service;
+ watchface_complication_event_type_e type;
+ app_control_create(&service);
+ app_control_import_from_bundle(service, shared);
+ int ret = watchface_complication_provider_event_get_type(
+ service, &type);
+ bundle_free(shared);
+ bundle_free(touch_data);
+ free(raw_data);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(type, WATCHFACE_COMPLICATION_EVENT_TAP);
+}
+
+TEST_F(CWCP, watchface_complication_provider_event_get_provider_id)
+{
+ bundle* shared = bundle_create();
+ bundle_add_str(shared, "__AUL_COMPLICATION_MODE__", "true");
+
+ bundle* touch_data = bundle_create();
+ bundle_add_str(touch_data, "__TOUCH_LAUNCH_PROVIDER_ID_KEY__",
+ "org.tizen.provider");
+ int str_len = 0;
+ bundle_raw* raw_data = NULL;
+ bundle_encode(touch_data, &raw_data, &str_len);
+ bundle_add_str(shared, "__TOUCH_LAUNCH_DATA_KEY__",
+ reinterpret_cast<const char*>(raw_data));
+
+ app_control_h service;
+ app_control_create(&service);
+ app_control_import_from_bundle(service, shared);
+ char* ret_provider;
+ int ret = watchface_complication_provider_event_get_provider_id(
+ service, &ret_provider);
+
+ bundle_free(shared);
+ bundle_free(touch_data);
+ free(raw_data);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_STREQ(ret_provider, "org.tizen.provider");
+}
+
+TEST_F(CWCP, watchface_complication_provider_event_get_complication_type)
+{
+ bundle* shared = bundle_create();
+ bundle_add_str(shared, "__AUL_COMPLICATION_MODE__", "true");
+
+ bundle* touch_data = bundle_create();
+ bundle_add_str(touch_data, "__TOUCH_LAUNCH_PROVIDER_ID_KEY__",
+ "org.tizen.provider");
+ bundle_add_str(touch_data, "__TOUCH_LAUNCH_TYPE_KEY__", "2");
+
+ int str_len = 0;
+ bundle_raw* raw_data = NULL;
+ bundle_encode(touch_data, &raw_data, &str_len);
+ bundle_add_str(shared, "__TOUCH_LAUNCH_DATA_KEY__",
+ reinterpret_cast<const char*>(raw_data));
+
+ app_control_h service;
+ watchface_complication_type_e type;
+ app_control_create(&service);
+ app_control_import_from_bundle(service, shared);
+ int ret = watchface_complication_provider_event_get_complication_type(
+ service, &type);
+
+ bundle_free(shared);
+ bundle_free(touch_data);
+ free(raw_data);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(type, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT);
+}
+
+TEST_F(CWCP, watchface_complication_provider_event_get_context)
+{
+ bundle* shared = bundle_create();
+ bundle* context = bundle_create();
+ int str_len = 0;
+ bundle_raw* raw_data = NULL;
+ bundle_encode(context, &raw_data, &str_len);
+ bundle_add_str(shared, "__AUL_COMPLICATION_MODE__", "true");
+
+ bundle* touch_data = bundle_create();
+ bundle_add_str(touch_data, "__TOUCH_LAUNCH_PROVIDER_ID_KEY__",
+ "org.tizen.provider");
+ bundle_add_str(touch_data, "__TOUCH_LAUNCH_CONTEXT_KEY__",
+ reinterpret_cast<const char*>(raw_data));
+ free(raw_data);
+
+ bundle_raw* raw = NULL;
+ int ret = bundle_encode(touch_data, &raw, &str_len);
+ EXPECT_EQ(BUNDLE_ERROR_NONE, ret);
+ bundle_add_str(shared, "__TOUCH_LAUNCH_DATA_KEY__",
+ reinterpret_cast<const char*>(raw));
+ free(raw);
+
+ app_control_h service;
+ bundle* ret_context;
+ app_control_create(&service);
+ app_control_import_from_bundle(service, shared);
+ ret = watchface_complication_provider_event_get_context(
+ service, &ret_context);
+ bundle_free(touch_data);
+ bundle_free(shared);
+ bundle_free(context);
+ app_control_destroy(service);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+} \ No newline at end of file
diff --git a/unittest/src/test-watchface-complication.cc b/unittest/src/test-watchface-complication.cc
new file mode 100644
index 0000000..4839ac8
--- /dev/null
+++ b/unittest/src/test-watchface-complication.cc
@@ -0,0 +1,668 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <watchface-complication.h>
+#include <watchface-complication-provider.h>
+
+#include "watchface-complication/complication.h"
+#include "mock/system_info_mock.h"
+#include "mock/tzplatform_config_mock.h"
+#include "mock/app_common.h"
+#include "mock/mock_util.h"
+#include "mock/pkgmgr_mock.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+
+using namespace std;
+using namespace tizen_base;
+using namespace watchface_complication;
+namespace {
+
+unsigned int event_timer__;
+GMainLoop* loop_ = nullptr;
+int __fake_system_info_get_platform_bool(const char* key, bool* value) {
+ *value = true;
+ return 0;
+}
+
+const char* __fake_tzplatform_mkpath(
+ enum tzplatform_variable e, const char* name) {
+ return get_db_path();
+}
+
+GDBusConnection* __fake_g_bus_get_sync(GBusType type,
+ GCancellable* cancel, GError** err) {
+ return (GDBusConnection*)calloc(1, 4);
+}
+
+guint __fake_g_bus_own_name_on_connection(GDBusConnection* conn,
+ const gchar* name, GBusNameOwnerFlags flags,
+ GBusNameAcquiredCallback acquire_cb,
+ GBusNameLostCallback lost_cb, gpointer user_data,
+ GDestroyNotify noti) {
+ return 1;
+}
+
+pkgmgr_client* __fake_pkgmgr_client_new(pkgmgr_client_type type) {
+ return (pkgmgr_client*)calloc(1, 4);
+}
+
+int __fake_pkgmgr_client_free(pkgmgr_client* ) {
+ return 0;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.gmock_comp_provider");
+ return 0;
+}
+
+char* __fake_app_get_data_path() {
+ string path = "./";
+ return strdup(path.c_str());
+}
+
+guint __fake_g_bus_watch_name_on_connection(GDBusConnection* connection,
+ const gchar* name,
+ GBusNameWatcherFlags flags,
+ GBusNameAppearedCallback name_appeared_handler,
+ GBusNameVanishedCallback name_vanished_handler,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ name_appeared_handler(nullptr, "appear test", "test owner", user_data);
+ name_vanished_handler(nullptr, "vanish test", user_data);
+ return 1;
+}
+
+GDBusMessage* __fake_g_dbus_message_new_method_call(
+ const gchar* a, const gchar* b, const gchar* c, const gchar* d) {
+ return (GDBusMessage*)calloc(1, 4);
+}
+
+void __fake_g_dbus_message_set_body(GDBusMessage * m,
+ GVariant* a) {
+}
+
+GDBusMessage* __fake_g_dbus_connection_send_message_with_reply_sync(
+ GDBusConnection* conn, GDBusMessage* m, GDBusSendMessageFlags f, gint a,
+ volatile guint32* b, GCancellable* c, GError* *d) {
+ return (GDBusMessage*)calloc(1, 4);
+}
+
+void __fake_g_object_unref(gpointer o) {
+}
+
+GVariant* __fake_g_dbus_message_get_body(GDBusMessage* m) {
+ return g_variant_new("(u)", 10);
+}
+void __fake_g_dbus_connection_signal_unsubscribe(GDBusConnection* c,
+ guint a) {
+}
+
+void __fake_g_bus_unwatch_name(guint a) {
+}
+
+guint __fake_g_dbus_connection_signal_subscribe(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ return 1;
+}
+
+
+class CWC : public ::testing::Test {
+ public:
+ complication_allowed_list_h allowed_list_;
+ complication_h complication_;
+ void RunLoop() {
+ g_main_loop_run(loop_);
+ }
+ virtual void SetUp() {
+ complication_ = nullptr;
+ allowed_list_ = nullptr;
+ loop_ = g_main_loop_new(NULL, FALSE);
+ system_info_get_platform_bool_fake.custom_fake = __fake_system_info_get_platform_bool;
+
+ tzplatform_mkpath_fake.custom_fake = __fake_tzplatform_mkpath;
+ g_bus_get_sync_fake.custom_fake = __fake_g_bus_get_sync;
+ pkgmgr_client_new_fake.custom_fake = __fake_pkgmgr_client_new;
+ pkgmgr_client_free_fake.custom_fake = __fake_pkgmgr_client_free;
+ g_bus_own_name_on_connection_fake.custom_fake = __fake_g_bus_own_name_on_connection;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ app_get_data_path_fake.custom_fake = __fake_app_get_data_path;
+
+ g_bus_watch_name_on_connection_fake.custom_fake = __fake_g_bus_watch_name_on_connection;
+ g_dbus_message_new_method_call_fake.custom_fake = __fake_g_dbus_message_new_method_call;
+ g_dbus_message_set_body_fake.custom_fake = __fake_g_dbus_message_set_body;
+ g_dbus_connection_send_message_with_reply_sync_fake.custom_fake = __fake_g_dbus_connection_send_message_with_reply_sync;
+ g_object_unref_fake.custom_fake = __fake_g_object_unref;
+ g_dbus_message_get_body_fake.custom_fake = __fake_g_dbus_message_get_body;
+ g_dbus_connection_signal_unsubscribe_fake.custom_fake = __fake_g_dbus_connection_signal_unsubscribe;
+ g_bus_unwatch_name_fake.custom_fake = __fake_g_bus_unwatch_name;
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_g_dbus_connection_signal_subscribe;
+ }
+ virtual void TearDown(){
+ if (complication_ != nullptr)
+ watchface_complication_destroy(complication_);
+ if (allowed_list_ != nullptr)
+ watchface_complication_allowed_list_destroy(allowed_list_);
+ if (event_timer__ != 0) {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ }
+ g_main_loop_quit(loop_);
+ g_main_loop_unref(loop_);
+ loop_ = nullptr;
+ }
+};
+
+TEST_F(CWC, watchface_complication_get_current_provider_id)
+{
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ char* cur_provider_id;
+ ret = watchface_complication_get_current_provider_id(complication_,
+ &cur_provider_id);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_STREQ(cur_provider_id, "org.tizen.gmock_comp_provider/test");
+ free(cur_provider_id);
+}
+
+TEST_F(CWC, watchface_complication_get_current_type)
+{
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ watchface_complication_type_e cur_type;
+ ret = watchface_complication_get_current_type(complication_,
+ &cur_type);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ EXPECT_EQ(cur_type, WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT);
+}
+
+void _complication_updated_cb(
+ int complication_id,
+ const char* provider_id,
+ watchface_complication_type_e type,
+ const bundle* data,
+ void* user_data) {
+}
+
+void _complication_error_cb(
+ int complication_id,
+ const char* provider_id,
+ watchface_complication_type_e type,
+ watchface_complication_error_e error,
+ void* user_data) {
+}
+
+TEST_F(CWC, watchface_complication_add_updated_cb)
+{
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb, _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWC, watchface_complication_remove_updated_cb)
+{
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb, _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ ret = watchface_complication_remove_updated_cb(complication_,
+ _complication_updated_cb);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWC, watchface_complication_send_update_request)
+{
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb, _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ ret = watchface_complication_send_update_request(complication_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+guint __fake_signal_subscribe_on_data_updated(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ if (event_timer__ != 0)
+ g_source_remove(event_timer__);
+
+ event_timer__ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+ Bundle b;
+ char num_str[32] = {0, };
+ snprintf(num_str, sizeof(num_str), "%d", ShortText);
+ b.Add("__DATA_TYPE_KEY__", num_str);
+ watchface_complication_provider_data_set_short_text(b.GetHandle(), "shorttext");
+ watchface_complication_provider_data_set_title(b.GetHandle(), "title");
+ watchface_complication_provider_data_set_icon_path(b.GetHandle(), "data/icon.png");
+
+ Bundle extra;
+ extra.Add("extra_key", "extra_data");
+ watchface_complication_provider_data_set_extra_data(
+ b.GetHandle(), reinterpret_cast<char*>(extra.ToRaw().first.get()));
+ watchface_complication_provider_data_set_screen_reader_text(
+ b.GetHandle(), "screen reader");
+
+ GVariant* parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+ ShortText,
+ 777,
+ reinterpret_cast<char*>(b.ToRaw().first.get()));
+
+ rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters);
+
+ b.Delete("__DATA_TYPE_KEY__");
+ snprintf(num_str, sizeof(num_str), "%d", LongText);
+ b.Add("__DATA_TYPE_KEY__", num_str);
+ watchface_complication_provider_data_set_long_text(b.GetHandle(), "longtext");
+ parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+ LongText,
+ 777,
+ reinterpret_cast<char*>(b.ToRaw().first.get()));
+ rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters);
+
+ b.Delete("__DATA_TYPE_KEY__");
+ snprintf(num_str, sizeof(num_str), "%d", RangedValue);
+ b.Add("__DATA_TYPE_KEY__", num_str);
+ watchface_complication_provider_data_set_ranged_value(
+ b.GetHandle(), 10.0, 0.0, 100.0);
+ parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+ RangedValue,
+ 777,
+ reinterpret_cast<char*>(b.ToRaw().first.get()));
+ rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters);
+
+ b.Delete("__DATA_TYPE_KEY__");
+ snprintf(num_str, sizeof(num_str), "%d", Time);
+ b.Add("__DATA_TYPE_KEY__", num_str);
+ watchface_complication_provider_data_set_timestamp(
+ b.GetHandle(), 10);
+
+ watchface_complication_provider_data_set_timestamp(
+ b.GetHandle(), 10);
+
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_set_timezone(info, "UTC-10");
+ watchface_complication_provider_timeinfo_set_timezone_id(info, "US/Hawaii");
+ watchface_complication_provider_timeinfo_set_timezone_country(info, "US");
+ watchface_complication_provider_timeinfo_set_timezone_city(info, "Hawaii");
+ watchface_complication_provider_data_set_timeinfo(
+ b.GetHandle(), info);
+ watchface_complication_provider_timeinfo_destroy(info);
+ parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+ Time,
+ 777,
+ reinterpret_cast<char*>(b.ToRaw().first.get()));
+ rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters);
+
+ b.Delete("__DATA_TYPE_KEY__");
+ snprintf(num_str, sizeof(num_str), "%d", Image);
+ b.Add("__DATA_TYPE_KEY__", num_str);
+ watchface_complication_provider_data_set_image_path(
+ b.GetHandle(), "data/img.png");
+ parameters = g_variant_new("(siis)", "org.tizen.gmock_comp_provider/test",
+ Image,
+ 777,
+ reinterpret_cast<char*>(b.ToRaw().first.get()));
+ rs->OnSignal(nullptr, "org.tizen.gmock_comp_provider",
+ "test path",
+ "test interface",
+ "__COMP_UPDATED__",
+ parameters);
+
+ if (g_main_loop_is_running(loop_))
+ g_main_loop_quit(loop_);
+ return G_SOURCE_CONTINUE;
+ }, reinterpret_cast<gpointer>(user_data));
+
+ return 1;
+}
+
+void _complication_updated_cb_get_test(
+ int complication_id,
+ const char* provider_id,
+ watchface_complication_type_e data_type,
+ const bundle* data,
+ void* user_data) {
+ watchface_complication_type_e type;
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT) {
+ char* value;
+ watchface_complication_data_get_short_text(data, &value);
+ EXPECT_STREQ(value, "shorttext");
+ free(value);
+
+ watchface_complication_data_get_title(data, &value);
+ EXPECT_STREQ(value, "title");
+ free(value);
+
+ watchface_complication_data_get_icon_path(data, &value);
+ EXPECT_STREQ(value, "data/icon.png");
+ free(value);
+
+ int ret = watchface_complication_data_get_extra_data(data, &value);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ free(value);
+
+ watchface_complication_data_get_screen_reader_text(data, &value);
+ EXPECT_STREQ(value, "screen reader");
+ free(value);
+
+ } else if (type == WATCHFACE_COMPLICATION_TYPE_LONG_TEXT) {
+ char* value;
+ watchface_complication_data_get_long_text(data, &value);
+ EXPECT_STREQ(value, "longtext");
+ free(value);
+ } else if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ long time;
+ watchface_complication_data_get_timestamp(data, &time);
+ EXPECT_EQ(time, 10);
+
+ complication_time_info_h info;
+ watchface_complication_data_get_timeinfo(data, &info);
+
+ char* value = nullptr;
+ watchface_complication_timeinfo_get_timezone(info, &value);
+ EXPECT_STREQ(value, "UTC-10");
+ free(value);
+ value = nullptr;
+
+ watchface_complication_timeinfo_get_timezone_id(info, &value);
+ EXPECT_STREQ(value, "US/Hawaii");
+ free(value);
+ value = nullptr;
+
+ watchface_complication_timeinfo_get_timezone_country(info, &value);
+ EXPECT_STREQ(value, "US");
+ free(value);
+ value = nullptr;
+
+ watchface_complication_timeinfo_get_timezone_city(info, &value);
+ EXPECT_STREQ(value, "Hawaii");
+ free(value);
+
+ time_t timestamp;
+ watchface_complication_timeinfo_get_timestamp(info, &timestamp);
+
+ time_t seoul_timestamp;
+ watchface_complication_provider_timeinfo_set_timezone_id(info, "Asia/Seoul");
+ watchface_complication_timeinfo_get_timestamp(info, &seoul_timestamp);
+ int diff = difftime(seoul_timestamp, timestamp);
+ EXPECT_EQ(diff / 3600, 19);
+ watchface_complication_timeinfo_destroy(info);
+ } else if (type == WATCHFACE_COMPLICATION_TYPE_IMAGE) {
+ char* value;
+ watchface_complication_data_get_image_path(data, &value);
+ EXPECT_STREQ(value, "data/img.png");
+ free(value);
+ } else if (type == WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE) {
+ double cur, min, max;
+ watchface_complication_data_get_ranged_value(data,
+ &cur, &min, &max);
+ EXPECT_EQ(cur, 10);
+ EXPECT_EQ(min, 0);
+ EXPECT_EQ(max, 100);
+ }
+}
+
+TEST_F(CWC, watchface_complication_data_get_short_text)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb_get_test,
+ _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+}
+
+TEST_F(CWC, watchface_complication_data_get_long_text)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_LONG_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_LONG_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb_get_test,
+ _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+}
+
+TEST_F(CWC, watchface_complication_data_get_timestamp)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_TIME,
+ WATCHFACE_COMPLICATION_TYPE_TIME,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb_get_test,
+ _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+}
+
+TEST_F(CWC, watchface_complication_data_get_image_path)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_IMAGE,
+ WATCHFACE_COMPLICATION_TYPE_IMAGE,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb_get_test,
+ _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+}
+
+TEST_F(CWC, watchface_complication_data_get_ranged_value)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
+ WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+
+ ret = watchface_complication_add_updated_cb(complication_,
+ _complication_updated_cb_get_test,
+ _complication_error_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+}
+
+TEST_F(CWC, watchface_complication_transfer_event)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+ ret = watchface_complication_transfer_event(complication_,
+ WATCHFACE_COMPLICATION_EVENT_TAP);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWC, watchface_complication_allowed_list)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+ ret = watchface_complication_allowed_list_create(&allowed_list_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_complication_allowed_list_add(allowed_list_,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT);
+ ret = watchface_complication_allowed_list_add(allowed_list_,
+ "org.tizen.gmock_comp_provider2/test",
+ WATCHFACE_COMPLICATION_TYPE_LONG_TEXT);
+ char* ret_provider_id;
+ int ret_type;
+ watchface_complication_allowed_list_get_nth(allowed_list_, 1,
+ &ret_provider_id, &ret_type);
+ EXPECT_STREQ(ret_provider_id, "org.tizen.gmock_comp_provider2/test");
+ free(ret_provider_id);
+
+ EXPECT_EQ(ret_type, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT);
+
+ ret = watchface_complication_allowed_list_apply(complication_,
+ allowed_list_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ ret = watchface_complication_allowed_list_clear(complication_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_complication_allowed_list_delete(allowed_list_,
+ "org.tizen.gmock_comp_provider/test");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+
+TEST_F(CWC, apply_not_exist_allowed_list)
+{
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_data_updated;
+ int comp_id = 777;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &complication_);
+ ret = watchface_complication_allowed_list_create(&allowed_list_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_complication_allowed_list_add(allowed_list_,
+ "org.tizen.gmock_comp_provider/notexsist",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT);
+ ret = watchface_complication_allowed_list_add(allowed_list_,
+ "org.tizen.gmock_comp_provider2/notexsist",
+ WATCHFACE_COMPLICATION_TYPE_LONG_TEXT);
+ ret = watchface_complication_allowed_list_apply(complication_,
+ allowed_list_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ ret = watchface_complication_send_update_request(complication_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE, ret);
+}
+
+}
diff --git a/unittest/src/test-watchface-editable.cc b/unittest/src/test-watchface-editable.cc
new file mode 100644
index 0000000..7e7f1ba
--- /dev/null
+++ b/unittest/src/test-watchface-editable.cc
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <watchface-editable.h>
+#include <watchface-editable-internal.h>
+
+#include "watchface-complication/design-element.h"
+#include "watchface-complication/editables-container.h"
+#include "watchface-complication/received-editable.h"
+
+#include "mock/system_info_mock.h"
+#include "mock/tzplatform_config_mock.h"
+#include "mock/app_common.h"
+#include "mock/mock_util.h"
+#include "mock/pkgmgr_mock.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+
+using namespace std;
+using namespace tizen_base;
+using namespace watchface_complication;
+namespace {
+
+unsigned int event_timer__;
+GMainLoop* loop_ = nullptr;
+int __fake_system_info_get_platform_bool(const char* key, bool* value) {
+ *value = true;
+ return 0;
+}
+
+guint __fake_signal_subscribe_on_update(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ if (event_timer__ != 0)
+ g_source_remove(event_timer__);
+
+ event_timer__ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+ Bundle b;
+ GVariant* parameters = g_variant_new("(s)", "org.tizen.editor");
+
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_READY__",
+ parameters);
+
+ parameters = g_variant_new("(iis)", 0, 0, b.ToRaw().first.get());
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_PREVIEW__",
+ parameters);
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_CANCEL__",
+ parameters);
+ parameters = g_variant_new("(iis)", 0, 0, b.ToRaw().first.get());
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_PREVIEW__",
+ parameters);
+ rs->OnSignal(nullptr, "org.tizen.editor",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_COMPLETE__",
+ parameters);
+ if (g_main_loop_is_running(loop_))
+ g_main_loop_quit(loop_);
+
+ return G_SOURCE_CONTINUE;
+ }, reinterpret_cast<gpointer>(user_data));
+
+ return 1;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.editor");
+ return 0;
+}
+
+static watchface_editable_highlight_h hi_;
+static complication_candidates_list_h candidates_list_;
+static complication_h comp_;
+class CWE : public ::testing::Test {
+ public:
+ void RunLoop() {
+ g_main_loop_run(loop_);
+ }
+ virtual void SetUp() {
+ hi_ = nullptr;
+ comp_ = nullptr;
+ candidates_list_ = nullptr;
+
+ system_info_get_platform_bool_fake.custom_fake = __fake_system_info_get_platform_bool;
+ g_dbus_connection_signal_subscribe_fake.custom_fake = __fake_signal_subscribe_on_update;
+ aul_app_get_appid_bypid_fake.custom_fake = __fake_aul_app_get_appid_bypid;
+ loop_ = g_main_loop_new(nullptr, FALSE);
+ }
+
+ virtual void TearDown() {
+ if (candidates_list_ != nullptr)
+ watchface_editable_candidates_list_destroy(candidates_list_);
+ if (comp_ != nullptr)
+ watchface_complication_destroy(comp_);
+ if (hi_ != nullptr)
+ watchface_editable_highlight_destroy(hi_);
+
+ if (event_timer__ != 0) {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ }
+ g_main_loop_quit(loop_);
+ g_main_loop_unref(loop_);
+ loop_ = nullptr;
+ }
+};
+
+void _editable_update_requested_cb(
+ const watchface_editable_h handle,
+ int selected_idx,
+ const watchface_editable_edit_state_e state,
+ void* user_data) {
+ if (hi_ != nullptr)
+ watchface_editable_highlight_destroy(hi_);
+ int ret = watchface_editable_get_highlight(handle, &hi_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ watchface_editable_shape_type_e shape;
+ ret = watchface_editable_highlight_get_shape_type(hi_, &shape);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ int x, y, w, h;
+ ret = watchface_editable_highlight_get_geometry(hi_, &x, &y, &w, &h);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ ret = watchface_editable_set_editable_name(handle, "test");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ char* name;
+ ret = watchface_editable_get_editable_name(handle, &name);
+ EXPECT_STREQ(name, "test");
+ free(name);
+
+ int id;
+ ret = watchface_editable_get_editable_id(handle, &id);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ bundle* nth_data;
+ ret = watchface_editable_get_nth_data(handle, 0, &nth_data);
+ if (nth_data != nullptr)
+ bundle_free(nth_data);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ int idx;
+ ret = watchface_editable_get_current_data_idx(handle, &idx);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ bundle* cur_data = nullptr;
+ ret = watchface_editable_get_current_data(handle, &cur_data);
+ if (cur_data != nullptr)
+ bundle_free(cur_data);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ watchface_editable_container_h container;
+ ret = watchface_editable_container_get(&container);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+void _editable_edit_ready_cb(
+ watchface_editable_container_h handle,
+ const char* editor_appid,
+ void* user_data) {
+ int comp_id = 1;
+ int design_element_id = 2;
+ int ret = watchface_complication_create(comp_id,
+ "org.tizen.gmock_comp_provider/test",
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT,
+ WATCHFACE_COMPLICATION_EVENT_TAP,
+ &comp_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ watchface_editable_highlight_create(&hi_, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
+ watchface_editable_highlight_set_geometry(hi_, 50, 50, 100, 100);
+ ret = watchface_editable_add_complication(handle, comp_id, comp_, hi_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_editable_candidates_list_create(&candidates_list_);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ bundle* current_data = nullptr;
+ ret = watchface_editable_load_current_data(design_element_id, &current_data);
+ if (current_data != nullptr)
+ bundle_free(current_data);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NO_DATA, ret);
+
+ watchface_editable_highlight_destroy(hi_);
+ watchface_editable_highlight_create(&hi_, WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE);
+ watchface_editable_highlight_set_geometry(hi_, 100, 50, 100, 100);
+ watchface_editable_highlight_set_shape_type(hi_, WATCHFACE_EDITABLE_SHAPE_TYPE_RECT);
+ bundle* design_element = bundle_create();
+ bundle_add_str(design_element, "TEST_COLOR", "Blue");
+ ret = watchface_editable_candidates_list_add(candidates_list_, design_element);
+ bundle_free(design_element);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_editable_add_design_element(handle, design_element_id, 0,
+ candidates_list_, hi_, "Color");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_editable_request_edit(handle,
+ _editable_update_requested_cb, user_data);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWE, watchface_editable_candidates_list)
+{
+ int ret = watchface_editable_add_edit_ready_cb(
+ _editable_edit_ready_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+ ret = watchface_editable_remove_edit_ready_cb(
+ _editable_edit_ready_cb);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+TEST_F(CWE, watchface_editable_candidates_color_test)
+{
+ bundle *candidate;
+ watchface_editable_color_h color;
+ watchface_editable_color_h ret_color;
+
+ int ret = watchface_editable_candidate_create(&candidate, "test");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ watchface_editable_candidate_color_create(&color, 12, 34, 56, 78);
+ watchface_editable_candidate_set_color(candidate, color);
+ watchface_editable_candidate_color_destroy(color);
+
+ watchface_editable_candidate_get_color(candidate, &ret_color);
+
+ int r, g, b, a;
+ watchface_editable_candidate_color_get(ret_color, &r, &g, &b, &a);
+ watchface_editable_candidate_color_destroy(ret_color);
+ EXPECT_EQ(12, r);
+ EXPECT_EQ(34, g);
+ EXPECT_EQ(56, b);
+ EXPECT_EQ(78, a);
+
+ char* name;
+ watchface_editable_candidate_get_name(candidate, &name);
+ EXPECT_STREQ(name, "test");
+ free(name);
+
+ bundle_free(candidate);
+}
+
+TEST_F(CWE, watchface_editable_candidates_preview_image_test)
+{
+ bundle *candidate;
+
+ int ret = watchface_editable_candidate_create(&candidate, "test");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ watchface_editable_candidate_set_preview_image(candidate, "imagepath");
+
+ char* imagepath;
+ watchface_editable_candidate_get_preview_image(candidate, &imagepath);
+ EXPECT_STREQ(imagepath, "imagepath");
+ free(imagepath);
+ bundle_free(candidate);
+}
+
+} \ No newline at end of file
diff --git a/unittest/src/test-watchface-editor.cc b/unittest/src/test-watchface-editor.cc
new file mode 100644
index 0000000..ab3a042
--- /dev/null
+++ b/unittest/src/test-watchface-editor.cc
@@ -0,0 +1,252 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <watchface-editor.h>
+#include <vector>
+
+#include "watchface-complication/design-element.h"
+#include "watchface-complication/editables-container.h"
+#include "watchface-complication/received-editable.h"
+
+#include "mock/system_info_mock.h"
+#include "mock/tzplatform_config_mock.h"
+#include "mock/app_common.h"
+#include "mock/mock_util.h"
+#include "mock/pkgmgr_mock.h"
+#include "mock/gio/gio.h"
+#include "mock/aul_mock.h"
+#include "mock/app_control_mock.h"
+
+using namespace std;
+using namespace tizen_base;
+using namespace watchface_complication;
+namespace {
+
+unsigned int event_timer__;
+GMainLoop* loop_ = nullptr;
+int __fake_system_info_get_platform_bool(const char* key, bool* value) {
+ *value = true;
+ return 0;
+}
+
+guint __fake_signal_subscribe_on_update(GDBusConnection* connection,
+ const gchar* sender,
+ const gchar* interface_name,
+ const gchar* member,
+ const gchar* object_path,
+ const gchar* arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func) {
+ if (event_timer__ != 0)
+ g_source_remove(event_timer__);
+
+ event_timer__ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
+ IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
+
+ Bundle data;
+ data.Add("GEO_X", std::to_string(0));
+ data.Add("GEO_Y", std::to_string(0));
+ data.Add("GEO_W", std::to_string(100));
+ data.Add("GEO_H", std::to_string(100));
+ data.Add("SHAPE_TYPE",
+ std::to_string(IEditable::EditableShapeType::Circle));
+ data.Add("CUR_DATA_IDX", std::to_string(0));
+ data.Add("NAME", "sample");
+ data.Add("EDITABLE_ID", std::to_string(0));
+ data.Add("SETUP_APPID", "org.tizen.setup");
+
+ Bundle candidate1;
+ Bundle candidate2;
+ candidate1.Add("__PROVIDER_ID_KEY__",
+ "org.tizen.gmock_comp_provider2/test");
+ candidate1.Add("__PROVIDER_TYPE_KEY__", "2");
+ candidate1.Add("__PRIVILEGE_ERROR_KEY__", "err msg");
+
+ candidate2.Add("__PROVIDER_ID_KEY__",
+ "org.tizen.gmock_comp_provider/test");
+ candidate2.Add("__PROVIDER_TYPE_KEY__", "4");
+ candidate2.Add("__SUPPORTED_EVENTS_ERROR_KEY__", "4");
+
+ vector<string> candidates_list;
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate1.ToRaw().first.get()));
+ candidates_list.push_back(
+ reinterpret_cast<char*>(candidate2.ToRaw().first.get()));
+ data.Add("CANDIDATES_LIST", candidates_list);
+
+ Bundle list_data;
+ vector<string> editable_list;
+ editable_list.push_back(
+ reinterpret_cast<char*>(data.ToRaw().first.get()));
+ list_data.Add("EDITABLE_LIST", editable_list);
+
+ GVariant* parameters = g_variant_new("(ss)",
+ "org.tizen.watch", list_data.ToRaw().first.get());
+
+ rs->OnSignal(nullptr, "org.tizen.watch",
+ "test path",
+ "test interface",
+ "__EDITABLE_EDIT_REQUEST__",
+ parameters);
+ Bundle setup_ctx;
+ parameters = g_variant_new("(is)",
+ "org.tizen.watch", setup_ctx.ToRaw().first.get());
+ rs->OnSignal(nullptr, "org.tizen.watch",
+ "test path",
+ "test interface",
+ "__SETUP_REPLY__",
+ parameters);
+ if (g_main_loop_is_running(loop_))
+ g_main_loop_quit(loop_);
+
+ return G_SOURCE_CONTINUE;
+ }, reinterpret_cast<gpointer>(user_data));
+
+ return 1;
+}
+
+int __fake_aul_app_get_appid_bypid(int pid, char* appid, int size) {
+ snprintf(appid, size, "%s", "org.tizen.watch");
+ return 0;
+}
+int __fake_app_control_send_launch_request(app_control_h app_control,
+ app_control_reply_cb callback, void* user_data) {
+ return 0;
+}
+
+class CWED : public ::testing::Test {
+ public:
+ void RunLoop() {
+ g_main_loop_run(loop_);
+ }
+ virtual void SetUp() {
+ system_info_get_platform_bool_fake.custom_fake =
+ __fake_system_info_get_platform_bool;
+ g_dbus_connection_signal_subscribe_fake.custom_fake =
+ __fake_signal_subscribe_on_update;
+ aul_app_get_appid_bypid_fake.custom_fake =
+ __fake_aul_app_get_appid_bypid;
+ app_control_send_launch_request_fake.custom_fake =
+ __fake_app_control_send_launch_request;
+ loop_ = g_main_loop_new(nullptr, FALSE);
+ }
+
+ virtual void TearDown(){
+ if (event_timer__ != 0) {
+ g_source_remove(event_timer__);
+ event_timer__ = 0;
+ }
+ g_main_loop_quit(loop_);
+ g_main_loop_unref(loop_);
+ loop_ = nullptr;
+ }
+};
+
+void _setup_result_cb(int editable_id,
+ bundle* new_context, void* user_data) {
+
+}
+
+void _editor_request_edit_cb(const char* appid,
+ editable_list_h list, void* user_data) {
+ int size;
+ editable_list_h dup_list = nullptr;
+ watchface_editor_editable_list_get_size(list, &size);
+ watchface_editor_editable_list_dup(list, &dup_list);
+ int ret = watchface_editor_editable_list_get_size(dup_list, &size);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ for (int i = 0; i < size; i++) {
+ watchface_editable_h handle;
+ ret = watchface_editor_editable_list_get_nth(dup_list, i, &handle);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ int c_size;
+ bundle* c_data;
+ bool exist;
+ ret = watchface_editor_editable_candidate_list_get_size(handle, &c_size);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ for (int j = 0; j < c_size; j++) {
+ ret = watchface_editor_editable_candidate_list_get_nth(handle, j, &c_data);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ char* provider_id = nullptr;
+ watchface_editor_get_complication_provider_id(c_data, &provider_id);
+ if (provider_id != nullptr) {
+ free(provider_id);
+ watchface_complication_type_e cur_type;
+ ret = watchface_editor_get_complication_type(c_data, &cur_type);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ bool is_supported;
+ char* error_message = nullptr;
+ watchface_editor_error_e error;
+ ret = watchface_editor_get_complication_is_supported(c_data,
+ &is_supported, &error, &error_message);
+ if (error_message != nullptr)
+ free(error_message);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ char* provider_name = nullptr;
+ watchface_editor_get_complication_provider_name(c_data, &provider_name);
+ if (provider_name != nullptr)
+ free(provider_name);
+ }
+ bundle_free(c_data);
+ }
+ watchface_editor_is_setup_app_exist(handle, &exist);
+ if (exist) {
+ char* setup_appid = nullptr;
+ bool setup_app_exist;
+ ret = watchface_editor_get_setup_appid(handle, &setup_appid);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ if (setup_appid != nullptr)
+ free(setup_appid);
+
+ ret = watchface_editor_is_setup_app_exist(handle, &setup_app_exist);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+
+ watchface_editor_launch_setup_app(handle, _setup_result_cb, nullptr);
+ }
+
+ bundle* c_context = bundle_create();
+ watchface_editor_set_context(handle, c_context);
+ bundle_free(c_context);
+ watchface_editor_edit_preview(handle, 0);
+ }
+ watchface_editor_edit_cancel();
+ watchface_editor_edit_complete();
+
+ watchface_editor_editable_list_destroy(dup_list);
+}
+
+TEST_F(CWED, watchface_editable_candidates_list)
+{
+ int ret = watchface_editor_add_request_edit_cb(
+ _editor_request_edit_cb, nullptr);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ ret = watchface_editor_notify_edit_ready("org.tizen.watch");
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+ RunLoop();
+ ret = watchface_editor_remove_request_edit_cb(
+ _editor_request_edit_cb);
+ EXPECT_EQ(WATCHFACE_COMPLICATION_ERROR_NONE, ret);
+}
+
+} \ No newline at end of file
diff --git a/watchface-common/include/watchface-common.h b/watchface-common/include/watchface-common.h
index dc1b8d1..6612530 100644
--- a/watchface-common/include/watchface-common.h
+++ b/watchface-common/include/watchface-common.h
@@ -88,6 +88,12 @@ typedef enum _complication_event_type {
} watchface_complication_event_type_e;
/**
+ * @brief The complication time information handle.
+ * @since_tizen 5.5
+ */
+typedef struct complication_time_info_s *complication_time_info_h;
+
+/**
* @}
*/
diff --git a/watchface-common/watchface-common-internal.h b/watchface-common/watchface-common-internal.h
index c7e358d..eb33302 100644
--- a/watchface-common/watchface-common-internal.h
+++ b/watchface-common/watchface-common-internal.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__
-#define __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__
+#ifndef WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
+#define WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
#include <tizen.h>
@@ -33,6 +33,10 @@
#define ICON_KEY "__ICON_KEY__"
#define TITLE_KEY "__TITLE_KEY__"
#define TIME_KEY "__TIME_KEY__"
+#define TIME_ZONE_KEY "__TIME_ZONE_KEY__"
+#define TIME_ZONE_ID_KEY "__TIME_ZONE_ID_KEY__"
+#define TIME_COUNTRY_KEY "__TIME_COUNTRY_KEY__"
+#define TIME_CITY_KEY "__TIME_CITY_KEY__"
#define RANGE_CUR_KEY "__CUR_KEY__"
#define RANGE_MAX_KEY "__MAX_KEY__"
#define RANGE_MIN_KEY "__MIN_KEY__"
@@ -56,8 +60,15 @@ typedef enum _editor_error_e {
WATCHFACE_EDITOR_ERROR_EVENT_NOT_SUPPORT = 0x04 /**< Watchface complication do not support provider's events. */
} watchface_editor_error_e;
+struct complication_time_info_s {
+ char *timezone;
+ char *timezone_id;
+ char *country;
+ char *city;
+};
+
#ifdef __cplusplus
}
#endif
-#endif /* __TIZEN_APPFW_WATCHFACE_COMMON_INTERNAL_H__ */
+#endif // WATCHFACE_COMMON_WATCHFACE_COMMON_INTERNAL_H_
diff --git a/watchface-common/watchface-util.cc b/watchface-common/watchface-util.cc
index 225a5ef..1816ca7 100644
--- a/watchface-common/watchface-util.cc
+++ b/watchface-common/watchface-util.cc
@@ -24,10 +24,12 @@
#include <cynara-creds-gdbus.h>
#include <cynara-session.h>
#include <pkgmgr-info.h>
+#include <pkgmgr_installer_info.h>
#include <system_info.h>
#include <string>
#include <map>
+#include <list>
#include "watchface-common/watchface-util.h"
#include "watchface-common/include/watchface-common.h"
@@ -44,9 +46,12 @@
#define EDITABLE_PATH_PREFIX "/org/tizen/watchface_editable_"
#define COMPLICATION_OBJECT_PATH "/org/tizen/watchface_complication"
#define MAX_CACHE_COUNT 10
+#define ROOT_USER 0
#define LOG_TAG "WATCHFACE_COMPLICATION"
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
namespace util {
static int __cynara_check(const char* client, const char* user,
@@ -119,6 +124,25 @@ namespace util {
return ret;
}
+ int CheckPrivilege(string privilege, cynara_result* pcr) {
+ int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
+ if (*pcr == COMPLICATION_CYNARA_DENIED) {
+ LOGE("Permission denied");
+ return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
+ } else if (*pcr == COMPLICATION_CYNARA_UNKNOWN) {
+ ret = CheckPrivilege(privilege.c_str());
+ if (ret == WATCHFACE_COMPLICATION_ERROR_NONE) {
+ *pcr = COMPLICATION_CYNARA_ALLOWED;
+ } else if (ret == WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED) {
+ *pcr = COMPLICATION_CYNARA_DENIED;
+ return ret;
+ } else {
+ return ret;
+ }
+ }
+ return ret;
+ }
+
int CheckPrivilege(std::string& privilege, GDBusConnection* connection,
std::string& sender_name, std::string& sender_appid) {
int ret;
@@ -345,6 +369,9 @@ out:
case SetupReply :
ret = "__SETUP_REPLY__";
break;
+ case ProviderReady :
+ ret = "__PROVIDER_READY__";
+ break;
default :
break;
}
@@ -371,6 +398,72 @@ out:
return appid;
}
+ int GetDataType(Bundle shared_data) {
+ string shared_type = shared_data.GetString(DATA_TYPE_KEY);
+ if (shared_type.empty()) {
+ LOGE("failed to get data type");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ int comp_type = stoi(shared_type);
+ if (!CheckComplicationType(comp_type)) {
+ LOGE("Invalid param for type(%d)", comp_type);
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ return comp_type;
+ }
+
+ bool IsValidData(Bundle shared_data) {
+ int type = GetDataType(shared_data);
+ bool is_valid = true;
+
+ switch (type) {
+ case WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT : {
+ if (shared_data.GetString(SHORT_TEXT_KEY).empty())
+ is_valid = false;
+ break;
+ }
+ case WATCHFACE_COMPLICATION_TYPE_LONG_TEXT : {
+ if (shared_data.GetString(LONG_TEXT_KEY).empty())
+ is_valid = false;
+ break;
+ }
+ case WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE : {
+ if (shared_data.GetString(RANGE_CUR_KEY).empty() ||
+ shared_data.GetString(RANGE_MAX_KEY).empty() ||
+ shared_data.GetString(RANGE_MIN_KEY).empty())
+ is_valid = false;
+ break;
+ }
+ case WATCHFACE_COMPLICATION_TYPE_TIME : {
+ if (shared_data.GetString(TIME_KEY).empty() &&
+ shared_data.GetString(TIME_ZONE_ID_KEY).empty())
+ is_valid = false;
+ break;
+ }
+ case WATCHFACE_COMPLICATION_TYPE_ICON : {
+ if (shared_data.GetString(ICON_KEY).empty())
+ is_valid = false;
+ break;
+ }
+ case WATCHFACE_COMPLICATION_TYPE_IMAGE : {
+ if (shared_data.GetString(IMAGE_KEY).empty())
+ is_valid = false;
+ break;
+ }
+ case WATCHFACE_COMPLICATION_TYPE_NO_DATA :
+ is_valid = true;
+ break;
+ default :
+ is_valid = false;
+ break;
+ }
+
+ if (!is_valid)
+ LOGE("Invalid data (%d)", type);
+ return is_valid;
+ }
+
std::string GetAppPath(const char* appid, char* path) {
char* root_path;
aul_get_app_shared_resource_path_by_appid(appid, &root_path);
@@ -382,14 +475,15 @@ out:
}
int ConvertPathToAppPath(const char* appid, bundle* data) {
- char* path;
- char* dup_path;
- int ret = bundle_get_str(data, ICON_KEY, &path);
- if (ret == BUNDLE_ERROR_NONE) {
- dup_path = strdup(path);
- bundle_del(data, ICON_KEY);
- ret = bundle_add_str(
- data, ICON_KEY,
+ list<string> key_list {ICON_KEY, IMAGE_KEY};
+ for (auto& i : key_list) {
+ char* path;
+ int ret = bundle_get_str(data, i.c_str(), &path);
+ if (ret != BUNDLE_ERROR_NONE)
+ continue;
+ char* dup_path = strdup(path);
+ bundle_del(data, i.c_str());
+ ret = bundle_add_str(data, i.c_str(),
util::GetAppPath(appid, dup_path).c_str());
free(dup_path);
if (ret != BUNDLE_ERROR_NONE) {
@@ -397,22 +491,158 @@ out:
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
}
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+ }
- ret = bundle_get_str(data, IMAGE_KEY, &path);
- if (ret == BUNDLE_ERROR_NONE) {
- dup_path = strdup(path);
- bundle_del(data, IMAGE_KEY);
- ret = bundle_add_str(
- data, IMAGE_KEY,
- util::GetAppPath(appid, path).c_str());
- free(dup_path);
- if (ret != BUNDLE_ERROR_NONE) {
- LOGE("fail to add app path");
- return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- }
+ int ConvertAulError(int ret) {
+ if (ret == AUL_R_OK)
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+ if (ret == AUL_R_EILLACC)
+ return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
+ else if (ret == AUL_R_EINVAL)
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ else
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ void DestroyTimeInfo(struct complication_time_info_s* info_s) {
+ if (info_s->timezone)
+ free(info_s->timezone);
+
+ if (info_s->timezone_id)
+ free(info_s->timezone_id);
+
+ if (info_s->country)
+ free(info_s->country);
+
+ if (info_s->city)
+ free(info_s->city);
+ free(info_s);
+ }
+
+ const char* DBHelper::GetParserDataPath() const {
+ uid_t target_uid;
+ const char* path;
+ bool is_global;
+
+ pkgmgr_installer_info_get_target_uid(&target_uid);
+
+ if (target_uid == ROOT_USER
+ || target_uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER))
+ is_global = true;
+ else
+ is_global = false;
+
+ if (!is_global)
+ tzplatform_set_user(target_uid);
+
+ path = tzplatform_mkpath(is_global ? TZ_SYS_DB : TZ_USER_DB,
+ ".complication_provider.db");
+ tzplatform_reset_user();
+
+ return path;
+ }
+
+ bool DBHelper::Open() {
+ const char* path = GetParserDataPath();
+ if (path == nullptr)
+ return false;
+
+ sqlite3* db = nullptr;
+ int ret = sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY, nullptr);
+ if (ret != SQLITE_OK) {
+ LOGE("open db(%s) error: %d", path, ret);
+ return false;
}
+ db_.reset(db);
+ Exec("PRAGMA foreign_keys = ON");
- return WATCHFACE_COMPLICATION_ERROR_NONE;
+ return true;
+ }
+
+ bool DBHelper::Open(int mode) {
+ const char* path = GetParserDataPath();
+ if (path == nullptr)
+ return false;
+
+ sqlite3* db = nullptr;
+ int ret = sqlite3_open_v2(path, &db, mode, nullptr);
+ if (ret != SQLITE_OK) {
+ LOGE("open db(%s) error: %d", path, ret);
+ return false;
+ }
+ db_.reset(db);
+ Exec("PRAGMA foreign_keys = ON");
+
+ return true;
+ }
+
+ void DBHelper::Close() {
+ db_.reset();
+ }
+
+ bool DBHelper::Exec(const std::string& query) {
+ if (sqlite3_exec(db_.get(), query.c_str(), NULL, NULL, NULL) != SQLITE_OK) {
+ LOGE("exec error %s", sqlite3_errmsg(db_.get()));
+ return false;
+ }
+ return true;
+ }
+
+ bool DBHelper::Prepare(const std::string& query) {
+ sqlite3_stmt* stmt = nullptr;
+ if (sqlite3_prepare_v2(db_.get(), query.c_str(), query.size(), &stmt,
+ nullptr) != SQLITE_OK) {
+ LOGE("prepare error: %s", sqlite3_errmsg(db_.get()));
+ return false;
+ }
+
+ stmt_.reset(stmt);
+
+ return true;
+ }
+
+ const DBHelper::Cursor& DBHelper::GetCursor() const {
+ return stmt_;
+ }
+
+ int DBHelper::Step() const {
+ int ret = sqlite3_step(stmt_.get());
+ if (ret != SQLITE_DONE || ret != SQLITE_ROW)
+ LOGE("step error: %s", sqlite3_errmsg(db_.get()));
+ return ret;
+ }
+
+ int DBHelper::Reset() const {
+ return sqlite3_reset(stmt_.get());
+ }
+
+ bool DBHelper::Bind(int pos, std::string text) {
+ int ret = sqlite3_bind_text(stmt_.get(), pos, text.c_str(),
+ -1, SQLITE_TRANSIENT);
+ if (ret != SQLITE_OK) {
+ LOGE("bind error: %s", sqlite3_errmsg(db_.get()));
+ return false;
+ }
+
+ return true;
+ }
+
+ bool DBHelper::Bind(int pos, int val) {
+ if (sqlite3_bind_int(stmt_.get(), pos, val) != SQLITE_OK) {
+ LOGE("bind error: %s", sqlite3_errmsg(db_.get()));
+ return false;
+ }
+
+ return true;
+ }
+
+ const char* DBHelper::GetText(int pos) const {
+ return reinterpret_cast<const char*>(sqlite3_column_text(stmt_.get(), pos));
+ }
+
+ int DBHelper::GetInt(int pos) const {
+ return sqlite3_column_int(stmt_.get(), pos);
}
} // namespace util
diff --git a/watchface-common/watchface-util.h b/watchface-common/watchface-util.h
index a24a258..b26b714 100644
--- a/watchface-common/watchface-util.h
+++ b/watchface-common/watchface-util.h
@@ -19,9 +19,13 @@
#include <gio/gio.h>
#include <bundle.h>
+#include <bundle_cpp.h>
+#include <sqlite3.h>
+#include <tzplatform_config.h>
#include <string>
#include "watchface-common/include/watchface-common.h"
+#include "watchface-common/watchface-common-internal.h"
#define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
@@ -42,7 +46,8 @@ namespace util {
EditableEditPreview,
EditableEditCancel,
EditableEditReady,
- SetupReply
+ SetupReply,
+ ProviderReady
};
enum EncodeType {
@@ -53,6 +58,7 @@ namespace util {
EXPORT_API bool CheckWatchFeatureEnabled();
EXPORT_API int CheckPrivilege(const char* privilege);
+ EXPORT_API int CheckPrivilege(std::string privilege, cynara_result *pcr);
EXPORT_API int CheckPrivilege(std::string& privilege,
GDBusConnection *connection,
std::string& sender_name,
@@ -71,6 +77,39 @@ namespace util {
EXPORT_API bool CheckCertificate(const std::string& provider_app_id);
EXPORT_API std::string GetAppPath(const char* appid, char* path);
EXPORT_API int ConvertPathToAppPath(const char* appid, bundle* data);
+ EXPORT_API bool IsValidData(tizen_base::Bundle shared_data);
+ EXPORT_API int GetDataType(tizen_base::Bundle shared_data);
+ EXPORT_API int ConvertAulError(int ret);
+ EXPORT_API void DestroyTimeInfo(struct complication_time_info_s* info);
+
+ class EXPORT_API DBHelper {
+ public:
+ using Cursor = std::unique_ptr<sqlite3_stmt, decltype(sqlite3_finalize)*>;
+ DBHelper()
+ : db_(nullptr, sqlite3_close_v2), stmt_(nullptr, sqlite3_finalize) {}
+
+ bool Open();
+ bool Open(int mode);
+ void Close();
+ bool Prepare(const std::string& query);
+ bool Exec(const std::string& query);
+ const Cursor& GetCursor() const;
+ int Step() const;
+ int Reset() const;
+
+ bool Bind(int pos, std::string text);
+ bool Bind(int pos, int val);
+
+ const char* GetText(int pos) const;
+ int GetInt(int pos) const;
+
+ private:
+ const char* GetParserDataPath() const;
+
+ private:
+ std::unique_ptr<sqlite3, decltype(sqlite3_close_v2)*> db_;
+ Cursor stmt_;
+ };
} // namespace util
} // namespace watchface_complication
diff --git a/watchface-complication-provider/complication-provider-event-interface.h b/watchface-complication-provider/complication-provider-event-interface.h
index df0b6f4..310b470 100644
--- a/watchface-complication-provider/complication-provider-event-interface.h
+++ b/watchface-complication-provider/complication-provider-event-interface.h
@@ -17,17 +17,19 @@
#ifndef WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
#define WATCHFACE_COMPLICATION_PROVIDER_COMPLICATION_PROVIDER_EVENT_INTERFACE_H_
+#include <bundle_cpp.h>
+
#include <string>
#include "watchface-complication/include/watchface-complication-internal.h"
-#include "watchface-complication/complication-bundle.h"
namespace watchface_complication {
class EXPORT_API IComplicationProviderEvent {
public:
virtual void OnDataUpdated(const std::string& provider_id,
- ComplicationType type, const std::unique_ptr<Bundle>& data) = 0;
+ ComplicationType type,
+ const std::unique_ptr<tizen_base::Bundle>& data) = 0;
virtual void OnProviderError(const std::string& provider_id,
ComplicationType type, int error) = 0;
virtual void OnNotifyDataUpdate() = 0;
diff --git a/watchface-complication-provider/complication-provider-implementation.h b/watchface-complication-provider/complication-provider-implementation.h
index e4762c8..281264c 100644
--- a/watchface-complication-provider/complication-provider-implementation.h
+++ b/watchface-complication-provider/complication-provider-implementation.h
@@ -47,7 +47,8 @@ class ComplicationProvider::Impl : IGDBus::IGDBusEvent {
void OnVanish(const std::string& name) override;
void OnAppear(const std::string& name, const std::string& name_owner) override;
std::list<std::string>& GetRequiredPrivileges();
- Impl(ComplicationProvider* parent, const std::string& provider_id, bool mock);
+ int NotifyProviderReady();
+ Impl(ComplicationProvider* parent, const std::string& provider_id);
class SenderInfo {
public:
SenderInfo(const std::string& sender_name, const char* sender_app_id,
@@ -79,9 +80,8 @@ class ComplicationProvider::Impl : IGDBus::IGDBusEvent {
int supported_types_;
std::map<std::string, SenderInfo*> sender_info_;
std::list<std::string> required_privileges_;
- std::unique_ptr<IGDBus> gdbus_ = nullptr;
+ std::unique_ptr<IGDBus> gdbus_;
bool trusted_;
- bool mock_ = false;
};
} // namespace watchface_complication
diff --git a/watchface-complication-provider/complication-provider.cc b/watchface-complication-provider/complication-provider.cc
index 4fc3b29..888c1f6 100644
--- a/watchface-complication-provider/complication-provider.cc
+++ b/watchface-complication-provider/complication-provider.cc
@@ -30,21 +30,23 @@
#endif
#define LOG_TAG "WATCHFACE_COMPLICATION"
-#define PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing"
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
-ComplicationProvider::ComplicationProvider(const std::string& provider_id, bool mock)
- : impl_(new Impl(this, provider_id, mock)) {
+ComplicationProvider::ComplicationProvider(const std::string& provider_id)
+ : impl_(new Impl(this, provider_id)) {
+ impl_->NotifyProviderReady();
}
ComplicationProvider::~ComplicationProvider() = default;
ComplicationProvider::Impl::Impl(ComplicationProvider* parent,
- const std::string& provider_id, bool mock)
+ const std::string& provider_id)
: parent_(parent), provider_id_(provider_id),
- gdbus_(std::unique_ptr<IGDBus>(ComplicationConnector::GetInst(mock).CreateGDBus(mock))),
- mock_(mock) {
+ gdbus_(std::unique_ptr<IGDBus>(
+ ComplicationConnector::GetInst().CreateGDBus())) {
int ret = util::CheckPrivilege(PRIVILEGE_DATASHARING);
subscribe_id_ = gdbus_.get()->SubscribeSignal(
IGDBus::Complication, provider_id_, -1, this);
@@ -84,7 +86,8 @@ ComplicationProvider::Impl::SenderInfo::SenderInfo(
const std::string& sender_name, const char* sender_app_id,
int watcher_id, std::string watch_name)
: sender_name_(sender_name), sender_app_id_(sender_app_id),
- watcher_id_(watcher_id), watch_name_(watch_name), privilege_result_(COMPLICATION_CYNARA_UNKNOWN) {
+ watcher_id_(watcher_id), watch_name_(watch_name),
+ privilege_result_(COMPLICATION_CYNARA_UNKNOWN) {
}
int ComplicationProvider::Impl::SenderInfo::CheckPrivilege(
@@ -157,47 +160,52 @@ void ComplicationProvider::Impl::OnVanish(const std::string& watch_name) {
}
}
+int ComplicationProvider::Impl::NotifyProviderReady() {
+ LOGI("notify %s", provider_id_.c_str());
+ if (!gdbus_.get()->EmitSignal(IGDBus::Complication, "",
+ provider_id_, -1, util::GetCmdStr(util::ProviderReady),
+ g_variant_new("(s)", provider_id_.c_str())))
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
void ComplicationProvider::Impl::OnAppear(const std::string& name,
const std::string& name_owner) {
}
ComplicationProvider::Impl::SenderInfo* ComplicationProvider::Impl::GetSenderInfo(
std::string sender_name, GDBusConnection* connection, GVariant* parameters) {
-
auto iter = sender_info_.find(sender_name);
- SenderInfo* si;
- if (iter == sender_info_.end()) {
- char* sender_app_id = NULL;
- g_variant_get_child(parameters, 0, "&s", &sender_app_id);
- if (sender_app_id == NULL ||
- !util::CheckSender(sender_app_id, sender_name, connection)) {
- LOGE("invalid sender_app_id %s", sender_app_id);
- return NULL;
- }
+ if (iter != sender_info_.end())
+ return iter->second;
+
+ char* sender_app_id = nullptr;
+ g_variant_get_child(parameters, 0, "&s", &sender_app_id);
+ if (sender_app_id == nullptr ||
+ !util::CheckSender(sender_app_id, sender_name, connection)) {
+ LOGE("invalid sender_app_id %s", sender_app_id);
+ return nullptr;
+ }
- int watcher_id = 0;
- watcher_id = gdbus_.get()->Watch(std::string(sender_app_id), this);
- try {
- if (trusted_ && !util::CheckCertificate(sender_app_id)) {
- LOGE("Permission denied");
- return NULL;
- }
- std::string watch_name = util::EncodeStr(util::EncodeType::Name, sender_app_id);
- if (watch_name.empty()) {
- LOGE("fail to get watch name");
- return NULL;
- }
- si = new SenderInfo(sender_name, sender_app_id, watcher_id, watch_name);
- sender_info_[sender_name] = si;
- LOGI("sender_info added (%s) ", watch_name.c_str());
- } catch (const std::bad_alloc &ba) {
- LOGE("SenderInfo::Exception bad_alloc");
- return NULL;
- }
- LOGI("create new sender_info_ ");
- } else {
- si = iter->second;
+ int watcher_id = gdbus_.get()->Watch(std::string(sender_app_id), this);
+ if (trusted_ && !util::CheckCertificate(sender_app_id)) {
+ LOGE("Permission denied");
+ return nullptr;
}
+ std::string watch_name = util::EncodeStr(
+ util::EncodeType::Name, sender_app_id);
+ if (watch_name.empty()) {
+ LOGE("fail to get watch name");
+ return nullptr;
+ }
+ SenderInfo* si = new (std::nothrow) SenderInfo(
+ sender_name, sender_app_id, watcher_id, watch_name);
+ if (si == nullptr) {
+ LOGE("Out of memory");
+ return nullptr;
+ }
+ sender_info_[sender_name] = si;
+ LOGI("sender_info added (%s) ", watch_name.c_str());
return si;
}
@@ -208,19 +216,8 @@ void ComplicationProvider::Impl::OnSignal(GDBusConnection* connection,
const std::string& signal_name,
GVariant* parameters) {
LOGI("%s, %s", sender_name.c_str(), signal_name.c_str());
- int complication_id;
- char* context_raw = NULL;
- int type;
- Bundle* context_data;
- Bundle* shared_data;
- bool ret;
- bool is_valid;
- char num_str[32] = {0, };
- char* shared_data_type;
- char* sender_app_id = NULL;
-
SenderInfo* si = GetSenderInfo(sender_name, connection, parameters);
- if (si == NULL)
+ if (si == nullptr)
return;
if (si->GetPrivilegeResult() == COMPLICATION_CYNARA_DENIED) {
@@ -247,6 +244,10 @@ void ComplicationProvider::Impl::OnSignal(GDBusConnection* connection,
if (signal_name.compare(util::GetCmdStr(
util::CmdType::CompUpdateRequest)) == 0) {
+ char* context_raw = nullptr;
+ int type;
+ int complication_id;
+ char* sender_app_id = nullptr;
g_variant_get(parameters, "(&sii&s)", &sender_app_id,
&complication_id, &type, &context_raw);
@@ -266,63 +267,59 @@ void ComplicationProvider::Impl::OnSignal(GDBusConnection* connection,
}
LOGI("get : %s, %d, %d", sender_app_id, complication_id, type);
-
try {
- context_data = new Bundle(std::string(context_raw));
- shared_data = new Bundle();
+ Bundle context_data;
+ if (strlen(context_raw) > 0)
+ context_data = Bundle(context_raw);
+ Bundle shared_data;
+ string received_type = std::to_string(type);
+ int ret = shared_data.Add(DATA_TYPE_KEY, received_type);
+ if (ret != BUNDLE_ERROR_NONE)
+ return;
+
+ /* Call update request callback and fill shared data */
+ parent_->OnDataUpdateRequest(sender_app_id, (ComplicationType)type,
+ context_data, &shared_data);
+ string shared_type = shared_data.GetString(DATA_TYPE_KEY);
+ if (shared_type.empty() || shared_type != received_type) {
+ shared_data.Delete(DATA_TYPE_KEY);
+ ret = shared_data.Add(DATA_TYPE_KEY, received_type);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("Fail to add key");
+ return;
+ }
+ LOGW("DATA_TYPE_KEY repaired : %s %s",
+ shared_type.c_str(), received_type.c_str());
+ }
+ if (!util::IsValidData(shared_data)) {
+ LOGE("EmitSignal failed %s %s %d %d", sender_app_id, (provider_id_).c_str(),
+ complication_id, type);
+ return;
+ }
+ util::ConvertPathToAppPath(util::GetAppId().c_str(), shared_data.GetHandle());
+ bool result = gdbus_.get()->EmitSignal(
+ IGDBus::Complication,
+ std::string(sender_app_id),
+ provider_id_, -1,
+ util::GetCmdStr(util::CompUpdated),
+ g_variant_new("(siis)",
+ (provider_id_).c_str(),
+ type,
+ complication_id,
+ shared_data.ToRaw().first.get()));
+ if (!result)
+ LOGE("EmitSignal failed %s %s %d", sender_app_id, (provider_id_).c_str(),
+ complication_id);
} catch (const std::bad_alloc &ba) {
- LOGE("Bundle::Exception bad_alloc");
- return;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return;
- }
-
- snprintf(num_str, sizeof(num_str), "%d", type);
- bundle_add_str(shared_data->GetRaw(), DATA_TYPE_KEY, num_str);
-
- /* Call update request callback and fill shared data */
- parent_->OnDataUpdateRequest(sender_app_id, (ComplicationType)type,
- context_data, shared_data);
- delete context_data;
-
- shared_data_type = NULL;
- bundle_get_str(shared_data->GetRaw(), DATA_TYPE_KEY, &shared_data_type);
- if (shared_data_type == NULL || strcmp(shared_data_type, num_str) != 0) {
- bundle_del(shared_data->GetRaw(), DATA_TYPE_KEY);
- bundle_add_str(shared_data->GetRaw(), DATA_TYPE_KEY, num_str);
- LOGI("DATA_TYPE_KEY repaired : %s %s", shared_data_type, num_str);
- }
-
- is_valid = false;
- watchface_complication_provider_data_is_valid(shared_data->GetRaw(), &is_valid);
- if (is_valid == false) {
- LOGE("EmitSignal failed %s %s %d %d", sender_app_id, (provider_id_).c_str(),
- complication_id, type);
- delete shared_data;
+ LOGE("Exception bad_alloc");
return;
}
- util::ConvertPathToAppPath(util::GetAppId().c_str(), shared_data->GetRaw());
- ret = gdbus_.get()->EmitSignal(
- IGDBus::Complication,
- std::string(sender_app_id),
- provider_id_, -1,
- util::GetCmdStr(util::CompUpdated),
- g_variant_new("(siis)",
- (provider_id_).c_str(),
- type,
- complication_id,
- shared_data->ToString()));
- delete shared_data;
- if (ret == false)
- LOGE("EmitSignal failed %s %s %d", sender_app_id, (provider_id_).c_str(),
- complication_id);
}
}
/* LCOV_EXCL_START */
void ComplicationProvider::OnDataUpdateRequest(const std::string& sender_appid,
- ComplicationType type, const Bundle* context, Bundle* shared_data) {
+ ComplicationType type, const Bundle& context, Bundle* shared_data) {
}
/* LCOV_EXCL_STOP */
@@ -334,24 +331,9 @@ int ComplicationProvider::NotifyDataUpdate() {
LOGI("notify %s", impl_->provider_id_.c_str());
static cynara_result pcr = COMPLICATION_CYNARA_UNKNOWN;
-
- int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
- if (pcr == COMPLICATION_CYNARA_DENIED) {
- LOGE("Permission denied");
- return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
-
- } else if (pcr == COMPLICATION_CYNARA_UNKNOWN) {
- ret = util::CheckPrivilege(PRIVILEGE_DATASHARING);
- if (ret == WATCHFACE_COMPLICATION_ERROR_NONE) {
- pcr = COMPLICATION_CYNARA_ALLOWED;
- } else if (ret == WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED) {
- pcr = COMPLICATION_CYNARA_DENIED;
- return ret;
- } else {
- return ret;
- }
- }
-
+ int ret = util::CheckPrivilege(PRIVILEGE_DATASHARING, &pcr);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
if (!impl_->gdbus_.get()->EmitSignal(IGDBus::Complication, "",
impl_->provider_id_, -1, util::GetCmdStr(util::CompNotifyDataUpdate),
g_variant_new("(s)", impl_->provider_id_.c_str())))
@@ -359,7 +341,8 @@ int ComplicationProvider::NotifyDataUpdate() {
return ret;
}
-bool ComplicationProvider::SetupReplyToEditor(std::string editor_appid, int editable_id, const char* raw) {
+bool ComplicationProvider::SetupReplyToEditor(std::string editor_appid,
+ int editable_id, const char* raw) {
bool emit_signal_ret = false;
try {
emit_signal_ret = ComplicationConnector::GetInst().EmitSignal(
@@ -367,7 +350,7 @@ bool ComplicationProvider::SetupReplyToEditor(std::string editor_appid, int edit
editor_appid,
editor_appid, -1,
util::GetCmdStr(util::CmdType::SetupReply),
- g_variant_new("(is)", editable_id, raw == NULL ? "" : raw));
+ g_variant_new("(is)", editable_id, raw == nullptr ? "" : raw));
} catch (Exception &ex) {
LOGE("%s %d", ex.what(), ex.GetErrorCode());
}
diff --git a/watchface-complication-provider/complication-provider.h b/watchface-complication-provider/complication-provider.h
index faef2a1..a8a6b11 100644
--- a/watchface-complication-provider/complication-provider.h
+++ b/watchface-complication-provider/complication-provider.h
@@ -28,18 +28,19 @@ namespace watchface_complication {
class EXPORT_API ComplicationProvider : public IComplicationEvent {
public:
- explicit ComplicationProvider(const std::string& provider_id, bool mock);
+ explicit ComplicationProvider(const std::string& provider_id);
virtual ~ComplicationProvider(); /* LCOV_EXCL_LINE */
public:
void OnDataUpdateRequest(const std::string& sender_appid,
ComplicationType type,
- const Bundle* context,
- Bundle* shared_data) override;
+ const tizen_base::Bundle& context,
+ tizen_base::Bundle* shared_data) override;
int NotifyDataUpdate();
const std::string& GetProviderId() const;
- static bool SetupReplyToEditor(std::string editor_appid, int editable_id, const char* raw);
+ static bool SetupReplyToEditor(std::string editor_appid,
+ int editable_id, const char* raw);
private:
class Impl;
diff --git a/watchface-complication-provider/include/watchface-complication-provider-internal.h b/watchface-complication-provider/include/watchface-complication-provider-internal.h
index 2de996a..b7f390b 100644
--- a/watchface-complication-provider/include/watchface-complication-provider-internal.h
+++ b/watchface-complication-provider/include/watchface-complication-provider-internal.h
@@ -40,10 +40,10 @@ extern "C" {
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
*
*/
@@ -54,4 +54,4 @@ int watchface_complication_provider_data_set_type(bundle *shared_data,
}
#endif
-#endif /* __TIZEN_APPFW_WATCHFACE_COMPLICATION_PROVIDER_INTERNAL_H__ */ \ No newline at end of file
+#endif /* __TIZEN_APPFW_WATCHFACE_COMPLICATION_PROVIDER_INTERNAL_H__ */
diff --git a/watchface-complication-provider/include/watchface-complication-provider.h b/watchface-complication-provider/include/watchface-complication-provider.h
index f488a3e..3ec6ad0 100644
--- a/watchface-complication-provider/include/watchface-complication-provider.h
+++ b/watchface-complication-provider/include/watchface-complication-provider.h
@@ -113,12 +113,12 @@ typedef void (*watchface_complication_provider_update_requested_cb)(
* @param[in] user_data The user data passed from the callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @see watchface_complication_provider_remove_update_requested_cb()
* @par Sample code:
* @code
@@ -141,8 +141,8 @@ int watchface_complication_provider_add_update_requested_cb(
* @param[in] callback The callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_complication_provider_add_update_requested_cb()
* @par Sample code:
* @code
@@ -166,11 +166,11 @@ int watchface_complication_provider_remove_update_requested_cb(
* @param[in] updated_provider_id The id of the provider
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-complication-provider.h>
@@ -197,11 +197,11 @@ int watchface_complication_provider_notify_update(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see complication_provider_setup_get_context()
* @par Sample code:
* @code
@@ -229,9 +229,9 @@ int watchface_complication_provider_setup_reply_to_editor(app_control_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @see complication_provider_setup_reply_to_editor()
* @par Sample code:
* @code
@@ -264,9 +264,9 @@ int watchface_complication_provider_setup_is_editing(app_control_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @see complication_provider_setup_reply_to_editor()
* @par Sample code:
* @code
@@ -293,10 +293,10 @@ int watchface_complication_provider_setup_get_context(app_control_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -322,10 +322,10 @@ int watchface_complication_provider_data_set_short_text(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -352,10 +352,10 @@ int watchface_complication_provider_data_set_long_text(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -373,6 +373,7 @@ int watchface_complication_provider_data_set_title(bundle *shared_data,
const char *title);
/**
+ * @deprecated Deprecated since 5.5. Use watchface_complication_provider_data_set_timeinfo() instead.
* @brief Sets timestamp data for shared data.
* @since_tizen 5.0
* @remarks @a timestamp can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
@@ -381,10 +382,10 @@ int watchface_complication_provider_data_set_title(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -403,7 +404,266 @@ void _watchface_complication_provider_update_requested_cb(const char *provider_i
* @endcode
*/
int watchface_complication_provider_data_set_timestamp(bundle *shared_data,
- long timestamp);
+ long timestamp) TIZEN_DEPRECATED_API;
+
+/**
+ * @brief Creates timeinfo data.
+ * @since_tizen 5.5
+ * @remarks @a info can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
+ * @remarks The @a info should be released using watchface_complication_provider_timeinfo_destroy().
+ * @param[out] info The time information handle
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @see watchface_complication_provider_timeinfo_set_timezone()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
+ * @see watchface_complication_provider_timeinfo_set_timezone_country()
+ * @see watchface_complication_provider_timeinfo_set_timezone_city()
+ * @see watchface_complication_provider_timeinfo_destroy()
+ * @see watchface_complication_provider_data_set_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_timeinfo_create(complication_time_info_h *info);
+
+/**
+ * @brief Sets timezone information.
+ * @since_tizen 5.5
+ * @remarks @a info can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
+ * @param[in] info The time information handle
+ * @param[in] timezone The timezone string
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
+ * @see watchface_complication_provider_timeinfo_set_timezone_country()
+ * @see watchface_complication_provider_timeinfo_set_timezone_city()
+ * @see watchface_complication_provider_timeinfo_destroy()
+ * @see watchface_complication_provider_data_set_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_set_timezone(info, "UTC+9");
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_timeinfo_set_timezone(complication_time_info_h info,
+ const char *timezone);
+
+/**
+ * @brief Sets timezone id.
+ * @since_tizen 5.5
+ * @remarks @a info can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
+ * @param[in] info The time information handle
+ * @param[in] timezone_id The timezone id which is specified in TZ database
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see watchface_complication_provider_timeinfo_set_timezone()
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_timeinfo_set_timezone_country()
+ * @see watchface_complication_provider_timeinfo_set_timezone_city()
+ * @see watchface_complication_provider_timeinfo_destroy()
+ * @see watchface_complication_provider_data_set_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_set_timezone_id(info, "Asia/Seoul");
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_timeinfo_set_timezone_id(complication_time_info_h info,
+ const char *timezone_id);
+
+/**
+ * @brief Sets timezone country information.
+ * @since_tizen 5.5
+ * @remarks @a info can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
+ * @param[in] info The time information handle
+ * @param[in] country The timezone country information
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see watchface_complication_provider_timeinfo_set_timezone()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_timeinfo_set_timezone_city()
+ * @see watchface_complication_provider_timeinfo_destroy()
+ * @see watchface_complication_provider_data_set_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_set_timezone_country(info, "Korea");
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_timeinfo_set_timezone_country(complication_time_info_h info,
+ const char *country);
+
+/**
+ * @brief Sets timezone city information.
+ * @since_tizen 5.5
+ * @remarks @a info can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
+ * @param[in] info The time information handle
+ * @param[in] city The timezone city information
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see watchface_complication_provider_timeinfo_set_timezone()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
+ * @see watchface_complication_provider_timeinfo_set_timezone_country()
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_timeinfo_destroy()
+ * @see watchface_complication_provider_data_set_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_set_timezone_city(info, "Seoul");
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_timeinfo_set_timezone_city(complication_time_info_h info,
+ const char *city);
+
+/**
+ * @brief Destroys timezone handle.
+ * @since_tizen 5.5
+ * @param[in] info The time information handle
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see watchface_complication_provider_timeinfo_set_timezone()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
+ * @see watchface_complication_provider_timeinfo_set_timezone_country()
+ * @see watchface_complication_provider_timeinfo_set_timezone_city()
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_data_set_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_timeinfo_destroy(complication_time_info_h info);
+
+
+/**
+ * @brief Sets time information data to shared data.
+ * @since_tizen 5.5
+ * @remarks @a info can be added only for #WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
+ * @param[in] shared_data The data which will be shared with watch application
+ * @param[in] info The time information handle
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_timeinfo_set_timezone()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
+ * @see watchface_complication_provider_timeinfo_set_timezone_country()
+ * @see watchface_complication_provider_timeinfo_set_timezone_city()
+ * @see watchface_complication_provider_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication-provider.h>
+void _watchface_complication_provider_update_requested_cb(const char *provider_id,
+ const char *req_appid, watchface_complication_type_e type,
+ const bundle *context, bundle *shared_data, void *user_data)
+{
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ complication_time_info_h info;
+ watchface_complication_provider_timeinfo_create(&info);
+ watchface_complication_provider_timeinfo_set_timezone(info, "UTC+9");
+ watchface_complication_provider_data_set_timeinfo(shared_data, info);
+ watchface_complication_provider_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_provider_data_set_timeinfo(bundle *shared_data,
+ complication_time_info_h info);
/**
* @brief Sets image path data for shared data.
@@ -415,10 +675,10 @@ int watchface_complication_provider_data_set_timestamp(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -446,10 +706,10 @@ int watchface_complication_provider_data_set_image_path(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -477,10 +737,10 @@ int watchface_complication_provider_data_set_ranged_value(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -506,10 +766,10 @@ int watchface_complication_provider_data_set_icon_path(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -534,10 +794,10 @@ int watchface_complication_provider_data_set_extra_data(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-complication-provider.h>
@@ -559,7 +819,7 @@ int watchface_complication_provider_data_set_screen_reader_text(
* #WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT : short text\n
* #WATCHFACE_COMPLICATION_TYPE_LONG_TEXT : long text\n
* #WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE : current, min, max\n
- * #WATCHFACE_COMPLICATION_TYPE_TIME : timestamp\n
+ * #WATCHFACE_COMPLICATION_TYPE_TIME : timestamp or timezone_id\n
* #WATCHFACE_COMPLICATION_TYPE_ICON : icon path\n
* #WATCHFACE_COMPLICATION_TYPE_IMAGE : image path\n
* @since_tizen 5.0
@@ -573,9 +833,10 @@ int watchface_complication_provider_data_set_screen_reader_text(
* @see watchface_complication_provider_data_set_short_text()
* @see watchface_complication_provider_data_set_long_text()
* @see watchface_complication_provider_data_set_ranged_value()
- * @see watchface_complication_provider_data_set_timestamp()
* @see watchface_complication_provider_data_set_icon_path()
* @see watchface_complication_provider_data_set_image_path()
+ * @see watchface_complication_provider_timeinfo_create()
+ * @see watchface_complication_provider_timeinfo_set_timezone_id()
* @par Sample code:
* @code
#include <watchface-complication-provider.h>
@@ -610,8 +871,8 @@ int watchface_complication_provider_data_is_valid(bundle *shared_data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @see watchface_complication_event_type_e
@@ -654,11 +915,11 @@ int watchface_complication_provider_event_get_type(app_control_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_transfer_event()
* @see watchface_complication_provider_event_get_complication_type()
* @see watchface_complication_provider_event_get_context()
@@ -696,11 +957,11 @@ int watchface_complication_provider_event_get_provider_id(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_transfer_event()
* @see watchface_complication_provider_event_get_provider_id()
* @see watchface_complication_provider_event_get_context()
@@ -743,11 +1004,11 @@ int watchface_complication_provider_event_get_complication_type(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_transfer_event()
* @see watchface_complication_provider_event_get_provider_id()
* @see watchface_complication_provider_event_get_complication_type()
diff --git a/watchface-complication-provider/watchface-complication-provider.cc b/watchface-complication-provider/watchface-complication-provider.cc
index 3e92dd5..0e98ebb 100644
--- a/watchface-complication-provider/watchface-complication-provider.cc
+++ b/watchface-complication-provider/watchface-complication-provider.cc
@@ -25,6 +25,7 @@
#include <app_control_internal.h>
#include <dlog.h>
#include <bundle.h>
+#include <bundle_cpp.h>
#include <map>
#include <list>
@@ -40,11 +41,12 @@
#endif
#define LOG_TAG "WATCHFACE_COMPLICATION"
-#define MAX_MANDATORY_FIELDS 3
static int _add_bundle_data(bundle* shared_data, const char* key,
const char* value);
+using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
class CallbackInfo {
public:
@@ -52,14 +54,31 @@ class CallbackInfo {
void* user_data) : cb_(cb), user_data_(user_data) {
}
+ CallbackInfo(CallbackInfo&& c) noexcept {
+ cb_ = c.cb_;
+ user_data_ = c.user_data_;
+ c.cb_ = nullptr;
+ c.user_data_ = nullptr;
+ }
+
+ CallbackInfo& operator = (CallbackInfo&& c) noexcept {
+ if (this != &c) {
+ cb_ = c.cb_;
+ user_data_ = c.user_data_;
+ c.cb_ = nullptr;
+ c.user_data_ = nullptr;
+ }
+ return *this;
+ }
+
void Invoke(const std::string& provider_id, const std::string& sender_appid,
- ComplicationType type, const Bundle* context,
+ ComplicationType type, const Bundle& context,
Bundle* shared_data) {
- const bundle* context_data = context->GetConstRaw();
+ const bundle* context_data = context.GetHandle();
cb_(provider_id.c_str(), sender_appid.c_str(),
static_cast<watchface_complication_type_e>(type), context_data,
- shared_data->GetRaw(), user_data_);
+ shared_data->GetHandle(), user_data_);
}
watchface_complication_provider_update_requested_cb GetCallback() {
@@ -74,11 +93,11 @@ class CallbackInfo {
class WatchComplicationProviderStub : public ComplicationProvider {
public:
explicit WatchComplicationProviderStub(const std::string& provider_id)
- : ComplicationProvider(provider_id, false) {
+ : ComplicationProvider(provider_id) {
}
void OnDataUpdateRequest(const std::string& sender_appid,
- ComplicationType type, const Bundle* context,
+ ComplicationType type, const Bundle& context,
Bundle* shared_data) override {
for (auto& i : cb_list_)
i->Invoke(GetProviderId(), sender_appid, type, context, shared_data);
@@ -86,14 +105,14 @@ class WatchComplicationProviderStub : public ComplicationProvider {
GetProviderId().c_str(), sender_appid.c_str());
}
- int AddCallbackInfo(CallbackInfo* ci) {
+ int AddCallbackInfo(unique_ptr<CallbackInfo> ci) {
for (auto& i : cb_list_) {
if (i.get()->GetCallback() == ci->GetCallback()) {
LOGI("already registered callback");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
}
- cb_list_.emplace_back(ci);
+ cb_list_.emplace_back(move(ci));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -113,12 +132,6 @@ class WatchComplicationProviderStub : public ComplicationProvider {
};
static std::map<std::string, WatchComplicationProviderStub*> __providers;
-
-struct complication_mandatory_fields {
- watchface_complication_type_e type;
- const char* mandatory_fields[MAX_MANDATORY_FIELDS];
-};
-
extern "C" EXPORT_API int watchface_complication_provider_add_update_requested_cb(
const char* provider_id,
watchface_complication_provider_update_requested_cb cb,
@@ -126,7 +139,7 @@ extern "C" EXPORT_API int watchface_complication_provider_add_update_requested_c
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (provider_id == NULL || cb == NULL)
+ if (provider_id == nullptr || cb == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
std::string appid = DBManager::GetProviderAppId(provider_id);
@@ -135,7 +148,6 @@ extern "C" EXPORT_API int watchface_complication_provider_add_update_requested_c
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
auto cp = __providers.find(provider_id);
auto ws = cp->second;
@@ -153,12 +165,14 @@ extern "C" EXPORT_API int watchface_complication_provider_add_update_requested_c
LOGI("create new provider : %s", provider_id);
}
- auto ci = new CallbackInfo(cb, user_data);
- ret = ws->AddCallbackInfo(ci);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
- delete ci;
+ auto ci = unique_ptr<CallbackInfo>(
+ new (std::nothrow) CallbackInfo(cb, user_data));
+ if (ci.get() == nullptr) {
+ LOGE("Out of memeory");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
- return ret;
+ return ws->AddCallbackInfo(move(ci));
}
extern "C" EXPORT_API int watchface_complication_provider_remove_update_requested_cb(
@@ -167,14 +181,15 @@ extern "C" EXPORT_API int watchface_complication_provider_remove_update_requeste
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (provider_id == NULL || cb == NULL)
+ if (provider_id == nullptr || cb == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
auto cp = __providers.find(provider_id);
auto ws = cp->second;
if (cp == __providers.end()) {
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ LOGE("Cannot find callback");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
return ws->RemoveCallbackInfo(cb);
@@ -185,7 +200,7 @@ extern "C" EXPORT_API int watchface_complication_provider_notify_update(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (updated_provider_id == NULL)
+ if (updated_provider_id == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
auto cp = __providers.find(updated_provider_id);
@@ -200,16 +215,28 @@ extern "C" EXPORT_API int watchface_complication_provider_notify_update(
return ws->NotifyDataUpdate();
}
+static int __convert_app_control_error(int error) {
+ if (error == APP_CONTROL_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+
+ if (error == APP_CONTROL_ERROR_OUT_OF_MEMORY) {
+ LOGE("Out of memory");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ LOGE("Fail to get data from control (%d)", error);
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+}
+
extern "C" EXPORT_API int watchface_complication_provider_setup_reply_to_editor(
app_control_h handle, bundle* context) {
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- char* editor_appid = NULL;
- char* editable_id = NULL;
+ char* editor_appid = nullptr;
+ char* editable_id = nullptr;
int ret;
int str_len = 0;
- bundle_raw* raw_data = NULL;
+ bundle_raw* raw_data = nullptr;
bool emit_signal_ret = false;
ret = app_control_get_extra_data(handle, SETUP_EDITOR_APPID_KEY,
@@ -218,35 +245,28 @@ extern "C" EXPORT_API int watchface_complication_provider_setup_reply_to_editor(
LOGE("Fail to get editor appid");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
+ string editor_appid_str = editor_appid;
+ free(editor_appid);
ret = app_control_get_extra_data(handle, SETUP_EDITABLE_ID_KEY, &editable_id);
- if (ret != APP_CONTROL_ERROR_NONE) {
- free(editor_appid);
-
- if (ret == APP_CONTROL_ERROR_OUT_OF_MEMORY) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
- LOGE("Fail to get setup editable ID (%d)", ret);
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
+ ret = __convert_app_control_error(ret);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ string editable_id_str = editable_id;
+ free(editable_id);
- if (context != NULL) {
+ if (context != nullptr) {
ret = bundle_encode(context, &raw_data, &str_len);
if (ret != 0) {
LOGE("Fail to encode data");
- free(editable_id);
- free(editor_appid);
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
}
emit_signal_ret = ComplicationProvider::SetupReplyToEditor(
- std::string(editor_appid),
- strtol(editable_id, NULL, 10),
- raw_data == NULL ? "" : reinterpret_cast<const char*>(raw_data));
- free(editor_appid);
- free(editable_id);
+ editor_appid_str,
+ stoi(editable_id_str),
+ raw_data == nullptr ? "" : reinterpret_cast<const char*>(raw_data));
free(raw_data);
if (emit_signal_ret == false)
@@ -257,75 +277,59 @@ extern "C" EXPORT_API int watchface_complication_provider_setup_reply_to_editor(
extern "C" EXPORT_API int watchface_complication_provider_setup_is_editing(
app_control_h handle, bool* is_editing) {
- char* value = NULL;
+ char* value = nullptr;
int ret;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || is_editing == NULL) {
+ if (handle == nullptr || is_editing == nullptr) {
LOGE("Null parameter");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
ret = app_control_get_extra_data(handle, SETUP_EDITOR_APPID_KEY, &value);
- if (ret != APP_CONTROL_ERROR_NONE) {
- if (ret == APP_CONTROL_ERROR_OUT_OF_MEMORY) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } else if (ret == APP_CONTROL_ERROR_KEY_NOT_FOUND) {
+ if (ret == APP_CONTROL_ERROR_KEY_NOT_FOUND) {
*is_editing = false;
return WATCHFACE_COMPLICATION_ERROR_NONE;
- }
- LOGE("Fail to get setup editor appid (%d)", ret);
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
+ ret = __convert_app_control_error(ret);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
- *is_editing = true;
free(value);
-
+ *is_editing = true;
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int watchface_complication_provider_setup_get_context(
app_control_h handle, bundle** context) {
- char* value = NULL;
- bundle* data = NULL;
+ char* value = nullptr;
+ bundle* data = nullptr;
int ret;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || context == NULL) {
+ if (handle == nullptr || context == nullptr) {
LOGE("Null parameter");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
ret = app_control_get_extra_data(handle, SETUP_EDITOR_APPID_KEY, &value);
- if (ret != APP_CONTROL_ERROR_NONE) {
- if (ret == APP_CONTROL_ERROR_OUT_OF_MEMORY) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
- LOGE("Fail to get setup editor appid (%d)", ret);
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
+ ret = __convert_app_control_error(ret);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
free(value);
ret = app_control_get_extra_data(handle, SETUP_CONTEXT_DATA_KEY, &value);
- if (ret != APP_CONTROL_ERROR_NONE) {
- if (ret == APP_CONTROL_ERROR_OUT_OF_MEMORY) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } else if (ret == APP_CONTROL_ERROR_KEY_NOT_FOUND) {
- *context = NULL;
+ if (ret == APP_CONTROL_ERROR_KEY_NOT_FOUND) {
+ *context = nullptr;
return WATCHFACE_COMPLICATION_ERROR_NONE;
- } else {
- LOGE("Fail to get context data (%d)", ret);
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
}
-
+ ret = __convert_app_control_error(ret);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
data = bundle_decode(reinterpret_cast<const bundle_raw*>(value),
strlen(value));
*context = data;
@@ -357,26 +361,18 @@ static int _add_bundle_data(bundle* shared_data, const char* key,
static int _get_data_type(bundle* shared_data,
watchface_complication_type_e* type) {
- int ret;
- char* type_str = NULL;
-
- if (shared_data == NULL) {
- LOGE("shared_data is NULL");
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
-
- ret = bundle_get_str(shared_data, DATA_TYPE_KEY, &type_str);
- if (ret != BUNDLE_ERROR_NONE) {
- LOGE("failed to get data type %d", ret);
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
-
- int comp_type = strtol(type_str, NULL, 10);
- if (!util::CheckComplicationType(comp_type)) {
- LOGE("Invalid param");
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ try {
+ Bundle b(shared_data);
+ int data_type = util::GetDataType(b);
+ if (!util::CheckComplicationType(data_type)) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ *type = static_cast<watchface_complication_type_e>(data_type);
+ } catch (const std::exception &e) {
+ LOGE("Exception (%s)", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
- *type = static_cast<watchface_complication_type_e>(comp_type);
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -385,7 +381,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_type(
bundle* shared_data, watchface_complication_type_e type) {
char num_str[32] = {0, };
- if (shared_data == NULL ||
+ if (shared_data == nullptr ||
!util::CheckComplicationType(static_cast<int>(type))) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -403,7 +399,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_title(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || title == NULL) {
+ if (shared_data == nullptr || title == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -430,7 +426,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_short_text(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || text == NULL) {
+ if (shared_data == nullptr || text == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -456,7 +452,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_long_text(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || text == NULL) {
+ if (shared_data == nullptr || text == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -481,7 +477,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_timestamp(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL) {
+ if (shared_data == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -498,6 +494,181 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_timestamp(
return _add_bundle_data(shared_data, TIME_KEY, num_str);
}
+extern "C" EXPORT_API int watchface_complication_provider_timeinfo_create(
+ complication_time_info_h *info) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ complication_time_info_h h = (complication_time_info_h)calloc(1, sizeof(struct complication_time_info_s));
+ if (h == nullptr) {
+ LOGE("Out of memory");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ *info = h;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_provider_timeinfo_set_timezone(
+ complication_time_info_h info, const char *timezone) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || timezone == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ struct complication_time_info_s* info_s = (struct complication_time_info_s*)info;
+ char *dup_timezone = strdup(timezone);
+ if (dup_timezone == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ if (info_s->timezone)
+ free(info_s->timezone);
+ info_s->timezone = dup_timezone;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_provider_timeinfo_set_timezone_id(
+ complication_time_info_h info, const char *timezone_id) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || timezone_id == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ struct complication_time_info_s* info_s = (struct complication_time_info_s*)info;
+ char *dup_timezone_id = strdup(timezone_id);
+ if (dup_timezone_id == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ if (info_s->timezone_id)
+ free(info_s->timezone_id);
+ info_s->timezone_id = dup_timezone_id;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int
+watchface_complication_provider_timeinfo_set_timezone_country(complication_time_info_h info,
+ const char *country) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || country == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ struct complication_time_info_s* info_s = (struct complication_time_info_s*)info;
+ char *dup_country = strdup(country);
+ if (dup_country == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ if (info_s->country)
+ free(info_s->country);
+ info_s->country = dup_country;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int
+watchface_complication_provider_timeinfo_set_timezone_city(complication_time_info_h info,
+ const char *city) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || city == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ struct complication_time_info_s* info_s = (struct complication_time_info_s*)info;
+ char *dup_city = strdup(city);
+ if (dup_city == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ if (info_s->city)
+ free(info_s->city);
+ info_s->city = dup_city;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_provider_timeinfo_destroy(
+ complication_time_info_h info) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ watchface_complication::util::DestroyTimeInfo((struct complication_time_info_s*)info);
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_provider_data_set_timeinfo(
+ bundle *shared_data, complication_time_info_h info) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (shared_data == nullptr || info == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ watchface_complication_type_e type;
+ int ret = _get_data_type(shared_data, &type);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+
+ if (type != WATCHFACE_COMPLICATION_TYPE_TIME) {
+ LOGE("Invalid type, not allowed for this type !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ struct complication_time_info_s* info_s = (struct complication_time_info_s*)info;
+ if (info_s->timezone) {
+ ret = _add_bundle_data(shared_data, TIME_ZONE_KEY, info_s->timezone);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ if (info_s->timezone_id) {
+ ret = _add_bundle_data(shared_data, TIME_ZONE_ID_KEY, info_s->timezone_id);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ if (info_s->country) {
+ ret = _add_bundle_data(shared_data, TIME_COUNTRY_KEY, info_s->country);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ if (info_s->city) {
+ ret = _add_bundle_data(shared_data, TIME_CITY_KEY, info_s->city);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ }
+
+ return ret;
+}
+
extern "C" EXPORT_API int watchface_complication_provider_data_set_image_path(
bundle* shared_data, const char* image_path) {
int ret;
@@ -506,7 +677,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_image_path(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || image_path == NULL) {
+ if (shared_data == nullptr || image_path == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -532,7 +703,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_ranged_value(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || min_value > max_value || current_value < min_value
+ if (shared_data == nullptr || min_value > max_value || current_value < min_value
|| current_value > max_value) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -572,7 +743,7 @@ extern "C" EXPORT_API int watchface_complication_provider_data_set_icon_path(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || icon_path == NULL) {
+ if (shared_data == nullptr || icon_path == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -597,7 +768,7 @@ int watchface_complication_provider_data_set_extra_data(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || extra_data == NULL) {
+ if (shared_data == nullptr || extra_data == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -611,7 +782,7 @@ int watchface_complication_provider_data_set_screen_reader_text(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || screen_reader_text == NULL) {
+ if (shared_data == nullptr || screen_reader_text == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -619,75 +790,41 @@ int watchface_complication_provider_data_set_screen_reader_text(
return _add_bundle_data(shared_data, SCREEN_READER_TEXT_KEY, screen_reader_text);
}
-static struct complication_mandatory_fields _mandatory_fields[] {
- {WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, {SHORT_TEXT_KEY, NULL, NULL}},
- {WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, {LONG_TEXT_KEY, NULL, NULL}},
- {WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE,
- {RANGE_CUR_KEY, RANGE_MAX_KEY, RANGE_MIN_KEY}},
- {WATCHFACE_COMPLICATION_TYPE_TIME, {TIME_KEY, NULL, NULL}},
- {WATCHFACE_COMPLICATION_TYPE_ICON, {ICON_KEY, NULL, NULL}},
- {WATCHFACE_COMPLICATION_TYPE_IMAGE, {IMAGE_KEY, NULL, NULL}}
-};
-
extern "C" EXPORT_API int watchface_complication_provider_data_is_valid(
- bundle* shared_data, bool*is_valid) {
- int ret;
- int type_count;
- watchface_complication_type_e type;
- char* value = NULL;
-
+ bundle* shared_data, bool* is_valid) {
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (shared_data == NULL || is_valid == NULL) {
+ if (shared_data == nullptr || is_valid == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- ret = _get_data_type(shared_data, &type);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
- return ret;
-
- type_count = sizeof(_mandatory_fields) /
- sizeof(struct complication_mandatory_fields);
-
- for (int i = 0; i < type_count; i++) {
- if (type == _mandatory_fields[i].type) {
- for (int idx = 0; idx < MAX_MANDATORY_FIELDS
- && _mandatory_fields[i].mandatory_fields[idx] != NULL; idx++) {
- ret = bundle_get_str(shared_data,
- _mandatory_fields[i].mandatory_fields[idx], &value);
- if (ret != BUNDLE_ERROR_NONE) {
- LOGE("Invalid data, missing field : %s",
- _mandatory_fields[i].mandatory_fields[idx]);
- *is_valid = false;
- return WATCHFACE_COMPLICATION_ERROR_NONE;
- }
- }
- *is_valid = true;
- return WATCHFACE_COMPLICATION_ERROR_NONE;
- }
+ try {
+ Bundle b(shared_data, false, false);
+ int result = util::GetDataType(b);
+ if (!util::CheckComplicationType(result))
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ *is_valid = util::IsValidData(b);
+ } catch (const std::exception &e) {
+ LOGE("Exception (%s)", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
}
static int _get_value_from_touch_launch_data(app_control_h handle,
const char* key, char** value) {
- bundle* data = NULL;
- char* bundle_str = NULL;
- char* bundle_val = NULL;
+ bundle* data = nullptr;
+ char* bundle_str = nullptr;
+ char* bundle_val = nullptr;
int ret;
ret = app_control_get_extra_data(handle, TOUCH_LAUNCH_DATA_KEY, &bundle_str);
- if (ret != APP_CONTROL_ERROR_NONE) {
- if (ret == APP_CONTROL_ERROR_OUT_OF_MEMORY) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
- LOGE("Fail to get data (%d)", ret);
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
+ ret = __convert_app_control_error(ret);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
data = bundle_decode(reinterpret_cast<const bundle_raw*>(bundle_str),
strlen(bundle_str));
@@ -705,7 +842,7 @@ static int _get_value_from_touch_launch_data(app_control_h handle,
}
*value = strdup(bundle_val);
- if (*value == NULL) {
+ if (*value == nullptr) {
LOGE("Out of memory");
bundle_free(data);
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
@@ -719,13 +856,13 @@ static int _get_value_from_touch_launch_data(app_control_h handle,
extern "C" EXPORT_API int watchface_complication_provider_event_get_type(
app_control_h handle, watchface_complication_event_type_e* event_type) {
int ret;
- char* value = NULL;
+ char* value = nullptr;
bundle* data;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || event_type == NULL) {
+ if (handle == nullptr || event_type == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -755,7 +892,7 @@ extern "C" EXPORT_API int watchface_complication_provider_event_get_type(
}
*event_type = static_cast<watchface_complication_event_type_e>(
- strtol(value, NULL, 10));
+ strtol(value, nullptr, 10));
free(value);
return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -765,12 +902,12 @@ extern "C" EXPORT_API
int watchface_complication_provider_event_get_provider_id(
app_control_h handle, char** provider_id) {
int ret;
- char* value = NULL;
+ char* value = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || provider_id == NULL) {
+ if (handle == nullptr || provider_id == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -789,12 +926,12 @@ extern "C" EXPORT_API
int watchface_complication_provider_event_get_complication_type(
app_control_h handle, watchface_complication_type_e* type) {
int ret;
- char* value = NULL;
+ char* value = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || type == NULL) {
+ if (handle == nullptr || type == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -804,7 +941,7 @@ int watchface_complication_provider_event_get_complication_type(
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
- int comp_type = strtol(value, NULL, 10);
+ int comp_type = strtol(value, nullptr, 10);
if (!util::CheckComplicationType(comp_type)) {
LOGE("Invalid param");
free(value);
@@ -820,13 +957,13 @@ extern "C" EXPORT_API
int watchface_complication_provider_event_get_context(
app_control_h handle, bundle** context) {
int ret;
- char* value = NULL;
- bundle* ctx_data = NULL;
+ char* value = nullptr;
+ bundle* ctx_data = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || context == NULL) {
+ if (handle == nullptr || context == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -839,7 +976,7 @@ int watchface_complication_provider_event_get_context(
ctx_data = bundle_decode(reinterpret_cast<const bundle_raw*>(value),
strlen(value));
free(value);
- if (ctx_data == NULL) {
+ if (ctx_data == nullptr) {
LOGE("Cannot convert value to bundle !!");
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
diff --git a/watchface-complication/CMakeLists.txt b/watchface-complication/CMakeLists.txt
index ecd184f..15e1603 100644
--- a/watchface-complication/CMakeLists.txt
+++ b/watchface-complication/CMakeLists.txt
@@ -24,6 +24,7 @@ pkg_check_modules(watchface-complication REQUIRED
pkgmgr
pkgmgr-info
capi-system-info
+ capi-base-utils-i18n
)
FOREACH(flag ${watchface-complication_CFLAGS})
diff --git a/watchface-complication/complication-bundle.cc b/watchface-complication/complication-bundle.cc
deleted file mode 100644
index 58033b8..0000000
--- a/watchface-complication/complication-bundle.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <dlog.h>
-
-#include "watchface-complication/complication-bundle.h"
-#include "watchface-common/watchface-exception.h"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "WATCHFACE_COMPLICATION"
-using std::string;
-namespace watchface_complication {
-
-Bundle::Bundle() {
- LOGE("create bundle !!");
- raw_ = bundle_create();
- if (raw_ == NULL)
- THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
-}
-
-Bundle::Bundle(std::string raw) {
- if (!raw.empty()) {
- raw_ = bundle_decode(reinterpret_cast<const bundle_raw*>(raw.c_str()),
- raw.length());
- if (raw_ == NULL) {
- int ret = get_last_result();
- if (ret == BUNDLE_ERROR_OUT_OF_MEMORY)
- THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
- else
- THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
- }
- } else {
- raw_ = bundle_create();
- if (raw_ == NULL)
- THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
- }
-}
-
-Bundle::Bundle(bundle* raw) {
- raw_ = bundle_dup(raw);
- if (raw_ == NULL)
- THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
-}
-
-Bundle::Bundle(Bundle&& b) : raw_(b.raw_) {
- b.raw_ = nullptr;
-}
-
-Bundle& Bundle::operator = (Bundle&& b) {
- raw_ = b.raw_;
- b.raw_ = nullptr;
- return *this;
-}
-
-Bundle::Bundle(const Bundle& b) : raw_(bundle_dup(b.raw_)) {}
-Bundle& Bundle::operator = (const Bundle& b) {
- raw_ = bundle_dup(b.raw_);
- if (raw_ == NULL)
- THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
- return *this;
-}
-
-const bundle* Bundle::GetConstRaw() const {
- return raw_;
-}
-
-bundle* Bundle::GetRaw() {
- return raw_;
-}
-
-const char* Bundle::ToString() {
- int str_len = 0;
- bundle_raw* temp;
-
- if (str_raw_ != NULL)
- return str_raw_;
-
- if (bundle_encode(raw_, &temp, &str_len) != BUNDLE_ERROR_NONE)
- THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
-
- str_raw_ = reinterpret_cast<char*>(temp);
- return str_raw_;
-}
-
-Bundle::~Bundle() {
- bundle_free(raw_);
- free(str_raw_);
- str_raw_ = NULL;
- raw_ = NULL;
-}
-
-} // namespace watchface_complication
diff --git a/watchface-complication/complication-bundle.h b/watchface-complication/complication-bundle.h
deleted file mode 100644
index de6f049..0000000
--- a/watchface-complication/complication-bundle.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef WATCHFACE_COMPLICATION_COMPLICATION_BUNDLE_H_
-#define WATCHFACE_COMPLICATION_COMPLICATION_BUNDLE_H_
-
-#include <bundle.h>
-
-#include <watchface-common.h>
-
-#include <string>
-
-namespace watchface_complication {
-
-class EXPORT_API Bundle {
- public:
- Bundle();
- explicit Bundle(std::string raw);
- explicit Bundle(bundle* raw);
- ~Bundle();
- Bundle(const Bundle&);
- Bundle& operator=(const Bundle&);
-
- Bundle(Bundle && other);
- Bundle& operator=(Bundle && other);
-
- const bundle* GetConstRaw() const;
- bundle* GetRaw();
- const char* ToString();
- private:
- bundle* raw_ = NULL;
- char* str_raw_ = NULL;
-};
-
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_COMPLICATION_BUNDLE_H_
diff --git a/watchface-complication/complication-connector-implementation.h b/watchface-complication/complication-connector-implementation.h
index 1890375..29e1bd0 100644
--- a/watchface-complication/complication-connector-implementation.h
+++ b/watchface-complication/complication-connector-implementation.h
@@ -48,10 +48,9 @@ class ComplicationConnector::Impl {
private:
friend class ComplicationConnector;
Impl();
- /* LCOV_EXCL_START */
static int PackageAppinfoCallback(const pkgmgrinfo_appinfo_h handle,
void* user_data) {
- char* appid = NULL;
+ char* appid = nullptr;
int ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
if (ret < 0) {
LOGE("Failed to get appid");
@@ -69,7 +68,6 @@ class ComplicationConnector::Impl {
LOGE("filter create failed [%d]", ret);
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
-
ret = pkgmgrinfo_appinfo_filter_add_string(handle,
PMINFO_APPINFO_PROP_APP_PACKAGE, pkgname);
if (ret != PMINFO_R_OK) {
@@ -77,15 +75,13 @@ class ComplicationConnector::Impl {
pkgmgrinfo_appinfo_filter_destroy(handle);
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
-
ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle,
- PackageAppinfoCallback, NULL);
+ PackageAppinfoCallback, nullptr);
if (ret != PMINFO_R_OK) {
LOGE("foreach failed [%d]", ret);
pkgmgrinfo_appinfo_filter_destroy(handle);
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
-
pkgmgrinfo_appinfo_filter_destroy(handle);
return 0;
}
@@ -123,11 +119,10 @@ class ComplicationConnector::Impl {
return 0;
}
- /* LCOV_EXCL_STOP */
private:
- GDBusConnection* conn_ = NULL;
- pkgmgr_client* pkgmgr_client_ = NULL;
+ GDBusConnection* conn_ = nullptr;
+ pkgmgr_client* pkgmgr_client_ = nullptr;
std::string appid_;
private:
diff --git a/watchface-complication/complication-connector.cc b/watchface-complication/complication-connector.cc
index e434bda..24822d4 100644
--- a/watchface-complication/complication-connector.cc
+++ b/watchface-complication/complication-connector.cc
@@ -21,11 +21,11 @@
#include <package-manager.h>
#include <pkgmgr-info.h>
+#include <list>
+
#include "watchface-complication/complication-connector.h"
#include "watchface-complication/complication-connector-implementation.h"
#include "watchface-common/watchface-exception.h"
-#include "watchface-complication/gdbus-mock.h"
-#include "watchface-complication/package-manager-mock.h"
#include "watchface-complication/package-manager.h"
#include "watchface-complication/gdbus.h"
@@ -43,10 +43,10 @@ std::list<IPackageManager::IPackageEvent*> ComplicationConnector::Impl::package_
std::list<std::string> ComplicationConnector::Impl::package_app_list_;
std::string ComplicationConnector::Impl::current_pkg_event_;
-ComplicationConnector& ComplicationConnector::GetInst(bool mock) {
+ComplicationConnector& ComplicationConnector::GetInst() {
static ComplicationConnector w_inst;
int ret;
- if (w_inst.impl_ == nullptr && !mock) {
+ if (w_inst.impl_ == nullptr) {
ret = w_inst.Init();
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
THROW(ret);
@@ -61,7 +61,7 @@ ComplicationConnector::Impl::Impl() = default;
bool ComplicationConnector::EmitSignal(IGDBus::SigType type,
std::string target_id, std::string id, int sub_id, std::string cmd,
GVariant* data) {
- GError* err = NULL;
+ GError* err = nullptr;
gboolean result = TRUE;
std::string path = util::EncodeStr(
type == IGDBus::Complication ?
@@ -71,16 +71,16 @@ bool ComplicationConnector::EmitSignal(IGDBus::SigType type,
LOGI("emit : %s, %s, %d, %s", target_id.c_str(), id.c_str(), sub_id,
cmd.c_str());
- LOGI("emit signal %s, %s", name.empty() ? NULL : name.c_str(), path.c_str());
+ LOGI("emit signal %s, %s", name.empty() ? nullptr : name.c_str(), path.c_str());
result = g_dbus_connection_emit_signal(
impl_->conn_,
- name.empty() ? NULL : name.c_str(),
+ name.empty() ? nullptr : name.c_str(),
path.c_str(),
COMPLICATION_INTERFACE,
cmd.c_str(), data, &err);
if (result == FALSE) {
LOGE("g_dbus_connection_emit_signal() is failed");
- if (err != NULL) {
+ if (err != nullptr) {
LOGE("g_dbus_connection_emit_signal() err : %s",
err->message);
g_error_free(err);
@@ -92,30 +92,27 @@ bool ComplicationConnector::EmitSignal(IGDBus::SigType type,
return result;
}
-IGDBus* ComplicationConnector::CreateGDBus(bool mock) {
- return mock ?
- static_cast<IGDBus*>(new test::GDBusMock()) :
- static_cast<IGDBus*>(new GDBus(impl_->conn_));
+IGDBus* ComplicationConnector::CreateGDBus() {
+ return static_cast<IGDBus*>(new GDBus(impl_->conn_));
}
-IPackageManager* ComplicationConnector::CreatePackageManager(bool mock) {
- return mock ?
- static_cast<IPackageManager*>(new test::PackageManagerMock()) :
- static_cast<IPackageManager*>(new PackageManager());
+IPackageManager* ComplicationConnector::CreatePackageManager() {
+ return static_cast<IPackageManager*>(new PackageManager());
}
void ComplicationConnector::WatchPackageEvent(IPackageManager::IPackageEvent* pe) {
- if (impl_->pkgmgr_client_ == NULL) {
+ if (impl_->pkgmgr_client_ == nullptr) {
impl_->pkgmgr_client_ = pkgmgr_client_new(PC_LISTENING);
- if (impl_->pkgmgr_client_ == NULL) {
+ if (impl_->pkgmgr_client_ == nullptr) {
LOGE("fail to create pkgmgr client");
return;
}
if (pkgmgr_client_listen_status(impl_->pkgmgr_client_ ,
- impl_->PkgmgrPackageStatusCb, NULL) <= 0) {
+ impl_->PkgmgrPackageStatusCb, nullptr) <= 0) {
LOGE("fail to listen pkg status");
pkgmgr_client_free(impl_->pkgmgr_client_);
+ impl_->pkgmgr_client_ = nullptr;
return;
}
LOGI("listen pkg status");
@@ -127,12 +124,12 @@ void ComplicationConnector::UnWatchPackageEvent(IPackageManager::IPackageEvent*
impl_->package_listener_list_.remove(pe);
if (impl_->package_listener_list_.size() == 0) {
pkgmgr_client_free(impl_->pkgmgr_client_);
- impl_->pkgmgr_client_ = NULL;
+ impl_->pkgmgr_client_ = nullptr;
}
}
int ComplicationConnector::Init() {
- GError* error = NULL;
+ GError* error = nullptr;
std::string encoded_name;
int owner_id;
std::unique_ptr<Impl> tmp_impl;
@@ -144,9 +141,9 @@ int ComplicationConnector::Init() {
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
- tmp_impl->conn_ = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
- if (tmp_impl->conn_ == NULL) {
- if (error != NULL) {
+ tmp_impl->conn_ = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, &error);
+ if (tmp_impl->conn_ == nullptr) {
+ if (error != nullptr) {
LOGE("Failed to get dbus [%s]", error->message);
g_error_free(error);
}
@@ -154,7 +151,7 @@ int ComplicationConnector::Init() {
}
tmp_impl->pkgmgr_client_ = pkgmgr_client_new(PC_LISTENING);
- if (tmp_impl->pkgmgr_client_ == NULL) {
+ if (tmp_impl->pkgmgr_client_ == nullptr) {
LOGE("fail to create pkgmgr client");
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
@@ -169,7 +166,7 @@ int ComplicationConnector::Init() {
LOGI("own name %s", encoded_name.c_str());
owner_id = g_bus_own_name_on_connection(tmp_impl->conn_, encoded_name.c_str(),
G_BUS_NAME_OWNER_FLAGS_NONE,
- NULL, NULL, NULL, NULL);
+ nullptr, nullptr, nullptr, nullptr);
if (!owner_id) {
g_object_unref(tmp_impl->conn_);
LOGE("g_bus_own_name_on_connection, error");
diff --git a/watchface-complication/complication-connector.h b/watchface-complication/complication-connector.h
index c8dbbf1..9716ff0 100644
--- a/watchface-complication/complication-connector.h
+++ b/watchface-complication/complication-connector.h
@@ -30,9 +30,9 @@ namespace watchface_complication {
class EXPORT_API ComplicationConnector {
public:
- static ComplicationConnector& GetInst(bool mock = false);
- IGDBus* CreateGDBus(bool mock);
- IPackageManager* CreatePackageManager(bool mock);
+ static ComplicationConnector& GetInst();
+ IGDBus* CreateGDBus();
+ IPackageManager* CreatePackageManager();
bool EmitSignal(IGDBus::SigType type, std::string target_id, std::string id,
int sub_id, std::string cmd, GVariant* data);
void WatchPackageEvent(IPackageManager::IPackageEvent* pe);
diff --git a/watchface-complication/complication-event-interface.h b/watchface-complication/complication-event-interface.h
index 8376d3c..4a4d7e5 100644
--- a/watchface-complication/complication-event-interface.h
+++ b/watchface-complication/complication-event-interface.h
@@ -17,10 +17,11 @@
#ifndef WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
#define WATCHFACE_COMPLICATION_COMPLICATION_EVENT_INTERFACE_H_
+#include <bundle_cpp.h>
+
#include <string>
#include "watchface-complication/include/watchface-complication-internal.h"
-#include "watchface-complication/complication-bundle.h"
namespace watchface_complication {
@@ -28,8 +29,8 @@ class EXPORT_API IComplicationEvent {
public:
virtual void OnDataUpdateRequest(const std::string& sender_appid,
ComplicationType type,
- const Bundle* context,
- Bundle* shared_data) = 0;
+ const tizen_base::Bundle& context,
+ tizen_base::Bundle* shared_data) = 0;
};
} // namespace watchface_complication
diff --git a/watchface-complication/complication-implementation.h b/watchface-complication/complication-implementation.h
index 16f755f..f04b5c8 100644
--- a/watchface-complication/complication-implementation.h
+++ b/watchface-complication/complication-implementation.h
@@ -19,6 +19,7 @@
#include <gio/gio.h>
#include <dlog.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -56,11 +57,11 @@ class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
Impl(Complication* parent, int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
- ComplicationType default_type, bool mock);
+ ComplicationType default_type);
void RestoreStateOrSetDefault();
int StoreSetting(int comp_id, std::string& provider_id,
ComplicationType type);
- std::unique_ptr<Bundle> LoadSetting();
+ std::unique_ptr<tizen_base::Bundle> LoadSetting();
int AddCandidate(std::string provider_id, int type);
int AddCandidates(std::string provider_id, int types);
int AddCandidates(int types);
@@ -83,6 +84,7 @@ class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
const std::string& sender_name);
void UpdatedProcess(GVariant* parameters);
void NotifyDataUpdateProcess(GVariant* parameters);
+ void ProviderReadyProcess(GVariant* parameters);
int UpdateCurProvider(std::string new_provider_id, ComplicationType type);
private:
@@ -100,13 +102,13 @@ class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
ComplicationType cur_type_;
std::string last_provider_id_;
ComplicationType last_type_ = NoData;
- std::list<std::unique_ptr<Bundle>> candidates_list_;
+ std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
std::list<std::unique_ptr<ProviderInfo>> allowed_list_;
std::list<std::string> privilege_list_;
int cur_data_idx_ = -1;
- std::unique_ptr<Bundle> context_data_ = nullptr;
- std::unique_ptr<Bundle> last_context_data_ = nullptr;
- std::unique_ptr<Bundle> last_data_ = nullptr;
+ std::unique_ptr<tizen_base::Bundle> context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_data_;
int last_data_idx_ = -1;
std::string name_;
int subscribe_id_ = -1;
@@ -118,8 +120,9 @@ class Complication::Impl : IGDBus::IGDBusEvent, IPackageManager::IPackageEvent {
static std::list<int> complication_id_list_;
IEditable::EditableState ed_state_ = Complete;
guint periodic_timer_ = 0;
- std::unique_ptr<IGDBus> gdbus_ = nullptr;
- std::unique_ptr<IPackageManager> package_ = nullptr;
+ std::unique_ptr<IGDBus> gdbus_;
+ std::unique_ptr<IPackageManager> package_;
+ EditablesManager& editables_manager_;
bool mock_ = false;
};
diff --git a/watchface-complication/complication.cc b/watchface-complication/complication.cc
index 5a4bcf5..2eb5eb5 100644
--- a/watchface-complication/complication.cc
+++ b/watchface-complication/complication.cc
@@ -28,6 +28,8 @@
#include "watchface-common/watchface-common-internal.h"
#include "watchface-complication/include/watchface-complication-internal.h"
+#include <iostream>
+
#ifdef LOG_TAG
#undef LOG_TAG
#endif
@@ -36,6 +38,8 @@
#define MAX_PACKAGE_STR_SIZE 512
#define QUERY_MAXLEN 4096
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
std::list<int> Complication::Impl::complication_id_list_;
const std::string Complication::Impl::provider_id_key_ = "__PROVIDER_ID_KEY__";
@@ -44,49 +48,33 @@ const std::string Complication::Impl::supported_events_error_key_ = "__SUPPORTED
const std::string Complication::Impl::privilege_error_key_ = "__PRIVILEGE_ERROR_KEY__";
Complication::Complication(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
- ComplicationType default_type, bool mock)
+ ComplicationType default_type)
: impl_(new Impl(this, id, supported_types, supported_event_types,
- default_provider_id, default_type, mock)) {
-}
-
-Complication::~Complication() {
+ default_provider_id, default_type)) {
}
+Complication::~Complication() = default;
int Complication::Impl::LoadCurProviderFromPrev() {
- char* prev_provider_id = NULL;
- char* prev_provider_type = NULL;
- std::string prev_provider_id_str;
- std::unique_ptr<Bundle> setting_data;
-
- try {
- setting_data = EditablesManager::GetInst(mock_).LoadSetting(complication_id_);
- } catch (watchface_complication::Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
- }
-
+ string prev_provider_type;
+ string prev_provider_id;
+ unique_ptr<Bundle> setting_data =
+ editables_manager_.LoadSetting(complication_id_);
if (setting_data == nullptr) {
LOGW("no prev setting info");
return WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE;
}
- bundle_get_str(setting_data.get()->GetRaw(), provider_id_key_.c_str(),
- &prev_provider_id);
- bundle_get_str(setting_data.get()->GetRaw(), provider_type_key_.c_str(),
- &prev_provider_type);
-
- if (prev_provider_id == NULL) {
+ prev_provider_id = setting_data->GetString(provider_id_key_);
+ prev_provider_type = setting_data->GetString(provider_type_key_);
+ if (prev_provider_id.empty()) {
LOGW("No prev provider id");
return WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE;
}
- if (prev_provider_id)
- prev_provider_id_str = std::string(prev_provider_id);
-
- LOGI("get setting from bundle %s, %s", prev_provider_id, prev_provider_type);
-
- int ret = UpdateCurProvider(prev_provider_id_str, static_cast<ComplicationType>(
- strtol((const char*)prev_provider_type, NULL, 10)));
+ LOGI("get setting from bundle %s, %s",
+ prev_provider_id.c_str(), prev_provider_type.c_str());
+ int ret = UpdateCurProvider(prev_provider_id, static_cast<ComplicationType>(
+ stoi(prev_provider_type)));
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
@@ -116,7 +104,6 @@ int Complication::Init() {
ret = impl_->LoadPeriod();
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
-
impl_->package_.get()->Watch(impl_.get());
impl_->default_provider_appid_ =
@@ -133,15 +120,17 @@ Complication::Impl::Impl(Complication* parent, int id,
int supported_types,
int supported_event_types,
const std::string& default_provider_id,
- ComplicationType default_type, bool mock)
+ ComplicationType default_type)
: parent_(parent), complication_id_(id), supported_types_(supported_types),
supported_event_types_(supported_event_types | 1),
default_provider_id_(default_provider_id),
default_type_(default_type),
cur_type_(default_type),
- gdbus_(std::unique_ptr<IGDBus>(ComplicationConnector::GetInst(mock).CreateGDBus(mock))),
- package_(std::unique_ptr<IPackageManager>(ComplicationConnector::GetInst(mock).CreatePackageManager(mock))),
- mock_(mock) {
+ gdbus_(std::unique_ptr<IGDBus>(
+ ComplicationConnector::GetInst().CreateGDBus())),
+ package_(std::unique_ptr<IPackageManager>(
+ ComplicationConnector::GetInst().CreatePackageManager())),
+ editables_manager_(EditablesManager::GetInst()) {
for (auto& i : complication_id_list_) {
if (i == complication_id_) {
LOGE("Exist complication id (%d)", complication_id_);
@@ -175,7 +164,6 @@ void Complication::Impl::OnVanish(const std::string& name) {
void Complication::Impl::OnAppear(const std::string& name,
const std::string& name_owner) {
LOGI("OnAppear %s ", name.c_str());
- parent_->SendDataUpdateRequest(false);
}
bool Complication::Impl::IsValidSender(GDBusConnection* connection,
@@ -203,7 +191,7 @@ void Complication::Impl::UpdatedProcess(GVariant* parameters) {
char* provider_id;
int type;
int complication_id;
- bundle_raw* raw = NULL;
+ bundle_raw* raw = nullptr;
g_variant_get(parameters, "(&sii&s)", &provider_id, &type,
&complication_id, &raw);
@@ -215,17 +203,20 @@ void Complication::Impl::UpdatedProcess(GVariant* parameters) {
return;
}
- if (raw != NULL) {
- try {
- last_data_.reset(new Bundle(std::string(reinterpret_cast<char*>(raw))));
- LOGI("data: %s, %d, cur_type :%d",
- provider_id, complication_id, cur_type_);
- parent_->OnDataUpdated(std::string(provider_id), cur_type_, last_data_);
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return;
- }
+ if (strlen(reinterpret_cast<char*>(raw)) == 0) {
+ LOGW("Empty data !!");
+ return;
}
+
+ try {
+ last_data_.reset(new Bundle(string(reinterpret_cast<char*>(raw))));
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return;
+ }
+
+ LOGI("data: %s, %d, cur_type :%d", provider_id, complication_id, cur_type_);
+ parent_->OnDataUpdated(std::string(provider_id), cur_type_, last_data_);
}
void Complication::Impl::NotifyDataUpdateProcess(GVariant* parameters) {
@@ -238,6 +229,16 @@ void Complication::Impl::NotifyDataUpdateProcess(GVariant* parameters) {
parent_->OnNotifyDataUpdate();
}
+void Complication::Impl::ProviderReadyProcess(GVariant* parameters) {
+ char* provider_id;
+ g_variant_get(parameters, "(&s)", &provider_id);
+ if (strcmp(cur_provider_id_.c_str(), provider_id) != 0) {
+ LOGI("It's not mine %s", provider_id);
+ return;
+ }
+ parent_->SendDataUpdateRequest(false);
+}
+
void Complication::Impl::OnSignal(GDBusConnection* connection,
const std::string& sender_name,
const std::string& object_path,
@@ -254,53 +255,42 @@ void Complication::Impl::OnSignal(GDBusConnection* connection,
} else if (signal_name.compare(
util::GetCmdStr(util::CompNotifyDataUpdate)) == 0) {
NotifyDataUpdateProcess(parameters);
+ } else if (signal_name.compare(
+ util::GetCmdStr(util::ProviderReady)) == 0) {
+ ProviderReadyProcess(parameters);
}
}
int Complication::Impl::StoreSetting(int comp_id, std::string& provider_id,
ComplicationType type) {
- bundle* setting_data;
- bundle_raw* raw_data = NULL;
- int raw_len;
- int ret;
- char buf[32];
-
if (provider_id.empty() && type != NoData)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ try {
+ Bundle setting_data;
+ int ret = setting_data.Add(provider_id_key_, provider_id);
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- setting_data = bundle_create();
- if (setting_data == NULL) {
- LOGE("bundle_create failed");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
-
- snprintf(buf, sizeof(buf), "%d", static_cast<int>(type));
- bundle_add_str(setting_data, provider_id_key_.c_str(), provider_id.c_str());
- bundle_add_str(setting_data, provider_type_key_.c_str(), buf);
- bundle_encode(setting_data, &raw_data, &raw_len);
- bundle_free(setting_data);
+ ret = setting_data.Add(provider_type_key_, to_string(type));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- try {
- ret = EditablesManager::GetInst(mock_).StoreSetting(comp_id, raw_data);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
- free(raw_data);
+ ret = editables_manager_.StoreSetting(
+ comp_id, setting_data.ToRaw().first.get());
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
- }
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- free(raw_data);
- return ex.GetErrorCode();
+ } catch(const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
-
- free(raw_data);
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-int Complication::GetComplicationId() {
+int Complication::GetComplicationId() const {
return impl_->complication_id_;
}
-int Complication::GetEditableId() {
+int Complication::GetEditableId() const {
return impl_->editable_id_;
}
@@ -314,7 +304,7 @@ int Complication::SetHighlight(std::unique_ptr<IEditable::Highlight> highlight)
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-IEditable::Highlight* Complication::GetHighlight() {
+IEditable::Highlight* Complication::GetHighlight() const {
return impl_->highlight_.get();
}
@@ -322,47 +312,45 @@ IEditable::Highlight* Complication::GetHighlight() {
Complication make candidates automatically, so we don't need it
*/
int Complication::SetCandidates(
- std::list<std::unique_ptr<Bundle>> candidates_list) {
+ std::list<std::shared_ptr<Bundle>> candidates_list) {
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-std::list<std::unique_ptr<Bundle>> const& Complication::GetCandidates() const {
+std::list<std::shared_ptr<Bundle>> const& Complication::GetCandidates() const {
return impl_->candidates_list_;
}
-const Bundle* Complication::GetCurData() {
+shared_ptr<Bundle> Complication::GetCurData() const {
if (static_cast<int>(impl_->candidates_list_.size()) < impl_->cur_data_idx_ + 1
|| impl_->cur_data_idx_ < 0) {
LOGE("No candidates");
- return NULL;
+ return shared_ptr<Bundle>({});
}
- std::list<std::unique_ptr<Bundle>>::iterator it
+ std::list<std::shared_ptr<Bundle>>::iterator it
= impl_->candidates_list_.begin();
LOGI("get cur data idx(%d), list_size(%zu)", impl_->cur_data_idx_,
impl_->candidates_list_.size());
- auto nx = std::next(it, impl_->cur_data_idx_);
- return nx->get();
+ return *std::next(it, impl_->cur_data_idx_);
}
-const Bundle* Complication::GetNthData(int nth) {
+shared_ptr<Bundle> Complication::GetNthData(int nth) const {
if (static_cast<int>(impl_->candidates_list_.size()) <= nth || nth < 0)
- return NULL;
+ return shared_ptr<Bundle>({});
- std::list<std::unique_ptr<Bundle>>::iterator it
+ std::list<std::shared_ptr<Bundle>>::iterator it
= impl_->candidates_list_.begin();
LOGI("get nth data %d", nth);
- auto nx = std::next(it, nth);
- return nx->get();
+ return *std::next(it, nth);
}
-int Complication::GetCurDataIdx() {
+int Complication::GetCurDataIdx() const {
return impl_->cur_data_idx_;
}
-int Complication::GetLastDataIdx() {
+int Complication::GetLastDataIdx() const {
return impl_->last_data_idx_;
}
@@ -370,7 +358,7 @@ int Complication::Impl::DeleteAppContext(const char* appid) {
int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
std::list<std::string> list = DBManager::GetProviderListWithAppId(appid);
for (std::string& info : list) {
- ret = EditablesManager::GetInst(mock_).DeleteContext(editable_id_, info.c_str());
+ ret = editables_manager_.DeleteContext(editable_id_, info.c_str());
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
LOGE("delete editable context fail %d", ret);
return ret;
@@ -544,10 +532,7 @@ int Complication::UpdateLastData() {
}
int Complication::SetCurDataIdx(int cur_data_idx) {
- char* provider_id = NULL;
- char* type = NULL;
int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
-
if (impl_->cur_data_idx_ == cur_data_idx) {
LOGI("Same with cur data idx skip setting process %d, %d",
impl_->cur_data_idx_, cur_data_idx);
@@ -561,22 +546,16 @@ int Complication::SetCurDataIdx(int cur_data_idx) {
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
} else {
- const Bundle* data = GetNthData(cur_data_idx);
- if (data == NULL) {
- LOGI("GetCurData failed");
- return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
- }
- bundle_get_str(const_cast<Bundle*>(data)->GetRaw(),
- impl_->provider_id_key_.c_str(), &provider_id);
- bundle_get_str(const_cast<Bundle*>(data)->GetRaw(),
- impl_->provider_type_key_.c_str(), &type);
+ shared_ptr<Bundle> data = GetNthData(cur_data_idx);
+ string provider_id = data->GetString(impl_->provider_id_key_);
+ string type = data->GetString(impl_->provider_type_key_);
- if (provider_id == NULL || type == NULL) {
+ if (provider_id.empty() || type.empty()) {
LOGI("GetCurData failed");
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
}
- ret = impl_->UpdateCurProvider(std::string(provider_id),
- static_cast<ComplicationType>(strtol(type, NULL, 10)));
+ ret = impl_->UpdateCurProvider(provider_id,
+ static_cast<ComplicationType>(stoi(type)));
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
impl_->cur_data_idx_ = cur_data_idx;
@@ -587,46 +566,28 @@ int Complication::SetCurDataIdx(int cur_data_idx) {
return impl_->UpdateProviderInfo();
}
-const char* Complication::GetCurProviderId() {
+string Complication::GetCurProviderId() const {
if (!impl_->cur_provider_id_.empty())
return impl_->cur_provider_id_.c_str();
-
- return NULL;
+ return "";
}
-const char* Complication::GetProviderId(const Bundle* candidate_data) {
- char* provider_id = NULL;
-
- if (candidate_data == NULL)
- return NULL;
-
- bundle_get_str(const_cast<Bundle*>(candidate_data)->GetRaw(),
- impl_->provider_id_key_.c_str(), &provider_id);
-
- return provider_id;
+string Complication::GetProviderId(const Bundle& candidate_data) const {
+ return candidate_data.GetString(impl_->provider_id_key_);
}
-int Complication::GetProviderType(const Bundle* candidate_data) {
- char* provider_type = NULL;
- int ret = 0;
-
- if (candidate_data == NULL)
- return ret;
-
- bundle_get_str(const_cast<Bundle*>(candidate_data)->GetRaw(),
- impl_->provider_type_key_.c_str(), &provider_type);
-
- if (provider_type)
- ret = strtol(provider_type, NULL, 10);
-
- return ret;
+int Complication::GetProviderType(const Bundle& candidate_data) const {
+ string type = candidate_data.GetString(impl_->provider_type_key_);
+ if (type.empty())
+ return 0;
+ return stoi(type);
}
-int Complication::GetCurType() {
+int Complication::GetCurType() const {
return static_cast<int>(impl_->cur_type_);
}
-const std::string& Complication::GetLabel() {
+const std::string& Complication::GetLabel() const {
return impl_->name_;
}
@@ -643,11 +604,9 @@ void Complication::OnEditableUpdated(int selected_idx,
if (state == OnGoing) {
LOGI("ongoing editing : %d", impl_->complication_id_);
std::unique_ptr<Bundle> ptr = nullptr;
- const char* provider_id = GetCurProviderId();
- std::string provider_id_str =
- provider_id == NULL ? "" : std::string(provider_id);
+ std::string provider_id_str = GetCurProviderId();
int type = GetCurType();
- ptr = DBManager::GetDefaultData(provider_id, type);
+ ptr = DBManager::GetDefaultData(provider_id_str.c_str(), type);
OnDataUpdated(provider_id_str, static_cast<ComplicationType>(type), ptr);
} else if (state == Complete) {
LOGI("complete editing : %d", impl_->complication_id_);
@@ -661,11 +620,11 @@ void Complication::OnEditableUpdated(int selected_idx,
}
}
+/* LCOV_EXCL_START */
void Complication::OnProviderError(const std::string& provider_id,
ComplicationType type, int error) {
}
-/* LCOV_EXCL_START */
void Complication::OnDataUpdated(const std::string& provider_id,
ComplicationType type,
const std::unique_ptr<Bundle>& data) {
@@ -715,33 +674,26 @@ int Complication::SendDataUpdateRequest(bool launch_option) {
return WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE;
}
- if (impl_->mock_) {
- std::unique_ptr<Bundle> ptr = nullptr;
- ptr = DBManager::GetDefaultData(impl_->cur_provider_id_.c_str(),
- static_cast<int>(impl_->cur_type_));
- OnDataUpdated(impl_->cur_provider_id_, impl_->cur_type_, ptr);
- return WATCHFACE_COMPLICATION_ERROR_NONE;
- }
-
if (launch_option) {
ret = aul_complication_update_request(
util::GetAppId().c_str(),
provider_appid.c_str(), getuid());
LOGI("Launch the provider app: %d, %s", ret, provider_appid.c_str());
+ ret = util::ConvertAulError(ret);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ }
- if (ret != AUL_R_OK) {
- if (ret == AUL_R_EILLACC)
- return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
- else if (ret == AUL_R_EINVAL)
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- else
- return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ if (impl_->context_data_ != nullptr) {
+ try {
+ context_data_raw = reinterpret_cast<const char*>(
+ impl_->context_data_->ToRaw().first.get());
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
}
- if (impl_->context_data_ != nullptr)
- context_data_raw = impl_->context_data_->ToString();
-
emit_ret = impl_->gdbus_.get()->EmitSignal(
IGDBus::SigType::Complication,
provider_appid,
@@ -753,8 +705,8 @@ int Complication::SendDataUpdateRequest(bool launch_option) {
impl_->complication_id_,
impl_->cur_type_,
context_data_raw));
- if (emit_ret == false)
- ret = WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ if (!emit_ret)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
LOGI("emit signal done");
return ret;
@@ -780,11 +732,11 @@ void Complication::SetState(IEditable::EditableState state) {
impl_->ed_state_ = state;
}
-IEditable::EditableState Complication::GetState() {
+IEditable::EditableState Complication::GetState() const {
return impl_->ed_state_;
}
-const std::string Complication::GetSetupAppId() {
+std::string Complication::GetSetupAppId() const {
return DBManager::GetSetupAppId(impl_->cur_provider_id_.c_str());
}
@@ -799,22 +751,23 @@ std::unique_ptr<Bundle>& Complication::GetContext() const {
}
int Complication::UpdateLastContext() {
- if (impl_->context_data_.get() == NULL) {
+ if (impl_->context_data_.get() == nullptr) {
LOGI("Empty context");
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
+ int ret = impl_->editables_manager_.StoreContext(
+ impl_->complication_id_, impl_->cur_provider_id_.c_str(),
+ impl_->context_data_.get());
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+
try {
- int ret = EditablesManager::GetInst(impl_->mock_).StoreContext(
- impl_->complication_id_, impl_->cur_provider_id_.c_str(),
- *impl_->context_data_.get());
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
- return ret;
- impl_->last_context_data_.reset(
- new Bundle((impl_->context_data_.get())->GetRaw()));
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
+ Bundle* new_ctx = new Bundle(impl_->context_data_->GetHandle());
+ impl_->last_context_data_.reset(new_ctx);
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -825,8 +778,6 @@ std::unique_ptr<Bundle>& Complication::GetLastContext() const {
}
int Complication::TouchLaunch(watchface_complication_event_type_e event_type) {
- const char* context_data_raw = NULL;
- int ret;
std::string provider_appid = DBManager::GetProviderAppId(
impl_->cur_provider_id_.c_str());
if (provider_appid.empty()) {
@@ -834,54 +785,38 @@ int Complication::TouchLaunch(watchface_complication_event_type_e event_type) {
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
- if (impl_->context_data_ != nullptr)
- context_data_raw = impl_->context_data_->ToString();
+ try {
+ Bundle launch_data;
+ int ret = launch_data.Add(TOUCH_LAUNCH_EVENT_KEY, to_string(event_type));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- bundle* launch_data = bundle_create();
- if (launch_data == NULL) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
+ ret = launch_data.Add(TOUCH_LAUNCH_PROVIDER_ID_KEY, impl_->cur_provider_id_);
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- char event_str[32] = {0,};
- snprintf(event_str, sizeof(event_str), "%d", event_type);
- bundle_add_str(launch_data, TOUCH_LAUNCH_EVENT_KEY, event_str);
+ ret = launch_data.Add(TOUCH_LAUNCH_TYPE_KEY, to_string(impl_->cur_type_));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- bundle_add_str(launch_data, TOUCH_LAUNCH_PROVIDER_ID_KEY,
- impl_->cur_provider_id_.c_str());
+ if (impl_->context_data_ != nullptr) {
+ ret = launch_data.Add(TOUCH_LAUNCH_CONTEXT_KEY,
+ reinterpret_cast<char*>(impl_->context_data_->ToRaw().first.get()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
- char type_str[32] = {0, };
- snprintf(type_str, sizeof(type_str), "%d", impl_->cur_type_);
- bundle_add_str(launch_data, TOUCH_LAUNCH_TYPE_KEY, type_str);
- if (context_data_raw != NULL)
- bundle_add_str(launch_data, TOUCH_LAUNCH_CONTEXT_KEY, context_data_raw);
-
- bundle_raw* raw_data = NULL;
- int raw_len;
- bundle_encode(launch_data, &raw_data, &raw_len);
- bundle_free(launch_data);
- if (raw_data == NULL) {
- LOGE("Fail to encode bundle");
- return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- }
+ ret = aul_complication_launch_with_extra_data(
+ util::GetAppId().c_str(),
+ provider_appid.c_str(), getuid(), TOUCH_LAUNCH_DATA_KEY,
+ reinterpret_cast<char*>(launch_data.ToRaw().first.get()));
- ret = aul_complication_launch_with_extra_data(
- util::GetAppId().c_str(),
- provider_appid.c_str(), getuid(), TOUCH_LAUNCH_DATA_KEY,
- reinterpret_cast<char*>(raw_data));
- free(raw_data);
-
- LOGI("Touch launch the %s : %d", provider_appid.c_str(), ret);
- if (ret != AUL_R_OK) {
- if (ret == AUL_R_EILLACC)
- return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
- else if (ret == AUL_R_EINVAL)
- return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- else
- return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ LOGI("Touch launch the %s : %d", provider_appid.c_str(), ret);
+ return util::ConvertAulError(ret);
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
-
- return WATCHFACE_COMPLICATION_ERROR_NONE;
}
bool Complication::Impl::CheckCachedPrivilege(std::string privilege) {
@@ -932,40 +867,40 @@ int Complication::Impl::GetNotSupportedEvents(
}
int Complication::Impl::AddCandidate(std::string provider_id, int type) {
- bundle* data = bundle_create();
- if (data == NULL)
+ unique_ptr<Bundle> data;
+ try {
+ data = unique_ptr<Bundle>(new Bundle());
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- bundle_add_str(data, provider_id_key_.c_str(), provider_id.c_str());
- bundle_add_str(data, provider_type_key_.c_str(),
- std::to_string(type).c_str());
+ }
+
+ int ret = data->Add(provider_id_key_, provider_id);
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ ret = data->Add(provider_type_key_, std::to_string(type));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
std::string error_msg = GetNotSupportedPrivileges(provider_id);
- if (!error_msg.empty())
- bundle_add_str(data, privilege_error_key_.c_str(), error_msg.c_str());
+ if (!error_msg.empty()) {
+ ret = data->Add(privilege_error_key_, error_msg);
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
int not_supported_events = GetNotSupportedEvents(provider_id);
if (not_supported_events > 0) {
- bundle_add_str(data, supported_events_error_key_.c_str(),
- std::to_string(not_supported_events).c_str());
+ ret = data->Add(supported_events_error_key_,
+ std::to_string(not_supported_events));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
} else if (not_supported_events < 0) {
LOGE("fail to get required events");
- bundle_free(data);
return WATCHFACE_COMPLICATION_ERROR_DB;
}
-
- try {
- candidates_list_.emplace_back(new Bundle(data));
- } catch (const std::bad_alloc &ba) {
- LOGE("Bundle::Exception bad_alloc");
- bundle_free(data);
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- bundle_free(data);
- return ex.GetErrorCode();
- }
- bundle_free(data);
-
+ candidates_list_.emplace_back(move(data));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -1028,13 +963,16 @@ int Complication::Impl::MakeCandidatesList() {
}
int Complication::Impl::LoadContext() {
- context_data_ = EditablesManager::GetInst(mock_).LoadContext(complication_id_,
+ context_data_ = editables_manager_.LoadContext(complication_id_,
cur_provider_id_.c_str());
+ if (context_data_ == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+
try {
- if (context_data_ != nullptr)
- last_context_data_.reset(new Bundle(context_data_.get()->GetRaw()));
- } catch (...) {
- LOGE("Out of memory");
+ Bundle* ctx = new Bundle(context_data_->GetHandle());
+ last_context_data_.reset(ctx);
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -1047,14 +985,11 @@ int Complication::Impl::UpdateCandidatesInfo() {
int idx = 0;
for (auto& i : candidates_list_) {
- char* temp_provider_id = NULL;
- char* temp_type = NULL;
Bundle& data = *(i.get());
- bundle_get_str(data.GetRaw(), provider_id_key_.c_str(), &temp_provider_id);
- bundle_get_str(data.GetRaw(), provider_type_key_.c_str(), &temp_type);
- if (temp_provider_id != NULL && temp_type != NULL) {
- if (strcmp(temp_provider_id, cur_provider_id_.c_str()) == 0
- && strtol(temp_type, NULL, 10) == cur_type_) {
+ string provider_id = data.GetString(provider_id_key_);
+ string type = data.GetString(provider_type_key_);
+ if (!provider_id.empty() && !type.empty()) {
+ if (provider_id == cur_provider_id_ && stoi(type) == cur_type_) {
cur_data_idx_ = idx;
LOGI("find cur idx %d", idx);
return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -1078,6 +1013,8 @@ int Complication::ApplyAllowedList(
*/
if (ret == WATCHFACE_COMPLICATION_ERROR_NOT_EXIST) {
impl_->cur_data_idx_ = -1;
+ impl_->cur_provider_appid_ = "";
+ impl_->cur_provider_id_ = "";
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
return ret;
diff --git a/watchface-complication/complication.h b/watchface-complication/complication.h
index 117e7bc..5708217 100644
--- a/watchface-complication/complication.h
+++ b/watchface-complication/complication.h
@@ -18,6 +18,7 @@
#define WATCHFACE_COMPLICATION_COMPLICATION_H_
#include <gio/gio.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -38,60 +39,65 @@ class EXPORT_API Complication : public IEditable
public:
Complication(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
- ComplicationType default_type, bool mock);
+ ComplicationType default_type);
virtual ~Complication();
public:
class ProviderInfo {
- std::string provider_id_;
- int types_;
public:
ProviderInfo(std::string provider_id, int types)
: provider_id_(provider_id), types_(types) {
}
- std::string& GetProviderId() {
+
+ const std::string& GetProviderId() const {
return provider_id_;
}
- int GetTypes() {
+
+ int GetTypes() const {
return types_;
}
+
+ private:
+ std::string provider_id_;
+ int types_;
};
+
int SetHighlight(std::unique_ptr<IEditable::Highlight> highlight) override;
- IEditable::Highlight* GetHighlight() override;
- std::list<std::unique_ptr<Bundle>> const& GetCandidates() const override;
- int SetCandidates(std::list<std::unique_ptr<Bundle>> candidates_list) override;
- const Bundle* GetCurData() override;
- const Bundle* GetNthData(int nth) override;
- int GetCurDataIdx() override;
+ IEditable::Highlight* GetHighlight() const override;
+ std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+ int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+ std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+ std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+ int GetCurDataIdx() const override;
int SetCurDataIdx(int cur_data_idx) override;
- int GetLastDataIdx() override;
+ int GetLastDataIdx() const override;
int UpdateLastData() override;
- const std::string& GetLabel() override;
+ const std::string& GetLabel() const override;
void OnEditableUpdated(int selected_idx,
IEditable::EditableState state) override;
void OnDataUpdated(const std::string& provider_id,
ComplicationType type,
- const std::unique_ptr<Bundle>& data) override;
+ const std::unique_ptr<tizen_base::Bundle>& data) override;
void OnProviderError(const std::string& provider_id, ComplicationType type,
int error) override;
void OnNotifyDataUpdate() override;
- int GetComplicationId();
- int GetEditableId() override;
+ int GetEditableId() const override;
int SetEditableId(int id) override;
void SetLabel(const std::string& name) override;
void SetState(IEditable::EditableState state) override;
- IEditable::EditableState GetState() override;
- int SetContext(std::unique_ptr<Bundle> context) override;
- std::unique_ptr<Bundle>& GetContext() const override;
+ IEditable::EditableState GetState() const override;
+ int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+ std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
int UpdateLastContext() override;
- std::unique_ptr<Bundle>& GetLastContext() const override;
- const std::string GetSetupAppId() override;
+ std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+ std::string GetSetupAppId() const override;
+ int GetComplicationId() const;
int SendDataUpdateRequest(bool launch_option = true);
- const char* GetCurProviderId();
- const char* GetProviderId(const Bundle* candidate_data);
- int GetProviderType(const Bundle* candidate_data);
- int GetCurType();
+ std::string GetCurProviderId() const;
+ std::string GetProviderId(const tizen_base::Bundle& candidate_data) const;
+ int GetProviderType(const tizen_base::Bundle& candidate_data) const;
+ int GetCurType() const;
int TouchLaunch(watchface_complication_event_type_e event_type);
int ApplyAllowedList(
std::list<std::unique_ptr<ProviderInfo>> allowed_list);
diff --git a/watchface-complication/db-manager.cc b/watchface-complication/db-manager.cc
index 66e833f..4ffdd57 100644
--- a/watchface-complication/db-manager.cc
+++ b/watchface-complication/db-manager.cc
@@ -31,366 +31,225 @@
#endif
#define LOG_TAG "WATCHFACE_COMPLICATION"
-
#define DEFAULT_LOCALE "No Locale"
-#define ROOT_USER 0
+using namespace tizen_base;
namespace watchface_complication {
DBManager::DBManager() = default;
DBManager::~DBManager() = default;
-sqlite3* DBManager::OpenDB() {
- int ret;
- const char* path;
- sqlite3* db = NULL;
-
- path = GetParserDataPath();
- if (path == NULL)
- return NULL;
-
- ret = sqlite3_open_v2(path, &db, SQLITE_OPEN_READONLY, NULL);
- if (ret != SQLITE_OK) {
- LOGE("open db(%s) error: %d", path, ret);
- return NULL;
- }
-
- return db;
-}
+std::unique_ptr<Bundle> DBManager::GetDefaultData(const char* provider_id,
+ int support_type) {
+ static const char query[] =
+ "SELECT trusted, appid, default_data FROM complication_provider as A "
+ "LEFT JOIN provider_support_types as B ON A.provider_id = B.provider_id "
+ "WHERE A.provider_id=? AND support_type=?";
-void DBManager::CloseDB(sqlite3* db) {
- int ret = SQLITE_OK;
+ util::DBHelper db;
- if (db)
- ret = sqlite3_close_v2(db);
+ if (!db.Open())
+ return nullptr;
- if (ret != SQLITE_OK)
- LOGE("close db error");
-}
+ if (!db.Prepare(query))
+ return nullptr;
-std::unique_ptr<Bundle> DBManager::GetDefaultData(const char* provider_id,
- int support_type) {
- std::unique_ptr<Bundle> default_data = nullptr;
- const char* raw_data;
- sqlite3_stmt* stmt;
- sqlite3* db;
- int trusted;
- std::string provider_app_id;
- int ret;
+ if (!db.Bind(1, provider_id))
+ return nullptr;
- static const char query[] =
- "SELECT trusted, appid, default_data FROM complication_provider "
- "WHERE provider_id=? AND support_type=?";
+ if (!db.Bind(2, support_type))
+ return nullptr;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (db.Step() != SQLITE_ROW)
return nullptr;
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ int trusted = db.GetInt(0);
+ const char* app_id = db.GetText(1);
+ if (app_id == nullptr) {
+ LOGE("app_id is nullptr");
return nullptr;
}
- ret = sqlite3_bind_text(stmt, 1, provider_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- goto out;
- }
+ std::string provider_app_id = app_id;
+ if (trusted && util::CheckCertificate(provider_app_id) == false)
+ return nullptr;
- ret = sqlite3_bind_int(stmt, 2, support_type);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- goto out;
+ const char* raw_data = db.GetText(2);
+ if (raw_data == nullptr) {
+ LOGE("raw_data is nullptr");
+ return nullptr;
}
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- trusted = sqlite3_column_int(stmt, 0);
- const char* app_id = reinterpret_cast<const char*>(
- sqlite3_column_text(stmt, 1));
- if (app_id == nullptr) {
- LOGE("app_id is nullptr");
- goto out;
- }
- provider_app_id = std::string(app_id);
- if (trusted &&
- util::CheckCertificate(provider_app_id) == false) {
- goto out;
- }
- raw_data = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 2));
- if (raw_data == nullptr) {
- LOGE("raw_data is nullptr");
- goto out;
- }
+ std::unique_ptr<Bundle> default_data;
+ try {
default_data = std::unique_ptr<Bundle>(new Bundle(std::string(raw_data)));
- util::ConvertPathToAppPath(provider_app_id.c_str(), default_data->GetRaw());
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return nullptr;
}
-out:
- sqlite3_finalize(stmt);
- CloseDB(db);
+ util::ConvertPathToAppPath(provider_app_id.c_str(),
+ default_data.get()->GetHandle());
- return std::move(default_data);
+ return default_data;
}
int DBManager::GetProviderPeriod(std::string& provider_id, int* period) {
- sqlite3_stmt* stmt = NULL;
- sqlite3* db;
- int ret;
-
static const char query[] =
"SELECT period FROM complication_provider WHERE provider_id=?";
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ util::DBHelper db;
+
+ if (!db.Open())
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(1, provider_id))
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
/* complication_provider table's default value of period is -1.
* So, if nothing specified in period, it will return -1
*/
- if (sqlite3_step(stmt) == SQLITE_ROW)
- *period = sqlite3_column_int(stmt, 0);
-
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (db.Step() == SQLITE_ROW)
+ *period = db.GetInt(0);
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
bool DBManager::IsProviderExist(std::string& provider_id, int support_type) {
- sqlite3_stmt* stmt = NULL;
- sqlite3* db;
- bool is_exist = false;
- int trusted;
- std::string provider_app_id;
- int ret;
-
static const char query[] =
- "SELECT trusted, appid FROM complication_provider "
- "WHERE provider_id=? AND support_type=?";
+ "SELECT trusted, appid FROM complication_provider as A "
+ "LEFT JOIN provider_support_types as B ON A.provider_id = B.provider_id "
+ "WHERE A.provider_id=? AND support_type=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return false;
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return false;
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(1, provider_id))
return false;
- }
- ret = sqlite3_bind_int(stmt, 2, support_type);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(2, support_type))
return false;
- }
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- trusted = sqlite3_column_int(stmt, 0);
- const char* app_id = reinterpret_cast<const char*>(
- sqlite3_column_text(stmt, 1));
+ bool is_exist = false;
+ if (db.Step() == SQLITE_ROW) {
+ int trusted;
+
+ trusted = db.GetInt(0);
+ const char* app_id = db.GetText(1);
if (app_id == nullptr) {
LOGE("app_id is nullptr");
- sqlite3_finalize(stmt);
- CloseDB(db);
return false;
}
- provider_app_id = std::string(app_id);
- if (trusted &&
- util::CheckCertificate(provider_app_id) == false)
+ std::string provider_app_id = app_id;
+ if (trusted && util::CheckCertificate(provider_app_id) == false)
is_exist = false;
else
is_exist = true;
}
- sqlite3_finalize(stmt);
- CloseDB(db);
-
return is_exist;
}
std::string DBManager::GetProviderAppId(const char* provider_id) {
- sqlite3_stmt* stmt = NULL;
- sqlite3* db;
- int trusted;
- std::string provider_app_id;
- int ret;
-
static const char query[] =
"SELECT trusted, appid FROM complication_provider WHERE provider_id=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return std::string();
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return std::string();
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(1, provider_id))
return std::string();
- }
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- trusted = sqlite3_column_int(stmt, 0);
- const char* app_id = reinterpret_cast<const char*>(
- sqlite3_column_text(stmt, 1));
- if (app_id == nullptr) {
- LOGE("app_id is nullptr");
- sqlite3_finalize(stmt);
- CloseDB(db);
- return std::string();
- }
- provider_app_id = std::string(app_id);
- if (trusted &&
- util::CheckCertificate(provider_app_id) == false) {
- sqlite3_finalize(stmt);
- CloseDB(db);
- return std::string();
- }
+ if (db.Step() != SQLITE_ROW)
+ return std::string();
+
+ int trusted = db.GetInt(0);
+ const char* app_id = db.GetText(1);
+
+ if (app_id == nullptr) {
+ LOGE("app_id is nullptr");
+ return std::string();
}
- sqlite3_finalize(stmt);
- CloseDB(db);
+ std::string provider_app_id = app_id;
+ if (trusted && util::CheckCertificate(provider_app_id) == false)
+ return std::string();
return provider_app_id;
}
std::list<std::unique_ptr<DBManager::ProviderInfo>>
DBManager::GetProviderListWithTypes(int supported_types) {
- const char* provider_id;
- int type = 0;
- sqlite3_stmt* stmt;
- sqlite3* db = NULL;
- std::list<std::unique_ptr<DBManager::ProviderInfo>> provider_list;
- int trusted;
- std::string provider_app_id;
- int ret;
-
static const char query[] =
- "SELECT trusted, appid, provider_id, support_type FROM complication_provider "
+ "SELECT trusted, appid, A.provider_id, support_type FROM "
+ "complication_provider as A LEFT JOIN provider_support_types as B "
+ "ON A.provider_id = B.provider_id "
"WHERE (support_type & ?) > 0";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
- return provider_list;
- }
+ if (!db.Open())
+ return {};
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
- return provider_list;
- }
+ if (!db.Prepare(query))
+ return {};
- ret = sqlite3_bind_int(stmt, 1, supported_types);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
- return provider_list;
- }
+ if (!db.Bind(1, supported_types))
+ return {};
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- trusted = sqlite3_column_int(stmt, 0);
- const char* app_id = reinterpret_cast<const char*>(
- sqlite3_column_text(stmt, 1));
+ std::list<std::unique_ptr<DBManager::ProviderInfo>> provider_list;
+ while (db.Step() == SQLITE_ROW) {
+ int trusted = db.GetInt(0);
+ const char* app_id = db.GetText(1);
if (app_id == nullptr) {
LOGE("app_id is nullptr");
continue;
}
- provider_app_id = std::string(app_id);
- if (trusted && util::CheckCertificate(provider_app_id) == false)
+ if (trusted && util::CheckCertificate(std::string(app_id)) == false)
continue;
- provider_id = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 2));
+ const char* provider_id = db.GetText(2);
if (provider_id == nullptr) {
LOGE("prodiver_id is nullptr");
continue;
}
- type = sqlite3_column_int(stmt, 3);
+ int type = db.GetInt(3);
provider_list.emplace_back(
std::unique_ptr<ProviderInfo>(new ProviderInfo(provider_id, type)));
}
- sqlite3_finalize(stmt);
- CloseDB(db);
-
- return std::move(provider_list);
+ return provider_list;
}
std::list<std::string> DBManager::GetProviderListWithAppId(
const char* provider_app_id) {
- const char* provider;
- sqlite3_stmt* stmt;
- sqlite3* db;
- std::list<std::string> provider_list;
- int ret;
-
static const char query[] =
"SELECT DISTINCT provider_id FROM complication_provider WHERE appid=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
- return provider_list;
- }
+ if (!db.Open())
+ return {};
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
- return provider_list;
- }
+ if (!db.Prepare(query))
+ return {};
- ret = sqlite3_bind_text(stmt, 1, provider_app_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
- return provider_list;
- }
+ if (!db.Bind(1, std::string(provider_app_id)))
+ return {};
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- provider = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
+ std::list<std::string> provider_list;
+ while (db.Step() == SQLITE_ROW) {
+ const char* provider = db.GetText(0);
if (provider == nullptr) {
LOGW("provider is nullptr");
continue;
@@ -398,64 +257,40 @@ std::list<std::string> DBManager::GetProviderListWithAppId(
provider_list.push_back(std::string(provider));
}
- sqlite3_finalize(stmt);
- CloseDB(db);
-
return provider_list;
}
int DBManager::GetSupportTypes(std::string& provider_id, int* types) {
- int supported_types = 0;
- sqlite3_stmt* stmt;
- sqlite3* db;
- int trusted;
- std::string provider_app_id;
- int ret;
-
static const char query[] =
- "SELECT trusted, appid, SUM(support_type) FROM complication_provider "
- "WHERE provider_id = ?";
+ "SELECT trusted, appid, SUM(support_type) FROM complication_provider as A "
+ "LEFT JOIN provider_support_types as B ON A.provider_id = B.provider_id "
+ "WHERE A.provider_id = ?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(1, provider_id))
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- trusted = sqlite3_column_int(stmt, 0);
- const char* app_id = reinterpret_cast<const char*>(
- sqlite3_column_text(stmt, 1));
+ int supported_types = 0;
+ if (db.Step() == SQLITE_ROW) {
+ int trusted = db.GetInt(0);
+ const char* app_id = db.GetText(1);
if (app_id == nullptr) {
LOGE("app_id is nullptr");
- sqlite3_finalize(stmt);
- CloseDB(db);
return WATCHFACE_COMPLICATION_ERROR_DB;
}
- provider_app_id = std::string(app_id);
+ std::string provider_app_id = app_id;
if (trusted && util::CheckCertificate(provider_app_id) == false)
supported_types = 0;
else
- supported_types = sqlite3_column_int(stmt, 2);
+ supported_types = db.GetInt(2);
}
- sqlite3_finalize(stmt);
- CloseDB(db);
-
*types = supported_types;
return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -463,37 +298,22 @@ int DBManager::GetSupportTypes(std::string& provider_id, int* types) {
std::list<std::string> DBManager::GetRequiredPrivilegeList(
std::string& provider_id) {
- const char* privilege;
- sqlite3_stmt* stmt;
- sqlite3* db;
- std::list<std::string> privlege_list;
- int ret;
-
static const char query[] =
"SELECT DISTINCT privilege FROM provider_privilege WHERE provider_id=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
- return privlege_list;
- }
+ if (!db.Open())
+ return {};
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
- return privlege_list;
- }
+ if (!db.Prepare(query))
+ return {};
- ret = sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
- return privlege_list;
- }
+ if (!db.Bind(1, provider_id))
+ return {};
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- privilege = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
+ std::list<std::string> privlege_list;
+ while (db.Step() == SQLITE_ROW) {
+ const char* privilege = db.GetText(0);
if (privilege == nullptr) {
LOGW("privilege is nullptr");
continue;
@@ -501,9 +321,6 @@ std::list<std::string> DBManager::GetRequiredPrivilegeList(
privlege_list.push_back(std::string(privilege));
}
- sqlite3_finalize(stmt);
- CloseDB(db);
-
return privlege_list;
}
@@ -515,39 +332,21 @@ Return -1 if error occurs.
int DBManager::GetRequiredSupportEvents(
std::string& provider_id) {
int support_events = WATCHFACE_COMPLICATION_EVENT_NONE;
- sqlite3_stmt* stmt;
- sqlite3* db;
- std::list<std::string> privlege_list;
- int ret;
-
static const char query[] =
"SELECT support_events FROM provider_support_events WHERE provider_id=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return -1;
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return -1;
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(1, provider_id))
return -1;
- }
-
- if (sqlite3_step(stmt) == SQLITE_ROW)
- support_events = sqlite3_column_int(stmt, 0);
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (db.Step() == SQLITE_ROW)
+ support_events = db.GetInt(0);
return support_events;
}
@@ -559,27 +358,27 @@ char* DBManager::GetSystemLocale() {
char* tmp;
lang = vconf_get_str(VCONFKEY_LANGSET);
- if (lang == NULL) {
+ if (lang == nullptr) {
locale = strdup(DEFAULT_LOCALE);
- if (locale == NULL) {
+ if (locale == nullptr) {
LOGE("out of memory");
- return NULL;
+ return nullptr;
}
return locale;
}
tmp = strtok_r(lang, ".", &ptr);
- if (tmp == NULL) {
+ if (tmp == nullptr) {
LOGE("failed to get language");
free(lang);
- return NULL;
+ return nullptr;
}
locale = strdup(tmp);
- if (locale == NULL) {
+ if (locale == nullptr) {
LOGE("out of memory");
free(lang);
- return NULL;
+ return nullptr;
}
for (int i = 0; i < static_cast<int>(strlen(locale)); i++) {
@@ -596,205 +395,171 @@ char* DBManager::GetSystemLocale() {
}
std::string DBManager::GetLabel(const char* provider_id) {
- std::string label;
- sqlite3_stmt *stmt;
- sqlite3* db;
- const char* lb;
- char* locale = NULL;
- int ret;
-
static const char query[] =
"SELECT provider_label FROM provider_localized_info "
"WHERE provider_id=? AND locale=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return std::string();
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return std::string();
- }
- locale = GetSystemLocale();
- if (locale == NULL) {
- sqlite3_finalize(stmt);
- CloseDB(db);
+ char* locale = GetSystemLocale();
+ if (locale == nullptr)
return std::string();
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
- free(locale);
+ std::unique_ptr<char, decltype(std::free)*> locale_ptr(locale, std::free);
+
+ if (!db.Bind(1, provider_id))
return std::string();
- }
- ret = sqlite3_bind_text(stmt, 2, locale, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
- free(locale);
+ if (!db.Bind(2, locale_ptr.get()))
return std::string();
- }
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- lb = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
+ std::string label;
+ if (db.Step() == SQLITE_ROW) {
+ const char* lb = db.GetText(0);
if (lb == nullptr) {
LOGW("lb is nullptr");
} else {
- label = std::string(lb);
+ label = lb;
}
}
if (label.empty()) {
- sqlite3_reset(stmt);
- sqlite3_clear_bindings(stmt);
+ sqlite3_reset(db.GetCursor().get());
+ sqlite3_clear_bindings(db.GetCursor().get());
- sqlite3_bind_text(stmt, 1, provider_id, -1, SQLITE_TRANSIENT);
- sqlite3_bind_text(stmt, 2, DEFAULT_LOCALE, -1, SQLITE_TRANSIENT);
+ if (!db.Bind(1, provider_id))
+ return std::string();
+ if (!db.Bind(2, DEFAULT_LOCALE))
+ return std::string();
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- lb = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
+ if (db.Step() == SQLITE_ROW) {
+ const char* lb = db.GetText(0);
if (lb == nullptr) {
LOGW("lb is nullptr");
} else {
- label = std::string(lb);
+ label = lb;
}
}
}
- sqlite3_finalize(stmt);
- CloseDB(db);
- free(locale);
-
return label;
}
-std::string DBManager::GetSetupAppId(const char* provider_id) {
- std::string setup_appid;
- sqlite3_stmt* stmt;
- sqlite3* db;
- int ret;
-
+std::string DBManager::GetIcon(const char* provider_id) {
static const char query[] =
- "SELECT DISTINCT setup_appid FROM provider_setup_appid WHERE provider_id=?";
+ "SELECT icon_path FROM provider_icon "
+ "WHERE provider_id=? AND locale=?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return std::string();
- }
- if (sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL) != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return std::string();
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ char* locale = GetSystemLocale();
+ if (locale == nullptr)
return std::string();
- }
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- const char* appid = reinterpret_cast<const char*>(
- sqlite3_column_text(stmt, 0));
- if (appid == nullptr) {
- LOGE("appid is nullptr");
- sqlite3_finalize(stmt);
- CloseDB(db);
- return std::string();
+ std::unique_ptr<char, decltype(std::free)*> locale_ptr(locale, std::free);
+
+ if (!db.Bind(1, provider_id))
+ return std::string();
+
+ if (!db.Bind(2, locale_ptr.get()))
+ return std::string();
+
+ std::string icon;
+ if (db.Step() == SQLITE_ROW) {
+ const char* ic = db.GetText(0);
+ if (ic == nullptr) {
+ LOGW("ic is nullptr");
+ } else {
+ icon = ic;
}
- setup_appid = std::string(appid);
}
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!icon.empty())
+ return icon;
- return setup_appid;
-}
+ sqlite3_reset(db.GetCursor().get());
+ sqlite3_clear_bindings(db.GetCursor().get());
-const char* DBManager::GetParserDataPath() {
- uid_t target_uid;
- const char* path;
- bool is_global;
+ if (!db.Bind(1, provider_id))
+ return std::string();
+ if (!db.Bind(2, DEFAULT_LOCALE))
+ return std::string();
- pkgmgr_installer_info_get_target_uid(&target_uid);
+ if (db.Step() == SQLITE_ROW) {
+ const char* ic = db.GetText(0);
+ if (ic == nullptr) {
+ LOGW("ic is nullptr");
+ } else {
+ icon = ic;
+ }
+ }
- if (target_uid == ROOT_USER
- || target_uid == tzplatform_getuid(TZ_SYS_GLOBALAPP_USER))
- is_global = true;
- else
- is_global = false;
+ return icon;
+}
- if (!is_global)
- tzplatform_set_user(target_uid);
+std::string DBManager::GetSetupAppId(const char* provider_id) {
+ static const char query[] =
+ "SELECT DISTINCT setup_appid FROM provider_setup_appid WHERE provider_id=?";
+ util::DBHelper db;
- path = tzplatform_mkpath(is_global ? TZ_SYS_DB : TZ_USER_DB,
- ".complication_provider.db");
+ if (!db.Open())
+ return std::string();
- tzplatform_reset_user();
+ if (!db.Prepare(query))
+ return std::string();
- return path;
+ if (!db.Bind(1, provider_id))
+ return std::string();
+
+ std::string setup_appid;
+ if (db.Step() == SQLITE_ROW) {
+ const char* appid = db.GetText(0);
+ if (appid == nullptr) {
+ LOGE("appid is nullptr");
+ return std::string();
+ }
+ setup_appid = appid;
+ }
+
+ return setup_appid;
}
int DBManager::GetTrustedInfo(std::string& provider_id, bool* trusted) {
- int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
- int trusted_info;
- sqlite3_stmt* stmt;
- sqlite3* db;
-
static const char query[] =
"SELECT trusted FROM complication_provider WHERE provider_id = ?";
+ util::DBHelper db;
- db = OpenDB();
- if (db == NULL) {
- LOGE("parser db not exist");
+ if (!db.Open())
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- ret = sqlite3_prepare_v2(db, query, strlen(query),
- &stmt, NULL);
- if (ret != SQLITE_OK) {
- LOGE("prepare error: %s", sqlite3_errmsg(db));
- CloseDB(db);
+ if (!db.Prepare(query))
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- ret = sqlite3_bind_text(stmt, 1, provider_id.c_str(), -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- LOGE("bind error: %s", sqlite3_errmsg(db));
- sqlite3_finalize(stmt);
- CloseDB(db);
+ if (!db.Bind(1, provider_id))
return WATCHFACE_COMPLICATION_ERROR_DB;
- }
- if (sqlite3_step(stmt) == SQLITE_ROW) {
- trusted_info = sqlite3_column_int(stmt, 0);
- if (trusted_info == 0)
- *trusted = false;
- else if (trusted_info == 1)
- *trusted = true;
- else
- ret = WATCHFACE_COMPLICATION_ERROR_DB;
- } else {
- ret = WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- }
+ if (db.Step() != SQLITE_ROW)
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- sqlite3_finalize(stmt);
- CloseDB(db);
+ int trusted_info = db.GetInt(0);
+ if (trusted_info == 0)
+ *trusted = false;
+ else if (trusted_info == 1)
+ *trusted = true;
+ else
+ return WATCHFACE_COMPLICATION_ERROR_DB;
- return ret;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
}
} // namespace watchface_complication
diff --git a/watchface-complication/db-manager.h b/watchface-complication/db-manager.h
index 17b26a2..6f5e9d1 100644
--- a/watchface-complication/db-manager.h
+++ b/watchface-complication/db-manager.h
@@ -20,13 +20,12 @@
#include <gio/gio.h>
#include <sqlite3.h>
#include <watchface-common.h>
+#include <bundle_cpp.h>
#include <string>
#include <memory>
#include <list>
-#include "watchface-complication/complication-bundle.h"
-
namespace watchface_complication {
class EXPORT_API DBManager {
@@ -45,8 +44,8 @@ class EXPORT_API DBManager {
return type_;
}
};
- static std::unique_ptr<Bundle> GetDefaultData(const char* provider_id,
- int support_type);
+ static std::unique_ptr<tizen_base::Bundle> GetDefaultData(
+ const char* provider_id, int support_type);
static std::string GetProviderAppId(const char* provider_id);
static std::list<std::string> GetRequiredPrivilegeList(
std::string& provider_id);
@@ -56,6 +55,7 @@ class EXPORT_API DBManager {
static int GetSupportTypes(std::string& provider_id, int* types);
static int GetProviderPeriod(std::string& provider_id, int* period);
static std::string GetLabel(const char* provider_id);
+ static std::string GetIcon(const char* provider_id);
static std::string GetSetupAppId(const char* provider_id);
static bool IsProviderExist(std::string& provider_id, int support_type);
static std::list<std::string> GetProviderListWithAppId(const char* provider_id);
@@ -64,9 +64,6 @@ class EXPORT_API DBManager {
private:
DBManager(); /* LCOV_EXCL_LINE */
virtual ~DBManager(); /* LCOV_EXCL_LINE */
- static sqlite3* OpenDB();
- static void CloseDB(sqlite3* db);
- static const char* GetParserDataPath();
static char* GetSystemLocale();
};
diff --git a/watchface-complication/design-element-implementation.h b/watchface-complication/design-element-implementation.h
index 22e94af..f2033b9 100644
--- a/watchface-complication/design-element-implementation.h
+++ b/watchface-complication/design-element-implementation.h
@@ -18,6 +18,7 @@
#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_IMPLEMENTATION_H_
#include <gio/gio.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -25,6 +26,7 @@
#include "watchface-complication/design-element.h"
#include "watchface-complication/complication-connector.h"
+#include "watchface-complication/editables-manager.h"
namespace watchface_complication {
@@ -34,7 +36,7 @@ class DesignElement::Impl {
private:
friend class DesignElement;
- Impl(DesignElement* parent, int id, int cur_data_idx, bool mock);
+ Impl(DesignElement* parent, int id, int cur_data_idx);
Impl(Impl const& other) = default;
Impl(Impl && other) = default;
Impl& operator=(Impl const& other) = default;
@@ -45,14 +47,14 @@ class DesignElement::Impl {
int id_ = -1;
int cur_data_idx_;
int last_data_idx_;
- std::list<std::unique_ptr<Bundle>> candidates_list_;
+ std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
std::unique_ptr<IEditable::Highlight> highlight_;
EditableShapeType shape_type_ = Circle;
std::string name_;
IEditable::EditableState ed_state_ = Complete;
- std::unique_ptr<Bundle> context_data_;
- std::unique_ptr<Bundle> last_context_data_ = nullptr;
- bool mock_;
+ std::unique_ptr<tizen_base::Bundle> context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_context_data_;
+ EditablesManager& editables_manager_;
};
} // namespace watchface_complication
diff --git a/watchface-complication/design-element.cc b/watchface-complication/design-element.cc
index fc5e821..465f0ae 100644
--- a/watchface-complication/design-element.cc
+++ b/watchface-complication/design-element.cc
@@ -29,10 +29,12 @@
#define LOG_TAG "WATCHFACE_COMPLICATION"
#define MAX_PACKAGE_STR_SIZE 512
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
-DesignElement::DesignElement(int id, int cur_data_idx, bool mock)
- : impl_(new Impl(this, id, cur_data_idx, mock)) {
+DesignElement::DesignElement(int id, int cur_data_idx)
+ : impl_(new Impl(this, id, cur_data_idx)) {
}
/* LCOV_EXCL_START */
@@ -41,13 +43,13 @@ DesignElement::~DesignElement() {
}
/* LCOV_EXCL_STOP */
-DesignElement::Impl::Impl(DesignElement* parent, int id,
- int cur_data_idx, bool mock)
- : parent_(parent), id_(id), cur_data_idx_(cur_data_idx), mock_(mock) {
+DesignElement::Impl::Impl(DesignElement* parent, int id, int cur_data_idx)
+ : parent_(parent), id_(id), cur_data_idx_(cur_data_idx),
+ editables_manager_(EditablesManager::GetInst()) {
last_data_idx_ = cur_data_idx_;
}
-int DesignElement::GetEditableId() {
+int DesignElement::GetEditableId() const {
return impl_->id_;
}
@@ -61,81 +63,62 @@ int DesignElement::SetHighlight(std::unique_ptr<IEditable::Highlight> highlight)
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-IEditable::Highlight* DesignElement::GetHighlight() {
+IEditable::Highlight* DesignElement::GetHighlight() const {
return impl_->highlight_.get();
}
int DesignElement::SetCandidates(
- std::list<std::unique_ptr<Bundle>> candidates_list) {
- impl_->candidates_list_ = std::move(candidates_list);
+ std::list<std::shared_ptr<Bundle>> candidates_list) {
+ impl_->candidates_list_ = candidates_list;
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-std::list<std::unique_ptr<Bundle>> const& DesignElement::GetCandidates() const {
+std::list<std::shared_ptr<Bundle>> const& DesignElement::GetCandidates() const {
return impl_->candidates_list_;
}
-const Bundle* DesignElement::GetCurData() {
+shared_ptr<Bundle> DesignElement::GetCurData() const {
if (static_cast<int>(impl_->candidates_list_.size()) < impl_->cur_data_idx_ + 1
|| impl_->cur_data_idx_ < 0)
- return NULL;
- std::list<std::unique_ptr<Bundle>>::iterator it
+ return shared_ptr<Bundle>({});
+ std::list<std::shared_ptr<Bundle>>::iterator it
= impl_->candidates_list_.begin();
-
LOGI("get cur data %d", impl_->cur_data_idx_);
- auto nx = std::next(it, impl_->cur_data_idx_);
- return nx->get();
+ return *std::next(it, impl_->cur_data_idx_);
}
-const Bundle* DesignElement::GetNthData(int nth) {
+shared_ptr<Bundle> DesignElement::GetNthData(int nth) const {
if (static_cast<int>(impl_->candidates_list_.size()) <= nth || nth < 0)
- return NULL;
+ return shared_ptr<Bundle>({});
- std::list<std::unique_ptr<Bundle>>::iterator it
+ std::list<std::shared_ptr<Bundle>>::iterator it
= impl_->candidates_list_.begin();
-
LOGI("get nth data %d", nth);
- auto nx = std::next(it, nth);
- return nx->get();
+ return *std::next(it, nth);
}
-int DesignElement::GetCurDataIdx() {
+int DesignElement::GetCurDataIdx() const {
return impl_->cur_data_idx_;
}
-int DesignElement::GetLastDataIdx() {
+int DesignElement::GetLastDataIdx() const {
LOGI("last data idx %d", impl_->last_data_idx_);
return impl_->last_data_idx_;
}
int DesignElement::UpdateLastData() {
- const Bundle* cur_data = GetCurData();
- if (cur_data == NULL)
+ shared_ptr<Bundle> cur_data = GetCurData();
+ if (cur_data.get() == nullptr)
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
- bundle_raw* raw_data = NULL;
- int raw_len, ret;
- ret = bundle_encode(const_cast<Bundle*>(cur_data)->GetRaw(),
- &raw_data, &raw_len);
- if (ret != BUNDLE_ERROR_NONE) {
- if (ret == BUNDLE_ERROR_OUT_OF_MEMORY) {
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } else {
- LOGE("bundle encode fail");
- return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
- }
- }
try {
- ret = EditablesManager::GetInst(impl_->mock_)
- .StoreSetting(impl_->id_, raw_data);
- free(raw_data);
-
+ int ret = impl_->editables_manager_.StoreSetting(
+ impl_->id_, cur_data->ToRaw().first.get());
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- free(raw_data);
- return ex.GetErrorCode();
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
impl_->last_data_idx_ = impl_->cur_data_idx_;
@@ -154,7 +137,7 @@ int DesignElement::SetCurDataIdx(int cur_data_idx) {
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-const std::string& DesignElement::GetLabel() {
+const std::string& DesignElement::GetLabel() const {
return impl_->name_;
}
@@ -173,11 +156,11 @@ void DesignElement::SetState(IEditable::EditableState state) {
impl_->ed_state_ = state;
}
-IEditable::EditableState DesignElement::GetState() {
+IEditable::EditableState DesignElement::GetState() const {
return impl_->ed_state_;
}
-const std::string DesignElement::GetSetupAppId() {
+std::string DesignElement::GetSetupAppId() const {
std::string setup_appid = "";
return setup_appid;
}
@@ -193,17 +176,17 @@ std::unique_ptr<Bundle>& DesignElement::GetContext() const {
}
int DesignElement::UpdateLastContext() {
- if (impl_->context_data_.get() == NULL) {
+ if (impl_->context_data_.get() == nullptr) {
LOGI("Empty context");
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
try {
- impl_->last_context_data_.reset(
- new Bundle((impl_->context_data_.get())->GetRaw()));
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
+ Bundle* ctx = new Bundle(impl_->context_data_->GetHandle());
+ impl_->last_context_data_.reset(ctx);
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
diff --git a/watchface-complication/design-element.h b/watchface-complication/design-element.h
index 7924097..0a907ed 100644
--- a/watchface-complication/design-element.h
+++ b/watchface-complication/design-element.h
@@ -18,6 +18,7 @@
#define WATCHFACE_COMPLICATION_DESIGN_ELEMENT_H_
#include <gio/gio.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -29,7 +30,7 @@ namespace watchface_complication {
class EXPORT_API DesignElement : public IEditable {
public:
- DesignElement(int id, int cur_data_idx, bool mock);
+ DesignElement(int id, int cur_data_idx);
virtual ~DesignElement();
DesignElement(DesignElement const& other) = default;
DesignElement(DesignElement && other) = default;
@@ -38,28 +39,28 @@ class EXPORT_API DesignElement : public IEditable {
public:
int SetHighlight(std::unique_ptr<IEditable::Highlight> highlight) override;
- IEditable::Highlight* GetHighlight() override;
- std::list<std::unique_ptr<Bundle>> const& GetCandidates() const override;
- int SetCandidates(std::list<std::unique_ptr<Bundle>> candidates_list) override;
- const Bundle* GetCurData() override;
- const Bundle* GetNthData(int nth) override;
- int GetCurDataIdx() override;
+ IEditable::Highlight* GetHighlight() const override;
+ std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+ int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+ std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+ std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+ int GetCurDataIdx() const override;
int SetCurDataIdx(int cur_data_idx) override;
- int GetLastDataIdx() override;
+ int GetLastDataIdx() const override;
int UpdateLastData() override;
- const std::string& GetLabel() override;
+ const std::string& GetLabel() const override;
void OnEditableUpdated(int selected_idx,
IEditable::EditableState state) override;
- int GetEditableId() override;
+ int GetEditableId() const override;
int SetEditableId(int id) override;
void SetLabel(const std::string& name) override;
void SetState(IEditable::EditableState state) override;
- IEditable::EditableState GetState() override;
- int SetContext(std::unique_ptr<Bundle> context) override;
- std::unique_ptr<Bundle>& GetContext() const override;
+ IEditable::EditableState GetState() const override;
+ int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+ std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
int UpdateLastContext() override;
- std::unique_ptr<Bundle>& GetLastContext() const override;
- const std::string GetSetupAppId() override;
+ std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+ std::string GetSetupAppId() const override;
private:
class Impl;
diff --git a/watchface-complication/editable-interface.h b/watchface-complication/editable-interface.h
index def9b9f..2f9dfb3 100644
--- a/watchface-complication/editable-interface.h
+++ b/watchface-complication/editable-interface.h
@@ -16,12 +16,12 @@
#ifndef WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
#define WATCHFACE_COMPLICATION_EDITABLE_INTERFACE_H_
+#include <bundle_cpp.h>
#include <string>
#include <list>
#include <memory>
-#include "watchface-complication/complication-bundle.h"
#include "watchface-complication/include/watchface-editable.h"
namespace watchface_complication {
@@ -123,27 +123,27 @@ class IEditable {
EditableShapeType shape_type_ = Circle;
};
virtual ~IEditable() = default;
- virtual int GetEditableId() = 0;
+ virtual int GetEditableId() const = 0;
virtual int SetEditableId(int id) = 0;
- virtual std::list<std::unique_ptr<Bundle>> const& GetCandidates() const = 0;
- virtual int SetCandidates(std::list<std::unique_ptr<Bundle>> candidates_list) = 0;
- virtual const Bundle* GetCurData() = 0;
- virtual const Bundle* GetNthData(int nth) = 0;
- virtual int GetCurDataIdx() = 0;
+ virtual std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const = 0;
+ virtual int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) = 0;
+ virtual std::shared_ptr<tizen_base::Bundle> GetCurData() const = 0;
+ virtual std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const = 0;
+ virtual int GetCurDataIdx() const = 0;
virtual int SetCurDataIdx(int cur_data_idx) = 0;
- virtual int GetLastDataIdx() = 0;
+ virtual int GetLastDataIdx() const = 0;
virtual int UpdateLastData() = 0;
- virtual const std::string& GetLabel() = 0;
+ virtual const std::string& GetLabel() const = 0;
virtual void SetLabel(const std::string& name) = 0;
virtual void OnEditableUpdated(int selected_idx, EditableState state) = 0;
virtual void SetState(EditableState state) = 0;
- virtual EditableState GetState() = 0;
- virtual const std::string GetSetupAppId() = 0;
- virtual int SetContext(std::unique_ptr<Bundle> context) = 0;
- virtual std::unique_ptr<Bundle>& GetContext() const = 0;
+ virtual EditableState GetState() const = 0;
+ virtual std::string GetSetupAppId() const = 0;
+ virtual int SetContext(std::unique_ptr<tizen_base::Bundle> context) = 0;
+ virtual std::unique_ptr<tizen_base::Bundle>& GetContext() const = 0;
virtual int UpdateLastContext() = 0;
- virtual std::unique_ptr<Bundle>& GetLastContext() const = 0;
- virtual Highlight* GetHighlight() = 0;
+ virtual std::unique_ptr<tizen_base::Bundle>& GetLastContext() const = 0;
+ virtual Highlight* GetHighlight() const = 0;
virtual int SetHighlight(std::unique_ptr<Highlight> highlight) = 0;
};
diff --git a/watchface-complication/editables-container-event-interface.h b/watchface-complication/editables-container-event-interface.h
index 5567f46..9f12837 100644
--- a/watchface-complication/editables-container-event-interface.h
+++ b/watchface-complication/editables-container-event-interface.h
@@ -16,12 +16,12 @@
#ifndef WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
#define WATCHFACE_COMPLICATION_EDITABLES_CONTAINER_EVENT_INTERFACE_H_
+#include <bundle_cpp.h>
#include <string>
#include <list>
#include <memory>
-#include "watchface-complication/complication-bundle.h"
#include "watchface-complication/complication.h"
namespace watchface_complication {
@@ -31,7 +31,7 @@ class EXPORT_API IEditablesContainerEvent {
virtual void OnRequestEdit(const std::string& appid,
std::list<std::unique_ptr<IEditable>> e_list) = 0;
virtual void OnSetupReply(const std::string& appid, int editable_id,
- std::unique_ptr<Bundle> context) = 0;
+ std::unique_ptr<tizen_base::Bundle> context) = 0;
};
} // namespace watchface_complication
diff --git a/watchface-complication/editables-container-implementation.h b/watchface-complication/editables-container-implementation.h
index de79894..7e71326 100644
--- a/watchface-complication/editables-container-implementation.h
+++ b/watchface-complication/editables-container-implementation.h
@@ -45,18 +45,11 @@ class EditablesContainer::Impl : IGDBus::IGDBusEvent {
void OnVanish(const std::string& name) override;
void OnAppear(const std::string& name, const std::string& name_owner) override;
void CancelEditing();
- explicit Impl(EditablesContainer* parent, bool mock);
+ explicit Impl(EditablesContainer* parent);
Impl(Impl const& other) = default;
Impl(Impl && other) = default;
Impl& operator=(Impl const& other) = default;
Impl& operator=(Impl && other) = default;
- static void FreeList(char** str_list, int size) {
- for (int i = 0; i < size; i++) {
- if (str_list[i])
- free(str_list[i]);
- }
- free(str_list);
- }
private:
EditablesContainer* parent_;
diff --git a/watchface-complication/editables-container.cc b/watchface-complication/editables-container.cc
index 81914d1..2c3fe5d 100644
--- a/watchface-complication/editables-container.cc
+++ b/watchface-complication/editables-container.cc
@@ -17,9 +17,11 @@
#include <glib.h>
#include <unistd.h>
#include <bundle.h>
+#include <bundle_cpp.h>
#include <bundle_internal.h>
#include <utility>
+#include <vector>
#include "watchface-complication/editables-container.h"
#include "watchface-complication/editables-container-implementation.h"
@@ -34,16 +36,19 @@
#define LOG_TAG "WATCHFACE_COMPLICATION"
#define MAX_PACKAGE_STR_SIZE 512
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
-EditablesContainer::EditablesContainer(bool mock)
- : impl_(new Impl(this, mock)) {
+EditablesContainer::EditablesContainer()
+ : impl_(new Impl(this)) {
}
EditablesContainer::~EditablesContainer() = default;
-EditablesContainer::Impl::Impl(EditablesContainer* parent, bool mock)
+EditablesContainer::Impl::Impl(EditablesContainer* parent)
: parent_(parent),
- gdbus_(std::unique_ptr<IGDBus>(ComplicationConnector::GetInst(mock).CreateGDBus(mock))) {
+ gdbus_(std::unique_ptr<IGDBus>(
+ ComplicationConnector::GetInst().CreateGDBus())) {
subscribe_id_ = gdbus_.get()->SubscribeSignal(
IGDBus::Editable,
util::GetAppId(), -1, this);
@@ -63,7 +68,7 @@ void EditablesContainer::Impl::OnSignal(GDBusConnection* connection,
const std::string& interface_name,
const std::string& signal_name,
GVariant* parameters) {
- char* editor_id = NULL;
+ char* editor_id = nullptr;
std::shared_ptr<const Bundle> updated_data;
LOGI("signal_name: %s ,%s", signal_name.c_str(), sender_name.c_str());
@@ -91,8 +96,7 @@ void EditablesContainer::Impl::OnSignal(GDBusConnection* connection,
util::GetCmdStr(util::EditableEditPreview)) == 0) {
int editable_id;
int selected_idx;
- char* context = NULL;
- std::string ctx_str;
+ char* context = nullptr;
if (sender_name_.compare(sender_name) != 0) {
LOGE("invalid sender_name %s", sender_name.c_str());
@@ -103,14 +107,24 @@ void EditablesContainer::Impl::OnSignal(GDBusConnection* connection,
LOGI("preview selected_idx, editable_id, state: %d, %d", selected_idx,
editable_id);
- if (context != NULL)
- ctx_str = std::string(context);
+ unique_ptr<Bundle> ctx_ptr;
+ std::string ctx_str = std::string(context);
+ if (!ctx_str.empty()) {
+ try {
+ ctx_ptr = std::unique_ptr<Bundle>(new Bundle(ctx_str));
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return;
+ }
+ }
+
for (auto& i : ed_list_) {
if (i.get()->GetEditableId() == editable_id) {
i.get()->SetState(IEditable::OnGoing);
i.get()->SetCurDataIdx(selected_idx);
- if (!ctx_str.empty())
- i.get()->SetContext(std::unique_ptr<Bundle>(new Bundle(ctx_str)));
+ if (ctx_ptr != nullptr)
+ i.get()->SetContext(move(ctx_ptr));
+
i.get()->OnEditableUpdated(i.get()->GetCurDataIdx(), IEditable::OnGoing);
parent_->OnUpdate(*i.get(), i.get()->GetCurDataIdx(), IEditable::OnGoing);
}
@@ -144,9 +158,9 @@ void EditablesContainer::Impl::CancelEditing() {
if (i.get()->GetState() != IEditable::Complete) {
i.get()->SetState(IEditable::Cancel);
i.get()->SetCurDataIdx(i.get()->GetLastDataIdx());
- if (i.get()->GetLastContext().get() != NULL) {
+ if (i.get()->GetLastContext().get() != nullptr) {
i.get()->SetContext(std::unique_ptr<Bundle>(
- new Bundle(i.get()->GetLastContext().get()->GetRaw())));
+ new Bundle(i.get()->GetLastContext().get()->GetHandle())));
} else {
i.get()->SetContext(std::unique_ptr<Bundle>{});
}
@@ -165,105 +179,104 @@ void EditablesContainer::Impl::OnAppear(const std::string& name,
}
int EditablesContainer::RequestEdit() {
- int list_idx = 0;
- int str_len = 0;
- bundle_raw* str_raw = NULL;
- char** list_arr;
- bool emit_ret = false;
-
if (impl_->editor_id_.empty())
- return -1;
-
- list_arr = reinterpret_cast<char**>(calloc(impl_->ed_list_.size(),
- sizeof(char*)));
- if (list_arr == NULL) {
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
-
- for (auto& i : impl_->ed_list_) {
- i.get()->SetState(IEditable::OnGoing);
- bundle* ed = bundle_create();
- if (ed == NULL) {
- impl_->FreeList(list_arr, impl_->ed_list_.size());
- LOGE("Out of memory");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
-
- bundle_add(ed, "SETUP_APPID", i.get()->GetSetupAppId().c_str());
- bundle_add(ed, "EDITABLE_ID",
- std::to_string(i.get()->GetEditableId()).c_str());
-
- int cur_data_idx = i.get()->GetCurDataIdx();
- bundle_add(ed, "CUR_DATA_IDX", std::to_string(cur_data_idx).c_str());
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
- std::unique_ptr<const char*[]> arr(
- new const char*[i->GetCandidates().size()]);
- int idx = 0;
- for (auto& data : i.get()->GetCandidates()) {
- arr.get()[idx++] = data->ToString();
- LOGD("%s", arr.get()[idx - 1]);
- }
- bundle_add_str_array(ed, "CANDIDATES_LIST", arr.get(),
- i.get()->GetCandidates().size());
- bundle_add(ed, "CANDIDATES_LIST_SIZE",
- std::to_string(i.get()->GetCandidates().size()).c_str());
-
- IEditable::Highlight* hi = i->GetHighlight();
- if (hi) {
- if (hi->GetGeometry()) {
- bundle_add(ed, "GEO_X", std::to_string(hi->GetGeometry()->GetX()).c_str());
- bundle_add(ed, "GEO_Y", std::to_string(hi->GetGeometry()->GetY()).c_str());
- bundle_add(ed, "GEO_W", std::to_string(hi->GetGeometry()->GetW()).c_str());
- bundle_add(ed, "GEO_H", std::to_string(hi->GetGeometry()->GetH()).c_str());
- LOGI("hi %d %d %d %d", hi->GetGeometry()->GetX(), hi->GetGeometry()->GetY(),
- hi->GetGeometry()->GetW(), hi->GetGeometry()->GetH());
+ try {
+ int ret;
+ vector<string> encoded_list;
+ for (auto& i : impl_->ed_list_) {
+ i.get()->SetState(IEditable::OnGoing);
+ Bundle b;
+ ret = b.Add("SETUP_APPID", i.get()->GetSetupAppId());
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ ret = b.Add("EDITABLE_ID", std::to_string(i.get()->GetEditableId()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ int cur_data_idx = i.get()->GetCurDataIdx();
+ ret = b.Add("CUR_DATA_IDX", std::to_string(cur_data_idx));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ vector<string> candidate_list;
+ for (auto& data : i.get()->GetCandidates()) {
+ candidate_list.push_back(
+ reinterpret_cast<char*>(data->ToRaw().first.get()));
+ }
+ ret = b.Add("CANDIDATES_LIST", candidate_list);
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ ret = b.Add("CANDIDATES_LIST_SIZE",
+ std::to_string(i.get()->GetCandidates().size()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ IEditable::Highlight* hi = i->GetHighlight();
+ if (hi) {
+ if (hi->GetGeometry()) {
+ ret = b.Add("GEO_X", std::to_string(hi->GetGeometry()->GetX()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ ret = b.Add("GEO_Y", std::to_string(hi->GetGeometry()->GetY()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ ret = b.Add("GEO_W", std::to_string(hi->GetGeometry()->GetW()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ ret = b.Add("GEO_H", std::to_string(hi->GetGeometry()->GetH()));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ LOGI("hi %d %d %d %d", hi->GetGeometry()->GetX(), hi->GetGeometry()->GetY(),
+ hi->GetGeometry()->GetW(), hi->GetGeometry()->GetH());
+ }
+
+ IEditable::EditableShapeType type = hi->GetShapeType();
+ ret = b.Add("SHAPE_TYPE", std::to_string(type));
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ } else {
+ LOGW("Null highlight info !!");
}
- IEditable::EditableShapeType type = hi->GetShapeType();
- bundle_add(ed, "SHAPE_TYPE", std::to_string(type).c_str());
- } else {
- LOGW("Null highlight info !!");
+ if (!i.get()->GetLabel().empty()) {
+ ret = b.Add("NAME", i.get()->GetLabel());
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+ encoded_list.push_back(reinterpret_cast<char*>(b.ToRaw().first.get()));
}
- if (!i.get()->GetLabel().empty())
- bundle_add(ed, "NAME", i.get()->GetLabel().c_str());
-
- bundle_encode(ed, &str_raw, &str_len);
- list_arr[list_idx++] = reinterpret_cast<char*>(str_raw);
-
- bundle_free(ed);
- }
-
- bundle* container = bundle_create();
- if (container == NULL) {
- impl_->FreeList(list_arr, impl_->ed_list_.size());
+ Bundle container;
+ ret = container.Add("EDITABLE_LIST", encoded_list);
+ if (ret != BUNDLE_ERROR_NONE)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ bool emit_ret = impl_->gdbus_.get()->EmitSignal(
+ IGDBus::SigType::Editable,
+ impl_->editor_id_,
+ impl_->editor_id_,
+ -1,
+ util::GetCmdStr(util::EditableEditRequest),
+ g_variant_new("(ss)",
+ util::GetAppId().c_str(), container.ToRaw().first.get()));
+
+ if (!emit_ret)
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+
+ impl_->watcher_id_ = impl_->gdbus_.get()->Watch(impl_->editor_id_,
+ this->impl_.get());
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
- bundle_add_str_array(container, "EDITABLE_LIST",
- const_cast<const char**>(list_arr), list_idx);
- impl_->FreeList(list_arr, impl_->ed_list_.size());
- bundle_encode(container, &str_raw, &str_len);
- emit_ret = impl_->gdbus_.get()->EmitSignal(
- IGDBus::SigType::Editable,
- impl_->editor_id_,
- impl_->editor_id_,
- -1,
- util::GetCmdStr(util::EditableEditRequest),
- g_variant_new("(ss)",
- util::GetAppId().c_str(),
- str_raw));
-
- bundle_free_encoded_rawdata(&str_raw);
- bundle_free(container);
-
- if (emit_ret == false)
- return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
-
- impl_->watcher_id_ = impl_->gdbus_.get()->Watch(impl_->editor_id_,
- this->impl_.get());
-
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
diff --git a/watchface-complication/editables-container.h b/watchface-complication/editables-container.h
index 5f948bd..f3afa3c 100644
--- a/watchface-complication/editables-container.h
+++ b/watchface-complication/editables-container.h
@@ -29,7 +29,7 @@ namespace watchface_complication {
class EXPORT_API EditablesContainer : IEditablesEditorEvent {
public:
- EditablesContainer(bool mock);
+ EditablesContainer();
virtual ~EditablesContainer(); /* LCOV_EXCL_LINE */
int Add(std::shared_ptr<IEditable> ed, int editable_id);
int Remove(std::shared_ptr<IEditable> ed);
diff --git a/watchface-complication/editables-manager-implementation.h b/watchface-complication/editables-manager-implementation.h
index 81103dd..a1663b1 100644
--- a/watchface-complication/editables-manager-implementation.h
+++ b/watchface-complication/editables-manager-implementation.h
@@ -41,16 +41,15 @@ class EditablesManager::Impl {
private:
friend class EditablesManager;
Impl();
- static std::string GetEditablesDataPath(bool mock) {
- char* app_data_path = mock ? (char*)"/tmp/" : app_get_data_path();
+ static std::string GetEditablesDataPath() {
+ char* app_data_path = app_get_data_path();
char setting_data_path[PATH_MAX] = {0, };
if (app_data_path != NULL) {
snprintf(setting_data_path, PATH_MAX, "%s.watchface_editables.db",
app_data_path);
LOGI("get setting data path %s", setting_data_path);
- if (!mock)
- free(app_data_path);
+ free(app_data_path);
}
return std::string(setting_data_path);
diff --git a/watchface-complication/editables-manager.cc b/watchface-complication/editables-manager.cc
index 7a1a210..33ef6c0 100644
--- a/watchface-complication/editables-manager.cc
+++ b/watchface-complication/editables-manager.cc
@@ -32,14 +32,15 @@
#define QUERY_MAXLEN 4096
+using namespace tizen_base;
namespace watchface_complication {
-EditablesManager& EditablesManager::GetInst(bool mock) {
+EditablesManager& EditablesManager::GetInst() {
static EditablesManager w_inst;
int ret;
if (w_inst.impl_ == nullptr) {
- ret = w_inst.Init(mock);
+ ret = w_inst.Init();
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
THROW(ret);
}
@@ -50,14 +51,12 @@ EditablesManager::EditablesManager() = default;
EditablesManager::~EditablesManager() = default;
EditablesManager::Impl::Impl() = default;
-int EditablesManager::Init(bool mock) {
+int EditablesManager::Init() {
int ret;
int open_flags = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
- std::unique_ptr<Impl> tmp_impl;
-
- try {
- tmp_impl = std::unique_ptr<EditablesManager::Impl>(new Impl());
- } catch (const std::bad_alloc &ba) {
+ std::unique_ptr<Impl> tmp_impl
+ = std::unique_ptr<EditablesManager::Impl>(new (std::nothrow) Impl());
+ if (tmp_impl.get() == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -72,7 +71,7 @@ int EditablesManager::Init(bool mock) {
"CREATE TABLE IF NOT EXISTS editable_setting" \
"(editable_id INTEGER NOT NULL, setting_data TEXT NOT NULL, "\
"PRIMARY KEY(editable_id))";
- std::string db_path = tmp_impl->GetEditablesDataPath(mock);
+ std::string db_path = tmp_impl->GetEditablesDataPath();
if (db_path.empty()) {
LOGE("GetSettingDataPath failed");
return WATCHFACE_COMPLICATION_ERROR_DB;
@@ -80,13 +79,13 @@ int EditablesManager::Init(bool mock) {
LOGI("db path : %s", db_path.c_str());
ret = sqlite3_open_v2(db_path.c_str(), &tmp_impl->setting_db_, open_flags,
- NULL);
+ nullptr);
if (ret != SQLITE_OK) {
LOGE("database creation failed with error: %d", ret);
return WATCHFACE_COMPLICATION_ERROR_DB;
}
ret = sqlite3_exec(tmp_impl->setting_db_, setting_table_command.c_str(),
- NULL, NULL, NULL);
+ nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
sqlite3_close_v2(tmp_impl->setting_db_);
LOGE("database setting table creation failed: %d", ret);
@@ -94,14 +93,14 @@ int EditablesManager::Init(bool mock) {
}
ret = sqlite3_open_v2(db_path.c_str(), &tmp_impl->context_db_, open_flags,
- NULL);
+ nullptr);
if (ret != SQLITE_OK) {
sqlite3_close_v2(tmp_impl->setting_db_);
LOGE("database creation failed with error: %d", ret);
return WATCHFACE_COMPLICATION_ERROR_DB;
}
ret = sqlite3_exec(tmp_impl->context_db_, context_table_command.c_str(),
- NULL, NULL, NULL);
+ nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
sqlite3_close_v2(tmp_impl->setting_db_);
sqlite3_close_v2(tmp_impl->context_db_);
@@ -115,9 +114,9 @@ int EditablesManager::Init(bool mock) {
int EditablesManager::StoreSetting(int editable_id, bundle_raw* raw_data) {
char query[QUERY_MAXLEN] = {0, };
- char* error = NULL;
+ char* error = nullptr;
- if (impl_->setting_db_ == NULL) {
+ if (impl_->setting_db_ == nullptr) {
LOGE("DB is not initialized.");
return -1;
}
@@ -125,7 +124,7 @@ int EditablesManager::StoreSetting(int editable_id, bundle_raw* raw_data) {
sqlite3_snprintf(QUERY_MAXLEN, query,
"INSERT OR REPLACE INTO editable_setting(editable_id, setting_data) " \
"VALUES (%d, %Q)", editable_id, raw_data);
- if (sqlite3_exec(impl_->setting_db_, query, NULL, NULL, &error) != SQLITE_OK) {
+ if (sqlite3_exec(impl_->setting_db_, query, nullptr, nullptr, &error) != SQLITE_OK) {
LOGE("sqlite3_exec error(editable_id %d, error = %s)", editable_id, error);
sqlite3_free(error);
return WATCHFACE_COMPLICATION_ERROR_DB;
@@ -135,12 +134,12 @@ int EditablesManager::StoreSetting(int editable_id, bundle_raw* raw_data) {
std::unique_ptr<Bundle> EditablesManager::LoadSetting(int editable_id) {
char query[QUERY_MAXLEN];
- std::unique_ptr<Bundle> setting_data = nullptr;
+ std::unique_ptr<Bundle> setting_data;
const char* raw_data;
sqlite3_stmt* stmt;
int ret;
- if (impl_->setting_db_ == NULL) {
+ if (impl_->setting_db_ == nullptr) {
return nullptr;
}
@@ -148,7 +147,7 @@ std::unique_ptr<Bundle> EditablesManager::LoadSetting(int editable_id) {
"SELECT setting_data FROM editable_setting WHERE " \
"editable_id = %d ", editable_id);
ret = sqlite3_prepare_v2(impl_->setting_db_,
- query, strlen(query), &stmt, NULL);
+ query, strlen(query), &stmt, nullptr);
if (ret != SQLITE_OK) {
LOGE("sqlite3_prepare_v2 failed (editable_id : %d, error = %s)",
editable_id, sqlite3_errmsg(impl_->setting_db_));
@@ -162,28 +161,34 @@ std::unique_ptr<Bundle> EditablesManager::LoadSetting(int editable_id) {
}
sqlite3_finalize(stmt);
- return std::move(setting_data);
+ return setting_data;
}
int EditablesManager::StoreContext(int editable_id, const char* provider_id,
- Bundle& context) {
+ Bundle* context) {
char query[QUERY_MAXLEN] = {0, };
- char* error = NULL;
+ char* error = nullptr;
- if (impl_->setting_db_ == NULL) {
+ if (impl_->setting_db_ == nullptr) {
LOGE("DB is not initialized.");
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
- sqlite3_snprintf(QUERY_MAXLEN, query,
- "INSERT OR REPLACE INTO editable_context(editable_id, provider_id, " \
- "context_data) VALUES (%d, %Q, %Q)",
- editable_id, provider_id, context.ToString());
- if (sqlite3_exec(impl_->context_db_, query, NULL, NULL, &error) != SQLITE_OK) {
- LOGE("sqlite3_exec error(editable_id : %d, provider_id : %s, error = %s)",
- editable_id, provider_id, error);
- sqlite3_free(error);
- return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ try {
+ sqlite3_snprintf(QUERY_MAXLEN, query,
+ "INSERT OR REPLACE INTO editable_context(editable_id, provider_id, " \
+ "context_data) VALUES (%d, %Q, %Q)",
+ editable_id, provider_id, context->ToRaw().first.get());
+ if (sqlite3_exec(
+ impl_->context_db_, query, nullptr, nullptr, &error) != SQLITE_OK) {
+ LOGE("sqlite3_exec error(editable_id : %d, provider_id : %s, error = %s)",
+ editable_id, provider_id, error);
+ sqlite3_free(error);
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -191,11 +196,11 @@ int EditablesManager::StoreContext(int editable_id, const char* provider_id,
std::unique_ptr<Bundle> EditablesManager::LoadContext(int editable_id,
const char* provider_id) {
char query[QUERY_MAXLEN] = {0, };
- std::unique_ptr<Bundle> context_data = nullptr;
+ std::unique_ptr<Bundle> context_data;
const char* raw_data;
sqlite3_stmt* stmt;
- if (impl_->context_db_ == NULL) {
+ if (impl_->context_db_ == nullptr) {
return nullptr;
}
@@ -203,7 +208,7 @@ std::unique_ptr<Bundle> EditablesManager::LoadContext(int editable_id,
"SELECT context_data FROM editable_context WHERE " \
"editable_id = %d AND provider_id = %Q ", editable_id, provider_id);
LOGI("editable context select sql : %s", query);
- if (sqlite3_prepare_v2(impl_->context_db_, query, strlen(query), &stmt, NULL)
+ if (sqlite3_prepare_v2(impl_->context_db_, query, strlen(query), &stmt, nullptr)
!= SQLITE_OK) {
LOGE("sqlite3_prepare fail %s", sqlite3_errmsg(impl_->context_db_));
sqlite3_close_v2(impl_->context_db_);
@@ -212,21 +217,27 @@ std::unique_ptr<Bundle> EditablesManager::LoadContext(int editable_id,
if (sqlite3_step(stmt) == SQLITE_ROW) {
raw_data = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 0));
- context_data = std::unique_ptr<Bundle>(new Bundle(std::string(raw_data)));
+ try {
+ context_data = std::unique_ptr<Bundle>(new Bundle(std::string(raw_data)));
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ sqlite3_finalize(stmt);
+ return nullptr;
+ }
}
sqlite3_finalize(stmt);
- return std::move(context_data);
+ return context_data;
}
int EditablesManager::DeleteContext(int editable_id,
const char* provider_id) {
char query[QUERY_MAXLEN];
- std::unique_ptr<Bundle> context_data = nullptr;
+ std::unique_ptr<Bundle> context_data;
sqlite3_stmt* stmt;
int ret;
- if (impl_->context_db_ == NULL)
+ if (impl_->context_db_ == nullptr)
return WATCHFACE_COMPLICATION_ERROR_DB;
sqlite3_snprintf(QUERY_MAXLEN, query,
@@ -234,7 +245,7 @@ int EditablesManager::DeleteContext(int editable_id,
"editable_id = %d AND provider_id = %Q ", editable_id, provider_id);
LOGI("editable context delete : (%d)(%s)", editable_id, provider_id);
ret = sqlite3_prepare_v2(impl_->context_db_, query, strlen(query), &stmt,
- NULL);
+ nullptr);
if (ret != SQLITE_OK) {
LOGE("sqlite3_prepare fail %s", sqlite3_errmsg(impl_->context_db_));
sqlite3_close_v2(impl_->context_db_);
diff --git a/watchface-complication/editables-manager.h b/watchface-complication/editables-manager.h
index db3f66d..4b0f3e1 100644
--- a/watchface-complication/editables-manager.h
+++ b/watchface-complication/editables-manager.h
@@ -19,27 +19,28 @@
#include <gio/gio.h>
#include <watchface-common.h>
+#include <bundle_cpp.h>
#include <string>
#include <memory>
-#include "watchface-complication/complication-bundle.h"
-
namespace watchface_complication {
class EXPORT_API EditablesManager {
public:
- static EditablesManager& GetInst(bool mock = false);
+ static EditablesManager& GetInst();
int StoreSetting(int editable_id, bundle_raw* raw_data);
- std::unique_ptr<Bundle> LoadSetting(int editable_id);
- int StoreContext(int editable_id, const char* provider_id, Bundle& context);
- std::unique_ptr<Bundle> LoadContext(int editable_id, const char* provider_id);
+ std::unique_ptr<tizen_base::Bundle> LoadSetting(int editable_id);
+ int StoreContext(int editable_id, const char* provider_id,
+ tizen_base::Bundle* context);
+ std::unique_ptr<tizen_base::Bundle> LoadContext(
+ int editable_id, const char* provider_id);
int DeleteContext(int editable_id, const char* provider_id);
private:
EditablesManager();
virtual ~EditablesManager();
- int Init(bool mock);
+ int Init();
private:
class Impl;
diff --git a/watchface-complication/gdbus-mock.h b/watchface-complication/gdbus-mock.h
deleted file mode 100644
index 04e00ea..0000000
--- a/watchface-complication/gdbus-mock.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef WATCHFACE_COMPLICATION_GDBUS_MOCK_H_
-#define WATCHFACE_COMPLICATION_GDBUS_MOCK_H_
-
-#include <glib.h>
-
-#include <memory>
-
-#include "watchface-complication/gdbus-interface.h"
-
-namespace watchface_complication {
-namespace test {
-
-class GDBusMock : public IGDBus {
- public:
- GDBusMock() { }
-
- virtual ~GDBusMock() {
- }
-
- int Watch(std::string appid, IGDBus::IGDBusEvent* listener) {
- return 0;
- }
-
- void UnWatch(int watcher_id) {
- }
-
- bool EmitSignal(SigType type, std::string target_id, std::string id,
- int sub_id, std::string cmd, GVariant* data) {
- return true;
- }
-
- void UnSubscribeSignal(int subscribe_id) {
-
- }
-
- int SubscribeSignal(SigType type, std::string id,
- int sub_id, IGDBus::IGDBusEvent* listener) {
- return 1;
- }
-
- private:
- static void SignalCb(GDBusConnection* connection,
- const gchar* sender_name,
- const gchar* object_path,
- const gchar* interface_name,
- const gchar* signal_name,
- GVariant* parameters,
- void* user_data) {
- IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
-
- rs->OnSignal(connection, sender_name, object_path, interface_name,
- signal_name, parameters);
- }
-
- static void VanishCb(GDBusConnection* connection,
- const gchar* name, gpointer user_data) {
- IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
- rs->OnVanish(name);
- }
-
- static void AppearCb(GDBusConnection* connection,
- const gchar* name, const gchar* name_owner, gpointer user_data) {
- IGDBus::IGDBusEvent* rs = static_cast<IGDBus::IGDBusEvent*>(user_data);
- rs->OnAppear(name, name_owner);
- }
-
- private:
-};
-
-} // namespace test
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_GDBUS_MOCK_H_
diff --git a/watchface-complication/gdbus.h b/watchface-complication/gdbus.h
index 10d0dd8..0a8bd35 100644
--- a/watchface-complication/gdbus.h
+++ b/watchface-complication/gdbus.h
@@ -22,6 +22,7 @@
#include <memory>
#include <list>
+#include <string>
#include "watchface-common/watchface-util.h"
#include "watchface-complication/gdbus-interface.h"
@@ -36,7 +37,7 @@ class GDBus : public IGDBus {
: conn_(conn) { }
virtual ~GDBus() {
- for(auto& id : subscribe_list_) {
+ for (auto& id : subscribe_list_) {
g_dbus_connection_signal_unsubscribe(conn_, id);
}
}
@@ -110,7 +111,6 @@ class GDBus : public IGDBus {
int SubscribeSignal(SigType type, std::string id,
int sub_id, IGDBus::IGDBusEvent* listener) {
-
LOGI("subscribe : %s, %d", id.c_str(), sub_id);
std::string path = util::EncodeStr(
type == Complication ?
@@ -171,4 +171,4 @@ class GDBus : public IGDBus {
} // namespace watchface_complication
-#endif // WATCHFACE_COMPLICATION_GDBUS_H_ \ No newline at end of file
+#endif // WATCHFACE_COMPLICATION_GDBUS_H_
diff --git a/watchface-complication/include/watchface-complication.h b/watchface-complication/include/watchface-complication.h
index 0f6f01e..0daef8e 100644
--- a/watchface-complication/include/watchface-complication.h
+++ b/watchface-complication/include/watchface-complication.h
@@ -19,6 +19,7 @@
#include <tizen.h>
#include <bundle.h>
+#include <time.h>
#include <watchface-common.h>
@@ -89,9 +90,9 @@ typedef void (*watchface_complication_error_cb)(
* @param[out] cur_provider The name of the provider supplying the data
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @pre Complication handle should be created by watchface_complication_create().
* @par Sample code:
* @code
@@ -125,9 +126,9 @@ int watchface_complication_get_current_provider_id(complication_h handle,
* @param[out] cur_type The type shown in the complication
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-complication.h>
@@ -164,10 +165,10 @@ int watchface_complication_get_current_type(complication_h handle,
* @param[in] user_data The user data to pass to the callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @pre Complication handle should be created by watchface_complication_create().
* @see watchface_complication_updated_cb()
@@ -207,8 +208,8 @@ int watchface_complication_add_updated_cb(complication_h handle,
* @param[in] cb The callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_complication_updated_cb()
* @par Sample code:
* @code
@@ -239,12 +240,12 @@ int watchface_complication_remove_updated_cb(complication_h handle,
* @param[in] handle Complication handle
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-complication.h>
@@ -272,7 +273,6 @@ int watchface_complication_send_update_request(complication_h handle);
/**
* @brief Creates a complication handle.
* @details The default provider and type are the items to set for initial display.
- * User should not enter null as the default provider and will receive an error.
* If user selects the other provider and type, they are no longer used.
* You can specify @a supported_types by combining the types you want to show in the complication.
* You can specify @a supported_event_types by combining the event types you want to handle for the complication.
@@ -294,14 +294,14 @@ int watchface_complication_send_update_request(complication_h handle);
* @param[out] created_handle Complication handle on success
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID Already exist @a complication_id
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_EXIST Provider does not exist
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PROVIDER_NOT_AVAILABLE Provider application is not available now for some reason. (eg. uninstall, disable)
* @see watchface_complication_type_e
* @see watchface_complication_event_type_e
@@ -343,8 +343,8 @@ int watchface_complication_create(int complication_id,
* @param[in] handle Complication handle
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @pre Complication handle should be created by watchface_complication_create().
* @see watchface_complication_create()
* @par Sample code:
@@ -376,10 +376,10 @@ int watchface_complication_destroy(complication_h handle);
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -407,10 +407,10 @@ int watchface_complication_data_get_type(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -442,10 +442,10 @@ int watchface_complication_data_get_short_text(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -477,10 +477,10 @@ int watchface_complication_data_get_long_text(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -500,6 +500,7 @@ void _on_complication_update(int complication_id,
int watchface_complication_data_get_title(const bundle *data, char **title);
/**
+ * @deprecated Deprecated since 5.5. Use watchface_complication_data_get_timeinfo() instead.
* @brief Gets timestamp from complication data.
* @since_tizen 5.0
* @param[in] data The data received from complication provider app
@@ -507,10 +508,10 @@ int watchface_complication_data_get_title(const bundle *data, char **title);
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -531,7 +532,296 @@ void _on_complication_update(int complication_id,
* @endcode
*/
int watchface_complication_data_get_timestamp(const bundle *data,
- long *timestamp);
+ long *timestamp) TIZEN_DEPRECATED_API;
+
+/**
+ * @brief Gets timeinfo from complication data.
+ * @since_tizen 5.5
+ * @remarks The @a info should be destroyed using watchface_complication_timeinfo_destroy().
+ * @param[in] data The data received from complication provider app
+ * @param[out] info The time information handle
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see #complication_time_info_h
+ * @see watchface_complication_timeinfo_get_timezone()
+ * @see watchface_complication_timeinfo_get_timezone_id()
+ * @see watchface_complication_timeinfo_get_timezone_country()
+ * @see watchface_complication_timeinfo_get_timezone_city()
+ * @see watchface_complication_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_data_get_timeinfo(const bundle *data,
+ complication_time_info_h *info);
+
+/**
+ * @brief Gets timezone from timeinfo.
+ * @since_tizen 5.5
+ * @remarks The @a timezone should be freed using free().
+ * @param[in] info The time information handle
+ * @param[out] timezone The timezone
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see #complication_time_info_h
+ * @see watchface_complication_data_get_timeinfo()
+ * @see watchface_complication_timeinfo_get_timezone_id()
+ * @see watchface_complication_timeinfo_get_timezone_country()
+ * @see watchface_complication_timeinfo_get_timezone_city()
+ * @see watchface_complication_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+ char *timezone;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_get_timezone(info, &timezone);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_timeinfo_get_timezone(complication_time_info_h info,
+ char **timezone);
+
+/**
+ * @brief Gets timezone ID from timeinfo.
+ * @since_tizen 5.5
+ * @remarks The @a timezone_id should be freed using free().
+ * @param[in] info The time information handle
+ * @param[out] timezone_id The timezone ID
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see #complication_time_info_h
+ * @see watchface_complication_timeinfo_get_timezone()
+ * @see watchface_complication_data_get_timeinfo()
+ * @see watchface_complication_timeinfo_get_timezone_country()
+ * @see watchface_complication_timeinfo_get_timezone_city()
+ * @see watchface_complication_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+ char *timezone_id;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_get_timezone_id(info, &timezone_id);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_timeinfo_get_timezone_id(complication_time_info_h info,
+ char **timezone_id);
+
+/**
+ * @brief Gets timezone country from timeinfo.
+ * @since_tizen 5.5
+ * @remarks The @a country should be freed using free().
+ * @param[in] info The time information handle
+ * @param[out] country The timezone country
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see #complication_time_info_h
+ * @see watchface_complication_timeinfo_get_timezone()
+ * @see watchface_complication_data_get_timeinfo()
+ * @see watchface_complication_timeinfo_get_timezone_id()
+ * @see watchface_complication_timeinfo_get_timezone_city()
+ * @see watchface_complication_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+ char *country;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_get_timezone_country(info, &country);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_timeinfo_get_timezone_country(complication_time_info_h info,
+ char **country);
+
+/**
+ * @brief Gets timezone city from timeinfo.
+ * @since_tizen 5.5
+ * @remarks The @a city should be freed using free().
+ * @param[in] info The time information handle
+ * @param[out] city The timezone city
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see #complication_time_info_h
+ * @see watchface_complication_timeinfo_get_timezone()
+ * @see watchface_complication_data_get_timeinfo()
+ * @see watchface_complication_timeinfo_get_timezone_id()
+ * @see watchface_complication_timeinfo_get_timezone()
+ * @see watchface_complication_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+ char *city;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_get_timezone_city(info, &city);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_timeinfo_get_timezone_city(complication_time_info_h info,
+ char **city);
+
+/**
+ * @brief Gets timestamp from timeinfo.
+ * @since_tizen 5.5
+ * @remarks The @a info should contain a timezone ID.
+ * If @a info doesn't contain a timezone ID, this function will return #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER.
+ * @param[in] info The time information handle
+ * @param[out] timestamp The number of seconds since 00:00, Jan 1 1970 UTC, corresponding to POSIX time.
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
+ * @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
+ * @see #complication_time_info_h
+ * @see watchface_complication_data_get_timeinfo()
+ * @see watchface_complication_timeinfo_get_timezone_id()
+ * @see watchface_complication_timeinfo_get_timezone()
+ * @see watchface_complication_timeinfo_destroy()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+ time_t timestamp;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_get_timestamp(info, &timestamp);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_timeinfo_get_timestamp(complication_time_info_h info,
+ time_t *timestamp);
+
+/**
+ * @brief Destroys time information handle.
+ * @since_tizen 5.5
+ * @param[in] info The time information handle
+ * @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
+ * otherwise an error code (see #watchface_complication_error_e) on failure
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see #complication_time_info_h
+ * @see watchface_complication_data_get_timeinfo()
+ * @par Sample code:
+ * @code
+#include <watchface-complication.h>
+void _on_complication_update(int complication_id,
+ const char *provider_id,
+ watchface_complication_type_e type,
+ const bundle *data, void *user_data)
+{
+ complication_time_info_h info;
+ watchface_complication_type_e type;
+
+ watchface_complication_data_get_type(data, &type);
+ if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
+ watchface_complication_data_get_timeinfo(data, &info);
+ watchface_complication_timeinfo_destroy(info);
+ }
+}
+ * @endcode
+ */
+int watchface_complication_timeinfo_destroy(complication_time_info_h info);
/**
* @brief Gets image path from complication data.
@@ -542,10 +832,10 @@ int watchface_complication_data_get_timestamp(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -578,10 +868,10 @@ int watchface_complication_data_get_image_path(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -613,10 +903,10 @@ int watchface_complication_data_get_ranged_value(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -648,10 +938,10 @@ int watchface_complication_data_get_icon_path(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @see watchface_complication_updated_cb()
* @par Sample code:
@@ -679,10 +969,10 @@ int watchface_complication_data_get_extra_data(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_updated_cb()
* @par Sample code:
* @code
@@ -719,12 +1009,12 @@ int watchface_complication_data_get_screen_reader_text(const bundle *data,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_provider_event_get_type()
* @see watchface_complication_provider_event_get_provider_id()
* @see watchface_complication_provider_event_get_complication_type()
@@ -757,9 +1047,9 @@ typedef struct complication_allowed_list_ *complication_allowed_list_h;
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_allowed_list_destroy()
* @see watchface_complication_allowed_list_add()
* @see watchface_complication_allowed_list_delete()
@@ -786,8 +1076,8 @@ int watchface_complication_allowed_list_create(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_complication_allowed_list_create()
* @see watchface_complication_allowed_list_add()
* @see watchface_complication_allowed_list_delete()
@@ -819,10 +1109,10 @@ int watchface_complication_allowed_list_destroy(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID The provider id is already exists in allowed list
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_allowed_list_create()
* @see watchface_complication_allowed_list_destroy()
* @see watchface_complication_allowed_list_delete()
@@ -852,8 +1142,8 @@ int watchface_complication_allowed_list_add(complication_allowed_list_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_complication_allowed_list_create()
* @see watchface_complication_allowed_list_destroy()
* @see watchface_complication_allowed_list_add()
@@ -891,10 +1181,10 @@ int watchface_complication_allowed_list_delete(complication_allowed_list_h handl
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_allowed_list_create()
* @see watchface_complication_allowed_list_destroy()
* @see watchface_complication_allowed_list_add()
@@ -932,10 +1222,10 @@ int watchface_complication_allowed_list_get_nth(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_allowed_list_create()
* @see watchface_complication_allowed_list_destroy()
* @see watchface_complication_allowed_list_add()
@@ -975,8 +1265,8 @@ int watchface_complication_allowed_list_apply(complication_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_complication_allowed_list_create()
* @see watchface_complication_allowed_list_destroy()
* @see watchface_complication_allowed_list_add()
diff --git a/watchface-complication/include/watchface-editable-internal.h b/watchface-complication/include/watchface-editable-internal.h
index 5ccb414..3e40b2b 100644
--- a/watchface-complication/include/watchface-editable-internal.h
+++ b/watchface-complication/include/watchface-editable-internal.h
@@ -27,17 +27,29 @@
extern "C" {
#endif
+typedef struct editable_color_ *watchface_editable_color_h;
+
+int watchface_editable_candidate_create(bundle **candidate, const char *name);
+int watchface_editable_candidate_get_name(bundle* candidate, char** name);
+int watchface_editable_candidate_set_color(bundle *candidate, watchface_editable_color_h color);
+int watchface_editable_candidate_get_color(bundle *candidate, watchface_editable_color_h *color);
+int watchface_editable_candidate_color_create(watchface_editable_color_h *color, int r, int g, int b, int a);
+int watchface_editable_candidate_color_get(watchface_editable_color_h color, int *r, int *g, int *b, int *a);
+int watchface_editable_candidate_color_destroy(watchface_editable_color_h color);
+int watchface_editable_candidate_set_preview_image(bundle *candidate, const char *path);
+int watchface_editable_candidate_get_preview_image(bundle *candidate, char **path);
+
/**
- * @brief Gets current editable container
+ * @brief Gets current editable container.
* @since_tizen 5.0
* @remarks Created candidates list should be destroyed after used.
* @param[out] container The editable container
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O Error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
{
diff --git a/watchface-complication/include/watchface-editable.h b/watchface-complication/include/watchface-editable.h
index eb2f508..8f17b87 100644
--- a/watchface-complication/include/watchface-editable.h
+++ b/watchface-complication/include/watchface-editable.h
@@ -121,9 +121,9 @@ typedef struct complication_candidates_list_ *complication_candidates_list_h;
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_candidates_list_add()
* @see watchface_editable_candidates_list_destroy()
* @see watchface_editable_add_design_element()
@@ -152,9 +152,9 @@ int watchface_editable_candidates_list_create(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_candidates_list_create()
* @see watchface_editable_candidates_list_destroy()
* @see watchface_editable_add_design_element()
@@ -204,8 +204,8 @@ int watchface_editable_candidates_list_add(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_editable_candidates_list_add()
* @see watchface_editable_candidates_list_create()
* @see watchface_editable_add_design_element()
@@ -264,10 +264,10 @@ int watchface_editable_candidates_list_destroy(
* @param[in] editable_name Name of editable
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID The given @a editable_id already exists
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_edit_ready_cb()
* @see watchface_editable_candidates_list_add()
* @see watchface_editable_candidates_list_create()
@@ -331,9 +331,9 @@ int watchface_editable_add_design_element(watchface_editable_container_h handle,
* @param[in] highlight Highlight information. It could be NULL
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID The given @a editable_id already exists
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_EXIST_ID The given @a editable_id already exists
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -366,12 +366,11 @@ int watchface_editable_add_complication(watchface_editable_container_h handle,
* @param[in] user_data The user data to pass to the callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O Error
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
- * @see watchface_editable_request_edit()
* @see watchface_editable_update_requested_cb()
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_create()
@@ -425,10 +424,10 @@ int watchface_editable_request_edit(watchface_editable_container_h handle,
* @param[in] user_data The user data to pass to the callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O Error
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_edit_ready_cb()
* @par Sample code:
* @code
@@ -447,8 +446,8 @@ int watchface_editable_add_edit_ready_cb(watchface_editable_edit_ready_cb cb,
* @param[in] cb The callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_editable_edit_ready_cb()
* @par Sample code:
* @code
@@ -468,10 +467,10 @@ int watchface_editable_remove_edit_ready_cb(watchface_editable_edit_ready_cb cb)
* @param[out] editable_name Name of editable
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -500,8 +499,8 @@ int watchface_editable_get_editable_name(const watchface_editable_h handle,
* @param[in] editable_name Name of editable
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -530,10 +529,10 @@ int watchface_editable_set_editable_name(const watchface_editable_h handle,
* @param[in] nth_data Bundle data
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -564,10 +563,10 @@ int watchface_editable_get_nth_data(const watchface_editable_h handle, int n,
* @param[out] cur_data Current data of bundle type
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -596,8 +595,8 @@ int watchface_editable_get_current_data(const watchface_editable_h handle,
* @param[in] idx Index
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -623,8 +622,8 @@ int watchface_editable_get_current_data_idx(const watchface_editable_h handle, i
* @param[out] editable_id Id
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -652,11 +651,11 @@ int watchface_editable_get_editable_id(const watchface_editable_h handle,
* @param[in] current_data Bundle data containing current information
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data available
* @retval #WATCHFACE_COMPLICATION_ERROR_DB Database error
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-editable.h>
@@ -680,9 +679,9 @@ int watchface_editable_load_current_data(int editable_id,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_get_geometry()
* @see watchface_editable_highlight_set_shape_type()
@@ -712,9 +711,9 @@ int watchface_editable_highlight_create(watchface_editable_highlight_h *handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_create()
* @see watchface_editable_highlight_get_geometry()
* @see watchface_editable_highlight_set_shape_type()
@@ -746,9 +745,9 @@ int watchface_editable_highlight_set_geometry(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_create()
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_set_shape_type()
@@ -778,9 +777,9 @@ int watchface_editable_highlight_get_geometry(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_create()
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_get_geometry()
@@ -810,13 +809,12 @@ int watchface_editable_highlight_set_shape_type(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_create()
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_get_geometry()
- * @see watchface_editable_highlight_get_shape_type()
* @see watchface_editable_highlight_destroy()
* @see watchface_editable_get_highlight()
* @par Sample code:
@@ -842,14 +840,13 @@ int watchface_editable_highlight_get_shape_type(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_create()
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_set_shape_type()
* @see watchface_editable_highlight_get_shape_type()
- * @see watchface_editable_highlight_destroy()
* @see watchface_editable_get_highlight()
* @par Sample code:
* @code
@@ -867,14 +864,15 @@ int watchface_editable_highlight_destroy(watchface_editable_highlight_h handle);
/**
* @brief Gets editable's highlight handle.
* @since_tizen 5.0
+ * @remarks The @highlight should be release usinig watchface_editable_highlight_destroy().
* @param[in] handle The editable handle
* @param[out] highlight The editable's highlight handle
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editable_highlight_create()
* @see watchface_editable_highlight_set_geometry()
* @see watchface_editable_highlight_get_geometry()
@@ -888,6 +886,8 @@ int watchface_editable_highlight_destroy(watchface_editable_highlight_h handle);
watchface_editable_highlight_h handle;
int ret = watchface_editable_get_highlight(ed, &handle);
+
+ watchface_editable_highlight_destroy(handle);
}
* @endcode
*/
diff --git a/watchface-complication/package-manager-interface.h b/watchface-complication/package-manager-interface.h
index c1ce353..c6041f8 100644
--- a/watchface-complication/package-manager-interface.h
+++ b/watchface-complication/package-manager-interface.h
@@ -31,7 +31,6 @@ class IPackageManager {
virtual void Watch(IPackageEvent* pe) = 0;
virtual void UnWatch(IPackageEvent* pe) = 0;
virtual bool CheckDisabled(const std::string& appid) = 0;
-
};
} // namespace watchface_complication
diff --git a/watchface-complication/package-manager-mock.h b/watchface-complication/package-manager-mock.h
deleted file mode 100644
index 7a50d1a..0000000
--- a/watchface-complication/package-manager-mock.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef WATCHFACE_COMPLICATION_PACKAGE_MANAGER_MOCK_H_
-#define WATCHFACE_COMPLICATION_PACKAGE_MANAGER_MOCK_H_
-
-#include <unistd.h>
-#include <dlog.h>
-
-#include <memory>
-#include <list>
-
-#include "watchface-common/watchface-util.h"
-#include "watchface-complication/gdbus-interface.h"
-
-#define COMPLICATION_INTERFACE "org.tizen.watchface_complication"
-
-namespace watchface_complication {
-namespace test {
-
-class PackageManagerMock : public IPackageManager {
- public:
- PackageManagerMock() {
- }
-
- void Watch(IPackageEvent* pe) override {
- pe_list_.push_back(pe);
- if (event_timer_ > 0)
- g_source_remove(event_timer_);
-
- event_timer_ = g_timeout_add(1000, [](gpointer user_data)->gboolean {
- PackageManagerMock* mock = static_cast<PackageManagerMock*>(user_data);
- static int seq = 0;
- for (IPackageManager::IPackageEvent* pe : mock->pe_list_) {
- if (seq++ % 2 == 0)
- pe->OnAppDisabled("org.tizen.gmock_comp_provider");
- else
- pe->OnAppUninstalled("org.tizen.gmock_comp_provider");
- }
- return G_SOURCE_CONTINUE;
- }, this);
- }
-
- void UnWatch(IPackageEvent* pe) override {
- for (IPackageManager::IPackageEvent* i : pe_list_) {
- if (i == pe) {
- pe_list_.remove(i);
- if (event_timer_ > 0) {
- g_source_remove(event_timer_);
- }
- return;
- }
- }
- }
-
- bool CheckDisabled(const std::string& appid) override {
- return true;
- }
-
- ~PackageManagerMock() {
- }
-
- public:
- std::list<IPackageEvent*> pe_list_;
-
- private:
- unsigned int event_timer_ = 0;
-};
-
-} // namespace test
-} // namespace watchface_complication
-
-#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_MOCK_H_ \ No newline at end of file
diff --git a/watchface-complication/package-manager.h b/watchface-complication/package-manager.h
index b926e61..7ba04cb 100644
--- a/watchface-complication/package-manager.h
+++ b/watchface-complication/package-manager.h
@@ -22,6 +22,7 @@
#include <memory>
#include <list>
+#include <string>
namespace watchface_complication {
@@ -43,9 +44,8 @@ class PackageManager : public IPackageManager {
return true;
}
private:
-
};
} // namespace watchface_complication
-#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_ \ No newline at end of file
+#endif // WATCHFACE_COMPLICATION_PACKAGE_MANAGER_H_
diff --git a/watchface-complication/received-editable-implementation.h b/watchface-complication/received-editable-implementation.h
index be42d5f..efa315e 100644
--- a/watchface-complication/received-editable-implementation.h
+++ b/watchface-complication/received-editable-implementation.h
@@ -18,6 +18,7 @@
#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_IMPLEMENTATION_H_
#include <gio/gio.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -42,8 +43,8 @@ class ReceivedEditable::Impl {
private:
ReceivedEditable* parent_;
int id_ = -1;
- Bundle* cur_data_ = nullptr;
- std::list<std::unique_ptr<Bundle>> candidates_list_;
+ tizen_base::Bundle* cur_data_ = nullptr;
+ std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list_;
std::unique_ptr<IEditable::Highlight> highlight_;
EditableShapeType shape_type_ = Circle;
std::string name_;
@@ -51,8 +52,8 @@ class ReceivedEditable::Impl {
int cur_data_idx_ = -1;
int last_data_idx_ = -1;
IEditable::EditableState ed_state_ = Complete;
- std::unique_ptr<Bundle> context_data_;
- std::unique_ptr<Bundle> last_context_data_ = nullptr;
+ std::unique_ptr<tizen_base::Bundle> context_data_;
+ std::unique_ptr<tizen_base::Bundle> last_context_data_;
};
} // namespace watchface_complication
diff --git a/watchface-complication/received-editable.cc b/watchface-complication/received-editable.cc
index 7723e90..902976a 100644
--- a/watchface-complication/received-editable.cc
+++ b/watchface-complication/received-editable.cc
@@ -17,6 +17,7 @@
#include <glib.h>
#include <unistd.h>
#include <utility>
+#include <vector>
#include "watchface-complication/received-editable.h"
#include "watchface-complication/received-editable-implementation.h"
@@ -29,6 +30,8 @@
#define LOG_TAG "WATCHFACE_COMPLICATION"
#define MAX_PACKAGE_STR_SIZE 512
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
ReceivedEditable::ReceivedEditable(std::string raw)
@@ -40,98 +43,69 @@ ReceivedEditable::Impl::Impl(ReceivedEditable* parent, std::string raw)
: parent_(parent) {
if (raw.empty())
THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
-
- bundle* data = NULL;
try {
- data = bundle_decode(
- reinterpret_cast<const bundle_raw*>(
- raw.c_str()), raw.length());
- const char** str_arr = NULL;
- int len = 0;
- char* val = NULL;
-
- str_arr = bundle_get_str_array(data, "CANDIDATES_LIST", &len);
- for (int i = 0; i < len; i++) {
- LOGD("%s", str_arr[i]);
- candidates_list_.emplace_back(new Bundle(str_arr[i]));
+ Bundle data(raw);
+ vector<string> candidate_list = data.GetStringArray("CANDIDATES_LIST");
+ for (auto& i : candidate_list) {
+ LOGD("%s", i.c_str());
+ candidates_list_.emplace_back(new Bundle(i));
}
- char* cur_data_idx_str = NULL;
- int ret = bundle_get_str(data, "CUR_DATA_IDX", &cur_data_idx_str);
- if (ret != BUNDLE_ERROR_NONE)
- THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
- cur_data_idx_ = atoi(cur_data_idx_str);
-
- char* setup_appid = NULL;
- ret = bundle_get_str(data, "SETUP_APPID", &setup_appid);
- if (ret == BUNDLE_ERROR_NONE)
- setup_appid_ = std::string(setup_appid);
- else
- setup_appid_ = "";
-
- char* editable_id_str = NULL;
- ret = bundle_get_str(data, "EDITABLE_ID", &editable_id_str);
- if (ret != BUNDLE_ERROR_NONE)
+ string cur_data_idx_str = data.GetString("CUR_DATA_IDX");
+ if (cur_data_idx_str.empty())
THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
- id_ = atoi(editable_id_str);
+ cur_data_idx_ = stoi(cur_data_idx_str);
- ret = bundle_get_str(data, "GEO_X", &val);
- if (ret == BUNDLE_ERROR_NONE) {
- int x = atoi(val);
+ setup_appid_ = data.GetString("SETUP_APPID");
+ string editable_id_str = data.GetString("EDITABLE_ID");
+ if (editable_id_str.empty())
+ THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
+ id_ = stoi(editable_id_str);
- ret = bundle_get_str(data, "GEO_Y", &val);
- if (ret != BUNDLE_ERROR_NONE)
+ string val = data.GetString("GEO_X");
+ if (!val.empty()) {
+ int x = stoi(val);
+ val = data.GetString("GEO_Y");
+ if (val.empty())
THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
- int y = atoi(val);
-
- ret = bundle_get_str(data, "GEO_W", &val);
- if (ret != BUNDLE_ERROR_NONE)
+ int y = stoi(val);
+ val = data.GetString("GEO_W");
+ if (val.empty())
THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
- int w = atoi(val);
-
- ret = bundle_get_str(data, "GEO_H", &val);
- if (ret != BUNDLE_ERROR_NONE)
+ int w = stoi(val);
+ val = data.GetString("GEO_H");
+ if (val.empty())
THROW(WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER);
- int h = atoi(val);
-
+ int h = stoi(val);
Geometry geo(x, y, w, h);
highlight_ = std::unique_ptr<IEditable::Highlight>(new IEditable::Highlight());
highlight_->SetGeometry(geo);
}
- ret = bundle_get_str(data, "SHAPE_TYPE", &val);
- if (ret == BUNDLE_ERROR_NONE) {
- if (highlight_.get() == NULL)
+ val = data.GetString("SHAPE_TYPE");
+ if (!val.empty()) {
+ if (highlight_.get() == nullptr) {
highlight_ = std::unique_ptr<IEditable::Highlight>(
new IEditable::Highlight());
+ }
highlight_->SetShapeType(
- static_cast<IEditable::EditableShapeType>(atoi(val)));
+ static_cast<IEditable::EditableShapeType>(stoi(val)));
}
-
- ret = bundle_get_str(data, "NAME", &val);
- if (ret != BUNDLE_ERROR_NONE)
- name_ = "";
- else
- name_ = std::string(val);
-
+ name_ = data.GetString("NAME");
} catch (const std::bad_alloc &ba) {
- if (data)
- bundle_free(data);
LOGE("ReceivedEditable::Exception bad_alloc");
THROW(WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY);
} catch (Exception &ex) {
- if (data)
- bundle_free(data);
LOGE("%s %d", ex.what(), ex.GetErrorCode());
THROW(ex.GetErrorCode());
}
}
-int ReceivedEditable::GetEditableId() {
+int ReceivedEditable::GetEditableId() const {
return impl_->id_;
}
@@ -145,25 +119,27 @@ int ReceivedEditable::SetHighlight(std::unique_ptr<IEditable::Highlight> highlig
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-IEditable::Highlight* ReceivedEditable::GetHighlight() {
+IEditable::Highlight* ReceivedEditable::GetHighlight() const {
return impl_->highlight_.get();
}
+/* LCOV_EXCL_START */
int ReceivedEditable::SetCandidates(
- std::list<std::unique_ptr<Bundle>> candidates_list) {
+ std::list<std::shared_ptr<Bundle>> candidates_list) {
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
-std::list<std::unique_ptr<Bundle>> const& ReceivedEditable::GetCandidates()
+std::list<std::shared_ptr<Bundle>> const& ReceivedEditable::GetCandidates()
const {
return impl_->candidates_list_;
}
-int ReceivedEditable::GetLastDataIdx() {
+int ReceivedEditable::GetLastDataIdx() const {
return impl_->last_data_idx_;
}
-int ReceivedEditable::GetCurDataIdx() {
+int ReceivedEditable::GetCurDataIdx() const {
return impl_->cur_data_idx_;
}
@@ -172,27 +148,24 @@ int ReceivedEditable::UpdateLastData() {
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-const Bundle* ReceivedEditable::GetCurData() {
+shared_ptr<Bundle> ReceivedEditable::GetCurData() const {
if (impl_->candidates_list_.size() == 0 || impl_->cur_data_idx_ < 0)
- return NULL;
- std::list<std::unique_ptr<Bundle>>::iterator it
+ return shared_ptr<Bundle>({});
+ std::list<std::shared_ptr<Bundle>>::iterator it
= impl_->candidates_list_.begin();
LOGI("get cur data %d", impl_->cur_data_idx_);
- auto nx = std::next(it, impl_->cur_data_idx_);
- return nx->get();
+ return *std::next(it, impl_->cur_data_idx_);
}
-const Bundle* ReceivedEditable::GetNthData(int nth) {
+shared_ptr<Bundle> ReceivedEditable::GetNthData(int nth) const {
if (static_cast<int>(impl_->candidates_list_.size()) <= nth || nth < 0)
- return NULL;
+ return shared_ptr<Bundle>({});
- std::list<std::unique_ptr<Bundle>>::iterator it
+ std::list<std::shared_ptr<Bundle>>::iterator it
= impl_->candidates_list_.begin();
-
LOGI("get nth data %d", nth);
- auto nx = std::next(it, nth);
- return nx->get();
+ return *std::next(it, nth);
}
int ReceivedEditable::SetCurDataIdx(int cur_data_idx) {
@@ -206,7 +179,7 @@ int ReceivedEditable::SetCurDataIdx(int cur_data_idx) {
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
-const std::string& ReceivedEditable::GetLabel() {
+const std::string& ReceivedEditable::GetLabel() const {
return impl_->name_;
}
@@ -225,11 +198,11 @@ void ReceivedEditable::SetState(IEditable::EditableState state) {
impl_->ed_state_ = state;
}
-IEditable::EditableState ReceivedEditable::GetState() {
+IEditable::EditableState ReceivedEditable::GetState() const {
return impl_->ed_state_;
}
-const std::string ReceivedEditable::GetSetupAppId() {
+std::string ReceivedEditable::GetSetupAppId() const {
return impl_->setup_appid_;
}
@@ -244,20 +217,17 @@ std::unique_ptr<Bundle>& ReceivedEditable::GetContext() const {
}
int ReceivedEditable::UpdateLastContext() {
- if (impl_->context_data_.get() == NULL) {
+ if (impl_->context_data_.get() == nullptr) {
LOGI("Empty context");
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
try {
- impl_->last_context_data_.reset(
- new Bundle((impl_->context_data_.get())->GetRaw()));
- } catch (const std::bad_alloc &ba) {
- LOGE("Bundle::Exception bad_alloc");
+ Bundle* ctx = new Bundle(impl_->context_data_->GetHandle());
+ impl_->last_context_data_.reset(ctx);
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
}
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
diff --git a/watchface-complication/received-editable.h b/watchface-complication/received-editable.h
index f96e878..a41486f 100644
--- a/watchface-complication/received-editable.h
+++ b/watchface-complication/received-editable.h
@@ -18,6 +18,7 @@
#define WATCHFACE_COMPLICATION_RECEIVED_EDITABLE_H_
#include <gio/gio.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -38,28 +39,28 @@ class EXPORT_API ReceivedEditable : public IEditable {
public:
int SetHighlight(std::unique_ptr<IEditable::Highlight> highlight) override;
- IEditable::Highlight* GetHighlight() override;
- std::list<std::unique_ptr<Bundle>> const& GetCandidates() const override;
- int SetCandidates(std::list<std::unique_ptr<Bundle>> candidates_list) override;
- const Bundle* GetCurData() override;
- const Bundle* GetNthData(int nth) override;
- int GetCurDataIdx() override;
+ IEditable::Highlight* GetHighlight() const override;
+ std::list<std::shared_ptr<tizen_base::Bundle>> const& GetCandidates() const override;
+ int SetCandidates(std::list<std::shared_ptr<tizen_base::Bundle>> candidates_list) override;
+ std::shared_ptr<tizen_base::Bundle> GetCurData() const override;
+ std::shared_ptr<tizen_base::Bundle> GetNthData(int nth) const override;
+ int GetCurDataIdx() const override;
int SetCurDataIdx(int cur_data_idx) override;
- int GetLastDataIdx() override;
+ int GetLastDataIdx() const override;
int UpdateLastData() override;
- const std::string& GetLabel() override;
+ const std::string& GetLabel() const override;
void OnEditableUpdated(int selected_idx,
IEditable::EditableState state) override;
- int GetEditableId() override;
+ int GetEditableId() const override;
int SetEditableId(int id) override;
void SetLabel(const std::string& name) override;
void SetState(IEditable::EditableState state) override;
- IEditable::EditableState GetState() override;
- int SetContext(std::unique_ptr<Bundle> context) override;
- std::unique_ptr<Bundle>& GetContext() const override;
+ IEditable::EditableState GetState() const override;
+ int SetContext(std::unique_ptr<tizen_base::Bundle> context) override;
+ std::unique_ptr<tizen_base::Bundle>& GetContext() const override;
int UpdateLastContext() override;
- std::unique_ptr<Bundle>& GetLastContext() const override;
- const std::string GetSetupAppId() override;
+ std::unique_ptr<tizen_base::Bundle>& GetLastContext() const override;
+ std::string GetSetupAppId() const override;
private:
class Impl;
diff --git a/watchface-complication/watchface-complication.cc b/watchface-complication/watchface-complication.cc
index c892ea6..0f60a97 100644
--- a/watchface-complication/watchface-complication.cc
+++ b/watchface-complication/watchface-complication.cc
@@ -20,11 +20,12 @@
#include <glib.h>
#include <math.h>
#include <gio/gio.h>
+#include <sys/time.h>
+#include <utils_i18n.h>
#include <aul.h>
#include <dlog.h>
-#include "watchface-common/watchface-util.h"
#include "watchface-complication/include/watchface-complication.h"
#include "watchface-complication/include/watchface-complication-internal.h"
#include "watchface-complication/complication.h"
@@ -42,6 +43,8 @@ struct complication_allowed_list_ {
GList* allowed_list;
};
+using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
class CallbackInfo {
public:
@@ -50,12 +53,33 @@ class CallbackInfo {
: cb_(cb), error_cb_(error_cb), user_data_(user_data) {
}
+ CallbackInfo(CallbackInfo&& c) noexcept {
+ cb_ = c.cb_;
+ error_cb_ = c.error_cb_;
+ user_data_ = c.user_data_;
+ c.cb_ = nullptr;
+ c.error_cb_ = nullptr;
+ c.user_data_ = nullptr;
+ }
+
+ CallbackInfo& operator = (CallbackInfo&& c) noexcept {
+ if (this != &c) {
+ cb_ = c.cb_;
+ error_cb_ = c.error_cb_;
+ user_data_ = c.user_data_;
+ c.cb_ = nullptr;
+ c.error_cb_ = nullptr;
+ c.user_data_ = nullptr;
+ }
+ return *this;
+ }
+
void Invoke(int complication_id,
const std::string& provider_id,
ComplicationType type, const std::unique_ptr<Bundle>& data) {
cb_(complication_id,
provider_id.c_str(), static_cast<watchface_complication_type_e>(type),
- data.get() == NULL ? NULL : data.get()->GetConstRaw(), user_data_);
+ data.get() == nullptr ? nullptr : data.get()->GetHandle(), user_data_);
}
void InvokeErrorCallback(int complication_id,
@@ -109,7 +133,7 @@ class WatchComplicationStub : public Complication {
const std::string& default_provider_id,
ComplicationType default_type)
: Complication(id, supported_types, supported_event_types,
- default_provider_id, default_type, false) {
+ default_provider_id, default_type) {
}
/* LCOV_EXCL_START */
void OnProviderError(const std::string& provider_id, ComplicationType type,
@@ -129,14 +153,14 @@ class WatchComplicationStub : public Complication {
LOGI("update call!! done");
}
- int AddCallbackInfo(CallbackInfo* ci) {
+ int AddCallbackInfo(unique_ptr<CallbackInfo> ci) {
for (auto& i : cb_list_) {
if (i.get()->GetCallback() == ci->GetCallback()) {
LOGI("already registered callback");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
}
- cb_list_.emplace_back(ci);
+ cb_list_.emplace_back(move(ci));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -160,48 +184,24 @@ extern "C" EXPORT_API int watchface_complication_add_updated_cb(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || cb == NULL || error_cb == NULL)
+ if (handle == nullptr || cb == nullptr || error_cb == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
static cynara_result pcr = COMPLICATION_CYNARA_UNKNOWN;
- int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
-
- if (pcr == COMPLICATION_CYNARA_DENIED) {
- LOGE("Permission denied");
- return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
- } else if (pcr == COMPLICATION_CYNARA_UNKNOWN) {
- ret = watchface_complication::util::CheckPrivilege(PRIVILEGE_DATASHARING);
- if (ret == WATCHFACE_COMPLICATION_ERROR_NONE) {
- pcr = COMPLICATION_CYNARA_ALLOWED;
- } else if (ret == WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED) {
- pcr = COMPLICATION_CYNARA_DENIED;
- return ret;
- } else {
- return ret;
- }
- }
-
+ int ret = util::CheckPrivilege(PRIVILEGE_DATASHARING, &pcr);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
-
- CallbackInfo* ci = nullptr;
- try {
- ci = new CallbackInfo(cb, error_cb, user_data);
- ret = ptr.get()->AddCallbackInfo(ci);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
- delete ci;
- return ret;
- }
- } catch (const std::bad_alloc &ba) {
- LOGE("WatchComplicationProviderStub::Exception bad_alloc");
- if (ci != nullptr)
- delete ci;
+ unique_ptr<CallbackInfo> ci = unique_ptr<CallbackInfo>(
+ new (std::nothrow) CallbackInfo(cb, error_cb, user_data));
+ if (ci.get() == nullptr) {
+ LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- delete ci;
- return ex.GetErrorCode();
}
+ ret = ptr.get()->AddCallbackInfo(move(ci));
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
return ret;
}
@@ -210,7 +210,7 @@ extern "C" EXPORT_API int watchface_complication_remove_updated_cb(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || cb == NULL)
+ if (handle == nullptr || cb == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
@@ -224,7 +224,7 @@ extern "C" EXPORT_API int watchface_complication_send_update_request(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL)
+ if (handle == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
LOGI("update call!!");
@@ -266,12 +266,12 @@ extern "C" EXPORT_API int watchface_complication_create(int complication_id,
}
if (default_type != WATCHFACE_COMPLICATION_TYPE_NO_DATA
- && default_provider_id == NULL) {
+ && default_provider_id == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- if (created_handle == NULL)
+ if (created_handle == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
try {
@@ -301,7 +301,7 @@ extern "C" EXPORT_API int watchface_complication_destroy(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL)
+ if (handle == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
@@ -315,18 +315,18 @@ extern "C" EXPORT_API int watchface_complication_get_current_provider_id(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || cur_provider_id == NULL)
+ if (handle == nullptr || cur_provider_id == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
char* tmp;
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
auto ptr = SharedHandle<WatchComplicationStub>::Share(sh);
- if (ptr.get()->GetCurProviderId() == NULL)
+ if (ptr.get()->GetCurProviderId().empty())
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
- LOGI("provider id : %s", ptr.get()->GetCurProviderId());
- tmp = strdup(ptr.get()->GetCurProviderId());
- if (tmp == NULL)
+ LOGI("provider id : %s", ptr.get()->GetCurProviderId().c_str());
+ tmp = strdup(ptr.get()->GetCurProviderId().c_str());
+ if (tmp == nullptr)
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
*cur_provider_id = tmp;
@@ -339,7 +339,7 @@ extern "C" EXPORT_API int watchface_complication_get_current_type(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || cur_type == NULL)
+ if (handle == nullptr || cur_type == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
auto sh = static_cast<SharedHandle<WatchComplicationStub>*>(handle);
@@ -358,13 +358,13 @@ extern "C" EXPORT_API int watchface_complication_get_current_type(
extern "C" EXPORT_API int watchface_complication_data_get_type(
const bundle* data, watchface_complication_type_e* type) {
- char* type_str = NULL;
+ char* type_str = nullptr;
int ret;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || type == NULL) {
+ if (data == nullptr || type == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -375,7 +375,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_type(
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
}
- int comp_type = strtol(type_str, NULL, 10);
+ int comp_type = strtol(type_str, nullptr, 10);
if (!util::CheckComplicationType(comp_type)) {
LOGE("Invalid param : type_str(%s)", type_str);
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -386,10 +386,10 @@ extern "C" EXPORT_API int watchface_complication_data_get_type(
static int __get_complication_data(const bundle* data, const char* key,
char** text) {
- char* value = NULL;
+ char* value = nullptr;
int ret;
- if (key == NULL) {
+ if (key == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -401,7 +401,7 @@ static int __get_complication_data(const bundle* data, const char* key,
}
*text = strdup(value);
- if (*text == NULL) {
+ if (*text == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -414,7 +414,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_short_text(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || short_text == NULL) {
+ if (data == nullptr || short_text == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -427,7 +427,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_long_text(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || long_text == NULL) {
+ if (data == nullptr || long_text == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -440,7 +440,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_title(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || title == NULL) {
+ if (data == nullptr || title == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -451,12 +451,12 @@ extern "C" EXPORT_API int watchface_complication_data_get_title(
extern "C" EXPORT_API int watchface_complication_data_get_timestamp(
const bundle* data, long* timestamp) {
int ret;
- char* time_str = NULL;
+ char* time_str = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || timestamp == NULL) {
+ if (data == nullptr || timestamp == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -466,14 +466,235 @@ extern "C" EXPORT_API int watchface_complication_data_get_timestamp(
LOGE("failed to get time %d", ret);
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
}
- *timestamp = strtol(time_str, NULL, 10);
+ *timestamp = strtol(time_str, nullptr, 10);
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+static int __get_dup_string_from_bundle(const bundle* data,
+ const char* key, char** dup_str) {
+ char* str;
+ int ret = bundle_get_str(const_cast<bundle*>(data), key, &str);
+ if (ret == BUNDLE_ERROR_KEY_NOT_AVAILABLE) {
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+ } else if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("failed to get data %d", ret);
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ *dup_str = strdup(str);
+ if (*dup_str == nullptr) {
+ LOGE("Out of memory");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_data_get_timeinfo(
+ const bundle* data, complication_time_info_h* info) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (data == nullptr || info == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ complication_time_info_h h = (complication_time_info_h)calloc(1,
+ sizeof(struct complication_time_info_s));
+ if (h == nullptr) {
+ LOGE("Out of memory");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+
+ int ret = __get_dup_string_from_bundle(data, TIME_ZONE_KEY, &h->timezone);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NO_DATA &&
+ ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
+ watchface_complication_timeinfo_destroy(h);
+ return ret;
+ }
+
+ ret = __get_dup_string_from_bundle(data, TIME_ZONE_ID_KEY, &h->timezone_id);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NO_DATA &&
+ ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
+ watchface_complication_timeinfo_destroy(h);
+ return ret;
+ }
+
+ ret = __get_dup_string_from_bundle(data, TIME_COUNTRY_KEY, &h->country);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NO_DATA &&
+ ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
+ watchface_complication_timeinfo_destroy(h);
+ return ret;
+ }
+
+ ret = __get_dup_string_from_bundle(data, TIME_CITY_KEY, &h->city);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NO_DATA &&
+ ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
+ watchface_complication_timeinfo_destroy(h);
+ return ret;
+ }
+
+ if (h->timezone == nullptr && h->timezone_id == nullptr &&
+ h->country == nullptr && h->city == nullptr) {
+ watchface_complication_timeinfo_destroy(h);
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+ }
+ *info = h;
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
+extern "C" EXPORT_API int watchface_complication_timeinfo_get_timezone(
+ complication_time_info_h info, char** timezone) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || timezone == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->timezone == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+
+ char* str = strdup(info->timezone);
+ if (str == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ *timezone = str;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_timeinfo_get_timezone_id(
+ complication_time_info_h info, char** timezone_id) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || timezone_id == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->timezone_id == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+
+ char* str = strdup(info->timezone_id);
+ if (str == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ *timezone_id = str;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_timeinfo_get_timezone_country(
+ complication_time_info_h info, char** country) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || country == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->country == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+
+ char* str = strdup(info->country);
+ if (str == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ *country = str;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_timeinfo_get_timezone_city(
+ complication_time_info_h info, char** city) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || city == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ if (info->city == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+
+ char* str = strdup(info->city);
+ if (str == nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ *city = str;
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+static int __get_timestamp(complication_time_info_h info, time_t* timestamp) {
+ static i18n_timezone_h tmz;
+ int err = i18n_timezone_detect_host_timezone(&tmz);
+ if (err != 0) {
+ LOGE("Fail to get timezone !!");
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ int32_t host_offset;
+ err = i18n_timezone_get_raw_offset(tmz, &host_offset);
+ if (err != 0) {
+ LOGE("Fail to get timezone offset !!");
+ i18n_timezone_destroy(tmz);
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ i18n_timezone_destroy(tmz);
+ err = i18n_timezone_create(&tmz, info->timezone_id);
+ if (err != 0) {
+ LOGE("Fail to get timezone !!");
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ int32_t offset;
+ err = i18n_timezone_get_raw_offset(tmz, &offset);
+ if (err != 0) {
+ LOGE("Fail to get timezone offset !!");
+ i18n_timezone_destroy(tmz);
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ struct timeval current;
+ gettimeofday(&current, nullptr);
+ *timestamp = current.tv_sec + ((offset - host_offset) / 1000);
+ i18n_timezone_destroy(tmz);
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_complication_timeinfo_get_timestamp(
+ complication_time_info_h info, time_t* timestamp) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr || info->timezone_id == nullptr || timestamp == nullptr) {
+ LOGE("Invalid param !!");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return __get_timestamp(info, timestamp);
+}
+
+extern "C" EXPORT_API int watchface_complication_timeinfo_destroy(
+ complication_time_info_h info) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (info == nullptr) {
+ LOGE("Invalid param");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ watchface_complication::util::DestroyTimeInfo(
+ (struct complication_time_info_s*)info);
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
extern "C" EXPORT_API int watchface_complication_data_get_image_path(
const bundle* data, char** image_path) {
- if (data == NULL || image_path == NULL) {
+ if (data == nullptr || image_path == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -485,15 +706,15 @@ extern "C" EXPORT_API int watchface_complication_data_get_ranged_value(
const bundle* data, double* current_value, double* min_value,
double* max_value) {
int ret;
- char* current_value_str = NULL;
- char* min_value_str = NULL;
- char* max_value_str = NULL;
+ char* current_value_str = nullptr;
+ char* min_value_str = nullptr;
+ char* max_value_str = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || current_value == NULL || min_value == NULL
- || max_value == NULL) {
+ if (data == nullptr || current_value == nullptr || min_value == nullptr
+ || max_value == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -519,16 +740,16 @@ extern "C" EXPORT_API int watchface_complication_data_get_ranged_value(
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
}
- *current_value = strtod(current_value_str, NULL);
- *min_value = strtod(min_value_str, NULL);
- *max_value = strtod(max_value_str, NULL);
+ *current_value = strtod(current_value_str, nullptr);
+ *min_value = strtod(min_value_str, nullptr);
+ *max_value = strtod(max_value_str, nullptr);
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int watchface_complication_data_get_icon_path(
const bundle* data, char** icon_path) {
- if (data == NULL || icon_path == NULL) {
+ if (data == nullptr || icon_path == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -541,7 +762,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_extra_data(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || extra_data == NULL) {
+ if (data == nullptr || extra_data == nullptr) {
LOGE("Invalid param !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -554,7 +775,7 @@ extern "C" EXPORT_API int watchface_complication_data_get_screen_reader_text(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (data == NULL || screen_reader_text == NULL) {
+ if (data == nullptr || screen_reader_text == nullptr) {
LOGE("Invalid data !!");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -567,7 +788,7 @@ extern "C" EXPORT_API int watchface_complication_transfer_event(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL ||
+ if (handle == nullptr ||
!(event_type == WATCHFACE_COMPLICATION_EVENT_TAP
|| event_type == WATCHFACE_COMPLICATION_EVENT_DOUBLE_TAP))
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -592,19 +813,19 @@ static void __free_provider_info(gpointer data) {
extern "C" EXPORT_API int watchface_complication_allowed_list_create(
complication_allowed_list_h* handle) {
- complication_allowed_list_h h = NULL;
+ complication_allowed_list_h h = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL) {
+ if (handle == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
h = (complication_allowed_list_h)calloc(1,
sizeof(struct complication_allowed_list_));
- if (h == NULL) {
+ if (h == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -619,7 +840,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_destroy(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL) {
+ if (handle == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -634,7 +855,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_destroy(
static gint __provider_info_cmp(gconstpointer a, gconstpointer b) {
provider_info* data = (provider_info*)a;
const char* provider_id = (const char*)b;
- if (data == NULL || data->provider_id == NULL)
+ if (data == nullptr || data->provider_id == nullptr)
return -1;
return strcmp(data->provider_id, provider_id);
}
@@ -644,7 +865,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_add(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || provider_id == NULL) {
+ if (handle == nullptr || provider_id == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -658,12 +879,12 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_add(
provider_info* info = reinterpret_cast<provider_info*>(calloc(1,
sizeof(provider_info)));
- if (info == NULL) {
+ if (info == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
info->provider_id = strdup(provider_id);
- if (info->provider_id == NULL) {
+ if (info->provider_id == nullptr) {
LOGE("Out of memory");
free(info);
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
@@ -679,7 +900,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_delete(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || provider_id == NULL || handle->allowed_list == NULL) {
+ if (handle == nullptr || provider_id == nullptr || handle->allowed_list == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -704,8 +925,8 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_get_nth(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || provider_id == NULL || types == NULL ||
- handle->allowed_list == NULL ||
+ if (handle == nullptr || provider_id == nullptr || types == nullptr ||
+ handle->allowed_list == nullptr ||
index >= static_cast<int>(g_list_length(handle->allowed_list)) ||
index < 0) {
LOGE("Invalid param");
@@ -714,12 +935,12 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_get_nth(
provider_info* info =
reinterpret_cast<provider_info*>(g_list_nth_data(handle->allowed_list,
index));
- if (info == NULL || info->provider_id == NULL) {
+ if (info == nullptr || info->provider_id == nullptr) {
LOGE("fail to get provider id");
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
char* id = strdup(info->provider_id);
- if (id == NULL) {
+ if (id == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -734,7 +955,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_apply(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || list_handle == NULL || list_handle->allowed_list == NULL
+ if (handle == nullptr || list_handle == nullptr || list_handle->allowed_list == nullptr
|| g_list_length(list_handle->allowed_list) == 0) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -748,7 +969,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_apply(
provider_info* info =
reinterpret_cast<provider_info*>(g_list_nth_data(
list_handle->allowed_list, i));
- if (info == NULL || info->provider_id == NULL)
+ if (info == nullptr || info->provider_id == nullptr)
continue;
try {
allowed_list.emplace_back(std::unique_ptr<Complication::ProviderInfo>(
@@ -768,7 +989,7 @@ extern "C" EXPORT_API int watchface_complication_allowed_list_clear(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL) {
+ if (handle == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
diff --git a/watchface-complication/watchface-editable.cc b/watchface-complication/watchface-editable.cc
index 57aad0b..8099e5c 100644
--- a/watchface-complication/watchface-editable.cc
+++ b/watchface-complication/watchface-editable.cc
@@ -35,13 +35,16 @@
#define LOG_TAG "WATCHFACE_COMPLICATION"
-using watchface_complication::EditablesContainer;
-using watchface_complication::Bundle;
-using watchface_complication::IEditable;
-using watchface_complication::DesignElement;
-using watchface_complication::SharedHandle;
-using watchface_complication::EditablesManager;
-
+#define CANDIDATE_NAME_KEY "__CANDIDATE_NAME_KEY__"
+#define CANDIDATE_COLOR_R_KEY "__CANDIDATE_COLOR_R_KEY__"
+#define CANDIDATE_COLOR_G_KEY "__CANDIDATE_COLOR_G_KEY__"
+#define CANDIDATE_COLOR_B_KEY "__CANDIDATE_COLOR_B_KEY__"
+#define CANDIDATE_COLOR_A_KEY "__CANDIDATE_COLOR_A_KEY__"
+#define CANDIDATE_PREVIEW_IMAGE_KEY "__CANDIDATE_PREVIEW_IMAGE_KEY__"
+
+using namespace std;
+using namespace tizen_base;
+using namespace watchface_complication;
struct complication_candidates_list_ {
GList* candidates_list;
};
@@ -54,12 +57,26 @@ struct editable_highlight_ {
watchface_editable_shape_type_e shape_type;
};
+struct editable_color_ {
+ int r;
+ int g;
+ int b;
+ int a;
+};
+
class ReadyCallbackInfo {
public:
ReadyCallbackInfo(watchface_editable_edit_ready_cb cb, void* user_data)
: cb_(cb), user_data_(user_data) {
}
+ ReadyCallbackInfo(ReadyCallbackInfo&& b) noexcept {
+ cb_ = b.cb_;
+ user_data_ = b.user_data_;
+ b.cb_ = nullptr;
+ b.user_data_ = nullptr;
+ }
+
void Invoke(void* stub, const std::string& editor_appid) {
cb_(stub, editor_appid.c_str(), user_data_);
}
@@ -79,6 +96,13 @@ class UpdateCallbackInfo {
: cb_(cb), user_data_(user_data) {
}
+ UpdateCallbackInfo(UpdateCallbackInfo&& b) noexcept {
+ cb_ = b.cb_;
+ user_data_ = b.user_data_;
+ b.cb_ = nullptr;
+ b.user_data_ = nullptr;
+ }
+
void Invoke(const void* handle, int selected_idx,
const watchface_editable_edit_state_e state) {
LOGI("call update");
@@ -93,7 +117,7 @@ class UpdateCallbackInfo {
class EditablesContainerStub : public EditablesContainer {
public:
EditablesContainerStub()
- : EditablesContainer(false) {
+ : EditablesContainer() {
}
void OnEditReady(const std::string& editor_id) override {
@@ -111,7 +135,7 @@ class EditablesContainerStub : public EditablesContainer {
}
}
- int AddReadyCallbackInfo(ReadyCallbackInfo* ci) {
+ int AddReadyCallbackInfo(unique_ptr<ReadyCallbackInfo> ci) {
for (auto& i : ready_cb_list_) {
if (i.get()->GetCallback() == ci->GetCallback()) {
LOGI("already registered callback");
@@ -119,7 +143,7 @@ class EditablesContainerStub : public EditablesContainer {
}
}
- ready_cb_list_.emplace_back(ci);
+ ready_cb_list_.emplace_back(move(ci));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -137,8 +161,8 @@ class EditablesContainerStub : public EditablesContainer {
update_cb_list_.clear();
}
- void AddUpdateCallbackInfo(UpdateCallbackInfo* ci) {
- update_cb_list_.emplace_back(ci);
+ void AddUpdateCallbackInfo(unique_ptr<UpdateCallbackInfo> ci) {
+ update_cb_list_.emplace_back(move(ci));
}
private:
@@ -160,7 +184,7 @@ static std::unique_ptr<IEditable::Highlight> __get_highlight_unique_ptr(
}
hi_ptr.get()->SetShapeType(
static_cast<IEditable::EditableShapeType>(highlight->shape_type));
- return std::move(hi_ptr);
+ return hi_ptr;
} catch (const std::bad_alloc &ba) {
LOGE("Highlight::Exception bad_alloc");
return nullptr;
@@ -176,34 +200,29 @@ extern "C" EXPORT_API int watchface_editable_add_design_element(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || list_handle == NULL || editable_name == NULL ||
- list_handle->candidates_list == NULL)
+ if (handle == nullptr || list_handle == nullptr || editable_name == nullptr ||
+ list_handle->candidates_list == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
if (cur_data_idx < 0 &&
cur_data_idx >= static_cast<int>(
g_list_length(list_handle->candidates_list)))
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+
EditablesContainerStub* ec = static_cast<EditablesContainerStub*>(handle);
- bundle* data;
- int str_len = 0;
- int ret;
- bundle_raw* str_raw = NULL;
GList* iter = list_handle->candidates_list;
- std::list<std::unique_ptr<Bundle>> new_list;
+ std::list<std::shared_ptr<Bundle>> new_list;
for (; iter; iter = iter->next) {
- data = reinterpret_cast<bundle*>(iter->data);
- if (data != NULL) {
- ret = bundle_encode(data, &str_raw, &str_len);
- if (ret == BUNDLE_ERROR_NONE && str_raw) {
- new_list.emplace_back(
- new Bundle(std::string(reinterpret_cast<char*>(str_raw))));
- free(str_raw);
- str_raw = NULL;
- } else {
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- }
+ bundle* data = reinterpret_cast<bundle*>(iter->data);
+ if (data == nullptr)
+ continue;
+
+ try {
+ new_list.emplace_back(new Bundle(data));
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
}
@@ -214,7 +233,7 @@ extern "C" EXPORT_API int watchface_editable_add_design_element(
try {
auto de = std::shared_ptr<IEditable>(
- new DesignElement(edit_id, cur_data_idx, false));
+ new DesignElement(edit_id, cur_data_idx));
if (highlight) {
std::unique_ptr<IEditable::Highlight> hi_ptr =
__get_highlight_unique_ptr(highlight);
@@ -223,7 +242,7 @@ extern "C" EXPORT_API int watchface_editable_add_design_element(
de.get()->SetHighlight(std::move(hi_ptr));
}
de.get()->SetLabel(std::string(editable_name));
- ret = de.get()->SetCandidates(std::move(new_list));
+ int ret = de.get()->SetCandidates(new_list);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
@@ -242,7 +261,7 @@ extern "C" EXPORT_API int watchface_editable_add_complication(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || comp == NULL)
+ if (handle == nullptr || comp == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
EditablesContainerStub* ec = static_cast<EditablesContainerStub*>(handle);
@@ -251,7 +270,7 @@ extern "C" EXPORT_API int watchface_editable_add_complication(
/* Update candidates */
ret = SharedHandle<IEditable>::Share(sh).get()->SetCandidates(
- std::list<std::unique_ptr<Bundle>>());
+ std::list<std::shared_ptr<Bundle>>());
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
@@ -282,44 +301,23 @@ extern "C" EXPORT_API int watchface_editable_request_edit(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || cb == NULL)
+ if (handle == nullptr || cb == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
static cynara_result pcr = COMPLICATION_CYNARA_UNKNOWN;
- int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
-
- if (pcr == COMPLICATION_CYNARA_DENIED) {
- LOGE("Permission denied");
- return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
-
- } else if (pcr == COMPLICATION_CYNARA_UNKNOWN) {
- ret = watchface_complication::util::CheckPrivilege(PRIVILEGE_DATASHARING);
- if (ret == WATCHFACE_COMPLICATION_ERROR_NONE) {
- pcr = COMPLICATION_CYNARA_ALLOWED;
- } else if (ret == WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED) {
- pcr = COMPLICATION_CYNARA_DENIED;
- return ret;
- } else {
- return ret;
- }
- }
+ int ret = util::CheckPrivilege(PRIVILEGE_DATASHARING, &pcr);
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
EditablesContainerStub* ec = static_cast<EditablesContainerStub*>(handle);
- UpdateCallbackInfo* ci = nullptr;
- try {
- ci = new UpdateCallbackInfo(cb, user_data);
- ec->ClearUpdateCallbackInfo();
- ec->AddUpdateCallbackInfo(ci);
- } catch (const std::bad_alloc &ba) {
- LOGE("UpdateCallbackInfo::Exception bad_alloc");
- if (ci != nullptr)
- delete ci;
+ unique_ptr<UpdateCallbackInfo> ci = unique_ptr<UpdateCallbackInfo>(
+ new (std::nothrow) UpdateCallbackInfo(cb, user_data));
+ if (ci.get() == nullptr) {
+ LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (watchface_complication::Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());;
- delete ci;
- return ex.GetErrorCode();
}
+ ec->ClearUpdateCallbackInfo();
+ ec->AddUpdateCallbackInfo(move(ci));
ret = ec->RequestEdit();
return ret;
@@ -330,38 +328,31 @@ extern "C" EXPORT_API int watchface_editable_add_edit_ready_cb(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (cb == NULL)
+ if (cb == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
- try {
- if (__container == NULL)
+ if (__container == nullptr) {
+ try {
__container = new EditablesContainerStub();
- } catch (const std::bad_alloc &ba) {
- LOGE("EditablesContainerStub::Exception bad_alloc");
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ }
+ if (__container == nullptr) {
+ LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (watchface_complication::Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());;
- return ex.GetErrorCode();
}
- ReadyCallbackInfo* ci = nullptr;
- try {
- ci = new ReadyCallbackInfo(cb, user_data);
- int ret = __container->AddReadyCallbackInfo(ci);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
- delete ci;
- return ret;
- }
- } catch (const std::bad_alloc &ba) {
- LOGE("UpdateCallbackInfo::Exception bad_alloc");
- if (ci != nullptr)
- delete ci;
+ unique_ptr<ReadyCallbackInfo> ci = unique_ptr<ReadyCallbackInfo>(
+ new (std::nothrow) ReadyCallbackInfo(cb, user_data));
+ if (ci.get() == nullptr) {
+ LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (watchface_complication::Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- delete ci;
- return ex.GetErrorCode();
}
+ int ret = __container->AddReadyCallbackInfo(move(ci));
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -371,7 +362,7 @@ extern "C" EXPORT_API int watchface_editable_remove_edit_ready_cb(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (cb == NULL || __container == NULL)
+ if (cb == nullptr || __container == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
return __container->RemoveReadyCallbackInfo(cb);
@@ -382,7 +373,7 @@ extern "C" EXPORT_API int watchface_editable_get_current_data_idx(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || idx == NULL)
+ if (handle == nullptr || idx == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
IEditable* ie = static_cast<IEditable*>(handle);
@@ -395,16 +386,16 @@ extern "C" EXPORT_API int watchface_editable_get_current_data(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || cur_data == NULL)
+ if (handle == nullptr || cur_data == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
IEditable* ie = static_cast<IEditable*>(handle);
- const Bundle* data = ie->GetCurData();
- if (data == NULL)
+ shared_ptr<Bundle> data = ie->GetCurData();
+ if (data.get() == nullptr)
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
- if (data->GetConstRaw() != NULL) {
- *cur_data = bundle_dup(const_cast<bundle*>(data->GetConstRaw()));
- if (*cur_data == NULL)
+ if (data->GetHandle() != nullptr) {
+ *cur_data = bundle_dup(data->GetHandle());
+ if (*cur_data == nullptr)
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
} else {
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
@@ -417,16 +408,16 @@ extern "C" EXPORT_API int watchface_editable_get_nth_data(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || nth_data == NULL)
+ if (handle == nullptr || nth_data == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
IEditable* ie = static_cast<IEditable*>(handle);
- const Bundle* data = ie->GetNthData(nth);
- if (data == NULL)
+ shared_ptr<Bundle> data = ie->GetNthData(nth);
+ if (data.get() == nullptr)
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
- if (data->GetConstRaw() != NULL) {
- *nth_data = bundle_dup(const_cast<bundle*>(data->GetConstRaw()));
- if (*nth_data == NULL)
+ if (data->GetHandle() != nullptr) {
+ *nth_data = bundle_dup(data->GetHandle());
+ if (*nth_data == nullptr)
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
} else {
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
@@ -439,7 +430,7 @@ extern "C" EXPORT_API int watchface_editable_get_editable_id(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || editable_id == NULL)
+ if (handle == nullptr || editable_id == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
IEditable* ie = static_cast<IEditable*>(handle);
@@ -453,13 +444,13 @@ extern "C" EXPORT_API int watchface_editable_get_editable_name(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || editable_name == NULL)
+ if (handle == nullptr || editable_name == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
IEditable* ie = static_cast<IEditable*>(handle);
if (!ie->GetLabel().empty()) {
*editable_name = strdup(ie->GetLabel().c_str());
- if (*editable_name == NULL) {
+ if (*editable_name == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -474,7 +465,7 @@ extern "C" EXPORT_API int watchface_editable_set_editable_name(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || editable_name == NULL)
+ if (handle == nullptr || editable_name == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
IEditable* ie = static_cast<IEditable*>(handle);
@@ -487,35 +478,205 @@ extern "C" EXPORT_API int watchface_editable_load_current_data(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (selected_data == NULL)
+ if (selected_data == nullptr)
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
std::unique_ptr<Bundle> setting_data;
-
try {
setting_data = EditablesManager::GetInst().LoadSetting(editable_id);
} catch (watchface_complication::Exception &ex) {
LOGE("%s %d", ex.what(), ex.GetErrorCode());
return ex.GetErrorCode();
}
+
if (setting_data != nullptr) {
- *selected_data = bundle_dup(setting_data.get()->GetRaw());
- if (*selected_data == NULL)
+ bundle* dup_bundle = bundle_dup(setting_data.get()->GetHandle());
+ if (dup_bundle == nullptr)
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ *selected_data = dup_bundle;
+ } else {
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+ }
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_create(
+ bundle** candidate, const char* name) {
+ if (candidate == nullptr || name == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ bundle* data = bundle_create();
+ int ret = bundle_add_str(data, CANDIDATE_NAME_KEY, name);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("fail to add name (%d)", ret);
+ bundle_free(data);
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+ *candidate = data;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_get_name(
+ bundle* candidate, char** name) {
+ if (candidate == nullptr || name == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ char* data;
+ int ret = bundle_get_str(candidate, CANDIDATE_NAME_KEY, &data);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGW("No data");
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+ }
+ *name = strdup(data);
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_set_color(
+ bundle* candidate, watchface_editable_color_h color) {
+ if (candidate == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ bundle_del(candidate, CANDIDATE_COLOR_A_KEY);
+ bundle_del(candidate, CANDIDATE_COLOR_R_KEY);
+ bundle_del(candidate, CANDIDATE_COLOR_G_KEY);
+ bundle_del(candidate, CANDIDATE_COLOR_B_KEY);
+ if (color != nullptr) {
+ bundle_add_str(candidate, CANDIDATE_COLOR_A_KEY, to_string(color->a).c_str());
+ bundle_add_str(candidate, CANDIDATE_COLOR_R_KEY, to_string(color->r).c_str());
+ bundle_add_str(candidate, CANDIDATE_COLOR_G_KEY, to_string(color->g).c_str());
+ bundle_add_str(candidate, CANDIDATE_COLOR_B_KEY, to_string(color->b).c_str());
+ }
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_get_color(
+ bundle* candidate, watchface_editable_color_h* color) {
+ if (candidate == nullptr || color == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ char* r_str = nullptr;
+ char* g_str = nullptr;
+ char* b_str = nullptr;
+ char* a_str = nullptr;
+
+ bundle_get_str(candidate, CANDIDATE_COLOR_A_KEY, &a_str);
+ bundle_get_str(candidate, CANDIDATE_COLOR_R_KEY, &r_str);
+ bundle_get_str(candidate, CANDIDATE_COLOR_G_KEY, &g_str);
+ bundle_get_str(candidate, CANDIDATE_COLOR_B_KEY, &b_str);
+
+ watchface_editable_color_h col;
+ if (r_str != nullptr) {
+ int ret = watchface_editable_candidate_color_create(&col,
+ stoi(r_str), stoi(g_str), stoi(b_str), stoi(a_str));
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ *color = col;
} else {
+ LOGW("No data");
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
}
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_color_create(
+ watchface_editable_color_h* color, int r, int g, int b, int a) {
+
+ if (color == nullptr || r < 0 || r > 255
+ || g < 0 || g > 255 || b < 0 || b > 255 || a < 0 || a > 255) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ watchface_editable_color_h col =
+ (watchface_editable_color_h)calloc(1, sizeof(struct editable_color_));
+ col->r = r;
+ col->g = g;
+ col->b = b;
+ col->a = a;
+ *color = col;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_color_get(
+ watchface_editable_color_h color, int* r, int* g, int* b, int* a) {
+ if (color == nullptr
+ || r == nullptr || g == nullptr || b == nullptr || a == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ *r = color->r;
+ *g = color->g;
+ *b = color->b;
+ *a = color->a;
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_color_destroy(
+ watchface_editable_color_h color) {
+ if (color == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+ free(color);
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_set_preview_image(
+ bundle *candidate, const char *path) {
+ if (candidate == nullptr || path == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ bundle_del(candidate, CANDIDATE_PREVIEW_IMAGE_KEY);
+ int ret = bundle_add_str(candidate, CANDIDATE_PREVIEW_IMAGE_KEY, path);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("fail to add path");
+ return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
+ }
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
+extern "C" EXPORT_API int watchface_editable_candidate_get_preview_image(
+ bundle* candidate, char** path) {
+ if (candidate == nullptr || path == nullptr) {
+ LOGE("Invalid parameter");
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ char* image;
+ int ret = bundle_get_str(candidate, CANDIDATE_PREVIEW_IMAGE_KEY, &image);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGW("No data");
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+ }
+ *path = strdup(image);
+
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
extern "C" EXPORT_API int watchface_editable_candidates_list_create(
complication_candidates_list_h* handle) {
- complication_candidates_list_h h = NULL;
+ complication_candidates_list_h h = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL) {
+ if (handle == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -523,7 +684,7 @@ extern "C" EXPORT_API int watchface_editable_candidates_list_create(
h = (complication_candidates_list_h)calloc(1,
sizeof(struct complication_candidates_list_));
- if (h == NULL) {
+ if (h == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -538,13 +699,13 @@ extern "C" EXPORT_API int watchface_editable_candidates_list_add(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || candidate == NULL) {
+ if (handle == nullptr || candidate == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
bundle* dup_candidate = bundle_dup(candidate);
- if (dup_candidate == NULL) {
+ if (dup_candidate == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -564,7 +725,7 @@ extern "C" EXPORT_API int watchface_editable_candidates_list_destroy(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL) {
+ if (handle == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -581,12 +742,12 @@ extern "C" EXPORT_API int watchface_editable_container_get(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (container == NULL) {
+ if (container == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- if (__container == NULL) {
+ if (__container == nullptr) {
LOGE("Container is not ready yet");
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
@@ -599,12 +760,12 @@ extern "C" EXPORT_API int watchface_editable_container_get(
extern "C" EXPORT_API int watchface_editable_highlight_create(
watchface_editable_highlight_h* handle,
watchface_editable_shape_type_e shape) {
- watchface_editable_highlight_h h = NULL;
+ watchface_editable_highlight_h h = nullptr;
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || shape < WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE ||
+ if (handle == nullptr || shape < WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE ||
WATCHFACE_EDITABLE_SHAPE_TYPE_RECT < shape) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
@@ -613,7 +774,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_create(
h = (watchface_editable_highlight_h)calloc(1,
sizeof(struct editable_highlight_));
- if (h == NULL) {
+ if (h == nullptr) {
LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
@@ -632,7 +793,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_set_geometry(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || x < 0 || y < 0 || w < 0 || h < 0) {
+ if (handle == nullptr || x < 0 || y < 0 || w < 0 || h < 0) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -650,7 +811,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_get_geometry(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || x == NULL || y == NULL || w == NULL || h == NULL) {
+ if (handle == nullptr || x == nullptr || y == nullptr || w == nullptr || h == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -668,7 +829,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_set_shape_type(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL
+ if (handle == nullptr
|| shape < WATCHFACE_EDITABLE_SHAPE_TYPE_CIRCLE
|| shape > WATCHFACE_EDITABLE_SHAPE_TYPE_RECT) {
LOGE("Invalid param");
@@ -685,7 +846,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_get_shape_type(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || shape == NULL) {
+ if (handle == nullptr || shape == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -699,7 +860,7 @@ extern "C" EXPORT_API int watchface_editable_highlight_destroy(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL) {
+ if (handle == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -714,7 +875,7 @@ extern "C" EXPORT_API int watchface_editable_get_highlight(
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
- if (handle == NULL || highlight == NULL) {
+ if (handle == nullptr || highlight == nullptr) {
LOGE("Invalid param");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
@@ -722,14 +883,14 @@ extern "C" EXPORT_API int watchface_editable_get_highlight(
IEditable* ie = static_cast<IEditable*>(handle);
IEditable::Highlight* info = ie->GetHighlight();
- if (info == NULL) {
+ if (info == nullptr) {
LOGE("editor do not have highlight data");
return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
}
watchface_editable_highlight_h hi = (watchface_editable_highlight_h)
calloc(1, sizeof(struct editable_highlight_));
- if (hi == NULL) {
+ if (hi == nullptr) {
LOGE("Out of Memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
diff --git a/watchface-editor/editables-editor-event-interface.h b/watchface-editor/editables-editor-event-interface.h
index 0d0b12c..5b545b8 100644
--- a/watchface-editor/editables-editor-event-interface.h
+++ b/watchface-editor/editables-editor-event-interface.h
@@ -19,7 +19,6 @@
#include <string>
-#include "watchface-complication/complication-bundle.h"
#include "watchface-complication/complication.h"
namespace watchface_complication {
diff --git a/watchface-editor/editables-editor-implementation.h b/watchface-editor/editables-editor-implementation.h
index 60b526e..13cf066 100644
--- a/watchface-editor/editables-editor-implementation.h
+++ b/watchface-editor/editables-editor-implementation.h
@@ -46,7 +46,7 @@ class EditablesEditor::Impl : IGDBus::IGDBusEvent {
void OnVanish(const std::string& name) override;
void OnAppear(const std::string& name, const std::string& name_owner) override;
int CheckPrivilege();
- explicit Impl(EditablesEditor* parent, bool mock);
+ explicit Impl(EditablesEditor* parent);
Impl(Impl const& other) = default;
Impl(Impl && other) = default;
Impl& operator=(Impl const& other) = default;
@@ -56,7 +56,7 @@ class EditablesEditor::Impl : IGDBus::IGDBusEvent {
EditablesEditor* parent_;
int subscribe_id_;
std::string edit_appid_;
- std::unique_ptr<IGDBus> gdbus_ = nullptr;
+ std::unique_ptr<IGDBus> gdbus_;
};
} // namespace watchface_complication
diff --git a/watchface-editor/editables-editor.cc b/watchface-editor/editables-editor.cc
index d761a75..21d325c 100644
--- a/watchface-editor/editables-editor.cc
+++ b/watchface-editor/editables-editor.cc
@@ -18,6 +18,7 @@
#include <unistd.h>
#include <utility>
#include <stdexcept>
+#include <vector>
#include "watchface-editor/editables-editor.h"
#include "watchface-editor/editables-editor-implementation.h"
@@ -32,49 +33,36 @@
#define LOG_TAG "WATCHFACE_COMPLICATION"
+using namespace std;
+using namespace tizen_base;
namespace watchface_complication {
-EditablesEditor::EditablesEditor(bool mock)
- : impl_(new Impl(this, mock)) {
+EditablesEditor::EditablesEditor()
+ : impl_(new Impl(this)) {
}
EditablesEditor::~EditablesEditor() = default;
-EditablesEditor::Impl::Impl(EditablesEditor* parent, bool mock)
+EditablesEditor::Impl::Impl(EditablesEditor* parent)
: parent_(parent),
- gdbus_(std::unique_ptr<IGDBus>(ComplicationConnector::GetInst(mock).CreateGDBus(mock))) {
+ gdbus_(std::unique_ptr<IGDBus>(
+ ComplicationConnector::GetInst().CreateGDBus())) {
subscribe_id_ = gdbus_.get()->SubscribeSignal(IGDBus::Editable,
util::GetAppId(), -1, this);
LOGI("subscribe signal %d", subscribe_id_);
}
+/* LCOV_EXCL_START */
void EditablesEditor::Impl::OnVanish(const std::string& name) {
}
void EditablesEditor::Impl::OnAppear(const std::string& name,
const std::string& name_owner) {
}
+/* LCOV_EXCL_STOP */
int EditablesEditor::Impl::CheckPrivilege() {
static cynara_result pcr = COMPLICATION_CYNARA_UNKNOWN;
-
- int ret = WATCHFACE_COMPLICATION_ERROR_NONE;
-
- if (pcr == COMPLICATION_CYNARA_DENIED) {
- LOGE("Permission denied");
- return WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED;
-
- } else if (pcr == COMPLICATION_CYNARA_UNKNOWN) {
- ret = util::CheckPrivilege(PRIVILEGE_DATASHARING);
- if (ret == WATCHFACE_COMPLICATION_ERROR_NONE) {
- pcr = COMPLICATION_CYNARA_ALLOWED;
- } else if (ret == WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED) {
- pcr = COMPLICATION_CYNARA_DENIED;
- return ret;
- } else {
- return ret;
- }
- }
- return ret;
+ return util::CheckPrivilege(PRIVILEGE_DATASHARING, &pcr);
}
void EditablesEditor::Impl::OnSignal(GDBusConnection* connection,
@@ -91,61 +79,47 @@ void EditablesEditor::Impl::OnSignal(GDBusConnection* connection,
return;
LOGI("signal_name: %s", signal_name.c_str());
- if (signal_name.compare(
- util::GetCmdStr(util::CmdType::EditableEditRequest)) == 0) {
- g_variant_get(parameters, "(&s&s)", &appid, &raw);
- LOGI("appid: %s", appid);
-
- if (edit_appid_.compare(sender_appid) != 0 ||
- edit_appid_.compare(appid) != 0) {
- LOGE("edit_appid %s, sender_appid: %s, appid : %s ", edit_appid_.c_str(),
- sender_appid.c_str(), appid);
- return;
- }
-
- bundle* data = bundle_decode(raw, strlen(reinterpret_cast<char*>(raw)));
- const char** str_arr = NULL;
- int len = 0;
-
- if (data == NULL) {
- LOGE("bundle decode failed %d", get_last_result());
- return;
- }
-
- str_arr = bundle_get_str_array(data, "EDITABLE_LIST", &len);
- for (int i = 0; i < len; i++) {
- try {
- e_list.emplace_back(std::unique_ptr<IEditable>(
- new ReceivedEditable(std::string(str_arr[i]))));
- } catch (const std::bad_alloc &ba) {
- LOGE("ReceivedEditable::Exception bad_alloc");
- return;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
+ try {
+ if (signal_name.compare(
+ util::GetCmdStr(util::CmdType::EditableEditRequest)) == 0) {
+ g_variant_get(parameters, "(&s&s)", &appid, &raw);
+ LOGI("appid: %s", appid);
+
+ if (edit_appid_.compare(sender_appid) != 0 ||
+ edit_appid_.compare(appid) != 0) {
+ LOGE("edit_appid %s, sender_appid: %s, appid : %s ", edit_appid_.c_str(),
+ sender_appid.c_str(), appid);
return;
}
+
+ Bundle data(reinterpret_cast<char*>(raw));
+ vector<string> raw_arr = data.GetStringArray("EDITABLE_LIST");
+ for (auto& i : raw_arr) {
+ std::unique_ptr<IEditable> received = std::unique_ptr<IEditable>(
+ new ReceivedEditable(i));
+ if (received.get() == nullptr) {
+ LOGE("Out of memory");
+ return;
+ }
+ e_list.emplace_back(move(received));
+ }
+ parent_->OnRequestEdit(std::string(appid), std::move(e_list));
+ } else if (signal_name.compare(
+ util::GetCmdStr(util::CmdType::SetupReply)) == 0) {
+ int edit_id;
+ char* raw_str;
+ g_variant_get(parameters, "(i&s)", &edit_id, &raw_str);
+ unique_ptr<Bundle> reply_data =
+ unique_ptr<Bundle>(new Bundle(std::string(raw_str)));
+ parent_->OnSetupReply(sender_appid, edit_id, move(reply_data));
}
- parent_->OnRequestEdit(std::string(appid), std::move(e_list));
- bundle_free(data);
- } else if (signal_name.compare(
- util::GetCmdStr(util::CmdType::SetupReply)) == 0) {
- int edit_id;
- char* raw_str;
-
- g_variant_get(parameters, "(i&s)", &edit_id, &raw_str);
- try {
- parent_->OnSetupReply(sender_appid, edit_id,
- std::unique_ptr<Bundle>(new Bundle(std::string(raw_str))));
- } catch (const std::bad_alloc &ba) {
- LOGE("Bundle::Exception bad_alloc");
- return;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return;
- }
+ } catch (const std::bad_alloc &e) {
+ LOGE("Exception (%s)", e.what());
+ return;
}
}
+/* LCOV_EXCL_START */
void EditablesEditor::OnSetupReply(const std::string& appid,
int editable_id, std::unique_ptr<Bundle> context) {
}
@@ -153,6 +127,7 @@ void EditablesEditor::OnSetupReply(const std::string& appid,
void EditablesEditor::OnRequestEdit(const std::string& appid,
std::list<std::unique_ptr<IEditable>> e_list) {
}
+/* LCOV_EXCL_STOP */
int EditablesEditor::EditPreview(IEditable& ed, int cur_data_idx) {
bool emit_result;
@@ -172,14 +147,23 @@ int EditablesEditor::EditPreview(IEditable& ed, int cur_data_idx) {
return ret;
Bundle* context = re.GetContext().get();
+ string ctx_str = "";
+ if (context != nullptr) {
+ try {
+ ctx_str = string(reinterpret_cast<char*>(context->ToRaw().first.get()));
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+ }
+
emit_result = impl_->gdbus_.get()->EmitSignal(
IGDBus::Editable,
impl_->edit_appid_.c_str(),
impl_->edit_appid_.c_str(),
-1,
util::GetCmdStr(util::CmdType::EditableEditPreview),
- g_variant_new("(iis)", cur_data_idx, ed.GetEditableId(),
- (context == nullptr) ? "" : context->ToString()));
+ g_variant_new("(iis)", cur_data_idx, ed.GetEditableId(), ctx_str.c_str()));
if (emit_result)
return WATCHFACE_COMPLICATION_ERROR_NONE;
@@ -188,19 +172,16 @@ int EditablesEditor::EditPreview(IEditable& ed, int cur_data_idx) {
}
int EditablesEditor::EditComplete() {
- bool emit_result;
- int ret;
-
if (impl_->edit_appid_.empty()) {
LOGE("Editing is not ready");
return WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY;
}
- ret = impl_->CheckPrivilege();
+ int ret = impl_->CheckPrivilege();
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
return ret;
- emit_result = impl_->gdbus_.get()->EmitSignal(
+ bool emit_result = impl_->gdbus_.get()->EmitSignal(
IGDBus::Editable,
impl_->edit_appid_.c_str(),
impl_->edit_appid_.c_str(),
diff --git a/watchface-editor/editables-editor.h b/watchface-editor/editables-editor.h
index ef66289..ae28bc7 100644
--- a/watchface-editor/editables-editor.h
+++ b/watchface-editor/editables-editor.h
@@ -18,6 +18,7 @@
#define WATCHFACE_EDITOR_EDITABLES_EDITOR_H_
#include <gio/gio.h>
+#include <bundle_cpp.h>
#include <memory>
#include <string>
@@ -29,12 +30,12 @@ namespace watchface_complication {
class EXPORT_API EditablesEditor : IEditablesContainerEvent {
public:
- EditablesEditor(bool mock);
+ EditablesEditor();
virtual ~EditablesEditor();
void OnRequestEdit(const std::string& appid,
std::list<std::unique_ptr<IEditable>> e_list) override;
void OnSetupReply(const std::string& appid,
- int editable_id, std::unique_ptr<Bundle> context) override;
+ int editable_id, std::unique_ptr<tizen_base::Bundle> context) override;
int EditPreview(IEditable& ed, int cur_data_idx);
int EditComplete();
int EditCancel();
diff --git a/watchface-editor/include/watchface-editor-internal.h b/watchface-editor/include/watchface-editor-internal.h
new file mode 100644
index 0000000..db9a145
--- /dev/null
+++ b/watchface-editor/include/watchface-editor-internal.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_APPFW_WATCHFACE_EDITOR_INTERNAL_H__
+#define __TIZEN_APPFW_WATCHFACE_EDITOR_INTERNAL_H__
+
+#include <tizen.h>
+#include <bundle.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int watchface_editor_get_complication_provider_icon(
+ const bundle* candidate_data, char** icon);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_APPFW_WATCHFACE_EDITOR_INTERNAL_H__ */
diff --git a/watchface-editor/include/watchface-editor.h b/watchface-editor/include/watchface-editor.h
index 9e4118b..fcffbff 100644
--- a/watchface-editor/include/watchface-editor.h
+++ b/watchface-editor/include/watchface-editor.h
@@ -74,10 +74,10 @@ typedef void (*watchface_editor_request_edit_cb)(const char *appid,
* @param[in] user_data The user data passed from the callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editor_request_edit_cb()
* @par Sample code:
* @code
@@ -96,8 +96,8 @@ int watchface_editor_add_request_edit_cb(watchface_editor_request_edit_cb cb,
* @param[in] cb The callback function
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_editor_request_edit_cb()
* @par Sample code:
* @code
@@ -116,11 +116,11 @@ int watchface_editor_remove_request_edit_cb(watchface_editor_request_edit_cb cb)
* @privilege http://tizen.org/privilege/datasharing
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
*/
int watchface_editor_edit_complete(void);
@@ -133,12 +133,12 @@ int watchface_editor_edit_complete(void);
* @param[in] cur_data_idx Index
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
- * @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-editor.h>
@@ -161,11 +161,11 @@ int watchface_editor_edit_preview(const watchface_editable_h handle, int cur_dat
* @privilege http://tizen.org/privilege/datasharing
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WATCHFACE_COMPLICATION_ERROR_EDIT_NOT_READY Edit not ready
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
*/
int watchface_editor_edit_cancel(void);
@@ -177,11 +177,11 @@ int watchface_editor_edit_cancel(void);
* @param[in] appid Application ID
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-editor.h>
@@ -200,8 +200,8 @@ int watchface_editor_notify_edit_ready(const char *appid);
* @param[out] dest The copied editable list
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see editable_list_h
* @see watchface_editor_editable_list_destroy()
* @par Sample code:
@@ -221,8 +221,8 @@ int watchface_editor_editable_list_dup(editable_list_h source, editable_list_h *
* @param[in] list List of editable
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @par Sample code:
* @code
#include <watchface-editor.h>
@@ -240,8 +240,8 @@ int watchface_editor_editable_list_destroy(editable_list_h list);
* @param[out] size Size of editable list
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see editable_list_h
* @par Sample code:
* @code
@@ -259,20 +259,23 @@ int watchface_editor_editable_list_get_size(editable_list_h list, int *size);
* @since_tizen 5.0
* @remarks The @a handle should not be released.
* @param[in] list List of editable
- * @param[in] n
+ * @param[in] n Index
* @param[out] handle The nth editable
* The @a handle is managed by the platform and will be released when
* watchface_editor_editable_list_destroy() is called or watchface_editor_request_edit_cb() is finished.
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_editable_h
* @par Sample code:
* @code
#include <watchface-editor.h>
{
- const watchface_editable_h handle = watchface_editor_editable_list_get_nth(list, 0);
+ int ret;
+ const watchface_editable_h handle;
+
+ ret = watchface_editor_editable_list_get_nth(list, 0, &handle);
}
* @endcode
*/
@@ -286,8 +289,8 @@ int watchface_editor_editable_list_get_nth(editable_list_h list,
* @param[out] size The editable's candidate list size
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_editable_h
* @par Sample code:
* @code
@@ -297,7 +300,7 @@ int watchface_editor_editable_list_get_nth(editable_list_h list,
int size;
watchface_editable_h handle;
- watchface_editor_editable_list_nth(list, idx, &handle);
+ watchface_editor_editable_list_get_nth(list, idx, &handle);
watchface_editor_editable_candidate_list_get_size(handle, &size);
if (candidates < 0)
@@ -310,14 +313,14 @@ int watchface_editor_editable_candidate_list_get_size(watchface_editable_h handl
/**
* @brief Gets the nth candidate data from the editable.
* @since_tizen 5.0
- * @remarks The @a data should be released using bundle_free().
+ * @remarks The @a candidate_data should be released using bundle_free().
* @param[in] handle The editable handle
* @param[in] n Index
* @param[out] candidate_data The editable's nth candidate data
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @see watchface_editable_h
* @par Sample code:
* @code
@@ -345,9 +348,9 @@ int watchface_editor_editable_candidate_list_get_nth(
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @see watchface_editor_launch_setup_app()
* @par Sample code:
* @code
@@ -375,11 +378,11 @@ int watchface_editor_set_context(watchface_editable_h handle, bundle *context);
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @retval #WATCHFACE_COMPLICATION_ERROR_IO_ERROR I/O error
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_editor_is_setup_app_exist()
* @par Sample code:
* @code
@@ -405,9 +408,9 @@ int watchface_editor_launch_setup_app(watchface_editable_h handle,
* @return #WATCHFACE_COMPLICATION_ERROR_NONE on success,
* otherwise an error code (see #watchface_complication_error_e) on failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Successful
- * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @see watchface_editor_launch_setup_app()
* @par Sample code:
* @code
@@ -433,9 +436,9 @@ int watchface_editor_is_setup_app_exist(watchface_editable_h handle, bool *exist
* @param[out] provider_id The name of the provider
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data available
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-complication.h>
@@ -457,9 +460,9 @@ int watchface_editor_get_complication_provider_id(
* @param[out] cur_type The type shown in the complication
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data available
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @see watchface_complication_type_e
* @par Sample code:
* @code
@@ -483,9 +486,9 @@ int watchface_editor_get_complication_type(const bundle *candidate_data,
* @param[out] provider_name The name of the provider
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
+ * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data available
- * @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
* @par Sample code:
* @code
#include <watchface-complication.h>
@@ -513,12 +516,12 @@ int watchface_editor_get_complication_provider_name(
* @param[out] error_message The error message. \n
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @see watchface_complication_event_type_e
* @see watchface_editor_error_e
- * @see watchface_editor_editable_candidate_list_get_nth
+ * @see watchface_editor_editable_candidate_list_get_nth()
* @par Sample code:
* @code
#include <watchface-complication.h>
@@ -554,8 +557,8 @@ int watchface_editor_get_complication_is_supported(const bundle *candidate_data,
* @param[out] setup_appid The complication application's setup appid.
* @return #WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
* @retval #WATCHFACE_COMPLICATION_ERROR_NONE Success
- * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WATCHFACE_COMPLICATION_ERROR_NO_DATA No data available
* @retval #WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY Out of memory
* @par Sample code:
diff --git a/watchface-editor/watchface-editor.cc b/watchface-editor/watchface-editor.cc
index 32ea597..b294525 100644
--- a/watchface-editor/watchface-editor.cc
+++ b/watchface-editor/watchface-editor.cc
@@ -19,6 +19,7 @@
#include <glib.h>
#include <dlog.h>
#include <app_control.h>
+#include <aul.h>
#include <string>
@@ -33,6 +34,8 @@
#define LOG_TAG "WATCHFACE_COMPLICATION"
+using namespace std;
+using namespace tizen_base;
using namespace watchface_complication;
class CallbackInfo {
@@ -41,6 +44,13 @@ class CallbackInfo {
: cb_(cb), user_data_(user_data) {
}
+ CallbackInfo(CallbackInfo&& b) noexcept {
+ cb_ = b.cb_;
+ user_data_ = b.user_data_;
+ b.cb_ = nullptr;
+ b.user_data_ = nullptr;
+ }
+
void Invoke(const std::string& appid, editable_list_h list_h) {
cb_(appid.c_str(), list_h, user_data_);
}
@@ -62,6 +72,15 @@ class SetupCallbackInfo {
cb_(cb), user_data_(user_data) {
}
+ SetupCallbackInfo(SetupCallbackInfo&& b) noexcept {
+ setup_appid_ = b.setup_appid_;
+ editable_id_ = b.editable_id_;
+ cb_ = b.cb_;
+ user_data_ = b.user_data_;
+ b.cb_ = nullptr;
+ b.user_data_ = nullptr;
+ }
+
void Invoke(bundle* new_context) {
cb_(editable_id_, new_context, user_data_);
}
@@ -82,8 +101,7 @@ class SetupCallbackInfo {
class EditablesEditorStub : public EditablesEditor {
public:
- EditablesEditorStub()
- : EditablesEditor(false) {
+ EditablesEditorStub() : EditablesEditor() {
}
virtual ~EditablesEditorStub() = default;
@@ -108,7 +126,7 @@ class EditablesEditorStub : public EditablesEditor {
LOGI("Setup reply!! %s, %d", appid.c_str(), editable_id);
for (auto& i : setup_cb_list_) {
if (i.get()->CompareInfo(appid, editable_id)) {
- i.get()->Invoke(context.get()->GetRaw());
+ i.get()->Invoke(context.get()->GetHandle());
setup_cb_list_.remove(i);
return;
}
@@ -116,20 +134,20 @@ class EditablesEditorStub : public EditablesEditor {
LOGE("Not exist callback info");
}
- void AddSetupCallbackInfo(SetupCallbackInfo* ci) {
- setup_cb_list_.emplace_back(ci);
+ void AddSetupCallbackInfo(unique_ptr<SetupCallbackInfo> ci) {
+ setup_cb_list_.emplace_back(move(ci));
}
- void RemoveSetupCallbackInfo(SetupCallbackInfo* ci) {
+ void RemoveSetupCallbackInfo(unique_ptr<SetupCallbackInfo> ci) {
for (auto& i : setup_cb_list_) {
- if (i.get() == ci) {
+ if (i.get() == ci.get()) {
setup_cb_list_.remove(i);
break;
}
}
}
- int AddCallbackInfo(CallbackInfo* ci) {
+ int AddCallbackInfo(unique_ptr<CallbackInfo> ci) {
for (auto& i : cb_list_) {
if (i.get()->GetCallback() == ci->GetCallback()) {
LOGI("already registered callback");
@@ -137,7 +155,7 @@ class EditablesEditorStub : public EditablesEditor {
}
}
- cb_list_.emplace_back(ci);
+ cb_list_.emplace_back(move(ci));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -164,8 +182,6 @@ class EditablesEditorStub : public EditablesEditor {
static std::unique_ptr<EditablesEditorStub> __stub = nullptr;
extern "C" EXPORT_API int watchface_editor_add_request_edit_cb(
watchface_editor_request_edit_cb cb, void* user_data) {
- int ret;
-
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
@@ -177,33 +193,19 @@ extern "C" EXPORT_API int watchface_editor_add_request_edit_cb(
if (__stub == nullptr) {
try {
__stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
- } catch (const std::bad_alloc &ba) {
- LOGE("EditablesEditorStub::Exception bad_alloc");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
}
}
- CallbackInfo* ci = nullptr;
- try {
- ci = new CallbackInfo(cb, user_data);
- ret = __stub->AddCallbackInfo(ci);
- if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
- delete ci;
- } catch (const std::bad_alloc &ba) {
- LOGE("CallbackInfo::Exception bad_alloc");
- if (ci != nullptr)
- delete ci;
+ unique_ptr<CallbackInfo> ci = unique_ptr<CallbackInfo>(
+ new (std::nothrow) CallbackInfo(cb, user_data));
+ if (ci.get() == nullptr) {
+ LOGE("Out of memory");
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- delete ci;
- return ex.GetErrorCode();
}
-
- return ret;
+ return __stub->AddCallbackInfo(move(ci));
}
extern "C" EXPORT_API int watchface_editor_remove_request_edit_cb(
@@ -240,40 +242,36 @@ extern "C" EXPORT_API int watchface_editor_edit_preview(
return __stub->EditPreview(*ed, cur_data_idx);
}
+static int __init_stub() {
+ if (__stub != nullptr)
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+ try {
+ __stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
+ } catch (const std::bad_alloc &ba) {
+ LOGE("EditablesEditorStub::Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ } catch (Exception &ex) {
+ LOGE("%s %d", ex.what(), ex.GetErrorCode());
+ return ex.GetErrorCode();
+ }
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
extern "C" EXPORT_API int watchface_editor_edit_complete(void) {
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
-
- if (__stub == nullptr) {
- try {
- __stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
- } catch (const std::bad_alloc &ba) {
- LOGE("EditablesEditorStub::Exception bad_alloc");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
- }
- }
-
+ int ret = __init_stub();
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
return __stub->EditComplete();
}
extern "C" EXPORT_API int watchface_editor_edit_cancel(void) {
if (!watchface_complication::util::CheckWatchFeatureEnabled())
return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
-
- if (__stub == nullptr) {
- try {
- __stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
- } catch (const std::bad_alloc &ba) {
- LOGE("EditablesEditorStub::Exception bad_alloc");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
- }
- }
+ int ret = __init_stub();
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
return __stub->EditCancel();
}
@@ -288,20 +286,10 @@ extern "C" EXPORT_API int watchface_editor_notify_edit_ready(
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- if (__stub == nullptr) {
- try {
- __stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
- } catch (const std::bad_alloc &ba) {
- LOGE("EditablesEditorStub::Exception bad_alloc");
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
- }
- } else {
- __stub->ClearEditableList();
- }
-
+ int ret = __init_stub();
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ __stub->ClearEditableList();
return __stub->NotifyEditReady(std::string(appid));
}
@@ -387,7 +375,7 @@ extern "C" EXPORT_API int watchface_editor_editable_candidate_list_get_size(
}
IEditable* ed = static_cast<IEditable*>(handle);
- std::list<std::unique_ptr<Bundle>> const& list = ed->GetCandidates();
+ std::list<std::shared_ptr<Bundle>> const& list = ed->GetCandidates();
*size = list.size();
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -404,11 +392,11 @@ extern "C" EXPORT_API int watchface_editor_editable_candidate_list_get_nth(
bundle* tmp;
IEditable* ed = static_cast<IEditable*>(handle);
- const std::list<std::unique_ptr<Bundle>>& list = ed->GetCandidates();
- const std::list<std::unique_ptr<Bundle>>::const_iterator it
+ const std::list<std::shared_ptr<Bundle>>& list = ed->GetCandidates();
+ const std::list<std::shared_ptr<Bundle>>::const_iterator it
= list.begin();
auto nx = std::next(it, nth);
- tmp = bundle_dup(((*nx).get())->GetRaw());
+ tmp = bundle_dup((*nx)->GetHandle());
if (tmp == NULL)
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
@@ -454,12 +442,9 @@ extern "C" EXPORT_API int watchface_editor_set_context(
try {
std::unique_ptr<Bundle> b(new Bundle(new_context));
re = ed->SetContext(std::move(b));
- } catch (const std::bad_alloc &ba) {
- LOGE("Out of memory");
+ } catch (const std::exception& e) {
+ LOGE("Exception occurred : %s", e.what());
return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- return ex.GetErrorCode();
}
} else {
re = ed->SetContext(std::unique_ptr<Bundle>{});
@@ -511,75 +496,69 @@ extern "C" EXPORT_API int watchface_editor_launch_setup_app(
IEditable* ed = static_cast<IEditable*>(handle);
std::string appid = ed->GetSetupAppId();
- app_control_h service = NULL;
Bundle* context_data;
char ed_id[256] = {0, };
+ app_control_h service = nullptr;
if (APP_CONTROL_ERROR_NONE != app_control_create(&service)) {
LOGE("Fail to create app control");
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
+ auto ptr = unique_ptr<app_control_s,
+ decltype(app_control_destroy)*>(service, app_control_destroy);
+
LOGI("LAUNCH !!! %s", appid.c_str());
- int ret = app_control_set_app_id(service, appid.c_str());
+ int ret = app_control_set_app_id(ptr.get(), appid.c_str());
if (ret != APP_CONTROL_ERROR_NONE) {
LOGE("Fail to set appid");
- app_control_destroy(service);
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
- ret = _add_extra_data(service, SETUP_EDITOR_APPID_KEY,
+ ret = _add_extra_data(ptr.get(), SETUP_EDITOR_APPID_KEY,
util::GetAppId().c_str());
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
LOGE("Fail to add setup appid ");
- app_control_destroy(service);
return ret;
}
snprintf(ed_id, sizeof(ed_id), "%d", ed->GetEditableId());
LOGI("add ed_id %s", ed_id);
- ret = _add_extra_data(service, SETUP_EDITABLE_ID_KEY, ed_id);
+ ret = _add_extra_data(ptr.get(), SETUP_EDITABLE_ID_KEY, ed_id);
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
LOGE("Fail to add ed_id %s", ed_id);
- app_control_destroy(service);
return ret;
}
context_data = (ed->GetContext()).get();
if (context_data != nullptr) {
- ret = _add_extra_data(service, SETUP_CONTEXT_DATA_KEY,
- context_data->ToString());
+ try {
+ ret = _add_extra_data(ptr.get(), SETUP_CONTEXT_DATA_KEY,
+ reinterpret_cast<char*>(context_data->ToRaw().first.get()));
+ } catch (const std::bad_alloc &ba) {
+ LOGE("Exception bad_alloc");
+ return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+ }
+
if (ret != WATCHFACE_COMPLICATION_ERROR_NONE) {
LOGE("Fail to add setup_context_data %d", ret);
- app_control_destroy(service);
return ret;
}
}
- ret = app_control_send_launch_request(service, NULL, NULL);
+ ret = app_control_send_launch_request(ptr.get(), nullptr, nullptr);
if (ret != APP_CONTROL_ERROR_NONE) {
LOGE("Failed to launch:%d", ret);
- app_control_destroy(service);
return WATCHFACE_COMPLICATION_ERROR_IO_ERROR;
}
- app_control_destroy(service);
- SetupCallbackInfo* ci = nullptr;
- try {
- if (__stub == nullptr)
- __stub = std::unique_ptr<EditablesEditorStub>(new EditablesEditorStub());
+ unique_ptr<SetupCallbackInfo> ci = unique_ptr<SetupCallbackInfo>(
+ new (std::nothrow) SetupCallbackInfo(
+ appid, ed->GetEditableId(), cb, user_data));
- ci = new SetupCallbackInfo(appid, ed->GetEditableId(), cb, user_data);
- __stub->AddSetupCallbackInfo(ci);
- } catch (const std::bad_alloc &ba) {
- LOGE("Out of memory");
- if (ci != nullptr)
- delete ci;
- return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
- } catch (Exception &ex) {
- LOGE("%s %d", ex.what(), ex.GetErrorCode());
- delete ci;
- return ex.GetErrorCode();
- }
+ ret = __init_stub();
+ if (ret != WATCHFACE_COMPLICATION_ERROR_NONE)
+ return ret;
+ __stub->AddSetupCallbackInfo(move(ci));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
@@ -659,6 +638,38 @@ extern "C" EXPORT_API int watchface_editor_get_complication_provider_name(
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
+extern "C" EXPORT_API int watchface_editor_get_complication_provider_icon(
+ const bundle* candidate_data, char** icon) {
+ if (!watchface_complication::util::CheckWatchFeatureEnabled())
+ return WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTED;
+
+ if (candidate_data == NULL || icon == NULL)
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+
+ char* val = NULL;
+ bundle_get_str(const_cast<bundle*>(candidate_data),
+ Complication::GetProviderIdKey(), &val);
+ if (val != NULL) {
+ std::string ic = DBManager::GetIcon(val);
+ if (!ic.empty()) {
+ char* shared_path;
+ aul_get_app_shared_resource_path_by_appid(
+ DBManager::GetProviderAppId(val).c_str(), &shared_path);
+ std::string app_path = std::string(shared_path) + ic;
+ free(shared_path);
+ LOGI("icon path : (%s)", app_path.c_str());
+ *icon = strdup(app_path.c_str());
+ } else {
+ LOGE("fail to get name (%s)", val);
+ return WATCHFACE_COMPLICATION_ERROR_NO_DATA;
+ }
+ } else {
+ return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
+ }
+
+ return WATCHFACE_COMPLICATION_ERROR_NONE;
+}
+
extern "C" EXPORT_API int watchface_editor_get_complication_is_supported(
const bundle* candidate_data, bool* is_supported,
watchface_editor_error_e* error, char** error_message) {