From 66d5d951df13aa3efdefe8269a94426ff42a4279 Mon Sep 17 00:00:00 2001 From: lexborisov Date: Thu, 16 Mar 2017 23:15:55 +0300 Subject: [PATCH] Make clone for Linux and Mac OS X --- Makefile | 2 +- Makefile.cfg | 5 +++ examples/myencoding/Makefile.mk | 7 ++++ .../detect_encoding_by_trigrams.c} | 3 +- .../detect_encoding_in_meta.c} | 3 +- .../encoding_by_name.c} | 2 +- examples/myencoding/example.h | 32 +++++++++++++++++++ source/myhtml/tree.c | 6 ---- 8 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 examples/myencoding/Makefile.mk rename examples/{myhtml/detect_encoding_high_level.c => myencoding/detect_encoding_by_trigrams.c} (99%) rename examples/{myhtml/detect_encoding_in_meta_high_level.c => myencoding/detect_encoding_in_meta.c} (98%) rename examples/{myhtml/encoding_by_name_high_level.c => myencoding/encoding_by_name.c} (97%) create mode 100644 examples/myencoding/example.h diff --git a/Makefile b/Makefile index f848a7c..c14ecf2 100644 --- a/Makefile +++ b/Makefile @@ -166,7 +166,7 @@ clean: $(MODEST_BUILD_MODULES_TARGET_CLEAN) for f in $(BUILD_SUB_DIRS); do $(MAKE) -C $$f clean; done clone: clean_api $(MODEST_BUILD_MODULES_TARGET_CLONE) - find $(INCLUDE_DIR_API) -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \; + $(call MODEST_CLONE_SED_HEADER_COMMAND) find $(INCLUDE_DIR_API) -name "*.h.bak" -exec rm -f {} \; clean_api: diff --git a/Makefile.cfg b/Makefile.cfg index a599a74..cb8973e 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -70,6 +70,7 @@ MODEST_BUILD_CLEAN_AFTER := # DEFAULT #*************** SED ?= sed + MODEST_DIR_SEPARATOR ?= / MODEST_PORT_NAME ?= posix @@ -82,6 +83,8 @@ OS ?= $(shell uname -s) prefix ?= /usr/local exec_prefix ?= $(prefix) +MODEST_CLONE_SED_HEADER_COMMAND = find $(INCLUDE_DIR_API) -name "*.h" -exec sed -i.bak -e 's,\s*\#\s*include\s*"\([^"]*\)",\#include <\1>,g' {} \; + #******************** # Set -D #*************** @@ -133,6 +136,8 @@ endif # Darwin, Mac OS X #******************* ifeq ($(OS),Darwin) + MODEST_CLONE_SED_HEADER_COMMAND = find $(INCLUDE_DIR_API) -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*\#[ \t]*include[ \t]*"([^"]+)"/\#include <\1>/g' {} \; + MODEST_CFLAGS += -fPIC MODEST_CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable -Wno-unused-function -std=c99 LIB_NAME_SUFFIX := .dylib diff --git a/examples/myencoding/Makefile.mk b/examples/myencoding/Makefile.mk new file mode 100644 index 0000000..0da1183 --- /dev/null +++ b/examples/myencoding/Makefile.mk @@ -0,0 +1,7 @@ +myencoding_dirs := . +myencoding_objs := $(call BINARY_UTILS_OBJS,myencoding,$(myencoding_dirs)) + +myencoding_all: $(myencoding_objs) + +myencoding_clean: + rm -f $(myencoding_objs) diff --git a/examples/myhtml/detect_encoding_high_level.c b/examples/myencoding/detect_encoding_by_trigrams.c similarity index 99% rename from examples/myhtml/detect_encoding_high_level.c rename to examples/myencoding/detect_encoding_by_trigrams.c index ba934df..70ba0ac 100644 --- a/examples/myhtml/detect_encoding_high_level.c +++ b/examples/myencoding/detect_encoding_by_trigrams.c @@ -20,7 +20,8 @@ #include #include -#include + +#include #include "example.h" diff --git a/examples/myhtml/detect_encoding_in_meta_high_level.c b/examples/myencoding/detect_encoding_in_meta.c similarity index 98% rename from examples/myhtml/detect_encoding_in_meta_high_level.c rename to examples/myencoding/detect_encoding_in_meta.c index 84d192d..e2e652d 100644 --- a/examples/myhtml/detect_encoding_in_meta_high_level.c +++ b/examples/myencoding/detect_encoding_in_meta.c @@ -20,7 +20,8 @@ #include #include -#include + +#include #include "example.h" diff --git a/examples/myhtml/encoding_by_name_high_level.c b/examples/myencoding/encoding_by_name.c similarity index 97% rename from examples/myhtml/encoding_by_name_high_level.c rename to examples/myencoding/encoding_by_name.c index 1b1e198..e2650b9 100644 --- a/examples/myhtml/encoding_by_name_high_level.c +++ b/examples/myencoding/encoding_by_name.c @@ -22,7 +22,7 @@ #include #include -#include +#include int main(int argc, const char * argv[]) { diff --git a/examples/myencoding/example.h b/examples/myencoding/example.h new file mode 100644 index 0000000..27f7ec8 --- /dev/null +++ b/examples/myencoding/example.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2016-2017 Alexander Borisov + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + Author: vincent.torri@gmail.com (Vincent Torri) +*/ + +#ifndef MyHTML_EXAMPLE_EXAMPLE_H +#define MyHTML_EXAMPLE_EXAMPLE_H +#pragma once + +/* Format */ +#ifdef _WIN32 + #define MyCORE_FMT_Z "%Iu" +#else + #define MyCORE_FMT_Z "%zu" +#endif + +#endif /* MyHTML_EXAMPLE_EXAMPLE_H */ diff --git a/source/myhtml/tree.c b/source/myhtml/tree.c index 0951287..533c307 100644 --- a/source/myhtml/tree.c +++ b/source/myhtml/tree.c @@ -2047,12 +2047,6 @@ myhtml_tree_node_t * myhtml_tree_appropriate_place_inserting_in_tree(myhtml_tree break; } -#ifdef MyCORE_BUILD_DEBUG - if(idx_table == 0) { - MyCORE_DEBUG_ERROR("Appropriate place inserting; Step 2.5; idx_table is 0"); - } -#endif - // step 2.6-7 adjusted_location = target;