From c8e5699235a1fd0729d7579cd96e054929a0d2be Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 13 May 2013 19:43:19 +0900 Subject: [PATCH] Revert "remove debug sentences" This reverts commit 504ce17705e6669f4dd019faf516aea2b03de30e --- CMakeLists.txt | 2 + .../autopopup_configure_bin_parser.cpp | 4 + binary_xmlresource/binary_xmlresource.cpp | 4 + .../default_configure_bin_parser.cpp | 5 + binary_xmlresource/include/metadata_provider.h | 6 +- .../input_mode_configure_bin_parser.cpp | 2 + .../key_coordinate_frame_bin_parser.cpp | 3 + binary_xmlresource/label_properties_bin_parser.cpp | 6 + binary_xmlresource/layout_bin_parser.cpp | 5 + .../magnifier_configure_bin_parser.cpp | 5 + .../modifier_decoration_bin_parser.cpp | 4 + .../nine_patch_file_list_bin_parser.cpp | 4 + res/put_record.h | 608 +++++++++++++++++++++ res/simple_debug.cpp | 125 +++++ res/simple_debug.h | 47 ++ res/simple_debug_test.cpp | 34 ++ scl/gwes/gtk/sclgraphics-gtk.cpp | 3 + scl/sclcontroller.cpp | 9 + scl/sclresourcecache.cpp | 6 +- scl/sclutils.cpp | 2 +- scl/sclwindows.cpp | 19 +- scl/utils/linux/sclutils-linux.cpp | 14 +- sclres/sclres_manager.cpp | 15 + xml2binary/CMakeLists.txt | 1 + xml2binary/encode_autopopup_configure.cpp | 6 + xml2binary/encode_default_configure.cpp | 5 + xml2binary/encode_input_mode_configure.cpp | 5 + xml2binary/encode_key_coordinate_frame.cpp | 1 + xml2binary/encode_label_properties_frame.cpp | 5 + xml2binary/encode_layout.cpp | 5 + xml2binary/encode_magnifier_configure.cpp | 6 + xml2binary/encode_modifier_decoration.cpp | 6 + xml2binary/encode_nine_patch.cpp | 10 + xml2binary/include/resource_storage_impl.h | 8 +- xml2binary/metadata_handler.cpp | 3 + xml2binary/xml2dat.cpp | 27 +- xmlresource/autopopup_configure_parser.cpp | 13 +- xmlresource/default_configure_parser.cpp | 13 +- xmlresource/input_mode_configure_parser.cpp | 23 +- xmlresource/label_properties_parser.cpp | 24 +- xmlresource/layout_parser.cpp | 22 +- xmlresource/magnifier_configure_parser.cpp | 14 +- xmlresource/main_entry_parser.cpp | 13 +- xmlresource/modifier_decoration_parser.cpp | 21 +- xmlresource/nine_patch_file_list_parser.cpp | 23 +- xmlresource/xmlresource.cpp | 45 +- 46 files changed, 1068 insertions(+), 163 deletions(-) create mode 100644 res/put_record.h create mode 100644 res/simple_debug.cpp create mode 100644 res/simple_debug.h create mode 100644 res/simple_debug_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d911ace..f22c35b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ SET(SRCS scl/sclactionstate.cpp scl/sclresourcecache.cpp res/sclresource.cpp + res/simple_debug.cpp ) SET(PACKAGE ${PROJECT_NAME}) @@ -123,6 +124,7 @@ INSTALL(FILES "${CMAKE_SOURCE_DIR}/scl/include/scltypes.h" DESTINATION include/l INSTALL(FILES "${CMAKE_SOURCE_DIR}/scl/include/sclconfig.h" DESTINATION include/libscl-ui) INSTALL(FILES "${CMAKE_SOURCE_DIR}/scl/include/sclstructs.h" DESTINATION include/libscl-ui) INSTALL(FILES "${CMAKE_SOURCE_DIR}/scl/include/scleventcallback.h" DESTINATION include/libscl-ui) +INSTALL(FILES "${CMAKE_SOURCE_DIR}/res/simple_debug.h" DESTINATION include/libscl-ui) CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) diff --git a/binary_xmlresource/autopopup_configure_bin_parser.cpp b/binary_xmlresource/autopopup_configure_bin_parser.cpp index 6824740..97db1a8 100644 --- a/binary_xmlresource/autopopup_configure_bin_parser.cpp +++ b/binary_xmlresource/autopopup_configure_bin_parser.cpp @@ -18,6 +18,7 @@ #include "autopopup_configure_bin_parser.h" #include using namespace std; +#include "put_record.h" BinAutoPopupConfigParser* BinAutoPopupConfigParser::m_instance = NULL; @@ -116,6 +117,9 @@ void BinAutoPopupConfigParser::parsing_autopopup_configure() { //add_grab_bottom cur->add_grab_bottom = m_storage.get(record_width.add_grab_bottom); +#ifdef __SCL_TXT_DEBUG + put_autopopup_configure(DECODE, m_autopopup_configure); +#endif } PSclAutoPopupConfigure BinAutoPopupConfigParser::get_autopopup_configure() { diff --git a/binary_xmlresource/binary_xmlresource.cpp b/binary_xmlresource/binary_xmlresource.cpp index 219b5f9..dcebb49 100644 --- a/binary_xmlresource/binary_xmlresource.cpp +++ b/binary_xmlresource/binary_xmlresource.cpp @@ -22,6 +22,7 @@ #include "string_provider.h" #include "metadata_provider.h" #include +#include "simple_debug.h" using namespace binary_xmlresource; @@ -81,6 +82,8 @@ BinResource* BinResource::get_instance() { } void BinResource::init(const char *entry_filepath) { + SCLLOG_TIME_BEGIN(); + char path[_POSIX_PATH_MAX] = {0}; @@ -156,6 +159,7 @@ void BinResource::init(const char *entry_filepath) { m_nine_patch_file_list_parser->init(storageAllData, info[NINE_PATCH].offset, info[NINE_PATCH].size, &parser_info_provider); } + SCLLOG_TIME_END("Parsing binary XML files"); } void BinResource::load(int layout_id) { diff --git a/binary_xmlresource/default_configure_bin_parser.cpp b/binary_xmlresource/default_configure_bin_parser.cpp index 6a849ca..2d67414 100644 --- a/binary_xmlresource/default_configure_bin_parser.cpp +++ b/binary_xmlresource/default_configure_bin_parser.cpp @@ -18,6 +18,7 @@ #include "default_configure_bin_parser.h" #include using namespace std; +#include "put_record.h" BinDefaultConfigParser* BinDefaultConfigParser::m_instance = NULL; @@ -116,6 +117,10 @@ void BinDefaultConfigParser::parsing_default_configure() { //dim_color decode_color(cur->dim_color, record_width.dim_color); + +#ifdef __SCL_TXT_DEBUG + put_default_configure(DECODE, m_default_configure); +#endif } PSclDefaultConfigure BinDefaultConfigParser::get_default_configure() { diff --git a/binary_xmlresource/include/metadata_provider.h b/binary_xmlresource/include/metadata_provider.h index d3f124d..1567d30 100644 --- a/binary_xmlresource/include/metadata_provider.h +++ b/binary_xmlresource/include/metadata_provider.h @@ -17,10 +17,6 @@ #ifndef __METADATA_PROVIDER_H__ #define __METADATA_PROVIDER_H_ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include "imetadata_provider.h" #include "metadata_bin_parser.h" class Metadata_Provider:public IMetadata_Provider{ @@ -48,7 +44,7 @@ class Metadata_Provider:public IMetadata_Provider{ current_record_name = record_name; curRecordIndex = find_metadata_record_index(record_name); if (curRecordIndex == -1) { - LOGD("Can not find %s metadata record.\n", record_name); + printf("Can not find %s metadata record.\n", record_name); } } } diff --git a/binary_xmlresource/input_mode_configure_bin_parser.cpp b/binary_xmlresource/input_mode_configure_bin_parser.cpp index aafa8e4..4a73ba3 100644 --- a/binary_xmlresource/input_mode_configure_bin_parser.cpp +++ b/binary_xmlresource/input_mode_configure_bin_parser.cpp @@ -16,6 +16,8 @@ */ #include "input_mode_configure_bin_parser.h" +#include "simple_debug.h" +#include "put_record.h" using namespace std; BinInputModeConfigParser* BinInputModeConfigParser::m_instance = NULL; diff --git a/binary_xmlresource/key_coordinate_frame_bin_parser.cpp b/binary_xmlresource/key_coordinate_frame_bin_parser.cpp index dd82075..8aa3a37 100644 --- a/binary_xmlresource/key_coordinate_frame_bin_parser.cpp +++ b/binary_xmlresource/key_coordinate_frame_bin_parser.cpp @@ -24,8 +24,10 @@ #include "string_provider.h" #include "metadata_provider.h" #include +#include "put_record.h" #include #include "binary_xmlresource.h" +#include "simple_debug.h" using namespace binary_xmlresource; using namespace std; @@ -107,6 +109,7 @@ load(int layout_id) for (int j = 0; j < pKey_num_array[i]; ++j) { SclLayoutKeyCoordinatePointer curPointer = (SclLayoutKeyCoordinatePointer)malloc(sizeof(SclLayoutKeyCoordinate)); if (curPointer == NULL) { + SCLLOG(SclLog::ERROR, "Memory malloc error.\n"); assert(0); } memset(curPointer, 0x00, sizeof(SclLayoutKeyCoordinate)); diff --git a/binary_xmlresource/label_properties_bin_parser.cpp b/binary_xmlresource/label_properties_bin_parser.cpp index 8bc7312..9a0a801 100644 --- a/binary_xmlresource/label_properties_bin_parser.cpp +++ b/binary_xmlresource/label_properties_bin_parser.cpp @@ -16,6 +16,8 @@ */ #include "label_properties_bin_parser.h" +#include "simple_debug.h" +#include "put_record.h" BinLabelPropertyParser* BinLabelPropertyParser::m_instance = NULL; BinLabelPropertyParser::BinLabelPropertyParser() { @@ -57,6 +59,7 @@ void BinLabelPropertyParser::parsing_label_properties_frame() { int maxj = m_storage.get(4); if (parser_info_provider == NULL) { + SCLLOG(SclLog::ERROR, "Error parser_info_provider is NULL\n"); return; } @@ -68,6 +71,9 @@ void BinLabelPropertyParser::parsing_label_properties_frame() { decode_label_properties_record(&cur, record_width); } } +#ifdef __SCL_TXT_DEBUG + put_label_properties_frame(DECODE, m_label_properties_frame); +#endif } void diff --git a/binary_xmlresource/layout_bin_parser.cpp b/binary_xmlresource/layout_bin_parser.cpp index bb927c5..45ba757 100644 --- a/binary_xmlresource/layout_bin_parser.cpp +++ b/binary_xmlresource/layout_bin_parser.cpp @@ -20,6 +20,7 @@ #include "key_coordinate_frame_bin_parser.h" #include "sclutils.h" +#include "put_record.h" #include using namespace std; using namespace scl; @@ -108,6 +109,10 @@ parsing_layout_table() { SclLayout& cur = m_layout_table[i]; decode_layout_record(cur, record_width); } +#ifdef __SCL_TXT_DEBUG + put_layout_table(DECODE, m_layout_table); +#endif + } void diff --git a/binary_xmlresource/magnifier_configure_bin_parser.cpp b/binary_xmlresource/magnifier_configure_bin_parser.cpp index d4409e2..75d1a57 100644 --- a/binary_xmlresource/magnifier_configure_bin_parser.cpp +++ b/binary_xmlresource/magnifier_configure_bin_parser.cpp @@ -19,6 +19,7 @@ #include "file_storage.h" #include using namespace std; +#include "put_record.h" BinMagnifierConfigParser* BinMagnifierConfigParser::m_instance = NULL; BinMagnifierConfigParser::BinMagnifierConfigParser() { @@ -88,6 +89,10 @@ void BinMagnifierConfigParser::parsing_magnifier_configure() { cur->padding_y = m_storage.get(record_width.padding_y); //show_shift_label cur->show_shift_label = m_storage.get(record_width.show_shift_label); + +#ifdef __SCL_TXT_DEBUG + put_magnifier_wnd_configure(DECODE, m_magnifier_configure); +#endif } PSclMagnifierWndConfigure BinMagnifierConfigParser::get_magnifier_configure() { diff --git a/binary_xmlresource/modifier_decoration_bin_parser.cpp b/binary_xmlresource/modifier_decoration_bin_parser.cpp index 2598b50..40265a3 100644 --- a/binary_xmlresource/modifier_decoration_bin_parser.cpp +++ b/binary_xmlresource/modifier_decoration_bin_parser.cpp @@ -17,6 +17,7 @@ #include "modifier_decoration_bin_parser.h" #include +#include "put_record.h" BinModifierDecorationParser* BinModifierDecorationParser::m_instance = NULL; @@ -71,6 +72,9 @@ BinModifierDecorationParser::parsing_modifier_decoration_table() { cur++; } +#ifdef __SCL_TXT_DEBUG + put_modifier_decoration(DECODE, m_modifier_decoration_table); +#endif } int diff --git a/binary_xmlresource/nine_patch_file_list_bin_parser.cpp b/binary_xmlresource/nine_patch_file_list_bin_parser.cpp index 298d33d..e039c7a 100644 --- a/binary_xmlresource/nine_patch_file_list_bin_parser.cpp +++ b/binary_xmlresource/nine_patch_file_list_bin_parser.cpp @@ -18,6 +18,7 @@ #include "nine_patch_file_list_bin_parser.h" #include #include +#include "put_record.h" BinNinePatchFileParser* BinNinePatchFileParser::m_instance = NULL; BinNinePatchFileParser::BinNinePatchFileParser() { @@ -63,6 +64,9 @@ void BinNinePatchFileParser::parsing_nine_patch_file_list() { cur->bottom = m_storage.get(record_width.bottom); cur++; } +#ifdef __SCL_TXT_DEBUG + put_nine_patch_info(DECODE, m_nine_patch_file_list); +#endif } SclNinePatchInfo* diff --git a/res/put_record.h b/res/put_record.h new file mode 100644 index 0000000..3f240de --- /dev/null +++ b/res/put_record.h @@ -0,0 +1,608 @@ +/* + * Copyright 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 __PUT_RECORD_H__ +#define __PUT_RECORD_H__ +/*This file is just for debug*/ +/*Use this file to output scl resources in txt format*/ + +// Open this flag to output the scl txt +// #define __SCL_TXT_DEBUG + +///////////////////////////////////////////////////// +#ifdef __SCL_TXT_DEBUG + +#include +#include +#include +using namespace std; +#include "sclresource.h" + +#define ENCODE 0 +#define DECODE 1 +#define PARSER 2 +static const string get_folder() { + return string(getenv("HOME")) + "/"; +} + +static inline void +put_str(FILE* fp, const char* str) { + assert(fp); + if (NULL != str) { + fprintf(fp, "%s\n", str); + } else { + fprintf(fp, "String:NULL\n"); + } +} + +static inline void +put_int(FILE* fp, int data) { + assert(fp); + fprintf(fp, "%d\n", data); +} +static inline void +put_flt(FILE* fp, double data) { + assert(fp); + fprintf(fp, "%lf\n", data); +} +static inline void +put_color(FILE* fp, const SclColor& c) { + assert(fp); + + fprintf(fp, "Color:\n"); + put_int(fp, c.r); + put_int(fp, c.g); + put_int(fp, c.b); + put_int(fp, c.a); +} + +static inline void +put_point(FILE* fp, const SclPoint& p) { + assert(fp); + + fprintf(fp, "Point:\n"); + put_int(fp, p.x); + put_int(fp, p.y); +} +static inline void +put_rect(FILE* fp, const SclRect& r) { + assert(fp); + + fprintf(fp, "Rect:\n"); + put_int(fp, r.left); + put_int(fp, r.top); + put_int(fp, r.right); + put_int(fp, r.bottom); +} + +static inline void +put_note(FILE*fp, int no) { + fprintf(fp, "--------------------------"); + fprintf(fp, "%d", no); + fprintf(fp, "--------------------------\n\n"); +} + +static inline void +put_note(FILE*fp, int i, int j) { + fprintf(fp, "--------------------------"); + fprintf(fp, "i is %d, j is %d", i, j); + fprintf(fp, "--------------------------\n\n"); +} +static inline void +put_seperator(FILE *fp) { + fprintf(fp, "\n##########\n\n"); +} + +static void +put_magnifier_wnd_configure_record(FILE* fp, const SclMagnifierWndConfigure& record) { + assert(fp); + + put_int(fp, record.style); + put_int(fp, record.width); + put_int(fp, record.height); + put_rect(fp, record.label_area_rect); + put_str(fp, record.bg_image_path); + put_seperator(fp); + + put_str(fp, record.bg_shift_image_path); + put_str(fp, record.bg_shift_lock_image_path); + put_str(fp, record.bg_long_key_image_path); + put_int(fp, record.use_actual_window); + put_str(fp, record.label_type); + put_seperator(fp); + + put_int(fp, record.padding_x); + put_int(fp, record.padding_y); + put_int(fp, record.show_shift_label); +} + +static void +put_autopopup_configure_record(FILE*fp, const SclAutoPopupConfigure& record) { + assert(fp); + + put_str(fp, record.bg_image_path); + put_color(fp, record.bg_color); + put_flt(fp, record.bg_line_width); + put_color(fp, record.bg_line_color); + put_int(fp, record.bg_padding); + put_seperator(fp); + + for (int i = 0; i < SCL_BUTTON_STATE_MAX; ++i) { + put_str(fp, record.button_image_path[i]); + } + put_seperator(fp); + + put_int(fp, record.sw_button_style); + put_int(fp, record.button_width); + put_int(fp, record.button_height); + put_int(fp, record.button_spacing); + + put_str(fp, record.label_type); + put_seperator(fp); + for (int i = 0; i < MAX_WND_DECORATOR; ++i) { + put_str(fp, record.decoration_image_path[i]); + } + + put_seperator(fp); + put_int(fp, record.decoration_size); + put_int(fp, record.max_column); + put_int(fp, record.add_grab_left); + put_int(fp, record.add_grab_right); + put_int(fp, record.add_grab_top); + put_seperator(fp); + put_int(fp, record.add_grab_bottom); +} + +static void +put_nine_patch_info_record(FILE* fp, const SclNinePatchInfo& record) { + assert(fp); + + put_str(fp, record.image_path); + put_int(fp, record.left); + put_int(fp, record.right); + put_int(fp, record.top); + put_int(fp, record.bottom); +} + +static void +put_modifier_decoration_record(FILE* fp, const SclModifierDecoration& record) { + assert(fp); + + put_int(fp, record.extract_background); + put_str(fp, record.name); + put_seperator(fp); + + for (int i = 0; i < DISPLAYMODE_MAX; ++i) { + for (int j = 0; j < KEY_MODIFIER_MAX; ++j) { + put_str(fp, record.bg_image_path[i][j]); + } + } +} + +static void +put_default_configure_record(FILE* fp, const SclDefaultConfigure& record) { + put_int(fp, record.display_mode); + put_str(fp, record.input_mode); + put_str(fp, record.image_file_base_path); + put_int(fp, record.target_screen_width); + put_int(fp, record.target_screen_height); + put_seperator(fp); + + put_int(fp, record.auto_detect_landscape); + put_int(fp, record.use_magnifier_window); + put_int(fp, record.use_auto_popup); + put_int(fp, record.use_zoom_window); + put_int(fp, record.on_error_noti_send); + put_seperator(fp); + put_int(fp, record.use_word_deletion); + put_int(fp, record.sw_button_style); + put_seperator(fp); + for (int i = 0; i < DISPLAYMODE_MAX; ++i) { + put_int(fp, record.touch_offset_level[i]); + } + + put_seperator(fp); + for (int i = 0; i < DISPLAYMODE_MAX; ++i) { + put_point(fp, record.touch_offset[i]); + } + + put_seperator(fp); + put_str(fp, record.default_sub_layout); + put_int(fp, record.use_actual_dim_window); + put_color(fp, record.dim_color); +} + +static void put_label_properties_record(FILE* fp, const SclLabelProperties& record) { + put_str(fp, record.label_type); + put_str(fp, record.font_name); + put_int(fp, record.font_size); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < SCL_BUTTON_STATE_MAX; ++j) { + put_color(fp, record.font_color[i][j]); + } + } + put_seperator(fp); + put_int(fp, record.alignment); + put_int(fp, record.padding_x); + put_int(fp, record.padding_y); + put_int(fp, record.inner_width); + put_int(fp, record.inner_height); + put_int(fp, record.shadow_distance); + put_int(fp, record.shadow_direction); + put_seperator(fp); + + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < SCL_BUTTON_STATE_MAX; ++j) { + put_color(fp, record.shadow_color[i][j]); + } + } +} + +static void put_key_coordinate_record(FILE* fp, const SclLayoutKeyCoordinate& record) { + put_int(fp, record.x); + put_int(fp, record.y); + put_int(fp, record.width); + put_int(fp, record.height); + put_seperator(fp); + put_int(fp, record.add_hit_left); + put_int(fp, record.add_hit_right); + put_int(fp, record.add_hit_top); + put_int(fp, record.add_hit_bottom); + put_seperator(fp); + + put_int(fp, record.popup_relative_x); + put_int(fp, record.popup_relative_y); + put_int(fp, record.extract_offset_x); + put_int(fp, record.extract_offset_y); + put_seperator(fp); + put_str(fp, record.sub_layout); + put_seperator(fp); + + put_int(fp, record.magnifier_offset_x); + put_int(fp, record.magnifier_offset_y); + put_seperator(fp); + put_str(fp, record.custom_id); + put_int(fp, record.button_type); + put_int(fp, record.key_type); + put_int(fp, record.popup_type); + put_seperator(fp); + + put_int(fp, record.use_magnifier); + put_int(fp, record.use_long_key_magnifier); + + put_seperator(fp); + for (int i = 0; i < SCL_DRAG_STATE_MAX; ++i) { + put_str(fp, record.popup_input_mode[i]); + } + put_seperator(fp); + put_str(fp, record.sound_style); + put_str(fp, record.vibe_style); + put_int(fp, record.is_side_button); + put_int(fp, record.label_count); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < MAX_SIZE_OF_LABEL_FOR_ONE; ++j) { + put_str(fp, record.label[i][j]); + } + } + put_seperator(fp); + put_str(fp, record.label_type); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < SCL_BUTTON_STATE_MAX; ++j) { + put_str(fp, record.image_label_path[i][j]); + } + } + put_str(fp, record.image_label_type); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < SCL_BUTTON_STATE_MAX; ++j) { + put_str(fp, record.bg_image_path[i][j]); + } + } + put_seperator(fp); + put_int(fp, record.key_value_count); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < MAX_SIZE_OF_MULTITAP_CHAR; ++j) { + put_str(fp, record.key_value[i][j]); + } + } + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < MAX_SIZE_OF_LABEL_FOR_ONE; ++j) { + put_int(fp, record.key_event[i][j]); + + } + } + put_seperator(fp); + put_str(fp, record.long_key_value); + put_int(fp, record.use_repeat_key); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < MAX_SIZE_OF_AUTOPOPUP_STRING; ++j) { + put_str(fp, record.autopopup_key_labels[i][j]); + put_str(fp, record.autopopup_key_values[i][j]); + put_int(fp, record.autopopup_key_events[i][j]); + } + } + put_seperator(fp); + put_int(fp, record.dont_close_popup); + put_int(fp, record.extra_option); + put_int(fp, record.multitouch_type); + put_seperator(fp); + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < MAX_SIZE_OF_LABEL_FOR_ONE; ++j) { + put_str(fp, record.magnifier_label[i][j]); + } + } +} +static void put_input_mode_configure_record(FILE* fp, const SclInputModeConfigure& record) { + put_str(fp, record.name); + put_str(fp, record.layouts[0]); + put_str(fp, record.layouts[1]); + put_int(fp, record.use_virtual_window); + put_int(fp, record.use_dim_window); + put_flt(fp, record.timeout); +} +static void put_layout_record(FILE* fp, const SclLayout& record ) { + put_str(fp, record.name); + put_int(fp, record.display_mode); + put_int(fp, record.style); + put_int(fp, record.width); + put_int(fp, record.height); + put_seperator(fp); + put_int(fp, record.use_sw_button); + put_int(fp, record.extract_background); + put_int(fp, record.use_magnifier_window); + put_int(fp, record.key_width); + put_int(fp, record.key_height); + put_seperator(fp); + put_int(fp, record.use_sw_background); + put_flt(fp, record.bg_line_width); + put_int(fp, record.add_grab_left); + put_int(fp, record.add_grab_right); + put_int(fp, record.add_grab_top); + put_int(fp, record.add_grab_bottom); + put_seperator(fp); + for(int i = 0; i < SCL_BUTTON_STATE_MAX; ++i) { + put_str(fp, record.image_path[i]); + } + put_seperator(fp); + //key_background_image + for (int i = 0; i < SCL_SHIFT_STATE_MAX; ++i) { + for (int j = 0; j < SCL_BUTTON_STATE_MAX; ++j) { + put_str(fp, record.key_background_image[i][j]); + } + } +} + +static void put_input_mode_configure_table(int flag, const PSclInputModeConfigure table) { + string file_name; + if (flag == ENCODE) + file_name = "encode_input_mode_configure.txt"; + else if (flag == DECODE) + file_name = "decode_input_mode_configure.txt"; + else + file_name = "sclres_input_mode_configure.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + for (int i = 0; i < MAX_SCL_INPUT_MODE; ++i) { + put_note(fp, i); + put_input_mode_configure_record(fp, table[i]); + } + + fclose(fp); +} + +static void put_layout_table(int flag, const PSclLayout table) { + string file_name; + if (flag == ENCODE) + file_name = "encode_layout.txt"; + else if (flag == DECODE) + file_name = "decode_layout.txt"; + else + file_name = "sclres_layout.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + for (int i = 0; i < MAX_SCL_LAYOUT; ++i) { + put_note(fp, i); + put_layout_record(fp, table[i]); + } + fclose(fp); +} + +static void +put_key_coordinate_frame(int flag, const PSclLayoutKeyCoordinatePointerTable frame) { + string file_name; + if (flag == ENCODE) { + file_name = "encode_key_coordinate_frame.txt"; + } else if (flag == DECODE){ + file_name = "decode_key_coordinate_frame.txt"; + } else + file_name = "sclres_key_coordinate_frame.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + for (int i = 0; i < MAX_SCL_LAYOUT; ++i) { + if (frame[i][0] == NULL) break; + + for (int j = 0; j < MAX_KEY; ++j) { + put_note(fp, i, j); + const SclLayoutKeyCoordinatePointer p = frame[i][j]; + if (!p) break; + const SclLayoutKeyCoordinate& cur = *p; + put_key_coordinate_record(fp, cur); + } + } + fclose(fp); +} + +static void +put_label_properties_frame(int flag, const PSclLabelPropertiesTable frame) { + string file_name; + if (flag == ENCODE) { + file_name = "encode_label_properties_frame.txt"; + } else if (flag == DECODE){ + file_name = "decode_label_properties_frame.txt"; + } else + file_name = "sclres_label_properties_frame.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + for (int i = 0; i < MAX_SCL_LABEL_PROPERTIES; ++i) { + for(int j = 0; j < MAX_SIZE_OF_LABEL_FOR_ONE; ++j) { + put_note(fp, i, j); + put_label_properties_record(fp, frame[i][j]); + } + } + fclose(fp); +} + +static void +put_default_configure(int flag, const SclDefaultConfigure& record) { + + string file_name; + if (flag == ENCODE) { + file_name = "encode_default_configure.txt"; + } else if (flag == DECODE) { + file_name = "decode_default_configure.txt"; + } else + file_name = "sclres_default_configure.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + put_default_configure_record(fp, record); + fclose(fp); +} + +static void +put_autopopup_configure(int flag, const SclAutoPopupConfigure& record) { + + string file_name; + if (flag == ENCODE) { + file_name = "encode_autopopup_configure.txt"; + } else if (flag == DECODE){ + file_name = "decode_autopopup_configure.txt"; + } else + file_name = "sclres_autopopup_configure.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + put_autopopup_configure_record(fp, record); + fclose(fp); +} + +static void +put_nine_patch_info(int flag, const SclNinePatchInfo* table) { + static const int MAX_NINE_PATCH_FILE_LIST = 128; + + string file_name; + if (flag == ENCODE) { + file_name = "encode_nine_patch_info.txt"; + } else if (flag == DECODE) { + file_name = "decode_nine_patch_info.txt"; + } else + file_name = "sclres_nine_patch_info.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + + for (int i = 0; i < MAX_NINE_PATCH_FILE_LIST; ++i) { + put_note(fp, i); + put_nine_patch_info_record(fp, table[i]); + } + fclose(fp); +} + + +static void +put_magnifier_wnd_configure(int flag, const SclMagnifierWndConfigure& record) { + string file_name; + if (flag == ENCODE) { + file_name = "encode_magnifier_wnd_configure.txt"; + } else if (flag == DECODE) { + file_name = "decode_magnifier_wnd_configure.txt"; + } else + file_name = "sclres_magnifier_wnd_configure.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + put_magnifier_wnd_configure_record(fp, record); + fclose(fp); +} + +static void +put_modifier_decoration(int flag, const PSclModifierDecoration table) { + string file_name; + if (flag == ENCODE) { + file_name = "encode_modifier_decoration.txt"; + } else if (flag == DECODE) { + file_name = "decode_modifier_decoration.txt"; + } else + file_name = "sclres_modifier_decoration.txt"; + + string path = get_folder() + file_name; + FILE *fp = fopen(path.c_str(), "w+"); + if (!fp) { + perror("Warning: path.c_str()"); + return; + } + + for (int i = 0; i < MAX_SCL_MODIFIER_DECORATION_NUM; ++i) { + put_note(fp, i); + put_modifier_decoration_record(fp, table[i]); + } + fclose(fp); +} +#endif +#endif diff --git a/res/simple_debug.cpp b/res/simple_debug.cpp new file mode 100644 index 0000000..7173d92 --- /dev/null +++ b/res/simple_debug.cpp @@ -0,0 +1,125 @@ +/* + * Copyright 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "simple_debug.h" +#include +#include +#include +#include +#include +#include + +SclLog* SclLog::m_instance = NULL; + +SclLog::SclLog() : m_flog(NULL) { + char *env = NULL; + char *scllog = NULL; + char log_path[128]; + + /* + * Use export scllog="true" to enable scllog + */ + scllog = getenv("scllog"); + if (scllog == NULL || 0 != strcmp(scllog, "true")) { + return; + } + + env = getenv("HOME"); + if (env == NULL) { + return; + } + + snprintf(log_path, 128, "%s/scl.log", env); + m_flog = fopen(log_path, "w+"); + if (m_flog == NULL) { + fprintf(stderr, "Could not open file: %s", log_path); + } +} + +SclLog::~SclLog() { + if (m_flog != NULL) { + fclose(m_flog); + } +} + +SclLog* +SclLog::get_instance() { + if(m_instance == NULL) { + m_instance = new SclLog(); + } + + return m_instance; +} + +void +SclLog::log(enum LOG_LEVEL level, char* fmt, ...) { + static const char *log_message[MAX_LOG_LEVEL] = { + "message", "warning", "debug", "error" + }; + + if (m_flog == NULL) { + return; + } + + char str_log[128]; + va_list ap; + va_start(ap, fmt); + vsprintf(str_log, fmt, ap); + va_end(ap); + + /* + * log current time + */ + time_t now; + struct tm *timenow; + + time(&now); + timenow = localtime(&now); + + fprintf(m_flog, "[ %s ] %s\n", log_message[level], asctime(timenow)); + fprintf(m_flog, "\t%s\n", str_log); + + fflush(m_flog); +} + +void +SCLLOG(enum SclLog::LOG_LEVEL level, char* fmt, ...) { + SclLog *log = SclLog::get_instance(); + if (log) { + char str_log[128]; + va_list ap; + va_start(ap, fmt); + vsprintf(str_log, fmt, ap); + va_end(ap); + log->log(level, str_log); + } +} + +static struct timeval g_time_begin; +static struct timeval g_time_end; +void +SCLLOG_TIME_BEGIN() { + gettimeofday(&g_time_begin, NULL); +} + +void +SCLLOG_TIME_END(char *msg) { + gettimeofday(&g_time_end, NULL); + + long diff = (g_time_end.tv_sec - g_time_begin.tv_sec) * 1000000 + g_time_end.tv_usec - g_time_begin.tv_usec; + fprintf(stdout, "%s use %ld usec\n", msg, diff); +} diff --git a/res/simple_debug.h b/res/simple_debug.h new file mode 100644 index 0000000..0fd3a24 --- /dev/null +++ b/res/simple_debug.h @@ -0,0 +1,47 @@ +/* + * Copyright 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 __SIMPLE_DEBUG_H__ +#define __SIMPLE_DEBUG_H__ +#include + +class SclLog { + public: + enum LOG_LEVEL { + MESSAGE = 0, + WARNING, + DEBUG, + ERROR, + MAX_LOG_LEVEL + }; + + static SclLog* get_instance(); + void log(enum LOG_LEVEL, char* fmt, ...); + ~SclLog(); + private: + SclLog(); + static SclLog* m_instance; + + FILE *m_flog; +}; + + +void SCLLOG(enum SclLog::LOG_LEVEL level, char* fmt, ...); + +void SCLLOG_TIME_BEGIN(); +void SCLLOG_TIME_END(char *msg); +#endif diff --git a/res/simple_debug_test.cpp b/res/simple_debug_test.cpp new file mode 100644 index 0000000..f61a244 --- /dev/null +++ b/res/simple_debug_test.cpp @@ -0,0 +1,34 @@ +/* + * Copyright 2012-2013 Samsung Electronics Co., Ltd. + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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. + * + */ + +/* + * Use `g++ -I. simple_debug.cpp simple_debug_test.cpp` to compiler it + */ +#include +#include + +int main() { + /* Test SclLog */ + SclLog *log = SclLog::get_instance(); + if (log) { + log->log(SclLog::WARNING, "Test %d\n", 100); + } + + /* Test SCLLOG */ + SCLLOG(SclLog::ERROR, "%s/%d", "SCLLOG", 100); + return 0; +} diff --git a/scl/gwes/gtk/sclgraphics-gtk.cpp b/scl/gwes/gtk/sclgraphics-gtk.cpp index 3c5510f..28e57bd 100644 --- a/scl/gwes/gtk/sclgraphics-gtk.cpp +++ b/scl/gwes/gtk/sclgraphics-gtk.cpp @@ -46,6 +46,7 @@ CSCLGraphicsImplGtk::draw_image(sclwindow window, const scldrawctx drawCtx, sclc sclint destWidth, sclint destHeight, sclint srcX, sclint srcY, sclint srcWidth, sclint srcHeight) { SCL_DEBUG(); + //printf("\n %d destX, %d destY,\n %d destWidth, %d destHeight, %d srcX, %d srcY,\n %d srcWidth, %d srcHeight\n", destX, destY, destWidth, destHeight, srcX, srcWidth, srcHeight); /* pre-condition */ scl_assert_return(imgPath); @@ -215,10 +216,12 @@ CSCLGraphicsImplGtk::draw_text(sclwindow window, const scldrawctx drawCtx, const if (textExtents.width > width) { int newSize = fontinfo.fontsize - (fontinfo.fontsize * (float)(textExtents.width - width)) / width - 1; + //printf("%s , %ld %ld %ld %ld %d\n", str, (int)(textExtents.width), (int)(textExtents.x_bearing), (int)(textExtents.x_advance), (int)(width), fontinfo.fontsize); cairo_set_font_size(cr, newSize); cairo_text_extents(cr, str, &textExtents); cairo_text_extents(cr, "|", &barExtents); + //printf("%s , %ld %ld %ld %ld %d\n", str, (int)(textExtents.width), (int)(textExtents.x_bearing), (int)(textExtents.x_advance), (int)(width), newSize); } if (align == LABEL_ALIGN_CENTER_TOP || align == LABEL_ALIGN_CENTER_MIDDLE || align == LABEL_ALIGN_CENTER_BOTTOM) { diff --git a/scl/sclcontroller.cpp b/scl/sclcontroller.cpp index c0c5c99..2776ebb 100644 --- a/scl/sclcontroller.cpp +++ b/scl/sclcontroller.cpp @@ -1332,6 +1332,7 @@ CSCLController::process_button_over_event(sclwindow window, sclint x, sclint y, return FALSE; } if (keyindex != highlighted_key || window != highlighted_window ) { + printf("%d != %d || %p != %p\n", keyindex, highlighted_key, window, highlighted_window); if(layout) { SclPoint pos = {0,}; sclfloat scale_rate_x, scale_rate_y; @@ -1346,12 +1347,15 @@ CSCLController::process_button_over_event(sclwindow window, sclint x, sclint y, if (coordinate->key_type != KEY_TYPE_NONE) { if (context->get_tts_enabled()) { const char *targetstr = coordinate->hint_string[shiftidx][btncontext->multikeyIdx]; + printf("coordinate->hint_string[%d][%d] : %p\n", shiftidx, btncontext->multikeyIdx, targetstr); if (targetstr == NULL) { targetstr = coordinate->key_value[shiftidx][btncontext->multikeyIdx]; } + printf("coordinate->key_value[%d][%d] : %p\n", shiftidx, btncontext->multikeyIdx, targetstr); if (targetstr == NULL) { targetstr = coordinate->label[shiftidx][0]; } + printf("coordinate->label[%d][0] : %p\n", shiftidx, targetstr); /*if(state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY || state->get_cur_action_state() == ACTION_STATE_POPUP_LONGKEY ) { targetstr = coordinate->long_key_value; @@ -1752,6 +1756,7 @@ CSCLController::process_button_release_event(sclwindow window, sclint x, sclint sclres_manager->get_layout_id(sclres_input_mode_configure[popup_input_mode].layouts[display_mode]); if (popupLayoutId == NOT_USED){ // deal with NOT_USED + printf("popupLayoutID is not used.\n"); } SclLayout *layout = NULL; /* FIXME */ @@ -2762,6 +2767,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice } deltax = originx - startx; deltay = originy - starty; + //printf("DIST : %f, RECOG : %f\n", dist, direction_recog_dist); if (dist > direction_recog_dist) { next_drag_state = get_drag_state(deltax, deltay); /* Disable longkey if dragging is recognized */ @@ -2780,6 +2786,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice deltax = originx - startx; deltay = originy - starty; sclfloat dist_farthest = utils->get_approximate_distance(originx, originy, startx, starty); + printf("%d %d %d %d %f, %d %d\n", originx, originy, startx, starty, dist_farthest, cur_drag_state, next_drag_state); /* Let's see how much we are away from the last farthest point */ sclfloat diffdir_recog_dist = SCL_DIRECTION_RELATIVE_DIFFDIR_RECOG_DIST * utils->get_smallest_scale_rate(); /* If we moved certain amount from the point where direction changed, process drag state change routine */ @@ -2829,6 +2836,7 @@ CSCLController::mouse_move(sclwindow window, sclint x, sclint y, scltouchdevice if (drag_state_changed) { /* When the dragging direction changes, save the current position as farthest point for future comparison */ context->set_farthest_move_point(touch_id, originx, originy); + printf("SET_FARTHEST : %d %d %d\n", originx, originy, context->get_cur_drag_state(touch_id)); } } @@ -3122,6 +3130,7 @@ CSCLController::timer_event(const scl32 data) move_point.x = (move_ctx->geometry.x - popup_ctx->geometry.x) + move_point.x; move_point.y = (move_ctx->geometry.y - popup_ctx->geometry.y) + move_point.y; } + printf("AUTOPOPUP : %d %d\n", move_point.x, move_point.y); CSCLWindows *windows = CSCLWindows::get_instance(); if (windows && coordinate) { diff --git a/scl/sclresourcecache.cpp b/scl/sclresourcecache.cpp index 8da21ad..94b4b14 100644 --- a/scl/sclresourcecache.cpp +++ b/scl/sclresourcecache.cpp @@ -15,10 +15,6 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include "sclresourcekeys.h" @@ -718,7 +714,7 @@ CSCLResourceCache::add_private_key(SclPrivateKeyProperties* privProperties, sclb if (mPrivateKeyProperties[loop].valid == FALSE) break; } if (loop == MAX_PRIVATE_KEY) { - LOGD("Out of buffer!! could not insert new private data into buffer \n"); + printf("Out of buffer!! could not insert new private data into buffer \n"); return ret; } } diff --git a/scl/sclutils.cpp b/scl/sclutils.cpp index 1fdd768..bcb3d70 100644 --- a/scl/sclutils.cpp +++ b/scl/sclutils.cpp @@ -387,7 +387,7 @@ CSCLUtils::get_nine_patch_info(const sclchar *image_path) finished = TRUE; } } - + SclResParserManager *sclres_manager = SclResParserManager::get_instance(); if (sclres_manager) { if (sclres_manager->get_nine_patch_info(buf, &ret)) { diff --git a/scl/sclwindows.cpp b/scl/sclwindows.cpp index 792edf9..31b5c27 100644 --- a/scl/sclwindows.cpp +++ b/scl/sclwindows.cpp @@ -15,11 +15,6 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif - #include "sclwindows.h" #ifdef __WIN32__ #include "sclwindows-win32.h" @@ -133,7 +128,7 @@ sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectang events->create_timer(SCL_TIMER_POPUP_TIMEOUT, timeout, layout); } - LOGD("create window (%p) x: %d, y:%d, width:%d, height:%d , layout:%d, popuptype:%d\n", + printf("create window (%p) x: %d, y:%d, width:%d, height:%d , layout:%d, popuptype:%d\n", window, geometry.x, geometry.y, geometry.width, geometry.height, layout, popup_type); events->connect_window_events(window, SCL_EVENT_MOUSE | SCL_EVENT_EXPOSE); @@ -240,6 +235,8 @@ sclwindow CSCLWindows::open_popup(const SclWindowOpener opener, const SclRectang bool CSCLWindows::close_popup(sclwindow window) { + printf("close_popup window (%p) \n",window); + pop_window_in_Z_order_list(window); hide_window(get_dim_window()); @@ -350,7 +347,7 @@ CSCLWindows::create_window(const SclWindowOpener opener, const SclRectangle &geo //get_window_context(window, TRUE); if (window == NULL) { - LOGD("Failed to create a new window. The size of window buffer has exeeded.\n"); + printf("Failed to create a new window. The size of window buffer has exeeded.\n"); } } return window; @@ -380,9 +377,9 @@ CSCLWindows::create_magnifier_window(const sclwindow parent, scl16 x, scl16 y, s set_parent(parent, window); if (window == NULL) { - LOGD("Failed to create a new window. The size of window buffer has exeeded.\n"); + printf("Failed to create a new window. The size of window buffer has exeeded.\n"); } else { - LOGD("Magnifier Window %p created\n", window); + printf("Magnifier Window %p created\n", window); } } @@ -430,7 +427,7 @@ CSCLWindows::create_dim_window(const sclwindow parent, SclWindowContext *winctx, } if (window == NULL) { - LOGD("Failed to create a new window. The size of window buffer has exeeded.\n"); + printf("Failed to create a new window. The size of window buffer has exeeded.\n"); } } @@ -866,7 +863,7 @@ void CSCLWindows::set_window_rotation(const sclwindow window, SCLRotation rotati */ } else { impl->set_window_rotation(window, rotation); - LOGD("## set_window_rotation : %d \n", rotation); + printf("## set_window_rotation : %d \n", rotation); } } diff --git a/scl/utils/linux/sclutils-linux.cpp b/scl/utils/linux/sclutils-linux.cpp index 4560441..6cf2fa5 100644 --- a/scl/utils/linux/sclutils-linux.cpp +++ b/scl/utils/linux/sclutils-linux.cpp @@ -118,20 +118,20 @@ CSCLUtilsImplLinux::play_tts(const sclchar* str) { r = tts_get_state(tts, ¤t_state); if (TTS_ERROR_NONE != r) { - LOGD("Fail to get state from TTS : ret(%d)\n", r); + printf("Fail to get state from TTS : ret(%d)\n", r); } if (TTS_STATE_PLAYING == current_state) { r = tts_stop(tts); if (TTS_ERROR_NONE != r) { - LOGD("Fail to stop TTS : ret(%d)\n", r); + printf("Fail to stop TTS : ret(%d)\n", r); } } r = tts_add_text(tts, str, "en_US", TTS_VOICE_TYPE_FEMALE, TTS_SPEED_NORMAL, &utt_id); if (TTS_ERROR_NONE == r) { r = tts_play(tts); if (TTS_ERROR_NONE != r) { - LOGD("Fail to play TTS : ret(%d)\n", r); + printf("Fail to play TTS : ret(%d)\n", r); } } } @@ -229,12 +229,12 @@ CSCLUtilsImplLinux::open_devices() { /*r = tts_create(&tts); if (TTS_ERROR_NONE != r) { - LOGD("tts_create FAILED : result(%d)", r); + printf("tts_create FAILED : result(%d)", r); } else { tts_set_mode (tts, TTS_MODE_SCREEN_READER); } if (TTS_ERROR_NONE != r) { - LOGD("tts_set_mode FAILED : result(%d)", r); + printf("tts_set_mode FAILED : result(%d)", r); } tts_state_e current_state; @@ -264,12 +264,12 @@ CSCLUtilsImplLinux::close_devices() { /* r = tts_unprepare(tts); if (TTS_ERROR_NONE != r) { - LOGD("tts_unprepare FAILED : result(%d)", r); + printf("tts_unprepare FAILED : result(%d)", r); } r = tts_destroy(tts); if (TTS_ERROR_NONE != r) { - LOGD("tts_destroy FAILED : result(%d)", r); + printf("tts_destroy FAILED : result(%d)", r); }*/ return TRUE; } diff --git a/sclres/sclres_manager.cpp b/sclres/sclres_manager.cpp index 7fa4573..9550d9f 100644 --- a/sclres/sclres_manager.cpp +++ b/sclres/sclres_manager.cpp @@ -19,9 +19,11 @@ #include "xmlresource.h" #include "binary_xmlresource.h" #include +#include "simple_debug.h" using namespace xmlresource; using namespace binary_xmlresource; using namespace sclres; +#include "put_record.h" static sclres::SclRes *_current_parser = NULL; @@ -47,9 +49,11 @@ SclResParserManager::SclResParserManager() { void SclResParserManager::init(const SCLParserType parser_type, const char *entry_filepath) { if (parser_type == SCL_PARSER_TYPE_XML) { + SCLLOG(SclLog::MESSAGE, "Use text xml\n"); _current_parser = XMLResource::get_instance(); } else if (parser_type == SCL_PARSER_TYPE_BINARY_XML) { + SCLLOG(SclLog::MESSAGE, "Use binary xml\n"); _current_parser = BinResource::get_instance(); } @@ -66,6 +70,17 @@ SclResParserManager::init(const SCLParserType parser_type, const char *entry_fil /* Assume the directory where the main entry file exists, is the default resource directory */ _current_parser->set_resource_directory(filepath.c_str()); _current_parser->init(filename.c_str()); +#ifdef __SCL_TXT_DEBUG + put_autopopup_configure(PARSER, *(_current_parser->get_autopopup_configure())); + put_default_configure(PARSER, *(_current_parser->get_default_configure())); + put_input_mode_configure_table(PARSER, _current_parser->get_input_mode_configure_table()); + put_key_coordinate_frame(PARSER, _current_parser->get_key_coordinate_pointer_frame()); + put_label_properties_frame(PARSER, _current_parser->get_label_properties_frame()); + put_layout_table(PARSER, _current_parser->get_layout_table()); + put_magnifier_wnd_configure(PARSER, *(_current_parser->get_magnifier_configure())); + put_modifier_decoration(PARSER, _current_parser->get_modifier_decoration_table()); + //put_nine_patch_info(PARSER, _current_parser->get_nine_patch_file_list()); +#endif } } diff --git a/xml2binary/CMakeLists.txt b/xml2binary/CMakeLists.txt index 254d2ef..64c4925 100644 --- a/xml2binary/CMakeLists.txt +++ b/xml2binary/CMakeLists.txt @@ -27,6 +27,7 @@ SET(SRCS metadata_handler.cpp xml2dat.cpp ../sclres/sclres.cpp + ../res/simple_debug.cpp ) SET(PACKAGE ${PROJECT_NAME}) diff --git a/xml2binary/encode_autopopup_configure.cpp b/xml2binary/encode_autopopup_configure.cpp index d7c5c1c..1b2b42a 100644 --- a/xml2binary/encode_autopopup_configure.cpp +++ b/xml2binary/encode_autopopup_configure.cpp @@ -18,6 +18,7 @@ #include "encode_autopopup_configure.h" #include "xmlresource.h" #include "resource_storage_impl.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace xmlresource; static void _encode_color(ResourceStorage& storage, const SclColor& color, int width) { @@ -94,6 +95,11 @@ encode_autopopup_configure_file(ResourceStorage& storage, IMetaData_Helper& md_h XMLResource *xmlresource = XMLResource::get_instance(); PSclAutoPopupConfigure autopopupConfigure = xmlresource->get_autopopup_configure(); +#ifdef __SCL_TXT_DEBUG + put_autopopup_configure(ENCODE, *autopopupConfigure); + +#endif + Autopopup_configure_width record_width; set_autopopup_configure_width(md_helper, record_width); diff --git a/xml2binary/encode_default_configure.cpp b/xml2binary/encode_default_configure.cpp index eacfe77..476409c 100644 --- a/xml2binary/encode_default_configure.cpp +++ b/xml2binary/encode_default_configure.cpp @@ -20,6 +20,7 @@ #include "resource_storage_impl.h" using namespace xmlresource; +#include "put_record.h" #include "_auto_metadata.h" static void _encode_color(ResourceStorage& storage, const SclColor& color, int width) { if (width <= 0) return; @@ -95,6 +96,10 @@ encode_default_configure_file(ResourceStorage& storage, IMetaData_Helper& md_hel XMLResource *xmlresource = XMLResource::get_instance(); PSclDefaultConfigure defaultConfigure = xmlresource->get_default_configure(); +#ifdef __SCL_TXT_DEBUG + put_default_configure(ENCODE, *defaultConfigure); + +#endif Default_configure_width record_width; set_default_configure_width(md_helper, record_width); diff --git a/xml2binary/encode_input_mode_configure.cpp b/xml2binary/encode_input_mode_configure.cpp index 919d3d1..1221549 100644 --- a/xml2binary/encode_input_mode_configure.cpp +++ b/xml2binary/encode_input_mode_configure.cpp @@ -21,6 +21,7 @@ #include #include "xmlresource.h" #include "imetadata_helper.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace std; using namespace xmlresource; @@ -51,6 +52,10 @@ int encode_input_mode_configure_file(ResourceStorage& storage, IMetaData_Helper& XMLResource *xmlresource = XMLResource::get_instance(); PSclInputModeConfigure inputModeConfigureTable = xmlresource->get_input_mode_configure_table(); int size = xmlresource->get_inputmode_size(); +#ifdef __SCL_TXT_DEBUG + put_input_mode_configure_table(ENCODE, inputModeConfigureTable); + +#endif PSclInputModeConfigure cur = inputModeConfigureTable; //first 8 byte is the size of the block diff --git a/xml2binary/encode_key_coordinate_frame.cpp b/xml2binary/encode_key_coordinate_frame.cpp index 8e78c39..c18df7f 100644 --- a/xml2binary/encode_key_coordinate_frame.cpp +++ b/xml2binary/encode_key_coordinate_frame.cpp @@ -19,6 +19,7 @@ #include "encode_key_coordinate_frame.h" #include #include "xmlresource.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace xmlresource; using namespace std; diff --git a/xml2binary/encode_label_properties_frame.cpp b/xml2binary/encode_label_properties_frame.cpp index affc325..3f3a5d3 100644 --- a/xml2binary/encode_label_properties_frame.cpp +++ b/xml2binary/encode_label_properties_frame.cpp @@ -19,6 +19,7 @@ #include "encode_label_properties_frame.h" #include #include "xmlresource.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace xmlresource; using namespace std; @@ -94,6 +95,10 @@ encode_label_properties_frame_file(ResourceStorage& storage, IMetaData_Helper& m XMLResource *xmlresource = XMLResource::get_instance(); PSclLabelPropertiesTable labelPropertiesFrame = xmlresource->get_label_properties_frame(); +#ifdef __SCL_TXT_DEBUG + put_label_properties_frame(ENCODE, labelPropertiesFrame); + +#endif int size = xmlresource->get_labelproperty_size(); int maxj = MAX_SIZE_OF_LABEL_FOR_ONE; diff --git a/xml2binary/encode_layout.cpp b/xml2binary/encode_layout.cpp index b6ced5f..64f9b03 100644 --- a/xml2binary/encode_layout.cpp +++ b/xml2binary/encode_layout.cpp @@ -20,6 +20,7 @@ #include #include #include "xmlresource.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace std; using namespace xmlresource; @@ -129,6 +130,10 @@ encode_layout_file(ResourceStorage& storage, IMetaData_Helper& md_helper) { int size = xmlresource->get_layout_size(); +#ifdef __SCL_TXT_DEBUG + put_layout_table(ENCODE, layoutTable); +#endif + PSclLayout cur = layoutTable; // data size diff --git a/xml2binary/encode_magnifier_configure.cpp b/xml2binary/encode_magnifier_configure.cpp index c8d9f33..95c39cb 100644 --- a/xml2binary/encode_magnifier_configure.cpp +++ b/xml2binary/encode_magnifier_configure.cpp @@ -18,6 +18,7 @@ #include "encode_magnifier_configure.h" #include "xmlresource.h" #include "resource_storage_impl.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace xmlresource; static void @@ -68,6 +69,11 @@ encode_magnifier_configure_file(ResourceStorage& storage, IMetaData_Helper& md_h XMLResource *xmlresource = XMLResource::get_instance(); PSclMagnifierWndConfigure magnifierConfigure = xmlresource->get_magnifier_configure(); + +#ifdef __SCL_TXT_DEBUG + put_magnifier_wnd_configure(ENCODE, *magnifierConfigure); + +#endif Magnifier_configure_width record_width; set_magnifier_configure_width(md_helper, record_width); diff --git a/xml2binary/encode_modifier_decoration.cpp b/xml2binary/encode_modifier_decoration.cpp index ffb80cb..596226d 100644 --- a/xml2binary/encode_modifier_decoration.cpp +++ b/xml2binary/encode_modifier_decoration.cpp @@ -18,6 +18,7 @@ #include "encode_modifier_decoration.h" #include "xmlresource.h" #include "resource_storage_impl.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace xmlresource; static void @@ -39,9 +40,14 @@ encode_modifier_decoration_file(ResourceStorage& storage, IMetaData_Helper& md_h XMLResource *xmlresource = XMLResource::get_instance(); PSclModifierDecoration modifierDecorationTable = xmlresource->get_modifier_decoration_table(); if (modifierDecorationTable == NULL) { + printf("Error. modifier decoration table is NULL\n"); return 0; } +#ifdef __SCL_TXT_DEBUG + put_modifier_decoration(ENCODE, modifierDecorationTable); + +#endif Modifier_decoration_width record_width; set_modifier_decoration_width(md_helper, record_width); diff --git a/xml2binary/encode_nine_patch.cpp b/xml2binary/encode_nine_patch.cpp index 8b473b3..643402b 100644 --- a/xml2binary/encode_nine_patch.cpp +++ b/xml2binary/encode_nine_patch.cpp @@ -20,6 +20,7 @@ #include "xmlresource.h" #include "imetadata_helper.h" #include "resource_storage_impl.h" +#include "put_record.h" #include "_auto_metadata.h" using namespace std; using namespace xmlresource; @@ -43,10 +44,19 @@ encode_nine_patch_file(ResourceStorage& storage, IMetaData_Helper& md_helper) { int init_size = storage.size(); XMLResource *xmlresource = XMLResource::get_instance(); + if (xmlresource == NULL) { + printf("Error: failed to get xmlresource instance.\n"); + return 0; + } SclNinePatchInfo* ninePatchInfoTable = xmlresource->get_nine_patch_list(); if (ninePatchInfoTable == NULL) { + printf("Warning: nine patch list is null\n"); return 0; } +#ifdef __SCL_TXT_DEBUG + put_nine_patch_info(ENCODE, ninePatchInfoTable); + +#endif storage.reserve(8); storage.put(MAX_NINE_PATCH_FILE_LIST, 4); diff --git a/xml2binary/include/resource_storage_impl.h b/xml2binary/include/resource_storage_impl.h index 988f5d1..ea7b66a 100644 --- a/xml2binary/include/resource_storage_impl.h +++ b/xml2binary/include/resource_storage_impl.h @@ -19,10 +19,6 @@ #define __RESOURCE_STORAGE_IMPL_H__ #include "resource_storage.h" -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif inline ResourceStorage:: ResourceStorage() { init(); @@ -148,13 +144,13 @@ inline void ResourceStorage:: expand_storage() { unsigned int _new_size = (unsigned int)(m_capability + __RE_NEW_LENGTH__); if (_new_size > __MAX_NEW_SIZE__) { - LOGD("expand_storage failed: size is limited to %d\n", __MAX_NEW_SIZE__); + printf("expand_storage failed: size is limited to %d\n", __MAX_NEW_SIZE__); return; } char* _p = new char[_new_size]; if(_p == NULL) { - LOGD("expand_storage error"); + printf("expand_storage error"); return; } memset(_p, 0x00, _new_size); diff --git a/xml2binary/metadata_handler.cpp b/xml2binary/metadata_handler.cpp index 0296649..108dcf6 100644 --- a/xml2binary/metadata_handler.cpp +++ b/xml2binary/metadata_handler.cpp @@ -208,16 +208,19 @@ parsing_metadata() { doc = xmlReadFile(file_name, NULL, 0); if (doc == NULL) { + printf("Could not load file.\n"); exit(1); } curNode = xmlDocGetRootElement(doc); if (curNode == NULL) { + printf("empty document.\n"); xmlFreeDoc(doc); exit(1); } if (0 != xmlStrcmp(curNode->name, (const xmlChar*)"metadata")) { + printf("root name %s error!\n", curNode->name); xmlFreeDoc(doc); exit(1); } diff --git a/xml2binary/xml2dat.cpp b/xml2binary/xml2dat.cpp index 19a9c44..0e4a3e0 100644 --- a/xml2binary/xml2dat.cpp +++ b/xml2binary/xml2dat.cpp @@ -30,21 +30,25 @@ #include "encode_autopopup_configure.h" #include "encode_nine_patch.h" #include "xmlresource.h" -#include using namespace xmlresource; using namespace std; String_Encoder actual_string_encoder; IString_Encoder& string_encoder = actual_string_encoder; +static inline void show_usage(){ + static const char* message = { "xml2binary: missing folder operand\n" + "-------------------------------------------------------\n" + "| Usage: xml2binary operand1 operand2 |\n" + "| operand1: the folder where xml text files located |\n" + "| operand2: the folder you want to place the bin file|\n" + "------------------------------------------------------- \n"}; + printf("%s", message); +} + int main(const int argc, char* argv[]) { if (argc < 2) { - cout<<"xml2binary: missing folder operand\n" - <<"-------------------------------------------------------\n" - <<"| Usage: xml2binary operand1 operand2 |\n" - <<"| operand1: the folder where xml text files located |\n" - <<"| operand2: the folder you want to place the bin file|\n" - <<"------------------------------------------------------- \n"; + show_usage(); return -1; } @@ -67,6 +71,11 @@ int main(const int argc, char* argv[]) { } XMLResource *xmlresource = XMLResource::get_instance(); + if (!xmlresource) { + printf("Failed build xmlresource instance.\n"); + return -1; + } + xmlresource->set_resource_directory(xml_text_dir); xmlresource->init("main_entry.xml"); @@ -115,6 +124,7 @@ int main(const int argc, char* argv[]) { rs.reserve(MAX_DATATYPE * (SIZE_WIDTH + OFFSET_WIDTH)); int ret = rs.toFile(bin_file, offset); if (ret < 0) { + printf("error\n"); return -1; } } @@ -165,11 +175,12 @@ int main(const int argc, char* argv[]) { int offset = 0; int ret = rs.toFile(bin_file, offset); if (ret < 0) { + printf("error\n"); return -1; } } - cout<<"xml2binary succesfully.\n"; + printf("xml2binary succesfully.\n"); return 0; } diff --git a/xmlresource/autopopup_configure_parser.cpp b/xmlresource/autopopup_configure_parser.cpp index 5a7fc56..a405db0 100644 --- a/xmlresource/autopopup_configure_parser.cpp +++ b/xmlresource/autopopup_configure_parser.cpp @@ -15,16 +15,13 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include #include "autopopup_configure_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" using namespace std; class AutoPopupConfigureParserImpl { @@ -66,19 +63,19 @@ class AutoPopupConfigureParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s.", input_file); + SCLLOG(SclLog::WARNING, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("AutoPopupConfigParser: empty document.\n"); + SCLLOG(SclLog::WARNING, "AutoPopupConfigParser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"autopopup_configure")) { - LOGD("AutoPopup_Configure: root name error: %s\n!", (char *)cur_node->name); + SCLLOG(SclLog::WARNING, "AutoPopup_Configure: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -312,7 +309,7 @@ AutoPopupConfigParser::AutoPopupConfigParser() { AutoPopupConfigParser::~AutoPopupConfigParser() { if (m_impl) { - LOGD("~AutoPopupConfigParser() has called"); + SCLLOG(SclLog::MESSAGE, "~AutoPopupConfigParser() has called"); delete m_impl; m_impl = NULL; } diff --git a/xmlresource/default_configure_parser.cpp b/xmlresource/default_configure_parser.cpp index 27e89a7..f21d35c 100644 --- a/xmlresource/default_configure_parser.cpp +++ b/xmlresource/default_configure_parser.cpp @@ -15,15 +15,12 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include #include "default_configure_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" using namespace std; class DefaultConfigureParserImpl { @@ -55,19 +52,19 @@ class DefaultConfigureParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("DefaultConfigParser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "DefaultConfigParser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"default_configure")) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "DefaultConfigParser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -220,7 +217,7 @@ DefaultConfigParser::DefaultConfigParser() { DefaultConfigParser::~DefaultConfigParser() { if (m_impl) { - LOGD("~DefaultConfigParser() has called"); + SCLLOG(SclLog::MESSAGE, "~DefaultConfigParser() has called"); delete m_impl; m_impl = NULL; } diff --git a/xmlresource/input_mode_configure_parser.cpp b/xmlresource/input_mode_configure_parser.cpp index a7ec6d8..a47d624 100644 --- a/xmlresource/input_mode_configure_parser.cpp +++ b/xmlresource/input_mode_configure_parser.cpp @@ -15,15 +15,12 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include "input_mode_configure_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" /** Example of input mode XML file : * @@ -83,19 +80,19 @@ class InputModeConfigureParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("InputModeConfigParser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "InputModeConfigParser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)INPUT_MODE_CONFIGURE_TABLE_TAG)) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "InputModeConfigParser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -120,7 +117,7 @@ class InputModeConfigureParserImpl { m_inputmode_size++; cur_rec++; if (m_inputmode_size >= MAX_SCL_INPUT_MODE) { - LOGD("No Space for input mode record."); + SCLLOG(SclLog::ERROR, "No Space for input mode record."); break; } } @@ -160,7 +157,7 @@ class InputModeConfigureParserImpl { if (0 == xmlStrcmp(child_node->name, (const xmlChar *)INPUT_MODE_CONFIGURE_LAYOUT_TAG) ) { parsing_layouts(child_node, cur_rec); } else { - LOGD("No such node name: %s.\n", (char *)child_node->name); + SCLLOG(SclLog::WARNING, "input_mode_configure has no such node name: %s\n", (char *)child_node->name); } child_node = child_node->next; @@ -198,7 +195,7 @@ InputModeConfigParser::InputModeConfigParser() { InputModeConfigParser::~InputModeConfigParser() { if (m_impl) { - LOGD("~InputModeConfigParser() has called"); + SCLLOG(SclLog::MESSAGE, "~InputModeConfigParser() has called"); delete m_impl; m_impl = NULL; } @@ -220,14 +217,14 @@ InputModeConfigParser::init(const char* file) { int InputModeConfigParser::get_inputmode_id(const char *name) { if (name == NULL) { - LOGD("get_inputmode_id failed"); + SCLLOG(SclLog::DEBUG, "get_inputmode_id failed"); return -1; } PSclInputModeConfigure config_table = get_input_mode_configure_table(); if (config_table == NULL) { - LOGD("get_inputmode_id failed"); + SCLLOG(SclLog::DEBUG, "get_inputmode_id failed"); return -1; } @@ -239,7 +236,7 @@ InputModeConfigParser::get_inputmode_id(const char *name) { } } - LOGD("get_inputmode_id failed"); + SCLLOG(SclLog::DEBUG, "get_inputmode_id failed"); return -1; } diff --git a/xmlresource/label_properties_parser.cpp b/xmlresource/label_properties_parser.cpp index b630388..f633313 100644 --- a/xmlresource/label_properties_parser.cpp +++ b/xmlresource/label_properties_parser.cpp @@ -15,14 +15,12 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include "label_properties_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" +#include "put_record.h" static int match_alignment(const char* key) { assert(key != NULL); @@ -119,19 +117,19 @@ class LabelPropertiesParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("Label_Properties_Parser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "Label_Properties_Parser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"label_properties_frame")) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "Label_Properties_Parser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -149,7 +147,7 @@ class LabelPropertiesParserImpl { m_size++; curTable++; if (m_size >= MAX_SCL_LABEL_PROPERTIES) { - LOGD("No Space for label properties record."); + SCLLOG(SclLog::ERROR, "No Space for label properties record."); break; } } @@ -317,24 +315,24 @@ class LabelPropertiesParserImpl { temp_string[2] = key[2]; temp_string[3] = key[3]; if (sscanf(temp_string, "%x", &r) <= 0) { - LOGD("parsing_rgb() has failed."); + SCLLOG(SclLog::ERROR, "parsing_rgb() has failed."); } temp_string[2] = key[4]; temp_string[3] = key[5]; if (sscanf(temp_string, "%x", &g) <= 0) { - LOGD("parsing_rgb() has failed."); + SCLLOG(SclLog::ERROR, "parsing_rgb() has failed."); } temp_string[2] = key[6]; temp_string[3] = key[7]; if (sscanf(temp_string, "%x", &b) <= 0) { - LOGD("parsing_rgb() has failed."); + SCLLOG(SclLog::ERROR, "parsing_rgb() has failed."); } temp_string[2] = key[8]; temp_string[3] = key[9]; if (sscanf(temp_string, "%x", &a) <= 0) { - LOGD("parsing_rgb() has failed."); + SCLLOG(SclLog::ERROR, "parsing_rgb() has failed."); } cur_color.r = r; @@ -390,7 +388,7 @@ LabelPropertyParser::LabelPropertyParser() { LabelPropertyParser::~LabelPropertyParser() { if (m_impl) { - LOGD("~LabelPropertyParser() has called"); + SCLLOG(SclLog::MESSAGE, "~LabelPropertyParser() has called"); delete m_impl; m_impl = NULL; } diff --git a/xmlresource/layout_parser.cpp b/xmlresource/layout_parser.cpp index 0e6fea0..664dac6 100644 --- a/xmlresource/layout_parser.cpp +++ b/xmlresource/layout_parser.cpp @@ -15,10 +15,6 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include @@ -29,6 +25,8 @@ #include "default_configure_parser.h" /* use data in default_configure.xml */ #include "xml_parser_utils.h" #include "layout_parser_helper.h" +#include "put_record.h" +#include "simple_debug.h" using namespace std; @@ -261,19 +259,19 @@ LayoutParserImpl::load(int layout_id) { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::ERROR, "Could not load file: %s.", input_file); exit(1); } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("LayoutParserImpl: empty document.\n"); + SCLLOG(SclLog::ERROR, "LayoutParserImpl: empty document.\n"); xmlFreeDoc(doc); exit(1); } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)LAYOUT_TAG)) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::ERROR, "LayoutParserImpl: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); exit(1); } @@ -390,19 +388,19 @@ LayoutParserImpl::parsing_layout_table(char** file, int file_num) { string input_file = m_dir + "/" + m_layout_files[index]; doc = xmlReadFile(input_file.c_str(), NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file.c_str()); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file.c_str()); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("LayoutParserImpl: empty document.\n"); + SCLLOG(SclLog::DEBUG, "LayoutParserImpl: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)LAYOUT_TAG)) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "LayoutParserImpl: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -1197,7 +1195,7 @@ LayoutParserImpl::parsing_key_coordinate_record_node( *cur_rec_coordinate = (SclLayoutKeyCoordinatePointer)malloc(sizeof(SclLayoutKeyCoordinate)); if (*cur_rec_coordinate == NULL) { - LOGD("LayoutParserImpl: memory malloc eror.\n"); + SCLLOG(SclLog::ERROR, "LayoutParserImpl: memory malloc eror.\n"); return; } memset(*cur_rec_coordinate, 0x00, sizeof(SclLayoutKeyCoordinate)); @@ -1394,7 +1392,7 @@ LayoutParser::LayoutParser() { m_impl = new LayoutParserImpl; } LayoutParser::~LayoutParser() { - LOGD("~LayoutParser() has called"); + SCLLOG(SclLog::MESSAGE, "~LayoutParser() has called"); delete m_impl; m_impl = NULL; } diff --git a/xmlresource/magnifier_configure_parser.cpp b/xmlresource/magnifier_configure_parser.cpp index 96dabb0..df97616 100644 --- a/xmlresource/magnifier_configure_parser.cpp +++ b/xmlresource/magnifier_configure_parser.cpp @@ -14,17 +14,13 @@ * limitations under the License. * */ - -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include "magnifier_configure_parser.h" #include #include "xml_parser_utils.h" +#include "simple_debug.h" using namespace std; static SCLMagnifierStyle @@ -81,19 +77,19 @@ class MagnifierConfigureParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("MagnifierConfigParser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "MagnifierConfigParser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"magnifier_configure")) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "MagnifierConfigParser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -211,7 +207,7 @@ MagnifierConfigParser::MagnifierConfigParser() { MagnifierConfigParser::~MagnifierConfigParser() { if (m_impl) { - LOGD("~MagnifierConfigParser() has called"); + SCLLOG(SclLog::MESSAGE, "~MagnifierConfigParser() has called"); delete m_impl; m_impl = NULL; } diff --git a/xmlresource/main_entry_parser.cpp b/xmlresource/main_entry_parser.cpp index 1ce4675..d7331c8 100644 --- a/xmlresource/main_entry_parser.cpp +++ b/xmlresource/main_entry_parser.cpp @@ -15,16 +15,13 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include #include "main_entry_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" using namespace std; @@ -36,19 +33,19 @@ class MainEntryParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("MainEntryParser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "MainEntryParser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"main-entry")) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "MainEntryParser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -116,7 +113,7 @@ MainEntryParser::MainEntryParser() { MainEntryParser::~MainEntryParser() { if (m_impl) { - LOGD("~MainEntryParser() has called"); + SCLLOG(SclLog::MESSAGE, "~MainEntryParser() has called"); delete m_impl; m_impl = NULL; } diff --git a/xmlresource/modifier_decoration_parser.cpp b/xmlresource/modifier_decoration_parser.cpp index 6fc42a6..e538501 100644 --- a/xmlresource/modifier_decoration_parser.cpp +++ b/xmlresource/modifier_decoration_parser.cpp @@ -15,15 +15,12 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include "modifier_decoration_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" static int get_key_modifier_state_prop(const char*); //UTILS @@ -119,18 +116,18 @@ class ModifierDecorationParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("ModifierDecorationParser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "ModifierDecorationParser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"modifier_decoration_table")) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "ModifierDecorationParser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -147,7 +144,7 @@ class ModifierDecorationParserImpl { size++; cur_rec++; if (size >= MAX_SCL_MODIFIER_DECORATION_NUM) { - LOGD("No Space for modifier decoration record."); + SCLLOG(SclLog::ERROR, "No Space for modifier decoration record."); break; } } @@ -252,7 +249,7 @@ ModifierDecorationParser::ModifierDecorationParser() { ModifierDecorationParser::~ModifierDecorationParser() { if (m_impl) { - LOGD("~ModifierDecorationParser() has called"); + SCLLOG(SclLog::MESSAGE, "~ModifierDecorationParser() has called"); delete m_impl; m_impl = NULL; } @@ -273,13 +270,13 @@ int ModifierDecorationParser::get_modifier_decoration_id( const char *name ) { if (name == NULL) { - LOGD("get_modifier_decoration_id() has failed"); + SCLLOG(SclLog::DEBUG, "get_modifier_decoration_id() has failed"); return -1; } PSclModifierDecoration modifier_decoration_table = get_modifier_decoration_table(); if (modifier_decoration_table == NULL) { - LOGD("get_modifier_decoration_id() has failed"); + SCLLOG(SclLog::DEBUG, "get_modifier_decoration_id() has failed"); return -1; } for(int i = 0; i < MAX_SCL_MODIFIER_DECORATION_NUM; ++i) { @@ -290,7 +287,7 @@ ModifierDecorationParser::get_modifier_decoration_id( const char *name ) } } - LOGD("get_modifier_decoration_id() has failed"); + SCLLOG(SclLog::DEBUG, "get_modifier_decoration_id() has failed"); return -1; } diff --git a/xmlresource/nine_patch_file_list_parser.cpp b/xmlresource/nine_patch_file_list_parser.cpp index 044e358..a2cdff9 100644 --- a/xmlresource/nine_patch_file_list_parser.cpp +++ b/xmlresource/nine_patch_file_list_parser.cpp @@ -15,16 +15,13 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include #include "nine_patch_file_list_parser.h" #include "xml_parser_utils.h" +#include "simple_debug.h" class NinePatchFileListParserImpl { public: @@ -47,19 +44,19 @@ class NinePatchFileListParserImpl { doc = xmlReadFile(input_file, NULL, 0); if (doc == NULL) { - LOGD("Could not load file: %s\n", input_file); + SCLLOG(SclLog::DEBUG, "Could not load file: %s.", input_file); return -1; } cur_node = xmlDocGetRootElement(doc); if (cur_node == NULL) { - LOGD("Nine_Patch_File_Parser: empty document.\n"); + SCLLOG(SclLog::DEBUG, "Nine_Patch_File_Parser: empty document.\n"); xmlFreeDoc(doc); return -1; } if (0 != xmlStrcmp(cur_node->name, (const xmlChar*)"nine_patch_file_list")) { - LOGD("%s: root name error: %s.\n", __FUNCTION__, (char *)cur_node->name); + SCLLOG(SclLog::DEBUG, "Nine_Patch_File_Parser: root name error: %s\n!", (char *)cur_node->name); xmlFreeDoc(doc); return -1; } @@ -76,11 +73,11 @@ class NinePatchFileListParserImpl { get_prop_number(cur_node, "top", &(m_nine_patch_file_list[m_size].top)); get_prop_number(cur_node, "bottom", &(m_nine_patch_file_list[m_size].bottom)); if (m_nine_patch_file_list[m_size].image_path == NULL) { - LOGD("NinePatchFileParser: image_path should be not NULL"); + SCLLOG(SclLog::ERROR, "NinePatchFileParser: image_path should be not NULL"); } m_size++; if (m_size >= MAX_NINE_PATCH_FILE_LIST) { - LOGD("No Space for nine patch file list record."); + SCLLOG(SclLog::ERROR, "No Space for nine patch file list record."); break; } } @@ -105,7 +102,7 @@ NinePatchFileParser::NinePatchFileParser() { NinePatchFileParser::~NinePatchFileParser() { if (m_impl) { - LOGD("~NinePatchFileParser() has called."); + SCLLOG(SclLog::MESSAGE, "~NinePatchFileParser() has called."); delete m_impl; m_impl = NULL; } @@ -126,13 +123,13 @@ NinePatchFileParser::init(const char* file) { bool NinePatchFileParser::get_nine_patch_info(const char* filename, SclNinePatchInfo *info) { if (filename == NULL) { - LOGD("get_nine_patch_info() has failed."); + SCLLOG(SclLog::DEBUG, "get_nine_patch_info() has failed."); return false; } SclNinePatchInfo *nine_patch_list = get_nine_patch_list(); if (nine_patch_list == NULL) { - LOGD("get_nine_patch_info() has failed."); + SCLLOG(SclLog::DEBUG, "get_nine_patch_info() has failed."); return false; } @@ -146,7 +143,7 @@ NinePatchFileParser::get_nine_patch_info(const char* filename, SclNinePatchInfo } } - LOGD("get_nine_patch_info() has failed."); + SCLLOG(SclLog::DEBUG, "get_nine_patch_info() has failed."); return false; } diff --git a/xmlresource/xmlresource.cpp b/xmlresource/xmlresource.cpp index 2ca92ae..e70eacd 100644 --- a/xmlresource/xmlresource.cpp +++ b/xmlresource/xmlresource.cpp @@ -15,15 +15,12 @@ * */ -#include -#ifndef LOG_TAG -#define LOG_TAG "LIBSCL_UI" -#endif #include #include #include #include #include "xmlresource.h" +#include "simple_debug.h" using namespace xmlresource; @@ -121,7 +118,7 @@ get_layout_files(char **layout_files, int* size) { } if (empty_index == NOT_USED) { - LOGD("No space for new layout: %s.\n", cur_layout_file); + SCLLOG(SclLog::ERROR, "No space for new layout %s\n", cur_layout_file); } if (empty_index != NOT_USED) { @@ -142,25 +139,25 @@ XMLResource::init(const char *entry_filepath) { snprintf(input_file, _POSIX_PATH_MAX, "%s/%s", get_resource_directory(), entry_filepath); if ( 0 != m_main_entry_parser->init(input_file)) { /* main entry is necessary */ - LOGD("main entry init"); + SCLLOG(SclLog::ERROR, "main entry init"); } } /* get each type of xml file name */ XMLFiles& xml_files = m_main_entry_parser->get_xml_files(); - LOGD("init inputmode configure\n\n"); + SCLLOG(SclLog::MESSAGE, "init inputmode configure\n\n"); if (m_input_mode_configure_parser == NULL) { m_input_mode_configure_parser = InputModeConfigParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; snprintf(input_file, _POSIX_PATH_MAX, "%s/%s", get_resource_directory(), xml_files.input_mode_configure); if (0 != m_input_mode_configure_parser->init(input_file)) { /* input mode configure is necessary */ - LOGD("input mode configure init"); + SCLLOG(SclLog::ERROR, "input mode configure init"); } } - LOGD("init default_configure\n\n"); + SCLLOG(SclLog::MESSAGE, "init default_configure\n\n"); if (m_default_configure_parser == NULL) { m_default_configure_parser = DefaultConfigParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; @@ -168,11 +165,11 @@ XMLResource::init(const char *entry_filepath) { if (0 != m_default_configure_parser->init(input_file)) { /* default configure is not necessary */ - LOGD("default configure init"); + SCLLOG(SclLog::WARNING, "default configure init"); } } - LOGD("init modifier_decoration\n\n"); + SCLLOG(SclLog::MESSAGE, "init modifier_decoration\n\n"); if (m_modifier_decoration_parser == NULL) { m_modifier_decoration_parser = ModifierDecorationParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; @@ -180,10 +177,10 @@ XMLResource::init(const char *entry_filepath) { if (0 != m_modifier_decoration_parser->init(input_file)) { /* modifier decoration is not necessary */ - LOGD("modifier decoration init"); + SCLLOG(SclLog::WARNING, "modifier decoration init"); } } - LOGD("init label_properties\n\n"); + SCLLOG(SclLog::MESSAGE, "init label_properties\n\n"); if (m_label_properties_parser == NULL) { m_label_properties_parser = LabelPropertyParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; @@ -191,21 +188,21 @@ XMLResource::init(const char *entry_filepath) { if (0 != m_label_properties_parser->init(input_file)) { /* label properties is not necessary */ - LOGD("label properties init"); + SCLLOG(SclLog::WARNING, "label properties init"); } } - LOGD("init autopopup_configure\n\n"); + SCLLOG(SclLog::MESSAGE, "init autopopup_configure\n\n"); if (m_autopopup_configure_parser == NULL) { m_autopopup_configure_parser = AutoPopupConfigParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; snprintf(input_file, _POSIX_PATH_MAX, "%s/%s", get_resource_directory(), xml_files.autopopup_configure); if (0 != m_autopopup_configure_parser->init(input_file)) { /* autopopup configure is not necessary */ - LOGD("autopopup configure init"); + SCLLOG(SclLog::WARNING, "autopopup configure init"); } } - LOGD("init magnifier_configure\n\n"); + SCLLOG(SclLog::MESSAGE, "init magnifier_configure\n\n"); if (m_magnifier_configure_parser == NULL) { m_magnifier_configure_parser = MagnifierConfigParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; @@ -213,11 +210,11 @@ XMLResource::init(const char *entry_filepath) { if (0 != m_magnifier_configure_parser->init(input_file)) { /* magnifier configure is not necessary */ - LOGD("magnifier configure init"); + SCLLOG(SclLog::WARNING, "magnifier configure init"); } } - LOGD("init nine_patch_file_list\n\n"); + SCLLOG(SclLog::MESSAGE, "init nine_patch_file_list\n\n"); if (m_nine_patch_file_list_parser == NULL) { m_nine_patch_file_list_parser = NinePatchFileParser::get_instance(); char input_file[_POSIX_PATH_MAX] = {0}; @@ -225,11 +222,11 @@ XMLResource::init(const char *entry_filepath) { if (0 != m_nine_patch_file_list_parser->init(input_file)) { /* nine patch file list is not necessary */ - LOGD("nine patch file list init"); + SCLLOG(SclLog::WARNING, "nine patch file list init"); } } - LOGD("init layout\n\n"); + SCLLOG(SclLog::MESSAGE, "init layout\n\n"); if (m_layout_parser == NULL) { m_layout_parser = LayoutParser::get_instance(); char **layout_files = NULL; @@ -237,7 +234,7 @@ XMLResource::init(const char *entry_filepath) { layout_files = (char**)malloc(sizeof(char*) * MAX_SCL_LAYOUT); if (layout_files == NULL) { - LOGD("layout init"); + SCLLOG(SclLog::ERROR, "layout init"); exit(1); } memset(layout_files, 0, sizeof(char*) * MAX_SCL_LAYOUT); @@ -245,7 +242,7 @@ XMLResource::init(const char *entry_filepath) { get_layout_files(layout_files, &layout_file_size); if ( 0 != m_layout_parser->init(get_resource_directory(), layout_files, layout_file_size)) { /* layout is necessary */ - LOGD("layout init"); + SCLLOG(SclLog::ERROR, "layout init"); } for (int i = 0; i < layout_file_size; ++i) { free(layout_files[i]); @@ -254,7 +251,7 @@ XMLResource::init(const char *entry_filepath) { free(layout_files); } - LOGD("init Text XML resources OK.\n\n"); + SCLLOG(SclLog::MESSAGE, "init Text XML resources OK.\n\n"); } -- 2.7.4