Refactoring Threads and Makefile

This commit is contained in:
lexborisov 2017-03-09 23:47:39 +03:00
parent 77991b6e77
commit 8669462c8c
198 changed files with 4046 additions and 2747 deletions

205
Makefile
View File

@ -1,94 +1,159 @@
TARGET := source TARGET := source
SRCDIR := source SRCDIR := source
TSTDIR := test
CC ?= gcc CC ?= gcc
LIBNAME := modest # ARGS
LIBPOSTFIX := .so #
LIBSTATIC_POSTFIX := _static # MODEST_OPTIMIZATION_LEVEL, default -O2
IMP_FLAG := # MODEST_BUILD_WITHOUT_THREADS, YES or (NO or undefined), default undefined
LIB_TMP := lib # MODEST_BUILD_DEBUG, default undefined
INCLUDE_TMP := include #
BIN_TMP := bin
.DEFAULT_GOAL := all
#********************
# Flags
#***************
MODEST_OPTIMIZATION_LEVEL ?= -O2 MODEST_OPTIMIZATION_LEVEL ?= -O2
CFLAGS ?= -Wall -Werror MODEST_CFLAGS ?= -Wall -Werror
CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable --std=c99 -I$(SRCDIR) MODEST_CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable --std=c99 -I$(SRCDIR)
ifneq ($(OS),Windows_NT) MODEST_LFLAGS ?=
CFLAGS += -fPIC
endif
ifdef MODEST_BUILD_DEBUG #********************
CFLAGS += -g # Include
endif #***************
# include dirs
INCLUDE_DIR := $(TARGET)
INCLUDE_DIR_API := include
MODEST_BUILD_WITHOUT_THREADS ?= NO #********************
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES) # Libraries
$(info Build without POSIX Threads) #***************
CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS -DMyHTML_BUILD_WITHOUT_THREADS # lib name
else LIB_NAME := modest
$(info Build with POSIX Threads) LIB_NAME_SUFFIX := .so
CFLAGS += -pthread LIB_NAME_SUFFIX_STATIC := _static.a
endif
ifeq ($(OS),Windows_NT) # lib dirs
LIBPOSTFIX := .dll LIB_DIR_BASE := lib
IMP_FLAG := -Wl,--out-implib,$(LIB_TMP)/lib$(LIBNAME).dll.a
else
UNAM := $(shell uname -s)
ifeq ($(UNAM),Darwin)
LIBPOSTFIX := .dylib
else
CFLAGS += -D_POSIX_C_SOURCE=199309L
endif
endif
SRCS := #********************
HDRS := # Binaries
EXTDIRS := examples test #***************
# binaries dirs
BIN_DIR_BASE := bin
all: create shared static IMP_FLAG :=
for f in $(EXTDIRS); do $(MAKE) -C $$f all; done BIN_TMP := bin
include $(TARGET)/mycore/Makefile.mk #********************
include $(TARGET)/myencoding/Makefile.mk # other Makefile
include $(TARGET)/myhtml/Makefile.mk #***************
include $(TARGET)/mycss/Makefile.mk include Makefile.cfg
include $(TARGET)/myfont/Makefile.mk
include $(TARGET)/myurl/Makefile.mk
include $(TARGET)/modest/Makefile.mk
OBJS := $(patsubst %.c,%.o,$(SRCS)) #********************
# Build
#***************
MODEST_BUILD_MODULES ?= $(dir $(wildcard $(SRCDIR)/*/))
MODEST_BUILD_MODULES := $(patsubst %myport/,%myport/$(strip $(MODEST_PORT_NAME))/,$(MODEST_BUILD_MODULES))
MODEST_BUILD_MODULES_LIST := $(foreach dir,$(MODEST_BUILD_MODULES),$(word 2, $(subst $(MODEST_DIR_SEPARATOR), , $(dir))) )
MODEST_BUILD_MODULES_MAKEFILES_LIST := $(foreach dir,$(MODEST_BUILD_MODULES),$(dir)Makefile.mk)
shared: $(OBJS) #********************
$(CC) -shared $(IMP_FLAG) $(LDFLAGS) $(OBJS) -o $(LIB_TMP)/lib$(LIBNAME)$(LIBPOSTFIX) # Targets
#***************
MODEST_BUILD_MODULES_TARGET := $(MODEST_BUILD_MODULES_LIST)
MODEST_BUILD_MODULES_TARGET_ALL := $(foreach dir,$(MODEST_BUILD_MODULES_TARGET),$(dir)_all)
MODEST_BUILD_MODULES_TARGET_CLEAN := $(foreach dir,$(MODEST_BUILD_MODULES_TARGET),$(dir)_clean)
MODEST_BUILD_MODULES_TARGET_CLONE := $(foreach dir,$(MODEST_BUILD_MODULES_TARGET),$(dir)_clone)
static: shared #********************
$(AR) crus $(LIB_TMP)/lib$(LIBNAME)$(LIBSTATIC_POSTFIX).a $(OBJS) # Utils
#***************
define MODEST_UTILS_NEW_LINE
create:
mkdir -p lib bin
clean: endef
for f in $(EXTDIRS); do $(MAKE) -C $$f clean; done MODEST_UTILS_HDRS = $(foreach dir,$2,$(wildcard $(SRCDIR)/$1/$(dir)/*.h))
rm -f $(OBJS) MODEST_UTILS_OBJS = $(patsubst %.c,%.o,$(foreach dir,$2,$(wildcard $(SRCDIR)/$1/$(dir)/*.c)))
rm -f $(LIB_TMP)/* MODEST_UTILS_HDRS_CLONE_CMND = $(foreach path,$(foreach dir,$2,$(wildcard $(SRCDIR)/$1/$(dir)/*.h)), cp $(path) $(patsubst $(SRCDIR)%,$(INCLUDE_DIR_API)%,$(path)) $(MODEST_UTILS_NEW_LINE))
rm -f $(BIN_TMP)/* MODEST_UTILS_HDRS_CLONE_GDIR = $(foreach dir,$2,$(INCLUDE_DIR_API)/$1/$(dir)/)
MODEST_UTILS_HDRS_CLONE_DIRS = $(foreach dir,$(strip $(patsubst %./,%,$(foreach path,$(call MODEST_UTILS_HDRS_CLONE_GDIR,$1,$2),$(dir $(path))))),mkdir -p $(dir) $(MODEST_UTILS_NEW_LINE))
MODEST_UTILS_HDRS_CLONE = $(info Clone for $1) $(call MODEST_UTILS_HDRS_CLONE_DIRS,$1,$2) $(MODEST_UTILS_NEW_LINE) $(call MODEST_UTILS_HDRS_CLONE_CMND,$1,$2)
clean_include: #********************
rm -rf $(INCLUDE_TMP) # Include all modules Makefile.mk
#***************
include $(MODEST_BUILD_MODULES_MAKEFILES_LIST)
clone: create clean_include myhtml_clone mycss_clone modest_clone myfont_clone myurl_clone mycore_clone myencoding_clone #********************
find include -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \; # Set ARGS for flags
find include -name "*.h.bak" -exec rm -f {} \; #***************
CFLAGS += $(MODEST_CFLAGS)
test: #********************
test/mycss/declaration test/mycss/data/declaration # Objects
test/myhtml/utils/avl_tree #***************
test/myhtml/encoding_detect_meta test/myhtml/data/encoding/detect_meta.html MODEST_BUILD_OBJECT_SHARED ?= $(CC) -shared $(IMP_FLAG) $(LDFLAGS) $1 -o $2
test/myurl/url test/myurl/data MODEST_BUILD_OBJECT_MODULES := $(foreach dir,$(MODEST_BUILD_MODULES_TARGET),$($(dir)_objs))
.PHONY: all clean clone test #********************
# Target options
#***************
all: $(MODEST_BUILD_MODULES_TARGET_ALL)
$(call MODEST_BUILD_OBJECT_SHARED,$(MODEST_BUILD_OBJECT_MODULES),$(MODEST_LIBRARY))
clean: $(MODEST_BUILD_MODULES_TARGET_CLEAN)
clone: $(MODEST_BUILD_MODULES_TARGET_CLONE)
.PHONY: all clean clone $(MODEST_BUILD_MODULES_TARGET_ALL)
# SRCS :=
# HDRS :=
# EXTDIRS := examples test
# all: create shared static
# for f in $(EXTDIRS); do $(MAKE) -C $$f all; done
# include $(TARGET)/mycore/Makefile.mk
# include $(TARGET)/myencoding/Makefile.mk
# include $(TARGET)/myhtml/Makefile.mk
# include $(TARGET)/mycss/Makefile.mk
# include $(TARGET)/myfont/Makefile.mk
# include $(TARGET)/myurl/Makefile.mk
# include $(TARGET)/modest/Makefile.mk
# OBJS := $(patsubst %.c,%.o,$(SRCS))
# shared: $(OBJS)
# $(CC) -shared $(IMP_FLAG) $(LDFLAGS) $(OBJS) -o $(LIB_TMP)/lib$(LIBNAME)$(LIBPOSTFIX)
# static: shared
# $(AR) crus $(LIB_TMP)/lib$(LIBNAME)$(LIBSTATIC_POSTFIX).a $(OBJS)
# create:
# mkdir -p lib bin
# clean:
# for f in $(EXTDIRS); do $(MAKE) -C $$f clean; done
# rm -f $(OBJS)
# rm -f $(LIB_TMP)/*
# rm -f $(BIN_TMP)/*
# clean_include:
# rm -rf $(INCLUDE_TMP)
# clone: create clean_include myhtml_clone mycss_clone modest_clone myfont_clone myurl_clone mycore_clone myencoding_clone
# find include -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \;
# find include -name "*.h.bak" -exec rm -f {} \;
# test:
# test/mycss/declaration test/mycss/data/declaration
# test/myhtml/utils/avl_tree
# test/myhtml/encoding_detect_meta test/myhtml/data/encoding/detect_meta.html
# test/myurl/url test/myurl/data
# .PHONY: all clean clone test

69
Makefile.cfg Normal file
View File

@ -0,0 +1,69 @@
MODEST_BUILD_OS := UNDEF
# DEFAULT
MODEST_DIR_SEPARATOR ?= /
# names
MODEST_LIBRARY ?= $(LIB_DIR_BASE)/lib$(LIB_NAME)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY_STATIC ?= $(LIB_DIR_BASE)/lib$(LIB_NAME)$(LIB_NAME_SUFFIX_STATIC)
MODEST_PORT_NAME ?= posix
# flags
MODEST_CFLAGS := -I$(INCLUDE_DIR)
OS ?= $(shell uname -s)
#*******************************
# Windows_NT
#*******************
ifeq ($(OS),Windows_NT)
CFLAGS += -fPIC
# Need set
MODEST_BUILD_OS := $(OS)
# this name eq source/myport/<namedir>
MODEST_PORT_NAME := windows
endif
# end of Windows_NT
#*******************************
# Darwin, Mac OS X
#*******************
ifeq ($(OS),Darwin)
CFLAGS += -fPIC
LIB_NAME_SUFFIX := .dylib
# build without threads
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
MODEST_CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS
else
MODEST_LFLAGS += -pthread
endif
# Need set
MODEST_BUILD_OS := $(OS)
# this name eq source/myport/<namedir>
MODEST_PORT_NAME := posix
endif
# end of Darwin, Mac OS X
#*******************************
# POSIX
#*******************
ifeq ($(MODEST_BUILD_OS),UNDEF)
MODEST_CFLAGS += -fPIC
MODEST_CFLAGS += -D_POSIX_C_SOURCE=199309L
# build without threads
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
MODEST_CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS
else
MODEST_LFLAGS += -pthread
endif
# Need set
MODEST_BUILD_OS := $(OS)
# this name eq source/myport/<namedir>
MODEST_PORT_NAME := posix
endif
# end of POSIX

View File

@ -22,10 +22,10 @@
#define MODEST_DECLARATION_H #define MODEST_DECLARATION_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/node/node.h> #include "modest/node/node.h"
#include <modest/style/default.h> #include "modest/style/default.h"
#include <mycss/declaration/default.h> #include "mycss/declaration/default.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_FINDER_FINDER_H #define MODEST_FINDER_FINDER_H
#pragma once #pragma once
#include <modest/finder/myosi.h> #include "modest/finder/myosi.h"
#include <modest/finder/type.h> #include "modest/finder/type.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_FINDER_MATCH_H #define MODEST_FINDER_MATCH_H
#pragma once #pragma once
#include <myhtml/myosi.h> #include "myhtml/myosi.h"
#include <myhtml/tree.h> #include "myhtml/tree.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,10 +22,10 @@
#define MODEST_FINDER_MYOSI_H #define MODEST_FINDER_MYOSI_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/list.h> #include "mycss/selectors/list.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_FINDER_PSEUDO_CLASS_H #define MODEST_FINDER_PSEUDO_CLASS_H
#pragma once #pragma once
#include <modest/finder/myosi.h> #include "modest/finder/myosi.h"
#include <modest/finder/finder.h> #include "modest/finder/finder.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,17 +22,17 @@
#define MODEST_FINDER_THREAD_H #define MODEST_FINDER_THREAD_H
#pragma once #pragma once
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/node/node.h> #include "modest/node/node.h"
#include <modest/style/type.h> #include "modest/style/type.h"
#include <modest/style/map.h> #include "modest/style/map.h"
#include <modest/finder/myosi.h> #include "modest/finder/myosi.h"
#include <modest/finder/finder.h> #include "modest/finder/finder.h"
#include <mycore/thread.h> #include "mycore/mythread.h"
#include <mycore/utils/mcobject_async.h> #include "mycore/utils/mcobject_async.h"
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,13 +22,13 @@
#define MODEST_FINDER_TYPE_H #define MODEST_FINDER_TYPE_H
#pragma once #pragma once
#include <modest/finder/myosi.h> #include "modest/finder/myosi.h"
#include <modest/finder/finder.h> #include "modest/finder/finder.h"
#include <modest/finder/pseudo_class.h> #include "modest/finder/pseudo_class.h"
#include <modest/finder/match.h> #include "modest/finder/match.h"
#include <myhtml/tree.h> #include "myhtml/tree.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#include <mycss/selectors/value.h> #include "mycss/selectors/value.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_GLUE_H #define MODEST_GLUE_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/node/node.h> #include "modest/node/node.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_LAYER_LAYER_H #define MODEST_LAYER_LAYER_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,12 +22,12 @@
#define MODEST_H #define MODEST_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/layer/layer.h> #include "modest/layer/layer.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#include <mycore/utils/mcobject_async.h> #include "mycore/utils/mcobject_async.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
#include <mycore/utils/avl_tree.h> #include "mycore/utils/avl_tree.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_MYOSI_H #define MODEST_MYOSI_H
#pragma once #pragma once
#include <myhtml/myhtml.h> #include "myhtml/myhtml.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,11 +22,11 @@
#define MODEST_NODE_NODE_H #define MODEST_NODE_NODE_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/style/raw.h> #include "modest/style/raw.h"
#include <modest/render/tree_node.h> #include "modest/render/tree_node.h"
#include <mycore/utils/avl_tree.h> #include "mycore/utils/avl_tree.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,7 +22,7 @@
#define MODEST_NODE_PROPERTY_H #define MODEST_NODE_PROPERTY_H
#pragma once #pragma once
#include <modest/node/node.h> #include "modest/node/node.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,7 +22,7 @@
#define MODEST_NODE_RAW_PROPERTY_H #define MODEST_NODE_RAW_PROPERTY_H
#pragma once #pragma once
#include <modest/node/node.h> #include "modest/node/node.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,11 +22,11 @@
#define MODEST_NODE_SERIALIZATION_H #define MODEST_NODE_SERIALIZATION_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/node/node.h> #include "modest/node/node.h"
#include <modest/node/raw_property.h> #include "modest/node/raw_property.h"
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/declaration/serialization.h> #include "mycss/declaration/serialization.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MODEST_RENDER_BEGIN_H #define MODEST_RENDER_BEGIN_H
#pragma once #pragma once
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/style/type.h> #include "modest/style/type.h"
#include <modest/render/tree.h> #include "modest/render/tree.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,14 +22,14 @@
#define MODEST_RENDER_BINDING_H #define MODEST_RENDER_BINDING_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/node/node.h> #include "modest/node/node.h"
#include <modest/render/tree.h> #include "modest/render/tree.h"
#include <modest/render/tree_node.h> #include "modest/render/tree_node.h"
#include <modest/declaration.h> #include "modest/declaration.h"
#include <myhtml/tree.h> #include "myhtml/tree.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -24,9 +24,9 @@
typedef struct modest_render_tree modest_render_tree_t; typedef struct modest_render_tree modest_render_tree_t;
#include <modest/modest.h> #include "modest/modest.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#include <modest/render/tree_node.h> #include "modest/render/tree_node.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -24,11 +24,11 @@
typedef struct modest_render_tree_node modest_render_tree_node_t; typedef struct modest_render_tree_node modest_render_tree_node_t;
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/render/tree.h> #include "modest/render/tree.h"
#include <myhtml/tree.h> #include "myhtml/tree.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MODEST_STYLE_DEFAULT_H #define MODEST_STYLE_DEFAULT_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,7 +22,7 @@
#define MODEST_STYLE_DEFAULT_RESOURCES_H #define MODEST_STYLE_DEFAULT_RESOURCES_H
#pragma once #pragma once
#include <modest/style/default_entries.h> #include "modest/style/default_entries.h"
static const modest_style_default_by_html_node_f modest_style_default_function_of_declarations[MyHTML_TAG_LAST_ENTRY] = static const modest_style_default_by_html_node_f modest_style_default_function_of_declarations[MyHTML_TAG_LAST_ENTRY] =
{ {

View File

@ -22,10 +22,10 @@
#define MODEST_STYLE_MAP_H #define MODEST_STYLE_MAP_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/finder/myosi.h> #include "modest/finder/myosi.h"
#include <modest/finder/thread.h> #include "modest/finder/thread.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MODEST_STYLE_RAW_H #define MODEST_STYLE_RAW_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/modest.h> #include "modest/modest.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MODEST_STYLE_SHEET_H #define MODEST_STYLE_SHEET_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/modest.h> #include "modest/modest.h"
#include <modest/style/type.h> #include "modest/style/type.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,10 +22,10 @@
#define MODEST_STYLE_TYPE_H #define MODEST_STYLE_TYPE_H
#pragma once #pragma once
#include <modest/myosi.h> #include "modest/myosi.h"
#include <modest/modest.h> #include "modest/modest.h"
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
struct mycore_incoming_buffer { struct mycore_incoming_buffer {
const char* data; const char* data;

View File

@ -27,12 +27,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <memory.h> #include <memory.h>
#include <stdint.h> #include <stdint.h>
#include <stdarg.h> #include <inttypes.h>
#define MyCORE_VERSION_MAJOR 1 #define MyCORE_VERSION_MAJOR 1
#define MyCORE_VERSION_MINOR 0 #define MyCORE_VERSION_MINOR 0
#define MyCORE_VERSION_PATCH 0 #define MyCORE_VERSION_PATCH 0
#define MyCORE_BUILD_WITHOUT_THREADS
#ifdef __cplusplus #ifdef __cplusplus
//extern "C" { //extern "C" {
#endif #endif
@ -60,14 +62,14 @@
/* Debug */ /* Debug */
#ifdef MyCORE_DEBUG_MODE #ifdef MyCORE_DEBUG_MODE
#define MyCORE_DEBUG(format, ...) \ #define MyCORE_DEBUG(format, ...) \
mycore_print(stderr, "DEBUG: "format"\n", ##__VA_ARGS__) mycore_fprintf(stderr, "DEBUG: "format"\n", ##__VA_ARGS__)
#else #else
#define MyCORE_DEBUG(format, ...) #define MyCORE_DEBUG(format, ...)
#endif #endif
#ifdef MyCORE_DEBUG_MODE #ifdef MyCORE_DEBUG_MODE
#define MyCORE_DEBUG_ERROR(format, ...) \ #define MyCORE_DEBUG_ERROR(format, ...) \
mycore_print(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__) mycore_fprintf(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__)
#else #else
#define MyCORE_DEBUG_ERROR(format, ...) #define MyCORE_DEBUG_ERROR(format, ...)
#endif #endif
@ -123,22 +125,16 @@ enum mycore_status {
MyCORE_STATUS_MCOBJECT_ERROR_CACHE_CREATE = 0x0055, MyCORE_STATUS_MCOBJECT_ERROR_CACHE_CREATE = 0x0055,
MyCORE_STATUS_MCOBJECT_ERROR_CHUNK_CREATE = 0x0056, MyCORE_STATUS_MCOBJECT_ERROR_CHUNK_CREATE = 0x0056,
MyCORE_STATUS_MCOBJECT_ERROR_CHUNK_INIT = 0x0057, MyCORE_STATUS_MCOBJECT_ERROR_CHUNK_INIT = 0x0057,
MyCORE_STATUS_MCOBJECT_ERROR_CACHE_REALLOC = 0x0058 MyCORE_STATUS_MCOBJECT_ERROR_CACHE_REALLOC = 0x0058,
MyCORE_STATUS_ASYNC_ERROR_LOCK = 0x0060,
MyCORE_STATUS_ASYNC_ERROR_UNLOCK = 0x0061,
MyCORE_STATUS_ERROR_NO_FREE_SLOT = 0x0062,
} }
typedef mycore_status_t; typedef mycore_status_t;
typedef unsigned int mystatus_t; typedef unsigned int mystatus_t;
/* thread */ /* thread */
enum mythread_thread_opt {
MyTHREAD_OPT_UNDEF = 0x00,
MyTHREAD_OPT_WAIT = 0x01,
MyTHREAD_OPT_QUIT = 0x02,
MyTHREAD_OPT_STOP = 0x04,
MyTHREAD_OPT_DONE = 0x08
}
typedef mythread_thread_opt_t;
typedef struct mythread_queue_list_entry mythread_queue_list_entry_t; typedef struct mythread_queue_list_entry mythread_queue_list_entry_t;
typedef struct mythread_queue_thread_param mythread_queue_thread_param_t; typedef struct mythread_queue_thread_param mythread_queue_thread_param_t;
typedef struct mythread_queue_list mythread_queue_list_t; typedef struct mythread_queue_list mythread_queue_list_t;
@ -146,9 +142,8 @@ typedef struct mythread_queue_node mythread_queue_node_t;
typedef struct mythread_queue mythread_queue_t; typedef struct mythread_queue mythread_queue_t;
typedef size_t mythread_id_t; typedef size_t mythread_id_t;
typedef struct mythread_workers_list mythread_workers_list_t;
typedef struct mythread_context mythread_context_t; typedef struct mythread_context mythread_context_t;
typedef struct mythread_list mythread_list_t; typedef struct mythread_entry mythread_entry_t;
typedef struct mythread mythread_t; typedef struct mythread mythread_t;
/* mystring */ /* mystring */
@ -164,9 +159,28 @@ typedef void (*mycore_callback_serialize_f)(const char* buffer, size_t size, voi
void * mycore_malloc(size_t size); void * mycore_malloc(size_t size);
void * mycore_realloc(void* dst, size_t size); void * mycore_realloc(void* dst, size_t size);
void * mycore_calloc(size_t num, size_t size); void * mycore_calloc(size_t num, size_t size);
void mycore_free(void* dst); void * mycore_free(void* dst);
/* io */
int mycore_printf(const char* format, ...);
int mycore_fprintf(FILE* out, const char* format, ...);
int mycore_snprintf(char* buffer, size_t buffer_size, const char* format, ...);
/**
* Platform-specific hdef performance clock queries.
* Implemented in perf.c
*/
/** Get clock resolution */
uint64_t mycore_hperf_res(mystatus_t *status);
/** Get current value in clock ticks */
uint64_t mycore_hperf_clock(mystatus_t *status);
/** Print an hperf measure */
mystatus_t mycore_hperf_print(const char *name, uint64_t x, uint64_t y, FILE *fh);
mystatus_t mycore_hperf_print_by_val(const char *name, uint64_t x, FILE *fh);
void mycore_print(FILE* out, const char* format, ...);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#define mycore_string_get(str, attr) str->attr #define mycore_string_get(str, attr) str->attr
#define mycore_string_set(str, attr) mycore_string_get(str, attr) #define mycore_string_set(str, attr) mycore_string_get(str, attr)

159
include/mycore/mythread.h Normal file
View File

@ -0,0 +1,159 @@
/*
Copyright (C) 2015-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: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCORE_THREAD_H
#define MyCORE_THREAD_H
#pragma once
#ifdef __cplusplus
//extern "C" {
#endif
#include "mycore/myosi.h"
#include "mycore/mystring.h"
#ifdef MyCORE_BUILD_WITHOUT_THREADS
struct mythread {
int sys_last_error;
};
#else
/* functions */
typedef void (*mythread_callback_before_entry_join_f)(mythread_t* mythread, mythread_entry_t* entry, void* ctx);
typedef void (*mythread_process_f)(void* arg);
typedef void (*mythread_work_f)(mythread_id_t thread_id, void* arg);
void mythread_function_queue_stream(void *arg);
void mythread_function_queue_batch(void *arg);
void mythread_function(void *arg);
enum mythread_thread_opt {
MyTHREAD_OPT_UNDEF = 0x00,
MyTHREAD_OPT_WAIT = 0x01,
MyTHREAD_OPT_QUIT = 0x02,
MyTHREAD_OPT_STOP = 0x04,
MyTHREAD_OPT_DONE = 0x08
}
typedef mythread_thread_opt_t;
enum mythread_type {
MyTHREAD_TYPE_STREAM = 0x00,
MyTHREAD_TYPE_BATCH = 0x01
}
typedef mythread_type_t;
// thread
struct mythread_context {
mythread_id_t id;
mythread_work_f func;
volatile size_t t_count;
volatile mythread_thread_opt_t opt;
mystatus_t status;
void* mutex;
void* timespec;
mythread_t* mythread;
};
struct mythread_entry {
void* thread;
mythread_context_t context;
mythread_process_f process_func;
};
struct mythread {
mythread_entry_t *entries;
size_t entries_length;
size_t entries_size;
size_t id_increase;
void* context;
void* attr;
void* timespec;
int sys_last_error;
mythread_type_t type;
volatile mythread_thread_opt_t opt;
};
mythread_t * mythread_create(void);
mystatus_t mythread_init(mythread_t *mythread, mythread_type_t type, size_t threads_count, size_t id_increase);
void mythread_clean(mythread_t *mythread);
mythread_t * mythread_destroy(mythread_t *mythread, mythread_callback_before_entry_join_f before_join, void* ctx, bool self_destroy);
mythread_id_t myhread_increase_id_by_entry_id(mythread_t* mythread, mythread_id_t thread_id);
/* set for all threads */
mystatus_t mythread_join(mythread_t *mythread, mythread_callback_before_entry_join_f before_join, void* ctx);
mystatus_t mythread_quit(mythread_t *mythread, mythread_callback_before_entry_join_f before_join, void* ctx);
mystatus_t mythread_stop(mythread_t *mythread);
mystatus_t mythread_resume(mythread_t *mythread);
mystatus_t mythread_suspend(mythread_t *mythread);
mystatus_t mythread_check_status(mythread_t *mythread);
mythread_thread_opt_t mythread_option(mythread_t *mythread);
void mythread_option_set(mythread_t *mythread, mythread_thread_opt_t opt);
/* Entries */
mystatus_t myhread_entry_create(mythread_t *mythread, mythread_process_f process_func, mythread_work_f func, mythread_thread_opt_t opt);
mystatus_t mythread_entry_join(mythread_entry_t* entry, mythread_callback_before_entry_join_f before_join, void* ctx);
mystatus_t mythread_entry_quit(mythread_entry_t* entry, mythread_callback_before_entry_join_f before_join, void* ctx);
mystatus_t mythread_entry_stop(mythread_entry_t* entry);
mystatus_t mythread_entry_resume(mythread_entry_t* entry);
mystatus_t mythread_entry_suspend(mythread_entry_t* entry);
mystatus_t mythread_entry_status(mythread_entry_t* entry);
mythread_t * mythread_entry_mythread(mythread_entry_t* entry);
/* API for ports */
void * mythread_thread_create(mythread_t *mythread, void* process_func, void* ctx);
mystatus_t mythread_thread_join(mythread_t *mythread, void* thread);
mystatus_t mythread_thread_cancel(mythread_t *mythread, void* thread);
mystatus_t mythread_thread_destroy(mythread_t *mythread, void* thread);
void * mythread_thread_attr_init(mythread_t *mythread);
void mythread_thread_attr_clean(mythread_t *mythread, void* attr);
void mythread_thread_attr_destroy(mythread_t *mythread, void* attr);
void * mythread_mutex_create(mythread_t *mythread);
mystatus_t mythread_mutex_post(mythread_t *mythread, void* mutex);
mystatus_t mythread_mutex_wait(mythread_t *mythread, void* mutex);
void mythread_mutex_close(mythread_t *mythread, void* mutex);
void * mythread_nanosleep_create(mythread_t* mythread);
void mythread_nanosleep_clean(void* timespec);
void mythread_nanosleep_destroy(void* timespec);
mystatus_t mythread_nanosleep_sleep(void* timespec);
/* callback */
void mythread_callback_quit(mythread_t* mythread, mythread_entry_t* entry, void* ctx);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* MyCORE_THREAD_H */

View File

@ -1,223 +0,0 @@
/*
Copyright (C) 2015-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: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCORE_THREAD_H
#define MyCORE_THREAD_H
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <mycore/myosi.h>
#ifndef MyCORE_BUILD_WITHOUT_THREADS
#if !defined(IS_OS_WINDOWS)
# include <pthread.h>
# include <semaphore.h>
#endif
#include <time.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <mycore/mystring.h>
#endif /* MyCORE_BUILD_WITHOUT_THREADS */
#define MyTHREAD_SEM_NAME "mycore"
/* functions */
typedef void (*mythread_callback_before_join_f)(mythread_t* mythread);
typedef void (*mythread_process_f)(void* arg);
typedef void (*mythread_work_f)(mythread_id_t thread_id, void* arg);
#ifdef MyCORE_BUILD_WITHOUT_THREADS
struct mythread {
int sys_last_error;
};
#else /* MyCORE_BUILD_WITHOUT_THREADS */
void mythread_function_queue_stream(void *arg);
void mythread_function_queue_batch(void *arg);
void mythread_function(void *arg);
// thread
struct mythread_context {
mythread_id_t id;
#if defined(IS_OS_WINDOWS)
HANDLE mutex;
#else
pthread_mutex_t *mutex;
#endif
size_t sem_name_size;
mythread_work_f func;
volatile size_t t_count;
volatile mythread_thread_opt_t opt;
mythread_t *mythread;
unsigned int status;
};
struct mythread_list {
#if defined(IS_OS_WINDOWS)
HANDLE pth;
#else
pthread_t pth;
#endif
mythread_context_t data;
mythread_process_f process_func;
};
struct mythread_workers_list {
mythread_list_t *list;
size_t count;
};
struct mythread {
mythread_list_t *pth_list;
size_t pth_list_length;
size_t pth_list_size;
size_t pth_list_root;
void *context;
char *sem_prefix;
size_t sem_prefix_length;
#if !defined(IS_OS_WINDOWS)
pthread_attr_t *attr;
#endif
int sys_last_error;
mythread_id_t batch_first_id;
mythread_id_t batch_count;
volatile mythread_thread_opt_t stream_opt;
volatile mythread_thread_opt_t batch_opt;
};
mythread_id_t myhread_create_stream(mythread_t *mythread, mythread_process_f process_func, mythread_work_f func, mythread_thread_opt_t opt, mystatus_t *status);
mythread_id_t myhread_create_batch(mythread_t *mythread, mythread_process_f process_func, mythread_work_f func, mythread_thread_opt_t opt, mystatus_t *status, size_t count);
void mycore_thread_nanosleep(const struct timespec *tomeout);
#endif /* MyCORE_BUILD_WITHOUT_THREADS */
mythread_t * mythread_create(void);
mystatus_t mythread_init(mythread_t *mythread, const char *sem_prefix, size_t thread_count);
void mythread_clean(mythread_t *mythread);
mythread_t * mythread_destroy(mythread_t *mythread, mythread_callback_before_join_f before_join, bool self_destroy);
void mythread_stream_quit_all(mythread_t *mythread);
void mythread_batch_quit_all(mythread_t *mythread);
void mythread_stream_stop_all(mythread_t *mythread);
void mythread_batch_stop_all(mythread_t *mythread);
void mythread_stop_all(mythread_t *mythread);
void mythread_queue_wait_all_for_done(mythread_t *mythread);
void mythread_resume_all(mythread_t *mythread);
void mythread_suspend_all(mythread_t *mythread);
unsigned int mythread_check_status(mythread_t *mythread);
// queue
struct mythread_queue_node {
void* context;
void* args;
mythread_queue_node_t* prev;
};
struct mythread_queue_thread_param {
volatile size_t use;
};
struct mythread_queue_list_entry {
mythread_queue_list_entry_t *next;
mythread_queue_list_entry_t *prev;
mythread_queue_t *queue;
mythread_queue_thread_param_t *thread_param;
};
struct mythread_queue_list {
mythread_queue_list_entry_t *first;
mythread_queue_list_entry_t *last;
volatile size_t count;
};
struct mythread_queue {
mythread_queue_node_t **nodes;
size_t nodes_pos;
size_t nodes_pos_size;
size_t nodes_length;
volatile size_t nodes_uses;
volatile size_t nodes_size;
volatile size_t nodes_root;
};
mythread_queue_t * mythread_queue_create(size_t size, mystatus_t *status);
void mythread_queue_clean(mythread_queue_t* queue);
mythread_queue_t * mythread_queue_destroy(mythread_queue_t* token);
void mythread_queue_node_clean(mythread_queue_node_t* qnode);
size_t mythread_queue_count_used_node(mythread_queue_t* queue);
mythread_queue_node_t * mythread_queue_get_first_node(mythread_queue_t* queue);
mythread_queue_node_t * mythread_queue_get_prev_node(mythread_queue_node_t* qnode);
mythread_queue_node_t * mythread_queue_get_current_node(mythread_queue_t* queue);
mythread_queue_node_t * mythread_queue_node_malloc(mythread_t *mythread, mythread_queue_t* queue, mystatus_t *status);
mythread_queue_node_t * mythread_queue_node_malloc_limit(mythread_t *mythread, mythread_queue_t* queue, size_t limit, mystatus_t *status);
#ifndef MyCORE_BUILD_WITHOUT_THREADS
mythread_queue_list_t * mythread_queue_list_create(mystatus_t *status);
void mythread_queue_list_destroy(mythread_queue_list_t* queue_list);
size_t mythread_queue_list_get_count(mythread_queue_list_t* queue_list);
mythread_queue_list_entry_t * mythread_queue_list_entry_push(mythread_t *mythread, mythread_queue_t *queue, mystatus_t *status);
mythread_queue_list_entry_t * mythread_queue_list_entry_delete(mythread_t *mythread, mythread_queue_list_entry_t *entry, bool destroy_queue);
void mythread_queue_list_entry_clean(mythread_t *mythread, mythread_queue_list_entry_t *entry);
void mythread_queue_list_entry_wait_for_done(mythread_t *mythread, mythread_queue_list_entry_t *entry);
mythread_queue_node_t * mythread_queue_node_malloc_round(mythread_t *mythread, mythread_queue_list_entry_t *entry, mystatus_t *status);
#endif /* MyCORE_BUILD_WITHOUT_THREADS */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* defined(__mycore__mycore_thread__) */

View File

@ -0,0 +1,110 @@
/*
Copyright (C) 2015-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: lex.borisov@gmail.com (Alexander Borisov)
*/
#ifndef MyCORE_THREAD_QUEUE_H
#define MyCORE_THREAD_QUEUE_H
#pragma once
#include "mycore/myosi.h"
#include "mycore/mythread.h"
#ifdef __cplusplus
//extern "C" {
#endif
// queue
struct mythread_queue_node {
void* context;
void* args;
mythread_queue_node_t* prev;
};
struct mythread_queue_thread_param {
volatile size_t use;
};
struct mythread_queue_list_entry {
mythread_queue_t* queue;
mythread_queue_thread_param_t* thread_param;
size_t thread_param_size;
mythread_queue_list_entry_t* next;
mythread_queue_list_entry_t* prev;
};
struct mythread_queue_list {
mythread_queue_list_entry_t *first;
mythread_queue_list_entry_t *last;
volatile size_t count;
};
struct mythread_queue {
mythread_queue_node_t **nodes;
size_t nodes_pos;
size_t nodes_pos_size;
size_t nodes_length;
volatile size_t nodes_uses;
volatile size_t nodes_size;
volatile size_t nodes_root;
};
mythread_queue_t * mythread_queue_create(void);
mystatus_t mythread_queue_init(mythread_queue_t* queue, size_t size);
void mythread_queue_clean(mythread_queue_t* queue);
mythread_queue_t * mythread_queue_destroy(mythread_queue_t* token);
void mythread_queue_node_clean(mythread_queue_node_t* qnode);
size_t mythread_queue_count_used_node(mythread_queue_t* queue);
mythread_queue_node_t * mythread_queue_get_first_node(mythread_queue_t* queue);
mythread_queue_node_t * mythread_queue_get_prev_node(mythread_queue_node_t* qnode);
mythread_queue_node_t * mythread_queue_get_current_node(mythread_queue_t* queue);
mythread_queue_node_t * mythread_queue_node_malloc(mythread_t *mythread, mythread_queue_t* queue, mystatus_t *status);
mythread_queue_node_t * mythread_queue_node_malloc_limit(mythread_t *mythread, mythread_queue_t* queue, size_t limit, mystatus_t *status);
#ifndef MyCORE_BUILD_WITHOUT_THREADS
mythread_queue_node_t * mythread_queue_node_malloc_round(mythread_t *mythread, mythread_queue_list_entry_t *entry, mystatus_t *status);
#endif
#ifndef MyCORE_BUILD_WITHOUT_THREADS
mythread_queue_list_t * mythread_queue_list_create(mystatus_t *status);
void mythread_queue_list_destroy(mythread_queue_list_t* queue_list);
size_t mythread_queue_list_get_count(mythread_queue_list_t* queue_list);
void mythread_queue_list_wait_for_done(mythread_t* mythread, mythread_queue_list_t* queue_list);
bool mythread_queue_list_see_for_done(mythread_t* mythread, mythread_queue_list_t* queue_list);
bool mythread_queue_list_see_for_done_by_thread(mythread_t* mythread, mythread_queue_list_t* queue_list, mythread_id_t thread_id);
mythread_queue_list_entry_t * mythread_queue_list_entry_push(mythread_t** mythread_list, size_t list_size, mythread_queue_list_t* queue_list, mythread_queue_t* queue, size_t thread_param_size, mystatus_t* status);
mythread_queue_list_entry_t * mythread_queue_list_entry_delete(mythread_t** mythread_list, size_t list_size, mythread_queue_list_t *queue_list, mythread_queue_list_entry_t *entry, bool destroy_queue);
void mythread_queue_list_entry_clean(mythread_queue_list_entry_t *entry);
void mythread_queue_list_entry_wait_for_done(mythread_t *mythread, mythread_queue_list_entry_t *entry);
void mythread_queue_list_entry_make_batch(mythread_t* mythread, mythread_queue_list_entry_t* entry, size_t from, size_t length);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* MyCORE_THREAD_QUEUE_H */

View File

@ -26,7 +26,7 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
#define mycore_utils_whithspace(onechar, action, logic) \ #define mycore_utils_whithspace(onechar, action, logic) \
(onechar action ' ' logic \ (onechar action ' ' logic \

View File

@ -22,8 +22,8 @@
#define MyCORE_UTILS_AVL_TREE_H #define MyCORE_UTILS_AVL_TREE_H
#pragma once #pragma once
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils/mcsync.h> #include "mycore/utils/mcsync.h"
#define mchar_async_cache_has_nodes(cache) cache.count #define mchar_async_cache_has_nodes(cache) cache.count
@ -96,16 +96,16 @@ struct mchar_async {
typedef mchar_async_t; typedef mchar_async_t;
mchar_async_t * mchar_async_create(size_t pos_size, size_t size); mchar_async_t * mchar_async_create(void);
void mchar_async_init(mchar_async_t *mchar_async, size_t chunk_len, size_t char_size); mystatus_t mchar_async_init(mchar_async_t *mchar_async, size_t chunk_len, size_t char_size);
void mchar_async_clean(mchar_async_t *mchar_async); mystatus_t mchar_async_clean(mchar_async_t *mchar_async);
mchar_async_t * mchar_async_destroy(mchar_async_t *mchar_async, int destroy_self); mchar_async_t * mchar_async_destroy(mchar_async_t *mchar_async, int destroy_self);
char * mchar_async_malloc(mchar_async_t *mchar_async, size_t node_idx, size_t size); char * mchar_async_malloc(mchar_async_t *mchar_async, size_t node_idx, size_t size);
char * mchar_async_realloc(mchar_async_t *mchar_async, size_t node_idx, char *data, size_t data_len, size_t new_size); char * mchar_async_realloc(mchar_async_t *mchar_async, size_t node_idx, char *data, size_t data_len, size_t new_size);
void mchar_async_free(mchar_async_t *mchar_async, size_t node_idx, char *entry); void mchar_async_free(mchar_async_t *mchar_async, size_t node_idx, char *entry);
size_t mchar_async_node_add(mchar_async_t *mchar_async); size_t mchar_async_node_add(mchar_async_t *mchar_async, mystatus_t* status);
void mchar_async_node_clean(mchar_async_t *mchar_async, size_t node_idx); void mchar_async_node_clean(mchar_async_t *mchar_async, size_t node_idx);
void mchar_async_node_delete(mchar_async_t *mchar_async, size_t node_idx); void mchar_async_node_delete(mchar_async_t *mchar_async, size_t node_idx);
@ -116,7 +116,7 @@ char * mchar_async_crop_first_chars_without_cache(char *data, size_t crop_len);
size_t mchar_async_get_size_by_data(const char *data); size_t mchar_async_get_size_by_data(const char *data);
// cache // cache
void mchar_async_cache_init(mchar_async_cache_t *cache); mystatus_t mchar_async_cache_init(mchar_async_cache_t *cache);
mchar_async_cache_t * mchar_async_cache_destroy(mchar_async_cache_t *cache, bool self_destroy); mchar_async_cache_t * mchar_async_cache_destroy(mchar_async_cache_t *cache, bool self_destroy);
void mchar_async_cache_clean(mchar_async_cache_t *cache); void mchar_async_cache_clean(mchar_async_cache_t *cache);

View File

@ -26,7 +26,7 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
struct mcobject_chunk { struct mcobject_chunk {
unsigned char *begin; unsigned char *begin;

View File

@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils/mcsync.h> #include "mycore/utils/mcsync.h"
enum mcobject_async_status { enum mcobject_async_status {
MCOBJECT_ASYNC_STATUS_OK = 0, MCOBJECT_ASYNC_STATUS_OK = 0,

View File

@ -26,7 +26,7 @@
extern "C" { extern "C" {
#endif #endif
#include <mycore/myosi.h> #include "mycore/myosi.h"
struct mcsimple { struct mcsimple {
size_t struct_size; size_t struct_size;

View File

@ -22,37 +22,22 @@
#define MyCORE_UTILS_MCSYNC_H #define MyCORE_UTILS_MCSYNC_H
#pragma once #pragma once
#include "mycore/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <mycore/myosi.h>
#if !defined(MyCORE_BUILD_WITHOUT_THREADS)
#if defined(IS_OS_WINDOWS)
typedef CRITICAL_SECTION pthread_mutex_t;
typedef unsigned long pthread_mutexattr_t;
#else
# include <pthread.h>
#endif
#endif
enum mcsync_status { enum mcsync_status {
MCSYNC_STATUS_OK = 0, MCSYNC_STATUS_OK = 0x00,
MCSYNC_STATUS_NOT_OK = 1, MCSYNC_STATUS_NOT_OK = 0x01,
MCSYNC_STATUS_ERROR_MEM_ALLOCATE = 2 MCSYNC_STATUS_ERROR_MEM_ALLOCATE = 0x02
} }
typedef mcsync_status_t; typedef mcsync_status_t;
struct mcsync { struct mcsync {
int spinlock; int* spinlock;
#if !defined(MyCORE_BUILD_WITHOUT_THREADS) void* mutex;
pthread_mutex_t *mutex;
#endif
} }
typedef mcsync_t; typedef mcsync_t;
@ -61,37 +46,26 @@ mcsync_status_t mcsync_init(mcsync_t* mcsync);
void mcsync_clean(mcsync_t* mcsync); void mcsync_clean(mcsync_t* mcsync);
mcsync_t * mcsync_destroy(mcsync_t* mcsync, int destroy_self); mcsync_t * mcsync_destroy(mcsync_t* mcsync, int destroy_self);
mcsync_status_t mcsync_lock(mcsync_t* mclock); mcsync_status_t mcsync_lock(mcsync_t* mcsync);
mcsync_status_t mcsync_unlock(mcsync_t* mclock); mcsync_status_t mcsync_unlock(mcsync_t* mcsync);
mcsync_status_t mcsync_mutex_lock(mcsync_t* mclock); #ifndef MyCORE_BUILD_WITHOUT_THREADS
mcsync_status_t mcsync_mutex_unlock(mcsync_t* mclock); mcsync_status_t mcsync_spin_lock(void* spinlock);
mcsync_status_t mcsync_spin_unlock(void* spinlock);
#if !defined(MyCORE_BUILD_WITHOUT_THREADS) && defined(IS_OS_WINDOWS) mcsync_status_t mcsync_mutex_lock(void* mutex);
static __inline int pthread_mutex_lock(pthread_mutex_t *mutex) mcsync_status_t mcsync_mutex_try_lock(void* mutex);
{ mcsync_status_t mcsync_mutex_unlock(void* mutex);
EnterCriticalSection(mutex);
return 0;
}
static __inline int pthread_mutex_unlock(pthread_mutex_t *mutex) void * mcsync_spin_create(void);
{ mcsync_status_t mcsync_spin_init(void* spinlock);
LeaveCriticalSection(mutex); void mcsync_spin_clean(void* spinlock);
return 0; void mcsync_spin_destroy(void* spinlock);
}
static __inline int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *a) void * mcsync_mutex_create(void);
{ mcsync_status_t mcsync_mutex_init(void* mutex);
(void)a; void mcsync_mutex_clean(void* mutex);
InitializeCriticalSection(mutex); void mcsync_mutex_destroy(void* mutex);
return 0;
}
static __inline int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
DeleteCriticalSection(mutex);
return 0;
}
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -22,8 +22,8 @@
#define MyCORE_UTILS_MCTREE_H #define MyCORE_UTILS_MCTREE_H
#pragma once #pragma once
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -21,8 +21,8 @@
#ifndef MyCORE_UTILS_MHASH_H #ifndef MyCORE_UTILS_MHASH_H
#define MyCORE_UTILS_MHASH_H #define MyCORE_UTILS_MHASH_H
#include <mycore/myosi.h> #include "mycore/myosi.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/list.h> #include "mycss/selectors/list.h"
#define mycss_an_plus_b_current_entry(entry) (*entry->anb->entry) #define mycss_an_plus_b_current_entry(entry) (*entry->anb->entry)

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#include <mycss/entry.h> #include "mycss/entry.h"
bool mycss_check_three_code_points_would_start_identifier(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size); bool mycss_check_three_code_points_would_start_identifier(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
bool mycss_check_two_code_points_valid_escape(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size); bool mycss_check_two_code_points_valid_escape(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <myhtml/mystring.h> #include "myhtml/mystring.h"
const char * mycss_convert_split_dimension_string(mycore_string_t* str, double* value, bool* is_float); const char * mycss_convert_split_dimension_string(mycore_string_t* str, double* value, bool* is_float);

View File

@ -22,8 +22,8 @@
#define MyCSS_DECLARATION_DEFAULT_H #define MyCSS_DECLARATION_DEFAULT_H
#pragma once #pragma once
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,7 +22,7 @@
#define MyCSS_DECLARATION_DEFAULT_RESOURCES_H #define MyCSS_DECLARATION_DEFAULT_RESOURCES_H
#pragma once #pragma once
#include <mycss/declaration/default_entries.h> #include "mycss/declaration/default_entries.h"
static mycss_declaration_entry_t * mycss_declaration_default_entry_index_type[MyCSS_PROPERTY_TYPE_LAST_ENTRY] = static mycss_declaration_entry_t * mycss_declaration_default_entry_index_type[MyCSS_PROPERTY_TYPE_LAST_ENTRY] =
{ {

View File

@ -22,10 +22,10 @@
#define MyHTML_MyCSS_DECLARATION_ENTRY_H #define MyHTML_MyCSS_DECLARATION_ENTRY_H
#pragma once #pragma once
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycss/declaration/entry_destroy.h> #include "mycss/declaration/entry_destroy.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/property/init.h> #include "mycss/property/init.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MyCSS_DECLARATION_ENTRY_DESTROY_H #define MyCSS_DECLARATION_ENTRY_DESTROY_H
#pragma once #pragma once
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/values/destroy.h> #include "mycss/values/destroy.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MyHTML_MyCSS_DECLARATION_INIT_H #define MyHTML_MyCSS_DECLARATION_INIT_H
#pragma once #pragma once
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,11 +22,11 @@
#define MyHTML_MyCSS_DECLARATION_MYOSI_H #define MyHTML_MyCSS_DECLARATION_MYOSI_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/stack.h> #include "mycss/stack.h"
#include <mycss/values/units.h> #include "mycss/values/units.h"
#include <mycss/property/myosi.h> #include "mycss/property/myosi.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/property/init.h> #include "mycss/property/init.h"
#include <mycss/declaration/entry.h> #include "mycss/declaration/entry.h"
void mycss_declaration_parser_begin(mycss_entry_t* entry, mycss_token_t* token); void mycss_declaration_parser_begin(mycss_entry_t* entry, mycss_token_t* token);
void mycss_declaration_parser_ident(mycss_entry_t* entry, mycss_token_t* token); void mycss_declaration_parser_ident(mycss_entry_t* entry, mycss_token_t* token);

View File

@ -22,10 +22,10 @@
#define MyHTML_MyCSS_DECLARATION_SERIALIZATION_H #define MyHTML_MyCSS_DECLARATION_SERIALIZATION_H
#pragma once #pragma once
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/property/init.h> #include "mycss/property/init.h"
#include <mycss/property/serialization.h> #include "mycss/property/serialization.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/declaration/parser.h> #include "mycss/declaration/parser.h"
bool mycss_declaration_state_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response); bool mycss_declaration_state_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response);

View File

@ -26,22 +26,22 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#include <mycss/parser.h> #include "mycss/parser.h"
#include <mycss/stylesheet.h> #include "mycss/stylesheet.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <mycss/namespace/init.h> #include "mycss/namespace/init.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/init.h> #include "mycss/selectors/init.h"
#include <mycss/an_plus_b.h> #include "mycss/an_plus_b.h"
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycss/declaration/init.h> #include "mycss/declaration/init.h"
#include <mycss/declaration/entry.h> #include "mycss/declaration/entry.h"
#include <mycss/media/myosi.h> #include "mycss/media/myosi.h"
#include <mycss/media/init.h> #include "mycss/media/init.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
struct mycss_entry_parser_list_entry { struct mycss_entry_parser_list_entry {
mycss_parser_token_f parser; mycss_parser_token_f parser;

View File

@ -22,7 +22,7 @@
#define MyHTML_MyCSS_MEDIA_INIT_H #define MyHTML_MyCSS_MEDIA_INIT_H
#pragma once #pragma once
#include <mycss/media/myosi.h> #include "mycss/media/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,7 +22,7 @@
#define MyHTML_MyCSS_MEDIA_MYOSI_H #define MyHTML_MyCSS_MEDIA_MYOSI_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MyHTML_MyCSS_MEDIA_STATE_H #define MyHTML_MyCSS_MEDIA_STATE_H
#pragma once #pragma once
#include <mycss/media/myosi.h> #include "mycss/media/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -28,23 +28,23 @@ extern "C" {
#ifdef MyCSS_DEBUG #ifdef MyCSS_DEBUG
#define MyCSS_DEBUG_MESSAGE(format, ...) \ #define MyCSS_DEBUG_MESSAGE(format, ...) \
mycore_print(stderr, "DEBUG: "format"\n", ##__VA_ARGS__) mycore_fprintf(stderr, "DEBUG: "format"\n", ##__VA_ARGS__)
#else #else
#define MyCSS_DEBUG_MESSAGE(format, ...) #define MyCSS_DEBUG_MESSAGE(format, ...)
#endif #endif
#ifdef DEBUG_MODE #ifdef DEBUG_MODE
#define MyCORE_DEBUG_ERROR(format, ...) \ #define MyCORE_DEBUG_ERROR(format, ...) \
mycore_print(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__) mycore_fprintf(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__)
#else #else
#define MyCORE_DEBUG_ERROR(format, ...) #define MyCORE_DEBUG_ERROR(format, ...)
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/tokenizer.h> #include "mycss/tokenizer.h"
#include <myhtml/myhtml.h> #include "myhtml/myhtml.h"
#include <mycore/utils/mcobject_async.h> #include "mycore/utils/mcobject_async.h"
struct mycss { struct mycss {
mycss_tokenizer_state_f* parse_state_func; mycss_tokenizer_state_f* parse_state_func;

View File

@ -26,7 +26,7 @@
extern "C" { extern "C" {
#endif #endif
#include <myhtml/myosi.h> #include "myhtml/myosi.h"
// base // base
/* /*

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycore/incoming.h> #include "mycore/incoming.h"
#include <mycore/mystring.h> #include "mycore/mystring.h"
#include <myencoding/encoding.h> #include "myencoding/encoding.h"
enum mycss_string_process_state { enum mycss_string_process_state {
MyCSS_STRING_PROCESS_STATE_DATA = 0x00, MyCSS_STRING_PROCESS_STATE_DATA = 0x00,

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <myhtml/mynamespace.h> #include "myhtml/mynamespace.h"
mycss_namespace_t * mycss_namespace_create(void); mycss_namespace_t * mycss_namespace_create(void);
mystatus_t mycss_namespace_init(mycss_entry_t* entry, mycss_namespace_t* ns); mystatus_t mycss_namespace_init(mycss_entry_t* entry, mycss_namespace_t* ns);

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <myhtml/mystring.h> #include "myhtml/mystring.h"
#include <mycore/utils/mctree.h> #include "mycore/utils/mctree.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
typedef struct mycss_namespace mycss_namespace_t; typedef struct mycss_namespace mycss_namespace_t;
typedef struct mycss_namespace_entry mycss_namespace_entry_t; typedef struct mycss_namespace_entry mycss_namespace_entry_t;

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <myhtml/mynamespace.h> #include "myhtml/mynamespace.h"
#include <mycore/utils/mctree.h> #include "mycore/utils/mctree.h"
void mycss_namespace_parser_begin(mycss_entry_t* entry); void mycss_namespace_parser_begin(mycss_entry_t* entry);

View File

@ -22,8 +22,8 @@
#define MyHTML_MyCSS_NAMESPACE_SERIALIZATION_H #define MyHTML_MyCSS_NAMESPACE_SERIALIZATION_H
#pragma once #pragma once
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <mycss/namespace/parser.h> #include "mycss/namespace/parser.h"
#include <mycore/utils.h> #include "mycore/utils.h"
bool mycss_namespace_state_namespace(mycss_entry_t* entry, mycss_token_t* token, bool last_response); bool mycss_namespace_state_namespace(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_namespace_state_namespace_namespace(mycss_entry_t* entry, mycss_token_t* token, bool last_response); bool mycss_namespace_state_namespace_namespace(mycss_entry_t* entry, mycss_token_t* token, bool last_response);

View File

@ -26,16 +26,16 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/mystring.h> #include "mycss/mystring.h"
#include <mycss/convert.h> #include "mycss/convert.h"
#include <mycss/namespace/state.h> #include "mycss/namespace/state.h"
#include <mycss/selectors/state.h> #include "mycss/selectors/state.h"
#include <mycss/selectors/parser.h> #include "mycss/selectors/parser.h"
#include <mycss/declaration/state.h> #include "mycss/declaration/state.h"
#include <mycore/incoming.h> #include "mycore/incoming.h"
mycss_token_t * mycss_parser_token_ready_callback_function(mycss_entry_t* entry, mycss_token_t* token); mycss_token_t * mycss_parser_token_ready_callback_function(mycss_entry_t* entry, mycss_token_t* token);

View File

@ -22,10 +22,10 @@
#define MyHTML_MyCSS_PROPERTY_INIT_H #define MyHTML_MyCSS_PROPERTY_INIT_H
#pragma once #pragma once
#include <mycss/property/myosi.h> #include "mycss/property/myosi.h"
#include <mycss/property/parser.h> #include "mycss/property/parser.h"
#include <mycss/values/serialization.h> #include "mycss/values/serialization.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MyHTML_MyCSS_PROPERTY_MYOSI_H #define MyHTML_MyCSS_PROPERTY_MYOSI_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/property/const.h> #include "mycss/property/const.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,11 +22,11 @@
#define MyHTML_MyCSS_PROPERTY_PARSER_H #define MyHTML_MyCSS_PROPERTY_PARSER_H
#pragma once #pragma once
#include <mycss/property/myosi.h> #include "mycss/property/myosi.h"
#include <mycss/property/shared.h> #include "mycss/property/shared.h"
#include <mycss/values/consume.h> #include "mycss/values/consume.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/declaration/entry.h> #include "mycss/declaration/entry.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MyHTML_MyCSS_PROPERTY_SERIALIZATION_H #define MyHTML_MyCSS_PROPERTY_SERIALIZATION_H
#pragma once #pragma once
#include <mycss/property/myosi.h> #include "mycss/property/myosi.h"
#include <mycss/property/init.h> #include "mycss/property/init.h"
#include <mycss/values/serialization.h> #include "mycss/values/serialization.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,12 +22,12 @@
#define MyHTML_MyCSS_PROPERTY_SHARED_H #define MyHTML_MyCSS_PROPERTY_SHARED_H
#pragma once #pragma once
#include <mycss/property/myosi.h> #include "mycss/property/myosi.h"
#include <mycss/values/consume.h> #include "mycss/values/consume.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/values/color.h> #include "mycss/values/color.h"
#include <mycss/values/image.h> #include "mycss/values/image.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/function_parser.h> #include "mycss/selectors/function_parser.h"
typedef void (*mycss_selectors_function_begin_f)(mycss_entry_t* entry, mycss_selectors_entry_t* selector); typedef void (*mycss_selectors_function_begin_f)(mycss_entry_t* entry, mycss_selectors_entry_t* selector);

View File

@ -28,8 +28,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
bool mycss_selectors_function_parser_state_drop_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response); bool mycss_selectors_function_parser_state_drop_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/list.h> #include "mycss/selectors/list.h"
mycss_selectors_t * mycss_selectors_create(void); mycss_selectors_t * mycss_selectors_create(void);
mystatus_t mycss_selectors_init(mycss_entry_t* entry, mycss_selectors_t* selectors); mystatus_t mycss_selectors_init(mycss_entry_t* entry, mycss_selectors_t* selectors);

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
struct mycss_selectors_entries_list { struct mycss_selectors_entries_list {
mycss_selectors_entry_t* entry; mycss_selectors_entry_t* entry;

View File

@ -32,11 +32,11 @@ typedef struct mycss_selectors_entries_list mycss_selectors_entries_list_t;
typedef struct mycss_selectors_list mycss_selectors_list_t; typedef struct mycss_selectors_list mycss_selectors_list_t;
typedef struct mycss_selectors_specificity mycss_selectors_specificity_t; typedef struct mycss_selectors_specificity mycss_selectors_specificity_t;
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mystring.h> #include "mycss/mystring.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#include <mycore/utils/mcobject.h> #include "mycore/utils/mcobject.h"
typedef bool (*mycss_selectors_state_f)(mycss_entry_t* entry, mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_token_t* token); typedef bool (*mycss_selectors_state_f)(mycss_entry_t* entry, mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_token_t* token);
typedef void (*mycss_callback_selector_done_f)(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector); typedef void (*mycss_callback_selector_done_f)(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector);

View File

@ -26,13 +26,13 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <mycss/namespace/init.h> #include "mycss/namespace/init.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/value.h> #include "mycss/selectors/value.h"
#include <mycss/selectors/function.h> #include "mycss/selectors/function.h"
#include <mycss/selectors/pseudo.h> #include "mycss/selectors/pseudo.h"
void mycss_selectors_parser_selector_begin(mycss_entry_t* entry, mycss_token_t* token); void mycss_selectors_parser_selector_begin(mycss_entry_t* entry, mycss_token_t* token);
void mycss_selectors_parser_selector_ident_type(mycss_entry_t* entry, mycss_token_t* token); void mycss_selectors_parser_selector_ident_type(mycss_entry_t* entry, mycss_token_t* token);

View File

@ -26,8 +26,8 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
struct mycss_selectots_pseudo_begin_entry { struct mycss_selectots_pseudo_begin_entry {
const char* name; const char* name;

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/namespace/serialization.h> #include "mycss/namespace/serialization.h"
#include <mycss/declaration/serialization.h> #include "mycss/declaration/serialization.h"
void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_callback_serialization_f callback, void* context); void mycss_selectors_serialization_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_callback_serialization_f callback, void* context);
bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, mycss_callback_serialization_f callback, void* context); bool mycss_selectors_serialization_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, mycss_callback_serialization_f callback, void* context);

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/parser.h> #include "mycss/selectors/parser.h"
#include <mycore/utils.h> #include "mycore/utils.h"
void mycss_selectors_state_end(mycss_entry_t* entry); void mycss_selectors_state_end(mycss_entry_t* entry);
bool mycss_selectors_state_function_skip_all(mycss_entry_t* entry, mycss_token_t* token, bool last_response); bool mycss_selectors_state_function_skip_all(mycss_entry_t* entry, mycss_token_t* token, bool last_response);

View File

@ -34,9 +34,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
typedef void * (*mycss_selectors_value_destroy_f)(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy); typedef void * (*mycss_selectors_value_destroy_f)(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
typedef void * (*mycss_selectors_value_function_destroy_f)(mycss_entry_t* entry, void* value, bool self_destroy); typedef void * (*mycss_selectors_value_function_destroy_f)(mycss_entry_t* entry, void* value, bool self_destroy);

View File

@ -22,7 +22,7 @@
#define MyHTML_MyCSS_SELECTORS_VALUE_RESOURCE_H #define MyHTML_MyCSS_SELECTORS_VALUE_RESOURCE_H
#pragma once #pragma once
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
static const mycss_selectors_value_destroy_f mycss_selectors_value_destroy_map[MyCSS_SELECTORS_TYPE_LAST_ENTRY] = { static const mycss_selectors_value_destroy_f mycss_selectors_value_destroy_map[MyCSS_SELECTORS_TYPE_LAST_ENTRY] = {
mycss_selectors_value_undef_destroy, /* MyCSS_SELECTORS_TYPE_UNDEF */ mycss_selectors_value_undef_destroy, /* MyCSS_SELECTORS_TYPE_UNDEF */

View File

@ -22,7 +22,7 @@
#define MyCSS_STACK_H #define MyCSS_STACK_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,11 +22,11 @@
#define MyHTML_MyCSS_STYLESHEET_H #define MyHTML_MyCSS_STYLESHEET_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/namespace/myosi.h> #include "mycss/namespace/myosi.h"
#include <mycss/selectors/myosi.h> #include "mycss/selectors/myosi.h"
#include <mycss/selectors/serialization.h> #include "mycss/selectors/serialization.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,14 +26,14 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/check.h> #include "mycss/check.h"
#include <mycss/tokenizer_global.h> #include "mycss/tokenizer_global.h"
#include <mycss/tokenizer_end.h> #include "mycss/tokenizer_end.h"
#include <mycore/incoming.h> #include "mycore/incoming.h"
#define MyCSS_TOKEN_READY_CALLBACK_FUNCTION(ENTRY, TOKEN) \ #define MyCSS_TOKEN_READY_CALLBACK_FUNCTION(ENTRY, TOKEN) \
++ENTRY->token_counter; \ ++ENTRY->token_counter; \

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#include <mycss/entry.h> #include "mycss/entry.h"
size_t mycss_tokenizer_end_run_state_single(mycss_entry_t* entry, mycss_tokenizer_state_t state, const char* css, size_t css_offset, size_t css_size); size_t mycss_tokenizer_end_run_state_single(mycss_entry_t* entry, mycss_tokenizer_state_t state, const char* css, size_t css_offset, size_t css_size);

View File

@ -26,10 +26,10 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/mycss.h> #include "mycss/mycss.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/check.h> #include "mycss/check.h"
size_t mycss_tokenizer_global_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size); size_t mycss_tokenizer_global_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);

View File

@ -22,10 +22,10 @@
#define MyCSS_VALUES_COLOR_H #define MyCSS_VALUES_COLOR_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/values/color_const.h> #include "mycss/values/color_const.h"
#include <mycss/values/color_parser.h> #include "mycss/values/color_parser.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MyCSS_VALUES_COLOR_PARSER_H #define MyCSS_VALUES_COLOR_PARSER_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/values/consume.h> #include "mycss/values/consume.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,10 +22,10 @@
#define MyHTML_MyCSS_VALUES_CONSUME_H #define MyHTML_MyCSS_VALUES_CONSUME_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/entry.h> #include "mycss/entry.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/values/units.h> #include "mycss/values/units.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,8 +22,8 @@
#define MyCSS_VALUES_DESTROY_H #define MyCSS_VALUES_DESTROY_H
#pragma once #pragma once
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/declaration/entry.h> #include "mycss/declaration/entry.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -22,9 +22,9 @@
#define MyCSS_VALUES_IMAGE_H #define MyCSS_VALUES_IMAGE_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/property/parser.h> #include "mycss/property/parser.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -26,9 +26,9 @@
extern "C" { extern "C" {
#endif #endif
#include <mycss/values/values.h> #include "mycss/values/values.h"
#include <mycss/values/color.h> #include "mycss/values/color.h"
#include <mycss/property/const.h> #include "mycss/property/const.h"
void mycss_values_serialization_string(mycore_string_t* str, mycss_callback_serialization_f callback, void* context); void mycss_values_serialization_string(mycore_string_t* str, mycss_callback_serialization_f callback, void* context);
void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callback_serialization_f callback, void* context); void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callback_serialization_f callback, void* context);

View File

@ -22,8 +22,8 @@
#define MyHTML_MyCSS_VALUES_UNITS_H #define MyHTML_MyCSS_VALUES_UNITS_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#define mycss_units_is_angel_type(type) (type >= 1 && type <= 4) #define mycss_units_is_angel_type(type) (type >= 1 && type <= 4)
#define mycss_units_is_frequency_type(type) (type >= 5 && type <= 6) #define mycss_units_is_frequency_type(type) (type >= 5 && type <= 6)

View File

@ -22,13 +22,13 @@
#define MyHTML_MyCSS_VALUES_VALUES_H #define MyHTML_MyCSS_VALUES_VALUES_H
#pragma once #pragma once
#include <mycss/myosi.h> #include "mycss/myosi.h"
#include <mycss/values/units.h> #include "mycss/values/units.h"
#include <mycss/values/color_const.h> #include "mycss/values/color_const.h"
#include <mycss/property/const.h> #include "mycss/property/const.h"
#include <mycore/utils/mchar_async.h> #include "mycore/utils/mchar_async.h"
#include <myhtml/mystring.h> #include "myhtml/mystring.h"
#include <mycss/declaration/myosi.h> #include "mycss/declaration/myosi.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -28,7 +28,7 @@ extern "C" {
#define MyENCODING_DETECT_NAME_STATIC_SIZE 419 #define MyENCODING_DETECT_NAME_STATIC_SIZE 419
#include <myencoding/encoding.h> #include "myencoding/encoding.h"
static const myencoding_detect_name_entry_t myencoding_detect_name_entry_static_list_index[] = static const myencoding_detect_name_entry_t myencoding_detect_name_entry_static_list_index[] =
{ {

View File

@ -26,9 +26,9 @@
//extern "C" { //extern "C" {
#endif #endif
#include <myencoding/myosi.h> #include "myencoding/myosi.h"
#include <mycore/utils.h> #include "mycore/utils.h"
#include <mycore/mystring.h> #include "mycore/mystring.h"
struct myencoding_result { struct myencoding_result {
unsigned long first; unsigned long first;

View File

@ -22,7 +22,7 @@
#define MyENCODING_MYOSI_H #define MyENCODING_MYOSI_H
#pragma once #pragma once
#include <mycore/myosi.h> #include "mycore/myosi.h"
#define MyENCODING_VERSION_MAJOR 1 #define MyENCODING_VERSION_MAJOR 1
#define MyENCODING_VERSION_MINOR 0 #define MyENCODING_VERSION_MINOR 0

View File

@ -26,10 +26,10 @@
//extern "C" { //extern "C" {
#endif #endif
#include <myencoding/myosi.h> #include "myencoding/myosi.h"
#include <myencoding/encoding.h> #include "myencoding/encoding.h"
#include <mycore/mystring.h> #include "mycore/mystring.h"
#include <mycore/utils.h> #include "mycore/utils.h"
void myencoding_string_append(mycore_string_t* str, const char* buff, size_t length, myencoding_t encoding); void myencoding_string_append(mycore_string_t* str, const char* buff, size_t length, myencoding_t encoding);

Some files were not shown because too many files have changed in this diff Show More