mirror of
https://github.com/lexborisov/Modest
synced 2024-11-21 21:31:25 +03:00
Added -pedantic
This commit is contained in:
parent
5045cd4197
commit
4d34d0848e
19
Makefile
19
Makefile
@ -63,10 +63,18 @@ MODEST_BUILD_OBJECT_SHARED ?= $(CC) -shared $(LDFLAGS) $(MODEST_LDFLAGS) $1 -o
|
|||||||
MODEST_BUILD_OBJECT_STATIC ?= $(AR) crus $2 $1
|
MODEST_BUILD_OBJECT_STATIC ?= $(AR) crus $2 $1
|
||||||
MODEST_BUILD_OBJECT_MODULES := $(foreach dir,$(MODEST_BUILD_MODULES_TARGET),$($(dir)_objs))
|
MODEST_BUILD_OBJECT_MODULES := $(foreach dir,$(MODEST_BUILD_MODULES_TARGET),$($(dir)_objs))
|
||||||
|
|
||||||
|
#********************
|
||||||
|
# Sub Directories
|
||||||
|
#***************
|
||||||
|
BUILD_SUB_DIRS := examples $(TEST_DIR)
|
||||||
|
|
||||||
#********************
|
#********************
|
||||||
# Target options
|
# Target options
|
||||||
#***************
|
#***************
|
||||||
all: shared static
|
all: library
|
||||||
|
for f in $(BUILD_SUB_DIRS); do $(MAKE) -C $$f all; done
|
||||||
|
|
||||||
|
library: shared static
|
||||||
|
|
||||||
shared: create $(MODEST_BUILD_MODULES_TARGET_ALL)
|
shared: create $(MODEST_BUILD_MODULES_TARGET_ALL)
|
||||||
$(call MODEST_BUILD_OBJECT_SHARED,$(MODEST_BUILD_OBJECT_MODULES),$(call MODEST_LIBRARY_WITH_VERSION))
|
$(call MODEST_BUILD_OBJECT_SHARED,$(MODEST_BUILD_OBJECT_MODULES),$(call MODEST_LIBRARY_WITH_VERSION))
|
||||||
@ -78,7 +86,9 @@ static: create $(MODEST_BUILD_MODULES_TARGET_ALL)
|
|||||||
|
|
||||||
clean: $(MODEST_BUILD_MODULES_TARGET_CLEAN)
|
clean: $(MODEST_BUILD_MODULES_TARGET_CLEAN)
|
||||||
rm -f $(call MODEST_LIBRARY_WITH_VERSION) && rm -f $(call MODEST_LIBRARY_STATIC)
|
rm -f $(call MODEST_LIBRARY_WITH_VERSION) && rm -f $(call MODEST_LIBRARY_STATIC)
|
||||||
|
rm -rf $(TEST_DIR_BASE)
|
||||||
$(call MODEST_BUILD_CLEAN_AFTER)
|
$(call MODEST_BUILD_CLEAN_AFTER)
|
||||||
|
for f in $(BUILD_SUB_DIRS); do $(MAKE) -C $$f clean; done
|
||||||
|
|
||||||
clone: clean_api $(MODEST_BUILD_MODULES_TARGET_CLONE)
|
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' {} \;
|
find $(INCLUDE_DIR_API) -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \;
|
||||||
@ -88,6 +98,9 @@ clean_api:
|
|||||||
rm -rf $(INCLUDE_DIR_API)
|
rm -rf $(INCLUDE_DIR_API)
|
||||||
|
|
||||||
create:
|
create:
|
||||||
mkdir -p $(BINARY_DIR_BASE) $(LIB_DIR_BASE)
|
mkdir -p $(BINARY_DIR_BASE) $(LIB_DIR_BASE) $(TEST_DIR_BASE)
|
||||||
|
|
||||||
.PHONY: all clean clone $(MODEST_BUILD_MODULES_TARGET_ALL)
|
test:
|
||||||
|
$(MAKE) -C $(TEST_DIR) run
|
||||||
|
|
||||||
|
.PHONY: all clean clone test $(MODEST_BUILD_MODULES_TARGET_ALL)
|
||||||
|
@ -12,7 +12,7 @@ MODEST_VERSION_STRING := $(MODEST_VERSION_MAJOR).$(MODEST_VERSION_MINOR).$(MODES
|
|||||||
#********************
|
#********************
|
||||||
# Flags
|
# Flags
|
||||||
#***************
|
#***************
|
||||||
MODEST_CFLAGS ?= -Wall -Werror
|
MODEST_CFLAGS ?= -Wall -Werror -pipe -pedantic
|
||||||
MODEST_LFLAGS ?=
|
MODEST_LFLAGS ?=
|
||||||
|
|
||||||
#********************
|
#********************
|
||||||
@ -52,6 +52,12 @@ MODEST_LIBRARY_WITH_VERSION_MAJOR_MINOR = $(LIB_DIR_BASE)/lib$(LIB_NAME)-$(MODES
|
|||||||
# binaries dirs
|
# binaries dirs
|
||||||
BINARY_DIR_BASE := bin
|
BINARY_DIR_BASE := bin
|
||||||
|
|
||||||
|
#********************
|
||||||
|
# Test
|
||||||
|
#***************
|
||||||
|
TEST_DIR := test
|
||||||
|
TEST_DIR_BASE := test_suite
|
||||||
|
|
||||||
#********************
|
#********************
|
||||||
# Build
|
# Build
|
||||||
#***************
|
#***************
|
||||||
|
@ -1 +0,0 @@
|
|||||||
theme: jekyll-theme-cayman
|
|
@ -119,10 +119,8 @@
|
|||||||
0EF2D5F21E01E089000570B6 /* default.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF2D5F01E01E089000570B6 /* default.c */; };
|
0EF2D5F21E01E089000570B6 /* default.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF2D5F01E01E089000570B6 /* default.c */; };
|
||||||
0EF2D5F71E01E0BD000570B6 /* default.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF2D5F51E01E0BD000570B6 /* default.c */; };
|
0EF2D5F71E01E0BD000570B6 /* default.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF2D5F51E01E0BD000570B6 /* default.c */; };
|
||||||
0EF5D1581E680D880048E3D1 /* incoming.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D14D1E680D880048E3D1 /* incoming.c */; };
|
0EF5D1581E680D880048E3D1 /* incoming.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D14D1E680D880048E3D1 /* incoming.c */; };
|
||||||
0EF5D1591E680D880048E3D1 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D14F1E680D880048E3D1 /* memory.c */; };
|
|
||||||
0EF5D15A1E680D880048E3D1 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1511E680D880048E3D1 /* mystring.c */; };
|
0EF5D15A1E680D880048E3D1 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1511E680D880048E3D1 /* mystring.c */; };
|
||||||
0EF5D15B1E680D880048E3D1 /* perf.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1531E680D880048E3D1 /* perf.c */; };
|
0EF5D15C1E680D880048E3D1 /* mythread.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1541E680D880048E3D1 /* mythread.c */; };
|
||||||
0EF5D15C1E680D880048E3D1 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1541E680D880048E3D1 /* thread.c */; };
|
|
||||||
0EF5D15D1E680D880048E3D1 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1561E680D880048E3D1 /* utils.c */; };
|
0EF5D15D1E680D880048E3D1 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1561E680D880048E3D1 /* utils.c */; };
|
||||||
0EF5D1701E680DA50048E3D1 /* avl_tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1601E680DA50048E3D1 /* avl_tree.c */; };
|
0EF5D1701E680DA50048E3D1 /* avl_tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1601E680DA50048E3D1 /* avl_tree.c */; };
|
||||||
0EF5D1711E680DA50048E3D1 /* mchar_async.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1621E680DA50048E3D1 /* mchar_async.c */; };
|
0EF5D1711E680DA50048E3D1 /* mchar_async.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1621E680DA50048E3D1 /* mchar_async.c */; };
|
||||||
@ -137,6 +135,11 @@
|
|||||||
0EF5D1801E6819E80048E3D1 /* encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D17D1E6819E80048E3D1 /* encoding.c */; };
|
0EF5D1801E6819E80048E3D1 /* encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D17D1E6819E80048E3D1 /* encoding.c */; };
|
||||||
0EF5D1841E6822BD0048E3D1 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1821E6822BD0048E3D1 /* mystring.c */; };
|
0EF5D1841E6822BD0048E3D1 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1821E6822BD0048E3D1 /* mystring.c */; };
|
||||||
0EF5D1871E68362D0048E3D1 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1851E68362D0048E3D1 /* mystring.c */; };
|
0EF5D1871E68362D0048E3D1 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1851E68362D0048E3D1 /* mystring.c */; };
|
||||||
|
0EF5D19E1E6AE8BF0048E3D1 /* thread_queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D19C1E6AE8BF0048E3D1 /* thread_queue.c */; };
|
||||||
|
0EF5D1A71E6DDDC20048E3D1 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1A31E6DDDC20048E3D1 /* thread.c */; };
|
||||||
|
0EF5D1A81E6DDDC20048E3D1 /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1A41E6DDDC20048E3D1 /* io.c */; };
|
||||||
|
0EF5D1A91E6DDDC20048E3D1 /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1A51E6DDDC20048E3D1 /* memory.c */; };
|
||||||
|
0EF5D1AC1E6DDDCD0048E3D1 /* mcsync.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF5D1AB1E6DDDCD0048E3D1 /* mcsync.c */; };
|
||||||
0EF68DCE1DBF6CF000B0DEA4 /* color_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF68DCC1DBF6CF000B0DEA4 /* color_parser.c */; };
|
0EF68DCE1DBF6CF000B0DEA4 /* color_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF68DCC1DBF6CF000B0DEA4 /* color_parser.c */; };
|
||||||
0EF808A31D9FF3BC001AF6EF /* sheet.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF808A11D9FF3BC001AF6EF /* sheet.c */; };
|
0EF808A31D9FF3BC001AF6EF /* sheet.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF808A11D9FF3BC001AF6EF /* sheet.c */; };
|
||||||
0EF808A61DA08BBE001AF6EF /* map.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF808A41DA08BBE001AF6EF /* map.c */; };
|
0EF808A61DA08BBE001AF6EF /* map.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EF808A41DA08BBE001AF6EF /* map.c */; };
|
||||||
@ -411,13 +414,11 @@
|
|||||||
0EF2D5F61E01E0BD000570B6 /* default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default.h; sourceTree = "<group>"; };
|
0EF2D5F61E01E0BD000570B6 /* default.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default.h; sourceTree = "<group>"; };
|
||||||
0EF5D14D1E680D880048E3D1 /* incoming.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = incoming.c; path = ../../source/mycore/incoming.c; sourceTree = "<group>"; };
|
0EF5D14D1E680D880048E3D1 /* incoming.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = incoming.c; path = ../../source/mycore/incoming.c; sourceTree = "<group>"; };
|
||||||
0EF5D14E1E680D880048E3D1 /* incoming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = incoming.h; path = ../../source/mycore/incoming.h; sourceTree = "<group>"; };
|
0EF5D14E1E680D880048E3D1 /* incoming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = incoming.h; path = ../../source/mycore/incoming.h; sourceTree = "<group>"; };
|
||||||
0EF5D14F1E680D880048E3D1 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memory.c; path = ../../source/mycore/memory.c; sourceTree = "<group>"; };
|
|
||||||
0EF5D1501E680D880048E3D1 /* myosi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../source/mycore/myosi.h; sourceTree = "<group>"; };
|
0EF5D1501E680D880048E3D1 /* myosi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../source/mycore/myosi.h; sourceTree = "<group>"; };
|
||||||
0EF5D1511E680D880048E3D1 /* mystring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mystring.c; path = ../../source/mycore/mystring.c; sourceTree = "<group>"; };
|
0EF5D1511E680D880048E3D1 /* mystring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mystring.c; path = ../../source/mycore/mystring.c; sourceTree = "<group>"; };
|
||||||
0EF5D1521E680D880048E3D1 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../source/mycore/mystring.h; sourceTree = "<group>"; };
|
0EF5D1521E680D880048E3D1 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../source/mycore/mystring.h; sourceTree = "<group>"; };
|
||||||
0EF5D1531E680D880048E3D1 /* perf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = perf.c; path = ../../source/mycore/perf.c; sourceTree = "<group>"; };
|
0EF5D1541E680D880048E3D1 /* mythread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mythread.c; path = ../../source/mycore/mythread.c; sourceTree = "<group>"; };
|
||||||
0EF5D1541E680D880048E3D1 /* thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thread.c; path = ../../source/mycore/thread.c; sourceTree = "<group>"; };
|
0EF5D1551E680D880048E3D1 /* mythread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mythread.h; path = ../../source/mycore/mythread.h; sourceTree = "<group>"; };
|
||||||
0EF5D1551E680D880048E3D1 /* thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = thread.h; path = ../../source/mycore/thread.h; sourceTree = "<group>"; };
|
|
||||||
0EF5D1561E680D880048E3D1 /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utils.c; path = ../../source/mycore/utils.c; sourceTree = "<group>"; };
|
0EF5D1561E680D880048E3D1 /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utils.c; path = ../../source/mycore/utils.c; sourceTree = "<group>"; };
|
||||||
0EF5D1571E680D880048E3D1 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../source/mycore/utils.h; sourceTree = "<group>"; };
|
0EF5D1571E680D880048E3D1 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../source/mycore/utils.h; sourceTree = "<group>"; };
|
||||||
0EF5D15F1E680DA50048E3D1 /* resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resources.h; path = ../../source/mycore/utils/resources.h; sourceTree = "<group>"; };
|
0EF5D15F1E680DA50048E3D1 /* resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resources.h; path = ../../source/mycore/utils/resources.h; sourceTree = "<group>"; };
|
||||||
@ -448,6 +449,12 @@
|
|||||||
0EF5D1831E6822BD0048E3D1 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../source/myencoding/mystring.h; sourceTree = "<group>"; };
|
0EF5D1831E6822BD0048E3D1 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../source/myencoding/mystring.h; sourceTree = "<group>"; };
|
||||||
0EF5D1851E68362D0048E3D1 /* mystring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mystring.c; path = ../../source/myhtml/mystring.c; sourceTree = "<group>"; };
|
0EF5D1851E68362D0048E3D1 /* mystring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mystring.c; path = ../../source/myhtml/mystring.c; sourceTree = "<group>"; };
|
||||||
0EF5D1861E68362D0048E3D1 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../source/myhtml/mystring.h; sourceTree = "<group>"; };
|
0EF5D1861E68362D0048E3D1 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../source/myhtml/mystring.h; sourceTree = "<group>"; };
|
||||||
|
0EF5D19C1E6AE8BF0048E3D1 /* thread_queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thread_queue.c; path = ../../source/mycore/thread_queue.c; sourceTree = "<group>"; };
|
||||||
|
0EF5D19D1E6AE8BF0048E3D1 /* thread_queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = thread_queue.h; path = ../../source/mycore/thread_queue.h; sourceTree = "<group>"; };
|
||||||
|
0EF5D1A31E6DDDC20048E3D1 /* thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thread.c; path = ../../source/myport/posix/mycore/thread.c; sourceTree = "<group>"; };
|
||||||
|
0EF5D1A41E6DDDC20048E3D1 /* io.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = io.c; path = ../../source/myport/posix/mycore/io.c; sourceTree = "<group>"; };
|
||||||
|
0EF5D1A51E6DDDC20048E3D1 /* memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = memory.c; path = ../../source/myport/posix/mycore/memory.c; sourceTree = "<group>"; };
|
||||||
|
0EF5D1AB1E6DDDCD0048E3D1 /* mcsync.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mcsync.c; path = ../../source/myport/posix/mycore/utils/mcsync.c; sourceTree = "<group>"; };
|
||||||
0EF68DCC1DBF6CF000B0DEA4 /* color_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = color_parser.c; sourceTree = "<group>"; };
|
0EF68DCC1DBF6CF000B0DEA4 /* color_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = color_parser.c; sourceTree = "<group>"; };
|
||||||
0EF68DCD1DBF6CF000B0DEA4 /* color_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = color_parser.h; sourceTree = "<group>"; };
|
0EF68DCD1DBF6CF000B0DEA4 /* color_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = color_parser.h; sourceTree = "<group>"; };
|
||||||
0EF808A11D9FF3BC001AF6EF /* sheet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sheet.c; sourceTree = "<group>"; };
|
0EF808A11D9FF3BC001AF6EF /* sheet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sheet.c; sourceTree = "<group>"; };
|
||||||
@ -544,6 +551,7 @@
|
|||||||
0E750EEA1D9AF22500337E9B /* mycss */,
|
0E750EEA1D9AF22500337E9B /* mycss */,
|
||||||
0E750EE91D9AF21C00337E9B /* myhtml */,
|
0E750EE91D9AF21C00337E9B /* myhtml */,
|
||||||
0E10FECA1E5F71CF00242B61 /* myurl */,
|
0E10FECA1E5F71CF00242B61 /* myurl */,
|
||||||
|
0EF5D1A01E6DDD8E0048E3D1 /* posix */,
|
||||||
0E750EE01D9AF1D500337E9B /* Products */,
|
0E750EE01D9AF1D500337E9B /* Products */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -666,34 +674,34 @@
|
|||||||
0E750EEB1D9AF22E00337E9B /* myfont */ = {
|
0E750EEB1D9AF22E00337E9B /* myfont */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
0E750EFC1D9AF26300337E9B /* cmap.c */,
|
|
||||||
0E750EFD1D9AF26300337E9B /* cmap.h */,
|
|
||||||
0E750EFE1D9AF26300337E9B /* glyf.c */,
|
|
||||||
0E750EFF1D9AF26300337E9B /* glyf.h */,
|
|
||||||
0E750F001D9AF26300337E9B /* head.c */,
|
|
||||||
0E750F011D9AF26300337E9B /* head.h */,
|
|
||||||
0E750F021D9AF26300337E9B /* hhea.c */,
|
|
||||||
0E750F031D9AF26300337E9B /* hhea.h */,
|
|
||||||
0E750F041D9AF26300337E9B /* hmtx.c */,
|
|
||||||
0E750F051D9AF26300337E9B /* hmtx.h */,
|
|
||||||
0E750F061D9AF26300337E9B /* loca.c */,
|
|
||||||
0E750F071D9AF26300337E9B /* loca.h */,
|
|
||||||
0E750F081D9AF26300337E9B /* maxp.c */,
|
|
||||||
0E750F091D9AF26300337E9B /* maxp.h */,
|
|
||||||
0E750F0A1D9AF26300337E9B /* myfont.c */,
|
|
||||||
0E750F0B1D9AF26300337E9B /* myfont.h */,
|
0E750F0B1D9AF26300337E9B /* myfont.h */,
|
||||||
0E750F0C1D9AF26300337E9B /* myosi.c */,
|
0E750F0A1D9AF26300337E9B /* myfont.c */,
|
||||||
|
0E750EFD1D9AF26300337E9B /* cmap.h */,
|
||||||
|
0E750EFC1D9AF26300337E9B /* cmap.c */,
|
||||||
|
0E750EFF1D9AF26300337E9B /* glyf.h */,
|
||||||
|
0E750EFE1D9AF26300337E9B /* glyf.c */,
|
||||||
|
0E750F011D9AF26300337E9B /* head.h */,
|
||||||
|
0E750F001D9AF26300337E9B /* head.c */,
|
||||||
|
0E750F031D9AF26300337E9B /* hhea.h */,
|
||||||
|
0E750F021D9AF26300337E9B /* hhea.c */,
|
||||||
|
0E750F051D9AF26300337E9B /* hmtx.h */,
|
||||||
|
0E750F041D9AF26300337E9B /* hmtx.c */,
|
||||||
|
0E750F071D9AF26300337E9B /* loca.h */,
|
||||||
|
0E750F061D9AF26300337E9B /* loca.c */,
|
||||||
|
0E750F091D9AF26300337E9B /* maxp.h */,
|
||||||
|
0E750F081D9AF26300337E9B /* maxp.c */,
|
||||||
0E750F0D1D9AF26300337E9B /* myosi.h */,
|
0E750F0D1D9AF26300337E9B /* myosi.h */,
|
||||||
0E750F0E1D9AF26300337E9B /* name.c */,
|
0E750F0C1D9AF26300337E9B /* myosi.c */,
|
||||||
0E750F0F1D9AF26300337E9B /* name.h */,
|
0E750F0F1D9AF26300337E9B /* name.h */,
|
||||||
0E750F101D9AF26300337E9B /* os_2.c */,
|
0E750F0E1D9AF26300337E9B /* name.c */,
|
||||||
0E750F111D9AF26300337E9B /* os_2.h */,
|
0E750F111D9AF26300337E9B /* os_2.h */,
|
||||||
0E750F121D9AF26300337E9B /* pclt.c */,
|
0E750F101D9AF26300337E9B /* os_2.c */,
|
||||||
0E750F131D9AF26300337E9B /* pclt.h */,
|
0E750F131D9AF26300337E9B /* pclt.h */,
|
||||||
0E750F141D9AF26300337E9B /* vhea.c */,
|
0E750F121D9AF26300337E9B /* pclt.c */,
|
||||||
0E750F151D9AF26300337E9B /* vhea.h */,
|
0E750F151D9AF26300337E9B /* vhea.h */,
|
||||||
0E750F161D9AF26300337E9B /* vmtx.c */,
|
0E750F141D9AF26300337E9B /* vhea.c */,
|
||||||
0E750F171D9AF26300337E9B /* vmtx.h */,
|
0E750F171D9AF26300337E9B /* vmtx.h */,
|
||||||
|
0E750F161D9AF26300337E9B /* vmtx.c */,
|
||||||
);
|
);
|
||||||
name = myfont;
|
name = myfont;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -888,14 +896,14 @@
|
|||||||
children = (
|
children = (
|
||||||
0EF5D1501E680D880048E3D1 /* myosi.h */,
|
0EF5D1501E680D880048E3D1 /* myosi.h */,
|
||||||
0EF5D1781E680EA10048E3D1 /* myosi.c */,
|
0EF5D1781E680EA10048E3D1 /* myosi.c */,
|
||||||
0EF5D14F1E680D880048E3D1 /* memory.c */,
|
|
||||||
0EF5D14E1E680D880048E3D1 /* incoming.h */,
|
0EF5D14E1E680D880048E3D1 /* incoming.h */,
|
||||||
0EF5D14D1E680D880048E3D1 /* incoming.c */,
|
0EF5D14D1E680D880048E3D1 /* incoming.c */,
|
||||||
0EF5D1521E680D880048E3D1 /* mystring.h */,
|
0EF5D1521E680D880048E3D1 /* mystring.h */,
|
||||||
0EF5D1511E680D880048E3D1 /* mystring.c */,
|
0EF5D1511E680D880048E3D1 /* mystring.c */,
|
||||||
0EF5D1531E680D880048E3D1 /* perf.c */,
|
0EF5D1551E680D880048E3D1 /* mythread.h */,
|
||||||
0EF5D1551E680D880048E3D1 /* thread.h */,
|
0EF5D1541E680D880048E3D1 /* mythread.c */,
|
||||||
0EF5D1541E680D880048E3D1 /* thread.c */,
|
0EF5D19D1E6AE8BF0048E3D1 /* thread_queue.h */,
|
||||||
|
0EF5D19C1E6AE8BF0048E3D1 /* thread_queue.c */,
|
||||||
0EF5D1571E680D880048E3D1 /* utils.h */,
|
0EF5D1571E680D880048E3D1 /* utils.h */,
|
||||||
0EF5D1561E680D880048E3D1 /* utils.c */,
|
0EF5D1561E680D880048E3D1 /* utils.c */,
|
||||||
0EF5D15E1E680D8D0048E3D1 /* utils */,
|
0EF5D15E1E680D8D0048E3D1 /* utils */,
|
||||||
@ -942,6 +950,33 @@
|
|||||||
name = utils;
|
name = utils;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
0EF5D1A01E6DDD8E0048E3D1 /* posix */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
0EF5D1A11E6DDDA50048E3D1 /* mycore */,
|
||||||
|
);
|
||||||
|
name = posix;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
0EF5D1A11E6DDDA50048E3D1 /* mycore */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
0EF5D1A31E6DDDC20048E3D1 /* thread.c */,
|
||||||
|
0EF5D1A41E6DDDC20048E3D1 /* io.c */,
|
||||||
|
0EF5D1A51E6DDDC20048E3D1 /* memory.c */,
|
||||||
|
0EF5D1A21E6DDDAF0048E3D1 /* utils */,
|
||||||
|
);
|
||||||
|
name = mycore;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
0EF5D1A21E6DDDAF0048E3D1 /* utils */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
0EF5D1AB1E6DDDCD0048E3D1 /* mcsync.c */,
|
||||||
|
);
|
||||||
|
name = utils;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
@ -1001,6 +1036,7 @@
|
|||||||
files = (
|
files = (
|
||||||
0EF5D1771E680DA50048E3D1 /* mhash.c in Sources */,
|
0EF5D1771E680DA50048E3D1 /* mhash.c in Sources */,
|
||||||
0EA033771DB6AFBA009CB2B9 /* raw.c in Sources */,
|
0EA033771DB6AFBA009CB2B9 /* raw.c in Sources */,
|
||||||
|
0EF5D1AC1E6DDDCD0048E3D1 /* mcsync.c in Sources */,
|
||||||
0EF2D5E91E01DFD5000570B6 /* tree_node.c in Sources */,
|
0EF2D5E91E01DFD5000570B6 /* tree_node.c in Sources */,
|
||||||
0E750FF71D9AF27F00337E9B /* tag.c in Sources */,
|
0E750FF71D9AF27F00337E9B /* tag.c in Sources */,
|
||||||
0E750F1C1D9AF26300337E9B /* hmtx.c in Sources */,
|
0E750F1C1D9AF26300337E9B /* hmtx.c in Sources */,
|
||||||
@ -1009,6 +1045,7 @@
|
|||||||
0E0239851D9FEAB90084A81A /* node.c in Sources */,
|
0E0239851D9FEAB90084A81A /* node.c in Sources */,
|
||||||
0EF5D1741E680DA50048E3D1 /* mcsimple.c in Sources */,
|
0EF5D1741E680DA50048E3D1 /* mcsimple.c in Sources */,
|
||||||
0E750F201D9AF26300337E9B /* myosi.c in Sources */,
|
0E750F201D9AF26300337E9B /* myosi.c in Sources */,
|
||||||
|
0EF5D1A91E6DDDC20048E3D1 /* memory.c in Sources */,
|
||||||
0E750F181D9AF26300337E9B /* cmap.c in Sources */,
|
0E750F181D9AF26300337E9B /* cmap.c in Sources */,
|
||||||
0E750F911D9AF27200337E9B /* parser.c in Sources */,
|
0E750F911D9AF27200337E9B /* parser.c in Sources */,
|
||||||
0E750F931D9AF27200337E9B /* function_parser.c in Sources */,
|
0E750F931D9AF27200337E9B /* function_parser.c in Sources */,
|
||||||
@ -1018,7 +1055,7 @@
|
|||||||
0E750F891D9AF27200337E9B /* state.c in Sources */,
|
0E750F891D9AF27200337E9B /* state.c in Sources */,
|
||||||
0E10FEE91E5F720200242B61 /* url.c in Sources */,
|
0E10FEE91E5F720200242B61 /* url.c in Sources */,
|
||||||
0E750F1A1D9AF26300337E9B /* head.c in Sources */,
|
0E750F1A1D9AF26300337E9B /* head.c in Sources */,
|
||||||
0EF5D15C1E680D880048E3D1 /* thread.c in Sources */,
|
0EF5D15C1E680D880048E3D1 /* mythread.c in Sources */,
|
||||||
0E750F1B1D9AF26300337E9B /* hhea.c in Sources */,
|
0E750F1B1D9AF26300337E9B /* hhea.c in Sources */,
|
||||||
0E0C91991DB107E7007A0501 /* property.c in Sources */,
|
0E0C91991DB107E7007A0501 /* property.c in Sources */,
|
||||||
0E750EFB1D9AF25300337E9B /* type.c in Sources */,
|
0E750EFB1D9AF25300337E9B /* type.c in Sources */,
|
||||||
@ -1027,6 +1064,7 @@
|
|||||||
0E750F8B1D9AF27200337E9B /* mystring.c in Sources */,
|
0E750F8B1D9AF27200337E9B /* mystring.c in Sources */,
|
||||||
0EF5D1761E680DA50048E3D1 /* mctree.c in Sources */,
|
0EF5D1761E680DA50048E3D1 /* mctree.c in Sources */,
|
||||||
0EF5D1581E680D880048E3D1 /* incoming.c in Sources */,
|
0EF5D1581E680D880048E3D1 /* incoming.c in Sources */,
|
||||||
|
0EF5D1A81E6DDDC20048E3D1 /* io.c in Sources */,
|
||||||
0E750F231D9AF26300337E9B /* pclt.c in Sources */,
|
0E750F231D9AF26300337E9B /* pclt.c in Sources */,
|
||||||
0E750F8C1D9AF27200337E9B /* init.c in Sources */,
|
0E750F8C1D9AF27200337E9B /* init.c in Sources */,
|
||||||
0E10FEE11E5F720200242B61 /* host.c in Sources */,
|
0E10FEE11E5F720200242B61 /* host.c in Sources */,
|
||||||
@ -1054,7 +1092,6 @@
|
|||||||
0E750FF61D9AF27F00337E9B /* tag_init.c in Sources */,
|
0E750FF61D9AF27F00337E9B /* tag_init.c in Sources */,
|
||||||
0E750F8E1D9AF27200337E9B /* state.c in Sources */,
|
0E750F8E1D9AF27200337E9B /* state.c in Sources */,
|
||||||
0EF808A31D9FF3BC001AF6EF /* sheet.c in Sources */,
|
0EF808A31D9FF3BC001AF6EF /* sheet.c in Sources */,
|
||||||
0EF5D1591E680D880048E3D1 /* memory.c in Sources */,
|
|
||||||
0E0C918C1DAECB56007A0501 /* serialization.c in Sources */,
|
0E0C918C1DAECB56007A0501 /* serialization.c in Sources */,
|
||||||
0E750FFE1D9AF27F00337E9B /* tree.c in Sources */,
|
0E750FFE1D9AF27F00337E9B /* tree.c in Sources */,
|
||||||
0E750FEE1D9AF27F00337E9B /* mynamespace.c in Sources */,
|
0E750FEE1D9AF27F00337E9B /* mynamespace.c in Sources */,
|
||||||
@ -1063,6 +1100,7 @@
|
|||||||
0E750F801D9AF27200337E9B /* an_plus_b.c in Sources */,
|
0E750F801D9AF27200337E9B /* an_plus_b.c in Sources */,
|
||||||
0E750F9B1D9AF27200337E9B /* tokenizer_end.c in Sources */,
|
0E750F9B1D9AF27200337E9B /* tokenizer_end.c in Sources */,
|
||||||
0E750F851D9AF27200337E9B /* parser.c in Sources */,
|
0E750F851D9AF27200337E9B /* parser.c in Sources */,
|
||||||
|
0EF5D1A71E6DDDC20048E3D1 /* thread.c in Sources */,
|
||||||
0E750F871D9AF27200337E9B /* entry.c in Sources */,
|
0E750F871D9AF27200337E9B /* entry.c in Sources */,
|
||||||
0E818EF61DAE6F8F005B0C77 /* serialization.c in Sources */,
|
0E818EF61DAE6F8F005B0C77 /* serialization.c in Sources */,
|
||||||
0E0239811D9FE8EC0084A81A /* type.c in Sources */,
|
0E0239811D9FE8EC0084A81A /* type.c in Sources */,
|
||||||
@ -1117,9 +1155,9 @@
|
|||||||
0EF5D1801E6819E80048E3D1 /* encoding.c in Sources */,
|
0EF5D1801E6819E80048E3D1 /* encoding.c in Sources */,
|
||||||
0E750FE81D9AF27F00337E9B /* charef.c in Sources */,
|
0E750FE81D9AF27F00337E9B /* charef.c in Sources */,
|
||||||
0EE852811DC94891003BB21C /* parser_background.c in Sources */,
|
0EE852811DC94891003BB21C /* parser_background.c in Sources */,
|
||||||
0EF5D15B1E680D880048E3D1 /* perf.c in Sources */,
|
|
||||||
0E750EE31D9AF1D500337E9B /* main.c in Sources */,
|
0E750EE31D9AF1D500337E9B /* main.c in Sources */,
|
||||||
0E750F941D9AF27200337E9B /* init.c in Sources */,
|
0E750F941D9AF27200337E9B /* init.c in Sources */,
|
||||||
|
0EF5D19E1E6AE8BF0048E3D1 /* thread_queue.c in Sources */,
|
||||||
0E750F1E1D9AF26300337E9B /* maxp.c in Sources */,
|
0E750F1E1D9AF26300337E9B /* maxp.c in Sources */,
|
||||||
0E750F8A1D9AF27200337E9B /* mycss.c in Sources */,
|
0E750F8A1D9AF27200337E9B /* mycss.c in Sources */,
|
||||||
0E10FEE21E5F720200242B61 /* myosi.c in Sources */,
|
0E10FEE21E5F720200242B61 /* myosi.c in Sources */,
|
||||||
@ -1187,8 +1225,8 @@
|
|||||||
HEADER_SEARCH_PATHS = ../../source;
|
HEADER_SEARCH_PATHS = ../../source;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
OTHER_CFLAGS = (
|
OTHER_CFLAGS = (
|
||||||
"-DMyHTML_WITH_PERF",
|
"-DMyCORE_WITH_PERF",
|
||||||
"-DMyHTML_FORCE_RDTSC",
|
"-DMyCORE_FORCE_RDTSC",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
};
|
};
|
||||||
|
Binary file not shown.
@ -2,4 +2,22 @@
|
|||||||
<Bucket
|
<Bucket
|
||||||
type = "1"
|
type = "1"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
|
<Breakpoints>
|
||||||
|
<BreakpointProxy
|
||||||
|
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||||
|
<BreakpointContent
|
||||||
|
shouldBeEnabled = "Yes"
|
||||||
|
ignoreCount = "0"
|
||||||
|
continueAfterRunningActions = "No"
|
||||||
|
filePath = "../../source/myfont/glyf.c"
|
||||||
|
timestampString = "511106642.54925"
|
||||||
|
startingColumnNumber = "9223372036854775807"
|
||||||
|
endingColumnNumber = "9223372036854775807"
|
||||||
|
startingLineNumber = "71"
|
||||||
|
endingLineNumber = "71"
|
||||||
|
landmarkName = "myfont_glyf_load_data()"
|
||||||
|
landmarkType = "9">
|
||||||
|
</BreakpointContent>
|
||||||
|
</BreakpointProxy>
|
||||||
|
</Breakpoints>
|
||||||
</Bucket>
|
</Bucket>
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ void usage(const char *path, float font_size, size_t codepoint)
|
|||||||
int main(int argc, const char * argv[])
|
int main(int argc, const char * argv[])
|
||||||
{
|
{
|
||||||
/* set and get params */
|
/* set and get params */
|
||||||
const char *path = "../third_party/font/Arkhip.ttf";
|
const char *path = "third_party/font/Arkhip.ttf";
|
||||||
float font_size = 200.0f;
|
float font_size = 200.0f;
|
||||||
|
|
||||||
size_t codepoint;
|
size_t codepoint;
|
||||||
@ -67,7 +67,8 @@ int main(int argc, const char * argv[])
|
|||||||
myfont_font_t *mf = myfont_create();
|
myfont_font_t *mf = myfont_create();
|
||||||
myfont_init(mf);
|
myfont_init(mf);
|
||||||
|
|
||||||
mystatus_t mf_status = myfont_load(mf, path);
|
uint8_t *font_data;
|
||||||
|
mystatus_t mf_status = myfont_load_from_file(mf, path, &font_data, NULL);
|
||||||
|
|
||||||
if(mf_status) {
|
if(mf_status) {
|
||||||
myfont_destroy(mf, true);
|
myfont_destroy(mf, true);
|
||||||
@ -135,6 +136,7 @@ int main(int argc, const char * argv[])
|
|||||||
|
|
||||||
printf("</svg>\n");
|
printf("</svg>\n");
|
||||||
|
|
||||||
|
myfont_destroy_font_data(mf, font_data);
|
||||||
myfont_destroy(mf, true);
|
myfont_destroy(mf, true);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -55,8 +55,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Debug */
|
/* Debug */
|
||||||
#define MyCORE_DEBUG(format, ...)
|
#define MyCORE_DEBUG(...) do {} while(0)
|
||||||
#define MyCORE_DEBUG_ERROR(format, ...)
|
#define MyCORE_DEBUG_ERROR(...) do {} while(0)
|
||||||
|
|
||||||
#define MyCORE_FAILED(_status_) ((_status_) != MyCORE_STATUS_OK)
|
#define MyCORE_FAILED(_status_) ((_status_) != MyCORE_STATUS_OK)
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ struct mythread {
|
|||||||
#else
|
#else
|
||||||
/* functions */
|
/* functions */
|
||||||
typedef void (*mythread_callback_before_entry_join_f)(mythread_t* mythread, mythread_entry_t* entry, void* ctx);
|
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_process_f)(void* arg);
|
||||||
typedef void (*mythread_work_f)(mythread_id_t thread_id, 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_stream(void *arg);
|
||||||
void mythread_function_queue_batch(void *arg);
|
void * mythread_function_queue_batch(void *arg);
|
||||||
void mythread_function(void *arg);
|
void * mythread_function(void *arg);
|
||||||
|
|
||||||
enum mythread_thread_opt {
|
enum mythread_thread_opt {
|
||||||
MyTHREAD_OPT_UNDEF = 0x00,
|
MyTHREAD_OPT_UNDEF = 0x00,
|
||||||
@ -128,7 +128,7 @@ mystatus_t mythread_entry_status(mythread_entry_t* entry);
|
|||||||
mythread_t * mythread_entry_mythread(mythread_entry_t* entry);
|
mythread_t * mythread_entry_mythread(mythread_entry_t* entry);
|
||||||
|
|
||||||
/* API for ports */
|
/* API for ports */
|
||||||
void * mythread_thread_create(mythread_t *mythread, void* process_func, void* ctx);
|
void * mythread_thread_create(mythread_t *mythread, mythread_process_f process_func, void* ctx);
|
||||||
mystatus_t mythread_thread_join(mythread_t *mythread, void* thread);
|
mystatus_t mythread_thread_join(mythread_t *mythread, void* thread);
|
||||||
mystatus_t mythread_thread_cancel(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);
|
mystatus_t mythread_thread_destroy(mythread_t *mythread, void* thread);
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MyCSS_DEBUG_MESSAGE(format, ...)
|
|
||||||
#define MyCORE_DEBUG_ERROR(format, ...)
|
|
||||||
|
|
||||||
#include <mycss/myosi.h>
|
#include <mycss/myosi.h>
|
||||||
#include <mycss/entry.h>
|
#include <mycss/entry.h>
|
||||||
#include <mycss/tokenizer.h>
|
#include <mycss/tokenizer.h>
|
||||||
|
@ -115,12 +115,13 @@ struct mycss_values_type_list {
|
|||||||
size_t entries_length;
|
size_t entries_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mycss_values_type_length_percentage_entry {
|
union mycss_values_type_length_percentage_union {
|
||||||
union {
|
mycss_values_percentage_t* percentage;
|
||||||
mycss_values_percentage_t* percentage;
|
mycss_values_length_t* length;
|
||||||
mycss_values_length_t* length;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
struct mycss_values_type_length_percentage_entry {
|
||||||
|
union mycss_values_type_length_percentage_union value;
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ struct mycss_values_number {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
};
|
};
|
||||||
@ -137,9 +138,10 @@ struct mycss_values_length {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
|
|
||||||
mycss_units_type_t type;
|
mycss_units_type_t type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -147,7 +149,7 @@ struct mycss_values_percentage {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
};
|
};
|
||||||
@ -156,7 +158,7 @@ struct mycss_values_angle {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
mycss_units_type_t type;
|
mycss_units_type_t type;
|
||||||
@ -166,7 +168,7 @@ struct mycss_values_resolution {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
mycss_units_type_t type;
|
mycss_units_type_t type;
|
||||||
@ -211,7 +213,7 @@ struct mycss_values_color_alpha_value {
|
|||||||
union {
|
union {
|
||||||
mycss_values_number_t number;
|
mycss_values_number_t number;
|
||||||
mycss_values_percentage_t percentage;
|
mycss_values_percentage_t percentage;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_type_value_t type_value;
|
mycss_values_color_type_value_t type_value;
|
||||||
};
|
};
|
||||||
@ -220,7 +222,7 @@ struct mycss_values_color_hue_value {
|
|||||||
union {
|
union {
|
||||||
mycss_values_number_t number;
|
mycss_values_number_t number;
|
||||||
mycss_values_angle_t angle;
|
mycss_values_angle_t angle;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_type_value_t type_value;
|
mycss_values_color_type_value_t type_value;
|
||||||
};
|
};
|
||||||
@ -267,7 +269,7 @@ struct mycss_values_color {
|
|||||||
mycss_values_color_hwb_t hwb;
|
mycss_values_color_hwb_t hwb;
|
||||||
mycss_values_color_gray_t gray;
|
mycss_values_color_gray_t gray;
|
||||||
mycss_values_color_id_t name_id;
|
mycss_values_color_id_t name_id;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_type_t type;
|
mycss_values_color_type_t type;
|
||||||
mycss_values_color_type_value_t type_value;
|
mycss_values_color_type_value_t type_value;
|
||||||
@ -308,7 +310,7 @@ struct mycss_values_image {
|
|||||||
mycss_values_image_image_set_t* ii_set;
|
mycss_values_image_image_set_t* ii_set;
|
||||||
mycss_values_element_t* element;
|
mycss_values_element_t* element;
|
||||||
mycss_values_cross_fade_t* cross_fade;
|
mycss_values_cross_fade_t* cross_fade;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_property_value_t type;
|
mycss_property_value_t type;
|
||||||
};
|
};
|
||||||
@ -378,7 +380,7 @@ struct mycss_values_gradient_linear {
|
|||||||
union {
|
union {
|
||||||
mycss_values_angle_t angle;
|
mycss_values_angle_t angle;
|
||||||
mycss_values_gradient_side_or_corner_t side_or_corner;
|
mycss_values_gradient_side_or_corner_t side_or_corner;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_stop_list_t color_stop_list;
|
mycss_values_color_stop_list_t color_stop_list;
|
||||||
};
|
};
|
||||||
@ -400,7 +402,7 @@ struct mycss_values_font_family_entry {
|
|||||||
union {
|
union {
|
||||||
mycore_string_t str;
|
mycore_string_t str;
|
||||||
mycss_property_font_family_t prop_type;
|
mycss_property_font_family_t prop_type;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_font_family_type_t type;
|
mycss_values_font_family_type_t type;
|
||||||
};
|
};
|
||||||
|
@ -208,7 +208,7 @@ typedef myfont_table_cmap_t;
|
|||||||
|
|
||||||
#include <myfont/myfont.h>
|
#include <myfont/myfont.h>
|
||||||
|
|
||||||
mystatus_t myfont_load_table_cmap(myfont_font_t *mf);
|
mystatus_t myfont_load_table_cmap(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long char_code, mystatus_t* status);
|
uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long char_code, mystatus_t* status);
|
||||||
|
|
||||||
|
@ -99,13 +99,13 @@ typedef myfont_table_glyf_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_glyf(struct myfont_font *mf);
|
mystatus_t myfont_load_table_glyf(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint16_t glyph_index);
|
mystatus_t myfont_glyf_load(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* data, size_t data_size, uint16_t glyph_index);
|
||||||
mystatus_t myfont_glyf_load_data(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint32_t offset);
|
mystatus_t myfont_glyf_load_data(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* data, size_t data_size, uint32_t offset);
|
||||||
mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset);
|
mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset);
|
||||||
mystatus_t myfont_glyf_load_simple_flags(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset);
|
mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset);
|
||||||
mystatus_t myfont_glyf_load_simple_coordinates(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset);
|
mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -53,9 +53,9 @@ typedef myfont_table_head_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_head(struct myfont_font *mf);
|
mystatus_t myfont_load_table_head(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
float myfont_head_yMax_pixel(struct myfont_font *mf, float font_size);
|
float myfont_head_yMax_pixel(myfont_font_t *mf, float font_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -54,7 +54,7 @@ typedef myfont_table_hhea_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_hhea(struct myfont_font *mf);
|
mystatus_t myfont_load_table_hhea(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -45,7 +45,7 @@ typedef myfont_table_hmtx_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_hmtx(struct myfont_font *mf);
|
mystatus_t myfont_load_table_hmtx(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -38,9 +38,9 @@ typedef myfont_table_loca_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_loca(struct myfont_font *mf);
|
mystatus_t myfont_load_table_loca(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
uint32_t myfont_loca_get_offset(struct myfont_font *mf, uint16_t glyph_index);
|
uint32_t myfont_loca_get_offset(myfont_font_t *mf, uint16_t glyph_index);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -51,7 +51,7 @@ typedef myfont_table_maxp_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_maxp(struct myfont_font *mf);
|
mystatus_t myfont_load_table_maxp(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -85,10 +85,6 @@ struct myfont_font {
|
|||||||
myfont_table_pclt_t table_pclt;
|
myfont_table_pclt_t table_pclt;
|
||||||
myfont_table_loca_t table_loca;
|
myfont_table_loca_t table_loca;
|
||||||
|
|
||||||
char* file_path;
|
|
||||||
size_t file_size;
|
|
||||||
uint8_t* file_data;
|
|
||||||
|
|
||||||
mchar_async_t* mchar;
|
mchar_async_t* mchar;
|
||||||
size_t mchar_node_id;
|
size_t mchar_node_id;
|
||||||
};
|
};
|
||||||
@ -102,7 +98,9 @@ void * myfont_malloc(myfont_font_t* mf, size_t size);
|
|||||||
void * myfont_calloc(myfont_font_t* mf, size_t count, size_t size);
|
void * myfont_calloc(myfont_font_t* mf, size_t count, size_t size);
|
||||||
void myfont_free(myfont_font_t *mf, void* data);
|
void myfont_free(myfont_font_t *mf, void* data);
|
||||||
|
|
||||||
mystatus_t myfont_load(myfont_font_t *mf, const char *filepath);
|
mystatus_t myfont_load(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
mystatus_t myfont_load_from_file(myfont_font_t* mf, const char* filepath, uint8_t** return_data, size_t* data_size);
|
||||||
|
void * myfont_destroy_font_data(myfont_font_t* mf, uint8_t* return_data);
|
||||||
|
|
||||||
mystatus_t myfont_check_required_tables(myfont_font_t *mf);
|
mystatus_t myfont_check_required_tables(myfont_font_t *mf);
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ typedef myfont_table_name_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_name(struct myfont_font *mf);
|
mystatus_t myfont_load_table_name(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,9 +90,9 @@ typedef myfont_table_os_2_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_os_2(struct myfont_font *mf);
|
mystatus_t myfont_load_table_os_2(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
int8_t myfont_os_2_panose(struct myfont_font *mf, myfont_table_os_2_panose_t id);
|
int8_t myfont_os_2_panose(myfont_font_t* mf, myfont_table_os_2_panose_t id);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -52,7 +52,7 @@ typedef myfont_table_pclt_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_pclt(struct myfont_font *mf);
|
mystatus_t myfont_load_table_pclt(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -54,7 +54,7 @@ typedef myfont_table_vhea_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_vhea(struct myfont_font *mf);
|
mystatus_t myfont_load_table_vhea(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -45,7 +45,7 @@ typedef myfont_table_vmtx_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_vmtx(struct myfont_font *mf);
|
mystatus_t myfont_load_table_vmtx(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -78,7 +78,7 @@ struct myurl_host {
|
|||||||
myurl_host_ipv_t ipv;
|
myurl_host_ipv_t ipv;
|
||||||
myurl_host_opaque_t opaque;
|
myurl_host_opaque_t opaque;
|
||||||
myurl_host_domain_t domain;
|
myurl_host_domain_t domain;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
myurl_host_type_t type;
|
myurl_host_type_t type;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ mystatus_t modest_finder_thread_init(modest_finder_t* finder, modest_finder_thre
|
|||||||
|
|
||||||
/* create threads */
|
/* create threads */
|
||||||
for(size_t i = 0; i < finder_thread->thread->entries_size; i++) {
|
for(size_t i = 0; i < finder_thread->thread->entries_size; i++) {
|
||||||
myhread_entry_create(finder_thread->thread, mythread_function, modest_finder_thread_stream, MyTHREAD_OPT_UNDEF);
|
myhread_entry_create(finder_thread->thread, mythread_function, modest_finder_thread_stream, MyTHREAD_OPT_STOP);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -101,8 +101,9 @@ modest_finder_thread_t * modest_finder_thread_destroy(modest_finder_thread_t* fi
|
|||||||
finder_thread->declaration_obj = mcobject_async_destroy(finder_thread->declaration_obj, true);
|
finder_thread->declaration_obj = mcobject_async_destroy(finder_thread->declaration_obj, true);
|
||||||
|
|
||||||
#ifndef MyCORE_BUILD_WITHOUT_THREADS
|
#ifndef MyCORE_BUILD_WITHOUT_THREADS
|
||||||
if(finder_thread->thread)
|
if(finder_thread->thread) {
|
||||||
finder_thread->thread = mythread_destroy(finder_thread->thread, mythread_callback_quit, NULL, true);
|
finder_thread->thread = mythread_destroy(finder_thread->thread, mythread_callback_quit, NULL, true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(finder_thread->context_list) {
|
if(finder_thread->context_list) {
|
||||||
@ -134,7 +135,7 @@ void modest_finder_thread_collate_node(modest_t* modest, myhtml_tree_node_t* nod
|
|||||||
|
|
||||||
#ifndef MyCORE_BUILD_WITHOUT_THREADS
|
#ifndef MyCORE_BUILD_WITHOUT_THREADS
|
||||||
mystatus_t modest_finder_thread_process(modest_t* modest, modest_finder_thread_t* finder_thread,
|
mystatus_t modest_finder_thread_process(modest_t* modest, modest_finder_thread_t* finder_thread,
|
||||||
myhtml_tree_node_t* scope_node, mycss_selectors_list_t* selector_list)
|
myhtml_tree_node_t* scope_node, mycss_selectors_list_t* selector_list)
|
||||||
{
|
{
|
||||||
finder_thread->base_node = scope_node;
|
finder_thread->base_node = scope_node;
|
||||||
finder_thread->selector_list = selector_list;
|
finder_thread->selector_list = selector_list;
|
||||||
|
@ -55,8 +55,8 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Debug */
|
/* Debug */
|
||||||
#define MyCORE_DEBUG(format, ...)
|
#define MyCORE_DEBUG(...) do {} while(0)
|
||||||
#define MyCORE_DEBUG_ERROR(format, ...)
|
#define MyCORE_DEBUG_ERROR(...) do {} while(0)
|
||||||
|
|
||||||
#define MyCORE_FAILED(_status_) ((_status_) != MyCORE_STATUS_OK)
|
#define MyCORE_FAILED(_status_) ((_status_) != MyCORE_STATUS_OK)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ mystatus_t mythread_stop(mythread_t *mythread)
|
|||||||
|
|
||||||
for (size_t i = 0; i < mythread->entries_length; i++)
|
for (size_t i = 0; i < mythread->entries_length; i++)
|
||||||
{
|
{
|
||||||
while(mythread->entries[i].context.opt != MyTHREAD_OPT_STOP) {
|
while((mythread->entries[i].context.opt & MyTHREAD_OPT_STOP) == 0) {
|
||||||
mythread_nanosleep_sleep(mythread->timespec);
|
mythread_nanosleep_sleep(mythread->timespec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,8 +184,8 @@ mystatus_t mythread_suspend(mythread_t *mythread)
|
|||||||
|
|
||||||
for (size_t i = 0; i < mythread->entries_length; i++)
|
for (size_t i = 0; i < mythread->entries_length; i++)
|
||||||
{
|
{
|
||||||
while(mythread->entries[i].context.opt != MyTHREAD_OPT_STOP &&
|
while((mythread->entries[i].context.opt & MyTHREAD_OPT_STOP) == 0 &&
|
||||||
mythread->entries[i].context.opt != MyTHREAD_OPT_WAIT)
|
(mythread->entries[i].context.opt & MyTHREAD_OPT_WAIT) == 0)
|
||||||
{
|
{
|
||||||
mythread_nanosleep_sleep(mythread->timespec);
|
mythread_nanosleep_sleep(mythread->timespec);
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ mystatus_t mythread_resume(mythread_t *mythread)
|
|||||||
|
|
||||||
for (size_t i = 0; i < mythread->entries_length; i++)
|
for (size_t i = 0; i < mythread->entries_length; i++)
|
||||||
{
|
{
|
||||||
if(mythread->entries[i].context.opt == MyTHREAD_OPT_STOP) {
|
if(mythread->entries[i].context.opt & MyTHREAD_OPT_STOP) {
|
||||||
mythread->entries[i].context.opt = MyTHREAD_OPT_UNDEF;
|
mythread->entries[i].context.opt = MyTHREAD_OPT_UNDEF;
|
||||||
|
|
||||||
if(mythread_mutex_post(mythread, mythread->entries[i].context.mutex))
|
if(mythread_mutex_post(mythread, mythread->entries[i].context.mutex))
|
||||||
@ -272,7 +272,7 @@ mystatus_t mythread_entry_stop(mythread_entry_t* entry)
|
|||||||
|
|
||||||
entry->context.opt = MyTHREAD_OPT_STOP;
|
entry->context.opt = MyTHREAD_OPT_STOP;
|
||||||
|
|
||||||
while(entry->context.opt != MyTHREAD_OPT_STOP) {
|
while((entry->context.opt & MyTHREAD_OPT_STOP) == 0) {
|
||||||
mythread_nanosleep_sleep(entry->context.mythread->timespec);
|
mythread_nanosleep_sleep(entry->context.mythread->timespec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ mystatus_t mythread_entry_suspend(mythread_entry_t* entry)
|
|||||||
|
|
||||||
entry->context.opt = MyTHREAD_OPT_WAIT;
|
entry->context.opt = MyTHREAD_OPT_WAIT;
|
||||||
|
|
||||||
while(entry->context.opt != MyTHREAD_OPT_STOP && entry->context.opt != MyTHREAD_OPT_WAIT) {
|
while((entry->context.opt & MyTHREAD_OPT_STOP) == 0 && (entry->context.opt & MyTHREAD_OPT_WAIT) == 0) {
|
||||||
mythread_nanosleep_sleep(entry->context.mythread->timespec);
|
mythread_nanosleep_sleep(entry->context.mythread->timespec);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ mystatus_t mythread_entry_resume(mythread_entry_t* entry)
|
|||||||
if(entry->context.opt & MyTHREAD_OPT_WAIT) {
|
if(entry->context.opt & MyTHREAD_OPT_WAIT) {
|
||||||
entry->context.opt = MyTHREAD_OPT_UNDEF;
|
entry->context.opt = MyTHREAD_OPT_UNDEF;
|
||||||
}
|
}
|
||||||
else if(entry->context.opt == MyTHREAD_OPT_STOP) {
|
else if(entry->context.opt & MyTHREAD_OPT_STOP) {
|
||||||
entry->context.opt = MyTHREAD_OPT_UNDEF;
|
entry->context.opt = MyTHREAD_OPT_UNDEF;
|
||||||
|
|
||||||
if(mythread_mutex_post(entry->context.mythread, entry->context.mutex))
|
if(mythread_mutex_post(entry->context.mythread, entry->context.mutex))
|
||||||
@ -323,7 +323,7 @@ mythread_t * mythread_entry_mythread(mythread_entry_t* entry)
|
|||||||
/* Callbacks */
|
/* Callbacks */
|
||||||
void mythread_callback_quit(mythread_t* mythread, mythread_entry_t* entry, void* ctx)
|
void mythread_callback_quit(mythread_t* mythread, mythread_entry_t* entry, void* ctx)
|
||||||
{
|
{
|
||||||
while(entry->context.opt != MyTHREAD_OPT_QUIT)
|
while((entry->context.opt & MyTHREAD_OPT_QUIT) == 0)
|
||||||
mythread_nanosleep_sleep(mythread->timespec);
|
mythread_nanosleep_sleep(mythread->timespec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ struct mythread {
|
|||||||
#else
|
#else
|
||||||
/* functions */
|
/* functions */
|
||||||
typedef void (*mythread_callback_before_entry_join_f)(mythread_t* mythread, mythread_entry_t* entry, void* ctx);
|
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_process_f)(void* arg);
|
||||||
typedef void (*mythread_work_f)(mythread_id_t thread_id, 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_stream(void *arg);
|
||||||
void mythread_function_queue_batch(void *arg);
|
void * mythread_function_queue_batch(void *arg);
|
||||||
void mythread_function(void *arg);
|
void * mythread_function(void *arg);
|
||||||
|
|
||||||
enum mythread_thread_opt {
|
enum mythread_thread_opt {
|
||||||
MyTHREAD_OPT_UNDEF = 0x00,
|
MyTHREAD_OPT_UNDEF = 0x00,
|
||||||
@ -128,7 +128,7 @@ mystatus_t mythread_entry_status(mythread_entry_t* entry);
|
|||||||
mythread_t * mythread_entry_mythread(mythread_entry_t* entry);
|
mythread_t * mythread_entry_mythread(mythread_entry_t* entry);
|
||||||
|
|
||||||
/* API for ports */
|
/* API for ports */
|
||||||
void * mythread_thread_create(mythread_t *mythread, void* process_func, void* ctx);
|
void * mythread_thread_create(mythread_t *mythread, mythread_process_f process_func, void* ctx);
|
||||||
mystatus_t mythread_thread_join(mythread_t *mythread, void* thread);
|
mystatus_t mythread_thread_join(mythread_t *mythread, void* thread);
|
||||||
mystatus_t mythread_thread_cancel(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);
|
mystatus_t mythread_thread_destroy(mythread_t *mythread, void* thread);
|
||||||
|
@ -502,7 +502,7 @@ bool mythread_function_see_opt(mythread_context_t *ctx, volatile mythread_thread
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mythread_function_queue_batch(void *arg)
|
void * mythread_function_queue_batch(void *arg)
|
||||||
{
|
{
|
||||||
mythread_context_t *ctx = (mythread_context_t*)arg;
|
mythread_context_t *ctx = (mythread_context_t*)arg;
|
||||||
mythread_t *mythread = ctx->mythread;
|
mythread_t *mythread = ctx->mythread;
|
||||||
@ -553,9 +553,11 @@ void mythread_function_queue_batch(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (1);
|
while (1);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mythread_function_queue_stream(void *arg)
|
void * mythread_function_queue_stream(void *arg)
|
||||||
{
|
{
|
||||||
mythread_context_t *ctx = (mythread_context_t*)arg;
|
mythread_context_t *ctx = (mythread_context_t*)arg;
|
||||||
mythread_t * mythread = ctx->mythread;
|
mythread_t * mythread = ctx->mythread;
|
||||||
@ -607,9 +609,11 @@ void mythread_function_queue_stream(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(1);
|
while(1);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mythread_function(void *arg)
|
void * mythread_function(void *arg)
|
||||||
{
|
{
|
||||||
mythread_context_t *ctx = (mythread_context_t*)arg;
|
mythread_context_t *ctx = (mythread_context_t*)arg;
|
||||||
mythread_t * mythread = ctx->mythread;
|
mythread_t * mythread = ctx->mythread;
|
||||||
@ -619,7 +623,7 @@ void mythread_function(void *arg)
|
|||||||
do {
|
do {
|
||||||
if(mythread->opt & MyTHREAD_OPT_STOP || ctx->opt & MyTHREAD_OPT_STOP)
|
if(mythread->opt & MyTHREAD_OPT_STOP || ctx->opt & MyTHREAD_OPT_STOP)
|
||||||
{
|
{
|
||||||
ctx->opt |= MyTHREAD_OPT_DONE;
|
ctx->opt = MyTHREAD_OPT_DONE|MyTHREAD_OPT_STOP;
|
||||||
mythread_mutex_wait(mythread, ctx->mutex);
|
mythread_mutex_wait(mythread, ctx->mutex);
|
||||||
|
|
||||||
if(mythread->opt & MyTHREAD_OPT_QUIT || ctx->opt & MyTHREAD_OPT_QUIT)
|
if(mythread->opt & MyTHREAD_OPT_QUIT || ctx->opt & MyTHREAD_OPT_QUIT)
|
||||||
@ -627,7 +631,7 @@ void mythread_function(void *arg)
|
|||||||
mythread_mutex_close(mythread, ctx->mutex);
|
mythread_mutex_close(mythread, ctx->mutex);
|
||||||
mythread_nanosleep_destroy(ctx->timespec);
|
mythread_nanosleep_destroy(ctx->timespec);
|
||||||
|
|
||||||
ctx->opt = MyTHREAD_OPT_QUIT;
|
ctx->opt = MyTHREAD_OPT_DONE|MyTHREAD_OPT_QUIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,13 +642,15 @@ void mythread_function(void *arg)
|
|||||||
mythread_mutex_close(mythread, ctx->mutex);
|
mythread_mutex_close(mythread, ctx->mutex);
|
||||||
mythread_nanosleep_destroy(ctx->timespec);
|
mythread_nanosleep_destroy(ctx->timespec);
|
||||||
|
|
||||||
ctx->opt = MyTHREAD_OPT_QUIT;
|
ctx->opt = MyTHREAD_OPT_DONE|MyTHREAD_OPT_QUIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->func(ctx->id, ctx);
|
ctx->func(ctx->id, ctx);
|
||||||
}
|
}
|
||||||
while(1);
|
while(1);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -256,8 +256,12 @@ mcobject_async_chunk_t * mcobject_async_chunk_malloc_without_lock(mcobject_async
|
|||||||
|
|
||||||
mcobject_async_chunk_t * mcobject_async_chunk_malloc(mcobject_async_t *mcobj_async, size_t length, mcobject_async_status_t *status)
|
mcobject_async_chunk_t * mcobject_async_chunk_malloc(mcobject_async_t *mcobj_async, size_t length, mcobject_async_status_t *status)
|
||||||
{
|
{
|
||||||
if(mcsync_lock(mcobj_async->mcsync))
|
if(mcsync_lock(mcobj_async->mcsync)) {
|
||||||
|
if(status)
|
||||||
|
*status = MCOBJECT_ASYNC_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
mcobject_async_chunk_t* chunk = mcobject_async_chunk_malloc_without_lock(mcobj_async, length, status);
|
mcobject_async_chunk_t* chunk = mcobject_async_chunk_malloc_without_lock(mcobj_async, length, status);
|
||||||
mcsync_unlock(mcobj_async->mcsync);
|
mcsync_unlock(mcobj_async->mcsync);
|
||||||
|
@ -41,7 +41,7 @@ size_t mycore_utils_mhash_hash(const char* key, size_t key_size, size_t table_si
|
|||||||
mycore_utils_mhash_t * mycore_utils_mhash_create(void)
|
mycore_utils_mhash_t * mycore_utils_mhash_create(void)
|
||||||
{
|
{
|
||||||
return mycore_calloc(1, sizeof(mycore_utils_mhash_t));
|
return mycore_calloc(1, sizeof(mycore_utils_mhash_t));
|
||||||
};
|
}
|
||||||
|
|
||||||
mystatus_t mycore_utils_mhash_init(mycore_utils_mhash_t* mhash, size_t table_size, size_t max_depth)
|
mystatus_t mycore_utils_mhash_init(mycore_utils_mhash_t* mhash, size_t table_size, size_t max_depth)
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ mystatus_t mycore_utils_mhash_init(mycore_utils_mhash_t* mhash, size_t table_siz
|
|||||||
mhash->table_size = table_size;
|
mhash->table_size = table_size;
|
||||||
|
|
||||||
return MyCORE_STATUS_OK;
|
return MyCORE_STATUS_OK;
|
||||||
};
|
}
|
||||||
|
|
||||||
void mycore_utils_mhash_clean(mycore_utils_mhash_t* mhash)
|
void mycore_utils_mhash_clean(mycore_utils_mhash_t* mhash)
|
||||||
{
|
{
|
||||||
|
@ -159,11 +159,11 @@ bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool
|
|||||||
anb_entry->is_broken = true;
|
anb_entry->is_broken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_hyphen_n_hyphen_asterisk_end");
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_hyphen_n_hyphen_asterisk_end");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(mycore_strncasecmp(str.data, "-n", 2) == 0) {
|
else if(mycore_strncasecmp(str.data, "-n", 2) == 0) {
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_hyphen_n_end")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_hyphen_n_end");
|
||||||
|
|
||||||
anb_entry->a = -1;
|
anb_entry->a = -1;
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool
|
|||||||
anb_entry->is_broken = true;
|
anb_entry->is_broken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_n");
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_n");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(mycore_strncasecmp(str.data, "n", 1) == 0)
|
else if(mycore_strncasecmp(str.data, "n", 1) == 0)
|
||||||
@ -219,21 +219,21 @@ bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool
|
|||||||
anb_entry->is_broken = true;
|
anb_entry->is_broken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_n");
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_n");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(mycore_strcasecmp(str.data, "even") == 0) {
|
else if(mycore_strcasecmp(str.data, "even") == 0) {
|
||||||
anb_entry->a = 2;
|
anb_entry->a = 2;
|
||||||
anb_entry->b = 0;
|
anb_entry->b = 0;
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_e_v_e_n")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_e_v_e_n");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(mycore_strcasecmp(str.data, "odd") == 0) {
|
else if(mycore_strcasecmp(str.data, "odd") == 0) {
|
||||||
anb_entry->a = 2;
|
anb_entry->a = 2;
|
||||||
anb_entry->b = 1;
|
anb_entry->b = 1;
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_o_d_d")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_o_d_d");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -268,7 +268,7 @@ bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool
|
|||||||
|
|
||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_number")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_number");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool
|
|||||||
anb_entry->is_broken = true;
|
anb_entry->is_broken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_n_hyphen_asterisk_end")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_n_hyphen_asterisk_end");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(mycore_strncasecmp(&str.data[consumed_len], "n", 1) == 0)
|
else if(mycore_strncasecmp(&str.data[consumed_len], "n", 1) == 0)
|
||||||
@ -314,7 +314,7 @@ bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool
|
|||||||
anb_entry->is_broken = true;
|
anb_entry->is_broken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_n_end")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_n_end");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -362,11 +362,11 @@ bool mycss_an_plus_b_state_anb_plus(mycss_entry_t* entry, mycss_token_t* token,
|
|||||||
anb_entry->is_broken = true;
|
anb_entry->is_broken = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_plus_n_hyphen_asterisk_end")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_plus_n_hyphen_asterisk_end");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(mycore_strncasecmp(str.data, "n", 1) == 0) {
|
else if(mycore_strncasecmp(str.data, "n", 1) == 0) {
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_plus_n")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_plus_n");
|
||||||
entry->parser = mycss_an_plus_b_state_anb_plus_n;
|
entry->parser = mycss_an_plus_b_state_anb_plus_n;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -409,7 +409,7 @@ bool mycss_an_plus_b_state_anb_plus_n_hyphen(mycss_entry_t* entry, mycss_token_t
|
|||||||
|
|
||||||
anb_entry->b = -res;
|
anb_entry->b = -res;
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_plus_n_hyphen_zero_hyphen_nine_end")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_plus_n_hyphen_zero_hyphen_nine_end");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
|
|
||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
@ -459,7 +459,7 @@ bool mycss_an_plus_b_state_anb_plus_n(mycss_entry_t* entry, mycss_token_t* token
|
|||||||
|
|
||||||
mycss_convert_data_to_integer(str.data, str.length, &anb_entry->b);
|
mycss_convert_data_to_integer(str.data, str.length, &anb_entry->b);
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_plus_n_begin_plus_vertical_bar_hyphen")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_plus_n_begin_plus_vertical_bar_hyphen");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
|
|
||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
@ -496,7 +496,7 @@ bool mycss_an_plus_b_state_anb_plus_n_plus(mycss_entry_t* entry, mycss_token_t*
|
|||||||
|
|
||||||
mycss_convert_data_to_integer(str.data, str.length, &anb_entry->b);
|
mycss_convert_data_to_integer(str.data, str.length, &anb_entry->b);
|
||||||
|
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_an_plus_b_state_anb_plus_n_plus_zero_hyphen_nine_end")
|
MyCORE_DEBUG("mycss_an_plus_b_state_anb_plus_n_plus_zero_hyphen_nine_end");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
|
|
||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
|
@ -271,11 +271,11 @@ bool mycss_declaration_serialization_font_family(mycss_entry_t* entry, mycss_dec
|
|||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
|
|
||||||
if(font_family->entries[i].type == MyCSS_VALUES_FONT_FAMILY_TYPE_GENERIC) {
|
if(font_family->entries[i].type == MyCSS_VALUES_FONT_FAMILY_TYPE_GENERIC) {
|
||||||
mycss_property_serialization_value(font_family->entries[i].prop_type, NULL, callback, context);
|
mycss_property_serialization_value(font_family->entries[i].value.prop_type, NULL, callback, context);
|
||||||
}
|
}
|
||||||
else if(font_family->entries[i].type == MyCSS_VALUES_FONT_FAMILY_TYPE_NAME) {
|
else if(font_family->entries[i].type == MyCSS_VALUES_FONT_FAMILY_TYPE_NAME) {
|
||||||
callback("\"", 1, context);
|
callback("\"", 1, context);
|
||||||
mycore_string_t *str = &font_family->entries[i].str;
|
mycore_string_t *str = &font_family->entries[i].value.str;
|
||||||
callback(str->data, str->length, context);
|
callback(str->data, str->length, context);
|
||||||
callback("\"", 1, context);
|
callback("\"", 1, context);
|
||||||
}
|
}
|
||||||
@ -587,23 +587,23 @@ bool mycss_declaration_serialization_background_position(mycss_entry_t* entry, m
|
|||||||
|
|
||||||
if(position->one.type) {
|
if(position->one.type) {
|
||||||
o_e = true;
|
o_e = true;
|
||||||
mycss_property_serialization_value(position->one.type, position->one.length, callback, context);
|
mycss_property_serialization_value(position->one.type, position->one.value.length, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(position->two.type) {
|
if(position->two.type) {
|
||||||
if(o_e) callback(" ", 1, context); else o_e = true;
|
if(o_e) callback(" ", 1, context); else o_e = true;
|
||||||
mycss_property_serialization_value(position->two.type, position->two.length, callback, context);
|
mycss_property_serialization_value(position->two.type, position->two.value.length, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(position->three.type) {
|
if(position->three.type) {
|
||||||
if(o_e) callback(" ", 1, context); else o_e = true;
|
if(o_e) callback(" ", 1, context); else o_e = true;
|
||||||
mycss_property_serialization_value(position->three.type, position->three.length, callback, context);
|
mycss_property_serialization_value(position->three.type, position->three.value.length, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(position->four.type) {
|
if(position->four.type) {
|
||||||
if(o_e) callback(" ", 1, context);
|
if(o_e) callback(" ", 1, context);
|
||||||
|
|
||||||
mycss_property_serialization_value(position->four.type, position->four.length, callback, context);
|
mycss_property_serialization_value(position->four.type, position->four.value.length, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
mycss_declaration_serialization_important_if_need(dec_entry, callback, context);
|
mycss_declaration_serialization_important_if_need(dec_entry, callback, context);
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MyCSS_DEBUG_MESSAGE(format, ...)
|
|
||||||
#define MyCORE_DEBUG_ERROR(format, ...)
|
|
||||||
|
|
||||||
#include "mycss/myosi.h"
|
#include "mycss/myosi.h"
|
||||||
#include "mycss/entry.h"
|
#include "mycss/entry.h"
|
||||||
#include "mycss/tokenizer.h"
|
#include "mycss/tokenizer.h"
|
||||||
|
@ -110,7 +110,7 @@ bool mycss_namespace_state_namespace_namespace_ident_string(mycss_entry_t* entry
|
|||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
||||||
mycss_namespace_parser_end(entry, token);
|
mycss_namespace_parser_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_namespace_state_namespace_namespace_ident_string_semicolon")
|
MyCORE_DEBUG("mycss_namespace_state_namespace_namespace_ident_string_semicolon");
|
||||||
entry->parser = mycss_parser_token;
|
entry->parser = mycss_parser_token;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -129,7 +129,7 @@ bool mycss_namespace_state_namespace_namespace_ident_url(mycss_entry_t* entry, m
|
|||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
||||||
mycss_namespace_parser_end(entry, token);
|
mycss_namespace_parser_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_namespace_state_namespace_namespace_ident_url_semicolon")
|
MyCORE_DEBUG("mycss_namespace_state_namespace_namespace_ident_url_semicolon");
|
||||||
entry->parser = mycss_parser_token;
|
entry->parser = mycss_parser_token;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -148,7 +148,7 @@ bool mycss_namespace_state_namespace_namespace_string(mycss_entry_t* entry, mycs
|
|||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
||||||
mycss_namespace_parser_end(entry, token);
|
mycss_namespace_parser_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_namespace_state_namespace_namespace_string_semicolon")
|
MyCORE_DEBUG("mycss_namespace_state_namespace_namespace_string_semicolon");
|
||||||
entry->parser = mycss_parser_token;
|
entry->parser = mycss_parser_token;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -167,7 +167,7 @@ bool mycss_namespace_state_namespace_namespace_url(mycss_entry_t* entry, mycss_t
|
|||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
if(token->type == MyCSS_TOKEN_TYPE_SEMICOLON) {
|
||||||
mycss_namespace_parser_end(entry, token);
|
mycss_namespace_parser_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_namespace_state_namespace_namespace_url_semicolon")
|
MyCORE_DEBUG("mycss_namespace_state_namespace_namespace_url_semicolon");
|
||||||
entry->parser = mycss_parser_token;
|
entry->parser = mycss_parser_token;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -292,9 +292,9 @@ static bool mycss_property_parser_background_check_position(mycss_entry_t* entry
|
|||||||
pos_entry->type = value_type;
|
pos_entry->type = value_type;
|
||||||
|
|
||||||
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
|
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
|
||||||
pos_entry->length = value;
|
pos_entry->value.length = value;
|
||||||
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
|
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
|
||||||
pos_entry->percentage = value;
|
pos_entry->value.percentage = value;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -319,7 +319,7 @@ static bool mycss_property_parser_background_step_size_height(mycss_entry_t* ent
|
|||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
||||||
bg_entry->height->percentage = value;
|
bg_entry->height->value.percentage = value;
|
||||||
bg_entry->height->type = value_type;
|
bg_entry->height->type = value_type;
|
||||||
}
|
}
|
||||||
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO)
|
else if(value_type == MyCSS_PROPERTY_BACKGROUND_SIZE_AUTO)
|
||||||
@ -362,7 +362,7 @@ bool mycss_property_parser_background_step_size(mycss_entry_t* entry, mycss_toke
|
|||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
||||||
bg_entry->width->percentage = value;
|
bg_entry->width->value.percentage = value;
|
||||||
bg_entry->width->type = value_type;
|
bg_entry->width->type = value_type;
|
||||||
|
|
||||||
entry->parser = mycss_property_parser_background_step_size_height;
|
entry->parser = mycss_property_parser_background_step_size_height;
|
||||||
@ -934,9 +934,9 @@ bool mycss_property_parser_background_position(mycss_entry_t* entry, mycss_token
|
|||||||
pos_entry->type = value_type;
|
pos_entry->type = value_type;
|
||||||
|
|
||||||
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
|
if(value_type == MyCSS_PROPERTY_VALUE__LENGTH)
|
||||||
pos_entry->length = value;
|
pos_entry->value.length = value;
|
||||||
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
|
else if(value_type == MyCSS_PROPERTY_VALUE__PERCENTAGE)
|
||||||
pos_entry->percentage = value;
|
pos_entry->value.percentage = value;
|
||||||
|
|
||||||
return mycss_property_parser_destroy_string(&str, true);
|
return mycss_property_parser_destroy_string(&str, true);
|
||||||
}
|
}
|
||||||
@ -1090,7 +1090,7 @@ static bool mycss_property_parser_background_size_height(mycss_entry_t* entry, m
|
|||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
bg_entry->height = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
||||||
bg_entry->height->percentage = value;
|
bg_entry->height->value.percentage = value;
|
||||||
bg_entry->height->type = value_type;
|
bg_entry->height->type = value_type;
|
||||||
|
|
||||||
entry->parser = mycss_property_parser_background_size_end;
|
entry->parser = mycss_property_parser_background_size_end;
|
||||||
@ -1131,7 +1131,7 @@ bool mycss_property_parser_background_size(mycss_entry_t* entry, mycss_token_t*
|
|||||||
|
|
||||||
if(value) {
|
if(value) {
|
||||||
bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
bg_entry->width = mycss_values_create(entry, sizeof(mycss_values_type_length_percentage_entry_t));
|
||||||
bg_entry->width->percentage = value;
|
bg_entry->width->value.percentage = value;
|
||||||
bg_entry->width->type = value_type;
|
bg_entry->width->type = value_type;
|
||||||
|
|
||||||
entry->parser = mycss_property_parser_background_size_height;
|
entry->parser = mycss_property_parser_background_size_height;
|
||||||
|
@ -60,7 +60,7 @@ bool mycss_property_parser_image_function_image(mycss_entry_t* entry, mycss_toke
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_image_image_t *image_image = image->ii;
|
mycss_values_image_image_t *image_image = image->value.ii;
|
||||||
|
|
||||||
void *value = NULL;
|
void *value = NULL;
|
||||||
unsigned int value_type = 0;
|
unsigned int value_type = 0;
|
||||||
@ -138,7 +138,7 @@ bool mycss_property_parser_image_function_image_color(mycss_entry_t* entry, mycs
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_image_image_t *image_image = image->ii;
|
mycss_values_image_image_t *image_image = image->value.ii;
|
||||||
|
|
||||||
void *value = NULL;
|
void *value = NULL;
|
||||||
unsigned int value_type = 0;
|
unsigned int value_type = 0;
|
||||||
@ -190,7 +190,7 @@ bool mycss_property_parser_image_function_image_set(mycss_entry_t* entry, mycss_
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_image_image_set_t *ii_set = image->ii_set;
|
mycss_values_image_image_set_t *ii_set = image->value.ii_set;
|
||||||
|
|
||||||
void *value = NULL;
|
void *value = NULL;
|
||||||
unsigned int value_type = 0;
|
unsigned int value_type = 0;
|
||||||
@ -237,7 +237,7 @@ bool mycss_property_parser_image_function_image_set_resolution(mycss_entry_t* en
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_image_image_set_t *ii_set = image->ii_set;
|
mycss_values_image_image_set_t *ii_set = image->value.ii_set;
|
||||||
|
|
||||||
void *value = NULL;
|
void *value = NULL;
|
||||||
unsigned int value_type = 0;
|
unsigned int value_type = 0;
|
||||||
@ -282,7 +282,7 @@ bool mycss_property_parser_image_function_string(mycss_entry_t* entry, mycss_tok
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_element_t *element = image->element;
|
mycss_values_element_t *element = image->value.element;
|
||||||
|
|
||||||
void *value = &element->custom_ident;
|
void *value = &element->custom_ident;
|
||||||
|
|
||||||
@ -336,7 +336,7 @@ bool mycss_property_parser_image_function_string_wait_ident(mycss_entry_t* entry
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_element_t *element = image->element;
|
mycss_values_element_t *element = image->value.element;
|
||||||
|
|
||||||
mycore_string_t str = {0};
|
mycore_string_t str = {0};
|
||||||
mycss_token_data_to_string(entry, token, &str, true, false);
|
mycss_token_data_to_string(entry, token, &str, true, false);
|
||||||
@ -370,7 +370,7 @@ bool mycss_property_parser_image_function_cross_fade(mycss_entry_t* entry, mycss
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_cross_fade_t *cross_fade = image->cross_fade;
|
mycss_values_cross_fade_t *cross_fade = image->value.cross_fade;
|
||||||
|
|
||||||
mycore_string_t str = {0};
|
mycore_string_t str = {0};
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ bool mycss_property_parser_image_function_cross_fade_mixing_after_percentage(myc
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_cross_fade_t *cross_fade = image->cross_fade;
|
mycss_values_cross_fade_t *cross_fade = image->value.cross_fade;
|
||||||
|
|
||||||
mycore_string_t str = {0};
|
mycore_string_t str = {0};
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ bool mycss_property_parser_image_function_cross_fade_final(mycss_entry_t* entry,
|
|||||||
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
|
||||||
|
|
||||||
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
mycss_values_image_t *image = (mycss_values_image_t*)declr_entry->value;
|
||||||
mycss_values_cross_fade_t *cross_fade = image->cross_fade;
|
mycss_values_cross_fade_t *cross_fade = image->value.cross_fade;
|
||||||
|
|
||||||
mycore_string_t str = {0};
|
mycore_string_t str = {0};
|
||||||
|
|
||||||
|
@ -66,9 +66,9 @@ bool mycss_property_shared_number(mycss_entry_t* entry, mycss_token_t* token, vo
|
|||||||
mycss_convert_data_to_double(str->data, str->length, &return_num, &length->is_float);
|
mycss_convert_data_to_double(str->data, str->length, &return_num, &length->is_float);
|
||||||
|
|
||||||
if(length->is_float)
|
if(length->is_float)
|
||||||
length->f = (float)return_num;
|
length->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
length->i = (int)return_num;
|
length->value.i = (int)return_num;
|
||||||
|
|
||||||
*value = length;
|
*value = length;
|
||||||
*value_type = MyCSS_PROPERTY_VALUE__NUMBER;
|
*value_type = MyCSS_PROPERTY_VALUE__NUMBER;
|
||||||
@ -96,9 +96,9 @@ bool mycss_property_shared_length(mycss_entry_t* entry, mycss_token_t* token, vo
|
|||||||
mycss_values_length_t *length = mycss_values_create(entry, sizeof(mycss_values_length_t));
|
mycss_values_length_t *length = mycss_values_create(entry, sizeof(mycss_values_length_t));
|
||||||
|
|
||||||
if(is_float)
|
if(is_float)
|
||||||
length->f = (float)return_num;
|
length->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
length->i = (int)return_num;
|
length->value.i = (int)return_num;
|
||||||
|
|
||||||
length->is_float = is_float;
|
length->is_float = is_float;
|
||||||
length->type = type;
|
length->type = type;
|
||||||
@ -135,9 +135,9 @@ bool mycss_property_shared_resolution(mycss_entry_t* entry, mycss_token_t* token
|
|||||||
mycss_values_resolution_t *resolution = mycss_values_create(entry, sizeof(mycss_values_resolution_t));
|
mycss_values_resolution_t *resolution = mycss_values_create(entry, sizeof(mycss_values_resolution_t));
|
||||||
|
|
||||||
if(is_float)
|
if(is_float)
|
||||||
resolution->f = (float)return_num;
|
resolution->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
resolution->i = (int)return_num;
|
resolution->value.i = (int)return_num;
|
||||||
|
|
||||||
resolution->is_float = is_float;
|
resolution->is_float = is_float;
|
||||||
resolution->type = type;
|
resolution->type = type;
|
||||||
@ -187,9 +187,9 @@ bool mycss_property_shared_percentage(mycss_entry_t* entry, mycss_token_t* token
|
|||||||
mycss_convert_data_to_double(str->data, str->length, &return_num, &length->is_float);
|
mycss_convert_data_to_double(str->data, str->length, &return_num, &length->is_float);
|
||||||
|
|
||||||
if(length->is_float)
|
if(length->is_float)
|
||||||
length->f = (float)return_num;
|
length->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
length->i = (int)return_num;
|
length->value.i = (int)return_num;
|
||||||
|
|
||||||
*value = length;
|
*value = length;
|
||||||
*value_type = MyCSS_PROPERTY_VALUE__PERCENTAGE;
|
*value_type = MyCSS_PROPERTY_VALUE__PERCENTAGE;
|
||||||
@ -238,8 +238,8 @@ bool mycss_property_shared_color(mycss_entry_t* entry, mycss_token_t* token, voi
|
|||||||
if(color_entry) {
|
if(color_entry) {
|
||||||
mycss_values_color_t *color = mycss_values_create(entry, sizeof(mycss_values_color_t));
|
mycss_values_color_t *color = mycss_values_create(entry, sizeof(mycss_values_color_t));
|
||||||
|
|
||||||
color->name_id = color_entry->type;
|
color->value.name_id = color_entry->type;
|
||||||
color->type = MyCSS_VALUES_COLOR_TYPE_NAMED;
|
color->type = MyCSS_VALUES_COLOR_TYPE_NAMED;
|
||||||
|
|
||||||
*value = color;
|
*value = color;
|
||||||
*value_type = MyCSS_PROPERTY_VALUE__COLOR;
|
*value_type = MyCSS_PROPERTY_VALUE__COLOR;
|
||||||
@ -696,7 +696,7 @@ bool mycss_property_shared_font_family(mycss_entry_t* entry, mycss_token_t* toke
|
|||||||
mycss_values_font_family_entry_t *ff_entry = mycss_property_shared_font_family_check(entry, value);
|
mycss_values_font_family_entry_t *ff_entry = mycss_property_shared_font_family_check(entry, value);
|
||||||
|
|
||||||
ff_entry->type = MyCSS_VALUES_FONT_FAMILY_TYPE_GENERIC;
|
ff_entry->type = MyCSS_VALUES_FONT_FAMILY_TYPE_GENERIC;
|
||||||
ff_entry->prop_type = family_type;
|
ff_entry->value.prop_type = family_type;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ bool mycss_property_shared_font_family(mycss_entry_t* entry, mycss_token_t* toke
|
|||||||
mycss_values_font_family_entry_t *ff_entry = mycss_property_shared_font_family_check(entry, value);
|
mycss_values_font_family_entry_t *ff_entry = mycss_property_shared_font_family_check(entry, value);
|
||||||
|
|
||||||
ff_entry->type = MyCSS_VALUES_FONT_FAMILY_TYPE_NAME;
|
ff_entry->type = MyCSS_VALUES_FONT_FAMILY_TYPE_NAME;
|
||||||
ff_entry->str = *str;
|
ff_entry->value.str = *str;
|
||||||
|
|
||||||
*dont_destroy_str = true;
|
*dont_destroy_str = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -132,24 +132,24 @@ bool mycss_selectors_state_combinator(mycss_entry_t* entry, mycss_token_t* token
|
|||||||
switch (token->type) {
|
switch (token->type) {
|
||||||
case MyCSS_TOKEN_TYPE_COLUMN: {
|
case MyCSS_TOKEN_TYPE_COLUMN: {
|
||||||
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_COLUMN;
|
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_COLUMN;
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_combinator_column")
|
MyCORE_DEBUG("mycss_selectors_state_combinator_column");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MyCSS_TOKEN_TYPE_DELIM: {
|
case MyCSS_TOKEN_TYPE_DELIM: {
|
||||||
if(*token->data == '+') {
|
if(*token->data == '+') {
|
||||||
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_NEXT_SIBLING;
|
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_NEXT_SIBLING;
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_combinator_plus")
|
MyCORE_DEBUG("mycss_selectors_state_combinator_plus");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(*token->data == '>') {
|
else if(*token->data == '>') {
|
||||||
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_CHILD;
|
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_CHILD;
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_combinator_greater_than")
|
MyCORE_DEBUG("mycss_selectors_state_combinator_greater_than");
|
||||||
entry->parser = mycss_selectors_state_combinator_greater_than;
|
entry->parser = mycss_selectors_state_combinator_greater_than;
|
||||||
}
|
}
|
||||||
else if(*token->data == '~') {
|
else if(*token->data == '~') {
|
||||||
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_FOLLOWING_SIBLING;
|
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_FOLLOWING_SIBLING;
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_combinator_tilde")
|
MyCORE_DEBUG("mycss_selectors_state_combinator_tilde");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -175,7 +175,7 @@ bool mycss_selectors_state_combinator_greater_than(mycss_entry_t* entry, mycss_t
|
|||||||
if(token->type == MyCSS_TOKEN_TYPE_DELIM) {
|
if(token->type == MyCSS_TOKEN_TYPE_DELIM) {
|
||||||
if(*token->data == '>') {
|
if(*token->data == '>') {
|
||||||
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_DESCENDANT;
|
*entry->selectors->combinator = MyCSS_SELECTORS_COMBINATOR_DESCENDANT;
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_combinator_greater_than_greater_than")
|
MyCORE_DEBUG("mycss_selectors_state_combinator_greater_than_greater_than");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -573,7 +573,7 @@ bool mycss_selectors_state_simple_selector(mycss_entry_t* entry, mycss_token_t*
|
|||||||
switch (token->type) {
|
switch (token->type) {
|
||||||
case MyCSS_TOKEN_TYPE_IDENT: {
|
case MyCSS_TOKEN_TYPE_IDENT: {
|
||||||
mycss_selectors_parser_selector_ident_type(entry, token);
|
mycss_selectors_parser_selector_ident_type(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_ident")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_ident");
|
||||||
|
|
||||||
entry->parser = mycss_selectors_state_simple_selector_ident;
|
entry->parser = mycss_selectors_state_simple_selector_ident;
|
||||||
break;
|
break;
|
||||||
@ -582,7 +582,7 @@ bool mycss_selectors_state_simple_selector(mycss_entry_t* entry, mycss_token_t*
|
|||||||
// HAND_EDIT_BEGIN
|
// HAND_EDIT_BEGIN
|
||||||
if(*token->data == '*') {
|
if(*token->data == '*') {
|
||||||
mycss_selectors_parser_selector_ident_type(entry, token);
|
mycss_selectors_parser_selector_ident_type(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_asterisk")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_asterisk");
|
||||||
|
|
||||||
entry->parser = mycss_selectors_state_simple_selector_ident;
|
entry->parser = mycss_selectors_state_simple_selector_ident;
|
||||||
}
|
}
|
||||||
@ -613,7 +613,7 @@ bool mycss_selectors_state_simple_selector(mycss_entry_t* entry, mycss_token_t*
|
|||||||
}
|
}
|
||||||
case MyCSS_TOKEN_TYPE_HASH: {
|
case MyCSS_TOKEN_TYPE_HASH: {
|
||||||
mycss_selectors_parser_selector_id(entry, token);
|
mycss_selectors_parser_selector_id(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_hash")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_hash");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -772,7 +772,7 @@ bool mycss_selectors_state_simple_selector_left_bracket_ident(mycss_entry_t* ent
|
|||||||
}
|
}
|
||||||
case MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET: {
|
case MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET: {
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_left_bracket_ident_right_bracket")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_left_bracket_ident_right_bracket");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -815,7 +815,7 @@ bool mycss_selectors_state_simple_selector_colon(mycss_entry_t* entry, mycss_tok
|
|||||||
switch (token->type) {
|
switch (token->type) {
|
||||||
case MyCSS_TOKEN_TYPE_IDENT: {
|
case MyCSS_TOKEN_TYPE_IDENT: {
|
||||||
mycss_selectors_parser_selector_pseudo_class(entry, token);
|
mycss_selectors_parser_selector_pseudo_class(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_colon_ident")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_colon_ident");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -841,7 +841,7 @@ bool mycss_selectors_state_simple_selector_colon_colon(mycss_entry_t* entry, myc
|
|||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
||||||
mycss_selectors_parser_selector_pseudo_element(entry, token);
|
mycss_selectors_parser_selector_pseudo_element(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_colon_colon_ident")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_colon_colon_ident");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_FUNCTION) {
|
else if(token->type == MyCSS_TOKEN_TYPE_FUNCTION) {
|
||||||
@ -860,7 +860,7 @@ bool mycss_selectors_state_simple_selector_colon_colon_function(mycss_entry_t* e
|
|||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS) {
|
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS) {
|
||||||
mycss_selectors_parser_selector_pseudo_element_function_end(entry, token);
|
mycss_selectors_parser_selector_pseudo_element_function_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_colon_colon_function_right_parenthesis")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_colon_colon_function_right_parenthesis");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -876,7 +876,7 @@ bool mycss_selectors_state_simple_selector_colon_function(mycss_entry_t* entry,
|
|||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS) {
|
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS) {
|
||||||
mycss_selectors_parser_selector_pseudo_class_function_end(entry, token);
|
mycss_selectors_parser_selector_pseudo_class_function_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_colon_function_right_parenthesis")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_colon_function_right_parenthesis");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -893,7 +893,7 @@ bool mycss_selectors_state_simple_selector_full_stop(mycss_entry_t* entry, mycss
|
|||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
||||||
mycss_selectors_parser_selector_class(entry, token);
|
mycss_selectors_parser_selector_class(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_full_stop_ident")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_full_stop_ident");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -910,14 +910,14 @@ bool mycss_selectors_state_simple_selector_vertical_bar(mycss_entry_t* entry, my
|
|||||||
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
||||||
mycss_selectors_parser_selector_after_namespace(entry, token);
|
mycss_selectors_parser_selector_after_namespace(entry, token);
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_vertical_bar_ident")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_vertical_bar_ident");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_DELIM) {
|
else if(token->type == MyCSS_TOKEN_TYPE_DELIM) {
|
||||||
if(*token->data == '*') {
|
if(*token->data == '*') {
|
||||||
mycss_selectors_parser_selector_after_namespace(entry, token);
|
mycss_selectors_parser_selector_after_namespace(entry, token);
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_vertical_bar_asterisk")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_vertical_bar_asterisk");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -964,14 +964,14 @@ bool mycss_selectors_state_simple_selector_ident_vertical_bar(mycss_entry_t* ent
|
|||||||
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
if(token->type == MyCSS_TOKEN_TYPE_IDENT) {
|
||||||
mycss_selectors_parser_selector_after_namespace(entry, token);
|
mycss_selectors_parser_selector_after_namespace(entry, token);
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_ident_vertical_bar_ident")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_ident_vertical_bar_ident");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_DELIM) {
|
else if(token->type == MyCSS_TOKEN_TYPE_DELIM) {
|
||||||
if(*token->data == '*') {
|
if(*token->data == '*') {
|
||||||
mycss_selectors_parser_selector_after_namespace(entry, token);
|
mycss_selectors_parser_selector_after_namespace(entry, token);
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_simple_selector_ident_vertical_bar_asterisk")
|
MyCORE_DEBUG("mycss_selectors_state_simple_selector_ident_vertical_bar_asterisk");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1064,7 +1064,7 @@ bool mycss_selectors_state_left_bracket_after_wq_name_attr(mycss_entry_t* entry,
|
|||||||
}
|
}
|
||||||
case MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET: {
|
case MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET: {
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_shared_after_wq_name_attr_right_bracket")
|
MyCORE_DEBUG("mycss_selectors_state_shared_after_wq_name_attr_right_bracket");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1089,7 +1089,7 @@ bool mycss_selectors_state_shared_after_attr_modifier(mycss_entry_t* entry, mycs
|
|||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET) {
|
if(token->type == MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET) {
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_shared_after_attr_modifier_right_bracket")
|
MyCORE_DEBUG("mycss_selectors_state_shared_after_attr_modifier_right_bracket");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1119,7 +1119,7 @@ bool mycss_selectors_state_shared_after_attribute_value(mycss_entry_t* entry, my
|
|||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET) {
|
else if(token->type == MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET) {
|
||||||
mycss_selectors_parser_selector_end(entry, token);
|
mycss_selectors_parser_selector_end(entry, token);
|
||||||
MyCSS_DEBUG_MESSAGE("mycss_selectors_state_shared_after_attribute_value_right_bracket")
|
MyCORE_DEBUG("mycss_selectors_state_shared_after_attribute_value_right_bracket");
|
||||||
entry->parser = entry->parser_switch;
|
entry->parser = entry->parser_switch;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -58,9 +58,9 @@ static void mycss_values_color_parser_set_percentage_value(mycss_entry_t* entry,
|
|||||||
mycss_convert_data_to_double(str.data, str.length, &return_num, &color_rgb->is_float);
|
mycss_convert_data_to_double(str.data, str.length, &return_num, &color_rgb->is_float);
|
||||||
|
|
||||||
if(color_rgb->is_float)
|
if(color_rgb->is_float)
|
||||||
color_rgb->f = (float)return_num;
|
color_rgb->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
color_rgb->i = (int)return_num;
|
color_rgb->value.i = (int)return_num;
|
||||||
|
|
||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
}
|
}
|
||||||
@ -74,9 +74,9 @@ static void mycss_values_color_parser_set_number_value(mycss_entry_t* entry, myc
|
|||||||
mycss_convert_data_to_double(str.data, str.length, &return_num, &color_rgb->is_float);
|
mycss_convert_data_to_double(str.data, str.length, &return_num, &color_rgb->is_float);
|
||||||
|
|
||||||
if(color_rgb->is_float)
|
if(color_rgb->is_float)
|
||||||
color_rgb->f = (float)return_num;
|
color_rgb->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
color_rgb->i = (int)return_num;
|
color_rgb->value.i = (int)return_num;
|
||||||
|
|
||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
}
|
}
|
||||||
@ -106,9 +106,9 @@ static bool mycss_values_color_parser_set_angle_value(mycss_entry_t* entry, mycs
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(is_float)
|
if(is_float)
|
||||||
angle->f = (float)return_num;
|
angle->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
angle->i = (int)return_num;
|
angle->value.i = (int)return_num;
|
||||||
|
|
||||||
angle->is_float = is_float;
|
angle->is_float = is_float;
|
||||||
angle->type = type;
|
angle->type = type;
|
||||||
@ -120,14 +120,14 @@ static bool mycss_values_color_parser_rgb_full(mycss_entry_t* entry, mycss_token
|
|||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE)
|
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE)
|
||||||
{
|
{
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->rgba_percentage.r);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.rgba_percentage.r);
|
||||||
|
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
||||||
entry->parser = mycss_values_color_parser_rgb_before_g_percentage;
|
entry->parser = mycss_values_color_parser_rgb_before_g_percentage;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
||||||
{
|
{
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->rgba_number.r);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.rgba_number.r);
|
||||||
|
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
entry->parser = mycss_values_color_parser_rgb_before_g_number;
|
entry->parser = mycss_values_color_parser_rgb_before_g_number;
|
||||||
@ -217,7 +217,7 @@ bool mycss_values_color_parser_rgb_g_percentage(mycss_entry_t* entry, mycss_toke
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->rgba_percentage.g);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.rgba_percentage.g);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_rgb_before_b_percentage;
|
entry->parser = mycss_values_color_parser_rgb_before_b_percentage;
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ bool mycss_values_color_parser_rgb_b_percentage(mycss_entry_t* entry, mycss_toke
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->rgba_percentage.b);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.rgba_percentage.b);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_rgb_before_alpha_percentage;
|
entry->parser = mycss_values_color_parser_rgb_before_alpha_percentage;
|
||||||
return true;
|
return true;
|
||||||
@ -307,12 +307,12 @@ bool mycss_values_color_parser_rgb_alpha_percentage(mycss_entry_t* entry, mycss_
|
|||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->rgba_percentage.alpha.percentage);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.rgba_percentage.alpha.value.percentage);
|
||||||
color->rgba_percentage.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
color->value.rgba_percentage.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->rgba_percentage.alpha.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.rgba_percentage.alpha.value.number);
|
||||||
color->rgba_percentage.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.rgba_percentage.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
@ -364,7 +364,7 @@ bool mycss_values_color_parser_rgb_g_number(mycss_entry_t* entry, mycss_token_t*
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->rgba_number.g);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.rgba_number.g);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_rgb_before_b_number;
|
entry->parser = mycss_values_color_parser_rgb_before_b_number;
|
||||||
return true;
|
return true;
|
||||||
@ -408,7 +408,7 @@ bool mycss_values_color_parser_rgb_b_number(mycss_entry_t* entry, mycss_token_t*
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->rgba_number.b);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.rgba_number.b);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_rgb_before_alpha_number;
|
entry->parser = mycss_values_color_parser_rgb_before_alpha_number;
|
||||||
return true;
|
return true;
|
||||||
@ -456,12 +456,12 @@ bool mycss_values_color_parser_rgb_alpha_number(mycss_entry_t* entry, mycss_toke
|
|||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->rgba_number.alpha.percentage);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.rgba_number.alpha.value.percentage);
|
||||||
color->rgba_number.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
color->value.rgba_number.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->rgba_number.alpha.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.rgba_number.alpha.value.number);
|
||||||
color->rgba_number.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.rgba_number.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
@ -478,7 +478,7 @@ bool mycss_values_color_parser_rgb_alpha_number(mycss_entry_t* entry, mycss_toke
|
|||||||
static bool mycss_values_color_parser_hsla_full(mycss_entry_t* entry, mycss_token_t* token, mycss_values_color_t *color)
|
static bool mycss_values_color_parser_hsla_full(mycss_entry_t* entry, mycss_token_t* token, mycss_values_color_t *color)
|
||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_DIMENSION) {
|
if(token->type == MyCSS_TOKEN_TYPE_DIMENSION) {
|
||||||
if(mycss_values_color_parser_set_angle_value(entry, token, &color->hsla.hue.angle) == false) {
|
if(mycss_values_color_parser_set_angle_value(entry, token, &color->value.hsla.hue.value.angle) == false) {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ static bool mycss_values_color_parser_hsla_full(mycss_entry_t* entry, mycss_toke
|
|||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
||||||
{
|
{
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->hsla.hue.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.hsla.hue.value.number);
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -573,7 +573,7 @@ bool mycss_values_color_parser_hsl_saturation(mycss_entry_t* entry, mycss_token_
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->hsla.saturation);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.hsla.saturation);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_hsl_before_lightness;
|
entry->parser = mycss_values_color_parser_hsl_before_lightness;
|
||||||
return true;
|
return true;
|
||||||
@ -617,7 +617,7 @@ bool mycss_values_color_parser_hsl_lightness(mycss_entry_t* entry, mycss_token_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->hsla.lightness);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.hsla.lightness);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_hsl_before_alpha;
|
entry->parser = mycss_values_color_parser_hsl_before_alpha;
|
||||||
return true;
|
return true;
|
||||||
@ -665,12 +665,12 @@ bool mycss_values_color_parser_hsl_alpha(mycss_entry_t* entry, mycss_token_t* to
|
|||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->hsla.alpha.percentage);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.hsla.alpha.value.percentage);
|
||||||
color->hsla.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
color->value.hsla.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->hsla.alpha.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.hsla.alpha.value.number);
|
||||||
color->hsla.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.hsla.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
@ -702,50 +702,50 @@ bool mycss_values_color_parser_hex(mycss_entry_t* entry, mycss_token_t* token, v
|
|||||||
|
|
||||||
switch (str->length) {
|
switch (str->length) {
|
||||||
case 6:
|
case 6:
|
||||||
color->hex.r.i = (int)mycss_values_color_parser_hex_get_by_two(u_data);
|
color->value.hex.r.value.i = (int)mycss_values_color_parser_hex_get_by_two(u_data);
|
||||||
color->hex.g.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[2]);
|
color->value.hex.g.value.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[2]);
|
||||||
color->hex.b.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[4]);
|
color->value.hex.b.value.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[4]);
|
||||||
color->hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_UNDEF;
|
color->value.hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_UNDEF;
|
||||||
|
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_6;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_6;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
color->hex.r.i = (int)mycss_values_color_parser_hex_get_by_two(u_data);
|
color->value.hex.r.value.i = (int)mycss_values_color_parser_hex_get_by_two(u_data);
|
||||||
color->hex.g.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[2]);
|
color->value.hex.g.value.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[2]);
|
||||||
color->hex.b.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[4]);
|
color->value.hex.b.value.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[4]);
|
||||||
|
|
||||||
color->hex.alpha.number.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[6]);
|
color->value.hex.alpha.value.number.value.i = (int)mycss_values_color_parser_hex_get_by_two(&u_data[6]);
|
||||||
color->hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
|
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_8;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_8;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
color->hex.r.i = (int)(mycore_string_chars_hex_map[ u_data[0] ]);
|
color->value.hex.r.value.i = (int)(mycore_string_chars_hex_map[ u_data[0] ]);
|
||||||
color->hex.r.i = (color->hex.r.i << 4) | color->hex.r.i;
|
color->value.hex.r.value.i = (color->value.hex.r.value.i << 4) | color->value.hex.r.value.i;
|
||||||
|
|
||||||
color->hex.g.i = (int)(mycore_string_chars_hex_map[ u_data[1] ]);
|
color->value.hex.g.value.i = (int)(mycore_string_chars_hex_map[ u_data[1] ]);
|
||||||
color->hex.g.i = (color->hex.g.i << 4) | color->hex.g.i;
|
color->value.hex.g.value.i = (color->value.hex.g.value.i << 4) | color->value.hex.g.value.i;
|
||||||
|
|
||||||
color->hex.b.i = (int)(mycore_string_chars_hex_map[ u_data[2] ]);
|
color->value.hex.b.value.i = (int)(mycore_string_chars_hex_map[ u_data[2] ]);
|
||||||
color->hex.b.i = (color->hex.b.i << 4) | color->hex.b.i;
|
color->value.hex.b.value.i = (color->value.hex.b.value.i << 4) | color->value.hex.b.value.i;
|
||||||
|
|
||||||
color->hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_UNDEF;
|
color->value.hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_UNDEF;
|
||||||
|
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_3;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_3;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
color->hex.r.i = (int)(mycore_string_chars_hex_map[ u_data[0] ]);
|
color->value.hex.r.value.i = (int)(mycore_string_chars_hex_map[ u_data[0] ]);
|
||||||
color->hex.r.i = (color->hex.r.i << 4) | color->hex.r.i;
|
color->value.hex.r.value.i = (color->value.hex.r.value.i << 4) | color->value.hex.r.value.i;
|
||||||
|
|
||||||
color->hex.g.i = (int)(mycore_string_chars_hex_map[ u_data[1] ]);
|
color->value.hex.g.value.i = (int)(mycore_string_chars_hex_map[ u_data[1] ]);
|
||||||
color->hex.g.i = (color->hex.g.i << 4) | color->hex.g.i;
|
color->value.hex.g.value.i = (color->value.hex.g.value.i << 4) | color->value.hex.g.value.i;
|
||||||
|
|
||||||
color->hex.b.i = (int)(mycore_string_chars_hex_map[ u_data[2] ]);
|
color->value.hex.b.value.i = (int)(mycore_string_chars_hex_map[ u_data[2] ]);
|
||||||
color->hex.b.i = (color->hex.b.i << 4) | color->hex.b.i;
|
color->value.hex.b.value.i = (color->value.hex.b.value.i << 4) | color->value.hex.b.value.i;
|
||||||
|
|
||||||
color->hex.alpha.number.i = (int)(mycore_string_chars_hex_map[ u_data[3] ]);
|
color->value.hex.alpha.value.number.value.i = (int)(mycore_string_chars_hex_map[ u_data[3] ]);
|
||||||
color->hex.alpha.number.i = (color->hex.alpha.number.i << 4) | color->hex.alpha.number.i;
|
color->value.hex.alpha.value.number.value.i = (color->value.hex.alpha.value.number.value.i << 4) | color->value.hex.alpha.value.number.value.i;
|
||||||
color->hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.hex.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
|
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_4;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_4;
|
||||||
break;
|
break;
|
||||||
@ -771,7 +771,7 @@ bool mycss_values_color_parser_hex(mycss_entry_t* entry, mycss_token_t* token, v
|
|||||||
static bool mycss_values_color_parser_hwb_hue(mycss_entry_t* entry, mycss_token_t* token, mycss_values_color_t *color)
|
static bool mycss_values_color_parser_hwb_hue(mycss_entry_t* entry, mycss_token_t* token, mycss_values_color_t *color)
|
||||||
{
|
{
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_DIMENSION) {
|
if(token->type == MyCSS_TOKEN_TYPE_DIMENSION) {
|
||||||
if(mycss_values_color_parser_set_angle_value(entry, token, &color->hwb.hue.angle) == false) {
|
if(mycss_values_color_parser_set_angle_value(entry, token, &color->value.hwb.hue.value.angle) == false) {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -780,7 +780,7 @@ static bool mycss_values_color_parser_hwb_hue(mycss_entry_t* entry, mycss_token_
|
|||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
||||||
{
|
{
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->hwb.hue.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.hwb.hue.value.number);
|
||||||
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -845,7 +845,7 @@ bool mycss_values_color_parser_hwb_whiteness(mycss_entry_t* entry, mycss_token_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->hwb.saturation);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.hwb.saturation);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_hwb_before_blackness;
|
entry->parser = mycss_values_color_parser_hwb_before_blackness;
|
||||||
return true;
|
return true;
|
||||||
@ -889,7 +889,7 @@ bool mycss_values_color_parser_hwb_blackness(mycss_entry_t* entry, mycss_token_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->hwb.lightness);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.hwb.lightness);
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_hwb_before_alpha;
|
entry->parser = mycss_values_color_parser_hwb_before_alpha;
|
||||||
return true;
|
return true;
|
||||||
@ -937,12 +937,12 @@ bool mycss_values_color_parser_hwb_alpha(mycss_entry_t* entry, mycss_token_t* to
|
|||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->hwb.alpha.percentage);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.hwb.alpha.value.percentage);
|
||||||
color->hwb.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
color->value.hwb.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->hwb.alpha.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.hwb.alpha.value.number);
|
||||||
color->hwb.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.hwb.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
@ -972,7 +972,7 @@ bool mycss_values_color_parser_gray(mycss_entry_t* entry, mycss_token_t* token,
|
|||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
if(token->type == MyCSS_TOKEN_TYPE_NUMBER)
|
||||||
{
|
{
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->gray.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.gray.number);
|
||||||
color->type = MyCSS_VALUES_COLOR_TYPE_GRAY;
|
color->type = MyCSS_VALUES_COLOR_TYPE_GRAY;
|
||||||
|
|
||||||
entry->parser = mycss_values_color_parser_gray_before_alpha;
|
entry->parser = mycss_values_color_parser_gray_before_alpha;
|
||||||
@ -1027,12 +1027,12 @@ bool mycss_values_color_parser_gray_alpha(mycss_entry_t* entry, mycss_token_t* t
|
|||||||
mycss_values_color_t *color = declr_entry->value;
|
mycss_values_color_t *color = declr_entry->value;
|
||||||
|
|
||||||
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
if(token->type == MyCSS_TOKEN_TYPE_PERCENTAGE) {
|
||||||
mycss_values_color_parser_set_percentage_value(entry, token, &color->gray.alpha.percentage);
|
mycss_values_color_parser_set_percentage_value(entry, token, &color->value.gray.alpha.value.percentage);
|
||||||
color->gray.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
color->value.gray.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE;
|
||||||
}
|
}
|
||||||
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
else if(token->type == MyCSS_TOKEN_TYPE_NUMBER) {
|
||||||
mycss_values_color_parser_set_number_value(entry, token, &color->gray.alpha.number);
|
mycss_values_color_parser_set_number_value(entry, token, &color->value.gray.alpha.value.number);
|
||||||
color->gray.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
color->value.gray.alpha.type_value = MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_color_parser_switch_parser(entry);
|
mycss_values_color_parser_switch_parser(entry);
|
||||||
|
@ -47,9 +47,9 @@ bool mycss_values_consume_length(mycss_entry_t* entry, mycss_token_t* token)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(value->is_float)
|
if(value->is_float)
|
||||||
value->f = (float)return_num;
|
value->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
value->i = (int)return_num;
|
value->value.i = (int)return_num;
|
||||||
|
|
||||||
*entry->values = value;
|
*entry->values = value;
|
||||||
}
|
}
|
||||||
@ -74,9 +74,9 @@ bool mycss_values_consume_percentage(mycss_entry_t* entry, mycss_token_t* token)
|
|||||||
mycore_string_destroy(&str, false);
|
mycore_string_destroy(&str, false);
|
||||||
|
|
||||||
if(value->is_float)
|
if(value->is_float)
|
||||||
value->f = (float)return_num;
|
value->value.f = (float)return_num;
|
||||||
else
|
else
|
||||||
value->i = (int)return_num;
|
value->value.i = (int)return_num;
|
||||||
|
|
||||||
*entry->values = value;
|
*entry->values = value;
|
||||||
|
|
||||||
|
@ -377,23 +377,23 @@ mycss_values_image_t * mycss_values_destroy_image(mycss_entry_t* entry, mycss_va
|
|||||||
|
|
||||||
switch (image->type) {
|
switch (image->type) {
|
||||||
case MyCSS_PROPERTY_VALUE__URL:
|
case MyCSS_PROPERTY_VALUE__URL:
|
||||||
image->url = mycss_values_destroy_url(entry, image->url, true);
|
image->value.url = mycss_values_destroy_url(entry, image->value.url, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyCSS_PROPERTY_VALUE__IMAGE_FUNCTION:
|
case MyCSS_PROPERTY_VALUE__IMAGE_FUNCTION:
|
||||||
image->ii = mycss_values_destroy_image_image(entry, image->ii, true);
|
image->value.ii = mycss_values_destroy_image_image(entry, image->value.ii, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyCSS_PROPERTY_VALUE__IMAGE_SET_FUNCTION:
|
case MyCSS_PROPERTY_VALUE__IMAGE_SET_FUNCTION:
|
||||||
image->ii_set = mycss_values_destroy_image_image_set(entry, image->ii_set, true);
|
image->value.ii_set = mycss_values_destroy_image_image_set(entry, image->value.ii_set, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyCSS_PROPERTY_VALUE__ELEMENT_FUNCTION:
|
case MyCSS_PROPERTY_VALUE__ELEMENT_FUNCTION:
|
||||||
image->element = mycss_values_destroy_element(entry, image->element, true);
|
image->value.element = mycss_values_destroy_element(entry, image->value.element, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyCSS_PROPERTY_VALUE__CROSS_FADE_FUNCTION:
|
case MyCSS_PROPERTY_VALUE__CROSS_FADE_FUNCTION:
|
||||||
image->cross_fade = mycss_values_destroy_cross_fade(entry, image->cross_fade, true);
|
image->value.cross_fade = mycss_values_destroy_cross_fade(entry, image->value.cross_fade, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -543,20 +543,20 @@ mycss_values_background_position_t * mycss_values_destroy_background_position(my
|
|||||||
if(value == NULL)
|
if(value == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if(value->one.length) {
|
if(value->one.value.length) {
|
||||||
mycss_values_destroy(entry, (void*)value->one.length);
|
mycss_values_destroy(entry, (void*)value->one.value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value->two.length) {
|
if(value->two.value.length) {
|
||||||
mycss_values_destroy(entry, (void*)value->two.length);
|
mycss_values_destroy(entry, (void*)value->two.value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value->three.length) {
|
if(value->three.value.length) {
|
||||||
mycss_values_destroy(entry, (void*)value->three.length);
|
mycss_values_destroy(entry, (void*)value->three.value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value->four.length) {
|
if(value->four.value.length) {
|
||||||
mycss_values_destroy(entry, (void*)value->four.length);
|
mycss_values_destroy(entry, (void*)value->four.value.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(self_destroy) {
|
if(self_destroy) {
|
||||||
@ -574,15 +574,15 @@ mycss_values_background_size_list_t * mycss_values_destroy_background_size(mycss
|
|||||||
|
|
||||||
for(size_t i = 0; i < value->entries_length; i++) {
|
for(size_t i = 0; i < value->entries_length; i++) {
|
||||||
if(value->entries[i].width) {
|
if(value->entries[i].width) {
|
||||||
if(value->entries[i].width->percentage)
|
if(value->entries[i].width->value.percentage)
|
||||||
mycss_values_destroy(entry, (void*)value->entries[i].width->percentage);
|
mycss_values_destroy(entry, (void*)value->entries[i].width->value.percentage);
|
||||||
|
|
||||||
mycss_values_destroy(entry, (void*)value->entries[i].width);
|
mycss_values_destroy(entry, (void*)value->entries[i].width);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value->entries[i].height) {
|
if(value->entries[i].height) {
|
||||||
if(value->entries[i].height->percentage)
|
if(value->entries[i].height->value.percentage)
|
||||||
mycss_values_destroy(entry, (void*)value->entries[i].height->percentage);
|
mycss_values_destroy(entry, (void*)value->entries[i].height->value.percentage);
|
||||||
|
|
||||||
mycss_values_destroy(entry, (void*)value->entries[i].height);
|
mycss_values_destroy(entry, (void*)value->entries[i].height);
|
||||||
}
|
}
|
||||||
|
@ -63,32 +63,32 @@ mycss_property_value_t mycss_values_image_id_by_name(const char *name, size_t le
|
|||||||
|
|
||||||
void * mycss_values_image_creator_url(mycss_entry_t* entry, mycss_values_image_t* image)
|
void * mycss_values_image_creator_url(mycss_entry_t* entry, mycss_values_image_t* image)
|
||||||
{
|
{
|
||||||
image->url = mycss_values_create(entry, sizeof(mycss_values_url_t));
|
image->value.url = mycss_values_create(entry, sizeof(mycss_values_url_t));
|
||||||
return image->url;
|
return image->value.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * mycss_values_image_creator_function_image(mycss_entry_t* entry, mycss_values_image_t* image)
|
void * mycss_values_image_creator_function_image(mycss_entry_t* entry, mycss_values_image_t* image)
|
||||||
{
|
{
|
||||||
image->ii = mycss_values_create(entry, sizeof(mycss_values_image_image_t));
|
image->value.ii = mycss_values_create(entry, sizeof(mycss_values_image_image_t));
|
||||||
return image->ii;
|
return image->value.ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * mycss_values_image_creator_image_set(mycss_entry_t* entry, mycss_values_image_t* image)
|
void * mycss_values_image_creator_image_set(mycss_entry_t* entry, mycss_values_image_t* image)
|
||||||
{
|
{
|
||||||
image->ii_set = mycss_values_create(entry, sizeof(mycss_values_image_image_set_t));
|
image->value.ii_set = mycss_values_create(entry, sizeof(mycss_values_image_image_set_t));
|
||||||
return image->ii_set;
|
return image->value.ii_set;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * mycss_values_image_creator_element(mycss_entry_t* entry, mycss_values_image_t* image)
|
void * mycss_values_image_creator_element(mycss_entry_t* entry, mycss_values_image_t* image)
|
||||||
{
|
{
|
||||||
image->element = mycss_values_create(entry, sizeof(mycss_values_element_t));
|
image->value.element = mycss_values_create(entry, sizeof(mycss_values_element_t));
|
||||||
return image->element;
|
return image->value.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * mycss_values_image_creator_cross_fade(mycss_entry_t* entry, mycss_values_image_t* image)
|
void * mycss_values_image_creator_cross_fade(mycss_entry_t* entry, mycss_values_image_t* image)
|
||||||
{
|
{
|
||||||
image->cross_fade = mycss_values_create(entry, sizeof(mycss_values_cross_fade_t));
|
image->value.cross_fade = mycss_values_create(entry, sizeof(mycss_values_cross_fade_t));
|
||||||
return image->cross_fade;
|
return image->value.cross_fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,11 +42,11 @@ void mycss_values_serialization_number(mycss_values_number_t* value, mycss_callb
|
|||||||
char buff[512];
|
char buff[512];
|
||||||
|
|
||||||
if(value->is_float) {
|
if(value->is_float) {
|
||||||
int len = snprintf(buff, 512, "%0.4f", value->f);
|
int len = snprintf(buff, 512, "%0.4f", value->value.f);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int len = snprintf(buff, 512, "%d", value->i);
|
int len = snprintf(buff, 512, "%d", value->value.i);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,11 +59,11 @@ void mycss_values_serialization_length(mycss_values_length_t* value, mycss_callb
|
|||||||
char buff[512];
|
char buff[512];
|
||||||
|
|
||||||
if(value->is_float) {
|
if(value->is_float) {
|
||||||
int len = snprintf(buff, 512, "%0.4f", value->f);
|
int len = snprintf(buff, 512, "%0.4f", value->value.f);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int len = snprintf(buff, 512, "%d", value->i);
|
int len = snprintf(buff, 512, "%d", value->value.i);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,11 +81,11 @@ void mycss_values_serialization_angle(mycss_values_angle_t* value, mycss_callbac
|
|||||||
char buff[512];
|
char buff[512];
|
||||||
|
|
||||||
if(value->is_float) {
|
if(value->is_float) {
|
||||||
int len = snprintf(buff, 512, "%0.4f", value->f);
|
int len = snprintf(buff, 512, "%0.4f", value->value.f);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int len = snprintf(buff, 512, "%d", value->i);
|
int len = snprintf(buff, 512, "%d", value->value.i);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,11 +103,11 @@ void mycss_values_serialization_resolution(mycss_values_resolution_t* value, myc
|
|||||||
char buff[512];
|
char buff[512];
|
||||||
|
|
||||||
if(value->is_float) {
|
if(value->is_float) {
|
||||||
int len = snprintf(buff, 512, "%0.4f", value->f);
|
int len = snprintf(buff, 512, "%0.4f", value->value.f);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int len = snprintf(buff, 512, "%d", value->i);
|
int len = snprintf(buff, 512, "%d", value->value.i);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,11 +125,11 @@ void mycss_values_serialization_percentage(mycss_values_percentage_t* value, myc
|
|||||||
char buff[512];
|
char buff[512];
|
||||||
|
|
||||||
if(value->is_float) {
|
if(value->is_float) {
|
||||||
int len = snprintf(buff, 512, "%0.4f%%", value->f);
|
int len = snprintf(buff, 512, "%0.4f%%", value->value.f);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int len = snprintf(buff, 512, "%d%%", value->i);
|
int len = snprintf(buff, 512, "%d%%", value->value.i);
|
||||||
mycss_values_serialization_to_callback(buff, len, callback, context);
|
mycss_values_serialization_to_callback(buff, len, callback, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,11 +138,11 @@ void mycss_values_serialization_type_length_percentage(mycss_values_type_length_
|
|||||||
{
|
{
|
||||||
switch (value->type) {
|
switch (value->type) {
|
||||||
case MyCSS_PROPERTY_VALUE__LENGTH:
|
case MyCSS_PROPERTY_VALUE__LENGTH:
|
||||||
mycss_values_serialization_length(value->length, callback, context);
|
mycss_values_serialization_length(value->value.length, callback, context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyCSS_PROPERTY_VALUE__PERCENTAGE:
|
case MyCSS_PROPERTY_VALUE__PERCENTAGE:
|
||||||
mycss_values_serialization_percentage(value->percentage, callback, context);
|
mycss_values_serialization_percentage(value->value.percentage, callback, context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
@ -173,7 +173,7 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
switch (value->type) {
|
switch (value->type) {
|
||||||
case MyCSS_VALUES_COLOR_TYPE_NAMED: {
|
case MyCSS_VALUES_COLOR_TYPE_NAMED: {
|
||||||
size_t length;
|
size_t length;
|
||||||
const char *name = mycss_values_color_name_by_id(value->name_id, &length);
|
const char *name = mycss_values_color_name_by_id(value->value.name_id, &length);
|
||||||
|
|
||||||
mycss_values_serialization_to_callback(name, length, callback, context);
|
mycss_values_serialization_to_callback(name, length, callback, context);
|
||||||
break;
|
break;
|
||||||
@ -189,25 +189,25 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
|
|
||||||
if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE)
|
if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE)
|
||||||
{
|
{
|
||||||
mycss_values_serialization_percentage(&value->rgba_percentage.r, callback, context);
|
mycss_values_serialization_percentage(&value->value.rgba_percentage.r, callback, context);
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->rgba_percentage.g, callback, context);
|
mycss_values_serialization_percentage(&value->value.rgba_percentage.g, callback, context);
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->rgba_percentage.b, callback, context);
|
mycss_values_serialization_percentage(&value->value.rgba_percentage.b, callback, context);
|
||||||
mycss_values_serialization_color_alpha(&value->rgba_percentage.alpha, callback, context);
|
mycss_values_serialization_color_alpha(&value->value.rgba_percentage.alpha, callback, context);
|
||||||
}
|
}
|
||||||
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER)
|
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER)
|
||||||
{
|
{
|
||||||
mycss_values_serialization_number(&value->rgba_number.r, callback, context);
|
mycss_values_serialization_number(&value->value.rgba_number.r, callback, context);
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_number(&value->rgba_number.g, callback, context);
|
mycss_values_serialization_number(&value->value.rgba_number.g, callback, context);
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_number(&value->rgba_number.b, callback, context);
|
mycss_values_serialization_number(&value->value.rgba_number.b, callback, context);
|
||||||
mycss_values_serialization_color_alpha(&value->rgba_number.alpha, callback, context);
|
mycss_values_serialization_color_alpha(&value->value.rgba_number.alpha, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(")", 1, context);
|
callback(")", 1, context);
|
||||||
@ -223,19 +223,19 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
else
|
else
|
||||||
callback("hsla(", 5, context);
|
callback("hsla(", 5, context);
|
||||||
|
|
||||||
if(value->hsla.hue.type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER) {
|
if(value->value.hsla.hue.type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER) {
|
||||||
mycss_values_serialization_number(&value->hsla.hue.number, callback, context);
|
mycss_values_serialization_number(&value->value.hsla.hue.value.number, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_serialization_angle(&value->hsla.hue.angle, callback, context);
|
mycss_values_serialization_angle(&value->value.hsla.hue.value.angle, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->hsla.saturation, callback, context);
|
mycss_values_serialization_percentage(&value->value.hsla.saturation, callback, context);
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->hsla.lightness, callback, context);
|
mycss_values_serialization_percentage(&value->value.hsla.lightness, callback, context);
|
||||||
mycss_values_serialization_color_alpha(&value->hsla.alpha, callback, context);
|
mycss_values_serialization_color_alpha(&value->value.hsla.alpha, callback, context);
|
||||||
|
|
||||||
callback(")", 1, context);
|
callback(")", 1, context);
|
||||||
|
|
||||||
@ -246,19 +246,19 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
{
|
{
|
||||||
callback("hwb(", 4, context);
|
callback("hwb(", 4, context);
|
||||||
|
|
||||||
if(value->hwb.hue.type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER) {
|
if(value->value.hwb.hue.type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER) {
|
||||||
mycss_values_serialization_number(&value->hwb.hue.number, callback, context);
|
mycss_values_serialization_number(&value->value.hwb.hue.value.number, callback, context);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mycss_values_serialization_angle(&value->hwb.hue.angle, callback, context);
|
mycss_values_serialization_angle(&value->value.hwb.hue.value.angle, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->hwb.saturation, callback, context);
|
mycss_values_serialization_percentage(&value->value.hwb.saturation, callback, context);
|
||||||
|
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->hwb.lightness, callback, context);
|
mycss_values_serialization_percentage(&value->value.hwb.lightness, callback, context);
|
||||||
mycss_values_serialization_color_alpha(&value->hwb.alpha, callback, context);
|
mycss_values_serialization_color_alpha(&value->value.hwb.alpha, callback, context);
|
||||||
|
|
||||||
callback(")", 1, context);
|
callback(")", 1, context);
|
||||||
|
|
||||||
@ -269,8 +269,8 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
{
|
{
|
||||||
callback("gray(", 5, context);
|
callback("gray(", 5, context);
|
||||||
|
|
||||||
mycss_values_serialization_number(&value->gray.number, callback, context);
|
mycss_values_serialization_number(&value->value.gray.number, callback, context);
|
||||||
mycss_values_serialization_color_alpha(&value->gray.alpha, callback, context);
|
mycss_values_serialization_color_alpha(&value->value.gray.alpha, callback, context);
|
||||||
|
|
||||||
callback(")", 1, context);
|
callback(")", 1, context);
|
||||||
|
|
||||||
@ -284,10 +284,10 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_8) {
|
if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_8) {
|
||||||
unsigned char data[9];
|
unsigned char data[9];
|
||||||
|
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.r.i, data);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.r.value.i, data);
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.g.i, &data[2]);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.g.value.i, &data[2]);
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.b.i, &data[4]);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.b.value.i, &data[4]);
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.alpha.number.i, &data[6]);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.alpha.value.number.value.i, &data[6]);
|
||||||
|
|
||||||
data[8] = '\0';
|
data[8] = '\0';
|
||||||
callback((const char*)data, 8, context);
|
callback((const char*)data, 8, context);
|
||||||
@ -295,9 +295,9 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_6) {
|
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_6) {
|
||||||
unsigned char data[7];
|
unsigned char data[7];
|
||||||
|
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.r.i, data);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.r.value.i, data);
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.g.i, &data[2]);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.g.value.i, &data[2]);
|
||||||
mycss_values_serialization_color_hex_two_value(value->hex.b.i, &data[4]);
|
mycss_values_serialization_color_hex_two_value(value->value.hex.b.value.i, &data[4]);
|
||||||
|
|
||||||
data[6] = '\0';
|
data[6] = '\0';
|
||||||
callback((const char*)data, 6, context);
|
callback((const char*)data, 6, context);
|
||||||
@ -305,10 +305,10 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_4) {
|
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_4) {
|
||||||
unsigned char data[5];
|
unsigned char data[5];
|
||||||
|
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.r.i, data);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.r.value.i, data);
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.g.i, &data[1]);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.g.value.i, &data[1]);
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.b.i, &data[2]);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.b.value.i, &data[2]);
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.alpha.number.i, &data[3]);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.alpha.value.number.value.i, &data[3]);
|
||||||
|
|
||||||
data[4] = '\0';
|
data[4] = '\0';
|
||||||
callback((const char*)data, 4, context);
|
callback((const char*)data, 4, context);
|
||||||
@ -316,9 +316,9 @@ void mycss_values_serialization_color(mycss_values_color_t* value, mycss_callbac
|
|||||||
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_3) {
|
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_HEX_3) {
|
||||||
unsigned char data[4];
|
unsigned char data[4];
|
||||||
|
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.r.i, data);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.r.value.i, data);
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.g.i, &data[1]);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.g.value.i, &data[1]);
|
||||||
mycss_values_serialization_color_hex_one_value(value->hex.b.i, &data[2]);
|
mycss_values_serialization_color_hex_one_value(value->value.hex.b.value.i, &data[2]);
|
||||||
|
|
||||||
data[3] = '\0';
|
data[3] = '\0';
|
||||||
callback((const char*)data, 3, context);
|
callback((const char*)data, 3, context);
|
||||||
@ -339,11 +339,11 @@ void mycss_values_serialization_color_alpha(mycss_values_color_alpha_value_t* va
|
|||||||
|
|
||||||
if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE) {
|
if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_PERCENTAGE) {
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_percentage(&value->percentage, callback, context);
|
mycss_values_serialization_percentage(&value->value.percentage, callback, context);
|
||||||
}
|
}
|
||||||
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER) {
|
else if(value->type_value == MyCSS_VALUES_COLOR_TYPE_VALUE_NUMBER) {
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_number(&value->number, callback, context);
|
mycss_values_serialization_number(&value->value.number, callback, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,7 +434,7 @@ void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callbac
|
|||||||
{
|
{
|
||||||
switch (image->type) {
|
switch (image->type) {
|
||||||
case MyCSS_PROPERTY_VALUE__URL:
|
case MyCSS_PROPERTY_VALUE__URL:
|
||||||
mycss_values_serialization_url(image->url, callback, context);
|
mycss_values_serialization_url(image->value.url, callback, context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyCSS_PROPERTY_VALUE__IMAGE_FUNCTION: {
|
case MyCSS_PROPERTY_VALUE__IMAGE_FUNCTION: {
|
||||||
@ -442,23 +442,23 @@ void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callbac
|
|||||||
|
|
||||||
bool o_e = false;
|
bool o_e = false;
|
||||||
|
|
||||||
if(image->ii->image) {
|
if(image->value.ii->image) {
|
||||||
o_e = true;
|
o_e = true;
|
||||||
mycss_values_serialization_image(image->ii->image, callback, context);
|
mycss_values_serialization_image(image->value.ii->image, callback, context);
|
||||||
}
|
}
|
||||||
else if(image->ii->str) {
|
else if(image->value.ii->str) {
|
||||||
o_e = true;
|
o_e = true;
|
||||||
|
|
||||||
callback("\"", 1, context);
|
callback("\"", 1, context);
|
||||||
mycss_values_serialization_string(image->ii->str, callback, context);
|
mycss_values_serialization_string(image->value.ii->str, callback, context);
|
||||||
callback("\"", 1, context);
|
callback("\"", 1, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(image->ii->color) {
|
if(image->value.ii->color) {
|
||||||
if(o_e)
|
if(o_e)
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
|
|
||||||
mycss_values_serialization_color(image->ii->color, callback, context);
|
mycss_values_serialization_color(image->value.ii->color, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(")", 1, context);
|
callback(")", 1, context);
|
||||||
@ -470,9 +470,9 @@ void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callbac
|
|||||||
|
|
||||||
bool o_e = false;
|
bool o_e = false;
|
||||||
|
|
||||||
for(size_t i = 0; i < image->ii_set->options_length; i++)
|
for(size_t i = 0; i < image->value.ii_set->options_length; i++)
|
||||||
{
|
{
|
||||||
mycss_values_image_image_set_option_t* option = &image->ii_set->options[i];
|
mycss_values_image_image_set_option_t* option = &image->value.ii_set->options[i];
|
||||||
|
|
||||||
if(option->image) {
|
if(option->image) {
|
||||||
o_e = true;
|
o_e = true;
|
||||||
@ -501,12 +501,12 @@ void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callbac
|
|||||||
case MyCSS_PROPERTY_VALUE__ELEMENT_FUNCTION: {
|
case MyCSS_PROPERTY_VALUE__ELEMENT_FUNCTION: {
|
||||||
callback("string(", 7, context);
|
callback("string(", 7, context);
|
||||||
|
|
||||||
mycss_values_serialization_string(&image->element->custom_ident.str, callback, context);
|
mycss_values_serialization_string(&image->value.element->custom_ident.str, callback, context);
|
||||||
|
|
||||||
if(image->element->type) {
|
if(image->value.element->type) {
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
|
|
||||||
const char* text_value = mycss_property_index_type_value[image->element->type];
|
const char* text_value = mycss_property_index_type_value[image->value.element->type];
|
||||||
callback(text_value, strlen(text_value), context);
|
callback(text_value, strlen(text_value), context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,26 +517,26 @@ void mycss_values_serialization_image(mycss_values_image_t* image, mycss_callbac
|
|||||||
case MyCSS_PROPERTY_VALUE__CROSS_FADE_FUNCTION: {
|
case MyCSS_PROPERTY_VALUE__CROSS_FADE_FUNCTION: {
|
||||||
callback("cross-fade(", 11, context);
|
callback("cross-fade(", 11, context);
|
||||||
|
|
||||||
if(image->cross_fade->mixing_image.percentage) {
|
if(image->value.cross_fade->mixing_image.percentage) {
|
||||||
mycss_values_serialization_percentage(image->cross_fade->mixing_image.percentage, callback, context);
|
mycss_values_serialization_percentage(image->value.cross_fade->mixing_image.percentage, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(image->cross_fade->mixing_image.image) {
|
if(image->value.cross_fade->mixing_image.image) {
|
||||||
if(image->cross_fade->mixing_image.percentage)
|
if(image->value.cross_fade->mixing_image.percentage)
|
||||||
callback(" ", 1, context);
|
callback(" ", 1, context);
|
||||||
|
|
||||||
mycss_values_serialization_image(image->cross_fade->mixing_image.image, callback, context);
|
mycss_values_serialization_image(image->value.cross_fade->mixing_image.image, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
mycss_values_serialization_string(&image->element->custom_ident.str, callback, context);
|
mycss_values_serialization_string(&image->value.element->custom_ident.str, callback, context);
|
||||||
|
|
||||||
if(image->cross_fade->final_image.image) {
|
if(image->value.cross_fade->final_image.image) {
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_image(image->cross_fade->final_image.image, callback, context);
|
mycss_values_serialization_image(image->value.cross_fade->final_image.image, callback, context);
|
||||||
}
|
}
|
||||||
else if(image->cross_fade->final_image.color) {
|
else if(image->value.cross_fade->final_image.color) {
|
||||||
callback(", ", 2, context);
|
callback(", ", 2, context);
|
||||||
mycss_values_serialization_color(image->cross_fade->final_image.color, callback, context);
|
mycss_values_serialization_color(image->value.cross_fade->final_image.color, callback, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(")", 1, context);
|
callback(")", 1, context);
|
||||||
|
@ -115,12 +115,13 @@ struct mycss_values_type_list {
|
|||||||
size_t entries_length;
|
size_t entries_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mycss_values_type_length_percentage_entry {
|
union mycss_values_type_length_percentage_union {
|
||||||
union {
|
mycss_values_percentage_t* percentage;
|
||||||
mycss_values_percentage_t* percentage;
|
mycss_values_length_t* length;
|
||||||
mycss_values_length_t* length;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
struct mycss_values_type_length_percentage_entry {
|
||||||
|
union mycss_values_type_length_percentage_union value;
|
||||||
unsigned int type;
|
unsigned int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -128,7 +129,7 @@ struct mycss_values_number {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
};
|
};
|
||||||
@ -137,9 +138,10 @@ struct mycss_values_length {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
|
|
||||||
mycss_units_type_t type;
|
mycss_units_type_t type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -147,7 +149,7 @@ struct mycss_values_percentage {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
};
|
};
|
||||||
@ -156,7 +158,7 @@ struct mycss_values_angle {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
mycss_units_type_t type;
|
mycss_units_type_t type;
|
||||||
@ -166,7 +168,7 @@ struct mycss_values_resolution {
|
|||||||
union {
|
union {
|
||||||
int i;
|
int i;
|
||||||
float f;
|
float f;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
bool is_float;
|
bool is_float;
|
||||||
mycss_units_type_t type;
|
mycss_units_type_t type;
|
||||||
@ -211,7 +213,7 @@ struct mycss_values_color_alpha_value {
|
|||||||
union {
|
union {
|
||||||
mycss_values_number_t number;
|
mycss_values_number_t number;
|
||||||
mycss_values_percentage_t percentage;
|
mycss_values_percentage_t percentage;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_type_value_t type_value;
|
mycss_values_color_type_value_t type_value;
|
||||||
};
|
};
|
||||||
@ -220,7 +222,7 @@ struct mycss_values_color_hue_value {
|
|||||||
union {
|
union {
|
||||||
mycss_values_number_t number;
|
mycss_values_number_t number;
|
||||||
mycss_values_angle_t angle;
|
mycss_values_angle_t angle;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_type_value_t type_value;
|
mycss_values_color_type_value_t type_value;
|
||||||
};
|
};
|
||||||
@ -267,7 +269,7 @@ struct mycss_values_color {
|
|||||||
mycss_values_color_hwb_t hwb;
|
mycss_values_color_hwb_t hwb;
|
||||||
mycss_values_color_gray_t gray;
|
mycss_values_color_gray_t gray;
|
||||||
mycss_values_color_id_t name_id;
|
mycss_values_color_id_t name_id;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_type_t type;
|
mycss_values_color_type_t type;
|
||||||
mycss_values_color_type_value_t type_value;
|
mycss_values_color_type_value_t type_value;
|
||||||
@ -308,7 +310,7 @@ struct mycss_values_image {
|
|||||||
mycss_values_image_image_set_t* ii_set;
|
mycss_values_image_image_set_t* ii_set;
|
||||||
mycss_values_element_t* element;
|
mycss_values_element_t* element;
|
||||||
mycss_values_cross_fade_t* cross_fade;
|
mycss_values_cross_fade_t* cross_fade;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_property_value_t type;
|
mycss_property_value_t type;
|
||||||
};
|
};
|
||||||
@ -378,7 +380,7 @@ struct mycss_values_gradient_linear {
|
|||||||
union {
|
union {
|
||||||
mycss_values_angle_t angle;
|
mycss_values_angle_t angle;
|
||||||
mycss_values_gradient_side_or_corner_t side_or_corner;
|
mycss_values_gradient_side_or_corner_t side_or_corner;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_color_stop_list_t color_stop_list;
|
mycss_values_color_stop_list_t color_stop_list;
|
||||||
};
|
};
|
||||||
@ -400,7 +402,7 @@ struct mycss_values_font_family_entry {
|
|||||||
union {
|
union {
|
||||||
mycore_string_t str;
|
mycore_string_t str;
|
||||||
mycss_property_font_family_t prop_type;
|
mycss_property_font_family_t prop_type;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
mycss_values_font_family_type_t type;
|
mycss_values_font_family_type_t type;
|
||||||
};
|
};
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
#include "myfont/cmap.h"
|
#include "myfont/cmap.h"
|
||||||
|
|
||||||
mystatus_t myfont_table_cmap_format_0(myfont_font_t *mf, myfont_tcmap_entry_t *entry, size_t offset)
|
mystatus_t myfont_table_cmap_format_0(myfont_font_t *mf, myfont_tcmap_entry_t *entry, uint8_t* font_data, size_t data_size, size_t offset)
|
||||||
{
|
{
|
||||||
if(mf->file_size < (offset + 260)) {
|
if(data_size < (offset + 260)) {
|
||||||
entry->header = NULL;
|
entry->header = NULL;
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ mystatus_t myfont_table_cmap_format_0(myfont_font_t *mf, myfont_tcmap_entry_t *e
|
|||||||
return MyFONT_STATUS_ERROR_MEMORY_ALLOCATION;
|
return MyFONT_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *data = &mf->file_data[offset];
|
uint8_t *data = &font_data[offset];
|
||||||
|
|
||||||
f0->length = myfont_read_u16(&data);
|
f0->length = myfont_read_u16(&data);
|
||||||
f0->language = myfont_read_u16(&data);
|
f0->language = myfont_read_u16(&data);
|
||||||
@ -46,9 +46,9 @@ mystatus_t myfont_table_cmap_format_0(myfont_font_t *mf, myfont_tcmap_entry_t *e
|
|||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_table_cmap_format_4(myfont_font_t *mf, myfont_tcmap_entry_t *entry, size_t offset)
|
mystatus_t myfont_table_cmap_format_4(myfont_font_t *mf, myfont_tcmap_entry_t *entry, uint8_t* font_data, size_t data_size, size_t offset)
|
||||||
{
|
{
|
||||||
uint8_t *data = &mf->file_data[offset];
|
uint8_t *data = &font_data[offset];
|
||||||
|
|
||||||
myfont_tcmap_format_4_t *f4 = (myfont_tcmap_format_4_t*)myfont_calloc(mf, 1, sizeof(myfont_tcmap_format_4_t));
|
myfont_tcmap_format_4_t *f4 = (myfont_tcmap_format_4_t*)myfont_calloc(mf, 1, sizeof(myfont_tcmap_format_4_t));
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ mystatus_t myfont_table_cmap_format_4(myfont_font_t *mf, myfont_tcmap_entry_t *e
|
|||||||
|
|
||||||
offset += MyFONT_TCMAP_FORMAT_4_FIRST_LENGTH;
|
offset += MyFONT_TCMAP_FORMAT_4_FIRST_LENGTH;
|
||||||
|
|
||||||
if(mf->file_size < offset) {
|
if(data_size < offset) {
|
||||||
myfont_free(mf, f4);
|
myfont_free(mf, f4);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ mystatus_t myfont_table_cmap_format_4(myfont_font_t *mf, myfont_tcmap_entry_t *e
|
|||||||
f4->numGlyphId = ((f4->length - (16L + 8L * f4->segCount)) & 0xffff) / 2;
|
f4->numGlyphId = ((f4->length - (16L + 8L * f4->segCount)) & 0xffff) / 2;
|
||||||
|
|
||||||
offset += sizeof(uint16_t) * (f4->segCount * 5);
|
offset += sizeof(uint16_t) * (f4->segCount * 5);
|
||||||
if(mf->file_size < offset)
|
if(data_size < offset)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* init mem */
|
/* init mem */
|
||||||
@ -224,7 +224,7 @@ uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long codepo
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_load_table_cmap(myfont_font_t *mf)
|
mystatus_t myfont_load_table_cmap(myfont_font_t *mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
myfont_table_cmap_t *tcmap = &mf->table_cmap;
|
myfont_table_cmap_t *tcmap = &mf->table_cmap;
|
||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_cmap];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_cmap];
|
||||||
@ -232,11 +232,11 @@ mystatus_t myfont_load_table_cmap(myfont_font_t *mf)
|
|||||||
if(table_offset == 0)
|
if(table_offset == 0)
|
||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
|
|
||||||
if((table_offset + 4) > mf->file_size)
|
if((table_offset + 4) > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
/* get header */
|
/* get header */
|
||||||
tcmap->header.version = myfont_read_u16(&data);
|
tcmap->header.version = myfont_read_u16(&data);
|
||||||
@ -248,7 +248,7 @@ mystatus_t myfont_load_table_cmap(myfont_font_t *mf)
|
|||||||
size_t size_records = sizeof(myfont_tcmap_record_t) * tcmap->header.numTables;
|
size_t size_records = sizeof(myfont_tcmap_record_t) * tcmap->header.numTables;
|
||||||
size_t size_entries = sizeof(myfont_tcmap_entry_t) * tcmap->header.numTables;
|
size_t size_entries = sizeof(myfont_tcmap_entry_t) * tcmap->header.numTables;
|
||||||
|
|
||||||
if(mf->file_size < (size_records + size_entries))
|
if(data_size < (size_records + size_entries))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
if((tcmap->records = (myfont_tcmap_record_t *)myfont_malloc(mf, size_records)) == NULL)
|
if((tcmap->records = (myfont_tcmap_record_t *)myfont_malloc(mf, size_records)) == NULL)
|
||||||
@ -271,19 +271,19 @@ mystatus_t myfont_load_table_cmap(myfont_font_t *mf)
|
|||||||
{
|
{
|
||||||
uint32_t offset = tcmap->records[i].offset + table_offset;
|
uint32_t offset = tcmap->records[i].offset + table_offset;
|
||||||
|
|
||||||
if(mf->file_size <= offset)
|
if(data_size <= offset)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
data = &mf->file_data[offset];
|
data = &font_data[offset];
|
||||||
tcmap->entries[i].format = myfont_read_u16(&data);
|
tcmap->entries[i].format = myfont_read_u16(&data);
|
||||||
|
|
||||||
switch (tcmap->entries[i].format) {
|
switch (tcmap->entries[i].format) {
|
||||||
case 0:
|
case 0:
|
||||||
myfont_table_cmap_format_0(mf, &tcmap->entries[i], (offset + 2));
|
myfont_table_cmap_format_0(mf, &tcmap->entries[i], font_data, data_size, (offset + 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
myfont_table_cmap_format_4(mf, &tcmap->entries[i], (offset + 2));
|
myfont_table_cmap_format_4(mf, &tcmap->entries[i], font_data, data_size, (offset + 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -208,7 +208,7 @@ typedef myfont_table_cmap_t;
|
|||||||
|
|
||||||
#include "myfont/myfont.h"
|
#include "myfont/myfont.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_cmap(myfont_font_t *mf);
|
mystatus_t myfont_load_table_cmap(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long char_code, mystatus_t* status);
|
uint16_t myfont_glyph_index_by_codepoint(myfont_font_t *mf, unsigned long char_code, mystatus_t* status);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/glyf.h"
|
#include "myfont/glyf.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_glyf(struct myfont_font *mf)
|
mystatus_t myfont_load_table_glyf(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_glyf, 0, sizeof(myfont_table_glyf_t));
|
memset(&mf->table_glyf, 0, sizeof(myfont_table_glyf_t));
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ mystatus_t myfont_load_table_glyf(struct myfont_font *mf)
|
|||||||
for(uint16_t i = 0; i < mf->table_maxp.numGlyphs; i++)
|
for(uint16_t i = 0; i < mf->table_maxp.numGlyphs; i++)
|
||||||
{
|
{
|
||||||
uint32_t offset = mf->cache.tables_offset[MyFONT_TKEY_glyf] + mf->table_loca.offsets[i];
|
uint32_t offset = mf->cache.tables_offset[MyFONT_TKEY_glyf] + mf->table_loca.offsets[i];
|
||||||
mystatus_t status = myfont_glyf_load_data(mf, &glyphs[i], offset);
|
mystatus_t status = myfont_glyf_load_data(mf, &glyphs[i], font_data, data_size, offset);
|
||||||
|
|
||||||
if(status)
|
if(status)
|
||||||
return status;
|
return status;
|
||||||
@ -49,7 +49,7 @@ mystatus_t myfont_load_table_glyf(struct myfont_font *mf)
|
|||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint16_t glyph_index)
|
mystatus_t myfont_glyf_load(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* font_data, size_t data_size, uint16_t glyph_index)
|
||||||
{
|
{
|
||||||
memset(glyph, 0, sizeof(myfont_table_glyph_t));
|
memset(glyph, 0, sizeof(myfont_table_glyph_t));
|
||||||
|
|
||||||
@ -59,20 +59,20 @@ mystatus_t myfont_glyf_load(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint
|
|||||||
uint16_t offset = myfont_loca_get_offset(mf, glyph_index);
|
uint16_t offset = myfont_loca_get_offset(mf, glyph_index);
|
||||||
offset += mf->cache.tables_offset[MyFONT_TKEY_glyf];
|
offset += mf->cache.tables_offset[MyFONT_TKEY_glyf];
|
||||||
|
|
||||||
return myfont_glyf_load_data(mf, glyph, offset);
|
return myfont_glyf_load_data(mf, glyph, font_data, data_size, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load_data(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint32_t offset)
|
mystatus_t myfont_glyf_load_data(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* font_data, size_t data_size, uint32_t offset)
|
||||||
{
|
{
|
||||||
memset(&glyph->head, 0, sizeof(myfont_table_glyf_head_t));
|
memset(&glyph->head, 0, sizeof(myfont_table_glyf_head_t));
|
||||||
|
|
||||||
// load head
|
// load head
|
||||||
offset += 10;
|
offset += 10;
|
||||||
if(offset > mf->file_size)
|
if(offset > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[offset];
|
uint8_t *data = &font_data[offset];
|
||||||
|
|
||||||
glyph->head.numberOfContours = myfont_read_16(&data);
|
glyph->head.numberOfContours = myfont_read_16(&data);
|
||||||
glyph->head.xMin = myfont_read_16(&data);
|
glyph->head.xMin = myfont_read_16(&data);
|
||||||
@ -81,12 +81,12 @@ mystatus_t myfont_glyf_load_data(myfont_font_t *mf, myfont_table_glyph_t *glyph,
|
|||||||
glyph->head.yMax = myfont_read_16(&data);
|
glyph->head.yMax = myfont_read_16(&data);
|
||||||
|
|
||||||
if(glyph->head.numberOfContours > 0)
|
if(glyph->head.numberOfContours > 0)
|
||||||
return myfont_glyf_load_simple(mf, glyph, data, offset);
|
return myfont_glyf_load_simple(mf, glyph, data, data_size, offset);
|
||||||
|
|
||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset)
|
mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset)
|
||||||
{
|
{
|
||||||
uint16_t *endPtsOfContours = (uint16_t *)myfont_calloc(mf, glyph->head.numberOfContours, sizeof(uint16_t));
|
uint16_t *endPtsOfContours = (uint16_t *)myfont_calloc(mf, glyph->head.numberOfContours, sizeof(uint16_t));
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyp
|
|||||||
|
|
||||||
offset = offset + (glyph->head.numberOfContours * 2) + 2;
|
offset = offset + (glyph->head.numberOfContours * 2) + 2;
|
||||||
|
|
||||||
if(offset > mf->file_size)
|
if(offset > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
for(uint16_t i = 0; i < glyph->head.numberOfContours; i++) {
|
for(uint16_t i = 0; i < glyph->head.numberOfContours; i++) {
|
||||||
@ -108,7 +108,7 @@ mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyp
|
|||||||
|
|
||||||
/* instruction */
|
/* instruction */
|
||||||
offset += glyph->simple.instructionLength;
|
offset += glyph->simple.instructionLength;
|
||||||
if(offset > mf->file_size)
|
if(offset > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
if(glyph->simple.instructionLength) {
|
if(glyph->simple.instructionLength) {
|
||||||
@ -121,10 +121,10 @@ mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyp
|
|||||||
data += glyph->simple.instructionLength;
|
data += glyph->simple.instructionLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
return myfont_glyf_load_simple_flags(mf, glyph, data, offset);
|
return myfont_glyf_load_simple_flags(mf, glyph, data, data_size, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset)
|
mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset)
|
||||||
{
|
{
|
||||||
uint8_t *flags = (uint8_t *)myfont_calloc(mf, glyph->pointCount, sizeof(uint8_t));
|
uint8_t *flags = (uint8_t *)myfont_calloc(mf, glyph->pointCount, sizeof(uint8_t));
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t
|
|||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
while(i < glyph->pointCount)
|
while(i < glyph->pointCount)
|
||||||
{
|
{
|
||||||
if(offset >= mf->file_size) {
|
if(offset >= data_size) {
|
||||||
myfont_free(mf, flags);
|
myfont_free(mf, flags);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t
|
|||||||
|
|
||||||
if(flags[i] & MyFONT_GLYF_SML_FLAGS_repeat)
|
if(flags[i] & MyFONT_GLYF_SML_FLAGS_repeat)
|
||||||
{
|
{
|
||||||
if(offset >= mf->file_size) {
|
if(offset >= data_size) {
|
||||||
myfont_free(mf, flags);
|
myfont_free(mf, flags);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
@ -168,10 +168,10 @@ mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t
|
|||||||
|
|
||||||
glyph->simple.flags = flags;
|
glyph->simple.flags = flags;
|
||||||
|
|
||||||
return myfont_glyf_load_simple_coordinates(mf, glyph, data, offset);
|
return myfont_glyf_load_simple_coordinates(mf, glyph, data, data_size, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset)
|
mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset)
|
||||||
{
|
{
|
||||||
/* alloc resources */
|
/* alloc resources */
|
||||||
int16_t *xCoordinates = (int16_t *)myfont_calloc(mf, glyph->pointCount, sizeof(int16_t));
|
int16_t *xCoordinates = (int16_t *)myfont_calloc(mf, glyph->pointCount, sizeof(int16_t));
|
||||||
@ -192,7 +192,7 @@ mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_g
|
|||||||
{
|
{
|
||||||
if(flags[i] & MyFONT_GLYF_SML_FLAGS_x_ShortVector)
|
if(flags[i] & MyFONT_GLYF_SML_FLAGS_x_ShortVector)
|
||||||
{
|
{
|
||||||
if(offset >= mf->file_size) {
|
if(offset >= data_size) {
|
||||||
myfont_free(mf, xCoordinates);
|
myfont_free(mf, xCoordinates);
|
||||||
myfont_free(mf, yCoordinates);
|
myfont_free(mf, yCoordinates);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
@ -209,7 +209,7 @@ mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_g
|
|||||||
{
|
{
|
||||||
offset++;
|
offset++;
|
||||||
|
|
||||||
if(offset >= mf->file_size) {
|
if(offset >= data_size) {
|
||||||
myfont_free(mf, xCoordinates);
|
myfont_free(mf, xCoordinates);
|
||||||
myfont_free(mf, yCoordinates);
|
myfont_free(mf, yCoordinates);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
@ -232,7 +232,7 @@ mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_g
|
|||||||
{
|
{
|
||||||
if(flags[i] & MyFONT_GLYF_SML_FLAGS_y_ShortVector)
|
if(flags[i] & MyFONT_GLYF_SML_FLAGS_y_ShortVector)
|
||||||
{
|
{
|
||||||
if(offset >= mf->file_size) {
|
if(offset >= data_size) {
|
||||||
myfont_free(mf, xCoordinates);
|
myfont_free(mf, xCoordinates);
|
||||||
myfont_free(mf, yCoordinates);
|
myfont_free(mf, yCoordinates);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
@ -248,7 +248,7 @@ mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_g
|
|||||||
else {
|
else {
|
||||||
offset++;
|
offset++;
|
||||||
|
|
||||||
if(offset >= mf->file_size) {
|
if(offset >= data_size) {
|
||||||
myfont_free(mf, xCoordinates);
|
myfont_free(mf, xCoordinates);
|
||||||
myfont_free(mf, yCoordinates);
|
myfont_free(mf, yCoordinates);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
@ -99,13 +99,13 @@ typedef myfont_table_glyf_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_glyf(struct myfont_font *mf);
|
mystatus_t myfont_load_table_glyf(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
mystatus_t myfont_glyf_load(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint16_t glyph_index);
|
mystatus_t myfont_glyf_load(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* data, size_t data_size, uint16_t glyph_index);
|
||||||
mystatus_t myfont_glyf_load_data(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint32_t offset);
|
mystatus_t myfont_glyf_load_data(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t* data, size_t data_size, uint32_t offset);
|
||||||
mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset);
|
mystatus_t myfont_glyf_load_simple(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset);
|
||||||
mystatus_t myfont_glyf_load_simple_flags(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset);
|
mystatus_t myfont_glyf_load_simple_flags(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset);
|
||||||
mystatus_t myfont_glyf_load_simple_coordinates(struct myfont_font *mf, myfont_table_glyph_t *glyph, uint8_t *data, uint32_t offset);
|
mystatus_t myfont_glyf_load_simple_coordinates(myfont_font_t *mf, myfont_table_glyph_t *glyph, uint8_t *data, size_t data_size, uint32_t offset);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/head.h"
|
#include "myfont/head.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_head(struct myfont_font *mf)
|
mystatus_t myfont_load_table_head(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_head, 0, sizeof(myfont_table_head_t));
|
memset(&mf->table_head, 0, sizeof(myfont_table_head_t));
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ mystatus_t myfont_load_table_head(struct myfont_font *mf)
|
|||||||
myfont_table_head_t *thead = &mf->table_head;
|
myfont_table_head_t *thead = &mf->table_head;
|
||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_head];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_head];
|
||||||
|
|
||||||
if(mf->file_size < (table_offset + 16 + 4 + 16 + 8 + 4 + 6))
|
if(data_size < (table_offset + 16 + 4 + 16 + 8 + 4 + 6))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
/* u32 */
|
/* u32 */
|
||||||
thead->version = myfont_read_u32(&data);
|
thead->version = myfont_read_u32(&data);
|
||||||
|
@ -53,9 +53,9 @@ typedef myfont_table_head_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_head(struct myfont_font *mf);
|
mystatus_t myfont_load_table_head(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
float myfont_head_yMax_pixel(struct myfont_font *mf, float font_size);
|
float myfont_head_yMax_pixel(myfont_font_t *mf, float font_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/hhea.h"
|
#include "myfont/hhea.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_hhea(myfont_font_t *mf)
|
mystatus_t myfont_load_table_hhea(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_hhea, 0, sizeof(myfont_table_hhea_t));
|
memset(&mf->table_hhea, 0, sizeof(myfont_table_hhea_t));
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ mystatus_t myfont_load_table_hhea(myfont_font_t *mf)
|
|||||||
myfont_table_hhea_t *thhea = &mf->table_hhea;
|
myfont_table_hhea_t *thhea = &mf->table_hhea;
|
||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_hhea];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_hhea];
|
||||||
|
|
||||||
if(mf->file_size < (table_offset + 8 + 6 + 2 + 22 + 2))
|
if(data_size < (table_offset + 8 + 6 + 2 + 22 + 2))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
thhea->version = myfont_read_u32(&data);
|
thhea->version = myfont_read_u32(&data);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ typedef myfont_table_hhea_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_hhea(struct myfont_font *mf);
|
mystatus_t myfont_load_table_hhea(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/hmtx.h"
|
#include "myfont/hmtx.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_hmtx(struct myfont_font *mf)
|
mystatus_t myfont_load_table_hmtx(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_hmtx, 0, sizeof(myfont_table_hmtx_t));
|
memset(&mf->table_hmtx, 0, sizeof(myfont_table_hmtx_t));
|
||||||
|
|
||||||
@ -31,13 +31,13 @@ mystatus_t myfont_load_table_hmtx(struct myfont_font *mf)
|
|||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_hmtx];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_hmtx];
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
uint16_t num_metrics = mf->table_hhea.numberOfHMetrics;
|
uint16_t num_metrics = mf->table_hhea.numberOfHMetrics;
|
||||||
|
|
||||||
if(num_metrics == 0)
|
if(num_metrics == 0)
|
||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
|
|
||||||
if(mf->file_size < (table_offset + (num_metrics * 2)))
|
if(data_size < (table_offset + (num_metrics * 2)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
myfont_long_hor_metric_t *lhor_metric = (myfont_long_hor_metric_t *)myfont_calloc(mf, num_metrics, sizeof(myfont_long_hor_metric_t));
|
myfont_long_hor_metric_t *lhor_metric = (myfont_long_hor_metric_t *)myfont_calloc(mf, num_metrics, sizeof(myfont_long_hor_metric_t));
|
||||||
|
@ -45,7 +45,7 @@ typedef myfont_table_hmtx_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_hmtx(struct myfont_font *mf);
|
mystatus_t myfont_load_table_hmtx(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/loca.h"
|
#include "myfont/loca.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_loca(struct myfont_font *mf)
|
mystatus_t myfont_load_table_loca(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_loca, 0, sizeof(myfont_table_loca_t));
|
memset(&mf->table_loca, 0, sizeof(myfont_table_loca_t));
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ mystatus_t myfont_load_table_loca(struct myfont_font *mf)
|
|||||||
uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_loca];
|
uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_loca];
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
uint16_t numGlyph = mf->table_maxp.numGlyphs;
|
uint16_t numGlyph = mf->table_maxp.numGlyphs;
|
||||||
|
|
||||||
if(numGlyph == 0)
|
if(numGlyph == 0)
|
||||||
@ -46,23 +46,23 @@ mystatus_t myfont_load_table_loca(struct myfont_font *mf)
|
|||||||
|
|
||||||
if(mf->table_head.indexToLocFormat)
|
if(mf->table_head.indexToLocFormat)
|
||||||
{
|
{
|
||||||
if(mf->file_size < (table_offset + (numGlyph * 4))) {
|
if(data_size < (table_offset + (numGlyph * 4))) {
|
||||||
myfont_free(mf, tloca->offsets);
|
myfont_free(mf, tloca->offsets);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint16_t i = 0; i < numGlyph; i++) {
|
for(size_t i = 0; i < numGlyph; i++) {
|
||||||
tloca->offsets[i] = myfont_read_u32(&data);
|
tloca->offsets[i] = myfont_read_u32(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mf->file_size < (table_offset + (numGlyph * 2))) {
|
if(data_size < (table_offset + (numGlyph * 2))) {
|
||||||
myfont_free(mf, tloca->offsets);
|
myfont_free(mf, tloca->offsets);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint16_t i = 0; i < numGlyph; i++) {
|
for(size_t i = 0; i < numGlyph; i++) {
|
||||||
tloca->offsets[i] = myfont_read_u16(&data) * 2;
|
tloca->offsets[i] = myfont_read_u16(&data) * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ typedef myfont_table_loca_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_loca(struct myfont_font *mf);
|
mystatus_t myfont_load_table_loca(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
uint32_t myfont_loca_get_offset(struct myfont_font *mf, uint16_t glyph_index);
|
uint32_t myfont_loca_get_offset(myfont_font_t *mf, uint16_t glyph_index);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/maxp.h"
|
#include "myfont/maxp.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_maxp(myfont_font_t *mf)
|
mystatus_t myfont_load_table_maxp(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_maxp, 0, sizeof(myfont_table_maxp_t));
|
memset(&mf->table_maxp, 0, sizeof(myfont_table_maxp_t));
|
||||||
|
|
||||||
@ -30,17 +30,17 @@ mystatus_t myfont_load_table_maxp(myfont_font_t *mf)
|
|||||||
myfont_table_maxp_t *tmaxp = &mf->table_maxp;
|
myfont_table_maxp_t *tmaxp = &mf->table_maxp;
|
||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_maxp];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_maxp];
|
||||||
|
|
||||||
if((table_offset + 4) > mf->file_size)
|
if((table_offset + 4) > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
tmaxp->version = myfont_read_u32_as_net(&data);
|
tmaxp->version = myfont_read_u32_as_net(&data);
|
||||||
|
|
||||||
if(myfont_table_version_major(tmaxp->version) == 1)
|
if(myfont_table_version_major(tmaxp->version) == 1)
|
||||||
{
|
{
|
||||||
if((table_offset + 4 + 28) > mf->file_size)
|
if((table_offset + 4 + 28) > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tmaxp->numGlyphs = myfont_read_u16(&data);
|
tmaxp->numGlyphs = myfont_read_u16(&data);
|
||||||
@ -59,7 +59,7 @@ mystatus_t myfont_load_table_maxp(myfont_font_t *mf)
|
|||||||
tmaxp->maxComponentDepth = myfont_read_u16(&data);
|
tmaxp->maxComponentDepth = myfont_read_u16(&data);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if((table_offset + 4 + 2) > mf->file_size)
|
if((table_offset + 4 + 2) > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tmaxp->numGlyphs = myfont_read_u16(&data);
|
tmaxp->numGlyphs = myfont_read_u16(&data);
|
||||||
|
@ -51,7 +51,7 @@ typedef myfont_table_maxp_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_maxp(struct myfont_font *mf);
|
mystatus_t myfont_load_table_maxp(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -54,8 +54,6 @@ mystatus_t myfont_init(myfont_font_t *mf)
|
|||||||
memset(mf->cache.tables_offset, 0, sizeof(uint32_t) * MyFONT_TKEY_LAST_KEY);
|
memset(mf->cache.tables_offset, 0, sizeof(uint32_t) * MyFONT_TKEY_LAST_KEY);
|
||||||
memset(&mf->header, 0, sizeof(myfont_header_t));
|
memset(&mf->header, 0, sizeof(myfont_header_t));
|
||||||
|
|
||||||
mf->file_path = NULL;
|
|
||||||
|
|
||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,17 +63,6 @@ void myfont_clean(myfont_font_t *mf)
|
|||||||
|
|
||||||
memset(mf->cache.tables_offset, 0, sizeof(uint32_t) * MyFONT_TKEY_LAST_KEY);
|
memset(mf->cache.tables_offset, 0, sizeof(uint32_t) * MyFONT_TKEY_LAST_KEY);
|
||||||
memset(&mf->header, 0, sizeof(myfont_header_t));
|
memset(&mf->header, 0, sizeof(myfont_header_t));
|
||||||
|
|
||||||
if(mf->file_data) {
|
|
||||||
mycore_free(mf->file_data);
|
|
||||||
mf->file_data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mf->file_path) {
|
|
||||||
mycore_free(mf->file_path);
|
|
||||||
mf->file_path = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(mf, 0, sizeof(myfont_font_t));
|
memset(mf, 0, sizeof(myfont_font_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,16 +73,6 @@ myfont_font_t * myfont_destroy(myfont_font_t *mf, bool self_destroy)
|
|||||||
|
|
||||||
mf->mchar = mchar_async_destroy(mf->mchar, 1);
|
mf->mchar = mchar_async_destroy(mf->mchar, 1);
|
||||||
|
|
||||||
if(mf->file_data) {
|
|
||||||
mycore_free(mf->file_data);
|
|
||||||
mf->file_data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mf->file_path) {
|
|
||||||
mycore_free(mf->file_path);
|
|
||||||
mf->file_path = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(self_destroy) {
|
if(self_destroy) {
|
||||||
mycore_free(mf);
|
mycore_free(mf);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -122,8 +99,16 @@ void myfont_free(myfont_font_t *mf, void* data)
|
|||||||
mchar_async_free(mf->mchar, mf->mchar_node_id, data);
|
mchar_async_free(mf->mchar, mf->mchar_node_id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
mystatus_t myfont_load(myfont_font_t *mf, const char *filepath)
|
mystatus_t myfont_load_from_file(myfont_font_t *mf, const char *filepath, uint8_t** return_data, size_t* data_size)
|
||||||
{
|
{
|
||||||
|
if(return_data)
|
||||||
|
*return_data = NULL;
|
||||||
|
|
||||||
|
if(data_size)
|
||||||
|
*data_size = 0;
|
||||||
|
|
||||||
|
size_t file_data_size;
|
||||||
|
|
||||||
FILE *fh = fopen(filepath, "rb");
|
FILE *fh = fopen(filepath, "rb");
|
||||||
if(fh == NULL)
|
if(fh == NULL)
|
||||||
return MyFONT_STATUS_ERROR_FILE_OPEN;
|
return MyFONT_STATUS_ERROR_FILE_OPEN;
|
||||||
@ -145,30 +130,47 @@ mystatus_t myfont_load(myfont_font_t *mf, const char *filepath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(file_size > 0)
|
if(file_size > 0)
|
||||||
mf->file_size = (size_t)file_size;
|
file_data_size = (size_t)file_size;
|
||||||
else {
|
else {
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
return MyFONT_STATUS_ERROR_FILE_TOO_SMALL;
|
return MyFONT_STATUS_ERROR_FILE_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mf->file_data = (uint8_t*)mycore_malloc(file_size);
|
uint8_t* data = (uint8_t*)mycore_malloc(file_size);
|
||||||
|
|
||||||
if(mf->file_data == NULL) {
|
if(data == NULL) {
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
return MyFONT_STATUS_ERROR_MEMORY_ALLOCATION;
|
return MyFONT_STATUS_ERROR_MEMORY_ALLOCATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fread(mf->file_data, 1, file_size, fh) != file_size) {
|
if(fread(data, 1, file_size, fh) != file_size) {
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
return MyFONT_STATUS_ERROR_FILE_READ;
|
return MyFONT_STATUS_ERROR_FILE_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
|
|
||||||
if(mf->file_size < 12)
|
if(return_data)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
*return_data = data;
|
||||||
|
|
||||||
uint8_t *data = mf->file_data;
|
if(data_size)
|
||||||
|
*data_size = file_data_size;
|
||||||
|
|
||||||
|
return myfont_load(mf, data, file_data_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void * myfont_destroy_font_data(myfont_font_t *mf, uint8_t* return_data)
|
||||||
|
{
|
||||||
|
if(return_data)
|
||||||
|
return mycore_free(return_data);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
mystatus_t myfont_load(myfont_font_t *mf, uint8_t* data, size_t data_size)
|
||||||
|
{
|
||||||
|
if(data_size < 12)
|
||||||
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
mf->header.version_major = myfont_read_u16(&data);
|
mf->header.version_major = myfont_read_u16(&data);
|
||||||
mf->header.version_minor = myfont_read_u16(&data);
|
mf->header.version_minor = myfont_read_u16(&data);
|
||||||
@ -177,7 +179,7 @@ mystatus_t myfont_load(myfont_font_t *mf, const char *filepath)
|
|||||||
mf->header.entrySelector = myfont_read_u16(&data);
|
mf->header.entrySelector = myfont_read_u16(&data);
|
||||||
mf->header.rangeShift = myfont_read_u16(&data);
|
mf->header.rangeShift = myfont_read_u16(&data);
|
||||||
|
|
||||||
if(mf->file_size < (12 + (mf->header.numTables * 16)))
|
if(data_size < (12 + (mf->header.numTables * 16)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
for(uint16_t i = 0; i < mf->header.numTables; i++)
|
for(uint16_t i = 0; i < mf->header.numTables; i++)
|
||||||
@ -235,48 +237,42 @@ mystatus_t myfont_load(myfont_font_t *mf, const char *filepath)
|
|||||||
if(myfont_check_required_tables(mf))
|
if(myfont_check_required_tables(mf))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LACKS_REQUIRED;
|
return MyFONT_STATUS_ERROR_TABLE_LACKS_REQUIRED;
|
||||||
|
|
||||||
mf->file_path = (char *)mycore_calloc(strlen(filepath), sizeof(char));
|
|
||||||
|
|
||||||
if(mf->file_path) {
|
|
||||||
strncpy(mf->file_path, filepath, strlen(filepath));
|
|
||||||
}
|
|
||||||
|
|
||||||
mystatus_t status;
|
mystatus_t status;
|
||||||
|
|
||||||
if((status = myfont_load_table_cmap(mf)))
|
if((status = myfont_load_table_cmap(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_CMAP;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_CMAP;
|
||||||
|
|
||||||
if((status = myfont_load_table_head(mf)))
|
if((status = myfont_load_table_head(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_HEAD;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_HEAD;
|
||||||
|
|
||||||
if((status = myfont_load_table_name(mf)))
|
if((status = myfont_load_table_name(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_NAME;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_NAME;
|
||||||
|
|
||||||
if((status = myfont_load_table_os_2(mf)))
|
if((status = myfont_load_table_os_2(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_OS_2;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_OS_2;
|
||||||
|
|
||||||
if((status = myfont_load_table_maxp(mf)))
|
if((status = myfont_load_table_maxp(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_MAXP;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_MAXP;
|
||||||
|
|
||||||
if((status = myfont_load_table_hhea(mf)))
|
if((status = myfont_load_table_hhea(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_HHEA;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_HHEA;
|
||||||
|
|
||||||
if((status = myfont_load_table_hmtx(mf)))
|
if((status = myfont_load_table_hmtx(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_HMTX;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_HMTX;
|
||||||
|
|
||||||
if((status = myfont_load_table_loca(mf)))
|
if((status = myfont_load_table_loca(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_LOCA;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_LOCA;
|
||||||
|
|
||||||
if((status = myfont_load_table_glyf(mf)))
|
if((status = myfont_load_table_glyf(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_GLYF;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_GLYF;
|
||||||
|
|
||||||
if((status = myfont_load_table_vhea(mf)))
|
if((status = myfont_load_table_vhea(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_VHEA;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_VHEA;
|
||||||
|
|
||||||
if((status = myfont_load_table_vmtx(mf)))
|
if((status = myfont_load_table_vmtx(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_VMTX;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_VMTX;
|
||||||
|
|
||||||
if((status = myfont_load_table_pclt(mf)))
|
if((status = myfont_load_table_pclt(mf, data, data_size)))
|
||||||
return MyFONT_STATUS_ERROR_TABLE_LOAD_PCLT;
|
return MyFONT_STATUS_ERROR_TABLE_LOAD_PCLT;
|
||||||
|
|
||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
|
@ -85,10 +85,6 @@ struct myfont_font {
|
|||||||
myfont_table_pclt_t table_pclt;
|
myfont_table_pclt_t table_pclt;
|
||||||
myfont_table_loca_t table_loca;
|
myfont_table_loca_t table_loca;
|
||||||
|
|
||||||
char* file_path;
|
|
||||||
size_t file_size;
|
|
||||||
uint8_t* file_data;
|
|
||||||
|
|
||||||
mchar_async_t* mchar;
|
mchar_async_t* mchar;
|
||||||
size_t mchar_node_id;
|
size_t mchar_node_id;
|
||||||
};
|
};
|
||||||
@ -102,7 +98,9 @@ void * myfont_malloc(myfont_font_t* mf, size_t size);
|
|||||||
void * myfont_calloc(myfont_font_t* mf, size_t count, size_t size);
|
void * myfont_calloc(myfont_font_t* mf, size_t count, size_t size);
|
||||||
void myfont_free(myfont_font_t *mf, void* data);
|
void myfont_free(myfont_font_t *mf, void* data);
|
||||||
|
|
||||||
mystatus_t myfont_load(myfont_font_t *mf, const char *filepath);
|
mystatus_t myfont_load(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
mystatus_t myfont_load_from_file(myfont_font_t* mf, const char* filepath, uint8_t** return_data, size_t* data_size);
|
||||||
|
void * myfont_destroy_font_data(myfont_font_t* mf, uint8_t* return_data);
|
||||||
|
|
||||||
mystatus_t myfont_check_required_tables(myfont_font_t *mf);
|
mystatus_t myfont_check_required_tables(myfont_font_t *mf);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/name.h"
|
#include "myfont/name.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_name(myfont_font_t *mf)
|
mystatus_t myfont_load_table_name(myfont_font_t *mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_name, 0, sizeof(myfont_table_name_t));
|
memset(&mf->table_name, 0, sizeof(myfont_table_name_t));
|
||||||
|
|
||||||
@ -31,18 +31,18 @@ mystatus_t myfont_load_table_name(myfont_font_t *mf)
|
|||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_name];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_name];
|
||||||
uint32_t pos = table_offset + 6;
|
uint32_t pos = table_offset + 6;
|
||||||
|
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
tname->format = myfont_read_u16(&data);
|
tname->format = myfont_read_u16(&data);
|
||||||
tname->count = myfont_read_u16(&data);
|
tname->count = myfont_read_u16(&data);
|
||||||
tname->stringOffset = myfont_read_u16(&data);
|
tname->stringOffset = myfont_read_u16(&data);
|
||||||
|
|
||||||
pos = pos + (tname->count * 12);
|
pos = pos + (tname->count * 12);
|
||||||
if(pos > mf->file_size) {
|
if(pos > data_size) {
|
||||||
tname->count = 0;
|
tname->count = 0;
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
@ -66,13 +66,13 @@ mystatus_t myfont_load_table_name(myfont_font_t *mf)
|
|||||||
if(tname->format == 1)
|
if(tname->format == 1)
|
||||||
{
|
{
|
||||||
pos += 2;
|
pos += 2;
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tname->langTagCount = myfont_read_u16(&data);
|
tname->langTagCount = myfont_read_u16(&data);
|
||||||
|
|
||||||
pos = pos + (tname->langTagCount * 4);
|
pos = pos + (tname->langTagCount * 4);
|
||||||
if(pos > mf->file_size) {
|
if(pos > data_size) {
|
||||||
tname->langTagCount = 0;
|
tname->langTagCount = 0;
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ typedef myfont_table_name_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_name(struct myfont_font *mf);
|
mystatus_t myfont_load_table_name(myfont_font_t *mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/os_2.h"
|
#include "myfont/os_2.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_os_2(myfont_font_t *mf)
|
mystatus_t myfont_load_table_os_2(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_os_2, 0, sizeof(myfont_table_os_2_t));
|
memset(&mf->table_os_2, 0, sizeof(myfont_table_os_2_t));
|
||||||
|
|
||||||
@ -31,10 +31,10 @@ mystatus_t myfont_load_table_os_2(myfont_font_t *mf)
|
|||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_OS_2];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_OS_2];
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
uint32_t pos = table_offset + 32 + 10 + 16 + 4 + 16;
|
uint32_t pos = table_offset + 32 + 10 + 16 + 4 + 16;
|
||||||
|
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tos_2->version = myfont_read_u16(&data);
|
tos_2->version = myfont_read_u16(&data);
|
||||||
@ -77,7 +77,7 @@ mystatus_t myfont_load_table_os_2(myfont_font_t *mf)
|
|||||||
switch (tos_2->version) {
|
switch (tos_2->version) {
|
||||||
case 1:
|
case 1:
|
||||||
pos += 8;
|
pos += 8;
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tos_2->ulCodePageRange1 = myfont_read_u32(&data);
|
tos_2->ulCodePageRange1 = myfont_read_u32(&data);
|
||||||
@ -88,7 +88,7 @@ mystatus_t myfont_load_table_os_2(myfont_font_t *mf)
|
|||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
pos += 18;
|
pos += 18;
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tos_2->ulCodePageRange1 = myfont_read_u32(&data);
|
tos_2->ulCodePageRange1 = myfont_read_u32(&data);
|
||||||
@ -102,7 +102,7 @@ mystatus_t myfont_load_table_os_2(myfont_font_t *mf)
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
pos += 22;
|
pos += 22;
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
tos_2->ulCodePageRange1 = myfont_read_u32(&data);
|
tos_2->ulCodePageRange1 = myfont_read_u32(&data);
|
||||||
|
@ -90,9 +90,9 @@ typedef myfont_table_os_2_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_os_2(struct myfont_font *mf);
|
mystatus_t myfont_load_table_os_2(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
int8_t myfont_os_2_panose(struct myfont_font *mf, myfont_table_os_2_panose_t id);
|
int8_t myfont_os_2_panose(myfont_font_t* mf, myfont_table_os_2_panose_t id);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/pclt.h"
|
#include "myfont/pclt.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_pclt(struct myfont_font *mf)
|
mystatus_t myfont_load_table_pclt(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_pclt, 0, sizeof(myfont_table_pclt_t));
|
memset(&mf->table_pclt, 0, sizeof(myfont_table_pclt_t));
|
||||||
|
|
||||||
@ -31,11 +31,11 @@ mystatus_t myfont_load_table_pclt(struct myfont_font *mf)
|
|||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_PCLT];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_PCLT];
|
||||||
|
|
||||||
uint32_t pos = table_offset + 4 + 16 + 16 + 8 + 6 + 4;
|
uint32_t pos = table_offset + 4 + 16 + 16 + 8 + 6 + 4;
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
tpclt->version = myfont_read_u32_as_net(&data);
|
tpclt->version = myfont_read_u32_as_net(&data);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ typedef myfont_table_pclt_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_pclt(struct myfont_font *mf);
|
mystatus_t myfont_load_table_pclt(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/vhea.h"
|
#include "myfont/vhea.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_vhea(myfont_font_t *mf)
|
mystatus_t myfont_load_table_vhea(myfont_font_t *mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_vhea, 0, sizeof(myfont_table_vhea_t));
|
memset(&mf->table_vhea, 0, sizeof(myfont_table_vhea_t));
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ mystatus_t myfont_load_table_vhea(myfont_font_t *mf)
|
|||||||
myfont_table_vhea_t *tvhea = &mf->table_vhea;
|
myfont_table_vhea_t *tvhea = &mf->table_vhea;
|
||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_vhea];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_vhea];
|
||||||
|
|
||||||
if((table_offset + 4 + 32) > mf->file_size)
|
if((table_offset + 4 + 32) > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
|
|
||||||
tvhea->version = myfont_read_u32_as_net(&data);
|
tvhea->version = myfont_read_u32_as_net(&data);
|
||||||
tvhea->Ascender = myfont_read_16(&data);
|
tvhea->Ascender = myfont_read_16(&data);
|
||||||
|
@ -54,7 +54,7 @@ typedef myfont_table_vhea_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_vhea(struct myfont_font *mf);
|
mystatus_t myfont_load_table_vhea(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "myfont/vmtx.h"
|
#include "myfont/vmtx.h"
|
||||||
|
|
||||||
mystatus_t myfont_load_table_vmtx(myfont_font_t *mf)
|
mystatus_t myfont_load_table_vmtx(myfont_font_t* mf, uint8_t* font_data, size_t data_size)
|
||||||
{
|
{
|
||||||
memset(&mf->table_vmtx, 0, sizeof(myfont_table_vmtx_t));
|
memset(&mf->table_vmtx, 0, sizeof(myfont_table_vmtx_t));
|
||||||
|
|
||||||
@ -31,14 +31,14 @@ mystatus_t myfont_load_table_vmtx(myfont_font_t *mf)
|
|||||||
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_vmtx];
|
const uint32_t table_offset = mf->cache.tables_offset[MyFONT_TKEY_vmtx];
|
||||||
|
|
||||||
/* get current data */
|
/* get current data */
|
||||||
uint8_t *data = &mf->file_data[table_offset];
|
uint8_t *data = &font_data[table_offset];
|
||||||
uint16_t num_metrics = mf->table_vhea.numOfLongVerMetrics;
|
uint16_t num_metrics = mf->table_vhea.numOfLongVerMetrics;
|
||||||
|
|
||||||
if(num_metrics == 0)
|
if(num_metrics == 0)
|
||||||
return MyFONT_STATUS_OK;
|
return MyFONT_STATUS_OK;
|
||||||
|
|
||||||
uint32_t pos = table_offset + (num_metrics * 4);
|
uint32_t pos = table_offset + (num_metrics * 4);
|
||||||
if(pos > mf->file_size)
|
if(pos > data_size)
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
|
|
||||||
myfont_long_ver_metric_t *lver_metric = (myfont_long_ver_metric_t *)myfont_calloc(mf, num_metrics, sizeof(myfont_long_ver_metric_t));
|
myfont_long_ver_metric_t *lver_metric = (myfont_long_ver_metric_t *)myfont_calloc(mf, num_metrics, sizeof(myfont_long_ver_metric_t));
|
||||||
@ -60,7 +60,7 @@ mystatus_t myfont_load_table_vmtx(myfont_font_t *mf)
|
|||||||
|
|
||||||
pos = pos + (numOfTSB * 2);
|
pos = pos + (numOfTSB * 2);
|
||||||
|
|
||||||
if(pos > mf->file_size) {
|
if(pos > data_size) {
|
||||||
myfont_free(mf, lver_metric);
|
myfont_free(mf, lver_metric);
|
||||||
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
return MyFONT_STATUS_ERROR_TABLE_UNEXPECTED_ENDING;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ typedef myfont_table_vmtx_t;
|
|||||||
|
|
||||||
struct myfont_font;
|
struct myfont_font;
|
||||||
|
|
||||||
mystatus_t myfont_load_table_vmtx(struct myfont_font *mf);
|
mystatus_t myfont_load_table_vmtx(myfont_font_t* mf, uint8_t* data, size_t data_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -215,7 +215,10 @@ void myhtml_serialization_node_append_text_node(myhtml_tree_node_t* node, mycore
|
|||||||
{
|
{
|
||||||
if(node->token == NULL || node->token->str.data == NULL) return;
|
if(node->token == NULL || node->token->str.data == NULL) return;
|
||||||
|
|
||||||
if(node->parent == NULL) return myhtml_serialization_append(node->token->str.data, node->token->str.length, callback, ptr);
|
if(node->parent == NULL) {
|
||||||
|
myhtml_serialization_append(node->token->str.data, node->token->str.length, callback, ptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (node->parent->tag_id) {
|
switch (node->parent->tag_id) {
|
||||||
case MyHTML_TAG_STYLE:
|
case MyHTML_TAG_STYLE:
|
||||||
|
@ -55,7 +55,7 @@ int mycore_ferror(FILE *stream)
|
|||||||
/* setbuf */
|
/* setbuf */
|
||||||
void mycore_setbuf(FILE *restrict stream, char *restrict buffer)
|
void mycore_setbuf(FILE *restrict stream, char *restrict buffer)
|
||||||
{
|
{
|
||||||
return setbuf(stream, buffer);
|
setbuf(stream, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* For all unix system. POSIX pthread
|
* For all unix system. POSIX pthread
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
***********************************************************************************/
|
||||||
void * mythread_thread_create(mythread_t *mythread, void* process_func, void* ctx)
|
void * mythread_thread_create(mythread_t *mythread, mythread_process_f process_func, void* ctx)
|
||||||
{
|
{
|
||||||
void *thread = mycore_calloc(1, sizeof(pthread_t));
|
void *thread = mycore_calloc(1, sizeof(pthread_t));
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* For Windows
|
* For Windows
|
||||||
*
|
*
|
||||||
***********************************************************************************/
|
***********************************************************************************/
|
||||||
void * mythread_thread_create(mythread_t *mythread, void* process_func, void* ctx)
|
void * mythread_thread_create(mythread_t *mythread, mythread_process_f process_func, void* ctx)
|
||||||
{
|
{
|
||||||
return CreateThread(NULL, // default security attributes
|
return CreateThread(NULL, // default security attributes
|
||||||
0, // use default stack size
|
0, // use default stack size
|
||||||
|
@ -41,10 +41,10 @@ mystatus_t myurl_host_init(myurl_t* url)
|
|||||||
void myurl_host_clean(myurl_t* url, myurl_host_t* host)
|
void myurl_host_clean(myurl_t* url, myurl_host_t* host)
|
||||||
{
|
{
|
||||||
if(host->type == MyURL_HOST_TYPE_DOMAIN)
|
if(host->type == MyURL_HOST_TYPE_DOMAIN)
|
||||||
url->callback_free(host->domain.value, url->callback_ctx);
|
url->callback_free(host->value.domain.value, url->callback_ctx);
|
||||||
|
|
||||||
if(host->type == MyURL_HOST_TYPE_OPAQUE)
|
if(host->type == MyURL_HOST_TYPE_OPAQUE)
|
||||||
url->callback_free(host->opaque.value, url->callback_ctx);
|
url->callback_free(host->value.opaque.value, url->callback_ctx);
|
||||||
|
|
||||||
memset(host, 0, sizeof(myurl_host_t));
|
memset(host, 0, sizeof(myurl_host_t));
|
||||||
}
|
}
|
||||||
@ -69,8 +69,8 @@ mystatus_t myurl_host_copy(myurl_t* url, myurl_host_t* host_from, myurl_host_t*
|
|||||||
|
|
||||||
switch (host_from->type) {
|
switch (host_from->type) {
|
||||||
case MyURL_HOST_TYPE_DOMAIN:
|
case MyURL_HOST_TYPE_DOMAIN:
|
||||||
return myurl_utils_data_copy_set(url, host_from->domain.value, host_from->domain.length,
|
return myurl_utils_data_copy_set(url, host_from->value.domain.value, host_from->value.domain.length,
|
||||||
&host_to->domain.value, &host_to->domain.length);
|
&host_to->value.domain.value, &host_to->value.domain.length);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -105,13 +105,13 @@ mystatus_t myurl_host_parser(myurl_t* url, myurl_host_t* host, const char* data,
|
|||||||
data_length++;
|
data_length++;
|
||||||
|
|
||||||
host->type = MyURL_HOST_TYPE_IPv6;
|
host->type = MyURL_HOST_TYPE_IPv6;
|
||||||
return myurl_host_ipv6_parser(&host->ipv, &data[data_length], (data_size - 2));
|
return myurl_host_ipv6_parser(&host->value.ipv, &data[data_length], (data_size - 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 */
|
/* 2 */
|
||||||
if(is_special == false) {
|
if(is_special == false) {
|
||||||
host->type = MyURL_HOST_TYPE_OPAQUE;
|
host->type = MyURL_HOST_TYPE_OPAQUE;
|
||||||
return myurl_host_opaque_host_parser(url, &host->opaque, data, data_size);
|
return myurl_host_opaque_host_parser(url, &host->value.opaque, data, data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 3 */
|
/* 3 */
|
||||||
@ -144,7 +144,7 @@ mystatus_t myurl_host_parser(myurl_t* url, myurl_host_t* host, const char* data,
|
|||||||
|
|
||||||
/* 7 */
|
/* 7 */
|
||||||
bool failure;
|
bool failure;
|
||||||
if(myurl_host_ipv4_parser(&host->ipv, ascii_domain, ascii_domain_size, &failure) == MyURL_STATUS_OK) {
|
if(myurl_host_ipv4_parser(&host->value.ipv, ascii_domain, ascii_domain_size, &failure) == MyURL_STATUS_OK) {
|
||||||
url->callback_free(ascii_domain, url->callback_ctx);
|
url->callback_free(ascii_domain, url->callback_ctx);
|
||||||
|
|
||||||
host->type = MyURL_HOST_TYPE_IPv4;
|
host->type = MyURL_HOST_TYPE_IPv4;
|
||||||
@ -158,8 +158,8 @@ mystatus_t myurl_host_parser(myurl_t* url, myurl_host_t* host, const char* data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
host->type = MyURL_HOST_TYPE_DOMAIN;
|
host->type = MyURL_HOST_TYPE_DOMAIN;
|
||||||
host->domain.value = ascii_domain;
|
host->value.domain.value = ascii_domain;
|
||||||
host->domain.length = ascii_domain_size;
|
host->value.domain.length = ascii_domain_size;
|
||||||
|
|
||||||
return MyURL_STATUS_OK;
|
return MyURL_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ struct myurl_host {
|
|||||||
myurl_host_ipv_t ipv;
|
myurl_host_ipv_t ipv;
|
||||||
myurl_host_opaque_t opaque;
|
myurl_host_opaque_t opaque;
|
||||||
myurl_host_domain_t domain;
|
myurl_host_domain_t domain;
|
||||||
};
|
} value;
|
||||||
|
|
||||||
myurl_host_type_t type;
|
myurl_host_type_t type;
|
||||||
}
|
}
|
||||||
|
@ -176,8 +176,8 @@ size_t myurl_parser_state_file_host_end(myurl_t* url, myurl_entry_t* url_entry,
|
|||||||
|
|
||||||
/* 1.3.3 */
|
/* 1.3.3 */
|
||||||
if(url_entry->host.type == MyURL_HOST_TYPE_DOMAIN &&
|
if(url_entry->host.type == MyURL_HOST_TYPE_DOMAIN &&
|
||||||
url_entry->host.domain.length == 9 &&
|
url_entry->host.value.domain.length == 9 &&
|
||||||
mycore_strncasecmp("localhost", url_entry->host.domain.value, url_entry->host.domain.length) == 0)
|
mycore_strncasecmp("localhost", url_entry->host.value.domain.value, url_entry->host.value.domain.length) == 0)
|
||||||
{
|
{
|
||||||
myurl_host_clean(url, &url_entry->host);
|
myurl_host_clean(url, &url_entry->host);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ void myurl_serialization_host(myurl_entry_t* url_entry, mycore_callback_serializ
|
|||||||
{
|
{
|
||||||
switch (url_entry->host.type) {
|
switch (url_entry->host.type) {
|
||||||
case MyURL_HOST_TYPE_DOMAIN:
|
case MyURL_HOST_TYPE_DOMAIN:
|
||||||
callback(url_entry->host.domain.value, url_entry->host.domain.length, ctx);
|
callback(url_entry->host.value.domain.value, url_entry->host.value.domain.length, ctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MyURL_HOST_TYPE_IPv4: {
|
case MyURL_HOST_TYPE_IPv4: {
|
||||||
@ -35,7 +35,7 @@ void myurl_serialization_host(myurl_entry_t* url_entry, mycore_callback_serializ
|
|||||||
size_t ipv4_length = 12 + 4;
|
size_t ipv4_length = 12 + 4;
|
||||||
size_t digit_size = 0;
|
size_t digit_size = 0;
|
||||||
|
|
||||||
unsigned int n = url_entry->host.ipv.pieces[0];
|
unsigned int n = url_entry->host.value.ipv.pieces[0];
|
||||||
|
|
||||||
for(size_t i = 0; i < 4; i++)
|
for(size_t i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ void myurl_serialization_host(myurl_entry_t* url_entry, mycore_callback_serializ
|
|||||||
callback("[", 1, ctx);
|
callback("[", 1, ctx);
|
||||||
|
|
||||||
/* 1 */
|
/* 1 */
|
||||||
unsigned int *pieces = url_entry->host.ipv.pieces;
|
unsigned int *pieces = url_entry->host.value.ipv.pieces;
|
||||||
unsigned int *compress_pointer = NULL;
|
unsigned int *compress_pointer = NULL;
|
||||||
|
|
||||||
char buffer[128] = {0};
|
char buffer[128] = {0};
|
||||||
@ -114,7 +114,7 @@ void myurl_serialization_host(myurl_entry_t* url_entry, mycore_callback_serializ
|
|||||||
}
|
}
|
||||||
|
|
||||||
case MyURL_HOST_TYPE_OPAQUE:
|
case MyURL_HOST_TYPE_OPAQUE:
|
||||||
callback(url_entry->host.opaque.value, url_entry->host.opaque.length, ctx);
|
callback(url_entry->host.value.opaque.value, url_entry->host.value.opaque.length, ctx);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -327,9 +327,9 @@ const char * myurl_entry_host_domain(myurl_entry_t* url_entry, size_t *length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(length)
|
if(length)
|
||||||
*length = url_entry->host.domain.length;
|
*length = url_entry->host.value.domain.length;
|
||||||
|
|
||||||
return url_entry->host.domain.value;
|
return url_entry->host.value.domain.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * myurl_entry_host_opaque(myurl_entry_t* url_entry, size_t *length)
|
const char * myurl_entry_host_opaque(myurl_entry_t* url_entry, size_t *length)
|
||||||
@ -342,9 +342,9 @@ const char * myurl_entry_host_opaque(myurl_entry_t* url_entry, size_t *length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(length)
|
if(length)
|
||||||
*length = url_entry->host.opaque.length;
|
*length = url_entry->host.value.opaque.length;
|
||||||
|
|
||||||
return url_entry->host.opaque.value;
|
return url_entry->host.value.opaque.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int myurl_entry_host_ipv4(myurl_entry_t* url_entry)
|
unsigned int myurl_entry_host_ipv4(myurl_entry_t* url_entry)
|
||||||
@ -352,7 +352,7 @@ unsigned int myurl_entry_host_ipv4(myurl_entry_t* url_entry)
|
|||||||
if(url_entry->host.type != MyURL_HOST_TYPE_IPv4)
|
if(url_entry->host.type != MyURL_HOST_TYPE_IPv4)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return url_entry->host.ipv.pieces[0];
|
return url_entry->host.value.ipv.pieces[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int * myurl_entry_host_ipv6(myurl_entry_t* url_entry)
|
unsigned int * myurl_entry_host_ipv6(myurl_entry_t* url_entry)
|
||||||
@ -360,7 +360,7 @@ unsigned int * myurl_entry_host_ipv6(myurl_entry_t* url_entry)
|
|||||||
if(url_entry->host.type != MyURL_HOST_TYPE_IPv6)
|
if(url_entry->host.type != MyURL_HOST_TYPE_IPv6)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return url_entry->host.ipv.pieces;
|
return url_entry->host.value.ipv.pieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* port */
|
/* port */
|
||||||
@ -494,7 +494,9 @@ mystatus_t myurl_entry_host_set(myurl_entry_t* url_entry, const char* host, size
|
|||||||
if(url_entry->url_ref == NULL)
|
if(url_entry->url_ref == NULL)
|
||||||
return MyURL_STATUS_ERROR;
|
return MyURL_STATUS_ERROR;
|
||||||
|
|
||||||
myurl_host_t new_host = {{}, 0};
|
myurl_host_t new_host;
|
||||||
|
memset(&new_host, 0, sizeof(myurl_host_t));
|
||||||
|
|
||||||
mystatus_t status = myurl_host_parser(url_entry->url_ref, &new_host, host, length, (url_entry->scheme.type & MyURL_SCHEME_TYPE_SPECIAL));
|
mystatus_t status = myurl_host_parser(url_entry->url_ref, &new_host, host, length, (url_entry->scheme.type & MyURL_SCHEME_TYPE_SPECIAL));
|
||||||
|
|
||||||
if(status)
|
if(status)
|
||||||
|
111
test/Makefile
111
test/Makefile
@ -1,54 +1,89 @@
|
|||||||
TARGET := test
|
TARGET := test
|
||||||
SRCDIR := test
|
SRCDIR := .
|
||||||
|
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
LIBS := ../lib/libmodest_static.a
|
|
||||||
LDLIBS := $(LIBS)
|
|
||||||
|
|
||||||
INCLUDE_TMP := include
|
# ARGS
|
||||||
|
#
|
||||||
|
# BINARY_OPTIMIZATION_LEVEL, default -O2
|
||||||
|
# MODEST_BUILD_WITHOUT_THREADS, YES or (NO or undefined), default undefined
|
||||||
|
#
|
||||||
|
|
||||||
MODEST_OPTIMIZATION_LEVEL ?= -O2
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
CFLAGS ?= -Wall -Werror
|
#********************
|
||||||
CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -Wno-unused-variable --std=c99 -I../include
|
# other Makefile
|
||||||
|
#***************
|
||||||
|
BINARY_PATH_RELATIVE := ..
|
||||||
|
include $(BINARY_PATH_RELATIVE)/Makefile.bin.cfg
|
||||||
|
|
||||||
ifneq ($(OS),Windows_NT)
|
BINARY_TO_DIR := $(BINARY_PATH_RELATIVE)/$(TEST_DIR_BASE)
|
||||||
CFLAGS += -fPIC
|
TEST_DIR_RELATIVE := $(BINARY_PATH_RELATIVE)/$(TEST_DIR)
|
||||||
endif
|
|
||||||
|
|
||||||
MODEST_BUILD_WITHOUT_THREADS ?= NO
|
#********************
|
||||||
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
|
# Build
|
||||||
$(info Build Tests without POSIX Threads)
|
#***************
|
||||||
else
|
BINARY_BUILD_MODULES ?= $(dir $(wildcard $(SRCDIR)/*/))
|
||||||
$(info Build Examples with POSIX Threads)
|
BINARY_BUILD_MODULES_LIST := $(strip $(foreach dir,$(BINARY_BUILD_MODULES),$(word 2, $(subst $(MODEST_DIR_SEPARATOR), , $(dir))) ))
|
||||||
CFLAGS += -pthread
|
BINARY_BUILD_MODULES_MAKEFILES_LIST := $(foreach dir,$(BINARY_BUILD_MODULES_LIST),$(dir)/Makefile.mk)
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
#********************
|
||||||
else
|
# Targets
|
||||||
UNAM := $(shell uname -s)
|
#***************
|
||||||
ifeq ($(UNAM),Darwin)
|
BINARY_BUILD_MODULES_TARGET := $(BINARY_BUILD_MODULES_LIST)
|
||||||
else
|
BINARY_BUILD_MODULES_TARGET_ALL := $(foreach dir,$(BINARY_BUILD_MODULES_TARGET),$(dir)_all)
|
||||||
CFLAGS += -D_POSIX_C_SOURCE=199309L
|
BINARY_BUILD_MODULES_TARGET_CLEAN := $(foreach dir,$(BINARY_BUILD_MODULES_TARGET),$(dir)_clean)
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
find_files_h = $(wildcard $(dir)/*.h)
|
#********************
|
||||||
find_files_c = $(wildcard $(dir)/*.c)
|
# Utils
|
||||||
|
#***************
|
||||||
|
define BYNARY_UTILS_NEW_LINE
|
||||||
|
|
||||||
SUBDIRS := mycss myhtml myhtml/utils
|
|
||||||
HDRS += $(foreach dir,$(SUBDIRS),$(find_files_h))
|
|
||||||
SRCS += $(foreach dir,$(SUBDIRS),$(find_files_c))
|
|
||||||
#SRCS_FN += $(foreach dir,$(SUBDIRS),$(notdir $(find_files_c)))
|
|
||||||
|
|
||||||
OBJS := $(patsubst %.c,%,$(SRCS))
|
endef
|
||||||
#OBJS_RM := $(patsubst %.c,%,$(SRCS_FN))
|
BINARY_UTILS_OBJS = $(patsubst %.c,%,$(foreach dir,$2,$(wildcard $(SRCDIR)/$1/$(dir)/*.c)))
|
||||||
|
BINARY_UTILS_CREATE_DIR = mkdir -p $(BINARY_TO_DIR)/$(subst /.,,$1) $(BYNARY_UTILS_NEW_LINE)
|
||||||
|
BINARY_UTILS_CREATE_DIRS = $(foreach dir,$(BINARY_BUILD_MODULES_LIST),$(foreach path,$($(dir)_dirs),$(call BINARY_UTILS_CREATE_DIR,$(dir)/$(path))))
|
||||||
|
|
||||||
all: $(TARGET)
|
#********************
|
||||||
|
# Include all modules Makefile.mk
|
||||||
|
#***************
|
||||||
|
include $(BINARY_BUILD_MODULES_MAKEFILES_LIST)
|
||||||
|
|
||||||
$(TARGET): $(OBJS)
|
#********************
|
||||||
|
# Set ARGS for flags
|
||||||
|
#***************
|
||||||
|
CFLAGS += $(BINARY_CFLAGS)
|
||||||
|
LDFLAGS += $(BINARY_LDFLAGS)
|
||||||
|
LDLIBS += $(BINARY_LIBRARIES)
|
||||||
|
|
||||||
clean:
|
#********************
|
||||||
rm -f $(OBJS)
|
# Objects
|
||||||
|
#***************
|
||||||
|
BINARY_BUILD_EXECUTE ?= $(foreach dir,$(BINARY_BUILD_MODULES_TARGET),$($(dir)_objs))
|
||||||
|
BINARY_BUILD_EXECUTE_CLEAN := $(foreach path,$(BINARY_BUILD_EXECUTE),$(subst ./,,$(path)))
|
||||||
|
BINARY_BUILD_EXECUTE_TO_CLEAN := $(foreach path,$(BINARY_BUILD_EXECUTE_CLEAN),rm -f $(BINARY_TO_DIR)/$(path) $(BYNARY_UTILS_NEW_LINE))
|
||||||
|
BINARY_BUILD_DIRS_TO_CLEAN := $(foreach path,$(BINARY_BUILD_MODULES_LIST),rm -rf $(BINARY_TO_DIR)/$(path) $(BYNARY_UTILS_NEW_LINE))
|
||||||
|
BINARY_BUILD_EXECUTE_COPY := $(foreach path,$(BINARY_BUILD_EXECUTE_CLEAN),cp $(path) $(BINARY_TO_DIR)/$(dir $(path)) $(BYNARY_UTILS_NEW_LINE))
|
||||||
|
BINARY_BUILD_EXECUTE_COPY_ALL := $(BINARY_UTILS_CREATE_DIRS) $(BINARY_BUILD_EXECUTE_COPY)
|
||||||
|
BINARY_BUILD_RUN_ALL_TEST := $(foreach dir,$(BINARY_BUILD_EXECUTE_CLEAN),$(dir) $($(word 1,$(subst /, ,$(dir)))_$(notdir $(dir))) $(BYNARY_UTILS_NEW_LINE))
|
||||||
|
|
||||||
.PHONY: all
|
#********************
|
||||||
|
# Target options
|
||||||
|
#***************
|
||||||
|
all: build
|
||||||
|
$(BINARY_BUILD_EXECUTE_COPY_ALL)
|
||||||
|
|
||||||
|
build: $(BINARY_BUILD_EXECUTE_CLEAN)
|
||||||
|
|
||||||
|
clean: $(BINARY_BUILD_MODULES_TARGET_CLEAN)
|
||||||
|
$(BINARY_BUILD_EXECUTE_TO_CLEAN)
|
||||||
|
$(BINARY_BUILD_DIRS_TO_CLEAN)
|
||||||
|
|
||||||
|
copy:
|
||||||
|
$(BINARY_BUILD_EXECUTE_COPY_ALL)
|
||||||
|
|
||||||
|
run: all
|
||||||
|
$(BINARY_BUILD_RUN_ALL_TEST)
|
||||||
|
|
||||||
|
.PHONY: all copy clean $(BINARY_BUILD_MODULES_TARGET_ALL)
|
||||||
|
7
test/mycore/Makefile.mk
Normal file
7
test/mycore/Makefile.mk
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
mycore_dirs := utils
|
||||||
|
mycore_objs := $(call BINARY_UTILS_OBJS,mycore,$(mycore_dirs))
|
||||||
|
|
||||||
|
mycore_all: $(mycore_objs)
|
||||||
|
|
||||||
|
mycore_clean:
|
||||||
|
rm -f $(mycore_objs)
|
9
test/mycss/Makefile.mk
Normal file
9
test/mycss/Makefile.mk
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
mycss_dirs := .
|
||||||
|
mycss_objs := $(call BINARY_UTILS_OBJS,mycss,$(mycss_dirs))
|
||||||
|
|
||||||
|
mycss_all: $(mycss_objs)
|
||||||
|
|
||||||
|
mycss_clean:
|
||||||
|
rm -f $(mycss_objs)
|
||||||
|
|
||||||
|
mycss_declaration := $(TEST_DIR_RELATIVE)/mycss/data/declaration
|
@ -90,7 +90,7 @@ test_res_t test_load_file(const char* filename)
|
|||||||
|
|
||||||
size_t nread = fread(file_data, 1, size, fh);
|
size_t nread = fread(file_data, 1, size, fh);
|
||||||
if (nread != size) {
|
if (nread != size) {
|
||||||
fprintf(stderr, "Could not read %ld bytes (" MyCORE_FMT_Z " bytes done)\n", size, nread);
|
fprintf(stderr, "Could not read %ld bytes (" MyCORE_FORMAT_Z " bytes done)\n", size, nread);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ test_stat_t test_read_dir(const char* dir_path, test_read_dir_callback_f callbac
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
result_stat.total++;
|
result_stat.total++;
|
||||||
printf(MyCORE_FMT_Z ") %s: ", result_stat.total, ent->d_name);
|
printf(MyCORE_FORMAT_Z ") %s: ", result_stat.total, ent->d_name);
|
||||||
|
|
||||||
if(callback(path, (strlen(ent->d_name) + path_len + 1), context)) {
|
if(callback(path, (strlen(ent->d_name) + path_len + 1), context)) {
|
||||||
result_stat.good++;
|
result_stat.good++;
|
||||||
@ -283,7 +283,7 @@ bool test_process_callback(const char* filename, size_t filename_len, void* cont
|
|||||||
printf("\tResult: ");
|
printf("\tResult: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("count(" MyCORE_FMT_Z ") good(" MyCORE_FMT_Z ") bad(" MyCORE_FMT_Z ")\n", result_stat.total, result_stat.good, (result_stat.total - result_stat.good));
|
printf("count(" MyCORE_FORMAT_Z ") good(" MyCORE_FORMAT_Z ") bad(" MyCORE_FORMAT_Z ")\n", result_stat.total, result_stat.good, (result_stat.total - result_stat.good));
|
||||||
|
|
||||||
test_data->stat.good += result_stat.good;
|
test_data->stat.good += result_stat.good;
|
||||||
test_data->stat.total += result_stat.total;
|
test_data->stat.total += result_stat.total;
|
||||||
@ -398,7 +398,7 @@ int main(int argc, const char * argv[])
|
|||||||
test_read_dir(argv[1], test_process_callback, &test_data);
|
test_read_dir(argv[1], test_process_callback, &test_data);
|
||||||
|
|
||||||
size_t bad_count = (test_data.stat.total - test_data.stat.good);
|
size_t bad_count = (test_data.stat.total - test_data.stat.good);
|
||||||
printf("\nTotal: " MyCORE_FMT_Z "; Good: " MyCORE_FMT_Z "; Bad: " MyCORE_FMT_Z "\n", test_data.stat.total, test_data.stat.good, bad_count);
|
printf("\nTotal: " MyCORE_FORMAT_Z "; Good: " MyCORE_FORMAT_Z "; Bad: " MyCORE_FORMAT_Z "\n", test_data.stat.total, test_data.stat.good, bad_count);
|
||||||
|
|
||||||
test_declaration_destroy_myhtml(test_data.tree);
|
test_declaration_destroy_myhtml(test_data.tree);
|
||||||
test_declaration_destroy_mycss(test_data.entry);
|
test_declaration_destroy_mycss(test_data.entry);
|
||||||
|
9
test/myencoding/Makefile.mk
Normal file
9
test/myencoding/Makefile.mk
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
myencoding_dirs := .
|
||||||
|
myencoding_objs := $(call BINARY_UTILS_OBJS,myencoding,$(myencoding_dirs))
|
||||||
|
|
||||||
|
myencoding_all: $(myencoding_objs)
|
||||||
|
|
||||||
|
myencoding_clean:
|
||||||
|
rm -f $(myencoding_objs)
|
||||||
|
|
||||||
|
myencoding_encoding_detect_meta := $(TEST_DIR_RELATIVE)/myencoding/data/encoding/detect_meta.html
|
736
test/myencoding/data/encoding/detect_meta.html
Normal file
736
test/myencoding/data/encoding/detect_meta.html
Normal file
@ -0,0 +1,736 @@
|
|||||||
|
koi8-r
|
||||||
|
<meta http-equiv="content-type" Content="text/html; charset=koi8-r">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv="CONTENT-TyPe" Content="text/html; charset=koi8-r">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv=CONTENT-TyPe Content="text/html; charset=koi8-r">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv=CONTENT-TyPe Content=charset=utf8>
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv=CONTENT-TyPe Content=lalalatextbeforecharcharset=utf8>
|
||||||
|
|
||||||
|
windows-1251
|
||||||
|
<meta key=value ns="bm" key-f='value some as value' / ddd = fff ddd = f = ff
|
||||||
|
http-equiv="content-Type" Content="text/html; charset=Windows-1251">
|
||||||
|
|
||||||
|
windows-1251
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=Windows-1251">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=utf-8">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=utf8">
|
||||||
|
|
||||||
|
WINDOWS-1252
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=X-USER-DEFINED">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=utf-16LE">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=UtF-8">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="content-Type" Content="text/htmlcharset=UtF-8">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="content-Type" Content="charset=UtF-8">
|
||||||
|
|
||||||
|
not-determined
|
||||||
|
<meta http-equiv="content-Type" Content="charset UtF-8">
|
||||||
|
|
||||||
|
not-determined
|
||||||
|
<meta http-equiv="content-Type" Content="charset=UtF">
|
||||||
|
|
||||||
|
not-determined
|
||||||
|
<meta http-equiv="content-Type" Content="utf-8">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="content-Type" Content="charset = ibm866">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="content-Type" Content=" charset = ibm866">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="content-Type" Content=" charset =ibm866">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="content-Type" Content=" charset= ibm866">
|
||||||
|
|
||||||
|
ISO-2022-JP
|
||||||
|
<meta http-equiv="content-Type" Content="
|
||||||
|
charset
|
||||||
|
=
|
||||||
|
IsO-2022-JP">
|
||||||
|
|
||||||
|
ISO-2022-JP
|
||||||
|
<meta http-equiv="content-Type" Content="text/html;
|
||||||
|
charset
|
||||||
|
=
|
||||||
|
IsO-2022-JP">
|
||||||
|
|
||||||
|
EUC-JP
|
||||||
|
<meta http-equiv="content-Type" Content="text/html; charset=EUC-JP">
|
||||||
|
|
||||||
|
not-determined
|
||||||
|
<meta http-equiv="content-Type blah" Content="text/html; charset=EUC-JP">
|
||||||
|
|
||||||
|
EUC-KR
|
||||||
|
<meta http-equiv="content-Type" Content="blah blah blah/mu mu mu;
|
||||||
|
charset
|
||||||
|
=
|
||||||
|
EUC-KR">
|
||||||
|
|
||||||
|
EUC-KR
|
||||||
|
<meta http-equiv="content-Type" Content="text/html;
|
||||||
|
charset
|
||||||
|
=
|
||||||
|
EUC-KR;">
|
||||||
|
|
||||||
|
SHIFT_JIS
|
||||||
|
<meta http-equiv="content-Type" Content="text/html">
|
||||||
|
<meta http-equiv="content-Type" Content="charset=SHIFT-JIS">
|
||||||
|
|
||||||
|
windows-874
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=tis-620">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88592">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88593">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88594">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=sjis">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88595">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88596">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso885910">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-3">
|
||||||
|
|
||||||
|
iso-8859-13
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso885913">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l1">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-9:1989">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatinarabic">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88597">
|
||||||
|
|
||||||
|
macintosh
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=mac">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88598">
|
||||||
|
|
||||||
|
windows-1251
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1251">
|
||||||
|
|
||||||
|
koi8-u
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=koi8-u">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88599">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ecma-114">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-4">
|
||||||
|
|
||||||
|
iso-8859-14
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso885914">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-110">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-10">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-100">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l3">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-2">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-2">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-8">
|
||||||
|
|
||||||
|
macintosh
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csmacintosh">
|
||||||
|
|
||||||
|
windows-1253
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1253">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-58">
|
||||||
|
|
||||||
|
windows-1258
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1258">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-4">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-4">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-144">
|
||||||
|
|
||||||
|
iso-8859-14
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-14">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-10">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-6">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-6">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-126">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l5">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=latin2">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-8">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-138">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-8">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-148">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp819">
|
||||||
|
|
||||||
|
iso-8859-14
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-14">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin6">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin1">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ms932">
|
||||||
|
|
||||||
|
iso-8859-15
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l9">
|
||||||
|
|
||||||
|
windows-1258
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1258">
|
||||||
|
|
||||||
|
windows-1256
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1256">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=gb_2312">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1252">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=sun_eu_greek">
|
||||||
|
|
||||||
|
euc-jp
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cseucpkdfmtjapanese">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=latin4">
|
||||||
|
|
||||||
|
big5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-x-big5">
|
||||||
|
|
||||||
|
windows-1255
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1255">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=koi">
|
||||||
|
|
||||||
|
windows-1257
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1257">
|
||||||
|
|
||||||
|
windows-874
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-874">
|
||||||
|
|
||||||
|
windows-1251
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1251">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=utf-16">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatincyrillic">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-7">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=visual">
|
||||||
|
|
||||||
|
macintosh
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=macintosh">
|
||||||
|
|
||||||
|
windows-1250
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1250">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=chinese">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ansi_x3.4-1968">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-3:1988">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-4:1988">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-5:1988">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-8:1988">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csiso88596e">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csiso88598e">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csgb2312">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=arabic">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=latin6">
|
||||||
|
|
||||||
|
windows-874
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso885911">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-1">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=greek">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ms_kanji">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-5">
|
||||||
|
|
||||||
|
iso-8859-15
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso885915">
|
||||||
|
|
||||||
|
macintosh
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-mac-roman">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ascii">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=korean">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cseuckr">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=utf8">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cskoi8r">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin3">
|
||||||
|
|
||||||
|
windows-1256
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1256">
|
||||||
|
|
||||||
|
x-mac-cyrillic
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-mac-ukrainian">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-9">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=us-ascii">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1252">
|
||||||
|
|
||||||
|
iso-8859-13
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-13">
|
||||||
|
|
||||||
|
big5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=big5">
|
||||||
|
|
||||||
|
windows-1250
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1250">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ksc5601">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=greek8">
|
||||||
|
|
||||||
|
gb18030
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=gb18030">
|
||||||
|
|
||||||
|
euc-jp
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-euc-jp">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-sjis">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=utf-16be">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=utf-16le">
|
||||||
|
|
||||||
|
windows-1255
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1255">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ks_c_5601-1987">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=866">
|
||||||
|
|
||||||
|
big5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cn-big5">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=koi8_r">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=koi8-r">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ibm819">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=shift_jis">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=shift-jis">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=asmo-708">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csshiftjis">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1254">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-6-e">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-8-e">
|
||||||
|
|
||||||
|
windows-1256
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1256">
|
||||||
|
|
||||||
|
iso-2022-jp
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-2022-jp">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csibm866">
|
||||||
|
|
||||||
|
windows-874
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-11">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-6:1987">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-2:1987">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-7:1987">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-1:1987">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=gb2312">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin5">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-6-i">
|
||||||
|
|
||||||
|
iso-8859-8-i
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-8-i">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-949">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-2">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l2">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=latin1">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ks_c_5601-1989">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-6">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-101">
|
||||||
|
|
||||||
|
windows-874
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-11">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-1">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-1">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp866">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-3">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-3">
|
||||||
|
|
||||||
|
iso-8859-13
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-13">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l4">
|
||||||
|
|
||||||
|
windows-1253
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1253">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-5">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-5">
|
||||||
|
|
||||||
|
iso-8859-15
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso8859-15">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-127">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-7">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-7">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-157">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=unicode-1-1-utf-8">
|
||||||
|
|
||||||
|
iso-8859-10
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=l6">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-149">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-ir-109">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-9">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-9">
|
||||||
|
|
||||||
|
windows-1253
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1253">
|
||||||
|
|
||||||
|
iso-8859-16
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-16">
|
||||||
|
|
||||||
|
windows-1258
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1258">
|
||||||
|
|
||||||
|
iso-8859-8-i
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=logical">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatinhebrew">
|
||||||
|
|
||||||
|
iso-8859-3
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=latin3">
|
||||||
|
|
||||||
|
windows-874
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=dos-874">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=euc-kr">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1252">
|
||||||
|
|
||||||
|
iso-8859-6
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csiso88596i">
|
||||||
|
|
||||||
|
iso-8859-8-i
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csiso88598i">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=gbk">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csksc56011987">
|
||||||
|
|
||||||
|
x-mac-cyrillic
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-mac-cyrillic">
|
||||||
|
|
||||||
|
iso-2022-jp
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csiso2022jp">
|
||||||
|
|
||||||
|
iso-8859-2
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin2">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-user-defined">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=latin5">
|
||||||
|
|
||||||
|
windows-1257
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1257">
|
||||||
|
|
||||||
|
big5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=big5-hkscs">
|
||||||
|
|
||||||
|
windows-1250
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1250">
|
||||||
|
|
||||||
|
euc-jp
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=euc-jp">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=elot_928">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ecma-118">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=gb_2312-80">
|
||||||
|
|
||||||
|
windows-1251
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1251">
|
||||||
|
|
||||||
|
iso-8859-15
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso-8859-15">
|
||||||
|
|
||||||
|
iso-8859-15
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso_8859-15">
|
||||||
|
|
||||||
|
euc-kr
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ksc_5601">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csiso58gb231280">
|
||||||
|
|
||||||
|
iso-8859-5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cyrillic">
|
||||||
|
|
||||||
|
big5
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csbig5">
|
||||||
|
|
||||||
|
windows-1255
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=cp1255">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1254">
|
||||||
|
|
||||||
|
iso-8859-15
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin9">
|
||||||
|
|
||||||
|
koi8-u
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=koi8-ru">
|
||||||
|
|
||||||
|
iso-8859-4
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatin4">
|
||||||
|
|
||||||
|
shift_jis
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-31j">
|
||||||
|
|
||||||
|
windows-1257
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-cp1257">
|
||||||
|
|
||||||
|
utf-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
|
||||||
|
|
||||||
|
ibm866
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=ibm866">
|
||||||
|
|
||||||
|
koi8-r
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=koi8">
|
||||||
|
|
||||||
|
iso-8859-8
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=hebrew">
|
||||||
|
|
||||||
|
windows-1254
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=windows-1254">
|
||||||
|
|
||||||
|
gbk
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=x-gbk">
|
||||||
|
|
||||||
|
iso-8859-7
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=csisolatingreek">
|
||||||
|
|
||||||
|
windows-1252
|
||||||
|
<meta http-equiv="Content-Type" Content="text/html; charset=iso88591">
|
178
test/myencoding/encoding_detect_meta.c
Normal file
178
test/myencoding/encoding_detect_meta.c
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
/*
|
||||||
|
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)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <myhtml/myhtml.h>
|
||||||
|
#include <myencoding/encoding.h>
|
||||||
|
|
||||||
|
struct test_res {
|
||||||
|
char* data;
|
||||||
|
size_t size;
|
||||||
|
}
|
||||||
|
typedef test_res_t;
|
||||||
|
|
||||||
|
test_res_t test_load_file(const char* filename)
|
||||||
|
{
|
||||||
|
FILE *fh = fopen(filename, "rb");
|
||||||
|
if(fh == NULL) {
|
||||||
|
fprintf(stderr, "Can't open file: %s\n", filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(fseek(fh, 0L, SEEK_END) != 0) {
|
||||||
|
fprintf(stderr, "Can't set position (fseek) in file: %s\n", filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
long size = ftell(fh);
|
||||||
|
|
||||||
|
if(fseek(fh, 0L, SEEK_SET) != 0) {
|
||||||
|
fprintf(stderr, "Can't set position (fseek) in file: %s\n", filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(size <= 0) {
|
||||||
|
fprintf(stderr, "Can't get file size or file is empty: %s\n", filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *file_data = (char*)malloc(size + 1);
|
||||||
|
if(file_data == NULL) {
|
||||||
|
fprintf(stderr, "Can't allocate mem for file: %s\n", filename);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t nread = fread(file_data, 1, size, fh);
|
||||||
|
if (nread != size) {
|
||||||
|
fprintf(stderr, "Could not read %ld bytes (" MyCORE_FORMAT_Z " bytes done)\n", size, nread);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fh);
|
||||||
|
|
||||||
|
return (test_res_t){file_data, (size_t)size};
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t test_skip_whitespace(const unsigned char *udata, size_t length, size_t data_size)
|
||||||
|
{
|
||||||
|
while(length < data_size) {
|
||||||
|
if(udata[length] != 0x09 && udata[length] != 0x0A && udata[length] != 0x0C && udata[length] != 0x0D && udata[length] != 0x20) {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
length++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t test_skip_not_whitespace(const unsigned char *udata, size_t length, size_t data_size)
|
||||||
|
{
|
||||||
|
while(length < data_size) {
|
||||||
|
if(udata[length] == 0x09 || udata[length] == 0x0A || udata[length] == 0x0C || udata[length] == 0x0D || udata[length] == 0x20) {
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
length++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t test_find_body_end(const unsigned char *udata, size_t length, size_t data_size)
|
||||||
|
{
|
||||||
|
while((length + 1) < data_size) {
|
||||||
|
if(udata[length] == 0x0A && udata[(length + 1)] == 0x0A) {
|
||||||
|
return (length + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
length++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return data_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_entries(const char* filename)
|
||||||
|
{
|
||||||
|
size_t length = 0;
|
||||||
|
test_res_t test_data = test_load_file(filename);
|
||||||
|
|
||||||
|
size_t code_begin = 0, code_length = 0;
|
||||||
|
size_t body_begin = 0;
|
||||||
|
|
||||||
|
myencoding_t encoding;
|
||||||
|
const unsigned char *udata = (const unsigned char*)test_data.data;
|
||||||
|
|
||||||
|
printf("Test, get encoding from <meta ...> element:\n");
|
||||||
|
|
||||||
|
while(length < test_data.size)
|
||||||
|
{
|
||||||
|
/* Find Encoding in Test Header */
|
||||||
|
/* skip ws */
|
||||||
|
length = code_begin = test_skip_whitespace(udata, length, test_data.size);
|
||||||
|
|
||||||
|
if(length >= test_data.size)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* find ws */
|
||||||
|
length = test_skip_not_whitespace(udata, length, test_data.size);
|
||||||
|
code_length = length - code_begin;
|
||||||
|
|
||||||
|
if(strncmp("not-determined", &test_data.data[code_begin], strlen("not-determined")) == 0) {
|
||||||
|
encoding = MyENCODING_NOT_DETERMINED;
|
||||||
|
}
|
||||||
|
else if(myencoding_by_name(&test_data.data[code_begin], code_length, &encoding) == false) {
|
||||||
|
fprintf(stderr, "Can't get encoding from test header: %.*s\n", (int)code_length, &test_data.data[code_begin]);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find Test Data */
|
||||||
|
/* get begin of body */
|
||||||
|
length = body_begin = test_skip_whitespace(udata, length, test_data.size);
|
||||||
|
|
||||||
|
/* get end of body */
|
||||||
|
length = test_find_body_end(udata, length, test_data.size);
|
||||||
|
|
||||||
|
myencoding_t find_encoding = myencoding_prescan_stream_to_determine_encoding(&test_data.data[body_begin], (length - body_begin));
|
||||||
|
|
||||||
|
if(find_encoding != encoding) {
|
||||||
|
fprintf(stderr, "ERROR! WRONG! ACHTUNG! Header Encoding not equally Encoding after parsing body\n");
|
||||||
|
fprintf(stderr, "Header: %.*s\n", (int)code_length, &test_data.data[code_begin]);
|
||||||
|
fprintf(stderr, "Body: %.*s\n", (int)(length - body_begin), &test_data.data[body_begin]);
|
||||||
|
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\t%.*s: Ok\n", (int)code_length, &test_data.data[code_begin]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, const char * argv[])
|
||||||
|
{
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("Bad ARGV!\nUse: encoding_detect_meta <test_file_path>\n");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
test_entries(argv[1]);
|
||||||
|
|
||||||
|
//test_entries("/new/C-git/Modest/test/myhtml/data/encoding/detect_meta.html");
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
9
test/myurl/Makefile.mk
Normal file
9
test/myurl/Makefile.mk
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
myurl_dirs := .
|
||||||
|
myurl_objs := $(call BINARY_UTILS_OBJS,myurl,$(myurl_dirs))
|
||||||
|
|
||||||
|
myurl_all: $(myurl_objs)
|
||||||
|
|
||||||
|
myurl_clean:
|
||||||
|
rm -f $(myurl_objs)
|
||||||
|
|
||||||
|
myurl_url := $(TEST_DIR_RELATIVE)/myurl/data
|
BIN
test/myurl/url
BIN
test/myurl/url
Binary file not shown.
@ -21,7 +21,7 @@
|
|||||||
#include <myurl/url.h>
|
#include <myurl/url.h>
|
||||||
#include <myurl/serialization.h>
|
#include <myurl/serialization.h>
|
||||||
#include <myhtml/mystring.h>
|
#include <myhtml/mystring.h>
|
||||||
#include <myhtml/utils/mchar_async.h>
|
#include <mycore/utils/mchar_async.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -304,7 +304,7 @@ bool test_for_type_second_entry(const char *data, size_t* length, size_t data_si
|
|||||||
fprintf(stderr, "Test FAILURE!\n");
|
fprintf(stderr, "Test FAILURE!\n");
|
||||||
fprintf(stderr, "\tURL: %.*s\n", (int)url.length, &data[ url.begin ]);
|
fprintf(stderr, "\tURL: %.*s\n", (int)url.length, &data[ url.begin ]);
|
||||||
fprintf(stderr, "\tDomain Type: %d\n", url_entry->host.type);
|
fprintf(stderr, "\tDomain Type: %d\n", url_entry->host.type);
|
||||||
fprintf(stderr, "\tDomain Ip Version Type: %d\n", url_entry->host.ipv.type);
|
fprintf(stderr, "\tDomain Ip Version Type: %d\n", url_entry->host.value.ipv.type);
|
||||||
fprintf(stderr, "\tExpect Domain Type: %d\n\n", domain_type);
|
fprintf(stderr, "\tExpect Domain Type: %d\n\n", domain_type);
|
||||||
|
|
||||||
test_destroy_url(url_entry);
|
test_destroy_url(url_entry);
|
||||||
@ -494,11 +494,14 @@ int main(int argc, const char * argv[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MCharOBJ = mchar_async_create(4, 4096);
|
MCharOBJ = mchar_async_create();
|
||||||
if(MCharOBJ == NULL)
|
if(MCharOBJ == NULL)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
MCharOBJNode = mchar_async_node_add(MCharOBJ);
|
if(mchar_async_init(MCharOBJ, 4, 4096))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
|
MCharOBJNode = mchar_async_node_add(MCharOBJ, NULL);
|
||||||
|
|
||||||
test_read_dir(argv[1]);
|
test_read_dir(argv[1]);
|
||||||
//test_read_dir("/new/C-git/Modest/test/myurl/data");
|
//test_read_dir("/new/C-git/Modest/test/myurl/data");
|
||||||
|
Loading…
Reference in New Issue
Block a user