Commit 11b23431 authored by XueShuming's avatar XueShuming
Browse files

update for log

parent e77ef878
......@@ -48,4 +48,4 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
find_package(HiCSS REQUIRED)
add_subdirectory(src)
#add_subdirectory(test)
add_subdirectory(test)
......@@ -65,6 +65,27 @@
#define HILAYOUT_IMPORTS_PENDING 8
#define HILAYOUT_PROPERTY_NOT_SET 9
#if defined(_DEBUG)
# define HL_LOGD(fmt, ...) \
do { \
fprintf (stderr, "D|%s:%d:%s|"fmt, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
} while (0)
# else
# define HL_LOGD(fmt, ...) do { } while (0)
#endif
#define HL_LOGE(fmt, ...) \
do { \
fprintf (stderr, "E|"fmt, ##__VA_ARGS__); \
} while (0)
#define HL_LOGW(fmt, ...) \
do { \
fprintf (stderr, "W|"fmt, ##__VA_ARGS__); \
} while (0)
typedef struct HLDomElementNode_ HLDomElementNode;
typedef struct HLCSS_ HLCSS;
......
......@@ -45,15 +45,22 @@ cmake_minimum_required(VERSION 3.10)
project(hilayout)
#add_definitions(-D_DEBUG)
list(APPEND hilayout_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/src/dom
${CMAKE_SOURCE_DIR}/src/select
${CMAKE_SOURCE_DIR}/src/layout
)
list(APPEND hilayout_SOURCES
${CMAKE_SOURCE_DIR}/src/dom/node.c
${CMAKE_SOURCE_DIR}/src/select/select.c
${CMAKE_SOURCE_DIR}/src/layout/layout.c
${CMAKE_SOURCE_DIR}/src/layout/layout_block.c
${CMAKE_SOURCE_DIR}/src/layout/layout_block.c
${CMAKE_SOURCE_DIR}/src/layout/layout_inline_block.c
${CMAKE_SOURCE_DIR}/src/layout/hilayout.c
)
......
......@@ -81,7 +81,7 @@ css_stylesheet *create_css_stylesheet(const char *charset, const char *url, bool
error = css_stylesheet_create(&params, &sheet);
if (error != CSS_OK) {
fprintf(stderr, "Failed creating sheet: %d\n", error);
HL_LOGE("Failed create sheet: %d\n", error);
return NULL;
}
......@@ -114,7 +114,7 @@ int hilayout_css_append_data(HLCSS* css, const char* data, size_t len)
css_error error = css_stylesheet_append_data(css->sheet, data, len);
if (error != CSS_OK && error != CSS_NEEDDATA) {
fprintf(stderr, "failed appending data: %d\n", error);
HL_LOGE("failed appending data: %d\n", error);
return error;
}
......
cmake_minimum_required(VERSION 3.10)
project(css_select_test)
add_definitions(-D_DEBUG)
# css
list(APPEND css_select_test_INCLUDE_DIRECTORIES
......@@ -19,6 +20,7 @@ add_executable(css_select_test ${css_select_test_SOURCES})
target_link_libraries(css_select_test hilayout)
list(APPEND css_select_test2_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/src/dom
${CMAKE_SOURCE_DIR}/src/select
)
......
......@@ -53,6 +53,7 @@
#include "node.h"
#include "select.h"
#include "layout.h"
#include "hilayout.h"
/*
<div id="root">
......@@ -172,6 +173,9 @@ int main(int argc, char **argv)
layout_node(root, 0, 0, 1080, 720, &w, &h, 0);
destroyStylesheet(sheet);
HL_LOGD("LOGD test \n");
HL_LOGE("LOGE test \n");
HL_LOGW("LOGW test \n");
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment