mirror of
https://github.com/lexborisov/Modest
synced 2024-11-21 21:31:25 +03:00
First commit
This commit is contained in:
commit
5afb4ca9b7
BIN
CHANGELOG.md
Normal file
BIN
CHANGELOG.md
Normal file
Binary file not shown.
458
LICENSE
Normal file
458
LICENSE
Normal file
@ -0,0 +1,458 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
(This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.)
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
69
Makefile
Normal file
69
Makefile
Normal file
@ -0,0 +1,69 @@
|
||||
TARGET := source
|
||||
SRCDIR := source
|
||||
|
||||
CC ?= gcc
|
||||
|
||||
LIBNAME := modest
|
||||
LIBPOSTFIX := .so
|
||||
LIBSTATIC_POSTFIX := _static
|
||||
LIB_TMP := lib
|
||||
INCLUDE_TMP := include
|
||||
BIN_TMP := bin
|
||||
|
||||
MODEST_OPTIMIZATION_LEVEL ?= -O2
|
||||
|
||||
CFLAGS ?= -Wall -Werror
|
||||
CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -fPIC --std=c99 -I$(SRCDIR)
|
||||
|
||||
MODEST_BUILD_WITHOUT_THREADS ?= NO
|
||||
ifeq ($(MODEST_BUILD_WITHOUT_THREADS),YES)
|
||||
$(info Build without POSIX Threads)
|
||||
CFLAGS += -DMODEST_BUILD_WITHOUT_THREADS
|
||||
else
|
||||
$(info Build with POSIX Threads)
|
||||
CFLAGS += -pthread
|
||||
endif
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
else
|
||||
UNAM := $(shell uname -s)
|
||||
ifeq ($(UNAM),Darwin)
|
||||
LIBPOSTFIX := .dylib
|
||||
else
|
||||
CFLAGS += -D_POSIX_C_SOURCE=199309L
|
||||
endif
|
||||
endif
|
||||
|
||||
SRCS :=
|
||||
HDRS :=
|
||||
EXTDIRS := examples
|
||||
|
||||
all: shared static
|
||||
for f in $(EXTDIRS); do $(MAKE) -C $$f all; done
|
||||
|
||||
include $(TARGET)/myhtml/Makefile.mk
|
||||
include $(TARGET)/mycss/Makefile.mk
|
||||
include $(TARGET)/modest/Makefile.mk
|
||||
|
||||
OBJS := $(patsubst %.c,%.o,$(SRCS))
|
||||
|
||||
shared: $(OBJS) $(HDRS)
|
||||
$(CC) -shared $(LDFLAGS) $(OBJS) -o $(LIB_TMP)/lib$(LIBNAME)$(LIBPOSTFIX)
|
||||
|
||||
static: shared
|
||||
$(AR) crus $(LIB_TMP)/lib$(LIBNAME)$(LIBSTATIC_POSTFIX).a $(OBJS)
|
||||
|
||||
clean:
|
||||
for f in $(EXTDIRS); do $(MAKE) -C $$f clean; done
|
||||
rm -f $(OBJS)
|
||||
rm -f $(LIB_TMP)/*
|
||||
rm -f $(BIN_TMP)/*
|
||||
|
||||
clean_include:
|
||||
rm -rf $(INCLUDE_TMP)
|
||||
|
||||
clone: clean_include MODEST_clone mycss_clone modest_clone
|
||||
find include -name "*.h" -exec sed -i '.bak' -E 's/^[ \t]*#[ \t]*include[ \t]*"([^"]+)"/#include <\1>/g' {} \;
|
||||
find include -name "*.h.bak" -exec rm -f {} \;
|
||||
|
||||
.PHONY: all clean clone
|
130
README.md
Normal file
130
README.md
Normal file
@ -0,0 +1,130 @@
|
||||
# Modest C/C++ HTML Render
|
||||
|
||||
Modest is a fast HTML Render implemented as a pure C99 library with no outside dependencies.
|
||||
|
||||
## Now
|
||||
|
||||
```text
|
||||
The current version is 0.0.1 - devel
|
||||
```
|
||||
|
||||
## Changes
|
||||
Please, see [CHANGELOG.md] file
|
||||
|
||||
## Features
|
||||
|
||||
Render is in development. Now available:
|
||||
|
||||
- Search nodes by Selectors
|
||||
- See Features of [MyHTML]
|
||||
- See Features of [MyCSS]
|
||||
|
||||
## The Story of Creation
|
||||
|
||||
[The Story of Creation]
|
||||
|
||||
## Build and Installation
|
||||
|
||||
**Make**
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
If successful copy lib/* and include/* at the right place for you
|
||||
|
||||
Flags that can be passed to make:
|
||||
- `MODEST_OPTIMIZATION_LEVEL=-O2` set compiler optimization level. Default: -O2
|
||||
- `MODEST_BUILD_WITHOUT_THREADS=YES` build without POSIX Threads. Default: NO
|
||||
|
||||
*for example*
|
||||
```bash
|
||||
make MODEST_BUILD_WITHOUT_THREADS=NO
|
||||
```
|
||||
|
||||
```bash
|
||||
cp lib/* /usr/local/lib
|
||||
cp -r include/* /usr/local/include
|
||||
```
|
||||
|
||||
**CMake**
|
||||
|
||||
In modest/project directory:
|
||||
|
||||
```bash
|
||||
cmake .
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Flags that can be passed to CMake:
|
||||
- `MODEST_OPTIMIZATION_LEVEL=-O2` set compiler optimization level. Default: -O2
|
||||
- `CMAKE_INSTALL_LIBDIR=lib` set path to install created library. Default: lib
|
||||
- `MODEST_BUILD_SHARED=ON` build shared library. Default: ON
|
||||
- `MODEST_BUILD_STATIC=ON` build static library. Default: ON
|
||||
- `MODEST_INSTALL_HEADER=OFF` install header files. Default OFF
|
||||
- `MODEST_BUILD_WITHOUT_THREADS=YES` build without POSIX Threads. Default: NO
|
||||
- `MODEST_EXTERN_MALLOC=my_malloc_func` set extern malloc function. Default: UNDEFINED
|
||||
- `MODEST_EXTERN_REALLOC=my_realloc_func` set extern realloc function. Default: UNDEFINED
|
||||
- `MODEST_EXTERN_CALLOC=my_calloc_func` set extern calloc function. Default: UNDEFINED
|
||||
- `MODEST_EXTERN_FREE=my_free_func` set extern free function. Default: UNDEFINED
|
||||
|
||||
*for example*
|
||||
```bash
|
||||
cmake . -DCMAKE_INSTALL_LIBDIR=lib64 -DMODEST_INSTALL_HEADER=ON
|
||||
```
|
||||
|
||||
|
||||
## Build with your program
|
||||
|
||||
I advise to build using clang, but decided to show examples of gcc
|
||||
|
||||
**for example**
|
||||
|
||||
*build with shared library*
|
||||
```bash
|
||||
gcc -Wall -Werror -O2 -lmodest your_program.c -o your_program
|
||||
```
|
||||
|
||||
*build with static library*
|
||||
```bash
|
||||
gcc -Wall -Werror -O2 your_program.c /path/to/libmodest_static.a -o your_program
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
None
|
||||
|
||||
## In other languages, external bindings
|
||||
|
||||
Send pull request if you create any bindings
|
||||
|
||||
## Examples
|
||||
|
||||
See [examples] directory
|
||||
|
||||
## AUTHOR
|
||||
|
||||
Alexander Borisov <lex.borisov@gmail.com>
|
||||
|
||||
## COPYRIGHT AND LICENSE
|
||||
|
||||
Copyright (C) 2015-2016 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
|
||||
|
||||
See the [LICENSE] file.
|
||||
|
||||
|
||||
[high]: https://github.com/lexborisov/modest/blob/master/include/myhtml/api.h
|
||||
[low]: https://github.com/lexborisov/modest/tree/master/include/myhtml
|
||||
[examples]: https://github.com/lexborisov/modest/tree/master/examples
|
||||
[MyHTML]: https://github.com/lexborisov/myhtml
|
||||
[MyCSS]: https://github.com/lexborisov/mycss
|
||||
[CHANGELOG.md]: https://github.com/lexborisov/modest/blob/master/CHANGELOG.md
|
||||
[The Story of Creation]: http://lexborisov.github.io/myhtml/
|
||||
[LICENSE]: https://github.com/lexborisov/myhtml/blob/master/LICENSE
|
804
devel/osx/Modest.xcodeproj/project.pbxproj
Normal file
804
devel/osx/Modest.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,804 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0E108E3C1D57EE71009D43FA /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E351D57EE71009D43FA /* init.c */; };
|
||||
0E108E3D1D57EE71009D43FA /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E381D57EE71009D43FA /* parser.c */; };
|
||||
0E108E3E1D57EE71009D43FA /* state.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E3A1D57EE71009D43FA /* state.c */; };
|
||||
0E108E411D5872DD009D43FA /* an_plus_b.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E3F1D5872DD009D43FA /* an_plus_b.c */; };
|
||||
0E108E441D5893B5009D43FA /* function_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E421D5893B5009D43FA /* function_parser.c */; };
|
||||
0E108E4B1D5B324F009D43FA /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E461D5B324F009D43FA /* init.c */; };
|
||||
0E108E4C1D5B324F009D43FA /* state.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E108E491D5B324F009D43FA /* state.c */; };
|
||||
0E17B98D1D50B20700F1995B /* serialization.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E17B98B1D50B20700F1995B /* serialization.c */; };
|
||||
0E42F0EF1D1749E10010E1C2 /* data_process.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E42F0ED1D1749E10010E1C2 /* data_process.c */; };
|
||||
0E465ABA1CFC4BC500CA7D65 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465AB91CFC4BC500CA7D65 /* main.c */; };
|
||||
0E465B1E1CFC4C5E00CA7D65 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B061CFC4C5E00CA7D65 /* parser.c */; };
|
||||
0E465B201CFC4C5E00CA7D65 /* entry.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B091CFC4C5E00CA7D65 /* entry.c */; };
|
||||
0E465B211CFC4C5E00CA7D65 /* tokenizer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B0B1CFC4C5E00CA7D65 /* tokenizer.c */; };
|
||||
0E465B221CFC4C5E00CA7D65 /* mycss.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B0D1CFC4C5E00CA7D65 /* mycss.c */; };
|
||||
0E465B231CFC4C5E00CA7D65 /* check.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B131CFC4C5E00CA7D65 /* check.c */; };
|
||||
0E465B241CFC4C5E00CA7D65 /* convert.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B151CFC4C5E00CA7D65 /* convert.c */; };
|
||||
0E465B261CFC4C5E00CA7D65 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B181CFC4C5E00CA7D65 /* mystring.c */; };
|
||||
0E465B271CFC4C5E00CA7D65 /* tokenizer_end.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B191CFC4C5E00CA7D65 /* tokenizer_end.c */; };
|
||||
0E465B281CFC4C5E00CA7D65 /* tokenizer_global.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B1B1CFC4C5E00CA7D65 /* tokenizer_global.c */; };
|
||||
0E465B2F1CFC4C9800CA7D65 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B2C1CFC4C9800CA7D65 /* parser.c */; };
|
||||
0E465B301CFC4C9800CA7D65 /* state.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B2E1CFC4C9800CA7D65 /* state.c */; };
|
||||
0E465B5F1CFC4CBA00CA7D65 /* charef.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B361CFC4CBA00CA7D65 /* charef.c */; };
|
||||
0E465B601CFC4CBA00CA7D65 /* encoding_detect.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B3A1CFC4CBA00CA7D65 /* encoding_detect.c */; };
|
||||
0E465B611CFC4CBA00CA7D65 /* encoding.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B3C1CFC4CBA00CA7D65 /* encoding.c */; };
|
||||
0E465B621CFC4CBA00CA7D65 /* incoming.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B3E1CFC4CBA00CA7D65 /* incoming.c */; };
|
||||
0E465B631CFC4CBA00CA7D65 /* myhtml.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B401CFC4CBA00CA7D65 /* myhtml.c */; };
|
||||
0E465B641CFC4CBA00CA7D65 /* myosi.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B421CFC4CBA00CA7D65 /* myosi.c */; };
|
||||
0E465B651CFC4CBA00CA7D65 /* mystring.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B441CFC4CBA00CA7D65 /* mystring.c */; };
|
||||
0E465B661CFC4CBA00CA7D65 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B461CFC4CBA00CA7D65 /* parser.c */; };
|
||||
0E465B671CFC4CBA00CA7D65 /* perf.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B481CFC4CBA00CA7D65 /* perf.c */; };
|
||||
0E465B681CFC4CBA00CA7D65 /* rules.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B491CFC4CBA00CA7D65 /* rules.c */; };
|
||||
0E465B691CFC4CBA00CA7D65 /* tag_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B4C1CFC4CBA00CA7D65 /* tag_init.c */; };
|
||||
0E465B6A1CFC4CBA00CA7D65 /* tag.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B4D1CFC4CBA00CA7D65 /* tag.c */; };
|
||||
0E465B6B1CFC4CBA00CA7D65 /* thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B4F1CFC4CBA00CA7D65 /* thread.c */; };
|
||||
0E465B6C1CFC4CBA00CA7D65 /* token.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B511CFC4CBA00CA7D65 /* token.c */; };
|
||||
0E465B6D1CFC4CBA00CA7D65 /* tokenizer_doctype.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B531CFC4CBA00CA7D65 /* tokenizer_doctype.c */; };
|
||||
0E465B6E1CFC4CBA00CA7D65 /* tokenizer_end.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B551CFC4CBA00CA7D65 /* tokenizer_end.c */; };
|
||||
0E465B6F1CFC4CBA00CA7D65 /* tokenizer_script.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B571CFC4CBA00CA7D65 /* tokenizer_script.c */; };
|
||||
0E465B701CFC4CBA00CA7D65 /* tokenizer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B591CFC4CBA00CA7D65 /* tokenizer.c */; };
|
||||
0E465B711CFC4CBA00CA7D65 /* tree.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B5B1CFC4CBA00CA7D65 /* tree.c */; };
|
||||
0E465B721CFC4CBA00CA7D65 /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B5D1CFC4CBA00CA7D65 /* utils.c */; };
|
||||
0E465B7F1CFC4CD100CA7D65 /* mchar_async.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B741CFC4CD100CA7D65 /* mchar_async.c */; };
|
||||
0E465B801CFC4CD100CA7D65 /* mcobject_async.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B761CFC4CD100CA7D65 /* mcobject_async.c */; };
|
||||
0E465B811CFC4CD100CA7D65 /* mcsimple.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B781CFC4CD100CA7D65 /* mcsimple.c */; };
|
||||
0E465B821CFC4CD100CA7D65 /* mcsync.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B7A1CFC4CD100CA7D65 /* mcsync.c */; };
|
||||
0E465B831CFC4CD100CA7D65 /* mctree.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B7C1CFC4CD100CA7D65 /* mctree.c */; };
|
||||
0E465B8B1CFC64F100CA7D65 /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465B891CFC64F100CA7D65 /* init.c */; };
|
||||
0E465BA41CFF594100CA7D65 /* mynamespace.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E465BA21CFF594100CA7D65 /* mynamespace.c */; };
|
||||
0E5D5C7B1D464F74001BA53C /* values.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E5D5C791D464F74001BA53C /* values.c */; };
|
||||
0E5D5C7E1D46AC0B001BA53C /* units.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E5D5C7C1D46AC0B001BA53C /* units.c */; };
|
||||
0E7BE0FC1D434DB10063BDE5 /* stylesheet.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E7BE0FA1D434DB10063BDE5 /* stylesheet.c */; };
|
||||
0E7BE0FF1D43581F0063BDE5 /* list.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E7BE0FD1D43581F0063BDE5 /* list.c */; };
|
||||
0E84999A1D1B1E7A0027A80B /* stream.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E8499981D1B1E7A0027A80B /* stream.c */; };
|
||||
0E84999B1D1B1E7A0027A80B /* callback.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E8499991D1B1E7A0027A80B /* callback.c */; };
|
||||
0E84999E1D1B23490027A80B /* mcobject.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E84999C1D1B23490027A80B /* mcobject.c */; };
|
||||
0E8499A11D21ABDF0027A80B /* pseudo.c in Sources */ = {isa = PBXBuildFile; fileRef = 0E84999F1D21ABDF0027A80B /* pseudo.c */; };
|
||||
0EBB6F261D6BA22900F75F4A /* match.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EBB6F241D6BA22900F75F4A /* match.c */; };
|
||||
0EBB6F2B1D6D10D500F75F4A /* pseudo_class.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EBB6F291D6D10D500F75F4A /* pseudo_class.c */; };
|
||||
0EC3AF111D66543F00027DDC /* finder.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EC3AF0C1D66543F00027DDC /* finder.c */; };
|
||||
0EC3AF121D66543F00027DDC /* type.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EC3AF0F1D66543F00027DDC /* type.c */; };
|
||||
0EC768F21D4F610C00CE1587 /* entry.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EC768F01D4F610C00CE1587 /* entry.c */; };
|
||||
0ECA38641D08B88E00171335 /* value.c in Sources */ = {isa = PBXBuildFile; fileRef = 0ECA38621D08B88E00171335 /* value.c */; };
|
||||
0ECA38681D08CCAB00171335 /* function.c in Sources */ = {isa = PBXBuildFile; fileRef = 0ECA38661D08CCAB00171335 /* function.c */; };
|
||||
0EFEFB681D49FCFD00F2A070 /* state.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEFB661D49FCFD00F2A070 /* state.c */; };
|
||||
0EFEFB6B1D49FD7500F2A070 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEFB691D49FD7500F2A070 /* parser.c */; };
|
||||
0EFEFB6E1D4A014700F2A070 /* consume.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEFB6C1D4A014700F2A070 /* consume.c */; };
|
||||
0EFEFB711D4A13CD00F2A070 /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEFB6F1D4A13CD00F2A070 /* init.c */; };
|
||||
0EFEFB7B1D4A301E00F2A070 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEFB791D4A301E00F2A070 /* parser.c */; };
|
||||
0EFEFB7F1D4A40B500F2A070 /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = 0EFEFB7D1D4A40B500F2A070 /* init.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
0E465AB41CFC4BC500CA7D65 /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0E108E351D57EE71009D43FA /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = init.c; path = ../../../mycss/source/mycss/namespace/init.c; sourceTree = "<group>"; };
|
||||
0E108E361D57EE71009D43FA /* init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = init.h; path = ../../../mycss/source/mycss/namespace/init.h; sourceTree = "<group>"; };
|
||||
0E108E371D57EE71009D43FA /* myosi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../mycss/source/mycss/namespace/myosi.h; sourceTree = "<group>"; };
|
||||
0E108E381D57EE71009D43FA /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = ../../../mycss/source/mycss/namespace/parser.c; sourceTree = "<group>"; };
|
||||
0E108E391D57EE71009D43FA /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../../../mycss/source/mycss/namespace/parser.h; sourceTree = "<group>"; };
|
||||
0E108E3A1D57EE71009D43FA /* state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = state.c; path = ../../../mycss/source/mycss/namespace/state.c; sourceTree = "<group>"; };
|
||||
0E108E3B1D57EE71009D43FA /* state.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = state.h; path = ../../../mycss/source/mycss/namespace/state.h; sourceTree = "<group>"; };
|
||||
0E108E3F1D5872DD009D43FA /* an_plus_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = an_plus_b.c; path = ../../../mycss/source/mycss/an_plus_b.c; sourceTree = "<group>"; };
|
||||
0E108E401D5872DD009D43FA /* an_plus_b.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = an_plus_b.h; path = ../../../mycss/source/mycss/an_plus_b.h; sourceTree = "<group>"; };
|
||||
0E108E421D5893B5009D43FA /* function_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = function_parser.c; path = ../../../mycss/source/mycss/selectors/function_parser.c; sourceTree = "<group>"; };
|
||||
0E108E431D5893B5009D43FA /* function_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = function_parser.h; path = ../../../mycss/source/mycss/selectors/function_parser.h; sourceTree = "<group>"; };
|
||||
0E108E461D5B324F009D43FA /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = init.c; path = ../../../mycss/source/mycss/media/init.c; sourceTree = "<group>"; };
|
||||
0E108E471D5B324F009D43FA /* init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = init.h; path = ../../../mycss/source/mycss/media/init.h; sourceTree = "<group>"; };
|
||||
0E108E481D5B324F009D43FA /* myosi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../mycss/source/mycss/media/myosi.h; sourceTree = "<group>"; };
|
||||
0E108E491D5B324F009D43FA /* state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = state.c; path = ../../../mycss/source/mycss/media/state.c; sourceTree = "<group>"; };
|
||||
0E108E4A1D5B324F009D43FA /* state.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = state.h; path = ../../../mycss/source/mycss/media/state.h; sourceTree = "<group>"; };
|
||||
0E17B98B1D50B20700F1995B /* serialization.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = serialization.c; path = ../../../mycss/source/mycss/values/serialization.c; sourceTree = "<group>"; };
|
||||
0E17B98C1D50B20700F1995B /* serialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = serialization.h; path = ../../../mycss/source/mycss/values/serialization.h; sourceTree = "<group>"; };
|
||||
0E42F0EC1D1749E10010E1C2 /* data_process.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = data_process.h; path = ../../../myhtml/source/myhtml/data_process.h; sourceTree = "<group>"; };
|
||||
0E42F0ED1D1749E10010E1C2 /* data_process.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = data_process.c; path = ../../../myhtml/source/myhtml/data_process.c; sourceTree = "<group>"; };
|
||||
0E42F0EE1D1749E10010E1C2 /* charef_resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = charef_resource.h; path = ../../../myhtml/source/myhtml/charef_resource.h; sourceTree = "<group>"; };
|
||||
0E465AB61CFC4BC500CA7D65 /* Modest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Modest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0E465AB91CFC4BC500CA7D65 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
|
||||
0E465B061CFC4C5E00CA7D65 /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = ../../../mycss/source/mycss/parser.c; sourceTree = "<group>"; };
|
||||
0E465B071CFC4C5E00CA7D65 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../../../mycss/source/mycss/parser.h; sourceTree = "<group>"; };
|
||||
0E465B091CFC4C5E00CA7D65 /* entry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = entry.c; path = ../../../mycss/source/mycss/entry.c; sourceTree = "<group>"; };
|
||||
0E465B0A1CFC4C5E00CA7D65 /* entry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = entry.h; path = ../../../mycss/source/mycss/entry.h; sourceTree = "<group>"; };
|
||||
0E465B0B1CFC4C5E00CA7D65 /* tokenizer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer.c; path = ../../../mycss/source/mycss/tokenizer.c; sourceTree = "<group>"; };
|
||||
0E465B0C1CFC4C5E00CA7D65 /* tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer.h; path = ../../../mycss/source/mycss/tokenizer.h; sourceTree = "<group>"; };
|
||||
0E465B0D1CFC4C5E00CA7D65 /* mycss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mycss.c; path = ../../../mycss/source/mycss/mycss.c; sourceTree = "<group>"; };
|
||||
0E465B0E1CFC4C5E00CA7D65 /* mycss.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mycss.h; path = ../../../mycss/source/mycss/mycss.h; sourceTree = "<group>"; };
|
||||
0E465B0F1CFC4C5E00CA7D65 /* myosi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../mycss/source/mycss/myosi.h; sourceTree = "<group>"; };
|
||||
0E465B101CFC4C5E00CA7D65 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../../mycss/source/mycss/mystring.h; sourceTree = "<group>"; };
|
||||
0E465B121CFC4C5E00CA7D65 /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = api.h; path = ../../../mycss/source/mycss/api.h; sourceTree = "<group>"; };
|
||||
0E465B131CFC4C5E00CA7D65 /* check.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = check.c; path = ../../../mycss/source/mycss/check.c; sourceTree = "<group>"; };
|
||||
0E465B141CFC4C5E00CA7D65 /* check.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = check.h; path = ../../../mycss/source/mycss/check.h; sourceTree = "<group>"; };
|
||||
0E465B151CFC4C5E00CA7D65 /* convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = convert.c; path = ../../../mycss/source/mycss/convert.c; sourceTree = "<group>"; };
|
||||
0E465B161CFC4C5E00CA7D65 /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = convert.h; path = ../../../mycss/source/mycss/convert.h; sourceTree = "<group>"; };
|
||||
0E465B181CFC4C5E00CA7D65 /* mystring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mystring.c; path = ../../../mycss/source/mycss/mystring.c; sourceTree = "<group>"; };
|
||||
0E465B191CFC4C5E00CA7D65 /* tokenizer_end.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer_end.c; path = ../../../mycss/source/mycss/tokenizer_end.c; sourceTree = "<group>"; };
|
||||
0E465B1A1CFC4C5E00CA7D65 /* tokenizer_end.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer_end.h; path = ../../../mycss/source/mycss/tokenizer_end.h; sourceTree = "<group>"; };
|
||||
0E465B1B1CFC4C5E00CA7D65 /* tokenizer_global.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer_global.c; path = ../../../mycss/source/mycss/tokenizer_global.c; sourceTree = "<group>"; };
|
||||
0E465B1C1CFC4C5E00CA7D65 /* tokenizer_global.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer_global.h; path = ../../../mycss/source/mycss/tokenizer_global.h; sourceTree = "<group>"; };
|
||||
0E465B1D1CFC4C5E00CA7D65 /* tokenizer_resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer_resource.h; path = ../../../mycss/source/mycss/tokenizer_resource.h; sourceTree = "<group>"; };
|
||||
0E465B2B1CFC4C9800CA7D65 /* state.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = state.h; path = ../../../mycss/source/mycss/selectors/state.h; sourceTree = "<group>"; };
|
||||
0E465B2C1CFC4C9800CA7D65 /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = ../../../mycss/source/mycss/selectors/parser.c; sourceTree = "<group>"; };
|
||||
0E465B2D1CFC4C9800CA7D65 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../../../mycss/source/mycss/selectors/parser.h; sourceTree = "<group>"; };
|
||||
0E465B2E1CFC4C9800CA7D65 /* state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = state.c; path = ../../../mycss/source/mycss/selectors/state.c; sourceTree = "<group>"; };
|
||||
0E465B341CFC4CBA00CA7D65 /* api_encoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = api_encoding.h; path = ../../../myhtml/source/myhtml/api_encoding.h; sourceTree = "<group>"; };
|
||||
0E465B351CFC4CBA00CA7D65 /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = api.h; path = ../../../myhtml/source/myhtml/api.h; sourceTree = "<group>"; };
|
||||
0E465B361CFC4CBA00CA7D65 /* charef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = charef.c; path = ../../../myhtml/source/myhtml/charef.c; sourceTree = "<group>"; };
|
||||
0E465B371CFC4CBA00CA7D65 /* charef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = charef.h; path = ../../../myhtml/source/myhtml/charef.h; sourceTree = "<group>"; };
|
||||
0E465B381CFC4CBA00CA7D65 /* def.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = def.h; path = ../../../myhtml/source/myhtml/def.h; sourceTree = "<group>"; };
|
||||
0E465B391CFC4CBA00CA7D65 /* encoding_detect_resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = encoding_detect_resource.h; path = ../../../myhtml/source/myhtml/encoding_detect_resource.h; sourceTree = "<group>"; };
|
||||
0E465B3A1CFC4CBA00CA7D65 /* encoding_detect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = encoding_detect.c; path = ../../../myhtml/source/myhtml/encoding_detect.c; sourceTree = "<group>"; };
|
||||
0E465B3B1CFC4CBA00CA7D65 /* encoding_resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = encoding_resource.h; path = ../../../myhtml/source/myhtml/encoding_resource.h; sourceTree = "<group>"; };
|
||||
0E465B3C1CFC4CBA00CA7D65 /* encoding.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = encoding.c; path = ../../../myhtml/source/myhtml/encoding.c; sourceTree = "<group>"; };
|
||||
0E465B3D1CFC4CBA00CA7D65 /* encoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = encoding.h; path = ../../../myhtml/source/myhtml/encoding.h; sourceTree = "<group>"; };
|
||||
0E465B3E1CFC4CBA00CA7D65 /* incoming.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = incoming.c; path = ../../../myhtml/source/myhtml/incoming.c; sourceTree = "<group>"; };
|
||||
0E465B3F1CFC4CBA00CA7D65 /* incoming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = incoming.h; path = ../../../myhtml/source/myhtml/incoming.h; sourceTree = "<group>"; };
|
||||
0E465B401CFC4CBA00CA7D65 /* myhtml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = myhtml.c; path = ../../../myhtml/source/myhtml/myhtml.c; sourceTree = "<group>"; };
|
||||
0E465B411CFC4CBA00CA7D65 /* myhtml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myhtml.h; path = ../../../myhtml/source/myhtml/myhtml.h; sourceTree = "<group>"; };
|
||||
0E465B421CFC4CBA00CA7D65 /* myosi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = myosi.c; path = ../../../myhtml/source/myhtml/myosi.c; sourceTree = "<group>"; };
|
||||
0E465B431CFC4CBA00CA7D65 /* myosi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../myhtml/source/myhtml/myosi.h; sourceTree = "<group>"; };
|
||||
0E465B441CFC4CBA00CA7D65 /* mystring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mystring.c; path = ../../../myhtml/source/myhtml/mystring.c; sourceTree = "<group>"; };
|
||||
0E465B451CFC4CBA00CA7D65 /* mystring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mystring.h; path = ../../../myhtml/source/myhtml/mystring.h; sourceTree = "<group>"; };
|
||||
0E465B461CFC4CBA00CA7D65 /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = ../../../myhtml/source/myhtml/parser.c; sourceTree = "<group>"; };
|
||||
0E465B471CFC4CBA00CA7D65 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../../../myhtml/source/myhtml/parser.h; sourceTree = "<group>"; };
|
||||
0E465B481CFC4CBA00CA7D65 /* perf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = perf.c; path = ../../../myhtml/source/myhtml/perf.c; sourceTree = "<group>"; };
|
||||
0E465B491CFC4CBA00CA7D65 /* rules.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = rules.c; path = ../../../myhtml/source/myhtml/rules.c; sourceTree = "<group>"; };
|
||||
0E465B4A1CFC4CBA00CA7D65 /* rules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rules.h; path = ../../../myhtml/source/myhtml/rules.h; sourceTree = "<group>"; };
|
||||
0E465B4B1CFC4CBA00CA7D65 /* tag_const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tag_const.h; path = ../../../myhtml/source/myhtml/tag_const.h; sourceTree = "<group>"; };
|
||||
0E465B4C1CFC4CBA00CA7D65 /* tag_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tag_init.c; path = ../../../myhtml/source/myhtml/tag_init.c; sourceTree = "<group>"; };
|
||||
0E465B4D1CFC4CBA00CA7D65 /* tag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tag.c; path = ../../../myhtml/source/myhtml/tag.c; sourceTree = "<group>"; };
|
||||
0E465B4E1CFC4CBA00CA7D65 /* tag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tag.h; path = ../../../myhtml/source/myhtml/tag.h; sourceTree = "<group>"; };
|
||||
0E465B4F1CFC4CBA00CA7D65 /* thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = thread.c; path = ../../../myhtml/source/myhtml/thread.c; sourceTree = "<group>"; };
|
||||
0E465B501CFC4CBA00CA7D65 /* thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = thread.h; path = ../../../myhtml/source/myhtml/thread.h; sourceTree = "<group>"; };
|
||||
0E465B511CFC4CBA00CA7D65 /* token.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = token.c; path = ../../../myhtml/source/myhtml/token.c; sourceTree = "<group>"; };
|
||||
0E465B521CFC4CBA00CA7D65 /* token.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = token.h; path = ../../../myhtml/source/myhtml/token.h; sourceTree = "<group>"; };
|
||||
0E465B531CFC4CBA00CA7D65 /* tokenizer_doctype.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer_doctype.c; path = ../../../myhtml/source/myhtml/tokenizer_doctype.c; sourceTree = "<group>"; };
|
||||
0E465B541CFC4CBA00CA7D65 /* tokenizer_doctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer_doctype.h; path = ../../../myhtml/source/myhtml/tokenizer_doctype.h; sourceTree = "<group>"; };
|
||||
0E465B551CFC4CBA00CA7D65 /* tokenizer_end.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer_end.c; path = ../../../myhtml/source/myhtml/tokenizer_end.c; sourceTree = "<group>"; };
|
||||
0E465B561CFC4CBA00CA7D65 /* tokenizer_end.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer_end.h; path = ../../../myhtml/source/myhtml/tokenizer_end.h; sourceTree = "<group>"; };
|
||||
0E465B571CFC4CBA00CA7D65 /* tokenizer_script.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer_script.c; path = ../../../myhtml/source/myhtml/tokenizer_script.c; sourceTree = "<group>"; };
|
||||
0E465B581CFC4CBA00CA7D65 /* tokenizer_script.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer_script.h; path = ../../../myhtml/source/myhtml/tokenizer_script.h; sourceTree = "<group>"; };
|
||||
0E465B591CFC4CBA00CA7D65 /* tokenizer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tokenizer.c; path = ../../../myhtml/source/myhtml/tokenizer.c; sourceTree = "<group>"; };
|
||||
0E465B5A1CFC4CBA00CA7D65 /* tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tokenizer.h; path = ../../../myhtml/source/myhtml/tokenizer.h; sourceTree = "<group>"; };
|
||||
0E465B5B1CFC4CBA00CA7D65 /* tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tree.c; path = ../../../myhtml/source/myhtml/tree.c; sourceTree = "<group>"; };
|
||||
0E465B5C1CFC4CBA00CA7D65 /* tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tree.h; path = ../../../myhtml/source/myhtml/tree.h; sourceTree = "<group>"; };
|
||||
0E465B5D1CFC4CBA00CA7D65 /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = utils.c; path = ../../../myhtml/source/myhtml/utils.c; sourceTree = "<group>"; };
|
||||
0E465B5E1CFC4CBA00CA7D65 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../../myhtml/source/myhtml/utils.h; sourceTree = "<group>"; };
|
||||
0E465B741CFC4CD100CA7D65 /* mchar_async.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mchar_async.c; path = ../../../myhtml/source/myhtml/utils/mchar_async.c; sourceTree = "<group>"; };
|
||||
0E465B751CFC4CD100CA7D65 /* mchar_async.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mchar_async.h; path = ../../../myhtml/source/myhtml/utils/mchar_async.h; sourceTree = "<group>"; };
|
||||
0E465B761CFC4CD100CA7D65 /* mcobject_async.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mcobject_async.c; path = ../../../myhtml/source/myhtml/utils/mcobject_async.c; sourceTree = "<group>"; };
|
||||
0E465B771CFC4CD100CA7D65 /* mcobject_async.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mcobject_async.h; path = ../../../myhtml/source/myhtml/utils/mcobject_async.h; sourceTree = "<group>"; };
|
||||
0E465B781CFC4CD100CA7D65 /* mcsimple.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mcsimple.c; path = ../../../myhtml/source/myhtml/utils/mcsimple.c; sourceTree = "<group>"; };
|
||||
0E465B791CFC4CD100CA7D65 /* mcsimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mcsimple.h; path = ../../../myhtml/source/myhtml/utils/mcsimple.h; sourceTree = "<group>"; };
|
||||
0E465B7A1CFC4CD100CA7D65 /* mcsync.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mcsync.c; path = ../../../myhtml/source/myhtml/utils/mcsync.c; sourceTree = "<group>"; };
|
||||
0E465B7B1CFC4CD100CA7D65 /* mcsync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mcsync.h; path = ../../../myhtml/source/myhtml/utils/mcsync.h; sourceTree = "<group>"; };
|
||||
0E465B7C1CFC4CD100CA7D65 /* mctree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mctree.c; path = ../../../myhtml/source/myhtml/utils/mctree.c; sourceTree = "<group>"; };
|
||||
0E465B7D1CFC4CD100CA7D65 /* mctree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mctree.h; path = ../../../myhtml/source/myhtml/utils/mctree.h; sourceTree = "<group>"; };
|
||||
0E465B7E1CFC4CD100CA7D65 /* resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resources.h; path = ../../../myhtml/source/myhtml/utils/resources.h; sourceTree = "<group>"; };
|
||||
0E465B881CFC63D700CA7D65 /* myosi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../mycss/source/mycss/selectors/myosi.h; sourceTree = "<group>"; };
|
||||
0E465B891CFC64F100CA7D65 /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = init.c; path = ../../../mycss/source/mycss/selectors/init.c; sourceTree = "<group>"; };
|
||||
0E465B8A1CFC64F100CA7D65 /* init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = init.h; path = ../../../mycss/source/mycss/selectors/init.h; sourceTree = "<group>"; };
|
||||
0E465BA21CFF594100CA7D65 /* mynamespace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mynamespace.c; path = ../../../myhtml/source/myhtml/mynamespace.c; sourceTree = "<group>"; };
|
||||
0E465BA31CFF594100CA7D65 /* mynamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mynamespace.h; path = ../../../myhtml/source/myhtml/mynamespace.h; sourceTree = "<group>"; };
|
||||
0E465BA51CFF5A5600CA7D65 /* mynamespace_resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mynamespace_resource.h; path = ../../../myhtml/source/myhtml/mynamespace_resource.h; sourceTree = "<group>"; };
|
||||
0E5D5C781D464F2C001BA53C /* resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = resources.h; path = ../../../mycss/source/mycss/values/resources.h; sourceTree = "<group>"; };
|
||||
0E5D5C791D464F74001BA53C /* values.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = values.c; path = ../../../mycss/source/mycss/values/values.c; sourceTree = "<group>"; };
|
||||
0E5D5C7A1D464F74001BA53C /* values.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = values.h; path = ../../../mycss/source/mycss/values/values.h; sourceTree = "<group>"; };
|
||||
0E5D5C7C1D46AC0B001BA53C /* units.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = units.c; path = ../../../mycss/source/mycss/values/units.c; sourceTree = "<group>"; };
|
||||
0E5D5C7D1D46AC0B001BA53C /* units.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = units.h; path = ../../../mycss/source/mycss/values/units.h; sourceTree = "<group>"; };
|
||||
0E5D5C7F1D46AC7E001BA53C /* units_resources.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = units_resources.h; path = ../../../mycss/source/mycss/values/units_resources.h; sourceTree = "<group>"; };
|
||||
0E780D451D02F8AC008972B9 /* myosi_resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = myosi_resource.h; path = ../../../mycss/source/mycss/selectors/myosi_resource.h; sourceTree = "<group>"; };
|
||||
0E7BE0FA1D434DB10063BDE5 /* stylesheet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stylesheet.c; path = ../../../mycss/source/mycss/stylesheet.c; sourceTree = "<group>"; };
|
||||
0E7BE0FB1D434DB10063BDE5 /* stylesheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stylesheet.h; path = ../../../mycss/source/mycss/stylesheet.h; sourceTree = "<group>"; };
|
||||
0E7BE0FD1D43581F0063BDE5 /* list.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = list.c; path = ../../../mycss/source/mycss/selectors/list.c; sourceTree = "<group>"; };
|
||||
0E7BE0FE1D43581F0063BDE5 /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = list.h; path = ../../../mycss/source/mycss/selectors/list.h; sourceTree = "<group>"; };
|
||||
0E8499961D1B1E7A0027A80B /* callback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = callback.h; path = ../../../myhtml/source/myhtml/callback.h; sourceTree = "<group>"; };
|
||||
0E8499971D1B1E7A0027A80B /* stream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stream.h; path = ../../../myhtml/source/myhtml/stream.h; sourceTree = "<group>"; };
|
||||
0E8499981D1B1E7A0027A80B /* stream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = stream.c; path = ../../../myhtml/source/myhtml/stream.c; sourceTree = "<group>"; };
|
||||
0E8499991D1B1E7A0027A80B /* callback.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = callback.c; path = ../../../myhtml/source/myhtml/callback.c; sourceTree = "<group>"; };
|
||||
0E84999C1D1B23490027A80B /* mcobject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mcobject.c; path = ../../../myhtml/source/myhtml/utils/mcobject.c; sourceTree = "<group>"; };
|
||||
0E84999D1D1B23490027A80B /* mcobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mcobject.h; path = ../../../myhtml/source/myhtml/utils/mcobject.h; sourceTree = "<group>"; };
|
||||
0E84999F1D21ABDF0027A80B /* pseudo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pseudo.c; path = ../../../mycss/source/mycss/selectors/pseudo.c; sourceTree = "<group>"; };
|
||||
0E8499A01D21ABDF0027A80B /* pseudo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pseudo.h; path = ../../../mycss/source/mycss/selectors/pseudo.h; sourceTree = "<group>"; };
|
||||
0E8499A21D21AC500027A80B /* pseudo_resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = pseudo_resource.h; path = ../../../mycss/source/mycss/selectors/pseudo_resource.h; sourceTree = "<group>"; };
|
||||
0EBB6F241D6BA22900F75F4A /* match.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = match.c; path = ../../source/modest/finder/match.c; sourceTree = "<group>"; };
|
||||
0EBB6F251D6BA22900F75F4A /* match.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = match.h; path = ../../source/modest/finder/match.h; sourceTree = "<group>"; };
|
||||
0EBB6F271D6BA8B500F75F4A /* myosi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../source/modest/finder/myosi.h; sourceTree = "<group>"; };
|
||||
0EBB6F281D6BAE3100F75F4A /* myosi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../source/modest/myosi.h; sourceTree = "<group>"; };
|
||||
0EBB6F291D6D10D500F75F4A /* pseudo_class.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pseudo_class.c; path = ../../source/modest/finder/pseudo_class.c; sourceTree = "<group>"; };
|
||||
0EBB6F2A1D6D10D500F75F4A /* pseudo_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = pseudo_class.h; path = ../../source/modest/finder/pseudo_class.h; sourceTree = "<group>"; };
|
||||
0EC3AF0C1D66543F00027DDC /* finder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = finder.c; path = ../../source/modest/finder/finder.c; sourceTree = "<group>"; };
|
||||
0EC3AF0D1D66543F00027DDC /* finder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = finder.h; path = ../../source/modest/finder/finder.h; sourceTree = "<group>"; };
|
||||
0EC3AF0E1D66543F00027DDC /* resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resource.h; path = ../../source/modest/finder/resource.h; sourceTree = "<group>"; };
|
||||
0EC3AF0F1D66543F00027DDC /* type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = type.c; path = ../../source/modest/finder/type.c; sourceTree = "<group>"; };
|
||||
0EC3AF101D66543F00027DDC /* type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = type.h; path = ../../source/modest/finder/type.h; sourceTree = "<group>"; };
|
||||
0EC768F01D4F610C00CE1587 /* entry.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = entry.c; path = ../../../mycss/source/mycss/declaration/entry.c; sourceTree = "<group>"; };
|
||||
0EC768F11D4F610C00CE1587 /* entry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = entry.h; path = ../../../mycss/source/mycss/declaration/entry.h; sourceTree = "<group>"; };
|
||||
0ECA38621D08B88E00171335 /* value.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = value.c; path = ../../../mycss/source/mycss/selectors/value.c; sourceTree = "<group>"; };
|
||||
0ECA38631D08B88E00171335 /* value.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = value.h; path = ../../../mycss/source/mycss/selectors/value.h; sourceTree = "<group>"; };
|
||||
0ECA38651D08BC3600171335 /* value_resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = value_resource.h; path = ../../../mycss/source/mycss/selectors/value_resource.h; sourceTree = "<group>"; };
|
||||
0ECA38661D08CCAB00171335 /* function.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = function.c; path = ../../../mycss/source/mycss/selectors/function.c; sourceTree = "<group>"; };
|
||||
0ECA38671D08CCAB00171335 /* function.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = function.h; path = ../../../mycss/source/mycss/selectors/function.h; sourceTree = "<group>"; };
|
||||
0ECA38691D090BBD00171335 /* function_resource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = function_resource.h; path = ../../../mycss/source/mycss/selectors/function_resource.h; sourceTree = "<group>"; };
|
||||
0EFEFB661D49FCFD00F2A070 /* state.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = state.c; path = ../../../mycss/source/mycss/declaration/state.c; sourceTree = "<group>"; };
|
||||
0EFEFB671D49FCFD00F2A070 /* state.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = state.h; path = ../../../mycss/source/mycss/declaration/state.h; sourceTree = "<group>"; };
|
||||
0EFEFB691D49FD7500F2A070 /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = ../../../mycss/source/mycss/declaration/parser.c; sourceTree = "<group>"; };
|
||||
0EFEFB6A1D49FD7500F2A070 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../../../mycss/source/mycss/declaration/parser.h; sourceTree = "<group>"; };
|
||||
0EFEFB6C1D4A014700F2A070 /* consume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = consume.c; path = ../../../mycss/source/mycss/values/consume.c; sourceTree = "<group>"; };
|
||||
0EFEFB6D1D4A014700F2A070 /* consume.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = consume.h; path = ../../../mycss/source/mycss/values/consume.h; sourceTree = "<group>"; };
|
||||
0EFEFB6F1D4A13CD00F2A070 /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = init.c; path = ../../../mycss/source/mycss/declaration/init.c; sourceTree = "<group>"; };
|
||||
0EFEFB701D4A13CD00F2A070 /* init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = init.h; path = ../../../mycss/source/mycss/declaration/init.h; sourceTree = "<group>"; };
|
||||
0EFEFB721D4A142E00F2A070 /* myosi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../mycss/source/mycss/declaration/myosi.h; sourceTree = "<group>"; };
|
||||
0EFEFB781D4A301E00F2A070 /* resources.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = resources.h; path = ../../../mycss/source/mycss/property/resources.h; sourceTree = "<group>"; };
|
||||
0EFEFB791D4A301E00F2A070 /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = ../../../mycss/source/mycss/property/parser.c; sourceTree = "<group>"; };
|
||||
0EFEFB7A1D4A301E00F2A070 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../../../mycss/source/mycss/property/parser.h; sourceTree = "<group>"; };
|
||||
0EFEFB7C1D4A34B700F2A070 /* myosi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = myosi.h; path = ../../../mycss/source/mycss/property/myosi.h; sourceTree = "<group>"; };
|
||||
0EFEFB7D1D4A40B500F2A070 /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = init.c; path = ../../../mycss/source/mycss/property/init.c; sourceTree = "<group>"; };
|
||||
0EFEFB7E1D4A40B500F2A070 /* init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = init.h; path = ../../../mycss/source/mycss/property/init.h; sourceTree = "<group>"; };
|
||||
0EFEFB831D4E06CD00F2A070 /* const.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = const.h; path = ../../../mycss/source/mycss/property/const.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
0E465AB31CFC4BC500CA7D65 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0E108E341D57EE38009D43FA /* namespace */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E108E371D57EE71009D43FA /* myosi.h */,
|
||||
0E108E361D57EE71009D43FA /* init.h */,
|
||||
0E108E351D57EE71009D43FA /* init.c */,
|
||||
0E108E3B1D57EE71009D43FA /* state.h */,
|
||||
0E108E3A1D57EE71009D43FA /* state.c */,
|
||||
0E108E391D57EE71009D43FA /* parser.h */,
|
||||
0E108E381D57EE71009D43FA /* parser.c */,
|
||||
);
|
||||
name = namespace;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E108E451D5B3240009D43FA /* media */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E108E481D5B324F009D43FA /* myosi.h */,
|
||||
0E108E471D5B324F009D43FA /* init.h */,
|
||||
0E108E461D5B324F009D43FA /* init.c */,
|
||||
0E108E4A1D5B324F009D43FA /* state.h */,
|
||||
0E108E491D5B324F009D43FA /* state.c */,
|
||||
);
|
||||
name = media;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465AAD1CFC4BC500CA7D65 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E465AB81CFC4BC500CA7D65 /* Modest */,
|
||||
0E8499A61D22B6270027A80B /* modest */,
|
||||
0E465AC11CFC4C0000CA7D65 /* mycss */,
|
||||
0E465AC01CFC4BF900CA7D65 /* myhtml */,
|
||||
0E465AB71CFC4BC500CA7D65 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465AB71CFC4BC500CA7D65 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E465AB61CFC4BC500CA7D65 /* Modest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465AB81CFC4BC500CA7D65 /* Modest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E465AB91CFC4BC500CA7D65 /* main.c */,
|
||||
);
|
||||
path = Modest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465AC01CFC4BF900CA7D65 /* myhtml */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E8499971D1B1E7A0027A80B /* stream.h */,
|
||||
0E8499981D1B1E7A0027A80B /* stream.c */,
|
||||
0E8499961D1B1E7A0027A80B /* callback.h */,
|
||||
0E8499991D1B1E7A0027A80B /* callback.c */,
|
||||
0E465B351CFC4CBA00CA7D65 /* api.h */,
|
||||
0E465B341CFC4CBA00CA7D65 /* api_encoding.h */,
|
||||
0E465B431CFC4CBA00CA7D65 /* myosi.h */,
|
||||
0E465B421CFC4CBA00CA7D65 /* myosi.c */,
|
||||
0E465B411CFC4CBA00CA7D65 /* myhtml.h */,
|
||||
0E465B401CFC4CBA00CA7D65 /* myhtml.c */,
|
||||
0E465B471CFC4CBA00CA7D65 /* parser.h */,
|
||||
0E465B461CFC4CBA00CA7D65 /* parser.c */,
|
||||
0E465B521CFC4CBA00CA7D65 /* token.h */,
|
||||
0E465B511CFC4CBA00CA7D65 /* token.c */,
|
||||
0E465B5C1CFC4CBA00CA7D65 /* tree.h */,
|
||||
0E465B5B1CFC4CBA00CA7D65 /* tree.c */,
|
||||
0E465B4A1CFC4CBA00CA7D65 /* rules.h */,
|
||||
0E465B491CFC4CBA00CA7D65 /* rules.c */,
|
||||
0E465B4E1CFC4CBA00CA7D65 /* tag.h */,
|
||||
0E465B4D1CFC4CBA00CA7D65 /* tag.c */,
|
||||
0E465B4C1CFC4CBA00CA7D65 /* tag_init.c */,
|
||||
0E465B5A1CFC4CBA00CA7D65 /* tokenizer.h */,
|
||||
0E465B591CFC4CBA00CA7D65 /* tokenizer.c */,
|
||||
0E465B581CFC4CBA00CA7D65 /* tokenizer_script.h */,
|
||||
0E465B571CFC4CBA00CA7D65 /* tokenizer_script.c */,
|
||||
0E465B541CFC4CBA00CA7D65 /* tokenizer_doctype.h */,
|
||||
0E465B531CFC4CBA00CA7D65 /* tokenizer_doctype.c */,
|
||||
0E465B561CFC4CBA00CA7D65 /* tokenizer_end.h */,
|
||||
0E465B551CFC4CBA00CA7D65 /* tokenizer_end.c */,
|
||||
0E465B501CFC4CBA00CA7D65 /* thread.h */,
|
||||
0E465B4F1CFC4CBA00CA7D65 /* thread.c */,
|
||||
0E465B371CFC4CBA00CA7D65 /* charef.h */,
|
||||
0E465B361CFC4CBA00CA7D65 /* charef.c */,
|
||||
0E42F0EE1D1749E10010E1C2 /* charef_resource.h */,
|
||||
0E42F0EC1D1749E10010E1C2 /* data_process.h */,
|
||||
0E42F0ED1D1749E10010E1C2 /* data_process.c */,
|
||||
0E465B381CFC4CBA00CA7D65 /* def.h */,
|
||||
0E465B391CFC4CBA00CA7D65 /* encoding_detect_resource.h */,
|
||||
0E465B3A1CFC4CBA00CA7D65 /* encoding_detect.c */,
|
||||
0E465B3D1CFC4CBA00CA7D65 /* encoding.h */,
|
||||
0E465B3C1CFC4CBA00CA7D65 /* encoding.c */,
|
||||
0E465B3B1CFC4CBA00CA7D65 /* encoding_resource.h */,
|
||||
0E465B3F1CFC4CBA00CA7D65 /* incoming.h */,
|
||||
0E465B3E1CFC4CBA00CA7D65 /* incoming.c */,
|
||||
0E465B451CFC4CBA00CA7D65 /* mystring.h */,
|
||||
0E465B441CFC4CBA00CA7D65 /* mystring.c */,
|
||||
0E465BA31CFF594100CA7D65 /* mynamespace.h */,
|
||||
0E465BA21CFF594100CA7D65 /* mynamespace.c */,
|
||||
0E465BA51CFF5A5600CA7D65 /* mynamespace_resource.h */,
|
||||
0E465B481CFC4CBA00CA7D65 /* perf.c */,
|
||||
0E465B4B1CFC4CBA00CA7D65 /* tag_const.h */,
|
||||
0E465B5E1CFC4CBA00CA7D65 /* utils.h */,
|
||||
0E465B5D1CFC4CBA00CA7D65 /* utils.c */,
|
||||
0E465B731CFC4CBE00CA7D65 /* utils */,
|
||||
);
|
||||
name = myhtml;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465AC11CFC4C0000CA7D65 /* mycss */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E465B121CFC4C5E00CA7D65 /* api.h */,
|
||||
0E465B0F1CFC4C5E00CA7D65 /* myosi.h */,
|
||||
0E465B0E1CFC4C5E00CA7D65 /* mycss.h */,
|
||||
0E465B0D1CFC4C5E00CA7D65 /* mycss.c */,
|
||||
0E465B0A1CFC4C5E00CA7D65 /* entry.h */,
|
||||
0E465B091CFC4C5E00CA7D65 /* entry.c */,
|
||||
0E7BE0FB1D434DB10063BDE5 /* stylesheet.h */,
|
||||
0E7BE0FA1D434DB10063BDE5 /* stylesheet.c */,
|
||||
0E465B101CFC4C5E00CA7D65 /* mystring.h */,
|
||||
0E465B181CFC4C5E00CA7D65 /* mystring.c */,
|
||||
0E465B0C1CFC4C5E00CA7D65 /* tokenizer.h */,
|
||||
0E465B0B1CFC4C5E00CA7D65 /* tokenizer.c */,
|
||||
0E465B1C1CFC4C5E00CA7D65 /* tokenizer_global.h */,
|
||||
0E465B1B1CFC4C5E00CA7D65 /* tokenizer_global.c */,
|
||||
0E465B1A1CFC4C5E00CA7D65 /* tokenizer_end.h */,
|
||||
0E465B191CFC4C5E00CA7D65 /* tokenizer_end.c */,
|
||||
0E465B1D1CFC4C5E00CA7D65 /* tokenizer_resource.h */,
|
||||
0E465B141CFC4C5E00CA7D65 /* check.h */,
|
||||
0E465B131CFC4C5E00CA7D65 /* check.c */,
|
||||
0E465B161CFC4C5E00CA7D65 /* convert.h */,
|
||||
0E465B151CFC4C5E00CA7D65 /* convert.c */,
|
||||
0E465B071CFC4C5E00CA7D65 /* parser.h */,
|
||||
0E465B061CFC4C5E00CA7D65 /* parser.c */,
|
||||
0E108E401D5872DD009D43FA /* an_plus_b.h */,
|
||||
0E108E3F1D5872DD009D43FA /* an_plus_b.c */,
|
||||
0E108E451D5B3240009D43FA /* media */,
|
||||
0E108E341D57EE38009D43FA /* namespace */,
|
||||
0EFEFB771D4A2FE700F2A070 /* property */,
|
||||
0EFEFB651D49FCC900F2A070 /* declaration */,
|
||||
0E465B291CFC4C6C00CA7D65 /* selectors */,
|
||||
0E5D5C771D464ECE001BA53C /* values */,
|
||||
);
|
||||
name = mycss;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465B291CFC4C6C00CA7D65 /* selectors */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E465B881CFC63D700CA7D65 /* myosi.h */,
|
||||
0E780D451D02F8AC008972B9 /* myosi_resource.h */,
|
||||
0E465B8A1CFC64F100CA7D65 /* init.h */,
|
||||
0E465B891CFC64F100CA7D65 /* init.c */,
|
||||
0E7BE0FE1D43581F0063BDE5 /* list.h */,
|
||||
0E7BE0FD1D43581F0063BDE5 /* list.c */,
|
||||
0ECA38631D08B88E00171335 /* value.h */,
|
||||
0ECA38621D08B88E00171335 /* value.c */,
|
||||
0ECA38651D08BC3600171335 /* value_resource.h */,
|
||||
0E465B2B1CFC4C9800CA7D65 /* state.h */,
|
||||
0E465B2E1CFC4C9800CA7D65 /* state.c */,
|
||||
0E465B2D1CFC4C9800CA7D65 /* parser.h */,
|
||||
0E465B2C1CFC4C9800CA7D65 /* parser.c */,
|
||||
0E8499A01D21ABDF0027A80B /* pseudo.h */,
|
||||
0E84999F1D21ABDF0027A80B /* pseudo.c */,
|
||||
0E8499A21D21AC500027A80B /* pseudo_resource.h */,
|
||||
0ECA38671D08CCAB00171335 /* function.h */,
|
||||
0ECA38661D08CCAB00171335 /* function.c */,
|
||||
0E108E431D5893B5009D43FA /* function_parser.h */,
|
||||
0E108E421D5893B5009D43FA /* function_parser.c */,
|
||||
0ECA38691D090BBD00171335 /* function_resource.h */,
|
||||
);
|
||||
name = selectors;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E465B731CFC4CBE00CA7D65 /* utils */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E84999D1D1B23490027A80B /* mcobject.h */,
|
||||
0E84999C1D1B23490027A80B /* mcobject.c */,
|
||||
0E465B751CFC4CD100CA7D65 /* mchar_async.h */,
|
||||
0E465B741CFC4CD100CA7D65 /* mchar_async.c */,
|
||||
0E465B771CFC4CD100CA7D65 /* mcobject_async.h */,
|
||||
0E465B761CFC4CD100CA7D65 /* mcobject_async.c */,
|
||||
0E465B791CFC4CD100CA7D65 /* mcsimple.h */,
|
||||
0E465B781CFC4CD100CA7D65 /* mcsimple.c */,
|
||||
0E465B7B1CFC4CD100CA7D65 /* mcsync.h */,
|
||||
0E465B7A1CFC4CD100CA7D65 /* mcsync.c */,
|
||||
0E465B7D1CFC4CD100CA7D65 /* mctree.h */,
|
||||
0E465B7C1CFC4CD100CA7D65 /* mctree.c */,
|
||||
0E465B7E1CFC4CD100CA7D65 /* resources.h */,
|
||||
);
|
||||
name = utils;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E5D5C771D464ECE001BA53C /* values */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E5D5C7D1D46AC0B001BA53C /* units.h */,
|
||||
0E5D5C7C1D46AC0B001BA53C /* units.c */,
|
||||
0E5D5C7F1D46AC7E001BA53C /* units_resources.h */,
|
||||
0E5D5C7A1D464F74001BA53C /* values.h */,
|
||||
0E5D5C791D464F74001BA53C /* values.c */,
|
||||
0EFEFB6D1D4A014700F2A070 /* consume.h */,
|
||||
0EFEFB6C1D4A014700F2A070 /* consume.c */,
|
||||
0E17B98C1D50B20700F1995B /* serialization.h */,
|
||||
0E17B98B1D50B20700F1995B /* serialization.c */,
|
||||
0E5D5C781D464F2C001BA53C /* resources.h */,
|
||||
);
|
||||
name = values;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E5E4B8C1D6502F60030ECA0 /* finder */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0EBB6F271D6BA8B500F75F4A /* myosi.h */,
|
||||
0EC3AF0D1D66543F00027DDC /* finder.h */,
|
||||
0EC3AF0C1D66543F00027DDC /* finder.c */,
|
||||
0EC3AF101D66543F00027DDC /* type.h */,
|
||||
0EC3AF0F1D66543F00027DDC /* type.c */,
|
||||
0EBB6F2A1D6D10D500F75F4A /* pseudo_class.h */,
|
||||
0EBB6F291D6D10D500F75F4A /* pseudo_class.c */,
|
||||
0EBB6F251D6BA22900F75F4A /* match.h */,
|
||||
0EBB6F241D6BA22900F75F4A /* match.c */,
|
||||
0EC3AF0E1D66543F00027DDC /* resource.h */,
|
||||
);
|
||||
name = finder;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E8499A61D22B6270027A80B /* modest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0EBB6F281D6BAE3100F75F4A /* myosi.h */,
|
||||
0E5E4B8C1D6502F60030ECA0 /* finder */,
|
||||
);
|
||||
name = modest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0EFEFB651D49FCC900F2A070 /* declaration */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0EFEFB721D4A142E00F2A070 /* myosi.h */,
|
||||
0EC768F11D4F610C00CE1587 /* entry.h */,
|
||||
0EC768F01D4F610C00CE1587 /* entry.c */,
|
||||
0EFEFB701D4A13CD00F2A070 /* init.h */,
|
||||
0EFEFB6F1D4A13CD00F2A070 /* init.c */,
|
||||
0EFEFB671D49FCFD00F2A070 /* state.h */,
|
||||
0EFEFB661D49FCFD00F2A070 /* state.c */,
|
||||
0EFEFB6A1D49FD7500F2A070 /* parser.h */,
|
||||
0EFEFB691D49FD7500F2A070 /* parser.c */,
|
||||
);
|
||||
name = declaration;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0EFEFB771D4A2FE700F2A070 /* property */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0EFEFB7C1D4A34B700F2A070 /* myosi.h */,
|
||||
0EFEFB831D4E06CD00F2A070 /* const.h */,
|
||||
0EFEFB7E1D4A40B500F2A070 /* init.h */,
|
||||
0EFEFB7D1D4A40B500F2A070 /* init.c */,
|
||||
0EFEFB7A1D4A301E00F2A070 /* parser.h */,
|
||||
0EFEFB791D4A301E00F2A070 /* parser.c */,
|
||||
0EFEFB781D4A301E00F2A070 /* resources.h */,
|
||||
);
|
||||
name = property;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
0E465AB51CFC4BC500CA7D65 /* Modest */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 0E465ABD1CFC4BC500CA7D65 /* Build configuration list for PBXNativeTarget "Modest" */;
|
||||
buildPhases = (
|
||||
0E465AB21CFC4BC500CA7D65 /* Sources */,
|
||||
0E465AB31CFC4BC500CA7D65 /* Frameworks */,
|
||||
0E465AB41CFC4BC500CA7D65 /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = Modest;
|
||||
productName = Modest;
|
||||
productReference = 0E465AB61CFC4BC500CA7D65 /* Modest */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0E465AAE1CFC4BC500CA7D65 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0730;
|
||||
ORGANIZATIONNAME = "Alexander Borisov";
|
||||
TargetAttributes = {
|
||||
0E465AB51CFC4BC500CA7D65 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 0E465AB11CFC4BC500CA7D65 /* Build configuration list for PBXProject "Modest" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 0E465AAD1CFC4BC500CA7D65;
|
||||
productRefGroup = 0E465AB71CFC4BC500CA7D65 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
0E465AB51CFC4BC500CA7D65 /* Modest */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
0E465AB21CFC4BC500CA7D65 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0E108E4B1D5B324F009D43FA /* init.c in Sources */,
|
||||
0EFEFB7F1D4A40B500F2A070 /* init.c in Sources */,
|
||||
0E465B1E1CFC4C5E00CA7D65 /* parser.c in Sources */,
|
||||
0E465B6E1CFC4CBA00CA7D65 /* tokenizer_end.c in Sources */,
|
||||
0E465B631CFC4CBA00CA7D65 /* myhtml.c in Sources */,
|
||||
0E465B661CFC4CBA00CA7D65 /* parser.c in Sources */,
|
||||
0ECA38641D08B88E00171335 /* value.c in Sources */,
|
||||
0EC3AF111D66543F00027DDC /* finder.c in Sources */,
|
||||
0E465B681CFC4CBA00CA7D65 /* rules.c in Sources */,
|
||||
0E84999E1D1B23490027A80B /* mcobject.c in Sources */,
|
||||
0E465B831CFC4CD100CA7D65 /* mctree.c in Sources */,
|
||||
0E465B601CFC4CBA00CA7D65 /* encoding_detect.c in Sources */,
|
||||
0E465ABA1CFC4BC500CA7D65 /* main.c in Sources */,
|
||||
0E84999A1D1B1E7A0027A80B /* stream.c in Sources */,
|
||||
0EC768F21D4F610C00CE1587 /* entry.c in Sources */,
|
||||
0E84999B1D1B1E7A0027A80B /* callback.c in Sources */,
|
||||
0E465B621CFC4CBA00CA7D65 /* incoming.c in Sources */,
|
||||
0E108E3C1D57EE71009D43FA /* init.c in Sources */,
|
||||
0E465B641CFC4CBA00CA7D65 /* myosi.c in Sources */,
|
||||
0E5D5C7B1D464F74001BA53C /* values.c in Sources */,
|
||||
0EFEFB6E1D4A014700F2A070 /* consume.c in Sources */,
|
||||
0EBB6F261D6BA22900F75F4A /* match.c in Sources */,
|
||||
0E465B711CFC4CBA00CA7D65 /* tree.c in Sources */,
|
||||
0E465B211CFC4C5E00CA7D65 /* tokenizer.c in Sources */,
|
||||
0E108E3E1D57EE71009D43FA /* state.c in Sources */,
|
||||
0E465B241CFC4C5E00CA7D65 /* convert.c in Sources */,
|
||||
0E465B6A1CFC4CBA00CA7D65 /* tag.c in Sources */,
|
||||
0E465B721CFC4CBA00CA7D65 /* utils.c in Sources */,
|
||||
0E465B811CFC4CD100CA7D65 /* mcsimple.c in Sources */,
|
||||
0E465B6B1CFC4CBA00CA7D65 /* thread.c in Sources */,
|
||||
0E465B221CFC4C5E00CA7D65 /* mycss.c in Sources */,
|
||||
0E465B201CFC4C5E00CA7D65 /* entry.c in Sources */,
|
||||
0E465B801CFC4CD100CA7D65 /* mcobject_async.c in Sources */,
|
||||
0E465B611CFC4CBA00CA7D65 /* encoding.c in Sources */,
|
||||
0E465B231CFC4C5E00CA7D65 /* check.c in Sources */,
|
||||
0E465B7F1CFC4CD100CA7D65 /* mchar_async.c in Sources */,
|
||||
0EFEFB711D4A13CD00F2A070 /* init.c in Sources */,
|
||||
0EFEFB681D49FCFD00F2A070 /* state.c in Sources */,
|
||||
0E465B5F1CFC4CBA00CA7D65 /* charef.c in Sources */,
|
||||
0E465B6D1CFC4CBA00CA7D65 /* tokenizer_doctype.c in Sources */,
|
||||
0E465B6C1CFC4CBA00CA7D65 /* token.c in Sources */,
|
||||
0E465B6F1CFC4CBA00CA7D65 /* tokenizer_script.c in Sources */,
|
||||
0E465B261CFC4C5E00CA7D65 /* mystring.c in Sources */,
|
||||
0EC3AF121D66543F00027DDC /* type.c in Sources */,
|
||||
0E42F0EF1D1749E10010E1C2 /* data_process.c in Sources */,
|
||||
0E465B701CFC4CBA00CA7D65 /* tokenizer.c in Sources */,
|
||||
0E465BA41CFF594100CA7D65 /* mynamespace.c in Sources */,
|
||||
0E8499A11D21ABDF0027A80B /* pseudo.c in Sources */,
|
||||
0E108E4C1D5B324F009D43FA /* state.c in Sources */,
|
||||
0E108E411D5872DD009D43FA /* an_plus_b.c in Sources */,
|
||||
0E465B281CFC4C5E00CA7D65 /* tokenizer_global.c in Sources */,
|
||||
0E465B2F1CFC4C9800CA7D65 /* parser.c in Sources */,
|
||||
0E465B821CFC4CD100CA7D65 /* mcsync.c in Sources */,
|
||||
0E17B98D1D50B20700F1995B /* serialization.c in Sources */,
|
||||
0EFEFB6B1D49FD7500F2A070 /* parser.c in Sources */,
|
||||
0E108E3D1D57EE71009D43FA /* parser.c in Sources */,
|
||||
0ECA38681D08CCAB00171335 /* function.c in Sources */,
|
||||
0E108E441D5893B5009D43FA /* function_parser.c in Sources */,
|
||||
0E465B301CFC4C9800CA7D65 /* state.c in Sources */,
|
||||
0EBB6F2B1D6D10D500F75F4A /* pseudo_class.c in Sources */,
|
||||
0EFEFB7B1D4A301E00F2A070 /* parser.c in Sources */,
|
||||
0E7BE0FC1D434DB10063BDE5 /* stylesheet.c in Sources */,
|
||||
0E465B651CFC4CBA00CA7D65 /* mystring.c in Sources */,
|
||||
0E465B8B1CFC64F100CA7D65 /* init.c in Sources */,
|
||||
0E465B671CFC4CBA00CA7D65 /* perf.c in Sources */,
|
||||
0E465B271CFC4C5E00CA7D65 /* tokenizer_end.c in Sources */,
|
||||
0E465B691CFC4CBA00CA7D65 /* tag_init.c in Sources */,
|
||||
0E5D5C7E1D46AC0B001BA53C /* units.c in Sources */,
|
||||
0E7BE0FF1D43581F0063BDE5 /* list.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
0E465ABB1CFC4BC500CA7D65 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
0E465ABC1CFC4BC500CA7D65 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
0E465ABE1CFC4BC500CA7D65 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
HEADER_SEARCH_PATHS = ../../source;
|
||||
OTHER_CFLAGS = (
|
||||
"-DMyHTML_WITH_PERF",
|
||||
"-DMyHTML_FORCE_RDTSC",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
0E465ABF1CFC4BC500CA7D65 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
HEADER_SEARCH_PATHS = ../../source;
|
||||
OTHER_CFLAGS = (
|
||||
"-DMyHTML_WITH_PERF",
|
||||
"-DMyHTML_FORCE_RDTSC",
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
0E465AB11CFC4BC500CA7D65 /* Build configuration list for PBXProject "Modest" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
0E465ABB1CFC4BC500CA7D65 /* Debug */,
|
||||
0E465ABC1CFC4BC500CA7D65 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
0E465ABD1CFC4BC500CA7D65 /* Build configuration list for PBXNativeTarget "Modest" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
0E465ABE1CFC4BC500CA7D65 /* Debug */,
|
||||
0E465ABF1CFC4BC500CA7D65 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0E465AAE1CFC4BC500CA7D65 /* Project object */;
|
||||
}
|
7
devel/osx/Modest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
devel/osx/Modest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:Modest.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
</Bucket>
|
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0730"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0E465AB51CFC4BC500CA7D65"
|
||||
BuildableName = "Modest"
|
||||
BlueprintName = "Modest"
|
||||
ReferencedContainer = "container:Modest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0E465AB51CFC4BC500CA7D65"
|
||||
BuildableName = "Modest"
|
||||
BlueprintName = "Modest"
|
||||
ReferencedContainer = "container:Modest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0E465AB51CFC4BC500CA7D65"
|
||||
BuildableName = "Modest"
|
||||
BlueprintName = "Modest"
|
||||
ReferencedContainer = "container:Modest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0E465AB51CFC4BC500CA7D65"
|
||||
BuildableName = "Modest"
|
||||
BlueprintName = "Modest"
|
||||
ReferencedContainer = "container:Modest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>Modest.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>0E465AB51CFC4BC500CA7D65</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
188
devel/osx/Modest/main.c
Normal file
188
devel/osx/Modest/main.c
Normal file
@ -0,0 +1,188 @@
|
||||
/*
|
||||
Copyright (C) 2016 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 "mycss/mycss.h"
|
||||
#include "mycss/declaration/init.h"
|
||||
#include "modest/finder/finder.h"
|
||||
|
||||
struct res_data {
|
||||
char *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct res_data load_data(const char* filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "rb");
|
||||
fseek(f, 0L, SEEK_END);
|
||||
|
||||
long l = ftell(f);
|
||||
fseek(f, 0L, SEEK_SET);
|
||||
|
||||
char *html = (char*)myhtml_malloc(l);
|
||||
fread(html, 1, l, f);
|
||||
|
||||
fclose(f);
|
||||
|
||||
struct res_data res = {html, (size_t)l};
|
||||
return res;
|
||||
}
|
||||
|
||||
myhtml_tree_t * myhtml(const char* data, size_t data_size, bool is_file, bool print_result)
|
||||
{
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
myhtml_t* myhtml = myhtml_create();
|
||||
myhtml_init(myhtml, MyHTML_OPTIONS_DEFAULT, 1, 0);
|
||||
|
||||
uint64_t all_start = myhtml_hperf_clock(NULL);
|
||||
uint64_t tree_init_start = myhtml_hperf_clock(NULL);
|
||||
|
||||
myhtml_tree_t* tree = myhtml_tree_create();
|
||||
myhtml_tree_init(tree, myhtml);
|
||||
|
||||
uint64_t tree_init_stop = myhtml_hperf_clock(NULL);
|
||||
uint64_t parse_start = myhtml_hperf_clock(NULL);
|
||||
|
||||
if(is_file) {
|
||||
struct res_data res = load_data(data);
|
||||
myhtml_parse(tree, MyHTML_ENCODING_UTF_8, res.data, res.size);
|
||||
free(res.data);
|
||||
}
|
||||
else {
|
||||
myhtml_parse(tree, MyHTML_ENCODING_UTF_8, data, data_size);
|
||||
}
|
||||
|
||||
uint64_t parse_stop = myhtml_hperf_clock(NULL);
|
||||
uint64_t all_stop = myhtml_hperf_clock(NULL);
|
||||
|
||||
if(print_result) {
|
||||
myhtml_tree_print_node_children(tree, tree->document, stdout, 0);
|
||||
|
||||
printf("\n\nMyHTML Information:\n");
|
||||
printf("\tTicks/sec: %llu\n", (unsigned long long) myhtml_hperf_res(NULL));
|
||||
myhtml_hperf_print("\tFirst Tree init", tree_init_start, tree_init_stop, stdout);
|
||||
myhtml_hperf_print("\tParse html", parse_start, parse_stop, stdout);
|
||||
myhtml_hperf_print("\tTotal", all_start, all_stop, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
//myhtml_tree_destroy(tree);
|
||||
//myhtml_destroy(myhtml);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
mycss_entry_t * mycss(const char* data, size_t data_size, bool is_file, bool print_result)
|
||||
{
|
||||
// base init
|
||||
mycss_t *mycss = mycss_create();
|
||||
mycss_status_t status = mycss_init(mycss);
|
||||
|
||||
// currenr entry work init
|
||||
mycss_entry_t *entry = mycss_entry_create();
|
||||
status = mycss_entry_init(mycss, entry);
|
||||
|
||||
uint64_t parse_start = myhtml_hperf_clock(NULL);
|
||||
|
||||
if(is_file) {
|
||||
struct res_data res = load_data(data);
|
||||
mycss_parse(entry, MyHTML_ENCODING_UTF_8, res.data, res.size);
|
||||
free(res.data);
|
||||
}
|
||||
else {
|
||||
mycss_parse(entry, MyHTML_ENCODING_UTF_8, data, data_size);
|
||||
}
|
||||
|
||||
uint64_t parse_stop = myhtml_hperf_clock(NULL);
|
||||
|
||||
if(print_result) {
|
||||
printf("\n");
|
||||
mycss_stylesheet_t *stylesheet = mycss_entry_stylesheet(entry);
|
||||
mycss_selectors_print_list(entry->selectors, stylesheet->sel_list_first, stdout);
|
||||
|
||||
printf("\n------------\nMyCSS Information:\n");
|
||||
printf("\tTicks/sec: %llu\n", (unsigned long long) myhtml_hperf_res(NULL));
|
||||
myhtml_hperf_print("\tParse css", parse_start, parse_stop, stdout);
|
||||
}
|
||||
|
||||
//mycss_entry_destroy(entry, true);
|
||||
//mycss_destroy(mycss, true);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
char *html = "<fff>sdsd<aaaa id=hash class=best><div a1><menu class=\"lalala\" id=\"menu-id\" b1><span span1><div a2></div></div><span span2></aaaa><a href=\"\" sec></a><div div1><div div2></div><div div3></div><div div4></div></div><p p1><p p2><p p3><p p4>";
|
||||
//char *html = "/new/C-git/test_full.html";
|
||||
char *css = "img {width: auto\\9; height: auto; max-width: 100%; -ms-interpolation-mode: bicubic;}";
|
||||
char *selector = "html|fff >> div";
|
||||
|
||||
myhtml_tree_t *myhtml_tree = myhtml(html, strlen(html), false, true);
|
||||
mycss_entry_t *mycss_entry = mycss(css, strlen(css), false, true);
|
||||
|
||||
mycss_stylesheet_t *stylesheet = mycss_entry_stylesheet(mycss_entry);
|
||||
|
||||
/* simple api */
|
||||
uint64_t parse_simple_start = myhtml_hperf_clock(NULL);
|
||||
|
||||
// mycss_status_t out_status;
|
||||
// modest_finder_t *finder = modest_finder_create_simple(myhtml_tree, NULL);
|
||||
//
|
||||
// mycss_selectors_list_t *list = mycss_selectors_parse(mycss_entry->selectors, MyHTML_ENCODING_UTF_8, selector, strlen(selector), &out_status);
|
||||
// myhtml_collection_t *collection = modest_finder_by_selectors_list(finder, list, myhtml_tree->node_html, NULL);
|
||||
//
|
||||
uint64_t parse_simple_stop = myhtml_hperf_clock(NULL);
|
||||
//
|
||||
// printf("\nPrint simple result:\n");
|
||||
// for(size_t i = 0; i < collection->length; i++) {
|
||||
// myhtml_tree_print_node(myhtml_tree, collection->list[i], stdout);
|
||||
// }
|
||||
//
|
||||
// finder = modest_finder_destroy(finder, true);
|
||||
|
||||
/* full api */
|
||||
uint64_t parse_start = myhtml_hperf_clock(NULL);
|
||||
|
||||
myhtml_collection_t* full_collection = NULL;
|
||||
modest_finder_t *finder_full = modest_finder_by_stylesheet(myhtml_tree, stylesheet, &full_collection, NULL, NULL);
|
||||
|
||||
uint64_t parse_stop = myhtml_hperf_clock(NULL);
|
||||
|
||||
printf("\n\n------------\nInformation:\n");
|
||||
printf("\tTicks/sec: %llu\n", (unsigned long long) myhtml_hperf_res(NULL));
|
||||
myhtml_hperf_print("\tFound selectors", parse_start, parse_stop, stdout);
|
||||
myhtml_hperf_print("\tParse and Found Simple selectors", parse_simple_start, parse_simple_stop, stdout);
|
||||
printf("\n");
|
||||
|
||||
printf("\nPrint result:\n");
|
||||
for(size_t i = 0; i < full_collection->length; i++) {
|
||||
myhtml_tree_print_node(myhtml_tree, full_collection->list[i], stdout);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
modest_finder_destroy(finder_full, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
32
examples/Makefile
Normal file
32
examples/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
TARGET := examples
|
||||
SRCDIR := examples
|
||||
|
||||
CC ?= gcc
|
||||
LIBS := ../lib/libmodest_static.a
|
||||
LDLIBS := $(LIBS)
|
||||
|
||||
INCLUDE_TMP := include
|
||||
|
||||
MODEST_OPTIMIZATION_LEVEL ?= -O2
|
||||
|
||||
CFLAGS ?= -Wall -Werror
|
||||
CFLAGS += $(MODEST_OPTIMIZATION_LEVEL) -fPIC --std=c99 -I../include
|
||||
|
||||
find_files_h = $(wildcard $(dir)/*.h)
|
||||
find_files_c = $(wildcard $(dir)/*.c)
|
||||
|
||||
SUBDIRS := selectors
|
||||
HDRS += $(foreach dir,$(SUBDIRS),$(find_files_h))
|
||||
SRCS += $(foreach dir,$(SUBDIRS),$(find_files_c))
|
||||
|
||||
OBJS := $(patsubst %.c,%,$(SRCS))
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
cp -r $(OBJS) ../bin/
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
.PHONY: all
|
101
examples/selectors/selectors_low_level.c
Normal file
101
examples/selectors/selectors_low_level.c
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright (C) 2016 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/selectors/init.h>
|
||||
#include <modest/finder/finder.h>
|
||||
|
||||
myhtml_tree_t * parse_html(const char* data, size_t data_size)
|
||||
{
|
||||
myhtml_t* myhtml = myhtml_create();
|
||||
myhtml_init(myhtml, MyHTML_OPTIONS_DEFAULT, 1, 0);
|
||||
|
||||
myhtml_tree_t* tree = myhtml_tree_create();
|
||||
myhtml_tree_init(tree, myhtml);
|
||||
|
||||
myhtml_parse(tree, MyHTML_ENCODING_UTF_8, data, data_size);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
mycss_entry_t * create_css_parser(void)
|
||||
{
|
||||
// base init
|
||||
mycss_t *mycss = mycss_create();
|
||||
mycss_status_t status = mycss_init(mycss);
|
||||
|
||||
// currenr entry work init
|
||||
mycss_entry_t *entry = mycss_entry_create();
|
||||
status = mycss_entry_init(mycss, entry);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
int main(int argc, const char * argv[])
|
||||
{
|
||||
const char *html = "<div><p id=p1><p id=p2><p id=p3><a>link</a><p id=p4><p id=p5><p id=p6></div>";
|
||||
const char *selector = "div > :nth-child(2n+1):not(:has(a))";
|
||||
|
||||
myhtml_tree_t *html_tree = parse_html(html, strlen(html));
|
||||
mycss_entry_t *css_entry = create_css_parser();
|
||||
|
||||
mycss_status_t out_status;
|
||||
modest_finder_t *finder = modest_finder_create_simple(html_tree, NULL);
|
||||
|
||||
mycss_selectors_list_t *list = mycss_selectors_parse(css_entry->selectors, MyHTML_ENCODING_UTF_8, selector, strlen(selector), &out_status);
|
||||
myhtml_collection_t *collection = modest_finder_by_selectors_list(finder, list, html_tree->node_html, NULL);
|
||||
|
||||
/* destroy Modest finder */
|
||||
modest_finder_destroy(finder, true);
|
||||
|
||||
/* print result */
|
||||
fprintf(stdout, "HTML Tree:\n");
|
||||
myhtml_tree_print_node_children(html_tree, html_tree->document, stdout, 0);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
fprintf(stdout, "Selector:\n\t");
|
||||
mycss_selectors_print_list(css_entry->selectors, list, stdout);
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
printf("\nFound result:\n");
|
||||
for(size_t i = 0; i < collection->length; i++) {
|
||||
fprintf(stdout, "\t");
|
||||
myhtml_tree_print_node(html_tree, collection->list[i], stdout);
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
// destroy all
|
||||
mycss_t *mycss = css_entry->mycss;
|
||||
mycss_entry_destroy(css_entry, true);
|
||||
mycss_destroy(mycss, true);
|
||||
|
||||
myhtml_t* myhtml = html_tree->myhtml;
|
||||
myhtml_tree_destroy(html_tree);
|
||||
myhtml_destroy(myhtml);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
68
include/modest/finder/finder.h
Normal file
68
include/modest/finder/finder.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_FINDER_FINDER_H
|
||||
#define MODEST_FINDER_FINDER_H
|
||||
#pragma once
|
||||
|
||||
#include <modest/finder/myosi.h>
|
||||
#include <modest/finder/type.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/list.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
#endif
|
||||
|
||||
typedef bool (*modest_finder_selector_type_f)(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
typedef myhtml_tree_node_t * (*modest_finder_selector_combinator_f)(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
|
||||
/* init */
|
||||
modest_finder_t * modest_finder_create(void);
|
||||
modest_status_t modest_finder_init(modest_finder_t* finder, myhtml_tree_t* myhtml_tree, mycss_stylesheet_t *stylesheet);
|
||||
void modest_finder_clean(modest_finder_t* finder);
|
||||
modest_finder_t * modest_finder_destroy(modest_finder_t* finder, bool self_destroy);
|
||||
|
||||
/* simple api */
|
||||
modest_finder_t * modest_finder_create_simple(myhtml_tree_t* myhtml_tree, mycss_stylesheet_t *stylesheet);
|
||||
|
||||
/* callbacks */
|
||||
void modest_finder_callback_found_with_collection(modest_finder_t* finder, myhtml_tree_node_t* node, void* ctx);
|
||||
void modest_finder_callback_found_with_bool(modest_finder_t* finder, myhtml_tree_node_t* node, void* ctx);
|
||||
|
||||
/* base api */
|
||||
void modest_finder_begin(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
modest_finder_t * modest_finder_by_stylesheet(myhtml_tree_t* myhtml_tree, mycss_stylesheet_t *stylesheet, myhtml_collection_t** collection, myhtml_tree_node_t* base_node, mycss_selectors_list_t* selector_list);
|
||||
myhtml_collection_t * modest_finder_by_selectors_list(modest_finder_t* finder, mycss_selectors_list_t *sel_list, myhtml_tree_node_t* base_node, myhtml_collection_t* collection);
|
||||
|
||||
/* process */
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_begin(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_undef(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_descendant(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_next_sibling(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_following_sibling(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
myhtml_tree_node_t * modest_finder_node_combinator_column(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MODEST_FINDER_FINDER_H */
|
44
include/modest/finder/match.h
Normal file
44
include/modest/finder/match.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_FINDER_MATCH_H
|
||||
#define MODEST_FINDER_MATCH_H
|
||||
#pragma once
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
#endif
|
||||
|
||||
bool modest_finder_match_attribute_only_key(myhtml_token_attr_t* attr, const char* key, size_t key_len);
|
||||
bool modest_finder_match_attribute_eq(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
bool modest_finder_match_attribute_ws(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
bool modest_finder_match_attribute_begin(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
bool modest_finder_match_attribute_end(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
bool modest_finder_match_attribute_sub(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
bool modest_finder_match_attribute_hsp(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MODEST_FINDER_MATCH_H */
|
51
include/modest/finder/myosi.h
Normal file
51
include/modest/finder/myosi.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_FINDER_MYOSI_H
|
||||
#define MODEST_FINDER_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#include <modest/myosi.h>
|
||||
#include <myhtml/myosi.h>
|
||||
#include <mycss/myosi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
#endif
|
||||
|
||||
struct modest_finder typedef modest_finder_t;
|
||||
|
||||
typedef void (*modest_finder_callback_f)(modest_finder_t* finder, myhtml_tree_node_t* node, void* ctx);
|
||||
typedef bool (*modest_finder_match_f)(myhtml_token_attr_t* attr, const char* key, size_t key_len, const char* value, size_t value_len, bool case_sensitive);
|
||||
|
||||
struct modest_finder {
|
||||
myhtml_tree_t* tree;
|
||||
mycss_stylesheet_t* stylesheet;
|
||||
|
||||
modest_finder_callback_f callback_found;
|
||||
void* callback_found_ctx;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MODEST_FINDER_MYOSI_H */
|
92
include/modest/finder/pseudo_class.h
Normal file
92
include/modest/finder/pseudo_class.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_FINDER_PSEUDO_CLASS_H
|
||||
#define MODEST_FINDER_PSEUDO_CLASS_H
|
||||
#pragma once
|
||||
|
||||
#include <modest/finder/myosi.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/value.h>
|
||||
#include <modest/finder/finder.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
#endif
|
||||
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_undef(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_current(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_dir(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_drop(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_has(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_lang(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_matches(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_not(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_nth_child(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_nth_column(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_child(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_column(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_function_nth_of_type(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
|
||||
/* classes */
|
||||
bool modest_finder_selector_sub_type_pseudo_class_undef(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_active(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_any_link(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_blank(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_checked(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_current(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_default(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_disabled(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_drop(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_empty(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_enabled(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_first_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_first_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_focus(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_future(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_hover(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_in_range(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_indeterminate(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_invalid(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_last_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_link(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_only_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_only_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_optional(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_out_of_range(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_past(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_placeholder_shown(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_read_only(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_read_write(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_required(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_root(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_scope(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_target(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_user_error(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_valid(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_sub_type_pseudo_class_visited(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MODEST_FINDER_PSEUDO_CLASS_H */
|
125
include/modest/finder/resource.h
Normal file
125
include/modest/finder/resource.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_FINDER_RESOURCE_H
|
||||
#define MODEST_FINDER_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
/* see enum mycss_selectors_type (mycss_selectors_type_t) on mycss/selectors/myosi.h */
|
||||
static const modest_finder_selector_type_f modest_finder_static_selector_type_map[MyCSS_SELECTORS_TYPE_LAST_ENTRY] =
|
||||
{
|
||||
modest_finder_selector_type_undef, /* MyCSS_SELECTORS_TYPE_UNDEF */
|
||||
modest_finder_selector_type_element, /* MyCSS_SELECTORS_TYPE_ELEMENT */
|
||||
modest_finder_selector_type_id, /* MyCSS_SELECTORS_TYPE_ID */
|
||||
modest_finder_selector_type_class, /* MyCSS_SELECTORS_TYPE_CLASS */
|
||||
modest_finder_selector_type_attribute, /* MyCSS_SELECTORS_TYPE_ATTRIBUTE */
|
||||
modest_finder_selector_type_pseudo_class_function, /* MyCSS_SELECTORS_TYPE_PSEUDO_CLASS_FUNCTION */
|
||||
modest_finder_selector_type_pseudo_class, /* MyCSS_SELECTORS_TYPE_PSEUDO_CLASS */
|
||||
modest_finder_selector_type_pseudo_element_function, /* MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT_FUNCTION */
|
||||
modest_finder_selector_type_pseudo_element /* MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT */
|
||||
};
|
||||
|
||||
/* see enum mycss_selectors_sub_type (mycss_selectors_sub_type_t) on mycss/selectors/myosi.h */
|
||||
static const modest_finder_selector_type_f modest_finder_static_selector_sub_type_pseudo_class_function_map[MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LAST_ENTRY] =
|
||||
{
|
||||
modest_finder_selector_sub_type_pseudo_class_function_undef, /* UNDEF */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_undef, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNKNOWN */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_current, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CURRENT */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_dir, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DIR */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_drop, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DROP */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_has, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_HAS */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_lang, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LANG */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_matches, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_MATCHES */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_not, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NOT */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_nth_child, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_CHILD */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_nth_column, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_COLUMN */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_nth_last_child, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_CHILD */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_nth_last_column, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_COLUMN */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_OF_TYPE */
|
||||
modest_finder_selector_sub_type_pseudo_class_function_nth_of_type /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE */
|
||||
|
||||
};
|
||||
|
||||
/* see enum mycss_selectors_sub_type (mycss_selectors_sub_type_t) on mycss/selectors/myosi.h */
|
||||
static const modest_finder_selector_type_f modest_finder_static_selector_sub_type_pseudo_class_map[MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_ENTRY] =
|
||||
{
|
||||
modest_finder_selector_sub_type_pseudo_class_undef, /* UNDEF */
|
||||
modest_finder_selector_sub_type_pseudo_class_undef, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNKNOWN */
|
||||
modest_finder_selector_sub_type_pseudo_class_active, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ACTIVE */
|
||||
modest_finder_selector_sub_type_pseudo_class_any_link, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ANY_LINK */
|
||||
modest_finder_selector_sub_type_pseudo_class_blank, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_BLANK */
|
||||
modest_finder_selector_sub_type_pseudo_class_checked, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_CHECKED */
|
||||
modest_finder_selector_sub_type_pseudo_class_current, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_CURRENT */
|
||||
modest_finder_selector_sub_type_pseudo_class_default, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DEFAULT */
|
||||
modest_finder_selector_sub_type_pseudo_class_disabled, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DISABLED */
|
||||
modest_finder_selector_sub_type_pseudo_class_drop, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DROP */
|
||||
modest_finder_selector_sub_type_pseudo_class_empty, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_EMPTY */
|
||||
modest_finder_selector_sub_type_pseudo_class_enabled, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ENABLED */
|
||||
modest_finder_selector_sub_type_pseudo_class_first_child, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FIRST_CHILD */
|
||||
modest_finder_selector_sub_type_pseudo_class_first_of_type, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FIRST_OF_TYPE */
|
||||
modest_finder_selector_sub_type_pseudo_class_focus, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FOCUS */
|
||||
modest_finder_selector_sub_type_pseudo_class_future, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUTURE */
|
||||
modest_finder_selector_sub_type_pseudo_class_hover, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_HOVER */
|
||||
modest_finder_selector_sub_type_pseudo_class_in_range, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_IN_RANGE */
|
||||
modest_finder_selector_sub_type_pseudo_class_indeterminate, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_INDETERMINATE */
|
||||
modest_finder_selector_sub_type_pseudo_class_invalid, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_INVALID */
|
||||
modest_finder_selector_sub_type_pseudo_class_last_child, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_CHILD */
|
||||
modest_finder_selector_sub_type_pseudo_class_last_of_type, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_OF_TYPE */
|
||||
modest_finder_selector_sub_type_pseudo_class_link, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LINK */
|
||||
modest_finder_selector_sub_type_pseudo_class_only_child, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ONLY_CHILD */
|
||||
modest_finder_selector_sub_type_pseudo_class_only_of_type, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ONLY_OF_TYPE */
|
||||
modest_finder_selector_sub_type_pseudo_class_optional, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_OPTIONAL */
|
||||
modest_finder_selector_sub_type_pseudo_class_out_of_range, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_OUT_OF_RANGE */
|
||||
modest_finder_selector_sub_type_pseudo_class_past, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_PAST */
|
||||
modest_finder_selector_sub_type_pseudo_class_placeholder_shown, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_PLACEHOLDER_SHOWN */
|
||||
modest_finder_selector_sub_type_pseudo_class_read_only, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_READ_ONLY */
|
||||
modest_finder_selector_sub_type_pseudo_class_read_write, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_READ_WRITE */
|
||||
modest_finder_selector_sub_type_pseudo_class_required, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_REQUIRED */
|
||||
modest_finder_selector_sub_type_pseudo_class_root, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ROOT */
|
||||
modest_finder_selector_sub_type_pseudo_class_scope, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_SCOPE */
|
||||
modest_finder_selector_sub_type_pseudo_class_target, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_TARGET */
|
||||
modest_finder_selector_sub_type_pseudo_class_user_error, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_USER_ERROR */
|
||||
modest_finder_selector_sub_type_pseudo_class_valid, /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_VALID */
|
||||
modest_finder_selector_sub_type_pseudo_class_visited /* MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_VISITED */
|
||||
};
|
||||
|
||||
/* see enum mycss_selectors_combinator (mycss_selectors_combinator_t) on mycss/selectors/myosi.h */
|
||||
static const modest_finder_selector_combinator_f modest_finder_static_selector_combinator_map[MyCSS_SELECTORS_COMBINATOR_LAST_ENTRY] =
|
||||
{
|
||||
modest_finder_node_combinator_undef, /* MyCSS_SELECTORS_COMBINATOR_UNDEF */
|
||||
modest_finder_node_combinator_descendant, /* MyCSS_SELECTORS_COMBINATOR_DESCENDANT */
|
||||
modest_finder_node_combinator_child, /* MyCSS_SELECTORS_COMBINATOR_CHILD */
|
||||
modest_finder_node_combinator_next_sibling, /* MyCSS_SELECTORS_COMBINATOR_NEXT_SIBLING */
|
||||
modest_finder_node_combinator_following_sibling, /* MyCSS_SELECTORS_COMBINATOR_FOLLOWING_SIBLING */
|
||||
modest_finder_node_combinator_column /* MyCSS_SELECTORS_COMBINATOR_COLUMN */
|
||||
};
|
||||
|
||||
/* see enum mycss_selectors_match (mycss_selectors_match_t) on mycss/selectors/myosi.h */
|
||||
static const modest_finder_match_f modest_finder_static_selector_match_map[MyCSS_SELECTORS_MATCH_LAST_ENTRY] =
|
||||
{
|
||||
modest_finder_match_attribute_eq, /* MyCSS_SELECTORS_MATCH_EQUAL */
|
||||
modest_finder_match_attribute_ws, /* MyCSS_SELECTORS_MATCH_INCLUDE */
|
||||
modest_finder_match_attribute_hsp, /* MyCSS_SELECTORS_MATCH_DASH */
|
||||
modest_finder_match_attribute_begin, /* MyCSS_SELECTORS_MATCH_PREFIX */
|
||||
modest_finder_match_attribute_end, /* MyCSS_SELECTORS_MATCH_SUFFIX */
|
||||
modest_finder_match_attribute_sub /* MyCSS_SELECTORS_MATCH_SUBSTRING */
|
||||
};
|
||||
|
||||
#endif /* MODEST_FINDER_RESOURCE_H */
|
54
include/modest/finder/type.h
Normal file
54
include/modest/finder/type.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_FINDER_TYPE_H
|
||||
#define MODEST_FINDER_TYPE_H
|
||||
#pragma once
|
||||
|
||||
#include <modest/finder/myosi.h>
|
||||
#include <modest/finder/finder.h>
|
||||
#include <modest/finder/pseudo_class.h>
|
||||
#include <modest/finder/match.h>
|
||||
#include <myhtml/tree.h>
|
||||
#include <myhtml/utils.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/list.h>
|
||||
#include <mycss/selectors/value.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
#endif
|
||||
|
||||
bool modest_finder_selector_type_undef(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_element(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_id(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_class(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_attribute(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_pseudo_class_function(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_pseudo_class(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_pseudo_element_function(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
bool modest_finder_selector_type_pseudo_element(modest_finder_t* finder, myhtml_tree_node_t* node, mycss_selectors_entry_t* selector);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MODEST_FINDER_TYPE_H */
|
52
include/modest/myosi.h
Normal file
52
include/modest/myosi.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MODEST_MYOSI_H
|
||||
#define MODEST_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
#endif
|
||||
|
||||
// base
|
||||
/*
|
||||
Very important!!!
|
||||
|
||||
for myhtml 0..00ffff; MyHTML_STATUS_OK == 0x000000
|
||||
for mycss and modules 010000..01ffff; MyCSS_STATUS_OK == 0x000000
|
||||
for modest 020000..02ffff; MODEST_STATUS_OK == 0x000000
|
||||
for myrender 030000..03ffff; MyRENDER_STATUS_OK == 0x000000
|
||||
for mydom 040000..04ffff; MyDOM_STATUS_OK == 0x000000
|
||||
for mynetwork 050000..05ffff; MyNETWORK_STATUS_OK == 0x000000
|
||||
for myecma 060000..06ffff; MyECMA_STATUS_OK == 0x000000
|
||||
not occupied 070000..
|
||||
*/
|
||||
enum modest_status {
|
||||
MODEST_STATUS_OK = 0x000000,
|
||||
MODEST_STATUS_ERROR_MEMORY_ALLOCATION = 0x020000
|
||||
}
|
||||
typedef modest_status_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MODEST_MYOSI_H */
|
71
include/mycss/an_plus_b.h
Normal file
71
include/mycss/an_plus_b.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_AN_PLUS_B_H
|
||||
#define MyHTML_MyCSS_AN_PLUS_B_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/list.h>
|
||||
|
||||
#define mycss_an_plus_b_current_entry(entry) (*entry->anb->entry)
|
||||
|
||||
struct mycss_an_plus_b {
|
||||
mycss_an_plus_b_entry_t** entry;
|
||||
};
|
||||
|
||||
struct mycss_an_plus_b_entry {
|
||||
long a;
|
||||
long b;
|
||||
long n;
|
||||
|
||||
bool is_broken;
|
||||
mycss_selectors_list_t* of;
|
||||
};
|
||||
|
||||
mycss_an_plus_b_t * mycss_an_plus_b_create(void);
|
||||
mycss_status_t mycss_an_plus_b_init(mycss_entry_t* entry, mycss_an_plus_b_t* anb);
|
||||
mycss_status_t mycss_an_plus_b_clean_all(mycss_an_plus_b_t* anb);
|
||||
mycss_an_plus_b_t * mycss_an_plus_b_destroy(mycss_an_plus_b_t* anb, bool self_destroy);
|
||||
|
||||
mycss_an_plus_b_entry_t * mycss_an_plus_b_entry_create(mycss_entry_t* entry);
|
||||
void mycss_an_plus_b_entry_clean_all(mycss_an_plus_b_entry_t* anb_entry);
|
||||
mycss_an_plus_b_entry_t * mycss_an_plus_b_entry_destroy(mycss_entry_t* entry, mycss_an_plus_b_entry_t* anb_entry, bool self_destroy);
|
||||
|
||||
void mycss_an_plus_b_print(mycss_an_plus_b_entry_t* anb_entry, FILE* fh);
|
||||
|
||||
void mycss_an_plus_b_parser_expectations_error(mycss_entry_t* entry);
|
||||
|
||||
bool mycss_an_plus_b_state_anb_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_an_plus_b_state_anb(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_an_plus_b_state_anb_plus(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_an_plus_b_state_anb_plus_n_hyphen(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_an_plus_b_state_anb_plus_n(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_an_plus_b_state_anb_plus_n_plus(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_AN_PLUS_B_H */
|
524
include/mycss/api.h
Normal file
524
include/mycss/api.h
Normal file
@ -0,0 +1,524 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyCSS_MyCSS_API_H
|
||||
#define MyCSS_MyCSS_API_H
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file mycss/api.h
|
||||
*
|
||||
* Fast C/C++ CSS Parser (Cascading Style Sheets). Using threads.
|
||||
*
|
||||
* C99 and POSIX Threads!
|
||||
* This is part of big project.
|
||||
* All projects (and this too) is based on myhtml (https://github.com/lexborisov/myhtml)
|
||||
*
|
||||
* By https://www.w3.org/TR/css-syntax-3/ specification.
|
||||
*
|
||||
*/
|
||||
|
||||
#define MyCSS_VERSION_MAJOR 0
|
||||
#define MyCSS_VERSION_MINOR 0
|
||||
#define MyCSS_VERSION_PATCH 9
|
||||
|
||||
#include <myhtml/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @struct mycss statuses
|
||||
*/
|
||||
// base
|
||||
// base
|
||||
/*
|
||||
Very important!!!
|
||||
|
||||
for myhtml 0..00ffff; MyHTML_STATUS_OK == 0x000000
|
||||
for mycss and modules 010000..01ffff; MyCSS_STATUS_OK == 0x000000
|
||||
for modest 020000..02ffff; MODEST_STATUS_OK == 0x000000
|
||||
for myrender 030000..03ffff; MyRENDER_STATUS_OK == 0x000000
|
||||
for mydom 040000..04ffff; MyDOM_STATUS_OK == 0x000000
|
||||
for mynetwork 050000..05ffff; MyNETWORK_STATUS_OK == 0x000000
|
||||
for myecma 060000..06ffff; MyECMA_STATUS_OK == 0x000000
|
||||
not occupied 070000..
|
||||
*/
|
||||
enum mycss_status {
|
||||
MyCSS_STATUS_OK = 0x000000,
|
||||
MyCSS_STATUS_ERROR_MEMORY_ALLOCATION = 0x010001,
|
||||
MyCSS_STATUS_ERROR_TOKENIZER_STATE_ALLOCATION = 0x010020,
|
||||
MyCSS_STATUS_ERROR_TOKENIZER_INCOMING_BUFFER_ADD = 0x010021,
|
||||
MyCSS_STATUS_ERROR_TOKENIZER_TOKEN_ALLOCATION = 0x010022,
|
||||
MyCSS_STATUS_ERROR_INCOMING_BUFFER_INIT = 0x010030,
|
||||
MyCSS_STATUS_ERROR_ENTRY_INCOMING_BUFFER_CREATE = 0x010039,
|
||||
MyCSS_STATUS_ERROR_ENTRY_INCOMING_BUFFER_INIT = 0x010040,
|
||||
MyCSS_STATUS_ERROR_ENTRY_TOKEN_INCOMING_BUFFER_INIT = 0x010041,
|
||||
MyCSS_STATUS_ERROR_ENTRY_TOKEN_NODE_ADD = 0x010042,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_CREATE = 0x010100,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_ENTRIES_CREATE = 0x010101,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_ENTRIES_INIT = 0x010102,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_ENTRIES_NODE_ADD = 0x010103,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_LIST_CREATE = 0x010104,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_LIST_INIT = 0x010105,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_LIST_ADD_NODE = 0x010106,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_CREATE = 0x010200,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_INIT = 0x010201,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_ENTRIES_CREATE = 0x010202,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_ENTRIES_INIT = 0x010203,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_NODE_ADD = 0x010204,
|
||||
MyCSS_STATUS_ERROR_MEDIA_CREATE = 0x010404,
|
||||
MyCSS_STATUS_ERROR_STRING_CREATE = 0x010501,
|
||||
MyCSS_STATUS_ERROR_STRING_INIT = 0x010502,
|
||||
MyCSS_STATUS_ERROR_STRING_NODE_INIT = 0x010503,
|
||||
MyCSS_STATUS_ERROR_AN_PLUS_B_CREATE = 0x010600,
|
||||
MyCSS_STATUS_ERROR_AN_PLUS_B_INIT = 0x010601,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_CREATE = 0x010700,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_INIT = 0x010701,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_ENTRY_CREATE = 0x010702,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_ENTRY_INIT = 0x010703,
|
||||
MyCSS_STATUS_ERROR_PARSER_LIST_CREATE = 0x010800
|
||||
}
|
||||
typedef mycss_status_t;
|
||||
|
||||
#define MyCSS_FAILED(_status_) ((_status_) != MyCSS_STATUS_OK)
|
||||
|
||||
/**
|
||||
* Tokenizer Token types
|
||||
*/
|
||||
enum mycss_token_type {
|
||||
MyCSS_TOKEN_TYPE_UNDEF = 0x0000,
|
||||
MyCSS_TOKEN_TYPE_WHITESPACE = 0x0001,
|
||||
MyCSS_TOKEN_TYPE_IDENT = 0x0002,
|
||||
MyCSS_TOKEN_TYPE_FUNCTION = 0x0003,
|
||||
MyCSS_TOKEN_TYPE_AT_KEYWORD = 0x0004,
|
||||
MyCSS_TOKEN_TYPE_HASH = 0x0005,
|
||||
MyCSS_TOKEN_TYPE_STRING = 0x0006,
|
||||
MyCSS_TOKEN_TYPE_URL = 0x0007,
|
||||
MyCSS_TOKEN_TYPE_NUMBER = 0x0008,
|
||||
MyCSS_TOKEN_TYPE_DIMENSION = 0x0009,
|
||||
MyCSS_TOKEN_TYPE_PERCENTAGE = 0x000a,
|
||||
MyCSS_TOKEN_TYPE_INCLUDE_MATCH = 0x000b,
|
||||
MyCSS_TOKEN_TYPE_DASH_MATCH = 0x000c,
|
||||
MyCSS_TOKEN_TYPE_PREFIX_MATCH = 0x000d,
|
||||
MyCSS_TOKEN_TYPE_SUFFIX_MATCH = 0x000e,
|
||||
MyCSS_TOKEN_TYPE_SUBSTRING_MATCH = 0x000f,
|
||||
MyCSS_TOKEN_TYPE_COLUMN = 0x0010,
|
||||
MyCSS_TOKEN_TYPE_CDO = 0x0011,
|
||||
MyCSS_TOKEN_TYPE_CDC = 0x0012,
|
||||
MyCSS_TOKEN_TYPE_BAD_STRING = 0x0013,
|
||||
MyCSS_TOKEN_TYPE_DELIM = 0x0014,
|
||||
MyCSS_TOKEN_TYPE_LEFT_PARENTHESIS = 0x0015,
|
||||
MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS = 0x0016,
|
||||
MyCSS_TOKEN_TYPE_COMMA = 0x0017,
|
||||
MyCSS_TOKEN_TYPE_COLON = 0x0018,
|
||||
MyCSS_TOKEN_TYPE_SEMICOLON = 0x0019,
|
||||
MyCSS_TOKEN_TYPE_LEFT_SQUARE_BRACKET = 0x001a,
|
||||
MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET = 0x001b,
|
||||
MyCSS_TOKEN_TYPE_LEFT_CURLY_BRACKET = 0x001c,
|
||||
MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET = 0x001d,
|
||||
MyCSS_TOKEN_TYPE_BAD_URL = 0x001e,
|
||||
MyCSS_TOKEN_TYPE_COMMENT = 0x001f,
|
||||
MyCSS_TOKEN_TYPE_UNICODE_RANGE = 0x0020,
|
||||
MyCSS_TOKEN_TYPE_EOF = 0x0021,
|
||||
MyCSS_TOKEN_TYPE_LAST_ENTRY = 0x0022
|
||||
}
|
||||
typedef mycss_token_type_t;
|
||||
|
||||
/**
|
||||
* @struct mycss_t MyCSS
|
||||
*
|
||||
* Basic structure. Create once for using many times.
|
||||
*/
|
||||
typedef struct mycss mycss_t;
|
||||
|
||||
/**
|
||||
* @struct mycss_entry_t MyCSS_ENTRY
|
||||
*
|
||||
* Secondary structure. Create once for using many times.
|
||||
*/
|
||||
typedef struct mycss_entry mycss_entry_t;
|
||||
|
||||
/**
|
||||
* @struct mycss_token_t MyCSS_TOKEN
|
||||
*
|
||||
* Tokenizer data structure.
|
||||
*/
|
||||
typedef struct mycss_token mycss_token_t;
|
||||
|
||||
/**
|
||||
* @struct mycss_token_done_callback_f
|
||||
*
|
||||
* Callback for token is ready
|
||||
*/
|
||||
typedef mycss_token_t*
|
||||
(*mycss_token_ready_callback_f)(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* MyCSS
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
/**
|
||||
* Create a MyCSS structure
|
||||
*
|
||||
* @return mycss_t* if successful, otherwise an NULL value.
|
||||
*/
|
||||
mycss_t*
|
||||
mycss_create(void);
|
||||
|
||||
/**
|
||||
* Allocating and Initialization resources for a MyCSS structure
|
||||
*
|
||||
* @param[in] mycss_t*
|
||||
*
|
||||
* @return MyCSS_STATUS_OK if successful, otherwise an error status value.
|
||||
*/
|
||||
mycss_status_t
|
||||
mycss_init(mycss_t* mycss);
|
||||
|
||||
/**
|
||||
* Destroy of a MyCSS structure
|
||||
*
|
||||
* @param[in] mycss_t*
|
||||
* @param[in] call free() function for mycss_t* object? true or false
|
||||
*
|
||||
* @return NULL if successful, otherwise an MyCSS structure.
|
||||
*/
|
||||
mycss_t*
|
||||
mycss_destroy(mycss_t* mycss, bool self_destroy);
|
||||
|
||||
/**
|
||||
* Parsing CSS
|
||||
*
|
||||
* @param[in] previously created structure mycss_entry_t*
|
||||
* @param[in] Now is not working! Coming Soon. Input character encoding; Default: MyHTML_ENCODING_UTF_8 or MyHTML_ENCODING_DEFAULT or 0
|
||||
* @param[in] CSS data
|
||||
* @param[in] CSS data size
|
||||
*
|
||||
* All input character encoding decode to utf-8
|
||||
*
|
||||
* @return MyCSS_STATUS_OK if successful, otherwise an error status
|
||||
*/
|
||||
mycss_status_t
|
||||
mycss_parse(mycss_entry_t* entry, myhtml_encoding_t encoding, const char* css, size_t css_size);
|
||||
|
||||
/**
|
||||
* Parsing CSS chunk. For End Parsing call mycss_parse_chunk_end function
|
||||
*
|
||||
* @param[in] previously created structure mycss_entry_t*
|
||||
* @param[in] CSS data
|
||||
* @param[in] CSS data size
|
||||
*
|
||||
* All input character encoding decode to utf-8
|
||||
*
|
||||
* @return MyCSS_STATUS_OK if successful, otherwise an error status
|
||||
*/
|
||||
mycss_status_t
|
||||
mycss_parse_chunk(mycss_entry_t* entry, const char* css, size_t css_size);
|
||||
|
||||
/**
|
||||
* End of parsing CSS chunks
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return MyCSS_STATUS_OK if successful, otherwise an error status
|
||||
*/
|
||||
mycss_status_t
|
||||
mycss_parse_chunk_end(mycss_entry_t* entry);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* MyCSS_ENTRY
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
/**
|
||||
* Create a MyCSS_ENTRY structure
|
||||
*
|
||||
* @return mycss_entry_t* if successful, otherwise an NULL value.
|
||||
*/
|
||||
mycss_entry_t*
|
||||
mycss_entry_create(void);
|
||||
|
||||
/**
|
||||
* Allocating and Initialization resources for a MyCSS_ENTRY structure
|
||||
*
|
||||
* @param[in] mycss_t*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return MyCSS_STATUS_OK if successful, otherwise an error status value.
|
||||
*/
|
||||
mycss_status_t
|
||||
mycss_entry_init(mycss_t* mycss, mycss_entry_t* entry);
|
||||
|
||||
/**
|
||||
* Clear all structures
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return MyCSS_STATUS_OK if successful, otherwise an error status value.
|
||||
*/
|
||||
mycss_status_t
|
||||
mycss_entry_clean_all(mycss_entry_t* entry);
|
||||
|
||||
/**
|
||||
* Destroy of a MyCSS_ENTRY structure
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
* @param[in] call free() function for mycss_entry_t* object? true or false
|
||||
*
|
||||
* @return NULL if successful, otherwise an MyCSS_ENTRY structure.
|
||||
*/
|
||||
mycss_entry_t*
|
||||
mycss_entry_destroy(mycss_entry_t* entry, bool self_destroy);
|
||||
|
||||
/**
|
||||
* Set or Get current callback function for token is ready
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
* @param[in] mycss_token_ready_callback_f
|
||||
* function which will be returned when the token is ready
|
||||
* or NULL for only return current function
|
||||
*
|
||||
* @example_function
|
||||
* mycss_token_t * your_name_callback(mycss_entry_t* entry, mycss_token_t* token) {
|
||||
* return token;
|
||||
* }
|
||||
*
|
||||
* @example See tokenizer_high_level.c in examples directory
|
||||
*
|
||||
* @return mycss_token_ready_callback_f structure
|
||||
*/
|
||||
mycss_token_ready_callback_f
|
||||
mycss_entry_token_ready_callback(mycss_entry_t* entry,
|
||||
mycss_token_ready_callback_f callback_f);
|
||||
|
||||
/**
|
||||
* Get tokens count
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return count of token
|
||||
*/
|
||||
size_t
|
||||
mycss_entry_token_count(mycss_entry_t* entry);
|
||||
|
||||
/**
|
||||
* Get current Incoming Buffer
|
||||
* See MyHTML_INCOMING in https://github.com/lexborisov/myhtml
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return myhtml_incoming_buffer_t* if successful, otherwise an NULL value.
|
||||
*/
|
||||
myhtml_incoming_buffer_t*
|
||||
mycss_entry_incoming_buffer_current(mycss_entry_t* entry);
|
||||
|
||||
/**
|
||||
* Get first Incoming Buffer from list
|
||||
* See MyHTML_INCOMING in https://github.com/lexborisov/myhtml
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return myhtml_incoming_buffer_t* if successful, otherwise an NULL value.
|
||||
*/
|
||||
myhtml_incoming_buffer_t*
|
||||
mycss_entry_incoming_buffer_first(mycss_entry_t* entry);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* MyCSS_TOKEN
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
/**
|
||||
* Get begin position of Token
|
||||
*
|
||||
* @param[in] mycss_token_t*
|
||||
*
|
||||
* @return size_t, begin position for token
|
||||
*/
|
||||
size_t
|
||||
mycss_token_begin(mycss_token_t* token);
|
||||
|
||||
/**
|
||||
* Get length of Token
|
||||
*
|
||||
* @param[in] mycss_token_t*
|
||||
*
|
||||
* @return size_t, length of token
|
||||
*/
|
||||
size_t
|
||||
mycss_token_length(mycss_token_t* token);
|
||||
|
||||
/**
|
||||
* Get begin position and length for Token
|
||||
*
|
||||
* @param[in] mycss_token_t*
|
||||
* @param[out] size_t*, optional, token length
|
||||
*
|
||||
* @return size_t, begin position for token
|
||||
*/
|
||||
size_t
|
||||
mycss_token_position(mycss_token_t* token, size_t *return_length);
|
||||
|
||||
/**
|
||||
* Get Token type
|
||||
*
|
||||
* @param[in] mycss_token_t*
|
||||
*
|
||||
* @return mycss_token_type_t
|
||||
*/
|
||||
mycss_token_type_t
|
||||
mycss_token_type(mycss_token_t* token);
|
||||
|
||||
/**
|
||||
* Get Token name by Token type
|
||||
*
|
||||
* @param[in] mycss_token_type_t
|
||||
*
|
||||
* @return token name terminated with a null character ('\0')
|
||||
*/
|
||||
const char*
|
||||
mycss_token_name_by_type(mycss_token_type_t type);
|
||||
|
||||
/**
|
||||
* Converting raw token data (your input const char*)
|
||||
* to strict string as required by the specification
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
* @param[in] mycss_token_t*, token from which data will be obtained
|
||||
* @param[in] myhtml_string_t*, a pointer to the row in which the data will be written
|
||||
* @param[in] initialization myhtml_string_t* object
|
||||
*
|
||||
* @return length of processed data
|
||||
*/
|
||||
size_t
|
||||
mycss_token_data_to_string(mycss_entry_t* entry, mycss_token_t* token,
|
||||
myhtml_string_t* str, bool init_string);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* MyCSS_ENCODING
|
||||
*
|
||||
* @description It is inherited from the main project MyHTML
|
||||
* See https://github.com/lexborisov/myhtml
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
/**
|
||||
* Set character encoding for input stream
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
* @param[in] Input character encoding.
|
||||
* See https://github.com/lexborisov/myhtml/blob/master/source/myhtml/api.h
|
||||
* myhtml_encoding_t
|
||||
*
|
||||
*/
|
||||
void
|
||||
mycss_encoding_set(mycss_entry_t* entry, myhtml_encoding_t encoding);
|
||||
|
||||
/**
|
||||
* Get character encoding for current stream
|
||||
*
|
||||
* @param[in] mycss_entry_t*
|
||||
*
|
||||
* @return myhtml_encoding_t
|
||||
*/
|
||||
myhtml_encoding_t
|
||||
mycss_encoding_get(mycss_entry_t* entry);
|
||||
|
||||
/**
|
||||
* Get encoding from @charset "...";
|
||||
*
|
||||
* See for information:
|
||||
* https://www.w3.org/TR/css-syntax-3/#get-an-encoding
|
||||
* https://www.w3.org/TR/css-syntax-3/#charset-rule
|
||||
* myhtml_encoding_by_name in https://github.com/lexborisov/myhtml/blob/master/source/myhtml/api.h
|
||||
*
|
||||
* If @charset rule is missing or encoding not found return MyHTML_ENCODING_UTF_8 by default
|
||||
*
|
||||
* @param[in] css data stream
|
||||
* @param[in] css data stream size
|
||||
*
|
||||
* @return myhtml_encoding_t
|
||||
*/
|
||||
myhtml_encoding_t
|
||||
mycss_encoding_check_charset_rule(const char* css, size_t size);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* MyCSS_CONVERT
|
||||
*
|
||||
* @description It is inherited from the main project MyHTML
|
||||
* See https://github.com/lexborisov/myhtml
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
/**
|
||||
* Convert data to double number
|
||||
*
|
||||
* @param[in] data to convert
|
||||
* @param[in] data size
|
||||
* @param[out] converting result
|
||||
* @param[out] is integer or float
|
||||
*
|
||||
* @return length of data converting
|
||||
*/
|
||||
size_t
|
||||
mycss_convert_data_to_double(const char* data, size_t size, double* return_num, bool* is_float);
|
||||
|
||||
/**
|
||||
* Convert data to unicode range code point
|
||||
* See https://www.w3.org/TR/css-syntax-3/#unicode-range-token-diagram
|
||||
* See https://www.w3.org/TR/css-syntax-3/#consume-a-unicode-range-token
|
||||
*
|
||||
* @param[in] data to convert
|
||||
* @param[in] data size
|
||||
* @param[out] start range converting result
|
||||
* @param[out] end range converting result
|
||||
*
|
||||
* @return length of data converting
|
||||
*/
|
||||
size_t
|
||||
mycss_convert_unicode_range_to_codepoint(const char *data, size_t size, size_t *start, size_t *end);
|
||||
|
||||
/**
|
||||
* Convert hex data to code point
|
||||
*
|
||||
* @param[in] data to convert
|
||||
* @param[in] data size
|
||||
* @param[out] result codepoint
|
||||
* @param[in] how much length can be consumed
|
||||
*
|
||||
* @return length of data converting
|
||||
*/
|
||||
size_t
|
||||
mycss_convert_hex_to_codepoint(const char *data, size_t size, size_t *codepoint, unsigned int max_consumed);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyCSS_MyCSS_API_H */
|
41
include/mycss/check.h
Normal file
41
include/mycss/check.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_CHECK_H
|
||||
#define MyHTML_MyCSS_CHECK_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/entry.h>
|
||||
|
||||
bool mycss_check_three_code_points_would_start_identifier(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
bool mycss_check_two_code_points_valid_escape(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
bool mycss_check_three_code_points_would_start_number(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_CHECK_H */
|
44
include/mycss/convert.h
Normal file
44
include/mycss/convert.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_CONVERT_H
|
||||
#define MyHTML_MyCSS_CONVERT_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <myhtml/mystring.h>
|
||||
|
||||
const char * mycss_convert_split_dimension_string(myhtml_string_t* str, double* value, bool* is_float);
|
||||
|
||||
size_t mycss_convert_data_to_integer(const char* data, size_t size, long* return_num);
|
||||
size_t mycss_convert_data_to_double(const char *data, size_t size, double *return_num, bool* is_float);
|
||||
size_t mycss_convert_unicode_range_to_codepoint(const char *data, size_t size, size_t *start, size_t *end);
|
||||
size_t mycss_convert_hex_to_codepoint(const char *data, size_t size, size_t *codepoint, unsigned int max_consumed);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_CONVERT_H */
|
53
include/mycss/declaration/entry.h
Normal file
53
include/mycss/declaration/entry.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_DECLARATION_ENTRY_H
|
||||
#define MyHTML_MyCSS_DECLARATION_ENTRY_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/declaration/myosi.h>
|
||||
#include <mycss/values/values.h>
|
||||
#include <mycss/property/init.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
mycss_declaration_entry_t * mycss_declaration_entry_create(mycss_declaration_t* declaration, myhtml_status_t* status);
|
||||
void mycss_declaration_entry_clean(mycss_declaration_entry_t* entry);
|
||||
void mycss_declaration_entry_clean_all(mycss_declaration_entry_t* entry);
|
||||
void mycss_declaration_entry_destroy(mycss_declaration_t* declaration, mycss_declaration_entry_t* dec_entry);
|
||||
|
||||
mycss_declaration_entry_t * mycss_declaration_entry(mycss_declaration_t* declaration);
|
||||
mycss_declaration_entry_t * mycss_declaration_entry_last(mycss_declaration_t* declaration);
|
||||
|
||||
void mycss_declaration_entry_append_to_current(mycss_declaration_t* declaration, mycss_declaration_entry_t* dec_entry);
|
||||
void mycss_declaration_entry_remove(mycss_declaration_t* declaration, mycss_declaration_entry_t* dec_entry);
|
||||
mycss_declaration_entry_t * mycss_declaration_entry_delete(mycss_declaration_t* declaration, mycss_declaration_entry_t* dec_entry);
|
||||
|
||||
void mycss_declaration_entry_print(mycss_declaration_t* declaration, mycss_declaration_entry_t* dec_entry, FILE* fh);
|
||||
void mycss_declaration_entries_print(mycss_declaration_t* declaration, mycss_declaration_entry_t* first_dec_entry, FILE* fh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_DECLARATION_ENTRY_H */
|
||||
|
54
include/mycss/declaration/init.h
Normal file
54
include/mycss/declaration/init.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_DECLARATION_INIT_H
|
||||
#define MyHTML_MyCSS_DECLARATION_INIT_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/declaration/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
mycss_declaration_t * mycss_declaration_create(void);
|
||||
mycss_status_t mycss_declaration_init(mycss_entry_t* entry, mycss_declaration_t* declaration);
|
||||
void mycss_declaration_clean_all(mycss_declaration_t* declaration);
|
||||
void mycss_declaration_clean(mycss_declaration_t* declaration);
|
||||
mycss_declaration_t * mycss_declaration_destroy(mycss_declaration_t* declaration, bool self_destroy);
|
||||
|
||||
void mycss_declaration_entry_clean(mycss_declaration_entry_t* entry);
|
||||
|
||||
mycss_declaration_entry_t * mycss_declaration_entry_create(mycss_declaration_t* declaration, myhtml_status_t* status);
|
||||
void mycss_declaration_entry_clean_all(mycss_declaration_entry_t* entry);
|
||||
void mycss_declaration_entry_append_to_current(mycss_declaration_t* declaration, mycss_declaration_entry_t* dec_entry);
|
||||
|
||||
mycss_declaration_entry_t * mycss_declaration_parse(mycss_declaration_t* declaration, myhtml_encoding_t encoding, const char* data, size_t data_size, mycss_status_t* out_status);
|
||||
|
||||
mycss_token_type_t mycss_declaration_ending_token_type(mycss_declaration_t* declaration);
|
||||
void mycss_declaration_ending_token_type_set(mycss_declaration_t* declaration, mycss_token_type_t ending_token_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_DECLARATION_INIT_H */
|
||||
|
75
include/mycss/declaration/myosi.h
Normal file
75
include/mycss/declaration/myosi.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_DECLARATION_MYOSI_H
|
||||
#define MyHTML_MyCSS_DECLARATION_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/values/units.h>
|
||||
#include <mycss/property/myosi.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct mycss_declaration_entry mycss_declaration_entry_t;
|
||||
typedef struct mycss_declaration mycss_declaration_t;
|
||||
|
||||
typedef void (*mycss_callback_declaration_destroy_f)(mycss_entry_t* entry, mycss_declaration_entry_t* dec_entry);
|
||||
|
||||
enum mycss_declaration_flags {
|
||||
MyCSS_DECLARATION_FLAGS_UNDEF = 0x00,
|
||||
MyCSS_DECLARATION_FLAGS_BAD = 0x01
|
||||
}
|
||||
typedef mycss_declaration_flags_t;
|
||||
|
||||
struct mycss_declaration {
|
||||
mycss_entry_t* ref_entry;
|
||||
|
||||
mycss_declaration_entry_t** entry;
|
||||
mycss_declaration_entry_t* entry_last;
|
||||
|
||||
mycss_token_type_t ending_token;
|
||||
|
||||
mcobject_t* mcobject_entries; /* for a dec entries */
|
||||
mcobject_t* mcobject_list; /* for a dec list */
|
||||
};
|
||||
|
||||
struct mycss_declaration_entry {
|
||||
mycss_property_type_t type;
|
||||
|
||||
unsigned int value_type;
|
||||
void* value;
|
||||
|
||||
bool is_important;
|
||||
mycss_declaration_flags_t flags;
|
||||
|
||||
mycss_declaration_entry_t* next;
|
||||
mycss_declaration_entry_t* prev;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_DECLARATION_MYOSI_H */
|
41
include/mycss/declaration/parser.h
Normal file
41
include/mycss/declaration/parser.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_DECLARATION_PARSER_H
|
||||
#define MyHTML_MyCSS_DECLARATION_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/property/init.h>
|
||||
#include <mycss/declaration/entry.h>
|
||||
|
||||
void mycss_declaration_parser_begin(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_declaration_parser_ident(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_declaration_parser_end(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_DECLARATION_PARSER_H */
|
47
include/mycss/declaration/state.h
Normal file
47
include/mycss/declaration/state.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_DECLARATION_DECLARATION_H
|
||||
#define MyHTML_MyCSS_DECLARATION_DECLARATION_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/declaration/parser.h>
|
||||
|
||||
bool mycss_declaration_state_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_declaration_state_data(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_ident(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_colon_before_important(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_colon_important(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_colon_delim_after_important(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_find_ending(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_parse_error(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_declaration_state_drop_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_DECLARATION_DECLARATION_H */
|
157
include/mycss/entry.h
Normal file
157
include/mycss/entry.h
Normal file
@ -0,0 +1,157 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_ENTRY_H
|
||||
#define MyHTML_MyCSS_ENTRY_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/parser.h>
|
||||
#include <mycss/stylesheet.h>
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <mycss/namespace/init.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/init.h>
|
||||
#include <mycss/an_plus_b.h>
|
||||
#include <mycss/declaration/myosi.h>
|
||||
#include <mycss/declaration/init.h>
|
||||
#include <mycss/declaration/entry.h>
|
||||
#include <mycss/media/myosi.h>
|
||||
#include <mycss/media/init.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
|
||||
struct mycss_entry_parser_list_entry {
|
||||
mycss_parser_token_f parser;
|
||||
mycss_parser_token_f parser_switch;
|
||||
mycss_token_type_t ending_token;
|
||||
|
||||
bool is_local;
|
||||
}
|
||||
typedef mycss_entry_parser_list_entry_t;
|
||||
|
||||
struct mycss_entry_parser_list {
|
||||
mycss_entry_parser_list_entry_t* list;
|
||||
size_t size;
|
||||
size_t length;
|
||||
}
|
||||
typedef mycss_entry_parser_list_t;
|
||||
|
||||
struct mycss_entry {
|
||||
/* refs */
|
||||
mycss_t* mycss;
|
||||
mycss_token_t* token;
|
||||
mycss_stylesheet_t* stylesheet;
|
||||
|
||||
/* objects and memory for css modules */
|
||||
mchar_async_t* mchar;
|
||||
size_t mchar_node_id;
|
||||
size_t mchar_value_node_id;
|
||||
|
||||
mcobject_t* mcobject_string_entries;
|
||||
|
||||
/* css modules */
|
||||
mycss_namespace_t* ns;
|
||||
mycss_selectors_t* selectors;
|
||||
mycss_an_plus_b_t* anb;
|
||||
mycss_media_t* media;
|
||||
// mycss_rules_t* rules;
|
||||
mycss_declaration_t* declaration;
|
||||
void** values;
|
||||
|
||||
/* incoming buffer */
|
||||
mcobject_t* mcobject_incoming_buffer;
|
||||
myhtml_incoming_buffer_t* first_buffer;
|
||||
myhtml_incoming_buffer_t* current_buffer;
|
||||
|
||||
/* options */
|
||||
mycss_entry_type_t type;
|
||||
myhtml_encoding_t encoding;
|
||||
|
||||
/* tokenizer */
|
||||
mycss_tokenizer_state_t state;
|
||||
mycss_tokenizer_state_t state_back;
|
||||
|
||||
/* parser */
|
||||
mycss_entry_parser_list_t* parser_list;
|
||||
mycss_parser_token_f parser;
|
||||
mycss_parser_token_f parser_switch;
|
||||
mycss_parser_token_f parser_error;
|
||||
mycss_parser_token_f parser_original;
|
||||
mycss_token_type_t parser_ending_token;
|
||||
|
||||
/* callbacks */
|
||||
mycss_token_ready_callback_f token_ready_callback;
|
||||
mycss_callback_selector_done_f callback_selector_done;
|
||||
|
||||
/* helpers */
|
||||
size_t token_counter;
|
||||
size_t help_counter;
|
||||
};
|
||||
|
||||
mycss_entry_t * mycss_entry_create(void);
|
||||
mycss_status_t mycss_entry_init(mycss_t* mycss, mycss_entry_t* entry);
|
||||
mycss_status_t mycss_entry_clean(mycss_entry_t* entry);
|
||||
mycss_status_t mycss_entry_clean_all(mycss_entry_t* entry);
|
||||
mycss_entry_t * mycss_entry_destroy(mycss_entry_t* entry, bool self_destroy);
|
||||
|
||||
void mycss_entry_end(mycss_entry_t* entry);
|
||||
|
||||
mycss_token_ready_callback_f mycss_entry_token_ready_callback(mycss_entry_t* entry, mycss_token_ready_callback_f callback_f);
|
||||
|
||||
size_t mycss_entry_token_count(mycss_entry_t* entry);
|
||||
myhtml_incoming_buffer_t * mycss_entry_incoming_buffer_current(mycss_entry_t* entry);
|
||||
myhtml_incoming_buffer_t * mycss_entry_incoming_buffer_first(mycss_entry_t* entry);
|
||||
|
||||
myhtml_string_t * mycss_entry_string_create_and_init(mycss_entry_t* entry, size_t string_size);
|
||||
|
||||
mycss_stylesheet_t * mycss_entry_stylesheet(mycss_entry_t* entry);
|
||||
mycss_selectors_list_t * mycss_entry_current_selectors_list(mycss_entry_t* entry);
|
||||
|
||||
void mycss_entry_parser_set(mycss_entry_t* entry, mycss_parser_token_f parser);
|
||||
void mycss_entry_parser_switch_set(mycss_entry_t* entry, mycss_parser_token_f parser_switch);
|
||||
void mycss_entry_parser_original_set(mycss_entry_t* entry, mycss_parser_token_f parser_original);
|
||||
|
||||
/* parser list */
|
||||
mycss_entry_parser_list_t * mycss_entry_parser_list_create_and_init(size_t size);
|
||||
void mycss_entry_parser_list_clean(mycss_entry_parser_list_t* parser_list);
|
||||
mycss_entry_parser_list_t * mycss_entry_parser_list_destroy(mycss_entry_parser_list_t* parser_list, bool self_destroy);
|
||||
|
||||
mycss_status_t mycss_entry_parser_list_push(mycss_entry_t* entry, mycss_parser_token_f parser_func,
|
||||
mycss_parser_token_f parser_switch, mycss_token_type_t ending_token,
|
||||
bool is_local);
|
||||
|
||||
void mycss_entry_parser_list_pop(mycss_entry_t* entry);
|
||||
size_t mycss_entry_parser_list_length(mycss_entry_t* entry);
|
||||
mycss_token_type_t mycss_entry_parser_list_current_ending_token_type(mycss_entry_t* entry);
|
||||
mycss_parser_token_f mycss_entry_parser_list_current_parser(mycss_entry_t* entry);
|
||||
mycss_parser_token_f mycss_entry_parser_list_current_parser_switch(mycss_entry_t* entry);
|
||||
bool mycss_entry_parser_list_current_is_local(mycss_entry_t* entry);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_ENTRY_H */
|
40
include/mycss/media/init.h
Normal file
40
include/mycss/media/init.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_MEDIA_INIT_H
|
||||
#define MyHTML_MyCSS_MEDIA_INIT_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/media/myosi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
mycss_media_t * mycss_media_create(void);
|
||||
mycss_status_t mycss_media_init(mycss_entry_t* entry, mycss_media_t* media);
|
||||
mycss_status_t mycss_media_clean_all(mycss_media_t* media);
|
||||
mycss_media_t * mycss_media_destroy(mycss_media_t* media, bool self_destroy);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_MEDIA_INIT_H */
|
42
include/mycss/media/myosi.h
Normal file
42
include/mycss/media/myosi.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_MEDIA_MYOSI_H
|
||||
#define MyHTML_MyCSS_MEDIA_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct mycss_media mycss_media_t;
|
||||
|
||||
|
||||
struct mycss_media {
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_MEDIA_MYOSI_H */
|
38
include/mycss/media/state.h
Normal file
38
include/mycss/media/state.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_MEDIA_STATE_H
|
||||
#define MyHTML_MyCSS_MEDIA_STATE_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/media/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool mycss_media_state_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_MEDIA_STATE_H */
|
79
include/mycss/mycss.h
Normal file
79
include/mycss/mycss.h
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_MYCSS_H
|
||||
#define MyHTML_MyCSS_MYCSS_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef MyCSS_DEBUG
|
||||
#define MyCSS_DEBUG_MESSAGE(format, ...) \
|
||||
myhtml_print(stderr, "DEBUG: "format"\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define MyCSS_DEBUG_MESSAGE(format, ...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
#define MyHTML_DEBUG_ERROR(format, ...) \
|
||||
myhtml_print(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define MyHTML_DEBUG_ERROR(format, ...)
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/tokenizer.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/utils/mcobject_async.h>
|
||||
|
||||
struct mycss {
|
||||
mycss_tokenizer_state_f* parse_state_func;
|
||||
};
|
||||
|
||||
mycss_t * mycss_create(void);
|
||||
mycss_status_t mycss_init(mycss_t* mycss);
|
||||
mycss_t * mycss_destroy(mycss_t* mycss, bool self_destroy);
|
||||
|
||||
mycss_status_t mycss_parse(mycss_entry_t* entry, myhtml_encoding_t encoding, const char* css, size_t css_size);
|
||||
mycss_status_t mycss_parse_chunk(mycss_entry_t* entry, const char* css, size_t css_size);
|
||||
mycss_status_t mycss_parse_chunk_end(mycss_entry_t* entry);
|
||||
|
||||
size_t mycss_token_begin(mycss_token_t* token);
|
||||
size_t mycss_token_length(mycss_token_t* token);
|
||||
size_t mycss_token_position(mycss_token_t* token, size_t *return_length);
|
||||
mycss_token_type_t mycss_token_type(mycss_token_t* token);
|
||||
const char * mycss_token_name_by_type(mycss_token_type_t type);
|
||||
size_t mycss_token_data_to_string(mycss_entry_t* entry, mycss_token_t* token, myhtml_string_t* str, bool init_string, bool case_insensitive);
|
||||
|
||||
myhtml_incoming_buffer_t * mycss_token_buffer_first(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
// encoding
|
||||
void mycss_encoding_set(mycss_entry_t* entry, myhtml_encoding_t encoding);
|
||||
myhtml_encoding_t mycss_encoding_get(mycss_entry_t* entry);
|
||||
myhtml_encoding_t mycss_encoding_check_charset_rule(const char* css, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
281
include/mycss/myosi.h
Normal file
281
include/mycss/myosi.h
Normal file
@ -0,0 +1,281 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_MYOSI_H
|
||||
#define MyHTML_MyCSS_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
|
||||
|
||||
// base
|
||||
/*
|
||||
Very important!!!
|
||||
|
||||
for myhtml 0..00ffff; MyHTML_STATUS_OK == 0x000000
|
||||
for mycss and modules 010000..01ffff; MyCSS_STATUS_OK == 0x000000
|
||||
for modest 020000..02ffff; MODEST_STATUS_OK == 0x000000
|
||||
for myrender 030000..03ffff; MyRENDER_STATUS_OK == 0x000000
|
||||
for mydom 040000..04ffff; MyDOM_STATUS_OK == 0x000000
|
||||
for mynetwork 050000..05ffff; MyNETWORK_STATUS_OK == 0x000000
|
||||
for myecma 060000..06ffff; MyECMA_STATUS_OK == 0x000000
|
||||
not occupied 070000..
|
||||
*/
|
||||
enum mycss_status {
|
||||
MyCSS_STATUS_OK = 0x000000,
|
||||
MyCSS_STATUS_ERROR_MEMORY_ALLOCATION = 0x010001,
|
||||
MyCSS_STATUS_ERROR_TOKENIZER_STATE_ALLOCATION = 0x010020,
|
||||
MyCSS_STATUS_ERROR_TOKENIZER_INCOMING_BUFFER_ADD = 0x010021,
|
||||
MyCSS_STATUS_ERROR_TOKENIZER_TOKEN_ALLOCATION = 0x010022,
|
||||
MyCSS_STATUS_ERROR_INCOMING_BUFFER_INIT = 0x010030,
|
||||
MyCSS_STATUS_ERROR_ENTRY_INCOMING_BUFFER_CREATE = 0x010039,
|
||||
MyCSS_STATUS_ERROR_ENTRY_INCOMING_BUFFER_INIT = 0x010040,
|
||||
MyCSS_STATUS_ERROR_ENTRY_TOKEN_INCOMING_BUFFER_INIT = 0x010041,
|
||||
MyCSS_STATUS_ERROR_ENTRY_TOKEN_NODE_ADD = 0x010042,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_CREATE = 0x010100,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_ENTRIES_CREATE = 0x010101,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_ENTRIES_INIT = 0x010102,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_ENTRIES_NODE_ADD = 0x010103,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_LIST_CREATE = 0x010104,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_LIST_INIT = 0x010105,
|
||||
MyCSS_STATUS_ERROR_SELECTORS_LIST_ADD_NODE = 0x010106,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_CREATE = 0x010200,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_INIT = 0x010201,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_ENTRIES_CREATE = 0x010202,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_ENTRIES_INIT = 0x010203,
|
||||
MyCSS_STATUS_ERROR_NAMESPACE_NODE_ADD = 0x010204,
|
||||
MyCSS_STATUS_ERROR_MEDIA_CREATE = 0x010404,
|
||||
MyCSS_STATUS_ERROR_STRING_CREATE = 0x010501,
|
||||
MyCSS_STATUS_ERROR_STRING_INIT = 0x010502,
|
||||
MyCSS_STATUS_ERROR_STRING_NODE_INIT = 0x010503,
|
||||
MyCSS_STATUS_ERROR_AN_PLUS_B_CREATE = 0x010600,
|
||||
MyCSS_STATUS_ERROR_AN_PLUS_B_INIT = 0x010601,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_CREATE = 0x010700,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_INIT = 0x010701,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_ENTRY_CREATE = 0x010702,
|
||||
MyCSS_STATUS_ERROR_DECLARATION_ENTRY_INIT = 0x010703,
|
||||
MyCSS_STATUS_ERROR_PARSER_LIST_CREATE = 0x010800
|
||||
}
|
||||
typedef mycss_status_t;
|
||||
|
||||
#define MyCSS_FAILED(_status_) ((_status_) != MyCSS_STATUS_OK)
|
||||
|
||||
// entry
|
||||
typedef struct mycss_entry mycss_entry_t;
|
||||
|
||||
enum mycss_entry_type {
|
||||
MyCSS_ENTRY_TYPE_CLEAN = 0x0000,
|
||||
MyCSS_ENTRY_TYPE_END = 0x0001
|
||||
}
|
||||
typedef mycss_entry_type_t;
|
||||
|
||||
// mycss
|
||||
typedef struct mycss mycss_t;
|
||||
|
||||
// mycss_tokenizer
|
||||
typedef struct mycss_token mycss_token_t;
|
||||
|
||||
enum mycss_tokenizer_state {
|
||||
MyCSS_TOKENIZER_STATE_DATA = 0x000,
|
||||
//
|
||||
// generated by Perl script utils/mycss_first_char.pl
|
||||
MyCSS_TOKENIZER_STATE_APOSTROPHE = 0x001,
|
||||
MyCSS_TOKENIZER_STATE_ASTERISK = 0x002,
|
||||
MyCSS_TOKENIZER_STATE_CIRCUMFLEX_ACCENT = 0x003,
|
||||
MyCSS_TOKENIZER_STATE_COLON = 0x004,
|
||||
MyCSS_TOKENIZER_STATE_COMMA = 0x005,
|
||||
MyCSS_TOKENIZER_STATE_COMMERCIAL_AT = 0x006,
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT = 0x007,
|
||||
MyCSS_TOKENIZER_STATE_DIGIT = 0x008,
|
||||
MyCSS_TOKENIZER_STATE_DOLLAR_SIGN = 0x009,
|
||||
MyCSS_TOKENIZER_STATE_FULL_STOP = 0x00a,
|
||||
MyCSS_TOKENIZER_STATE_HYPHEN_MINUS = 0x00b,
|
||||
MyCSS_TOKENIZER_STATE_LEFT_CURLY_BRACKET = 0x00c,
|
||||
MyCSS_TOKENIZER_STATE_LEFT_PARENTHESIS = 0x00d,
|
||||
MyCSS_TOKENIZER_STATE_LEFT_SQUARE_BRACKET = 0x00e,
|
||||
MyCSS_TOKENIZER_STATE_LESS_THAN_SIGN = 0x00f,
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT = 0x010,
|
||||
MyCSS_TOKENIZER_STATE_NUMBER_SIGN = 0x011,
|
||||
MyCSS_TOKENIZER_STATE_PLUS_SIGN = 0x012,
|
||||
MyCSS_TOKENIZER_STATE_QUOTATION_MARK = 0x013,
|
||||
MyCSS_TOKENIZER_STATE_REVERSE_SOLIDUS = 0x014,
|
||||
MyCSS_TOKENIZER_STATE_RIGHT_CURLY_BRACKET = 0x015,
|
||||
MyCSS_TOKENIZER_STATE_RIGHT_PARENTHESIS = 0x016,
|
||||
MyCSS_TOKENIZER_STATE_RIGHT_SQUARE_BRACKET = 0x017,
|
||||
MyCSS_TOKENIZER_STATE_SEMICOLON = 0x018,
|
||||
MyCSS_TOKENIZER_STATE_SOLIDUS = 0x019,
|
||||
MyCSS_TOKENIZER_STATE_TILDE = 0x01a,
|
||||
MyCSS_TOKENIZER_STATE_VERTICAL_LINE = 0x01b,
|
||||
MyCSS_TOKENIZER_STATE_WHITESPACE = 0x01c,
|
||||
// end generated code
|
||||
//
|
||||
|
||||
MyCSS_TOKENIZER_STATE_QUOTATION_MARK_BACK = 0x01d,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_NUMBER_SIGN_NAME_BACK = 0x01e,
|
||||
MyCSS_TOKENIZER_STATE_NUMBER_SIGN_NAME_RSOLIDUS = 0x01f,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_APOSTROPHE_BACK = 0x020,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_HYPHEN_MINUS_RSOLIDUS = 0x021,
|
||||
MyCSS_TOKENIZER_STATE_HYPHEN_MINUS_MINUS = 0x022,
|
||||
MyCSS_TOKENIZER_STATE_HYPHEN_MINUS_MINUS_RSOLIDUS = 0x023,
|
||||
MyCSS_TOKENIZER_STATE_HYPHEN_MINUS_FULL_STOP = 0x024,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_SOLIDUS_COMMENT_END = 0x025,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_COMMERCIAL_AT_RSOLIDUS = 0x026,
|
||||
MyCSS_TOKENIZER_STATE_COMMERCIAL_AT_BACK = 0x027,
|
||||
MyCSS_TOKENIZER_STATE_COMMERCIAL_AT_MINUS = 0x028,
|
||||
MyCSS_TOKENIZER_STATE_COMMERCIAL_AT_MINUS_RSOLIDUS = 0x029,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_LESS_THAN_SIGN_MINUS = 0x02a,
|
||||
MyCSS_TOKENIZER_STATE_LESS_THAN_SIGN_MINUS_MINUS = 0x02b,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_PLUS_SIGN_FULL_STOP = 0x02c,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_LETTER_U = 0x02d,
|
||||
MyCSS_TOKENIZER_STATE_LETTER_U_NEXT = 0x02e,
|
||||
|
||||
// global
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMBER_DIGIT = 0x050,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMBER_DECIMAL = 0x051,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMBER_DOT = 0x052,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMBER_E = 0x053,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMBER_E_PLUS_MINUS = 0x054,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMBER_E_DECIMAL = 0x055,
|
||||
|
||||
// Consume a numeric token
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMERIC = 0x056,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMERIC_RSOLIDUS = 0x057,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMERIC_MINUS = 0x058,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NUMERIC_MINUS_RSOLIDUS = 0x059,
|
||||
|
||||
// Consume an ident-like token
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_IDENT = 0x05a,
|
||||
|
||||
// Consume a url token
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_URL = 0x05b,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_URL_STRING_BACK = 0x05c,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_URL_AFTER = 0x05d,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_URL_AFTER_WHITESPACE = 0x05e,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_URL_RSOLIDUS = 0x05f,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_BAD_URL = 0x060,
|
||||
|
||||
// Consume a string token
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_STRING_DOUBLE_QUOTED = 0x061,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_STRING_DOUBLE_QUOTED_RSOLIDUS = 0x062,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_STRING_DOUBLE_QUOTED_RSOLIDUS_R = 0x063,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_STRING_SINGLE_QUOTED = 0x064,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_STRING_SINGLE_QUOTED_RSOLIDUS = 0x065,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_STRING_SINGLE_QUOTED_RSOLIDUS_R = 0x066,
|
||||
|
||||
// Consume a name
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NAME = 0x067,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_NAME_RSOLIDUS = 0x068,
|
||||
|
||||
// Consume a unicode-range token
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_UNICODE_RANGE_BEFORE = 0x069,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_UNICODE_RANGE = 0x06a,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_UNICODE_RANGE_QUESTION = 0x06b,
|
||||
MyCSS_TOKENIZER_GLOBAL_STATE_UNICODE_RANGE_MINUS = 0x06c,
|
||||
|
||||
// back
|
||||
MyCSS_TOKENIZER_GLOBAL_BACK = 0x080,
|
||||
|
||||
MyCSS_TOKENIZER_STATE_FIRST_ENTRY = MyCSS_TOKENIZER_STATE_DATA,
|
||||
MyCSS_TOKENIZER_STATE_LAST_ENTRY = 0x100
|
||||
}
|
||||
typedef mycss_tokenizer_state_t;
|
||||
|
||||
enum mycss_token_type {
|
||||
MyCSS_TOKEN_TYPE_UNDEF = 0x0000,
|
||||
MyCSS_TOKEN_TYPE_WHITESPACE = 0x0001,
|
||||
MyCSS_TOKEN_TYPE_IDENT = 0x0002,
|
||||
MyCSS_TOKEN_TYPE_FUNCTION = 0x0003,
|
||||
MyCSS_TOKEN_TYPE_AT_KEYWORD = 0x0004,
|
||||
MyCSS_TOKEN_TYPE_HASH = 0x0005,
|
||||
MyCSS_TOKEN_TYPE_STRING = 0x0006,
|
||||
MyCSS_TOKEN_TYPE_URL = 0x0007,
|
||||
MyCSS_TOKEN_TYPE_NUMBER = 0x0008,
|
||||
MyCSS_TOKEN_TYPE_DIMENSION = 0x0009,
|
||||
MyCSS_TOKEN_TYPE_PERCENTAGE = 0x000a,
|
||||
MyCSS_TOKEN_TYPE_INCLUDE_MATCH = 0x000b,
|
||||
MyCSS_TOKEN_TYPE_DASH_MATCH = 0x000c,
|
||||
MyCSS_TOKEN_TYPE_PREFIX_MATCH = 0x000d,
|
||||
MyCSS_TOKEN_TYPE_SUFFIX_MATCH = 0x000e,
|
||||
MyCSS_TOKEN_TYPE_SUBSTRING_MATCH = 0x000f,
|
||||
MyCSS_TOKEN_TYPE_COLUMN = 0x0010,
|
||||
MyCSS_TOKEN_TYPE_CDO = 0x0011,
|
||||
MyCSS_TOKEN_TYPE_CDC = 0x0012,
|
||||
MyCSS_TOKEN_TYPE_BAD_STRING = 0x0013,
|
||||
MyCSS_TOKEN_TYPE_DELIM = 0x0014,
|
||||
MyCSS_TOKEN_TYPE_LEFT_PARENTHESIS = 0x0015,
|
||||
MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS = 0x0016,
|
||||
MyCSS_TOKEN_TYPE_COMMA = 0x0017,
|
||||
MyCSS_TOKEN_TYPE_COLON = 0x0018,
|
||||
MyCSS_TOKEN_TYPE_SEMICOLON = 0x0019,
|
||||
MyCSS_TOKEN_TYPE_LEFT_SQUARE_BRACKET = 0x001a,
|
||||
MyCSS_TOKEN_TYPE_RIGHT_SQUARE_BRACKET = 0x001b,
|
||||
MyCSS_TOKEN_TYPE_LEFT_CURLY_BRACKET = 0x001c,
|
||||
MyCSS_TOKEN_TYPE_RIGHT_CURLY_BRACKET = 0x001d,
|
||||
MyCSS_TOKEN_TYPE_BAD_URL = 0x001e,
|
||||
MyCSS_TOKEN_TYPE_COMMENT = 0x001f,
|
||||
MyCSS_TOKEN_TYPE_UNICODE_RANGE = 0x0020,
|
||||
MyCSS_TOKEN_TYPE_EOF = 0x0021,
|
||||
MyCSS_TOKEN_TYPE_LAST_ENTRY = 0x0022
|
||||
}
|
||||
typedef mycss_token_type_t;
|
||||
|
||||
// an+b
|
||||
typedef struct mycss_an_plus_b mycss_an_plus_b_t;
|
||||
typedef struct mycss_an_plus_b_entry mycss_an_plus_b_entry_t;
|
||||
|
||||
// result
|
||||
enum mycss_stylesheet_entry_type {
|
||||
MyCSS_RESULT_ENTRY_TYPE_UNDEF = 0x00,
|
||||
MyCSS_RESULT_ENTRY_TYPE_GOOD = 0x01,
|
||||
MyCSS_RESULT_ENTRY_TYPE_BAD = 0x02
|
||||
}
|
||||
typedef mycss_stylesheet_entry_type_t;
|
||||
|
||||
// stylesheet
|
||||
typedef struct mycss_stylesheet mycss_stylesheet_t;
|
||||
|
||||
// mystring
|
||||
typedef struct mycss_string_escaped_res mycss_string_escaped_res_t;
|
||||
typedef struct mycss_string_res mycss_string_res_t;
|
||||
|
||||
typedef size_t (*mycss_tokenizer_state_f)(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
typedef mycss_token_t * (*mycss_token_ready_callback_f)(mycss_entry_t* entry, mycss_token_t* token);
|
||||
typedef size_t (*mycss_string_process_state_f)(myhtml_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
typedef bool (*mycss_parser_token_f)(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
typedef bool (*mycss_an_plus_b_state_f)(mycss_entry_t* entry, mycss_an_plus_b_t* anb, mycss_an_plus_b_entry_t* anb_entry, mycss_token_t* token);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
69
include/mycss/mystring.h
Normal file
69
include/mycss/mystring.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_MYSTRING_H
|
||||
#define MyHTML_MyCSS_MYSTRING_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <myhtml/incoming.h>
|
||||
#include <myhtml/mystring.h>
|
||||
|
||||
enum mycss_string_process_state {
|
||||
MyCSS_STRING_PROCESS_STATE_DATA = 0x00,
|
||||
MyCSS_STRING_PROCESS_STATE_ESCAPED = 0x01,
|
||||
MyCSS_STRING_PROCESS_STATE_LAST_ENTRY = 0x02
|
||||
}
|
||||
typedef mycss_string_process_state_t;
|
||||
|
||||
struct mycss_string_escaped_res {
|
||||
unsigned short consumed;
|
||||
size_t code_point;
|
||||
};
|
||||
|
||||
struct mycss_string_res {
|
||||
mycss_string_escaped_res_t escaped;
|
||||
mycss_string_process_state_t state;
|
||||
|
||||
myhtml_encoding_t encoding;
|
||||
myhtml_encoding_result_t encoding_res;
|
||||
bool case_insensitive;
|
||||
};
|
||||
|
||||
size_t mycss_string_data_process(myhtml_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
void mycss_string_data_process_end(myhtml_string_t* str, mycss_string_res_t *out_res);
|
||||
|
||||
size_t mycss_string_process_state_data(myhtml_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
size_t mycss_string_process_state_data_utf_8(myhtml_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
size_t mycss_string_process_state_escaped(myhtml_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
size_t mycss_string_process_state_escaped_utf_8(myhtml_string_t* str, const char* data, size_t length, size_t size, mycss_string_res_t *out_res);
|
||||
|
||||
void mycss_string_res_clean(mycss_string_res_t* res);
|
||||
void mycss_string_escaped_res_clean(mycss_string_escaped_res_t* res);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_MYSTRING_H */
|
64
include/mycss/namespace/init.h
Normal file
64
include/mycss/namespace/init.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_NAMESPACE_INIT_H
|
||||
#define MyHTML_MyCSS_NAMESPACE_INIT_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <myhtml/mynamespace.h>
|
||||
|
||||
mycss_namespace_t * mycss_namespace_create(void);
|
||||
mycss_status_t mycss_namespace_init(mycss_entry_t* entry, mycss_namespace_t* ns);
|
||||
void mycss_namespace_clean(mycss_namespace_t* ns);
|
||||
mycss_status_t mycss_namespace_clean_all(mycss_namespace_t* ns);
|
||||
mycss_namespace_t * mycss_namespace_destroy(mycss_namespace_t* ns, bool self_destroy);
|
||||
|
||||
mycss_status_t mycss_namespace_stylesheet_init(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_entry_t* entry);
|
||||
mycss_status_t mycss_namespace_stylesheet_clean(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_entry_t* entry);
|
||||
mycss_namespace_stylesheet_t * mycss_namespace_stylesheet_destroy(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_entry_t* entry, bool self_destroy);
|
||||
|
||||
mycss_status_t mycss_namespace_stylesheet_init_default(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_entry_t* entry, const char* url, size_t url_length, myhtml_namespace_t def_ns);
|
||||
void mycss_namespace_stylesheet_append_default(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_namespace_entry_t* ns_entry);
|
||||
void mycss_namespace_stylesheet_destroy_default(mycss_namespace_stylesheet_t* ns_stylesheet, mycss_entry_t* entry);
|
||||
|
||||
mycss_namespace_entry_t * mycss_namespace_entry_create(mycss_namespace_t* ns);
|
||||
void mycss_namespace_entry_clean(mycss_namespace_entry_t* ns_entry);
|
||||
mycss_namespace_entry_t * mycss_namespace_entry_destroy(mycss_namespace_entry_t* ns_entry, mycss_entry_t* entry, bool self_destroy);
|
||||
|
||||
void mycss_namespace_entry_append_to_current(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry);
|
||||
|
||||
const char * mycss_namespace_name_by_id(mycss_namespace_t* ns, mctree_t* name_tree, size_t ns_id, size_t* length);
|
||||
mycss_namespace_entry_t * mycss_namespace_entry_by_name(mycss_namespace_t *ns, mctree_t* name_tree, const char* ns_name, size_t length, bool case_insensitive);
|
||||
const char * mycss_namespace_name_by_entry(mycss_namespace_entry_t* ns_entry, mctree_t* name_tree, size_t* length, bool* is_default);
|
||||
|
||||
void mycss_namespace_print(mycss_namespace_t* ns, mycss_namespace_entry_t* ns_entry, FILE* fh, bool with_vbar);
|
||||
void mycss_namespace_print_stylesheet(mycss_namespace_stylesheet_t* ns_stylesheet, FILE* fh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_NAMESPACE_INIT_H */
|
74
include/mycss/namespace/myosi.h
Normal file
74
include/mycss/namespace/myosi.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_NAMESPACE_MYOSI_H
|
||||
#define MyHTML_MyCSS_NAMESPACE_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <myhtml/mystring.h>
|
||||
#include <myhtml/utils/mctree.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
|
||||
typedef struct mycss_namespace mycss_namespace_t;
|
||||
typedef struct mycss_namespace_entry mycss_namespace_entry_t;
|
||||
typedef struct mycss_namespace_stylesheet mycss_namespace_stylesheet_t;
|
||||
|
||||
struct mycss_namespace_entry {
|
||||
myhtml_string_t* name;
|
||||
myhtml_string_t* url;
|
||||
|
||||
myhtml_namespace_t ns_id;
|
||||
size_t mctree_id;
|
||||
|
||||
mycss_namespace_entry_t* next;
|
||||
mycss_namespace_entry_t* prev;
|
||||
};
|
||||
|
||||
struct mycss_namespace_stylesheet {
|
||||
mctree_t* name_tree; // tree for namespace names
|
||||
|
||||
mycss_namespace_entry_t* entry_first;
|
||||
|
||||
mycss_namespace_entry_t* entry_default;
|
||||
mycss_namespace_entry_t entry_undef;
|
||||
mycss_namespace_entry_t entry_any;
|
||||
|
||||
size_t ns_id_counter;
|
||||
};
|
||||
|
||||
struct mycss_namespace {
|
||||
mycss_namespace_entry_t** entry;
|
||||
mycss_namespace_entry_t* entry_last;
|
||||
|
||||
mycss_namespace_stylesheet_t* ns_stylesheet;
|
||||
|
||||
mcobject_t* mcobject_entries;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_NAMESPACE_MYOSI_H */
|
46
include/mycss/namespace/parser.h
Normal file
46
include/mycss/namespace/parser.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_NAMESPACE_PARSER_H
|
||||
#define MyHTML_MyCSS_NAMESPACE_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <myhtml/mynamespace.h>
|
||||
#include <myhtml/utils/mctree.h>
|
||||
|
||||
void mycss_namespace_parser_begin(mycss_entry_t* entry);
|
||||
|
||||
void mycss_namespace_parser_name(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_namespace_parser_url(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_namespace_parser_end(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_namespace_parser_expectations_error(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_NAMESPACE_PARSER_H */
|
46
include/mycss/namespace/state.h
Normal file
46
include/mycss/namespace/state.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_NAMESPACE_STATE_H
|
||||
#define MyHTML_MyCSS_NAMESPACE_STATE_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <mycss/namespace/parser.h>
|
||||
#include <myhtml/utils.h>
|
||||
|
||||
bool mycss_namespace_state_namespace(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_namespace_state_namespace_namespace(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_namespace_state_namespace_namespace_ident(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_namespace_state_namespace_namespace_ident_string(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_namespace_state_namespace_namespace_ident_url(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_namespace_state_namespace_namespace_string(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_namespace_state_namespace_namespace_url(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_NAMESPACE_STATE_H */
|
54
include/mycss/parser.h
Normal file
54
include/mycss/parser.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_PARSER_H
|
||||
#define MyHTML_MyCSS_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/mystring.h>
|
||||
#include <mycss/convert.h>
|
||||
#include <mycss/namespace/state.h>
|
||||
#include <mycss/selectors/state.h>
|
||||
#include <mycss/selectors/parser.h>
|
||||
#include <mycss/declaration/state.h>
|
||||
#include <myhtml/incoming.h>
|
||||
|
||||
mycss_token_t * mycss_parser_token_ready_callback_function(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
bool mycss_parser_token(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_parser_token_selector_list_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_parser_token_drop_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_parser_token_drop_at_rule(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_parser_token_drop_at_rule_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_PARSER_H */
|
71
include/mycss/property/const.h
Normal file
71
include/mycss/property/const.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_PROPERTY_CONST_H
|
||||
#define MyHTML_MyCSS_PROPERTY_CONST_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum mycss_property_type {
|
||||
MyCSS_PROPERTY_TYPE_UNDEF = 0x0000,
|
||||
MyCSS_PROPERTY_TYPE_HEIGHT = 0x0001,
|
||||
MyCSS_PROPERTY_TYPE_WIDTH = 0x0002,
|
||||
MyCSS_PROPERTY_TYPE_LAST_ENTRY = 0x0003
|
||||
}
|
||||
typedef mycss_property_type_t;
|
||||
|
||||
enum mycss_property_value {
|
||||
MyCSS_PROPERTY_VALUE_UNDEF = 0x0000,
|
||||
MyCSS_PROPERTY_VALUE_AUTO = 0x0001,
|
||||
MyCSS_PROPERTY_VALUE_INHERIT = 0x0002,
|
||||
MyCSS_PROPERTY_VALUE_LENGTH = 0x0003,
|
||||
MyCSS_PROPERTY_VALUE_PERCENTAGE = 0x0004,
|
||||
MyCSS_PROPERTY_VALUE_LAST_ENTRY = 0x0005
|
||||
}
|
||||
typedef mycss_property_value_t;
|
||||
|
||||
enum mycss_property_height {
|
||||
MyCSS_PROPERTY_HEIGHT_AUTO = 0x0001,
|
||||
MyCSS_PROPERTY_HEIGHT_INHERIT = 0x0002,
|
||||
MyCSS_PROPERTY_HEIGHT_LENGTH = 0x0003,
|
||||
MyCSS_PROPERTY_HEIGHT_PERCENTAGE = 0x0004
|
||||
}
|
||||
typedef mycss_property_height_t;
|
||||
|
||||
enum mycss_property_width {
|
||||
MyCSS_PROPERTY_WIDTH_AUTO = 0x0001,
|
||||
MyCSS_PROPERTY_WIDTH_INHERIT = 0x0002,
|
||||
MyCSS_PROPERTY_WIDTH_LENGTH = 0x0003,
|
||||
MyCSS_PROPERTY_WIDTH_PERCENTAGE = 0x0004
|
||||
}
|
||||
typedef mycss_property_width_t;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_PROPERTY_CONST_H */
|
||||
|
||||
|
47
include/mycss/property/init.h
Normal file
47
include/mycss/property/init.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_PROPERTY_INIT_H
|
||||
#define MyHTML_MyCSS_PROPERTY_INIT_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/property/myosi.h>
|
||||
#include <mycss/property/parser.h>
|
||||
#include <mycss/values/serialization.h>
|
||||
#include <myhtml/utils.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const mycss_property_index_static_entry_t * mycss_property_index_entry_by_name(const char* name, size_t length);
|
||||
mycss_property_type_t mycss_property_type_by_name(const char *name, size_t length);
|
||||
|
||||
const mycss_property_value_index_static_entry_t * mycss_property_value_index_entry_by_name(const char* name, size_t length);
|
||||
mycss_property_value_t mycss_property_value_type_by_name(const char *name, size_t length);
|
||||
|
||||
void mycss_property_print(mycss_property_type_t prop_type, FILE* fh);
|
||||
void mycss_property_value_print(unsigned int value_type, void* value, FILE* fh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_PROPERTY_INIT_H */
|
59
include/mycss/property/myosi.h
Normal file
59
include/mycss/property/myosi.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_PROPERTY_MYOSI_H
|
||||
#define MyHTML_MyCSS_PROPERTY_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/property/const.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mycss_property_index_static_entry {
|
||||
const char* name;
|
||||
size_t name_length;
|
||||
|
||||
mycss_property_type_t type;
|
||||
mycss_parser_token_f parser;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef mycss_property_index_static_entry_t;
|
||||
|
||||
struct mycss_property_value_index_static_entry {
|
||||
const char* name;
|
||||
size_t name_length;
|
||||
|
||||
mycss_property_value_t type;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef mycss_property_value_index_static_entry_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_PROPERTY_MYOSI_H */
|
40
include/mycss/property/parser.h
Normal file
40
include/mycss/property/parser.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_PROPERTY_PARSER_H
|
||||
#define MyHTML_MyCSS_PROPERTY_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/property/myosi.h>
|
||||
#include <mycss/values/consume.h>
|
||||
#include <mycss/values/values.h>
|
||||
|
||||
bool mycss_property_parser_width(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_property_parser_height(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_PROPERTY_PARSER_H */
|
65
include/mycss/property/resources.h
Normal file
65
include/mycss/property/resources.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_PROPERTY_RESOURCES_H
|
||||
#define MyHTML_MyCSS_PROPERTY_RESOURCES_H
|
||||
#pragma once
|
||||
|
||||
#define MyCSS_PROPERTY_STATIC_INDEX_FOR_SEARCH_SIZE 3
|
||||
#define MyCSS_PROPERTY_VALUE_STATIC_INDEX_FOR_SEARCH_SIZE 5
|
||||
|
||||
static const mycss_property_index_static_entry_t mycss_property_index_static_for_search[] =
|
||||
{
|
||||
{NULL, 0, MyCSS_PROPERTY_TYPE_UNDEF, NULL, 0, 0},
|
||||
{"height", 6, MyCSS_PROPERTY_TYPE_HEIGHT, mycss_property_parser_height, 0, 1},
|
||||
{NULL, 0, MyCSS_PROPERTY_TYPE_UNDEF, NULL, 0, 0},
|
||||
{"width", 5, MyCSS_PROPERTY_TYPE_WIDTH, mycss_property_parser_width, 0, 3},
|
||||
};
|
||||
|
||||
static const mycss_property_value_index_static_entry_t mycss_property_value_index_static_for_search[] =
|
||||
{
|
||||
{NULL, 0, MyCSS_PROPERTY_VALUE_UNDEF, 0, 0},
|
||||
{"inherit", 7, MyCSS_PROPERTY_VALUE_INHERIT, 0, 1},
|
||||
{NULL, 0, MyCSS_PROPERTY_VALUE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_PROPERTY_VALUE_UNDEF, 0, 0},
|
||||
{"auto", 4, MyCSS_PROPERTY_VALUE_AUTO, 0, 4},
|
||||
{NULL, 0, MyCSS_PROPERTY_VALUE_UNDEF, 0, 0},
|
||||
};
|
||||
|
||||
static const char * mycss_property_index_type_name[] =
|
||||
{
|
||||
"",
|
||||
"height",
|
||||
"width",
|
||||
""
|
||||
};
|
||||
|
||||
static const char * mycss_property_index_type_value[] =
|
||||
{
|
||||
"",
|
||||
"auto",
|
||||
"inherit",
|
||||
"length",
|
||||
"percentage",
|
||||
""
|
||||
};
|
||||
|
||||
|
||||
#endif /* MyHTML_MyCSS_PROPERTY_RESOURCES_H */
|
75
include/mycss/selectors/function.h
Normal file
75
include/mycss/selectors/function.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_FUNCTION_H
|
||||
#define MyHTML_MyCSS_SELECTORS_FUNCTION_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/function_parser.h>
|
||||
|
||||
typedef void (*mycss_selectors_function_begin_f)(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
|
||||
struct mycss_selectors_function_index {
|
||||
mycss_parser_token_f parser;
|
||||
mycss_parser_token_f switch_parser;
|
||||
}
|
||||
typedef mycss_selectors_function_index_t;
|
||||
|
||||
struct mycss_selectots_function_begin_entry {
|
||||
const char* name;
|
||||
size_t length;
|
||||
|
||||
mycss_selectors_function_begin_f func;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef mycss_selectots_function_begin_entry_t;
|
||||
|
||||
mycss_selectors_function_begin_f mycss_function_begin_by_name(const char *name, size_t length);
|
||||
const mycss_selectots_function_begin_entry_t * mycss_function_begin_entry_by_name(const char* name, size_t length);
|
||||
|
||||
void mycss_selectors_function_begin_nth_child(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_not(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_dir(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_matches(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_lang(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_drop(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_nth_of_type(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_nth_last_column(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_current(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_nth_last_child(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_nth_last_of_type(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_has(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
void mycss_selectors_function_begin_nth_column(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
|
||||
void mycss_selectors_begin_unknown(mycss_entry_t* entry, mycss_selectors_entry_t* selector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_FUNCTION_H */
|
64
include/mycss/selectors/function_parser.h
Normal file
64
include/mycss/selectors/function_parser.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_FUNCTION_PARSER_H
|
||||
#define MyHTML_MyCSS_SELECTORS_FUNCTION_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#define MyCSS_SELECTORS_FUNCTION_NAME_STATIC_SIZE 57
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
|
||||
bool mycss_selectors_function_parser_state_drop_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_unknown_parser(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_function_parser_not_or_matches_or_current_parser(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_has(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_function_parser_nth_with_selectors(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_nth_with_selectors_need_of(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_nth_with_selectors_need_of_after(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_function_parser_nth_without_selectors(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_nth_without_selectors_after(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_function_parser_drop(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_drop_after(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_drop_after_column(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_function_parser_dir(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_dir_after(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
bool mycss_selectors_function_parser_lang(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_lang_after(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_function_parser_lang_comma(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_FUNCTION_PARSER_H */
|
90
include/mycss/selectors/function_resource.h
Normal file
90
include/mycss/selectors/function_resource.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_FUNCTION_RESOURCE_H
|
||||
#define MyHTML_MyCSS_SELECTORS_FUNCTION_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
#define MyCSS_SELECTORS_FUNCTION_NAME_STATIC_SIZE 57
|
||||
|
||||
static const mycss_selectots_function_begin_entry_t mycss_selectors_function_begin_map_index[] =
|
||||
{
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"dir", 3, mycss_selectors_function_begin_dir, 0, 1},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"nth-of-type", 11, mycss_selectors_function_begin_nth_of_type, 0, 3},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"nth-last-column", 15, mycss_selectors_function_begin_nth_last_column, 0, 13},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"current", 7, mycss_selectors_function_begin_current, 0, 19},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"matches", 7, mycss_selectors_function_begin_matches, 0, 23},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"has", 3, mycss_selectors_function_begin_has, 0, 28},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"not", 3, mycss_selectors_function_begin_not, 0, 34},
|
||||
{"nth-last-of-type", 16, mycss_selectors_function_begin_nth_last_of_type, 0, 35},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"lang", 4, mycss_selectors_function_begin_lang, 0, 37},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"nth-last-child", 14, mycss_selectors_function_begin_nth_last_child, 0, 44},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"nth-column", 10, mycss_selectors_function_begin_nth_column, 0, 47},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"nth-child", 9, mycss_selectors_function_begin_nth_child, 0, 49},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
{"drop", 4, mycss_selectors_function_begin_drop, 0, 56},
|
||||
{NULL, 0, NULL, 0, 0},
|
||||
};
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_FUNCTION_RESOURCE_H */
|
||||
|
66
include/mycss/selectors/init.h
Normal file
66
include/mycss/selectors/init.h
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_INIT_H
|
||||
#define MyHTML_MyCSS_SELECTORS_INIT_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/list.h>
|
||||
|
||||
mycss_selectors_t * mycss_selectors_create(void);
|
||||
mycss_status_t mycss_selectors_init(mycss_entry_t* entry, mycss_selectors_t* selectors);
|
||||
void mycss_selectors_clean(mycss_selectors_t* selectors);
|
||||
mycss_status_t mycss_selectors_clean_all(mycss_selectors_t* selectors);
|
||||
mycss_selectors_t * mycss_selectors_destroy(mycss_selectors_t* selectors, bool self_destroy);
|
||||
|
||||
void mycss_selectors_entry_clean(mycss_selectors_entry_t* sel_entry);
|
||||
mycss_selectors_entry_t * mycss_selectors_entry_destroy(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, bool self_destroy);
|
||||
|
||||
void * mycss_selectors_entry_value_destroy(mycss_entry_t* entry, mycss_selectors_entry_t* selector_entry, bool destroy_self);
|
||||
|
||||
mycss_selectors_list_t * mycss_selectors_parse(mycss_selectors_t* selectors, myhtml_encoding_t encoding, const char* data, size_t data_size, mycss_status_t* out_status);
|
||||
mycss_selectors_list_t * mycss_selectors_parse_by_function(mycss_selectors_t* selectors, mycss_parser_token_f func, myhtml_encoding_t encoding, const char* data, size_t data_size, mycss_status_t* out_status);
|
||||
|
||||
mycss_selectors_entry_t * mycss_selectors_entry_find_first(mycss_selectors_entry_t* selector);
|
||||
|
||||
void mycss_selectors_print_list(mycss_selectors_t* selectors, mycss_selectors_list_t* selectors_list, FILE* fh);
|
||||
void mycss_selectors_print_selector(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, FILE* fh);
|
||||
void mycss_selectors_print_chain(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, FILE* fh);
|
||||
|
||||
mycss_selectors_entry_t * mycss_selectors_entry_create(mycss_selectors_t* selectors);
|
||||
|
||||
mycss_selectors_entry_t ** mycss_selectors_entry_list_create(mycss_selectors_t* selectors);
|
||||
mycss_selectors_entry_t ** mycss_selectors_entry_list_add_one(mycss_selectors_t* selectors, mycss_selectors_entry_t** list, size_t current_size);
|
||||
mycss_selectors_entry_t ** mycss_selectors_entry_list_destroy(mycss_selectors_t* selectors, mycss_selectors_entry_t** list);
|
||||
|
||||
mycss_selectors_entry_t * mycss_selectors_entry(mycss_selectors_t* selectors);
|
||||
void mycss_selectors_entry_append_to_current(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_INIT_H */
|
62
include/mycss/selectors/list.h
Normal file
62
include/mycss/selectors/list.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_LIST_H
|
||||
#define MyHTML_MyCSS_SELECTORS_LIST_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/declaration/myosi.h>
|
||||
|
||||
struct mycss_selectors_list {
|
||||
mycss_selectors_entry_t** selector_list;
|
||||
size_t selector_list_length;
|
||||
|
||||
mycss_declaration_entry_t* declaration_entry;
|
||||
|
||||
mycss_selectors_flags_t flags;
|
||||
|
||||
mycss_selectors_list_t* parent;
|
||||
mycss_selectors_list_t* next;
|
||||
mycss_selectors_list_t* prev;
|
||||
};
|
||||
|
||||
mycss_selectors_list_t * mycss_selectors_list_create(mycss_selectors_t* selectors);
|
||||
void mycss_selectors_list_clean(mycss_selectors_list_t* selector_list);
|
||||
mycss_selectors_list_t * mycss_selectors_list_destroy(mycss_selectors_t* selectors, mycss_selectors_list_t* selector_list, bool self_destroy);
|
||||
|
||||
mycss_selectors_list_t * mycss_selectors_list_append_selector(mycss_selectors_t* selectors, mycss_selectors_list_t* selector_list, mycss_selectors_entry_t* selector);
|
||||
mycss_selectors_entry_t * mycss_selectors_list_last_entry(mycss_selectors_list_t* list);
|
||||
mycss_selectors_entry_t ** mycss_selectors_list_current_chain(mycss_selectors_list_t* list);
|
||||
|
||||
void mycss_selectors_list_append_to_current(mycss_selectors_t* selectors, mycss_selectors_list_t* current_list);
|
||||
|
||||
bool mycss_selectors_list_destroy_last_empty_selector(mycss_selectors_t* selectors, mycss_selectors_list_t* list, bool destroy_found);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_LIST_H */
|
228
include/mycss/selectors/myosi.h
Normal file
228
include/mycss/selectors/myosi.h
Normal file
@ -0,0 +1,228 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_MYOSI_H
|
||||
#define MyHTML_MyCSS_SELECTORS_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct mycss_selectors mycss_selectors_t;
|
||||
typedef struct mycss_selectors_entry mycss_selectors_entry_t;
|
||||
typedef struct mycss_selectors_list mycss_selectors_list_t;
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mystring.h>
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <mycss/declaration/myosi.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
|
||||
typedef bool (*mycss_selectors_state_f)(mycss_entry_t* entry, mycss_selectors_t* selectors, mycss_selectors_entry_t* selector, mycss_token_t* token);
|
||||
typedef void (*mycss_callback_selector_done_f)(mycss_selectors_t* selectors, mycss_selectors_entry_t* selector);
|
||||
|
||||
enum mycss_selectors_match {
|
||||
MyCSS_SELECTORS_MATCH_EQUAL = 0x00, // =
|
||||
MyCSS_SELECTORS_MATCH_INCLUDE = 0x01, // ~=
|
||||
MyCSS_SELECTORS_MATCH_DASH = 0x02, // |=
|
||||
MyCSS_SELECTORS_MATCH_PREFIX = 0x03, // ^=
|
||||
MyCSS_SELECTORS_MATCH_SUFFIX = 0x04, // $=
|
||||
MyCSS_SELECTORS_MATCH_SUBSTRING = 0x05, // *=
|
||||
MyCSS_SELECTORS_MATCH_LAST_ENTRY = 0x06
|
||||
}
|
||||
typedef mycss_selectors_match_t;
|
||||
|
||||
enum mycss_selectors_combinator {
|
||||
MyCSS_SELECTORS_COMBINATOR_UNDEF = 0x00, // two compound selectors [key=val].foo
|
||||
MyCSS_SELECTORS_COMBINATOR_DESCENDANT = 0x01, // '>>' or WHITESPACE
|
||||
MyCSS_SELECTORS_COMBINATOR_CHILD = 0x02, // '>'
|
||||
MyCSS_SELECTORS_COMBINATOR_NEXT_SIBLING = 0x03, // '+'
|
||||
MyCSS_SELECTORS_COMBINATOR_FOLLOWING_SIBLING = 0x04, // '~'
|
||||
MyCSS_SELECTORS_COMBINATOR_COLUMN = 0x05, // '||'
|
||||
MyCSS_SELECTORS_COMBINATOR_LAST_ENTRY = 0x06
|
||||
}
|
||||
typedef mycss_selectors_combinator_t;
|
||||
|
||||
enum mycss_selectors_mod {
|
||||
MyCSS_SELECTORS_MOD_UNDEF = 0x00,
|
||||
MyCSS_SELECTORS_MOD_I = 0x01
|
||||
}
|
||||
typedef mycss_selectors_mod_t;
|
||||
|
||||
enum mycss_selectors_flags {
|
||||
MyCSS_SELECTORS_FLAGS_UNDEF = 0x00,
|
||||
MyCSS_SELECTORS_FLAGS_SELECTOR_BAD = 0x01
|
||||
}
|
||||
typedef mycss_selectors_flags_t;
|
||||
|
||||
enum mycss_selectors_type {
|
||||
MyCSS_SELECTORS_TYPE_UNDEF = 0x000, // tag name <div> = div in css
|
||||
MyCSS_SELECTORS_TYPE_ELEMENT = 0x001, // tag name <div> = div in css
|
||||
MyCSS_SELECTORS_TYPE_ID = 0x002, // #hash
|
||||
MyCSS_SELECTORS_TYPE_CLASS = 0x003, // .class
|
||||
MyCSS_SELECTORS_TYPE_ATTRIBUTE = 0x004, // [key=val], in html <div key="val">
|
||||
MyCSS_SELECTORS_TYPE_PSEUDO_CLASS_FUNCTION = 0x005, // :function(...)
|
||||
MyCSS_SELECTORS_TYPE_PSEUDO_CLASS = 0x006, // :pseudo
|
||||
MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT_FUNCTION = 0x007, // ::function(...)
|
||||
MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT = 0x008, // ::pseudo
|
||||
MyCSS_SELECTORS_TYPE_LAST_ENTRY = 0x009
|
||||
}
|
||||
typedef mycss_selectors_type_t;
|
||||
|
||||
enum mycss_selectors_sub_type {
|
||||
MyCSS_SELECTORS_SUB_TYPE_UNDEF = 0x00,
|
||||
MyCSS_SELECTORS_SUB_TYPE_UNKNOWN = 0x01
|
||||
}
|
||||
typedef mycss_selectors_sub_type_t;
|
||||
|
||||
/* pseudo classes functions */
|
||||
enum mycss_selectors_sub_type_pseudo_class_function {
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNDEF = 0x00,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_UNKNOWN = 0x01,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_CURRENT = 0x02,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DIR = 0x03,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_DROP = 0x04,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_HAS = 0x05,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LANG = 0x06,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_MATCHES = 0x07,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NOT = 0x08,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_CHILD = 0x09,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_COLUMN = 0x0a,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_CHILD = 0x0b,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_COLUMN = 0x0c,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_LAST_OF_TYPE = 0x0d,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_NTH_OF_TYPE = 0x0e,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LAST_ENTRY = 0x0f
|
||||
}
|
||||
typedef mycss_selectors_sub_type_pseudo_class_function_t;
|
||||
|
||||
/* pseudo classes */
|
||||
enum mycss_selectors_sub_type_pseudo_class {
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF = 0x00,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNKNOWN = 0x01,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ACTIVE = 0x02,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ANY_LINK = 0x03,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_BLANK = 0x04,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_CHECKED = 0x05,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_CURRENT = 0x06,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DEFAULT = 0x07,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DISABLED = 0x08,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DROP = 0x09,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_EMPTY = 0x0a,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ENABLED = 0x0b,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FIRST_CHILD = 0x0c,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FIRST_OF_TYPE = 0x0d,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FOCUS = 0x0e,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUTURE = 0x0f,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_HOVER = 0x10,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_IN_RANGE = 0x11,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_INDETERMINATE = 0x12,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_INVALID = 0x13,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_CHILD = 0x14,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_OF_TYPE = 0x15,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LINK = 0x16,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ONLY_CHILD = 0x17,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ONLY_OF_TYPE = 0x18,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_OPTIONAL = 0x19,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_OUT_OF_RANGE = 0x1a,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_PAST = 0x1b,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_PLACEHOLDER_SHOWN = 0x1c,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_READ_ONLY = 0x1d,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_READ_WRITE = 0x1e,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_REQUIRED = 0x1f,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ROOT = 0x20,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_SCOPE = 0x21,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_TARGET = 0x22,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_USER_ERROR = 0x23,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_VALID = 0x24,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_VISITED = 0x25,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_ENTRY = 0x26
|
||||
}
|
||||
typedef mycss_selectors_sub_type_pseudo_class_t;
|
||||
|
||||
/* pseudo element */
|
||||
enum mycss_selectors_sub_type_pseudo_element {
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF = 0x00,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNKNOWN = 0x01,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_AFTER = 0x02,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_BACKDROP = 0x03,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_BEFORE = 0x04,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_FIRST_LETTER = 0x05,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_FIRST_LINE = 0x06,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_GRAMMAR_ERROR = 0x07,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_MARKER = 0x08,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_PLACEHOLDER = 0x09,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_SELECTION = 0x0a,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_SPELLING_ERROR = 0x0b,
|
||||
MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_LAST_ENTRY = 0x0c
|
||||
}
|
||||
typedef mycss_selectors_sub_type_pseudo_element_t;
|
||||
|
||||
enum mycss_selectors_function_drop_type {
|
||||
MyCSS_SELECTORS_FUNCTION_DROP_TYPE_UNDEF = 0x000,
|
||||
MyCSS_SELECTORS_FUNCTION_DROP_TYPE_ACTIVE = 0x001,
|
||||
MyCSS_SELECTORS_FUNCTION_DROP_TYPE_VALID = 0x002,
|
||||
MyCSS_SELECTORS_FUNCTION_DROP_TYPE_INVALID = 0x004,
|
||||
}
|
||||
typedef mycss_selectors_function_drop_type_t;
|
||||
|
||||
struct mycss_selectors {
|
||||
// refs
|
||||
mycss_entry_t* ref_entry;
|
||||
|
||||
mycss_selectors_entry_t** entry;
|
||||
mycss_selectors_entry_t* entry_last;
|
||||
|
||||
mycss_selectors_list_t** list;
|
||||
mycss_selectors_list_t* list_last;
|
||||
|
||||
mycss_selectors_combinator_t* combinator;
|
||||
|
||||
mycss_token_type_t ending_token;
|
||||
|
||||
mcobject_t* mcobject_entries;
|
||||
mcobject_t* mcobject_list_entries;
|
||||
};
|
||||
|
||||
struct mycss_selectors_entry {
|
||||
mycss_selectors_type_t type;
|
||||
int sub_type;
|
||||
mycss_selectors_flags_t flags;
|
||||
|
||||
mycss_namespace_entry_t* ns_entry;
|
||||
|
||||
myhtml_string_t* key;
|
||||
void* value;
|
||||
|
||||
mycss_selectors_combinator_t combinator;
|
||||
|
||||
/* TODO: experimental */
|
||||
void* node;
|
||||
|
||||
mycss_selectors_entry_t* next;
|
||||
mycss_selectors_entry_t* prev;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_MYOSI_H */
|
33
include/mycss/selectors/myosi_resource.h
Normal file
33
include/mycss/selectors/myosi_resource.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_MYOSI_RESOURCE_H
|
||||
#define MyHTML_MyCSS_SELECTORS_MYOSI_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
static const char mycss_selectors_resource_matcher_names_map[][3] = {
|
||||
"=", "~=", "|=", "^=", "$=", "*="
|
||||
};
|
||||
|
||||
static const char mycss_selectors_resource_combinator_names_map[][3] = {
|
||||
"", " ", ">", "+", "~", "||"
|
||||
};
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_MYOSI_RESOURCE_H */
|
65
include/mycss/selectors/parser.h
Normal file
65
include/mycss/selectors/parser.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_PARSER_H
|
||||
#define MyHTML_MyCSS_SELECTORS_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <mycss/namespace/init.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/value.h>
|
||||
#include <mycss/selectors/function.h>
|
||||
#include <mycss/selectors/pseudo.h>
|
||||
|
||||
void mycss_selectors_parser_selector_begin(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_ident_type(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_ident_attr(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_namespace_ident(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_namespace_attr(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_after_namespace(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_id(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_class(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_value(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_end(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_modifier(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_pseudo_class(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_pseudo_class_function(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_pseudo_class_function_end(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_pseudo_element(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_pseudo_element_function(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_selector_pseudo_element_function_end(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_expectations_error(mycss_entry_t* entry, mycss_token_t* token);
|
||||
void mycss_selectors_parser_bad_token(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
/* for set parent selector bad status if child selector is bad*/
|
||||
void mycss_selectors_parser_check_and_set_bad_parent_selector(mycss_entry_t* entry, mycss_selectors_list_t* selectors_list);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_PARSER_H */
|
52
include/mycss/selectors/pseudo.h
Normal file
52
include/mycss/selectors/pseudo.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_PSEUDO_H
|
||||
#define MyHTML_MyCSS_SELECTORS_PSEUDO_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
|
||||
struct mycss_selectots_pseudo_begin_entry {
|
||||
const char* name;
|
||||
size_t length;
|
||||
|
||||
int sub_type;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef mycss_selectots_pseudo_begin_entry_t;
|
||||
|
||||
|
||||
mycss_selectors_sub_type_pseudo_class_t mycss_pseudo_class_by_name(const char *name, size_t length);
|
||||
mycss_selectors_sub_type_pseudo_element_t mycss_pseudo_element_by_name(const char *name, size_t length);
|
||||
const mycss_selectots_pseudo_begin_entry_t * mycss_pseudo_begin_entry_by_name(const char* name, size_t length, size_t static_size, const mycss_selectots_pseudo_begin_entry_t* pseudo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_PSEUDO_H */
|
161
include/mycss/selectors/pseudo_resource.h
Normal file
161
include/mycss/selectors/pseudo_resource.h
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_PSEUDO_RESOURCE_H
|
||||
#define MyHTML_MyCSS_SELECTORS_PSEUDO_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
#define MyCSS_SELECTORS_PSEUDO_CLASS_NAME_STATIC_SIZE 73
|
||||
#define MyCSS_SELECTORS_PSEUDO_ELEMENT_NAME_STATIC_SIZE 41
|
||||
|
||||
static const mycss_selectots_pseudo_begin_entry_t mycss_selectors_pseudo_class_begin_map_index[] =
|
||||
{
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"placeholder-shown", 17, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_PLACEHOLDER_SHOWN, 0, 4},
|
||||
{"empty", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_EMPTY, 74, 5},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"last-of-type", 12, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_OF_TYPE, 0, 8},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"user-error", 10, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_USER_ERROR, 0, 10},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"in-range", 8, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_IN_RANGE, 0, 15},
|
||||
{"link", 4, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LINK, 75, 16},
|
||||
{"blank", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_BLANK, 76, 17},
|
||||
{"active", 6, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ACTIVE, 0, 18},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"read-write", 10, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_READ_WRITE, 0, 20},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"checked", 7, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_CHECKED, 77, 24},
|
||||
{"default", 7, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DEFAULT, 0, 25},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"focus", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FOCUS, 78, 32},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"last-child", 10, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_LAST_CHILD, 0, 34},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"enabled", 7, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ENABLED, 0, 37},
|
||||
{"visited", 7, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_VISITED, 0, 38},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"scope", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_SCOPE, 79, 41},
|
||||
{"indeterminate", 13, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_INDETERMINATE, 0, 42},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"root", 4, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ROOT, 80, 45},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"read-only", 9, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_READ_ONLY, 0, 47},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"drop", 4, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DROP, 0, 52},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"future", 6, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUTURE, 0, 55},
|
||||
{"optional", 8, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_OPTIONAL, 0, 56},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"invalid", 7, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_INVALID, 0, 63},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"past", 4, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_PAST, 81, 66},
|
||||
{"only-of-type", 12, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ONLY_OF_TYPE, 82, 67},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_UNDEF, 0, 0},
|
||||
{"target", 6, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_TARGET, 0, 72},
|
||||
{"first-child", 11, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FIRST_CHILD, 0, 73},
|
||||
{"hover", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_HOVER, 0, 74},
|
||||
{"current", 7, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_CURRENT, 0, 75},
|
||||
{"valid", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_VALID, 0, 76},
|
||||
{"required", 8, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_REQUIRED, 0, 77},
|
||||
{"any-link", 8, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ANY_LINK, 0, 78},
|
||||
{"only-child", 10, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_ONLY_CHILD, 0, 79},
|
||||
{"first-of-type", 13, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FIRST_OF_TYPE, 0, 80},
|
||||
{"disabled", 8, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_DISABLED, 0, 81},
|
||||
{"out-of-range", 12, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_OUT_OF_RANGE, 0, 82},
|
||||
};
|
||||
|
||||
static const mycss_selectots_pseudo_begin_entry_t mycss_selectors_pseudo_element_begin_map_index[] =
|
||||
{
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"grammar-error", 13, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_GRAMMAR_ERROR, 0, 4},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"first-letter", 12, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_FIRST_LETTER, 0, 14},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"marker", 6, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_MARKER, 0, 19},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"before", 6, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_BEFORE, 0, 21},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"after", 5, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_AFTER, 0, 23},
|
||||
{"placeholder", 11, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_PLACEHOLDER, 0, 24},
|
||||
{"spelling-error", 14, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_SPELLING_ERROR, 0, 25},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"backdrop", 8, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_BACKDROP, 0, 28},
|
||||
{"first-line", 10, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_FIRST_LINE, 0, 29},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{"selection", 9, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_SELECTION, 0, 35},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_SELECTORS_SUB_TYPE_PSEUDO_ELEMENT_UNDEF, 0, 0},
|
||||
};
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_PSEUDO_RESOURCE_H */
|
90
include/mycss/selectors/state.h
Normal file
90
include/mycss/selectors/state.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_STATE_H
|
||||
#define MyHTML_MyCSS_SELECTORS_STATE_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <mycss/selectors/parser.h>
|
||||
#include <myhtml/utils.h>
|
||||
|
||||
void mycss_selectors_state_end(mycss_entry_t* entry);
|
||||
bool mycss_selectors_state_function_skip_all(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
/* <drop> */
|
||||
bool mycss_selectors_state_drop(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_drop_component_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
/* <combinator> */
|
||||
bool mycss_selectors_state_combinator(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_combinator_greater_than(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
/* <complex-selector-list> */
|
||||
bool mycss_selectors_state_complex_selector_list(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_complex_selector_list_need_combinator_or_selector(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_complex_selector_list_need_combinator_or_selector_ws(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_complex_selector_list_need_selector(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_complex_selector_list_need_comma(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
/* <compound-selector-list> */
|
||||
bool mycss_selectors_state_compound_selector_list(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_compound_selector_list_need_selector(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_compound_selector_list_need_selector_or_comma(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_compound_selector_list_comma_ws(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_compound_selector_list_need_ending_or_comma(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
/* <relative-selector-list> */
|
||||
bool mycss_selectors_state_relative_selector_list(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_relative_selector_list_need_selector(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_relative_selector_list_need_combinator_or_selector_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_relative_selector_list_need_combinator_or_selector(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_relative_selector_list_need_combinator_or_selector_ws(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
/* <simple-selector> */
|
||||
bool mycss_selectors_state_simple_selector_begin(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_left_bracket(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_left_bracket_vertical_bar(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_left_bracket_ident(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_left_bracket_ident_vertical_bar(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_colon(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_colon_colon(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_colon_colon_function(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_colon_function(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_full_stop(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_vertical_bar(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_ident(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_simple_selector_ident_vertical_bar(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_shared_after_attr_modifier(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_shared_after_attribute_value(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_left_bracket_after_wq_name_attr(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
bool mycss_selectors_state_shared_after_attr_matcher(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_STATE_H */
|
107
include/mycss/selectors/value.h
Normal file
107
include/mycss/selectors/value.h
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_VALUE_H
|
||||
#define MyHTML_MyCSS_SELECTORS_VALUE_H
|
||||
#pragma once
|
||||
|
||||
#define mycss_selector_value_attribute(obj) ((mycss_selectors_object_attribute_t*)(obj))
|
||||
#define mycss_selector_value_string(obj) ((myhtml_string_t*)(obj))
|
||||
#define mycss_selector_value_an_plus_b(obj) ((mycss_an_plus_b_entry_t*)(obj))
|
||||
#define mycss_selector_value_drop(obj) ((mycss_selectors_function_drop_type_t)(obj))
|
||||
#define mycss_selector_value_lang(obj) ((mycss_selectors_value_lang_t*)(obj))
|
||||
#define mycss_selector_value_function(obj) ((mycss_result_entry_t*)(obj))
|
||||
#define mycss_selector_value_destroy(entry, type, sub_type, value, self_destroy) (mycss_selectors_value_destroy_map[type](entry, type, sub_type, value, self_destroy))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
|
||||
typedef void * (*mycss_selectors_value_destroy_f)(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
typedef void * (*mycss_selectors_value_function_destroy_f)(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
|
||||
struct mycss_selectors_value_attribute {
|
||||
myhtml_string_t* value;
|
||||
|
||||
mycss_selectors_match_t match;
|
||||
mycss_selectors_mod_t mod;
|
||||
}
|
||||
typedef mycss_selectors_object_attribute_t;
|
||||
|
||||
struct mycss_selectors_value_lang {
|
||||
myhtml_string_t str;
|
||||
struct mycss_selectors_value_lang* next;
|
||||
}
|
||||
typedef mycss_selectors_value_lang_t;
|
||||
|
||||
|
||||
/* create */
|
||||
void * mycss_selectors_value_undef_create(mycss_entry_t* entry, bool set_clean);
|
||||
mycss_selectors_object_attribute_t * mycss_selectors_value_attribute_create(mycss_entry_t* entry, bool set_clean);
|
||||
|
||||
/* destroy */
|
||||
void * mycss_selectors_value_undef_destroy(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_id_destroy(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_class_destroy(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_element_destroy(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_attribute_destroy(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_destroy(mycss_entry_t* entry, mycss_selectors_type_t type, int sub_type, void* value, bool self_destroy);
|
||||
|
||||
/* pseudo class function create */
|
||||
void * mycss_selectors_value_pseudo_class_function_undef_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_current_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_dir_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_drop_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_has_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_lang_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_matches_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_not_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_child_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_column_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_last_child_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_last_column_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_last_of_type_create(mycss_entry_t* entry, bool set_clean);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_of_type_create(mycss_entry_t* entry, bool set_clean);
|
||||
|
||||
/* pseudo class function destroy */
|
||||
void * mycss_selectors_value_pseudo_class_function_undef_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_current_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_dir_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_drop_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_has_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_lang_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_matches_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_not_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_child_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_column_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_last_child_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_last_column_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_last_of_type_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
void * mycss_selectors_value_pseudo_class_function_nth_of_type_destroy(mycss_entry_t* entry, void* value, bool self_destroy);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_VALUE_H */
|
57
include/mycss/selectors/value_resource.h
Normal file
57
include/mycss/selectors/value_resource.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_SELECTORS_VALUE_RESOURCE_H
|
||||
#define MyHTML_MyCSS_SELECTORS_VALUE_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/selectors/myosi.h>
|
||||
|
||||
static const mycss_selectors_value_destroy_f mycss_selectors_value_destroy_map[MyCSS_SELECTORS_TYPE_LAST_ENTRY] = {
|
||||
mycss_selectors_value_undef_destroy, /* MyCSS_SELECTORS_TYPE_UNDEF */
|
||||
mycss_selectors_value_element_destroy, /* MyCSS_SELECTORS_TYPE_ELEMENT */
|
||||
mycss_selectors_value_id_destroy, /* MyCSS_SELECTORS_TYPE_ID */
|
||||
mycss_selectors_value_class_destroy, /* MyCSS_SELECTORS_TYPE_CLASS */
|
||||
mycss_selectors_value_attribute_destroy, /* MyCSS_SELECTORS_TYPE_ATTRIBUTE */
|
||||
mycss_selectors_value_pseudo_class_function_destroy, /* MyCSS_SELECTORS_TYPE_PSEUDO_CLASS_FUNCTION */
|
||||
mycss_selectors_value_undef_destroy, /* MyCSS_SELECTORS_TYPE_PSEUDO_CLASS */
|
||||
mycss_selectors_value_undef_destroy, /* MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT_FUNCTION */
|
||||
mycss_selectors_value_undef_destroy /* MyCSS_SELECTORS_TYPE_PSEUDO_ELEMENT */
|
||||
};
|
||||
|
||||
static const mycss_selectors_value_function_destroy_f mycss_selectors_value_function_destroy_map[MyCSS_SELECTORS_SUB_TYPE_PSEUDO_CLASS_FUNCTION_LAST_ENTRY] = {
|
||||
mycss_selectors_value_pseudo_class_function_undef_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_undef_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_current_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_dir_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_drop_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_has_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_lang_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_matches_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_not_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_nth_child_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_nth_column_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_nth_last_child_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_nth_last_column_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_nth_last_of_type_destroy,
|
||||
mycss_selectors_value_pseudo_class_function_nth_of_type_destroy,
|
||||
};
|
||||
|
||||
#endif /* MyHTML_MyCSS_SELECTORS_VALUE_RESOURCE_H */
|
58
include/mycss/stylesheet.h
Normal file
58
include/mycss/stylesheet.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_STYLESHEET_H
|
||||
#define MyHTML_MyCSS_STYLESHEET_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/namespace/myosi.h>
|
||||
#include <mycss/selectors/myosi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mycss_stylesheet {
|
||||
mycss_entry_t* entry; /* refs */
|
||||
|
||||
mycss_namespace_stylesheet_t ns_stylesheet;
|
||||
mycss_selectors_list_t* sel_list_first;
|
||||
|
||||
mycss_stylesheet_t* child;
|
||||
mycss_stylesheet_t* parent;
|
||||
mycss_stylesheet_t* next;
|
||||
mycss_stylesheet_t* prev;
|
||||
};
|
||||
|
||||
mycss_stylesheet_t * mycss_stylesheet_create(void);
|
||||
mycss_status_t mycss_stylesheet_init(mycss_stylesheet_t* stylesheet, mycss_entry_t* entry);
|
||||
mycss_status_t mycss_stylesheet_clean_all(mycss_stylesheet_t* stylesheet);
|
||||
mycss_stylesheet_t * mycss_stylesheet_destroy(mycss_stylesheet_t* stylesheet, bool self_destroy);
|
||||
|
||||
void mycss_stylesheet_print(mycss_stylesheet_t* stylesheet, FILE* fh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* MyHTML_MyCSS_STYLESHEET_H */
|
140
include/mycss/tokenizer.h
Normal file
140
include/mycss/tokenizer.h
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_TOKENIZER_H
|
||||
#define MyHTML_MyCSS_TOKENIZER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/check.h>
|
||||
#include <mycss/tokenizer_global.h>
|
||||
#include <mycss/tokenizer_end.h>
|
||||
|
||||
#include <myhtml/incoming.h>
|
||||
|
||||
#define MyCSS_TOKEN_READY_CALLBACK_FUNCTION(ENTRY, TOKEN) \
|
||||
++ENTRY->token_counter; \
|
||||
if(ENTRY->token_ready_callback) \
|
||||
(void)ENTRY->token_ready_callback(ENTRY, TOKEN)
|
||||
|
||||
#define MyCSS_TOKEN_READY_CALLBACK_FUNCTION_WITH_REPLACE(ENTRY, TOKEN) \
|
||||
++ENTRY->token_counter; \
|
||||
if(ENTRY->token_ready_callback) \
|
||||
TOKEN = ENTRY->token_ready_callback(ENTRY, TOKEN)
|
||||
|
||||
struct mycss_token {
|
||||
mycss_token_type_t type;
|
||||
size_t begin;
|
||||
size_t length;
|
||||
|
||||
const char* data;
|
||||
};
|
||||
|
||||
mycss_status_t mycss_tokenizer_state_init(mycss_t* mycss);
|
||||
void mycss_tokenizer_state_destroy(mycss_t* mycss);
|
||||
|
||||
mycss_status_t mycss_tokenizer_chunk(mycss_entry_t* entry, const char* css, size_t css_length);
|
||||
mycss_status_t mycss_tokenizer_process(mycss_entry_t* entry, const char* css, size_t css_length);
|
||||
mycss_status_t mycss_tokenizer_end(mycss_entry_t* entry);
|
||||
|
||||
size_t mycss_tokenizer_run_state_single(mycss_entry_t* entry, mycss_tokenizer_state_t state, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_set_current_buffer_for_continue(mycss_entry_t* entry, size_t css_offset, size_t css_minus_offset);
|
||||
size_t mycss_tokenizer_token_strcasecmp(mycss_entry_t* entry, mycss_token_t* token, const char* to, size_t to_length);
|
||||
|
||||
|
||||
size_t mycss_tokenizer_state_quotation_mark(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_quotation_mark_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_number_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_number_sign_name_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_number_sign_name_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_dollar_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_apostrophe(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_apostrophe_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_left_parenthesis(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_right_parenthesis(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_asterisk(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_plus_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_plus_sign_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_comma(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_hyphen_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_hyphen_minus_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_hyphen_minus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_hyphen_minus_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_hyphen_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_solidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_solidus_comment_end(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_colon(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_semicolon(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_less_than_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_less_than_sign_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_less_than_sign_minus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_commercial_at(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_commercial_at_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_commercial_at_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_commercial_at_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_commercial_at_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_left_square_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_reverse_solidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_right_square_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_circumflex_accent(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_left_curly_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_right_curly_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_digit(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_letter_u(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_letter_u_next(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_name_start_code_point(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_vertical_line(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_state_tilde(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_state_delim_single_code_point(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
125
include/mycss/tokenizer_end.h
Normal file
125
include/mycss/tokenizer_end.h
Normal file
@ -0,0 +1,125 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_TOKENIZER_END_H
|
||||
#define MyHTML_MyCSS_TOKENIZER_END_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/entry.h>
|
||||
|
||||
size_t mycss_tokenizer_end_run_state_single(mycss_entry_t* entry, mycss_tokenizer_state_t state, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_state_whitespace(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_quotation_mark(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_quotation_mark_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_number_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_number_sign_name_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_number_sign_name_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_dollar_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_apostrophe(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_apostrophe_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_left_parenthesis(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_right_parenthesis(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_asterisk(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_plus_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_plus_sign_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_comma(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_hyphen_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_hyphen_minus_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_hyphen_minus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_hyphen_minus_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_hyphen_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_full_stop(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_solidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_solidus_comment_end(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_colon(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_semicolon(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_less_than_sign(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_less_than_sign_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_less_than_sign_minus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_commercial_at(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_commercial_at_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_commercial_at_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_commercial_at_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_commercial_at_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_left_square_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_reverse_solidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_right_square_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_circumflex_accent(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_left_curly_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_right_curly_bracket(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_digit(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_letter_u(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_letter_u_next(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_name_start_code_point(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_vertical_line(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_tilde(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_state_delim_single_code_point(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
// Global
|
||||
size_t mycss_tokenizer_end_global_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_numeric(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_numeric_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_numeric_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_numeric_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_number_digit(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_number_dot(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_number_decimal(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_number_e(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_number_e_plus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_number_e_decimal(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_ident(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_url(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_url_string_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_url_after(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_url_after_whitespace(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_url_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_bad_url(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_name(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_name_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_string_double_quoted(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_string_double_quoted_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_string_single_quoted(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_string_single_quoted_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_end_global_state_unicode_range_before(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_unicode_range(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_unicode_range_question(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_end_global_state_unicode_range_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_TOKENIZER_END_H */
|
78
include/mycss/tokenizer_global.h
Normal file
78
include/mycss/tokenizer_global.h
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_TOKENIZER_GLOBAL_H
|
||||
#define MyHTML_MyCSS_TOKENIZER_GLOBAL_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/mycss.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/check.h>
|
||||
|
||||
size_t mycss_tokenizer_global_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_numeric(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_numeric_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_numeric_minus_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_numeric_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_number_digit(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_number_dot(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_number_decimal(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_number_e(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_number_e_plus_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_number_e_decimal(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_ident(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_url(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_url_string_back(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_url_after(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_url_after_whitespace(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_url_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_bad_url(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_name(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_name_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_string_double_quoted(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_string_double_quoted_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_string_double_quoted_rsolidus_r(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_string_single_quoted(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_string_single_quoted_rsolidus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_string_single_quoted_rsolidus_r(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
size_t mycss_tokenizer_global_state_unicode_range_before(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_unicode_range(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_unicode_range_question(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
size_t mycss_tokenizer_global_state_unicode_range_minus(mycss_entry_t* entry, mycss_token_t* token, const char* css, size_t css_offset, size_t css_size);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_TOKENIZER_GLOBAL_H */
|
362
include/mycss/tokenizer_resource.h
Normal file
362
include/mycss/tokenizer_resource.h
Normal file
@ -0,0 +1,362 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_TOKENIZER_RESOURCE_H
|
||||
#define MyHTML_MyCSS_TOKENIZER_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// generated by Perl script utils/mycss_first_char.pl
|
||||
static const mycss_tokenizer_state_t mycss_begin_chars_state_map[] = {
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_WHITESPACE, // whitespace
|
||||
MyCSS_TOKENIZER_STATE_WHITESPACE, // whitespace
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_WHITESPACE, // whitespace
|
||||
MyCSS_TOKENIZER_STATE_WHITESPACE, // whitespace
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_WHITESPACE, // whitespace
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_QUOTATION_MARK, // U+0022 QUOTATION MARK (")
|
||||
MyCSS_TOKENIZER_STATE_NUMBER_SIGN, // U+0023 NUMBER SIGN (#)
|
||||
MyCSS_TOKENIZER_STATE_DOLLAR_SIGN, // U+0024 DOLLAR SIGN ($)
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_APOSTROPHE, // U+0027 APOSTROPHE (')
|
||||
MyCSS_TOKENIZER_STATE_LEFT_PARENTHESIS, // U+0028 LEFT PARENTHESIS (()
|
||||
MyCSS_TOKENIZER_STATE_RIGHT_PARENTHESIS, // U+0029 RIGHT PARENTHESIS ())
|
||||
MyCSS_TOKENIZER_STATE_ASTERISK, // U+002A ASTERISK (*)
|
||||
MyCSS_TOKENIZER_STATE_PLUS_SIGN, // U+002B PLUS SIGN (+)
|
||||
MyCSS_TOKENIZER_STATE_COMMA, // U+002C COMMA (,)
|
||||
MyCSS_TOKENIZER_STATE_HYPHEN_MINUS, // U+002D HYPHEN-MINUS (-)
|
||||
MyCSS_TOKENIZER_STATE_FULL_STOP, // U+002E FULL STOP (.)
|
||||
MyCSS_TOKENIZER_STATE_SOLIDUS, // U+002F SOLIDUS (/)
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_DIGIT, // digit
|
||||
MyCSS_TOKENIZER_STATE_COLON, // U+003A COLON (:)
|
||||
MyCSS_TOKENIZER_STATE_SEMICOLON, // U+003B SEMICOLON (;)
|
||||
MyCSS_TOKENIZER_STATE_LESS_THAN_SIGN, // U+003C LESS-THAN SIGN (<)
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_COMMERCIAL_AT, // U+0040 COMMERCIAL AT (@)
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_LETTER_U, // name-start code point and LATIN CAPITAL AND SMALL LETTER U
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_LEFT_SQUARE_BRACKET, // U+005B LEFT SQUARE BRACKET ([)
|
||||
MyCSS_TOKENIZER_STATE_REVERSE_SOLIDUS, // U+005C REVERSE SOLIDUS ()
|
||||
MyCSS_TOKENIZER_STATE_RIGHT_SQUARE_BRACKET, // U+005D RIGHT SQUARE BRACKET (])
|
||||
MyCSS_TOKENIZER_STATE_CIRCUMFLEX_ACCENT, // U+005E CIRCUMFLEX ACCENT (^)
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_LETTER_U, // name-start code point and LATIN CAPITAL AND SMALL LETTER U
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_LEFT_CURLY_BRACKET, // U+007B LEFT CURLY BRACKET ({)
|
||||
MyCSS_TOKENIZER_STATE_VERTICAL_LINE, // U+007C VERTICAL LINE (|)
|
||||
MyCSS_TOKENIZER_STATE_RIGHT_CURLY_BRACKET, // U+007D RIGHT CURLY BRACKET (})
|
||||
MyCSS_TOKENIZER_STATE_TILDE, // U+007E TILDE (~)
|
||||
MyCSS_TOKENIZER_STATE_DELIM_SINGLE_CODE_POINT, //
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT, // name-start code point
|
||||
MyCSS_TOKENIZER_STATE_NAME_START_CODE_POINT // name-start code point
|
||||
};
|
||||
|
||||
static const unsigned char mycss_chars_name_code_point_map[] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0x2d, 0xff, 0xff, 0x30, 0x31,
|
||||
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0x41, 0x42, 0x43, 0x44, 0x45,
|
||||
0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||
0x5a, 0xff, 0xff, 0xff, 0xff, 0x5f, 0xff, 0x61, 0x62, 0x63,
|
||||
0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d,
|
||||
0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x81,
|
||||
0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b,
|
||||
0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
|
||||
0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9,
|
||||
0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
|
||||
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd,
|
||||
0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
|
||||
0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1,
|
||||
0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
|
||||
0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5,
|
||||
0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9,
|
||||
0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
|
||||
};
|
||||
|
||||
static const char mycss_token_type_description[][32] =
|
||||
{
|
||||
"UNDEF",
|
||||
"WHITESPACE",
|
||||
"IDENT",
|
||||
"FUNCTION",
|
||||
"AT_KEYWORD",
|
||||
"HASH",
|
||||
"STRING",
|
||||
"URL",
|
||||
"NUMBER",
|
||||
"DIMENSION",
|
||||
"PERCENTAGE",
|
||||
"INCLUDE_MATCH",
|
||||
"DASH_MATCH",
|
||||
"PREFIX_MATCH",
|
||||
"SUFFIX_MATCH",
|
||||
"SUBSTRING_MATCH",
|
||||
"COLUMN",
|
||||
"CDO",
|
||||
"CDC",
|
||||
"BAD_STRING",
|
||||
"DELIM",
|
||||
"LEFT_PARENTHESIS",
|
||||
"RIGHT_PARENTHESIS",
|
||||
"COMMA",
|
||||
"COLON",
|
||||
"SEMICOLON",
|
||||
"LEFT_SQUARE_BRACKET",
|
||||
"RIGHT_SQUARE_BRACKET",
|
||||
"LEFT_CURLY_BRACKET",
|
||||
"RIGHT_CURLY_BRACKET",
|
||||
"BAD_URL",
|
||||
"COMMENT",
|
||||
"UNICODE_RANGE",
|
||||
"END_OF_FILE",
|
||||
""
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_TOKENIZER_RESOURCE_H */
|
43
include/mycss/values/consume.h
Normal file
43
include/mycss/values/consume.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_VALUES_CONSUME_H
|
||||
#define MyHTML_MyCSS_VALUES_CONSUME_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/entry.h>
|
||||
#include <mycss/values/values.h>
|
||||
#include <mycss/values/units.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
bool mycss_values_consume_length(mycss_entry_t* entry, mycss_token_t* token);
|
||||
bool mycss_values_consume_percentage(mycss_entry_t* entry, mycss_token_t* token);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_VALUES_CONSUME_H */
|
27
include/mycss/values/resources.h
Normal file
27
include/mycss/values/resources.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_VALUES_RESOURCES_H
|
||||
#define MyHTML_MyCSS_VALUES_RESOURCES_H
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
#endif /* MyHTML_MyCSS_VALUES_RESOURCES_H */
|
38
include/mycss/values/serialization.h
Normal file
38
include/mycss/values/serialization.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_VALUES_SERIALIZATION_H
|
||||
#define MyHTML_MyCSS_VALUES_SERIALIZATION_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mycss/values/values.h>
|
||||
|
||||
void mycss_serialization_length(mycss_values_length_t* value, FILE* fh);
|
||||
void mycss_serialization_percentage(mycss_values_percentage_t* value, FILE* fh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_VALUES_SERIALIZATION_H */
|
94
include/mycss/values/units.h
Normal file
94
include/mycss/values/units.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_VALUES_UNITS_H
|
||||
#define MyHTML_MyCSS_VALUES_UNITS_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
|
||||
#define mycss_units_is_angel_type(type) (type >= 1 && type <= 4)
|
||||
#define mycss_units_is_frequency_type(type) (type >= 5 && type <= 6)
|
||||
#define mycss_units_is_length_type(type) (type >= 7 && type <= 24)
|
||||
#define mycss_units_is_length_absolute_type(type) (type >= 7 && type <= 13)
|
||||
#define mycss_units_is_length_relative_type(type) (type >= 14 && type <= 24)
|
||||
#define mycss_units_is_resolution_type(type) (type >= 25 && type <= 27)
|
||||
#define mycss_units_is_time_type(type) (type >= 28 && type <= 29)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum mycss_units_type {
|
||||
MyCSS_UNIT_TYPE_UNDEF = 0x00,
|
||||
MyCSS_UNIT_TYPE_DEG = 0x01,
|
||||
MyCSS_UNIT_TYPE_GRAD = 0x02,
|
||||
MyCSS_UNIT_TYPE_RAD = 0x03,
|
||||
MyCSS_UNIT_TYPE_TURN = 0x04,
|
||||
MyCSS_UNIT_TYPE_HZ = 0x05,
|
||||
MyCSS_UNIT_TYPE_KHZ = 0x06,
|
||||
MyCSS_UNIT_TYPE_CM = 0x07,
|
||||
MyCSS_UNIT_TYPE_IN = 0x08,
|
||||
MyCSS_UNIT_TYPE_MM = 0x09,
|
||||
MyCSS_UNIT_TYPE_PC = 0x0a,
|
||||
MyCSS_UNIT_TYPE_PT = 0x0b,
|
||||
MyCSS_UNIT_TYPE_PX = 0x0c,
|
||||
MyCSS_UNIT_TYPE_Q = 0x0d,
|
||||
MyCSS_UNIT_TYPE_CH = 0x0e,
|
||||
MyCSS_UNIT_TYPE_EM = 0x0f,
|
||||
MyCSS_UNIT_TYPE_EX = 0x10,
|
||||
MyCSS_UNIT_TYPE_IC = 0x11,
|
||||
MyCSS_UNIT_TYPE_REM = 0x12,
|
||||
MyCSS_UNIT_TYPE_VB = 0x13,
|
||||
MyCSS_UNIT_TYPE_VH = 0x14,
|
||||
MyCSS_UNIT_TYPE_VI = 0x15,
|
||||
MyCSS_UNIT_TYPE_VMAX = 0x16,
|
||||
MyCSS_UNIT_TYPE_VMIN = 0x17,
|
||||
MyCSS_UNIT_TYPE_VW = 0x18,
|
||||
MyCSS_UNIT_TYPE_DPCM = 0x19,
|
||||
MyCSS_UNIT_TYPE_DPI = 0x1a,
|
||||
MyCSS_UNIT_TYPE_DPPX = 0x1b,
|
||||
MyCSS_UNIT_TYPE_MS = 0x1c,
|
||||
MyCSS_UNIT_TYPE_S = 0x1d,
|
||||
MyCSS_UNIT_TYPE_LAST_ENTRY = 0x1e,
|
||||
}
|
||||
typedef mycss_units_type_t;
|
||||
|
||||
struct mycss_units_index_static_entry {
|
||||
const char* name;
|
||||
size_t name_length;
|
||||
|
||||
mycss_units_type_t unit_type;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef mycss_units_index_static_entry_t;
|
||||
|
||||
|
||||
mycss_units_type_t mycss_units_type_by_name(const char *name, size_t length);
|
||||
const mycss_units_index_static_entry_t * mycss_units_index_entry_by_name(const char* name, size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_VALUES_UNITS_H */
|
237
include/mycss/values/units_resources.h
Normal file
237
include/mycss/values/units_resources.h
Normal file
@ -0,0 +1,237 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_VALUES_UNITS_RESOURCES_H
|
||||
#define MyHTML_MyCSS_VALUES_UNITS_RESOURCES_H
|
||||
#pragma once
|
||||
|
||||
#define MyCSS_UNITS_STATIC_INDEX_FOR_SEARCH_SIZE 199
|
||||
|
||||
static const char * mycss_units_index_name[31] = {
|
||||
"", "deg", "grad", "rad", "turn", "Hz", "kHz", "cm", "in", "mm", "pc",
|
||||
"pt", "px", "q", "ch", "em", "ex", "ic", "rem", "vb", "vh",
|
||||
"vi", "vmax", "vmin", "vw", "dpcm", "dpi", "dppx", "ms", "s", NULL
|
||||
};
|
||||
|
||||
static const mycss_units_index_static_entry_t mycss_units_index_static_for_search[] =
|
||||
{
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"grad", 4, MyCSS_UNIT_TYPE_GRAD, 0, 8},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"px", 2, MyCSS_UNIT_TYPE_PX, 0, 16},
|
||||
{"in", 2, MyCSS_UNIT_TYPE_IN, 0, 17},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"dpcm", 4, MyCSS_UNIT_TYPE_DPCM, 0, 20},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"vw", 2, MyCSS_UNIT_TYPE_VW, 0, 26},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"q", 1, MyCSS_UNIT_TYPE_Q, 0, 34},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"dppx", 4, MyCSS_UNIT_TYPE_DPPX, 0, 42},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"vb", 2, MyCSS_UNIT_TYPE_VB, 0, 45},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"deg", 3, MyCSS_UNIT_TYPE_DEG, 0, 56},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"dpi", 3, MyCSS_UNIT_TYPE_DPI, 0, 59},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"rem", 3, MyCSS_UNIT_TYPE_REM, 0, 66},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"vh", 2, MyCSS_UNIT_TYPE_VH, 0, 68},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"mm", 2, MyCSS_UNIT_TYPE_MM, 0, 82},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"pc", 2, MyCSS_UNIT_TYPE_PC, 0, 88},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"cm", 2, MyCSS_UNIT_TYPE_CM, 0, 91},
|
||||
{"s", 1, MyCSS_UNIT_TYPE_S, 0, 92},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"ic", 2, MyCSS_UNIT_TYPE_IC, 0, 95},
|
||||
{"ch", 2, MyCSS_UNIT_TYPE_CH, 0, 96},
|
||||
{"turn", 4, MyCSS_UNIT_TYPE_TURN, 0, 97},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"Hz", 2, MyCSS_UNIT_TYPE_HZ, 0, 104},
|
||||
{"vi", 2, MyCSS_UNIT_TYPE_VI, 0, 105},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"pt", 2, MyCSS_UNIT_TYPE_PT, 0, 115},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"vmax", 4, MyCSS_UNIT_TYPE_VMAX, 0, 125},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"em", 2, MyCSS_UNIT_TYPE_EM, 0, 129},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"kHz", 3, MyCSS_UNIT_TYPE_KHZ, 0, 159},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"ex", 2, MyCSS_UNIT_TYPE_EX, 0, 162},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"rad", 3, MyCSS_UNIT_TYPE_RAD, 0, 172},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"vmin", 4, MyCSS_UNIT_TYPE_VMIN, 0, 181},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{"ms", 2, MyCSS_UNIT_TYPE_MS, 0, 196},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyCSS_UNIT_TYPE_UNDEF, 0, 0},
|
||||
};
|
||||
|
||||
#endif /* MyHTML_MyCSS_VALUES_UNITS_RESOURCES_H */
|
65
include/mycss/values/values.h
Normal file
65
include/mycss/values/values.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MyCSS_VALUES_VALUES_H
|
||||
#define MyHTML_MyCSS_VALUES_VALUES_H
|
||||
#pragma once
|
||||
|
||||
#include <mycss/myosi.h>
|
||||
#include <mycss/values/units.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct mycss_values_length {
|
||||
union {
|
||||
int i;
|
||||
float f;
|
||||
};
|
||||
|
||||
bool is_float;
|
||||
mycss_units_type_t type;
|
||||
}
|
||||
typedef mycss_values_length_t;
|
||||
|
||||
struct mycss_values_percentage {
|
||||
union {
|
||||
int i;
|
||||
float f;
|
||||
};
|
||||
|
||||
bool is_float;
|
||||
}
|
||||
typedef mycss_values_percentage_t;
|
||||
|
||||
|
||||
void * mycss_values_create(mycss_entry_t* entry, size_t size);
|
||||
void * mycss_values_destroy(mycss_entry_t* entry, void* value);
|
||||
|
||||
void * mycss_values_entry(mycss_entry_t* entry);
|
||||
void mycss_values_entry_set(mycss_entry_t* entry, void** value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MyCSS_VALUES_VALUES_H */
|
2648
include/myhtml/api.h
Normal file
2648
include/myhtml/api.h
Normal file
File diff suppressed because it is too large
Load Diff
71
include/myhtml/api_encoding.h
Normal file
71
include/myhtml/api_encoding.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_API_ENCODING_H
|
||||
#define MyHTML_API_ENCODING_H
|
||||
#pragma once
|
||||
|
||||
#include <myhtml/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum myhtml_encoding_status {
|
||||
MyHTML_ENCODING_STATUS_OK = 0x00,
|
||||
MyHTML_ENCODING_STATUS_ERROR = 0x01,
|
||||
MyHTML_ENCODING_STATUS_CONTINUE = 0x02,
|
||||
MyHTML_ENCODING_STATUS_DONE = 0x04
|
||||
}
|
||||
typedef myhtml_encoding_status_t;
|
||||
|
||||
struct myhtml_encoding_result {
|
||||
unsigned long first;
|
||||
unsigned long second;
|
||||
unsigned long third;
|
||||
unsigned long result;
|
||||
unsigned long result_aux;
|
||||
unsigned long flag;
|
||||
}
|
||||
typedef myhtml_encoding_result_t;
|
||||
|
||||
typedef myhtml_encoding_status_t
|
||||
(*myhtml_encoding_custom_f)(unsigned const char byte, myhtml_encoding_result_t *res);
|
||||
|
||||
/***********************************************************************************
|
||||
*
|
||||
* MyHTML_ENCODING
|
||||
*
|
||||
***********************************************************************************/
|
||||
|
||||
/**
|
||||
* Clean myhtml_encoding_result_t. Use this function before and after text decode
|
||||
*
|
||||
* @param[in] myhtml_encoding_result_t*
|
||||
*/
|
||||
void
|
||||
myhtml_encoding_result_clean(myhtml_encoding_result_t *res);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* api_encoding_h */
|
47
include/myhtml/callback.h
Normal file
47
include/myhtml/callback.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_CALLBACK_H
|
||||
#define MyHTML_CALLBACK_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/tree.h>
|
||||
|
||||
/* callback functions */
|
||||
myhtml_callback_token_f myhtml_callback_before_token_done(myhtml_tree_t *tree);
|
||||
myhtml_callback_token_f myhtml_callback_after_token_done(myhtml_tree_t *tree);
|
||||
void myhtml_callback_before_token_done_set(myhtml_tree_t *tree, myhtml_callback_token_f func, void* ctx);
|
||||
void myhtml_callback_after_token_done_set(myhtml_tree_t *tree, myhtml_callback_token_f func, void* ctx);
|
||||
|
||||
myhtml_callback_tree_node_f myhtml_callback_tree_node_insert(myhtml_tree_t *tree);
|
||||
myhtml_callback_tree_node_f myhtml_callback_tree_node_remove(myhtml_tree_t *tree);
|
||||
void myhtml_callback_tree_node_insert_set(myhtml_tree_t *tree, myhtml_callback_tree_node_f func, void* ctx);
|
||||
void myhtml_callback_tree_node_remove_set(myhtml_tree_t *tree, myhtml_callback_tree_node_f func, void* ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_CALLBACK_H */
|
56
include/myhtml/charef.h
Normal file
56
include/myhtml/charef.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_CHAREF_H
|
||||
#define MyHTML_CHAREF_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
|
||||
struct charef_entry {
|
||||
unsigned char ch;
|
||||
size_t next;
|
||||
size_t cur_pos;
|
||||
size_t codepoints[2];
|
||||
size_t codepoints_len;
|
||||
}
|
||||
typedef charef_entry_t;
|
||||
|
||||
struct charef_entry_result {
|
||||
const charef_entry_t *curr_entry;
|
||||
const charef_entry_t *last_entry;
|
||||
size_t last_offset;
|
||||
int is_done;
|
||||
}
|
||||
typedef charef_entry_result_t;
|
||||
|
||||
const charef_entry_t * myhtml_charef_find(const char *begin, size_t *offset, size_t size, size_t *data_size);
|
||||
const charef_entry_t * myhtml_charef_find_by_pos(size_t pos, const char *begin, size_t *offset, size_t size, charef_entry_result_t *result);
|
||||
const charef_entry_t * myhtml_charef_get_first_position(const char begin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* charef_h */
|
5957
include/myhtml/charef_resource.h
Normal file
5957
include/myhtml/charef_resource.h
Normal file
File diff suppressed because it is too large
Load Diff
72
include/myhtml/data_process.h
Normal file
72
include/myhtml/data_process.h
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_DATA_PROCESS_H
|
||||
#define MyHTML_DATA_PROCESS_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/charef.h>
|
||||
#include <myhtml/mystring.h>
|
||||
|
||||
struct myhtml_data_process_entry {
|
||||
/* current state for process data */
|
||||
myhtml_data_process_state_f state;
|
||||
|
||||
/* for encodings */
|
||||
myhtml_encoding_t encoding;
|
||||
myhtml_encoding_result_t res;
|
||||
|
||||
/* temp */
|
||||
size_t tmp_str_pos_proc;
|
||||
size_t tmp_str_pos;
|
||||
size_t tmp_num;
|
||||
|
||||
/* < current result */
|
||||
charef_entry_result_t charef_res;
|
||||
|
||||
/* settings */
|
||||
bool is_attributes;
|
||||
bool emit_null_char;
|
||||
};
|
||||
|
||||
void myhtml_data_process_entry_clean(myhtml_data_process_entry_t* proc_entry);
|
||||
|
||||
void myhtml_data_process(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char* data, size_t size);
|
||||
void myhtml_data_process_end(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str);
|
||||
|
||||
size_t myhtml_data_process_state_data(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char* data, size_t offset, size_t size);
|
||||
size_t myhtml_data_process_state_ampersand(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char* data, size_t offset, size_t size);
|
||||
size_t myhtml_data_process_state_ampersand_data(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char* data, size_t offset, size_t size);
|
||||
size_t myhtml_data_process_state_ampersand_hash(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char* data, size_t offset, size_t size);
|
||||
size_t myhtml_data_process_state_ampersand_hash_data(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char *data, size_t offset, size_t size);
|
||||
size_t myhtml_data_process_state_ampersand_hash_x_data(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str, const char* data, size_t offset, size_t size);
|
||||
void myhtml_data_process_state_end(myhtml_data_process_entry_t* proc_entry, myhtml_string_t* str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_DATA_PROCESS_H */
|
||||
|
58
include/myhtml/def.h
Normal file
58
include/myhtml/def.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_def_H
|
||||
#define MyHTML_def_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define myhtml_parser_skip_whitespace() \
|
||||
if(myhtml_whithspace(html[html_offset], ==, ||)) { \
|
||||
while (html_offset < html_size && (myhtml_whithspace(html[html_offset], ==, ||))) { \
|
||||
html_offset++; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define myhtml_parser_queue_set_attr(tree, token_node) \
|
||||
if(token_node->attr_first == NULL) { \
|
||||
token_node->attr_first = myhtml_tree_token_attr_current(tree); \
|
||||
token_node->attr_last = token_node->attr_first; \
|
||||
\
|
||||
tree->attr_current = token_node->attr_last; \
|
||||
tree->attr_current->next = NULL; \
|
||||
tree->attr_current->prev = NULL; \
|
||||
} \
|
||||
else { \
|
||||
token_node->attr_last->next = myhtml_tree_token_attr_current(tree); \
|
||||
token_node->attr_last->next->prev = token_node->attr_last; \
|
||||
token_node->attr_last = token_node->attr_last->next; \
|
||||
\
|
||||
token_node->attr_last->next = NULL; \
|
||||
tree->attr_current = token_node->attr_last; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
146
include/myhtml/encoding.h
Normal file
146
include/myhtml/encoding.h
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_ENCODING_H
|
||||
#define MyHTML_ENCODING_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
|
||||
enum myhtml_encoding_status {
|
||||
MyHTML_ENCODING_STATUS_OK = 0x00,
|
||||
MyHTML_ENCODING_STATUS_ERROR = 0x01,
|
||||
MyHTML_ENCODING_STATUS_CONTINUE = 0x02,
|
||||
MyHTML_ENCODING_STATUS_DONE = 0x04
|
||||
}
|
||||
typedef myhtml_encoding_status_t;
|
||||
|
||||
struct myhtml_encoding_result {
|
||||
unsigned long first;
|
||||
unsigned long second;
|
||||
unsigned long third;
|
||||
unsigned long result;
|
||||
unsigned long result_aux;
|
||||
unsigned long flag;
|
||||
}
|
||||
typedef myhtml_encoding_result_t;
|
||||
|
||||
struct myhtml_encoding_trigram {
|
||||
const unsigned char trigram[3];
|
||||
size_t value;
|
||||
}
|
||||
typedef myhtml_encoding_trigram_t;
|
||||
|
||||
struct myhtml_encoding_trigram_result {
|
||||
size_t count;
|
||||
size_t value;
|
||||
}
|
||||
typedef myhtml_encoding_trigram_result_t;
|
||||
|
||||
struct myhtml_encoding_unicode_result {
|
||||
size_t count_ascii;
|
||||
size_t count_good;
|
||||
size_t count_bad;
|
||||
}
|
||||
typedef myhtml_encoding_unicode_result_t;
|
||||
|
||||
struct myhtml_encoding_detect_name_entry {
|
||||
const char* name;
|
||||
size_t name_length;
|
||||
const char* label;
|
||||
size_t label_length;
|
||||
|
||||
myhtml_encoding_t encoding;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef myhtml_encoding_detect_name_entry_t;
|
||||
|
||||
typedef myhtml_encoding_status_t (*myhtml_encoding_custom_f)(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
|
||||
myhtml_encoding_custom_f myhtml_encoding_get_function_by_id(myhtml_encoding_t idx);
|
||||
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_utf_8(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_ibm866(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_2(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_3(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_4(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_5(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_6(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_7(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_8(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_8_i(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_10(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_13(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_14(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_15(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_8859_16(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_koi8_r(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_koi8_u(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_macintosh(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_874(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1250(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1251(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1252(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1253(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1254(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1255(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1256(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1257(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_windows_1258(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_x_mac_cyrillic(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_gbk(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_gb18030(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_big5(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_euc_jp(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_iso_2022_jp(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_shift_jis(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_euc_kr(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_shared_utf_16(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_utf_16be(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_utf_16le(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
enum myhtml_encoding_status myhtml_encoding_decode_x_user_defined(unsigned const char data, myhtml_encoding_result_t *res);
|
||||
|
||||
size_t myhtml_encoding_codepoint_to_ascii_utf_8(size_t codepoint, char *data);
|
||||
size_t myhtml_encoding_codepoint_to_lowercase_ascii_utf_8(size_t codepoint, char *data);
|
||||
size_t myhtml_encoding_codepoint_to_ascii_utf_16(size_t codepoint, char *data);
|
||||
|
||||
void myhtml_encoding_result_clean(myhtml_encoding_result_t *res);
|
||||
|
||||
bool myhtml_encoding_detect(const char *text, size_t length, myhtml_encoding_t *encoding);
|
||||
bool myhtml_encoding_detect_russian(const char *text, size_t length, myhtml_encoding_t *encoding);
|
||||
bool myhtml_encoding_detect_unicode(const char *text, size_t length, myhtml_encoding_t *encoding);
|
||||
bool myhtml_encoding_detect_bom(const char *text, size_t length, myhtml_encoding_t *encoding);
|
||||
bool myhtml_encoding_detect_and_cut_bom(const char *text, size_t length, myhtml_encoding_t *encoding, const char **new_text, size_t *new_size);
|
||||
|
||||
const myhtml_encoding_detect_name_entry_t * myhtml_encoding_name_entry_by_name(const char* name, size_t length);
|
||||
bool myhtml_encoding_by_name(const char *name, size_t length, myhtml_encoding_t *encoding);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* encoding_h */
|
5580
include/myhtml/encoding_detect_resource.h
Normal file
5580
include/myhtml/encoding_detect_resource.h
Normal file
File diff suppressed because it is too large
Load Diff
9330
include/myhtml/encoding_resource.h
Normal file
9330
include/myhtml/encoding_resource.h
Normal file
File diff suppressed because it is too large
Load Diff
67
include/myhtml/incoming.h
Normal file
67
include/myhtml/incoming.h
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright (C) 2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_INCOMING_H
|
||||
#define MyHTML_INCOMING_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/tree.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
|
||||
struct myhtml_incoming_buffer {
|
||||
const char* data;
|
||||
size_t length; // use of data
|
||||
size_t size; // size of data
|
||||
size_t offset; // begin global offset
|
||||
|
||||
struct myhtml_incoming_buffer* prev;
|
||||
struct myhtml_incoming_buffer* next;
|
||||
};
|
||||
|
||||
|
||||
// incoming buffer
|
||||
myhtml_incoming_buffer_t * myhtml_incomming_buffer_add(myhtml_incoming_buffer_t *current, mcobject_t *mcobject, const char *html, size_t html_size);
|
||||
void myhtml_incomming_buffer_clean(myhtml_incoming_buffer_t *current);
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_find_by_position(myhtml_incoming_buffer_t *inc_buf, size_t begin);
|
||||
|
||||
const char * myhtml_incoming_buffer_data(myhtml_incoming_buffer_t *inc_buf);
|
||||
size_t myhtml_incoming_buffer_length(myhtml_incoming_buffer_t *inc_buf);
|
||||
size_t myhtml_incoming_buffer_size(myhtml_incoming_buffer_t *inc_buf);
|
||||
size_t myhtml_incoming_buffer_offset(myhtml_incoming_buffer_t *inc_buf);
|
||||
size_t myhtml_incoming_buffer_relative_begin(myhtml_incoming_buffer_t *inc_buf, size_t begin);
|
||||
size_t myhtml_incoming_buffer_available_length(myhtml_incoming_buffer_t *inc_buf, size_t relative_begin, size_t length);
|
||||
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_next(myhtml_incoming_buffer_t *inc_buf);
|
||||
myhtml_incoming_buffer_t * myhtml_incoming_buffer_prev(myhtml_incoming_buffer_t *inc_buf);
|
||||
|
||||
size_t myhtml_incoming_buffer_convert_one_escaped_to_code_point(myhtml_incoming_buffer_t **inc_buf, size_t *relative_pos);
|
||||
size_t myhtml_incoming_buffer_escaped_case_cmp(myhtml_incoming_buffer_t **inc_buf, const char *to, size_t to_size, size_t *relative_pos);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_INCOMING_H */
|
238
include/myhtml/myhtml.h
Normal file
238
include/myhtml/myhtml.h
Normal file
@ -0,0 +1,238 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MYHTML_H
|
||||
#define MyHTML_MYHTML_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
|
||||
#include <myhtml/utils/mctree.h>
|
||||
#include <myhtml/utils/mcobject_async.h>
|
||||
#include <myhtml/tree.h>
|
||||
#include <myhtml/tag.h>
|
||||
#include <myhtml/def.h>
|
||||
#include <myhtml/parser.h>
|
||||
#include <myhtml/tokenizer.h>
|
||||
#include <myhtml/thread.h>
|
||||
#include <myhtml/rules.h>
|
||||
#include <myhtml/token.h>
|
||||
#include <myhtml/charef.h>
|
||||
#include <myhtml/encoding.h>
|
||||
#include <myhtml/incoming.h>
|
||||
#include <myhtml/callback.h>
|
||||
|
||||
#define mh_queue_current() tree->queue
|
||||
#define myhtml_tokenizer_state_set(tree) myhtml_tree_set(tree, state)
|
||||
|
||||
#define mh_queue_get(idx, attr) myhtml->queue->nodes[idx].attr
|
||||
|
||||
// space, tab, LF, FF, CR
|
||||
#define myhtml_whithspace(onechar, action, logic) \
|
||||
onechar action ' ' logic \
|
||||
onechar action '\t' logic \
|
||||
onechar action '\n' logic \
|
||||
onechar action '\f' logic \
|
||||
onechar action '\r'
|
||||
|
||||
#define myhtml_ascii_char_cmp(onechar) \
|
||||
((onechar >= 'a' && onechar <= 'z') || \
|
||||
(onechar >= 'A' && onechar <= 'Z'))
|
||||
|
||||
#define myhtml_ascii_char_unless_cmp(onechar) \
|
||||
((onechar < 'a' || onechar > 'z') && \
|
||||
(onechar < 'A' || onechar > 'Z'))
|
||||
|
||||
struct myhtml {
|
||||
mythread_t *thread;
|
||||
//mchar_async_t *mchar; // for all
|
||||
|
||||
myhtml_tokenizer_state_f* parse_state_func;
|
||||
myhtml_insertion_f* insertion_func;
|
||||
|
||||
enum myhtml_options opt;
|
||||
myhtml_tree_node_t *marker;
|
||||
};
|
||||
|
||||
struct myhtml_collection {
|
||||
myhtml_tree_node_t **list;
|
||||
size_t size;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
|
||||
myhtml_t * myhtml_create(void);
|
||||
myhtml_status_t myhtml_init(myhtml_t* myhtml, enum myhtml_options opt, size_t thread_count, size_t queue_size);
|
||||
void myhtml_clean(myhtml_t* myhtml);
|
||||
myhtml_t* myhtml_destroy(myhtml_t* myhtml);
|
||||
|
||||
myhtml_status_t myhtml_parse(myhtml_tree_t* tree, myhtml_encoding_t encoding, const char* html, size_t html_size);
|
||||
myhtml_status_t myhtml_parse_fragment(myhtml_tree_t* tree, myhtml_encoding_t encoding, const char* html, size_t html_size, myhtml_tag_id_t tag_id, enum myhtml_namespace ns);
|
||||
|
||||
myhtml_status_t myhtml_parse_single(myhtml_tree_t* tree, myhtml_encoding_t encoding, const char* html, size_t html_size);
|
||||
myhtml_status_t myhtml_parse_fragment_single(myhtml_tree_t* tree, myhtml_encoding_t encoding, const char* html, size_t html_size, myhtml_tag_id_t tag_id, enum myhtml_namespace ns);
|
||||
|
||||
myhtml_status_t myhtml_parse_chunk(myhtml_tree_t* tree, const char* html, size_t html_size);
|
||||
myhtml_status_t myhtml_parse_chunk_fragment(myhtml_tree_t* tree, const char* html, size_t html_size, myhtml_tag_id_t tag_id, enum myhtml_namespace ns);
|
||||
myhtml_status_t myhtml_parse_chunk_single(myhtml_tree_t* tree, const char* html, size_t html_size);
|
||||
myhtml_status_t myhtml_parse_chunk_fragment_single(myhtml_tree_t* tree, const char* html, size_t html_size, myhtml_tag_id_t tag_id, enum myhtml_namespace ns);
|
||||
myhtml_status_t myhtml_parse_chunk_end(myhtml_tree_t* tree);
|
||||
|
||||
// encoding
|
||||
void myhtml_encoding_set(myhtml_tree_t* tree, myhtml_encoding_t encoding);
|
||||
myhtml_encoding_t myhtml_encoding_get(myhtml_tree_t* tree);
|
||||
|
||||
myhtml_collection_t * myhtml_get_nodes_by_tag_id(myhtml_tree_t* tree, myhtml_collection_t *collection, myhtml_tag_id_t tag_id, myhtml_status_t *status);
|
||||
myhtml_collection_t * myhtml_get_nodes_by_name(myhtml_tree_t* tree, myhtml_collection_t *collection, const char* html, size_t length, myhtml_status_t *status);
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_key(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* scope_node, const char* key, size_t key_len, myhtml_status_t* status);
|
||||
/* like a [some=value] or #id */
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_value(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* node,
|
||||
bool case_insensitive,
|
||||
const char* key, size_t key_len,
|
||||
const char* value, size_t value_len,
|
||||
myhtml_status_t* status);
|
||||
/* like a [some~=value] or .class */
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_value_whitespace_separated(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* node,
|
||||
bool case_insensitive,
|
||||
const char* key, size_t key_len,
|
||||
const char* value, size_t value_len,
|
||||
myhtml_status_t* status);
|
||||
/* like a [some^=value] */
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_value_begin(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* node,
|
||||
bool case_insensitive,
|
||||
const char* key, size_t key_len,
|
||||
const char* value, size_t value_len,
|
||||
myhtml_status_t* status);
|
||||
/* like a [some$=value] */
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_value_end(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* node,
|
||||
bool case_insensitive,
|
||||
const char* key, size_t key_len,
|
||||
const char* value, size_t value_len,
|
||||
myhtml_status_t* status);
|
||||
/* like a [some*=value] */
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_value_contain(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* node,
|
||||
bool case_insensitive,
|
||||
const char* key, size_t key_len,
|
||||
const char* value, size_t value_len,
|
||||
myhtml_status_t* status);
|
||||
/* like a [some|=value] */
|
||||
myhtml_collection_t * myhtml_get_nodes_by_attribute_value_hyphen_separated(myhtml_tree_t *tree, myhtml_collection_t* collection, myhtml_tree_node_t* node,
|
||||
bool case_insensitive,
|
||||
const char* key, size_t key_len,
|
||||
const char* value, size_t value_len,
|
||||
myhtml_status_t* status);
|
||||
|
||||
myhtml_collection_t * myhtml_get_nodes_by_tag_id_in_scope(myhtml_tree_t* tree, myhtml_collection_t *collection, myhtml_tree_node_t *node, myhtml_tag_id_t tag_id, myhtml_status_t *status);
|
||||
myhtml_collection_t * myhtml_get_nodes_by_name_in_scope(myhtml_tree_t* tree, myhtml_collection_t *collection, myhtml_tree_node_t *node, const char* html, size_t length, myhtml_status_t *status);
|
||||
|
||||
myhtml_tree_node_t * myhtml_node_first(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_node_next(myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_prev(myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_parent(myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_child(myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_last_child(myhtml_tree_node_t *node);
|
||||
|
||||
myhtml_tree_node_t * myhtml_node_insert_to_appropriate_place(myhtml_tree_t* tree, myhtml_tree_node_t *target, myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_append_child(myhtml_tree_t* tree, myhtml_tree_node_t *target, myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_insert_after(myhtml_tree_t* tree, myhtml_tree_node_t *target, myhtml_tree_node_t *node);
|
||||
myhtml_tree_node_t * myhtml_node_insert_before(myhtml_tree_t* tree, myhtml_tree_node_t *target, myhtml_tree_node_t *node);
|
||||
|
||||
myhtml_tree_node_t * myhtml_node_create(myhtml_tree_t* tree, myhtml_tag_id_t tag_id, enum myhtml_namespace ns);
|
||||
myhtml_tree_node_t * myhtml_node_remove(myhtml_tree_t* tree, myhtml_tree_node_t *node);
|
||||
void myhtml_node_delete(myhtml_tree_t* tree, myhtml_tree_node_t *node);
|
||||
void myhtml_node_delete_recursive(myhtml_tree_t* tree, myhtml_tree_node_t *node);
|
||||
void myhtml_node_free(myhtml_tree_t* tree, myhtml_tree_node_t *node);
|
||||
|
||||
myhtml_token_node_t* myhtml_node_token(myhtml_tree_node_t *node);
|
||||
myhtml_namespace_t myhtml_node_namespace(myhtml_tree_node_t *node);
|
||||
void myhtml_node_namespace_set(myhtml_tree_node_t *node, myhtml_namespace_t ns);
|
||||
myhtml_tag_id_t myhtml_node_tag_id(myhtml_tree_node_t *node);
|
||||
const char * myhtml_tag_name_by_id(myhtml_tree_t* tree, myhtml_tag_id_t tag_id, size_t *length);
|
||||
myhtml_tag_id_t myhtml_tag_id_by_name(myhtml_tree_t* tree, const char *tag_name, size_t length);
|
||||
bool myhtml_node_is_close_self(myhtml_tree_node_t *node);
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_first(myhtml_tree_node_t *node);
|
||||
myhtml_tree_attr_t * myhtml_node_attribute_last(myhtml_tree_node_t *node);
|
||||
const char * myhtml_node_text(myhtml_tree_node_t *node, size_t *length);
|
||||
myhtml_string_t * myhtml_node_string(myhtml_tree_node_t *node);
|
||||
myhtml_position_t myhtml_node_raw_pasition(myhtml_tree_node_t *node);
|
||||
myhtml_position_t myhtml_node_element_pasition(myhtml_tree_node_t *node);
|
||||
|
||||
/* attributes */
|
||||
myhtml_tree_attr_t * myhtml_attribute_next(myhtml_tree_attr_t *attr);
|
||||
myhtml_tree_attr_t * myhtml_attribute_prev(myhtml_tree_attr_t *attr);
|
||||
enum myhtml_namespace myhtml_attribute_namespace(myhtml_tree_attr_t *attr);
|
||||
void myhtml_attribute_namespace_set(myhtml_tree_attr_t *attr, myhtml_namespace_t ns);
|
||||
|
||||
const char * myhtml_attribute_key(myhtml_tree_attr_t *attr, size_t *length);
|
||||
const char * myhtml_attribute_value(myhtml_tree_attr_t *attr, size_t *length);
|
||||
myhtml_string_t * myhtml_attribute_key_string(myhtml_tree_attr_t* attr);
|
||||
myhtml_string_t * myhtml_attribute_value_string(myhtml_tree_attr_t* attr);
|
||||
myhtml_tree_attr_t * myhtml_attribute_by_key(myhtml_tree_node_t *node, const char *key, size_t key_len);
|
||||
myhtml_tree_attr_t * myhtml_attribute_add(myhtml_tree_t *tree, myhtml_tree_node_t *node, const char *key, size_t key_len, const char *value, size_t value_len, myhtml_encoding_t encoding);
|
||||
myhtml_tree_attr_t * myhtml_attribute_remove(myhtml_tree_node_t *node, myhtml_tree_attr_t *attr);
|
||||
myhtml_tree_attr_t * myhtml_attribute_remove_by_key(myhtml_tree_node_t *node, const char *key, size_t key_len);
|
||||
void myhtml_attribute_delete(myhtml_tree_t *tree, myhtml_tree_node_t *node, myhtml_tree_attr_t *attr);
|
||||
void myhtml_attribute_free(myhtml_tree_t *tree, myhtml_tree_attr_t *attr);
|
||||
myhtml_position_t myhtml_attribute_key_raw_position(myhtml_tree_attr_t *attr);
|
||||
myhtml_position_t myhtml_attribute_value_raw_position(myhtml_tree_attr_t *attr);
|
||||
|
||||
/* collection */
|
||||
myhtml_collection_t * myhtml_collection_create(size_t size, myhtml_status_t *status);
|
||||
void myhtml_collection_clean(myhtml_collection_t *collection);
|
||||
myhtml_collection_t * myhtml_collection_destroy(myhtml_collection_t *collection);
|
||||
myhtml_status_t myhtml_collection_check_size(myhtml_collection_t *collection, size_t need, size_t upto_length);
|
||||
|
||||
// strings
|
||||
myhtml_string_t * myhtml_node_text_set(myhtml_tree_t* tree, myhtml_tree_node_t *node, const char* text, size_t length, myhtml_encoding_t encoding);
|
||||
myhtml_string_t * myhtml_node_text_set_with_charef(myhtml_tree_t* tree, myhtml_tree_node_t *node, const char* text, size_t length, myhtml_encoding_t encoding);
|
||||
|
||||
bool myhtml_utils_strcmp(const char* ab, const char* to_lowercase, size_t size);
|
||||
bool myhtml_is_html_node(myhtml_tree_node_t *node, myhtml_tag_id_t tag_id);
|
||||
|
||||
// queue
|
||||
void myhtml_queue_add(myhtml_tree_t *tree, size_t begin, myhtml_token_node_t* token);
|
||||
|
||||
/**
|
||||
* Platform-specific hdef performance clock queries.
|
||||
* Implemented in perf.c
|
||||
*/
|
||||
|
||||
/** Get clock resolution */
|
||||
uint64_t myhtml_hperf_res(myhtml_status_t *status);
|
||||
|
||||
/** Get current value in clock ticks */
|
||||
uint64_t myhtml_hperf_clock(myhtml_status_t *status);
|
||||
|
||||
/** Print an hperf measure */
|
||||
myhtml_status_t myhtml_hperf_print(const char *name, uint64_t x, uint64_t y, FILE *fh);
|
||||
myhtml_status_t myhtml_hperf_print_by_val(const char *name, uint64_t x, FILE *fh);
|
||||
|
||||
/* version */
|
||||
myhtml_version_t myhtml_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
64
include/myhtml/mynamespace.h
Normal file
64
include/myhtml/mynamespace.h
Normal file
@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MYNAMESPACE_H
|
||||
#define MyHTML_MYNAMESPACE_H
|
||||
#pragma once
|
||||
|
||||
#define MyHTML_NAMESPACE_DETECT_NAME_STATIC_SIZE 19
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
|
||||
struct myhtml_namespace_detect_name_entry {
|
||||
const char* name;
|
||||
size_t name_length;
|
||||
|
||||
myhtml_namespace_t ns;
|
||||
|
||||
size_t next;
|
||||
size_t curr;
|
||||
}
|
||||
typedef myhtml_namespace_detect_name_entry_t;
|
||||
|
||||
struct myhtml_namespace_detect_url_entry {
|
||||
const char* url;
|
||||
size_t url_length;
|
||||
|
||||
myhtml_namespace_t ns;
|
||||
}
|
||||
typedef myhtml_namespace_detect_url_entry_t;
|
||||
|
||||
const char * myhtml_namespace_name_by_id(myhtml_namespace_t ns, size_t *length);
|
||||
bool myhtml_namespace_id_by_name(const char *name, size_t length, myhtml_namespace_t *ns);
|
||||
myhtml_namespace_t myhtml_namespace_id_by_url(const char *url, size_t length);
|
||||
const myhtml_namespace_detect_name_entry_t * myhtml_namespace_name_entry_by_name(const char* name, size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_MYNAMESPACE_H */
|
63
include/myhtml/mynamespace_resource.h
Normal file
63
include/myhtml/mynamespace_resource.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MYNAMESPACE_RESOURCE_H
|
||||
#define MyHTML_MYNAMESPACE_RESOURCE_H
|
||||
#pragma once
|
||||
|
||||
static const myhtml_namespace_detect_name_entry_t myhtml_namespace_detect_name_entry_static_list_index[] =
|
||||
{
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{"SVG", 3, MyHTML_NAMESPACE_SVG, 0, 6},
|
||||
{"XML", 3, MyHTML_NAMESPACE_XML, 0, 7},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{"MATHML", 6, MyHTML_NAMESPACE_MATHML, 0, 10},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{"XMLNS", 5, MyHTML_NAMESPACE_XMLNS, 0, 12},
|
||||
{"HTML", 4, MyHTML_NAMESPACE_HTML, 0, 13},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF, 0, 0},
|
||||
{"XLINK", 5, MyHTML_NAMESPACE_XLINK, 0, 19},
|
||||
};
|
||||
|
||||
static const char myhtml_namespace_resource_names_map[][8] = {
|
||||
"", "HTML", "MathML", "SVG", "XLink", "XML", "XMLNS", "*"
|
||||
};
|
||||
|
||||
static const myhtml_namespace_detect_url_entry_t myhtml_namespace_detect_url_entry_static_list_index[] = {
|
||||
{"http://www.w3.org/1999/xhtml", 28, MyHTML_NAMESPACE_HTML},
|
||||
{"http://www.w3.org/1998/Math/MathML", 34, MyHTML_NAMESPACE_MATHML},
|
||||
{"http://www.w3.org/2000/svg", 26, MyHTML_NAMESPACE_SVG},
|
||||
{"http://www.w3.org/1999/xlink", 28, MyHTML_NAMESPACE_XLINK},
|
||||
{"http://www.w3.org/XML/1998/namespace", 36, MyHTML_NAMESPACE_XML},
|
||||
{"http://www.w3.org/2000/xmlns/", 29, MyHTML_NAMESPACE_XMLNS},
|
||||
{NULL, 0, MyHTML_NAMESPACE_UNDEF}
|
||||
};
|
||||
|
||||
#endif /* MyHTML_MYNAMESPACE_RESOURCE_H */
|
514
include/myhtml/myosi.h
Normal file
514
include/myhtml/myosi.h
Normal file
@ -0,0 +1,514 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MYOSI_H
|
||||
#define MyHTML_MYOSI_H
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define MyHTML_VERSION_MAJOR 1
|
||||
#define MyHTML_VERSION_MINOR 0
|
||||
#define MyHTML_VERSION_PATCH 3
|
||||
|
||||
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WINPTHREADS_VERSION)
|
||||
#define IS_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define MyHTML_DEPRECATED(func, message) __declspec(deprecated(message)) func
|
||||
#elif defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||
# define MyHTML_DEPRECATED(func, message) func __attribute__((deprecated(message)))
|
||||
#else
|
||||
# define MyHTML_DEPRECATED(func, message) func
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Mem */
|
||||
#ifdef MyHTML_EXTERN_MALLOC
|
||||
extern void * MyHTML_EXTERN_MALLOC(size_t size);
|
||||
#define myhtml_malloc MyHTML_EXTERN_MALLOC
|
||||
#else
|
||||
#define myhtml_malloc myhtml_mem_malloc
|
||||
#endif
|
||||
|
||||
#ifdef MyHTML_EXTERN_REALLOC
|
||||
extern void * MyHTML_EXTERN_REALLOC(void* dst, size_t size);
|
||||
#define myhtml_realloc MyHTML_EXTERN_REALLOC
|
||||
#else
|
||||
#define myhtml_realloc myhtml_mem_realloc
|
||||
#endif
|
||||
|
||||
#ifdef MyHTML_EXTERN_CALLOC
|
||||
extern void * MyHTML_EXTERN_CALLOC(size_t num, size_t size);
|
||||
#define myhtml_calloc MyHTML_EXTERN_CALLOC
|
||||
#else
|
||||
#define myhtml_calloc myhtml_mem_calloc
|
||||
#endif
|
||||
|
||||
#ifdef MyHTML_EXTERN_FREE
|
||||
extern void MyHTML_EXTERN_FREE(void* dst);
|
||||
#define myhtml_free MyHTML_EXTERN_FREE
|
||||
#else
|
||||
#define myhtml_free myhtml_mem_free
|
||||
#endif
|
||||
|
||||
/* Debug */
|
||||
#ifdef DEBUG_MODE
|
||||
#define MyHTML_DEBUG(format, ...) \
|
||||
myhtml_print(stderr, "DEBUG: "format"\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define MyHTML_DEBUG(format, ...)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_MODE
|
||||
#define MyHTML_DEBUG_ERROR(format, ...) \
|
||||
myhtml_print(stderr, "DEBUG ERROR: "format"\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define MyHTML_DEBUG_ERROR(format, ...)
|
||||
#endif
|
||||
|
||||
#define myhtml_base_add(myhtml, point, lenn, sizen, strcn, size) \
|
||||
myhtml->Lenn++; \
|
||||
if(myhtml->lenn == myhtml->sizen) { \
|
||||
myhtml->sizen += size; \
|
||||
myhtml->point = (strcn*)myhtml_realloc(myhtml->point, \
|
||||
sizeof(strcn) * myhtml->sizen); \
|
||||
}
|
||||
|
||||
|
||||
// encoding
|
||||
// https://encoding.spec.whatwg.org/#the-encoding
|
||||
// https://encoding.spec.whatwg.org/#legacy-single-byte-encodings
|
||||
// https://encoding.spec.whatwg.org/#legacy-multi-byte-chinese-(simplified)-encodings
|
||||
// https://encoding.spec.whatwg.org/#legacy-multi-byte-chinese-(traditional)-encodings
|
||||
// https://encoding.spec.whatwg.org/#legacy-multi-byte-japanese-encodings
|
||||
// https://encoding.spec.whatwg.org/#legacy-multi-byte-korean-encodings
|
||||
// https://encoding.spec.whatwg.org/#legacy-miscellaneous-encodings
|
||||
|
||||
enum myhtml_encoding_list {
|
||||
MyHTML_ENCODING_DEFAULT = 0x00,
|
||||
// MyHTML_ENCODING_AUTO = 0x01, // future
|
||||
// MyHTML_ENCODING_CUSTOM = 0x02, // future
|
||||
MyHTML_ENCODING_UTF_8 = 0x00, // default encoding
|
||||
MyHTML_ENCODING_UTF_16LE = 0x04,
|
||||
MyHTML_ENCODING_UTF_16BE = 0x05,
|
||||
MyHTML_ENCODING_X_USER_DEFINED = 0x06,
|
||||
MyHTML_ENCODING_BIG5 = 0x07,
|
||||
MyHTML_ENCODING_EUC_KR = 0x08,
|
||||
MyHTML_ENCODING_GB18030 = 0x09,
|
||||
MyHTML_ENCODING_IBM866 = 0x0a,
|
||||
MyHTML_ENCODING_ISO_8859_10 = 0x0b,
|
||||
MyHTML_ENCODING_ISO_8859_13 = 0x0c,
|
||||
MyHTML_ENCODING_ISO_8859_14 = 0x0d,
|
||||
MyHTML_ENCODING_ISO_8859_15 = 0x0e,
|
||||
MyHTML_ENCODING_ISO_8859_16 = 0x0f,
|
||||
MyHTML_ENCODING_ISO_8859_2 = 0x10,
|
||||
MyHTML_ENCODING_ISO_8859_3 = 0x11,
|
||||
MyHTML_ENCODING_ISO_8859_4 = 0x12,
|
||||
MyHTML_ENCODING_ISO_8859_5 = 0x13,
|
||||
MyHTML_ENCODING_ISO_8859_6 = 0x14,
|
||||
MyHTML_ENCODING_ISO_8859_7 = 0x15,
|
||||
MyHTML_ENCODING_ISO_8859_8 = 0x16,
|
||||
MyHTML_ENCODING_KOI8_R = 0x17,
|
||||
MyHTML_ENCODING_KOI8_U = 0x18,
|
||||
MyHTML_ENCODING_MACINTOSH = 0x19,
|
||||
MyHTML_ENCODING_WINDOWS_1250 = 0x1a,
|
||||
MyHTML_ENCODING_WINDOWS_1251 = 0x1b,
|
||||
MyHTML_ENCODING_WINDOWS_1252 = 0x1c,
|
||||
MyHTML_ENCODING_WINDOWS_1253 = 0x1d,
|
||||
MyHTML_ENCODING_WINDOWS_1254 = 0x1e,
|
||||
MyHTML_ENCODING_WINDOWS_1255 = 0x1f,
|
||||
MyHTML_ENCODING_WINDOWS_1256 = 0x20,
|
||||
MyHTML_ENCODING_WINDOWS_1257 = 0x21,
|
||||
MyHTML_ENCODING_WINDOWS_1258 = 0x22,
|
||||
MyHTML_ENCODING_WINDOWS_874 = 0x23,
|
||||
MyHTML_ENCODING_X_MAC_CYRILLIC = 0x24,
|
||||
MyHTML_ENCODING_ISO_2022_JP = 0x25,
|
||||
MyHTML_ENCODING_GBK = 0x26,
|
||||
MyHTML_ENCODING_SHIFT_JIS = 0x27,
|
||||
MyHTML_ENCODING_EUC_JP = 0x28,
|
||||
MyHTML_ENCODING_ISO_8859_8_I = 0x29,
|
||||
MyHTML_ENCODING_LAST_ENTRY = 0x2a
|
||||
}
|
||||
typedef myhtml_encoding_t;
|
||||
|
||||
// char references
|
||||
typedef struct myhtml_data_process_entry myhtml_data_process_entry_t;
|
||||
|
||||
// strings
|
||||
typedef struct myhtml_string myhtml_string_t;
|
||||
|
||||
// thread
|
||||
enum mythread_thread_opt {
|
||||
MyTHREAD_OPT_UNDEF = 0x00,
|
||||
MyTHREAD_OPT_WAIT = 0x01,
|
||||
MyTHREAD_OPT_QUIT = 0x02,
|
||||
MyTHREAD_OPT_STOP = 0x04
|
||||
}
|
||||
typedef mythread_thread_opt_t;
|
||||
|
||||
typedef struct mythread_queue_list_entry mythread_queue_list_entry_t;
|
||||
typedef struct mythread_queue_thread_param mythread_queue_thread_param_t;
|
||||
typedef struct mythread_queue_list mythread_queue_list_t;
|
||||
typedef struct mythread_queue_node mythread_queue_node_t;
|
||||
typedef struct mythread_queue mythread_queue_t;
|
||||
|
||||
typedef size_t mythread_id_t;
|
||||
typedef struct mythread_workers_list mythread_workers_list_t;
|
||||
typedef struct mythread_context mythread_context_t;
|
||||
typedef struct mythread_list mythread_list_t;
|
||||
typedef struct mythread mythread_t;
|
||||
|
||||
// tree
|
||||
enum myhtml_tree_flags {
|
||||
MyHTML_TREE_FLAGS_CLEAN = 0x000,
|
||||
MyHTML_TREE_FLAGS_SCRIPT = 0x001,
|
||||
MyHTML_TREE_FLAGS_FRAMESET_OK = 0x002,
|
||||
MyHTML_TREE_FLAGS_IFRAME_SRCDOC = 0x004,
|
||||
MyHTML_TREE_FLAGS_ALREADY_STARTED = 0x008,
|
||||
MyHTML_TREE_FLAGS_SINGLE_MODE = 0x010,
|
||||
MyHTML_TREE_FLAGS_PARSE_END = 0x020,
|
||||
MyHTML_TREE_FLAGS_PARSE_FLAG = 0x040,
|
||||
MyHTML_TREE_FLAGS_PARSE_FLAG_EMIT_NEWLINE = 0x080
|
||||
};
|
||||
|
||||
enum myhtml_tree_parse_flags {
|
||||
MyHTML_TREE_PARSE_FLAGS_CLEAN = 0x000,
|
||||
MyHTML_TREE_PARSE_FLAGS_WITHOUT_BUILD_TREE = 0x001,
|
||||
MyHTML_TREE_PARSE_FLAGS_WITHOUT_PROCESS_TOKEN = 0x003,
|
||||
MyHTML_TREE_PARSE_FLAGS_SKIP_WHITESPACE_TOKEN = 0x004,
|
||||
MyHTML_TREE_PARSE_FLAGS_WITHOUT_DOCTYPE_IN_TREE = 0x008,
|
||||
}
|
||||
typedef myhtml_tree_parse_flags_t;
|
||||
|
||||
typedef struct myhtml_tree_temp_tag_name myhtml_tree_temp_tag_name_t;
|
||||
typedef struct myhtml_tree_insertion_list myhtml_tree_insertion_list_t;
|
||||
typedef struct myhtml_tree_token_list myhtml_tree_token_list_t;
|
||||
typedef struct myhtml_tree_list myhtml_tree_list_t;
|
||||
typedef struct myhtml_tree_indexes myhtml_tree_indexes_t;
|
||||
typedef struct myhtml_tree_doctype myhtml_tree_doctype_t;
|
||||
typedef struct myhtml_async_args myhtml_async_args_t;
|
||||
|
||||
typedef struct myhtml_tree_node myhtml_tree_node_t;
|
||||
typedef struct myhtml_tree myhtml_tree_t;
|
||||
|
||||
// token
|
||||
enum myhtml_token_type {
|
||||
MyHTML_TOKEN_TYPE_OPEN = 0x000,
|
||||
MyHTML_TOKEN_TYPE_CLOSE = 0x001,
|
||||
MyHTML_TOKEN_TYPE_CLOSE_SELF = 0x002,
|
||||
MyHTML_TOKEN_TYPE_DONE = 0x004,
|
||||
MyHTML_TOKEN_TYPE_WHITESPACE = 0x008,
|
||||
MyHTML_TOKEN_TYPE_RCDATA = 0x010,
|
||||
MyHTML_TOKEN_TYPE_RAWTEXT = 0x020,
|
||||
MyHTML_TOKEN_TYPE_SCRIPT = 0x040,
|
||||
MyHTML_TOKEN_TYPE_PLAINTEXT = 0x080,
|
||||
MyHTML_TOKEN_TYPE_CDATA = 0x100,
|
||||
MyHTML_TOKEN_TYPE_DATA = 0x200,
|
||||
MyHTML_TOKEN_TYPE_COMMENT = 0x400,
|
||||
MyHTML_TOKEN_TYPE_NULL = 0x800
|
||||
};
|
||||
|
||||
typedef size_t myhtml_token_index_t;
|
||||
typedef size_t myhtml_token_attr_index_t;
|
||||
typedef struct myhtml_token_replacement_entry myhtml_token_replacement_entry_t;
|
||||
typedef struct myhtml_token_namespace_replacement myhtml_token_namespace_replacement_t;
|
||||
|
||||
typedef struct myhtml_token_attr myhtml_token_attr_t;
|
||||
typedef struct myhtml_token_node myhtml_token_node_t;
|
||||
typedef struct myhtml_token myhtml_token_t;
|
||||
|
||||
// tags
|
||||
enum myhtml_tag_categories {
|
||||
MyHTML_TAG_CATEGORIES_UNDEF = 0x000,
|
||||
MyHTML_TAG_CATEGORIES_ORDINARY = 0x001,
|
||||
MyHTML_TAG_CATEGORIES_SPECIAL = 0x002,
|
||||
MyHTML_TAG_CATEGORIES_FORMATTING = 0x004,
|
||||
MyHTML_TAG_CATEGORIES_SCOPE = 0x008,
|
||||
MyHTML_TAG_CATEGORIES_SCOPE_LIST_ITEM = 0x010,
|
||||
MyHTML_TAG_CATEGORIES_SCOPE_BUTTON = 0x020,
|
||||
MyHTML_TAG_CATEGORIES_SCOPE_TABLE = 0x040,
|
||||
MyHTML_TAG_CATEGORIES_SCOPE_SELECT = 0x080
|
||||
};
|
||||
|
||||
typedef struct myhtml_tag_index_node myhtml_tag_index_node_t;
|
||||
typedef struct myhtml_tag_index_entry myhtml_tag_index_entry_t;
|
||||
typedef struct myhtml_tag_index myhtml_tag_index_t;
|
||||
|
||||
typedef size_t myhtml_tag_id_t;
|
||||
|
||||
typedef struct myhtml_tag myhtml_tag_t;
|
||||
|
||||
// stream
|
||||
typedef struct myhtml_stream_buffer_entry myhtml_stream_buffer_entry_t;
|
||||
typedef struct myhtml_stream_buffer myhtml_stream_buffer_t;
|
||||
|
||||
// parse
|
||||
enum myhtml_tokenizer_state {
|
||||
MyHTML_TOKENIZER_STATE_DATA = 0x000,
|
||||
MyHTML_TOKENIZER_STATE_CHARACTER_REFERENCE_IN_DATA = 0x001,
|
||||
MyHTML_TOKENIZER_STATE_RCDATA = 0x002,
|
||||
MyHTML_TOKENIZER_STATE_CHARACTER_REFERENCE_IN_RCDATA = 0x003,
|
||||
MyHTML_TOKENIZER_STATE_RAWTEXT = 0x004,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA = 0x005,
|
||||
MyHTML_TOKENIZER_STATE_PLAINTEXT = 0x006,
|
||||
MyHTML_TOKENIZER_STATE_TAG_OPEN = 0x007,
|
||||
MyHTML_TOKENIZER_STATE_END_TAG_OPEN = 0x008,
|
||||
MyHTML_TOKENIZER_STATE_TAG_NAME = 0x009,
|
||||
MyHTML_TOKENIZER_STATE_RCDATA_LESS_THAN_SIGN = 0x00a,
|
||||
MyHTML_TOKENIZER_STATE_RCDATA_END_TAG_OPEN = 0x00b,
|
||||
MyHTML_TOKENIZER_STATE_RCDATA_END_TAG_NAME = 0x00c,
|
||||
MyHTML_TOKENIZER_STATE_RAWTEXT_LESS_THAN_SIGN = 0x00d,
|
||||
MyHTML_TOKENIZER_STATE_RAWTEXT_END_TAG_OPEN = 0x00e,
|
||||
MyHTML_TOKENIZER_STATE_RAWTEXT_END_TAG_NAME = 0x00f,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_LESS_THAN_SIGN = 0x010,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_END_TAG_OPEN = 0x011,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_END_TAG_NAME = 0x012,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPE_START = 0x013,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPE_START_DASH = 0x014,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED = 0x015,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_DASH = 0x016,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_DASH_DASH = 0x017,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN = 0x018,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_END_TAG_OPEN = 0x019,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_END_TAG_NAME = 0x01a,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPE_START = 0x01b,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED = 0x01c,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_DASH = 0x01d,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH = 0x01e,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN = 0x01f,
|
||||
MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPE_END = 0x020,
|
||||
MyHTML_TOKENIZER_STATE_BEFORE_ATTRIBUTE_NAME = 0x021,
|
||||
MyHTML_TOKENIZER_STATE_ATTRIBUTE_NAME = 0x022,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_ATTRIBUTE_NAME = 0x023,
|
||||
MyHTML_TOKENIZER_STATE_BEFORE_ATTRIBUTE_VALUE = 0x024,
|
||||
MyHTML_TOKENIZER_STATE_ATTRIBUTE_VALUE_DOUBLE_QUOTED = 0x025,
|
||||
MyHTML_TOKENIZER_STATE_ATTRIBUTE_VALUE_SINGLE_QUOTED = 0x026,
|
||||
MyHTML_TOKENIZER_STATE_ATTRIBUTE_VALUE_UNQUOTED = 0x027,
|
||||
MyHTML_TOKENIZER_STATE_CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE = 0x028,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_ATTRIBUTE_VALUE__QUOTED = 0x029,
|
||||
MyHTML_TOKENIZER_STATE_SELF_CLOSING_START_TAG = 0x02a,
|
||||
MyHTML_TOKENIZER_STATE_BOGUS_COMMENT = 0x02b,
|
||||
MyHTML_TOKENIZER_STATE_MARKUP_DECLARATION_OPEN = 0x02c,
|
||||
MyHTML_TOKENIZER_STATE_COMMENT_START = 0x02d,
|
||||
MyHTML_TOKENIZER_STATE_COMMENT_START_DASH = 0x02e,
|
||||
MyHTML_TOKENIZER_STATE_COMMENT = 0x02f,
|
||||
MyHTML_TOKENIZER_STATE_COMMENT_END_DASH = 0x030,
|
||||
MyHTML_TOKENIZER_STATE_COMMENT_END = 0x031,
|
||||
MyHTML_TOKENIZER_STATE_COMMENT_END_BANG = 0x032,
|
||||
MyHTML_TOKENIZER_STATE_DOCTYPE = 0x033,
|
||||
MyHTML_TOKENIZER_STATE_BEFORE_DOCTYPE_NAME = 0x034,
|
||||
MyHTML_TOKENIZER_STATE_DOCTYPE_NAME = 0x035,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_DOCTYPE_NAME = 0x036,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_DOCTYPE_PUBLIC_KEYWORD = 0x037,
|
||||
MyHTML_TOKENIZER_STATE_BEFORE_DOCTYPE_PUBLIC_IDENTIFIER = 0x038,
|
||||
MyHTML_TOKENIZER_STATE_DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED = 0x039,
|
||||
MyHTML_TOKENIZER_STATE_DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED = 0x03a,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_DOCTYPE_PUBLIC_IDENTIFIER = 0x03b,
|
||||
MyHTML_TOKENIZER_STATE_BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS = 0x03c,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_DOCTYPE_SYSTEM_KEYWORD = 0x03d,
|
||||
MyHTML_TOKENIZER_STATE_BEFORE_DOCTYPE_SYSTEM_IDENTIFIER = 0x03e,
|
||||
MyHTML_TOKENIZER_STATE_DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED = 0x03f,
|
||||
MyHTML_TOKENIZER_STATE_DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED = 0x040,
|
||||
MyHTML_TOKENIZER_STATE_AFTER_DOCTYPE_SYSTEM_IDENTIFIER = 0x041,
|
||||
MyHTML_TOKENIZER_STATE_BOGUS_DOCTYPE = 0x042,
|
||||
MyHTML_TOKENIZER_STATE_CDATA_SECTION = 0x043,
|
||||
MyHTML_TOKENIZER_STATE_CUSTOM_AFTER_DOCTYPE_NAME_A_Z = 0x044,
|
||||
MyHTML_TOKENIZER_STATE_FIRST_ENTRY = MyHTML_TOKENIZER_STATE_DATA,
|
||||
MyHTML_TOKENIZER_STATE_LAST_ENTRY = 0x045
|
||||
};
|
||||
|
||||
enum myhtml_insertion_mode {
|
||||
MyHTML_INSERTION_MODE_INITIAL = 0x000,
|
||||
MyHTML_INSERTION_MODE_BEFORE_HTML = 0x001,
|
||||
MyHTML_INSERTION_MODE_BEFORE_HEAD = 0x002,
|
||||
MyHTML_INSERTION_MODE_IN_HEAD = 0x003,
|
||||
MyHTML_INSERTION_MODE_IN_HEAD_NOSCRIPT = 0x004,
|
||||
MyHTML_INSERTION_MODE_AFTER_HEAD = 0x005,
|
||||
MyHTML_INSERTION_MODE_IN_BODY = 0x006,
|
||||
MyHTML_INSERTION_MODE_TEXT = 0x007,
|
||||
MyHTML_INSERTION_MODE_IN_TABLE = 0x008,
|
||||
MyHTML_INSERTION_MODE_IN_TABLE_TEXT = 0x009,
|
||||
MyHTML_INSERTION_MODE_IN_CAPTION = 0x00a,
|
||||
MyHTML_INSERTION_MODE_IN_COLUMN_GROUP = 0x00b,
|
||||
MyHTML_INSERTION_MODE_IN_TABLE_BODY = 0x00c,
|
||||
MyHTML_INSERTION_MODE_IN_ROW = 0x00d,
|
||||
MyHTML_INSERTION_MODE_IN_CELL = 0x00e,
|
||||
MyHTML_INSERTION_MODE_IN_SELECT = 0x00f,
|
||||
MyHTML_INSERTION_MODE_IN_SELECT_IN_TABLE = 0x010,
|
||||
MyHTML_INSERTION_MODE_IN_TEMPLATE = 0x011,
|
||||
MyHTML_INSERTION_MODE_AFTER_BODY = 0x012,
|
||||
MyHTML_INSERTION_MODE_IN_FRAMESET = 0x013,
|
||||
MyHTML_INSERTION_MODE_AFTER_FRAMESET = 0x014,
|
||||
MyHTML_INSERTION_MODE_AFTER_AFTER_BODY = 0x015,
|
||||
MyHTML_INSERTION_MODE_AFTER_AFTER_FRAMESET = 0x016,
|
||||
MyHTML_INSERTION_MODE_LAST_ENTRY = 0x017
|
||||
};
|
||||
|
||||
// base
|
||||
/*
|
||||
Very important!!!
|
||||
|
||||
for myhtml 0..00ffff; MyHTML_STATUS_OK == 0x000000
|
||||
for mycss and modules 010000..01ffff; MyCSS_STATUS_OK == 0x000000
|
||||
for modest 020000..02ffff; MODEST_STATUS_OK == 0x000000
|
||||
for myrender 030000..03ffff; MyRENDER_STATUS_OK == 0x000000
|
||||
for mydom 040000..04ffff; MyDOM_STATUS_OK == 0x000000
|
||||
for mynetwork 050000..05ffff; MyNETWORK_STATUS_OK == 0x000000
|
||||
for myecma 060000..06ffff; MyECMA_STATUS_OK == 0x000000
|
||||
not occupied 070000..
|
||||
*/
|
||||
enum myhtml_status {
|
||||
MyHTML_STATUS_OK = 0x0000,
|
||||
MyHTML_STATUS_ERROR_MEMORY_ALLOCATION = 0x0001,
|
||||
MyHTML_STATUS_THREAD_ERROR_MEMORY_ALLOCATION = 0x0009,
|
||||
MyHTML_STATUS_THREAD_ERROR_LIST_INIT = 0x000a,
|
||||
MyHTML_STATUS_THREAD_ERROR_ATTR_MALLOC = 0x000b,
|
||||
MyHTML_STATUS_THREAD_ERROR_ATTR_INIT = 0x000c,
|
||||
MyHTML_STATUS_THREAD_ERROR_ATTR_SET = 0x000d,
|
||||
MyHTML_STATUS_THREAD_ERROR_ATTR_DESTROY = 0x000e,
|
||||
MyHTML_STATUS_THREAD_ERROR_NO_SLOTS = 0x000f,
|
||||
MyHTML_STATUS_THREAD_ERROR_BATCH_INIT = 0x0010,
|
||||
MyHTML_STATUS_THREAD_ERROR_WORKER_MALLOC = 0x0011,
|
||||
MyHTML_STATUS_THREAD_ERROR_WORKER_SEM_CREATE = 0x0012,
|
||||
MyHTML_STATUS_THREAD_ERROR_WORKER_THREAD_CREATE = 0x0013,
|
||||
MyHTML_STATUS_THREAD_ERROR_MASTER_THREAD_CREATE = 0x0014,
|
||||
MyHTML_STATUS_THREAD_ERROR_SEM_PREFIX_MALLOC = 0x0032,
|
||||
MyHTML_STATUS_THREAD_ERROR_SEM_CREATE = 0x0033,
|
||||
MyHTML_STATUS_THREAD_ERROR_QUEUE_MALLOC = 0x003c,
|
||||
MyHTML_STATUS_THREAD_ERROR_QUEUE_NODES_MALLOC = 0x003d,
|
||||
MyHTML_STATUS_THREAD_ERROR_QUEUE_NODE_MALLOC = 0x003e,
|
||||
MyHTML_STATUS_THREAD_ERROR_MUTEX_MALLOC = 0x0046,
|
||||
MyHTML_STATUS_THREAD_ERROR_MUTEX_INIT = 0x0047,
|
||||
MyHTML_STATUS_THREAD_ERROR_MUTEX_LOCK = 0x0048,
|
||||
MyHTML_STATUS_THREAD_ERROR_MUTEX_UNLOCK = 0x0049,
|
||||
MyHTML_STATUS_RULES_ERROR_MEMORY_ALLOCATION = 0x0064,
|
||||
MyHTML_STATUS_PERF_ERROR_COMPILED_WITHOUT_PERF = 0x00c8,
|
||||
MyHTML_STATUS_PERF_ERROR_FIND_CPU_CLOCK = 0x00c9,
|
||||
MyHTML_STATUS_TOKENIZER_ERROR_MEMORY_ALLOCATION = 0x012c,
|
||||
MyHTML_STATUS_TOKENIZER_ERROR_FRAGMENT_INIT = 0x012d,
|
||||
MyHTML_STATUS_TAGS_ERROR_MEMORY_ALLOCATION = 0x0190,
|
||||
MyHTML_STATUS_TAGS_ERROR_MCOBJECT_CREATE = 0x0191,
|
||||
MyHTML_STATUS_TAGS_ERROR_MCOBJECT_MALLOC = 0x0192,
|
||||
MyHTML_STATUS_TAGS_ERROR_MCOBJECT_CREATE_NODE = 0x0193,
|
||||
MyHTML_STATUS_TAGS_ERROR_CACHE_MEMORY_ALLOCATION = 0x0194,
|
||||
MyHTML_STATUS_TAGS_ERROR_INDEX_MEMORY_ALLOCATION = 0x0195,
|
||||
MyHTML_STATUS_TREE_ERROR_MEMORY_ALLOCATION = 0x01f4,
|
||||
MyHTML_STATUS_TREE_ERROR_MCOBJECT_CREATE = 0x01f5,
|
||||
MyHTML_STATUS_TREE_ERROR_MCOBJECT_INIT = 0x01f6,
|
||||
MyHTML_STATUS_TREE_ERROR_MCOBJECT_CREATE_NODE = 0x01f7,
|
||||
MyHTML_STATUS_TREE_ERROR_INCOMING_BUFFER_CREATE = 0x01f8,
|
||||
MyHTML_STATUS_ATTR_ERROR_ALLOCATION = 0x0258,
|
||||
MyHTML_STATUS_ATTR_ERROR_CREATE = 0x0259,
|
||||
MyHTML_STATUS_STREAM_BUFFER_ERROR_CREATE = 0x0300,
|
||||
MyHTML_STATUS_STREAM_BUFFER_ERROR_INIT = 0x0301,
|
||||
MyHTML_STATUS_STREAM_BUFFER_ENTRY_ERROR_CREATE = 0x0302,
|
||||
MyHTML_STATUS_STREAM_BUFFER_ENTRY_ERROR_INIT = 0x0303,
|
||||
MyHTML_STATUS_STREAM_BUFFER_ERROR_ADD_ENTRY = 0x0304,
|
||||
MyHTML_STATUS_MCOBJECT_ERROR_CACHE_CREATE = 0x0340,
|
||||
MyHTML_STATUS_MCOBJECT_ERROR_CHUNK_CREATE = 0x0341,
|
||||
MyHTML_STATUS_MCOBJECT_ERROR_CHUNK_INIT = 0x0342,
|
||||
MyHTML_STATUS_MCOBJECT_ERROR_CACHE_REALLOC = 0x0343
|
||||
}
|
||||
typedef myhtml_status_t;
|
||||
|
||||
enum myhtml_namespace {
|
||||
MyHTML_NAMESPACE_UNDEF = 0x00,
|
||||
MyHTML_NAMESPACE_HTML = 0x01,
|
||||
MyHTML_NAMESPACE_MATHML = 0x02,
|
||||
MyHTML_NAMESPACE_SVG = 0x03,
|
||||
MyHTML_NAMESPACE_XLINK = 0x04,
|
||||
MyHTML_NAMESPACE_XML = 0x05,
|
||||
MyHTML_NAMESPACE_XMLNS = 0x06,
|
||||
|
||||
/* MyHTML_NAMESPACE_ANY == MyHTML_NAMESPACE_LAST_ENTRY */
|
||||
MyHTML_NAMESPACE_ANY = 0x07,
|
||||
MyHTML_NAMESPACE_LAST_ENTRY = 0x07
|
||||
}
|
||||
typedef myhtml_namespace_t;
|
||||
|
||||
enum myhtml_options {
|
||||
MyHTML_OPTIONS_DEFAULT = 0x00,
|
||||
MyHTML_OPTIONS_PARSE_MODE_SINGLE = 0x01,
|
||||
MyHTML_OPTIONS_PARSE_MODE_ALL_IN_ONE = 0x02,
|
||||
MyHTML_OPTIONS_PARSE_MODE_SEPARATELY = 0x04
|
||||
};
|
||||
|
||||
struct myhtml_position {
|
||||
size_t begin;
|
||||
size_t length;
|
||||
}
|
||||
typedef myhtml_position_t;
|
||||
|
||||
struct myhtml_version {
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
}
|
||||
typedef myhtml_version_t;
|
||||
|
||||
typedef struct myhtml_incoming_buffer myhtml_incoming_buffer_t;
|
||||
typedef myhtml_token_attr_t myhtml_tree_attr_t;
|
||||
typedef struct myhtml_collection myhtml_collection_t;
|
||||
typedef struct myhtml myhtml_t;
|
||||
|
||||
// parser state function
|
||||
typedef size_t (*myhtml_tokenizer_state_f)(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
// parser stream function
|
||||
typedef void (*mythread_f)(mythread_id_t thread_id, mythread_queue_node_t *qnode);
|
||||
|
||||
// parser insertion mode function
|
||||
typedef bool (*myhtml_insertion_f)(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
|
||||
// char references state
|
||||
typedef size_t (*myhtml_data_process_state_f)(myhtml_data_process_entry_t* charef, myhtml_string_t* str, const char* data, size_t offset, size_t size);
|
||||
|
||||
// callback functions
|
||||
typedef void* (*myhtml_callback_token_f)(myhtml_tree_t* tree, myhtml_token_node_t* token, void* ctx);
|
||||
typedef void (*myhtml_callback_tree_node_f)(myhtml_tree_t* tree, myhtml_tree_node_t* node, void* ctx);
|
||||
|
||||
// find attribute value functions
|
||||
typedef bool (*myhtml_attribute_value_find_f)(myhtml_string_t* str_key, const char* value, size_t value_len);
|
||||
|
||||
|
||||
void * myhtml_mem_malloc(size_t size);
|
||||
void * myhtml_mem_realloc(void* dst, size_t size);
|
||||
void * myhtml_mem_calloc(size_t num, size_t size);
|
||||
void myhtml_mem_free(void* dst);
|
||||
|
||||
void myhtml_print(FILE* out, const char* format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
146
include/myhtml/mystring.h
Normal file
146
include/myhtml/mystring.h
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_MYSTRING_H
|
||||
#define MyHTML_MYSTRING_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/encoding.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
|
||||
#define myhtml_string_get(str, attr) str->attr
|
||||
#define myhtml_string_set(str, attr) myhtml_string_get(str, attr)
|
||||
#define myhtml_string_len(str) myhtml_string_get(str, length)
|
||||
|
||||
#define MyHTML_STRING_PREPROCESSOR_CHECK_BUFFER_SIZE(str, unsigned_data) \
|
||||
if(str->length >= str->size) { \
|
||||
myhtml_string_realloc(str, (str->length + 5)); \
|
||||
\
|
||||
unsigned_data = (unsigned char*)str->data; \
|
||||
}
|
||||
|
||||
#define MyHTML_STRING_REALLOC_IF_NEED(str, need_length, upto) \
|
||||
if((str->length + need_length) >= str->size) { \
|
||||
myhtml_string_realloc(str, (str->length + need_length + upto)); \
|
||||
} \
|
||||
|
||||
#define MyHTML_STRING_APPEND_BYTE_WITHOUT_REALLOC(onechar, str) \
|
||||
str->data[str->length] = onechar; \
|
||||
str->length++
|
||||
|
||||
#define MyHTML_STRING_APPEND_BYTE_WITHOUT_INCREMENT(onechar, str, upto) \
|
||||
if(str->length >= str->size) { \
|
||||
myhtml_string_realloc(str, (str->length + upto)); \
|
||||
} \
|
||||
str->data[str->length] = onechar
|
||||
|
||||
#define MyHTML_STRING_APPEND_BYTE_WITHOUT_INCREMENT_REALLOC(onechar, str) \
|
||||
str->data[str->length] = onechar
|
||||
|
||||
#define MyHTML_STRING_APPEND_BYTE(onechar, str, upto) \
|
||||
MyHTML_STRING_APPEND_BYTE_WITHOUT_INCREMENT(onechar, str, upto); \
|
||||
str->length++
|
||||
|
||||
#define myhtml_mystring_whitespace(onechar, action, logic) \
|
||||
(onechar action ' ' logic \
|
||||
onechar action '\t' logic \
|
||||
onechar action '\n' logic \
|
||||
onechar action '\f' logic \
|
||||
onechar action '\r')
|
||||
|
||||
struct myhtml_string {
|
||||
char* data;
|
||||
size_t size;
|
||||
size_t length;
|
||||
|
||||
mchar_async_t *mchar;
|
||||
size_t node_idx;
|
||||
};
|
||||
|
||||
typedef size_t myhtml_string_index_t;
|
||||
|
||||
char * myhtml_string_init(mchar_async_t *mchar, size_t node_idx, myhtml_string_t* str, size_t size);
|
||||
char * myhtml_string_realloc(myhtml_string_t *str, size_t new_size);
|
||||
|
||||
void myhtml_string_clean(myhtml_string_t* str);
|
||||
void myhtml_string_clean_all(myhtml_string_t* str);
|
||||
myhtml_string_t * myhtml_string_destroy(myhtml_string_t* str, bool destroy_obj);
|
||||
|
||||
/* basic api */
|
||||
char * myhtml_string_data_alloc(mchar_async_t *mchar, size_t node_id, size_t size);
|
||||
char * myhtml_string_data_realloc(mchar_async_t *mchar, size_t node_id, char *data, size_t len_to_copy, size_t size);
|
||||
void myhtml_string_data_free(mchar_async_t *mchar, size_t node_id, char *data);
|
||||
|
||||
char * myhtml_string_data(myhtml_string_t *str);
|
||||
size_t myhtml_string_length(myhtml_string_t *str);
|
||||
size_t myhtml_string_size(myhtml_string_t *str);
|
||||
char * myhtml_string_data_set(myhtml_string_t *str, char *data);
|
||||
size_t myhtml_string_size_set(myhtml_string_t *str, size_t size);
|
||||
size_t myhtml_string_length_set(myhtml_string_t *str, size_t length);
|
||||
|
||||
/* append */
|
||||
void myhtml_string_append(myhtml_string_t* str, const char* data, size_t length);
|
||||
void myhtml_string_append_one(myhtml_string_t* str, const char data);
|
||||
void myhtml_string_append_lowercase(myhtml_string_t* str, const char* data, size_t length);
|
||||
void myhtml_string_append_with_convert_encoding(myhtml_string_t* str, const char* buff, size_t length, myhtml_encoding_t encoding);
|
||||
|
||||
/* append with convert encoding */
|
||||
void myhtml_string_append_chunk_with_convert_encoding(myhtml_string_t* str, myhtml_encoding_result_t* res, const char* buff, size_t length, myhtml_encoding_t encoding);
|
||||
void myhtml_string_append_one_with_convert_encoding(myhtml_string_t* str, myhtml_encoding_result_t* res, const char data, myhtml_encoding_t encoding);
|
||||
|
||||
/* append with convert encoding lowercase */
|
||||
void myhtml_string_append_lowercase_ascii_with_convert_encoding(myhtml_string_t* str, const char* buff, size_t length, myhtml_encoding_t encoding);
|
||||
void myhtml_string_append_chunk_lowercase_ascii_with_convert_encoding(myhtml_string_t* str, myhtml_encoding_result_t* res, const char* buff, size_t length, myhtml_encoding_t encoding);
|
||||
|
||||
/* Oh, long long long name */
|
||||
|
||||
/* append with convert encoding with preprocessing */
|
||||
size_t myhtml_string_append_with_convert_encoding_with_preprocessing(myhtml_string_t* str, const char* buff, size_t length, myhtml_encoding_t encoding, bool emit_null_chars);
|
||||
size_t myhtml_string_append_chunk_with_convert_encoding_with_preprocessing(myhtml_string_t* str, myhtml_encoding_result_t* res, const char* buff, size_t length, myhtml_encoding_t encoding, bool emit_null_chars);
|
||||
|
||||
/* append with convert encoding lowercase with preprocessing */
|
||||
size_t myhtml_string_append_lowercase_with_convert_encoding_with_preprocessing(myhtml_string_t* str, const char* buff, size_t length, myhtml_encoding_t encoding, bool emit_null_chars);
|
||||
size_t myhtml_string_append_lowercase_chunk_with_convert_encoding_with_preprocessing(myhtml_string_t* str, myhtml_encoding_result_t* res, const char* buff, size_t length, myhtml_encoding_t encoding, bool emit_null_chars);
|
||||
|
||||
void myhtml_string_append_with_replacement_null_characters_only(myhtml_string_t* str, const char* buff, size_t length);
|
||||
|
||||
/* append with preprocessing */
|
||||
size_t myhtml_string_before_append_any_preprocessing(myhtml_string_t* str, const char* buff, size_t length, size_t last_position);
|
||||
size_t myhtml_string_append_with_preprocessing(myhtml_string_t* str, const char* buff, size_t length, bool emit_null_chars);
|
||||
size_t myhtml_string_append_lowercase_with_preprocessing(myhtml_string_t* str, const char* buff, size_t length, bool emit_null_chars);
|
||||
size_t myhtml_string_raw_set_replacement_character(myhtml_string_t* target, size_t position);
|
||||
|
||||
/* other functions */
|
||||
void myhtml_string_copy(myhtml_string_t* dest, myhtml_string_t* target);
|
||||
size_t myhtml_string_raw_copy(char* str1, const char* str2, size_t size);
|
||||
void myhtml_string_stay_only_whitespace(myhtml_string_t* target);
|
||||
size_t myhtml_string_crop_whitespace_from_begin(myhtml_string_t* target);
|
||||
size_t myhtml_string_whitespace_from_begin(myhtml_string_t* target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_mystring_h */
|
48
include/myhtml/parser.h
Normal file
48
include/myhtml/parser.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_PARSER_H
|
||||
#define MyHTML_PARSER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/mystring.h>
|
||||
#include <myhtml/tree.h>
|
||||
#include <myhtml/token.h>
|
||||
#include <myhtml/data_process.h>
|
||||
|
||||
void myhtml_parser_stream(mythread_id_t thread_id, mythread_queue_node_t *qnode);
|
||||
void myhtml_parser_worker(mythread_id_t thread_id, mythread_queue_node_t *qnode);
|
||||
void myhtml_parser_worker_stream(mythread_id_t thread_id, mythread_queue_node_t *qnode);
|
||||
|
||||
size_t myhtml_parser_token_data_to_string(myhtml_tree_t *tree, myhtml_string_t* str, myhtml_data_process_entry_t* proc_entry, size_t begin, size_t length);
|
||||
size_t myhtml_parser_token_data_to_string_lowercase(myhtml_tree_t *tree, myhtml_string_t* str, myhtml_data_process_entry_t* proc_entry, size_t begin, size_t length);
|
||||
size_t myhtml_parser_token_data_to_string_charef(myhtml_tree_t *tree, myhtml_string_t* str, myhtml_data_process_entry_t* proc_entry, size_t begin, size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_parser_h */
|
47
include/myhtml/rules.h
Normal file
47
include/myhtml/rules.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_RULES_H
|
||||
#define MyHTML_RULES_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/tree.h>
|
||||
|
||||
|
||||
myhtml_status_t myhtml_rules_init(myhtml_t* myhtml);
|
||||
void myhtml_rules_stop_parsing(myhtml_tree_t* tree);
|
||||
|
||||
bool myhtml_rules_tree_dispatcher(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
bool myhtml_insertion_mode_in_body_other_end_tag(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
bool myhtml_insertion_mode_in_body(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
bool myhtml_insertion_mode_in_template(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_rules_h */
|
62
include/myhtml/stream.h
Normal file
62
include/myhtml/stream.h
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_STREAM_H
|
||||
#define MyHTML_STREAM_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
|
||||
|
||||
struct myhtml_stream_buffer_entry {
|
||||
char* data;
|
||||
size_t length;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct myhtml_stream_buffer {
|
||||
myhtml_stream_buffer_entry_t* entries;
|
||||
size_t length;
|
||||
size_t size;
|
||||
|
||||
myhtml_encoding_result_t res;
|
||||
};
|
||||
|
||||
myhtml_stream_buffer_t * myhtml_stream_buffer_create(void);
|
||||
myhtml_status_t myhtml_stream_buffer_init(myhtml_stream_buffer_t* stream_buffer, size_t entries_size);
|
||||
void myhtml_stream_buffer_clean(myhtml_stream_buffer_t* stream_buffer);
|
||||
myhtml_stream_buffer_t * myhtml_stream_buffer_destroy(myhtml_stream_buffer_t* stream_buffer, bool self_destroy);
|
||||
myhtml_stream_buffer_entry_t * myhtml_stream_buffer_add_entry(myhtml_stream_buffer_t* stream_buffer, size_t entry_data_size);
|
||||
myhtml_stream_buffer_entry_t * myhtml_stream_buffer_current_entry(myhtml_stream_buffer_t* stream_buffer);
|
||||
|
||||
myhtml_status_t myhtml_stream_buffer_entry_init(myhtml_stream_buffer_entry_t* stream_buffer_entry, size_t size);
|
||||
void myhtml_stream_buffer_entry_clean(myhtml_stream_buffer_entry_t* stream_buffer_entry);
|
||||
myhtml_stream_buffer_entry_t * myhtml_stream_buffer_entry_destroy(myhtml_stream_buffer_entry_t* stream_buffer_entry, bool self_destroy);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* MyHTML_STREAM_H */
|
149
include/myhtml/tag.h
Normal file
149
include/myhtml/tag.h
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef myhtml_tag_H
|
||||
#define myhtml_tag_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
|
||||
#include <myhtml/tag_const.h>
|
||||
#include <myhtml/tokenizer.h>
|
||||
#include <myhtml/tree.h>
|
||||
#include <myhtml/utils.h>
|
||||
#include <myhtml/utils/mctree.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
#include <myhtml/utils/mcobject_async.h>
|
||||
#include <myhtml/utils/mcsimple.h>
|
||||
|
||||
#define myhtml_tag_get(tags, idx, attr) tags->context[idx].attr
|
||||
|
||||
#define myhtml_tag_context_clean(tags, idx) \
|
||||
tags->context[idx].id = 0; \
|
||||
tags->context[idx].name = NULL; \
|
||||
tags->context[idx].name_length = 0; \
|
||||
tags->context[idx].data_parser = MyHTML_TOKENIZER_STATE_DATA; \
|
||||
memset(tags->context[idx].cats, MyHTML_TAG_CATEGORIES_UNDEF, sizeof(tags->context[idx].cats));
|
||||
|
||||
|
||||
#define myhtml_tag_context_add(tags) \
|
||||
tags->context_length++; \
|
||||
if(tags->context_length == tags->context_size) { \
|
||||
tags->context_size += 4096; \
|
||||
tags->context = (myhtml_tag_context_t*)myhtml_realloc(tags->context, \
|
||||
sizeof(myhtml_tag_context_t) * tags->context_size); \
|
||||
} \
|
||||
myhtml_tag_context_clean(tags, tags->context_length)
|
||||
|
||||
#define myhtml_tag_index_clean_node(index_node) \
|
||||
memset(index_node, 0, sizeof(myhtml_tag_index_node_t));
|
||||
|
||||
struct myhtml_tag_index_entry {
|
||||
myhtml_tag_index_node_t *first;
|
||||
myhtml_tag_index_node_t *last;
|
||||
size_t count;
|
||||
};
|
||||
|
||||
struct myhtml_tag_index_node {
|
||||
myhtml_tag_index_node_t *next;
|
||||
myhtml_tag_index_node_t *prev;
|
||||
|
||||
myhtml_tree_node_t* node;
|
||||
};
|
||||
|
||||
struct myhtml_tag_index {
|
||||
myhtml_tag_index_entry_t* tags;
|
||||
size_t tags_length;
|
||||
size_t tags_size;
|
||||
};
|
||||
|
||||
struct myhtml_tag_context {
|
||||
myhtml_tag_id_t id;
|
||||
|
||||
const char* name;
|
||||
size_t name_length;
|
||||
|
||||
enum myhtml_tokenizer_state data_parser;
|
||||
enum myhtml_tag_categories cats[MyHTML_NAMESPACE_LAST_ENTRY];
|
||||
}
|
||||
typedef myhtml_tag_context_t;
|
||||
|
||||
struct myhtml_tag_static_list {
|
||||
const myhtml_tag_context_t* ctx;
|
||||
size_t next;
|
||||
size_t cur;
|
||||
}
|
||||
typedef myhtml_tag_static_list_t;
|
||||
|
||||
struct myhtml_tag {
|
||||
mctree_t* tree;
|
||||
mcsimple_t* mcsimple_context;
|
||||
|
||||
size_t tags_count;
|
||||
size_t mchar_node;
|
||||
|
||||
mchar_async_t *mchar;
|
||||
mcobject_t *mcobject_tag_index;
|
||||
};
|
||||
|
||||
myhtml_tag_t * myhtml_tag_create(void);
|
||||
myhtml_status_t myhtml_tag_init(myhtml_tree_t *tree, myhtml_tag_t *tags);
|
||||
void myhtml_tag_clean(myhtml_tag_t* tags);
|
||||
myhtml_tag_t * myhtml_tag_destroy(myhtml_tag_t* tags);
|
||||
|
||||
myhtml_tag_id_t myhtml_tag_add(myhtml_tag_t* tags, const char* key, size_t key_size,
|
||||
enum myhtml_tokenizer_state data_parser, bool to_lcase);
|
||||
|
||||
void myhtml_tag_set_category(myhtml_tag_t* tags, myhtml_tag_id_t tag_idx,
|
||||
enum myhtml_namespace ns, enum myhtml_tag_categories cats);
|
||||
|
||||
myhtml_tag_index_t * myhtml_tag_index_create(void);
|
||||
myhtml_status_t myhtml_tag_index_init(myhtml_tag_t* tags, myhtml_tag_index_t* tag_index);
|
||||
void myhtml_tag_index_clean(myhtml_tag_t* tags, myhtml_tag_index_t* tag_index);
|
||||
myhtml_tag_index_t * myhtml_tag_index_destroy(myhtml_tag_t* tags, myhtml_tag_index_t* tag_index);
|
||||
|
||||
myhtml_status_t myhtml_tag_index_add(myhtml_tag_t* tags, myhtml_tag_index_t* tag_index, myhtml_tree_node_t* node);
|
||||
myhtml_tag_index_entry_t * myhtml_tag_index_entry(myhtml_tag_index_t* tag_index, myhtml_tag_id_t tag_id);
|
||||
myhtml_tag_index_node_t * myhtml_tag_index_first(myhtml_tag_index_t* tag_index, myhtml_tag_id_t tag_id);
|
||||
myhtml_tag_index_node_t * myhtml_tag_index_last(myhtml_tag_index_t* tag_index, myhtml_tag_id_t tag_id);
|
||||
myhtml_tag_index_node_t * myhtml_tag_index_next(myhtml_tag_index_node_t *index_node);
|
||||
myhtml_tag_index_node_t * myhtml_tag_index_prev(myhtml_tag_index_node_t *index_node);
|
||||
myhtml_tree_node_t * myhtml_tag_index_tree_node(myhtml_tag_index_node_t *index_node);
|
||||
|
||||
size_t myhtml_tag_index_entry_count(myhtml_tag_index_t* tag_index, myhtml_tag_id_t tag_id);
|
||||
|
||||
const myhtml_tag_context_t * myhtml_tag_get_by_id(myhtml_tag_t* tags, myhtml_tag_id_t tag_id);
|
||||
const myhtml_tag_context_t * myhtml_tag_get_by_name(myhtml_tag_t* tags, const char* name, size_t length);
|
||||
|
||||
const myhtml_tag_context_t * myhtml_tag_static_get_by_id(size_t idx);
|
||||
const myhtml_tag_context_t * myhtml_tag_static_search(const char* name, size_t length);
|
||||
|
||||
void myhtml_tag_print(myhtml_tag_t* tags, FILE* fh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
293
include/myhtml/tag_const.h
Normal file
293
include/myhtml/tag_const.h
Normal file
@ -0,0 +1,293 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TAG_CONST_H
|
||||
#define MyHTML_TAG_CONST_H
|
||||
#pragma once
|
||||
|
||||
#define MyHTML_BASE_STATIC_SIZE 479
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum myhtml_tags {
|
||||
MyHTML_TAG__UNDEF = 0x000,
|
||||
MyHTML_TAG__TEXT = 0x001,
|
||||
MyHTML_TAG__COMMENT = 0x002,
|
||||
MyHTML_TAG__DOCTYPE = 0x003,
|
||||
MyHTML_TAG_A = 0x004,
|
||||
MyHTML_TAG_ABBR = 0x005,
|
||||
MyHTML_TAG_ACRONYM = 0x006,
|
||||
MyHTML_TAG_ADDRESS = 0x007,
|
||||
MyHTML_TAG_ANNOTATION_XML = 0x008,
|
||||
MyHTML_TAG_APPLET = 0x009,
|
||||
MyHTML_TAG_AREA = 0x00a,
|
||||
MyHTML_TAG_ARTICLE = 0x00b,
|
||||
MyHTML_TAG_ASIDE = 0x00c,
|
||||
MyHTML_TAG_AUDIO = 0x00d,
|
||||
MyHTML_TAG_B = 0x00e,
|
||||
MyHTML_TAG_BASE = 0x00f,
|
||||
MyHTML_TAG_BASEFONT = 0x010,
|
||||
MyHTML_TAG_BDI = 0x011,
|
||||
MyHTML_TAG_BDO = 0x012,
|
||||
MyHTML_TAG_BGSOUND = 0x013,
|
||||
MyHTML_TAG_BIG = 0x014,
|
||||
MyHTML_TAG_BLINK = 0x015,
|
||||
MyHTML_TAG_BLOCKQUOTE = 0x016,
|
||||
MyHTML_TAG_BODY = 0x017,
|
||||
MyHTML_TAG_BR = 0x018,
|
||||
MyHTML_TAG_BUTTON = 0x019,
|
||||
MyHTML_TAG_CANVAS = 0x01a,
|
||||
MyHTML_TAG_CAPTION = 0x01b,
|
||||
MyHTML_TAG_CENTER = 0x01c,
|
||||
MyHTML_TAG_CITE = 0x01d,
|
||||
MyHTML_TAG_CODE = 0x01e,
|
||||
MyHTML_TAG_COL = 0x01f,
|
||||
MyHTML_TAG_COLGROUP = 0x020,
|
||||
MyHTML_TAG_COMMAND = 0x021,
|
||||
MyHTML_TAG_COMMENT = 0x022,
|
||||
MyHTML_TAG_DATALIST = 0x023,
|
||||
MyHTML_TAG_DD = 0x024,
|
||||
MyHTML_TAG_DEL = 0x025,
|
||||
MyHTML_TAG_DETAILS = 0x026,
|
||||
MyHTML_TAG_DFN = 0x027,
|
||||
MyHTML_TAG_DIALOG = 0x028,
|
||||
MyHTML_TAG_DIR = 0x029,
|
||||
MyHTML_TAG_DIV = 0x02a,
|
||||
MyHTML_TAG_DL = 0x02b,
|
||||
MyHTML_TAG_DT = 0x02c,
|
||||
MyHTML_TAG_EM = 0x02d,
|
||||
MyHTML_TAG_EMBED = 0x02e,
|
||||
MyHTML_TAG_FIELDSET = 0x02f,
|
||||
MyHTML_TAG_FIGCAPTION = 0x030,
|
||||
MyHTML_TAG_FIGURE = 0x031,
|
||||
MyHTML_TAG_FONT = 0x032,
|
||||
MyHTML_TAG_FOOTER = 0x033,
|
||||
MyHTML_TAG_FORM = 0x034,
|
||||
MyHTML_TAG_FRAME = 0x035,
|
||||
MyHTML_TAG_FRAMESET = 0x036,
|
||||
MyHTML_TAG_H1 = 0x037,
|
||||
MyHTML_TAG_H2 = 0x038,
|
||||
MyHTML_TAG_H3 = 0x039,
|
||||
MyHTML_TAG_H4 = 0x03a,
|
||||
MyHTML_TAG_H5 = 0x03b,
|
||||
MyHTML_TAG_H6 = 0x03c,
|
||||
MyHTML_TAG_HEAD = 0x03d,
|
||||
MyHTML_TAG_HEADER = 0x03e,
|
||||
MyHTML_TAG_HGROUP = 0x03f,
|
||||
MyHTML_TAG_HR = 0x040,
|
||||
MyHTML_TAG_HTML = 0x041,
|
||||
MyHTML_TAG_I = 0x042,
|
||||
MyHTML_TAG_IFRAME = 0x043,
|
||||
MyHTML_TAG_IMAGE = 0x044,
|
||||
MyHTML_TAG_IMG = 0x045,
|
||||
MyHTML_TAG_INPUT = 0x046,
|
||||
MyHTML_TAG_INS = 0x047,
|
||||
MyHTML_TAG_ISINDEX = 0x048,
|
||||
MyHTML_TAG_KBD = 0x049,
|
||||
MyHTML_TAG_KEYGEN = 0x04a,
|
||||
MyHTML_TAG_LABEL = 0x04b,
|
||||
MyHTML_TAG_LEGEND = 0x04c,
|
||||
MyHTML_TAG_LI = 0x04d,
|
||||
MyHTML_TAG_LINK = 0x04e,
|
||||
MyHTML_TAG_LISTING = 0x04f,
|
||||
MyHTML_TAG_MAIN = 0x050,
|
||||
MyHTML_TAG_MAP = 0x051,
|
||||
MyHTML_TAG_MARK = 0x052,
|
||||
MyHTML_TAG_MARQUEE = 0x053,
|
||||
MyHTML_TAG_MENU = 0x054,
|
||||
MyHTML_TAG_MENUITEM = 0x055,
|
||||
MyHTML_TAG_META = 0x056,
|
||||
MyHTML_TAG_METER = 0x057,
|
||||
MyHTML_TAG_MTEXT = 0x058,
|
||||
MyHTML_TAG_NAV = 0x059,
|
||||
MyHTML_TAG_NOBR = 0x05a,
|
||||
MyHTML_TAG_NOEMBED = 0x05b,
|
||||
MyHTML_TAG_NOFRAMES = 0x05c,
|
||||
MyHTML_TAG_NOSCRIPT = 0x05d,
|
||||
MyHTML_TAG_OBJECT = 0x05e,
|
||||
MyHTML_TAG_OL = 0x05f,
|
||||
MyHTML_TAG_OPTGROUP = 0x060,
|
||||
MyHTML_TAG_OPTION = 0x061,
|
||||
MyHTML_TAG_OUTPUT = 0x062,
|
||||
MyHTML_TAG_P = 0x063,
|
||||
MyHTML_TAG_PARAM = 0x064,
|
||||
MyHTML_TAG_PLAINTEXT = 0x065,
|
||||
MyHTML_TAG_PRE = 0x066,
|
||||
MyHTML_TAG_PROGRESS = 0x067,
|
||||
MyHTML_TAG_Q = 0x068,
|
||||
MyHTML_TAG_RB = 0x069,
|
||||
MyHTML_TAG_RP = 0x06a,
|
||||
MyHTML_TAG_RT = 0x06b,
|
||||
MyHTML_TAG_RTC = 0x06c,
|
||||
MyHTML_TAG_RUBY = 0x06d,
|
||||
MyHTML_TAG_S = 0x06e,
|
||||
MyHTML_TAG_SAMP = 0x06f,
|
||||
MyHTML_TAG_SCRIPT = 0x070,
|
||||
MyHTML_TAG_SECTION = 0x071,
|
||||
MyHTML_TAG_SELECT = 0x072,
|
||||
MyHTML_TAG_SMALL = 0x073,
|
||||
MyHTML_TAG_SOURCE = 0x074,
|
||||
MyHTML_TAG_SPAN = 0x075,
|
||||
MyHTML_TAG_STRIKE = 0x076,
|
||||
MyHTML_TAG_STRONG = 0x077,
|
||||
MyHTML_TAG_STYLE = 0x078,
|
||||
MyHTML_TAG_SUB = 0x079,
|
||||
MyHTML_TAG_SUMMARY = 0x07a,
|
||||
MyHTML_TAG_SUP = 0x07b,
|
||||
MyHTML_TAG_SVG = 0x07c,
|
||||
MyHTML_TAG_TABLE = 0x07d,
|
||||
MyHTML_TAG_TBODY = 0x07e,
|
||||
MyHTML_TAG_TD = 0x07f,
|
||||
MyHTML_TAG_TEMPLATE = 0x080,
|
||||
MyHTML_TAG_TEXTAREA = 0x081,
|
||||
MyHTML_TAG_TFOOT = 0x082,
|
||||
MyHTML_TAG_TH = 0x083,
|
||||
MyHTML_TAG_THEAD = 0x084,
|
||||
MyHTML_TAG_TIME = 0x085,
|
||||
MyHTML_TAG_TITLE = 0x086,
|
||||
MyHTML_TAG_TR = 0x087,
|
||||
MyHTML_TAG_TRACK = 0x088,
|
||||
MyHTML_TAG_TT = 0x089,
|
||||
MyHTML_TAG_U = 0x08a,
|
||||
MyHTML_TAG_UL = 0x08b,
|
||||
MyHTML_TAG_VAR = 0x08c,
|
||||
MyHTML_TAG_VIDEO = 0x08d,
|
||||
MyHTML_TAG_WBR = 0x08e,
|
||||
MyHTML_TAG_XMP = 0x08f,
|
||||
MyHTML_TAG_ALTGLYPH = 0x090,
|
||||
MyHTML_TAG_ALTGLYPHDEF = 0x091,
|
||||
MyHTML_TAG_ALTGLYPHITEM = 0x092,
|
||||
MyHTML_TAG_ANIMATE = 0x093,
|
||||
MyHTML_TAG_ANIMATECOLOR = 0x094,
|
||||
MyHTML_TAG_ANIMATEMOTION = 0x095,
|
||||
MyHTML_TAG_ANIMATETRANSFORM = 0x096,
|
||||
MyHTML_TAG_CIRCLE = 0x097,
|
||||
MyHTML_TAG_CLIPPATH = 0x098,
|
||||
MyHTML_TAG_COLOR_PROFILE = 0x099,
|
||||
MyHTML_TAG_CURSOR = 0x09a,
|
||||
MyHTML_TAG_DEFS = 0x09b,
|
||||
MyHTML_TAG_DESC = 0x09c,
|
||||
MyHTML_TAG_ELLIPSE = 0x09d,
|
||||
MyHTML_TAG_FEBLEND = 0x09e,
|
||||
MyHTML_TAG_FECOLORMATRIX = 0x09f,
|
||||
MyHTML_TAG_FECOMPONENTTRANSFER = 0x0a0,
|
||||
MyHTML_TAG_FECOMPOSITE = 0x0a1,
|
||||
MyHTML_TAG_FECONVOLVEMATRIX = 0x0a2,
|
||||
MyHTML_TAG_FEDIFFUSELIGHTING = 0x0a3,
|
||||
MyHTML_TAG_FEDISPLACEMENTMAP = 0x0a4,
|
||||
MyHTML_TAG_FEDISTANTLIGHT = 0x0a5,
|
||||
MyHTML_TAG_FEDROPSHADOW = 0x0a6,
|
||||
MyHTML_TAG_FEFLOOD = 0x0a7,
|
||||
MyHTML_TAG_FEFUNCA = 0x0a8,
|
||||
MyHTML_TAG_FEFUNCB = 0x0a9,
|
||||
MyHTML_TAG_FEFUNCG = 0x0aa,
|
||||
MyHTML_TAG_FEFUNCR = 0x0ab,
|
||||
MyHTML_TAG_FEGAUSSIANBLUR = 0x0ac,
|
||||
MyHTML_TAG_FEIMAGE = 0x0ad,
|
||||
MyHTML_TAG_FEMERGE = 0x0ae,
|
||||
MyHTML_TAG_FEMERGENODE = 0x0af,
|
||||
MyHTML_TAG_FEMORPHOLOGY = 0x0b0,
|
||||
MyHTML_TAG_FEOFFSET = 0x0b1,
|
||||
MyHTML_TAG_FEPOINTLIGHT = 0x0b2,
|
||||
MyHTML_TAG_FESPECULARLIGHTING = 0x0b3,
|
||||
MyHTML_TAG_FESPOTLIGHT = 0x0b4,
|
||||
MyHTML_TAG_FETILE = 0x0b5,
|
||||
MyHTML_TAG_FETURBULENCE = 0x0b6,
|
||||
MyHTML_TAG_FILTER = 0x0b7,
|
||||
MyHTML_TAG_FONT_FACE = 0x0b8,
|
||||
MyHTML_TAG_FONT_FACE_FORMAT = 0x0b9,
|
||||
MyHTML_TAG_FONT_FACE_NAME = 0x0ba,
|
||||
MyHTML_TAG_FONT_FACE_SRC = 0x0bb,
|
||||
MyHTML_TAG_FONT_FACE_URI = 0x0bc,
|
||||
MyHTML_TAG_FOREIGNOBJECT = 0x0bd,
|
||||
MyHTML_TAG_G = 0x0be,
|
||||
MyHTML_TAG_GLYPH = 0x0bf,
|
||||
MyHTML_TAG_GLYPHREF = 0x0c0,
|
||||
MyHTML_TAG_HKERN = 0x0c1,
|
||||
MyHTML_TAG_LINE = 0x0c2,
|
||||
MyHTML_TAG_LINEARGRADIENT = 0x0c3,
|
||||
MyHTML_TAG_MARKER = 0x0c4,
|
||||
MyHTML_TAG_MASK = 0x0c5,
|
||||
MyHTML_TAG_METADATA = 0x0c6,
|
||||
MyHTML_TAG_MISSING_GLYPH = 0x0c7,
|
||||
MyHTML_TAG_MPATH = 0x0c8,
|
||||
MyHTML_TAG_PATH = 0x0c9,
|
||||
MyHTML_TAG_PATTERN = 0x0ca,
|
||||
MyHTML_TAG_POLYGON = 0x0cb,
|
||||
MyHTML_TAG_POLYLINE = 0x0cc,
|
||||
MyHTML_TAG_RADIALGRADIENT = 0x0cd,
|
||||
MyHTML_TAG_RECT = 0x0ce,
|
||||
MyHTML_TAG_SET = 0x0cf,
|
||||
MyHTML_TAG_STOP = 0x0d0,
|
||||
MyHTML_TAG_SWITCH = 0x0d1,
|
||||
MyHTML_TAG_SYMBOL = 0x0d2,
|
||||
MyHTML_TAG_TEXT = 0x0d3,
|
||||
MyHTML_TAG_TEXTPATH = 0x0d4,
|
||||
MyHTML_TAG_TREF = 0x0d5,
|
||||
MyHTML_TAG_TSPAN = 0x0d6,
|
||||
MyHTML_TAG_USE = 0x0d7,
|
||||
MyHTML_TAG_VIEW = 0x0d8,
|
||||
MyHTML_TAG_VKERN = 0x0d9,
|
||||
MyHTML_TAG_MATH = 0x0da,
|
||||
MyHTML_TAG_MACTION = 0x0db,
|
||||
MyHTML_TAG_MALIGNGROUP = 0x0dc,
|
||||
MyHTML_TAG_MALIGNMARK = 0x0dd,
|
||||
MyHTML_TAG_MENCLOSE = 0x0de,
|
||||
MyHTML_TAG_MERROR = 0x0df,
|
||||
MyHTML_TAG_MFENCED = 0x0e0,
|
||||
MyHTML_TAG_MFRAC = 0x0e1,
|
||||
MyHTML_TAG_MGLYPH = 0x0e2,
|
||||
MyHTML_TAG_MI = 0x0e3,
|
||||
MyHTML_TAG_MLABELEDTR = 0x0e4,
|
||||
MyHTML_TAG_MLONGDIV = 0x0e5,
|
||||
MyHTML_TAG_MMULTISCRIPTS = 0x0e6,
|
||||
MyHTML_TAG_MN = 0x0e7,
|
||||
MyHTML_TAG_MO = 0x0e8,
|
||||
MyHTML_TAG_MOVER = 0x0e9,
|
||||
MyHTML_TAG_MPADDED = 0x0ea,
|
||||
MyHTML_TAG_MPHANTOM = 0x0eb,
|
||||
MyHTML_TAG_MROOT = 0x0ec,
|
||||
MyHTML_TAG_MROW = 0x0ed,
|
||||
MyHTML_TAG_MS = 0x0ee,
|
||||
MyHTML_TAG_MSCARRIES = 0x0ef,
|
||||
MyHTML_TAG_MSCARRY = 0x0f0,
|
||||
MyHTML_TAG_MSGROUP = 0x0f1,
|
||||
MyHTML_TAG_MSLINE = 0x0f2,
|
||||
MyHTML_TAG_MSPACE = 0x0f3,
|
||||
MyHTML_TAG_MSQRT = 0x0f4,
|
||||
MyHTML_TAG_MSROW = 0x0f5,
|
||||
MyHTML_TAG_MSTACK = 0x0f6,
|
||||
MyHTML_TAG_MSTYLE = 0x0f7,
|
||||
MyHTML_TAG_MSUB = 0x0f8,
|
||||
MyHTML_TAG_MSUP = 0x0f9,
|
||||
MyHTML_TAG_MSUBSUP = 0x0fa,
|
||||
MyHTML_TAG__END_OF_FILE = 0x0fb,
|
||||
MyHTML_TAG_FIRST_ENTRY = MyHTML_TAG__TEXT,
|
||||
MyHTML_TAG_LAST_ENTRY = 0x0fc
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
212
include/myhtml/thread.h
Normal file
212
include/myhtml/thread.h
Normal file
@ -0,0 +1,212 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_THREAD_H
|
||||
#define MyHTML_THREAD_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
|
||||
#ifndef MyHTML_BUILD_WITHOUT_THREADS
|
||||
|
||||
#if !defined(IS_OS_WINDOWS)
|
||||
# include <pthread.h>
|
||||
# include <semaphore.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/tree.h>
|
||||
#include <myhtml/mystring.h>
|
||||
|
||||
#endif /* MyHTML_BUILD_WITHOUT_THREADS */
|
||||
|
||||
#define MyTHREAD_SEM_NAME "myhtml"
|
||||
|
||||
|
||||
#ifdef MyHTML_BUILD_WITHOUT_THREADS
|
||||
|
||||
struct mythread {
|
||||
int sys_last_error;
|
||||
};
|
||||
|
||||
#else /* MyHTML_BUILD_WITHOUT_THREADS */
|
||||
|
||||
void mythread_function_stream(void *arg);
|
||||
void mythread_function_batch(void *arg);
|
||||
|
||||
// thread
|
||||
struct mythread_context {
|
||||
mythread_id_t id;
|
||||
|
||||
#if defined(IS_OS_WINDOWS)
|
||||
HANDLE mutex;
|
||||
#else
|
||||
pthread_mutex_t *mutex;
|
||||
#endif
|
||||
|
||||
size_t sem_name_size;
|
||||
|
||||
mythread_f func;
|
||||
|
||||
volatile size_t t_count;
|
||||
volatile mythread_thread_opt_t opt;
|
||||
|
||||
mythread_t *mythread;
|
||||
};
|
||||
|
||||
struct mythread_list {
|
||||
#if defined(IS_OS_WINDOWS)
|
||||
HANDLE pth;
|
||||
#else
|
||||
pthread_t pth;
|
||||
#endif
|
||||
mythread_context_t data;
|
||||
};
|
||||
|
||||
struct mythread_workers_list {
|
||||
mythread_list_t *list;
|
||||
size_t count;
|
||||
};
|
||||
|
||||
struct mythread {
|
||||
mythread_list_t *pth_list;
|
||||
size_t pth_list_length;
|
||||
size_t pth_list_size;
|
||||
size_t pth_list_root;
|
||||
|
||||
mythread_queue_list_t *queue_list;
|
||||
|
||||
char *sem_prefix;
|
||||
size_t sem_prefix_length;
|
||||
|
||||
#if !defined(IS_OS_WINDOWS)
|
||||
pthread_attr_t *attr;
|
||||
#endif
|
||||
|
||||
int sys_last_error;
|
||||
|
||||
mythread_id_t batch_first_id;
|
||||
mythread_id_t batch_count;
|
||||
|
||||
volatile mythread_thread_opt_t stream_opt;
|
||||
volatile mythread_thread_opt_t batch_opt;
|
||||
};
|
||||
|
||||
mythread_id_t myhread_create_stream(mythread_t *mythread, mythread_f func, myhtml_status_t *status);
|
||||
mythread_id_t myhread_create_batch(mythread_t *mythread, mythread_f func, myhtml_status_t *status, size_t count);
|
||||
|
||||
void myhtml_thread_nanosleep(const struct timespec *tomeout);
|
||||
|
||||
#endif
|
||||
|
||||
mythread_t * mythread_create(void);
|
||||
myhtml_status_t mythread_init(mythread_t *mythread, const char *sem_prefix, size_t thread_count, size_t queue_size);
|
||||
void mythread_clean(mythread_t *mythread);
|
||||
mythread_t * mythread_destroy(mythread_t *mythread, bool self_destroy);
|
||||
|
||||
void mythread_stream_quit_all(mythread_t *mythread);
|
||||
void mythread_batch_quit_all(mythread_t *mythread);
|
||||
|
||||
void mythread_stream_stop_all(mythread_t *mythread);
|
||||
void mythread_batch_stop_all(mythread_t *mythread);
|
||||
|
||||
void mythread_stop_all(mythread_t *mythread);
|
||||
void mythread_wait_all_for_done(mythread_t *mythread);
|
||||
void mythread_resume_all(mythread_t *mythread);
|
||||
void mythread_suspend_all(mythread_t *mythread);
|
||||
|
||||
// queue
|
||||
struct mythread_queue_node {
|
||||
mythread_queue_node_t *prev;
|
||||
myhtml_token_node_t *token;
|
||||
myhtml_tree_t *tree;
|
||||
};
|
||||
|
||||
struct mythread_queue_thread_param {
|
||||
volatile size_t use;
|
||||
};
|
||||
|
||||
struct mythread_queue_list_entry {
|
||||
mythread_queue_list_entry_t *next;
|
||||
mythread_queue_list_entry_t *prev;
|
||||
mythread_queue_t *queue;
|
||||
mythread_queue_thread_param_t *thread_param;
|
||||
};
|
||||
|
||||
struct mythread_queue_list {
|
||||
mythread_queue_list_entry_t *first;
|
||||
mythread_queue_list_entry_t *last;
|
||||
|
||||
volatile size_t count;
|
||||
};
|
||||
|
||||
struct mythread_queue {
|
||||
mythread_queue_node_t **nodes;
|
||||
|
||||
size_t nodes_pos;
|
||||
size_t nodes_pos_size;
|
||||
size_t nodes_length;
|
||||
|
||||
volatile size_t nodes_uses;
|
||||
volatile size_t nodes_size;
|
||||
volatile size_t nodes_root;
|
||||
};
|
||||
|
||||
mythread_queue_t * mythread_queue_create(size_t size, myhtml_status_t *status);
|
||||
void mythread_queue_clean(mythread_queue_t* queue);
|
||||
mythread_queue_t * mythread_queue_destroy(mythread_queue_t* token);
|
||||
|
||||
void mythread_queue_node_clean(mythread_queue_node_t* qnode);
|
||||
|
||||
size_t mythread_queue_count_used_node(mythread_queue_t* queue);
|
||||
mythread_queue_node_t * mythread_queue_get_first_node(mythread_queue_t* queue);
|
||||
mythread_queue_node_t * mythread_queue_get_prev_node(mythread_queue_node_t* qnode);
|
||||
mythread_queue_node_t * mythread_queue_get_current_node(mythread_queue_t* queue);
|
||||
mythread_queue_node_t * mythread_queue_node_malloc(mythread_t *mythread, mythread_queue_t* queue, myhtml_status_t *status);
|
||||
mythread_queue_node_t * mythread_queue_node_malloc_limit(mythread_t *mythread, mythread_queue_t* queue, size_t limit, myhtml_status_t *status);
|
||||
|
||||
#ifndef MyHTML_BUILD_WITHOUT_THREADS
|
||||
|
||||
mythread_queue_list_t * mythread_queue_list_create(mythread_t *mythread, myhtml_status_t *status);
|
||||
mythread_queue_list_entry_t * mythread_queue_list_entry_push(mythread_t *mythread, mythread_queue_t *queue, myhtml_status_t *status);
|
||||
mythread_queue_list_entry_t * mythread_queue_list_entry_delete(mythread_t *mythread, mythread_queue_list_entry_t *entry, bool destroy_queue);
|
||||
void mythread_queue_list_entry_clean(mythread_t *mythread, mythread_queue_list_entry_t *entry);
|
||||
void mythread_queue_list_entry_wait_for_done(mythread_t *mythread, mythread_queue_list_entry_t *entry);
|
||||
|
||||
mythread_queue_node_t * mythread_queue_node_malloc_round(mythread_t *mythread, mythread_queue_list_entry_t *entry, myhtml_status_t *status);
|
||||
|
||||
#endif /* MyHTML_BUILD_WITHOUT_THREADS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* defined(__myhtml__myhtml_thread__) */
|
||||
|
168
include/myhtml/token.h
Normal file
168
include/myhtml/token.h
Normal file
@ -0,0 +1,168 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TOKEN_H
|
||||
#define MyHTML_TOKEN_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
#include <myhtml/tag.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/mystring.h>
|
||||
#include <myhtml/utils/mcobject_async.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
#include <myhtml/utils/mcsync.h>
|
||||
|
||||
#define myhtml_token_attr_malloc(token, attr_node, thread_idx) \
|
||||
attr_node = mcobject_async_malloc(token->attr_obj, thread_idx, NULL); \
|
||||
myhtml_token_attr_clean(attr_node)
|
||||
|
||||
#define myhtml_token_node_set_done(token_node) token_node->type |= MyHTML_TOKEN_TYPE_DONE
|
||||
|
||||
#define myhtml_token_node_malloc(token, token_node, thread_idx) \
|
||||
token_node = (myhtml_token_node_t*)mcobject_async_malloc(token->nodes_obj, thread_idx, NULL); \
|
||||
myhtml_token_node_clean(token_node)
|
||||
|
||||
struct myhtml_token_replacement_entry {
|
||||
char* from;
|
||||
size_t from_size;
|
||||
|
||||
char* to;
|
||||
size_t to_size;
|
||||
};
|
||||
|
||||
struct myhtml_token_namespace_replacement {
|
||||
char* from;
|
||||
size_t from_size;
|
||||
|
||||
char* to;
|
||||
size_t to_size;
|
||||
|
||||
enum myhtml_namespace ns;
|
||||
};
|
||||
|
||||
struct myhtml_token_attr {
|
||||
myhtml_token_attr_t* next;
|
||||
myhtml_token_attr_t* prev;
|
||||
|
||||
myhtml_string_t key;
|
||||
myhtml_string_t value;
|
||||
|
||||
size_t raw_key_begin;
|
||||
size_t raw_key_length;
|
||||
size_t raw_value_begin;
|
||||
size_t raw_value_length;
|
||||
|
||||
enum myhtml_namespace ns;
|
||||
};
|
||||
|
||||
struct myhtml_token_node {
|
||||
myhtml_tag_id_t tag_id;
|
||||
|
||||
myhtml_string_t str;
|
||||
|
||||
size_t raw_begin;
|
||||
size_t raw_length;
|
||||
|
||||
size_t element_begin;
|
||||
size_t element_length;
|
||||
|
||||
myhtml_token_attr_t* attr_first;
|
||||
myhtml_token_attr_t* attr_last;
|
||||
|
||||
volatile enum myhtml_token_type type;
|
||||
};
|
||||
|
||||
struct myhtml_token {
|
||||
myhtml_tree_t* tree; // ref
|
||||
|
||||
mcobject_async_t* nodes_obj; // myhtml_token_node_t
|
||||
mcobject_async_t* attr_obj; // myhtml_token_attr_t
|
||||
|
||||
// def thread node id
|
||||
size_t mcasync_token_id;
|
||||
size_t mcasync_attr_id;
|
||||
|
||||
bool is_new_tmp;
|
||||
};
|
||||
|
||||
myhtml_token_t * myhtml_token_create(myhtml_tree_t* tree, size_t size);
|
||||
void myhtml_token_clean(myhtml_token_t* token);
|
||||
void myhtml_token_clean_all(myhtml_token_t* token);
|
||||
myhtml_token_t * myhtml_token_destroy(myhtml_token_t* token);
|
||||
|
||||
myhtml_tag_id_t myhtml_token_node_tag_id(myhtml_token_node_t *token_node);
|
||||
myhtml_position_t myhtml_token_node_raw_pasition(myhtml_token_node_t *token_node);
|
||||
myhtml_position_t myhtml_token_node_element_pasition(myhtml_token_node_t *token_node);
|
||||
|
||||
myhtml_tree_attr_t * myhtml_token_node_attribute_first(myhtml_token_node_t *token_node);
|
||||
myhtml_tree_attr_t * myhtml_token_node_attribute_last(myhtml_token_node_t *token_node);
|
||||
|
||||
const char * myhtml_token_node_text(myhtml_token_node_t *token_node, size_t *length);
|
||||
myhtml_string_t * myhtml_token_node_string(myhtml_token_node_t *token_node);
|
||||
|
||||
bool myhtml_token_node_is_close_self(myhtml_token_node_t *token_node);
|
||||
|
||||
void myhtml_token_node_clean(myhtml_token_node_t* node);
|
||||
void myhtml_token_attr_clean(myhtml_token_attr_t* attr);
|
||||
myhtml_token_attr_t * myhtml_token_attr_remove(myhtml_token_node_t* node, myhtml_token_attr_t* attr);
|
||||
myhtml_token_attr_t * myhtml_token_attr_remove_by_name(myhtml_token_node_t* node, const char* name, size_t name_length);
|
||||
void myhtml_token_attr_delete_all(myhtml_token_t* token, myhtml_token_node_t* node);
|
||||
void myhtml_token_delete(myhtml_token_t* token, myhtml_token_node_t* node);
|
||||
void myhtml_token_node_wait_for_done(myhtml_token_node_t* node);
|
||||
void myhtml_token_set_done(myhtml_token_node_t* node);
|
||||
|
||||
myhtml_token_attr_t * myhtml_token_attr_match(myhtml_token_t* token, myhtml_token_node_t* target, const char* key, size_t key_size, const char* value, size_t value_size);
|
||||
myhtml_token_attr_t * myhtml_token_attr_match_case(myhtml_token_t* token, myhtml_token_node_t* target, const char* key, size_t key_size, const char* value, size_t value_size);
|
||||
|
||||
bool myhtml_token_release_and_check_doctype_attributes(myhtml_token_t* token, myhtml_token_node_t* target, myhtml_tree_doctype_t* return_doctype);
|
||||
|
||||
void myhtml_token_adjust_mathml_attributes(myhtml_token_node_t* target);
|
||||
void myhtml_token_adjust_svg_attributes(myhtml_token_node_t* target);
|
||||
void myhtml_token_adjust_foreign_attributes(myhtml_token_node_t* target);
|
||||
|
||||
myhtml_token_attr_t * myhtml_token_node_attr_append(myhtml_token_t* token, myhtml_token_node_t* dest, const char* key, size_t key_len, const char* value, size_t value_len, size_t thread_idx);
|
||||
myhtml_token_attr_t * myhtml_token_node_attr_append_with_convert_encoding(myhtml_token_t* token, myhtml_token_node_t* dest, const char* key, size_t key_len, const char* value, size_t value_len, size_t thread_idx, myhtml_encoding_t encoding);
|
||||
void myhtml_token_node_text_append(myhtml_token_t* token, myhtml_token_node_t* dest, const char* text, size_t text_len);
|
||||
void myhtml_token_node_attr_copy(myhtml_token_t* token, myhtml_token_node_t* target, myhtml_token_node_t* dest, size_t thread_idx);
|
||||
void myhtml_token_node_attr_copy_with_check(myhtml_token_t* token, myhtml_token_node_t* target, myhtml_token_node_t* dest, size_t thread_idx);
|
||||
myhtml_token_node_t * myhtml_token_node_clone(myhtml_token_t* token, myhtml_token_node_t* node, size_t token_thread_idx, size_t attr_thread_idx);
|
||||
bool myhtml_token_attr_copy(myhtml_token_t* token, myhtml_token_attr_t* attr, myhtml_token_node_t* dest, size_t thread_idx);
|
||||
myhtml_token_attr_t * myhtml_token_attr_by_name(myhtml_token_node_t* node, const char* name, size_t name_size);
|
||||
bool myhtml_token_attr_compare(myhtml_token_node_t* target, myhtml_token_node_t* dest);
|
||||
myhtml_token_node_t * myhtml_token_merged_two_token_string(myhtml_tree_t* tree, myhtml_token_node_t* token_to, myhtml_token_node_t* token_from, bool cp_reverse);
|
||||
void myhtml_token_set_replacement_character_for_null_token(myhtml_tree_t* tree, myhtml_token_node_t* node);
|
||||
|
||||
void myhtml_token_print_param_by_idx(myhtml_tree_t* myhtml_tree, myhtml_token_node_t* node, FILE* out);
|
||||
void myhtml_token_print_by_idx(myhtml_tree_t* myhtml_tree, myhtml_token_node_t* node, FILE* out);
|
||||
void myhtml_token_print_attr(myhtml_tree_t* myhtml_tree, myhtml_token_node_t* node, FILE* out);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_token_h */
|
73
include/myhtml/tokenizer.h
Normal file
73
include/myhtml/tokenizer.h
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TOKENIZER_H
|
||||
#define MyHTML_TOKENIZER_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/tag.h>
|
||||
#include <myhtml/thread.h>
|
||||
#include <myhtml/tokenizer_doctype.h>
|
||||
#include <myhtml/tokenizer_script.h>
|
||||
#include <myhtml/tokenizer_end.h>
|
||||
|
||||
#define MyHTML_TOKENIZER_CHAR_OTHER '\000'
|
||||
#define MyHTML_TOKENIZER_CHAR_A_Z_a_z '\001'
|
||||
#define MyHTML_TOKENIZER_CHAR_WHITESPACE '\002'
|
||||
|
||||
#define myhtml_tokenizer_inc_html_offset(offset, size) \
|
||||
offset++; \
|
||||
if(offset >= size) \
|
||||
return offset
|
||||
|
||||
myhtml_status_t myhtml_tokenizer_begin(myhtml_tree_t* tree, const char* html, size_t html_length);
|
||||
myhtml_status_t myhtml_tokenizer_chunk(myhtml_tree_t* tree, const char* html, size_t html_length);
|
||||
myhtml_status_t myhtml_tokenizer_chunk_with_stream_buffer(myhtml_tree_t* tree, const char* html, size_t html_length);
|
||||
myhtml_status_t myhtml_tokenizer_end(myhtml_tree_t* tree);
|
||||
void myhtml_tokenizer_set_state(myhtml_tree_t* tree, myhtml_token_node_t* token_node);
|
||||
|
||||
void myhtml_tokenizer_calc_current_namespace(myhtml_tree_t* tree, myhtml_token_node_t* token_node);
|
||||
|
||||
myhtml_tree_node_t * myhtml_tokenizer_fragment_init(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, enum myhtml_namespace ns);
|
||||
|
||||
void myhtml_tokenizer_wait(myhtml_tree_t* tree);
|
||||
void myhtml_tokenizer_post(myhtml_tree_t* tree);
|
||||
void myhtml_tokenizer_pause(myhtml_tree_t* tree);
|
||||
|
||||
myhtml_status_t myhtml_tokenizer_state_init(myhtml_t* myhtml);
|
||||
void myhtml_tokenizer_state_destroy(myhtml_t* myhtml);
|
||||
|
||||
myhtml_token_node_t * myhtml_tokenizer_queue_create_text_node_if_need(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t absolute_html_offset, enum myhtml_token_type type);
|
||||
void myhtml_check_tag_parser(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset);
|
||||
|
||||
size_t myhtml_tokenizer_state_bogus_comment(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
51
include/myhtml/tokenizer_doctype.h
Normal file
51
include/myhtml/tokenizer_doctype.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TOKENIZER_DOCTYPE_H
|
||||
#define MyHTML_TOKENIZER_DOCTYPE_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
|
||||
size_t myhtml_tokenizer_state_doctype(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_before_doctype_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_doctype_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_after_doctype_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_custom_after_doctype_name_a_z(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_before_doctype_public_identifier(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_doctype_public_identifier_double_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_doctype_public_identifier_single_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_after_doctype_public_identifier(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_doctype_system_identifier_double_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_doctype_system_identifier_single_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_after_doctype_system_identifier(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_bogus_doctype(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_tokenizer_doctype_h */
|
102
include/myhtml/tokenizer_end.h
Normal file
102
include/myhtml/tokenizer_end.h
Normal file
@ -0,0 +1,102 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TOKENIZER_END_H
|
||||
#define MyHTML_TOKENIZER_END_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/tokenizer.h>
|
||||
|
||||
size_t myhtml_tokenizer_end_state_data(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_self_closing_start_tag(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_markup_declaration_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_before_attribute_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_attribute_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_after_attribute_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_before_attribute_value(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_attribute_value_double_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_attribute_value_single_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_attribute_value_unquoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_comment_start(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_comment_start_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_comment(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_comment_end(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_comment_end_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_comment_end_bang(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_bogus_comment(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_cdata_section(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
size_t myhtml_tokenizer_end_state_rcdata(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_rcdata_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_rcdata_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_rcdata_end_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
size_t myhtml_tokenizer_end_state_rawtext(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_rawtext_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_rawtext_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_rawtext_end_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
size_t myhtml_tokenizer_end_state_plaintext(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_doctype(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_before_doctype_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_doctype_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_after_doctype_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_custom_after_doctype_name_a_z(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_before_doctype_public_identifier(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_doctype_public_identifier_double_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_doctype_public_identifier_single_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_after_doctype_public_identifier(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_doctype_system_identifier_double_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_doctype_system_identifier_single_quoted(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_after_doctype_system_identifier(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_bogus_doctype(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_end_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escape_start(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escape_start_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escaped(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escaped_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escaped_dash_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escaped_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escaped_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_escaped_end_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_double_escape_start(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_double_escaped(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_double_escaped_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_double_escaped_dash_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_double_escaped_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_end_state_script_data_double_escape_end(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_tokenizer_end_h */
|
57
include/myhtml/tokenizer_script.h
Normal file
57
include/myhtml/tokenizer_script.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TOKENIZER_SCRIPT_H
|
||||
#define MyHTML_TOKENIZER_SCRIPT_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/tokenizer.h>
|
||||
|
||||
size_t myhtml_tokenizer_state_script_data(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_end_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escape_start(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escape_start_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escaped(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escaped_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escaped_dash_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escaped_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escaped_end_tag_open(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_escaped_end_tag_name(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_double_escape_start(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_double_escaped(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_double_escaped_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_double_escaped_dash_dash(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_double_escaped_less_than_sign(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
size_t myhtml_tokenizer_state_script_data_double_escape_end(myhtml_tree_t* tree, myhtml_token_node_t* token_node, const char* html, size_t html_offset, size_t html_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_tokenizer_script_h */
|
426
include/myhtml/tree.h
Normal file
426
include/myhtml/tree.h
Normal file
@ -0,0 +1,426 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_TREE_H
|
||||
#define MyHTML_TREE_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/myhtml.h>
|
||||
#include <myhtml/mystring.h>
|
||||
#include <myhtml/token.h>
|
||||
#include <myhtml/stream.h>
|
||||
#include <myhtml/utils/mcsync.h>
|
||||
#include <myhtml/utils/mchar_async.h>
|
||||
#include <myhtml/utils/mcobject.h>
|
||||
#include <myhtml/utils/mcobject_async.h>
|
||||
|
||||
#define myhtml_tree_get(tree, attr) tree->attr
|
||||
#define myhtml_tree_set(tree, attr) tree->attr
|
||||
|
||||
#define myhtml_tree_token_current(tree) myhtml_tree_get(tree, token_current)
|
||||
#define myhtml_tree_token_attr_current(tree) myhtml_tree_get(tree, attr_current)
|
||||
|
||||
#define myhtml_tree_node_get(tree, node_id, attr) tree->nodes[node_id].attr
|
||||
|
||||
#define myhtml_tree_node_callback_insert(tree, node) \
|
||||
if(tree->callback_tree_node_insert) \
|
||||
tree->callback_tree_node_insert(tree, node, tree->callback_tree_node_insert_ctx)
|
||||
|
||||
#define myhtml_tree_node_callback_remove(tree, node) \
|
||||
if(tree->callback_tree_node_remove) \
|
||||
tree->callback_tree_node_remove(tree, node, tree->callback_tree_node_remove_ctx)
|
||||
|
||||
enum myhtml_tree_node_type {
|
||||
MyHTML_TYPE_NONE = 0,
|
||||
MyHTML_TYPE_BLOCK = 1,
|
||||
MyHTML_TYPE_INLINE = 2,
|
||||
MyHTML_TYPE_TABLE = 3,
|
||||
MyHTML_TYPE_META = 4,
|
||||
MyHTML_TYPE_COMMENT = 5
|
||||
};
|
||||
|
||||
enum myhtml_close_type {
|
||||
MyHTML_CLOSE_TYPE_NONE = 0,
|
||||
MyHTML_CLOSE_TYPE_NOW = 1,
|
||||
MyHTML_CLOSE_TYPE_SELF = 2,
|
||||
MyHTML_CLOSE_TYPE_BLOCK = 3
|
||||
};
|
||||
|
||||
enum myhtml_tree_node_flags {
|
||||
MyHTML_TREE_NODE_UNDEF = 0,
|
||||
MyHTML_TREE_NODE_PARSER_INSERTED = 1,
|
||||
MyHTML_TREE_NODE_BLOCKING = 2
|
||||
};
|
||||
|
||||
struct myhtml_tree_node {
|
||||
enum myhtml_tree_node_flags flags;
|
||||
|
||||
myhtml_tag_id_t tag_id;
|
||||
enum myhtml_namespace ns;
|
||||
|
||||
myhtml_tree_node_t* prev; // предыдущий ид элемента этого же уровня
|
||||
myhtml_tree_node_t* next; // следеющий ид эелента этого же уровня
|
||||
myhtml_tree_node_t* child; // ид чилда
|
||||
myhtml_tree_node_t* parent; // ид родителя
|
||||
|
||||
myhtml_tree_node_t* last_child; //
|
||||
|
||||
myhtml_token_node_t* token;
|
||||
};
|
||||
|
||||
enum myhtml_tree_compat_mode {
|
||||
MyHTML_TREE_COMPAT_MODE_NO_QUIRKS = 0x00,
|
||||
MyHTML_TREE_COMPAT_MODE_QUIRKS = 0x01,
|
||||
MyHTML_TREE_COMPAT_MODE_LIMITED_QUIRKS = 0x02
|
||||
};
|
||||
|
||||
enum myhtml_tree_doctype_id {
|
||||
MyHTML_TREE_DOCTYPE_ID_NAME = 0x00,
|
||||
MyHTML_TREE_DOCTYPE_ID_SYSTEM = 0x01,
|
||||
MyHTML_TREE_DOCTYPE_ID_PUBLIC = 0x02
|
||||
};
|
||||
|
||||
enum myhtml_tree_insertion_mode {
|
||||
MyHTML_TREE_INSERTION_MODE_DEFAULT = 0x00,
|
||||
MyHTML_TREE_INSERTION_MODE_BEFORE = 0x01,
|
||||
MyHTML_TREE_INSERTION_MODE_AFTER = 0x02
|
||||
};
|
||||
|
||||
struct myhtml_async_args {
|
||||
size_t mchar_node_id;
|
||||
};
|
||||
|
||||
struct myhtml_tree_doctype {
|
||||
bool is_html;
|
||||
char* attr_name;
|
||||
char* attr_public;
|
||||
char* attr_system;
|
||||
};
|
||||
|
||||
struct myhtml_tree_indexes {
|
||||
myhtml_tag_index_t* tags;
|
||||
};
|
||||
|
||||
struct myhtml_tree_list {
|
||||
myhtml_tree_node_t** list;
|
||||
volatile size_t length;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct myhtml_tree_token_list {
|
||||
myhtml_token_node_t** list;
|
||||
size_t length;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct myhtml_tree_insertion_list {
|
||||
enum myhtml_insertion_mode* list;
|
||||
size_t length;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct myhtml_tree_temp_tag_name {
|
||||
char *data;
|
||||
size_t length;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct myhtml_tree_special_token {
|
||||
myhtml_token_node_t *token;
|
||||
myhtml_namespace_t ns;
|
||||
}
|
||||
typedef myhtml_tree_special_token_t;
|
||||
|
||||
struct myhtml_tree_special_token_list {
|
||||
myhtml_tree_special_token_t *list;
|
||||
size_t length;
|
||||
size_t size;
|
||||
}
|
||||
typedef myhtml_tree_special_token_list_t;
|
||||
|
||||
struct myhtml_tree_temp_stream {
|
||||
struct myhtml_tree_temp_tag_name** data;
|
||||
size_t length;
|
||||
size_t size;
|
||||
|
||||
myhtml_encoding_result_t res;
|
||||
struct myhtml_tree_temp_tag_name* current;
|
||||
};
|
||||
|
||||
struct myhtml_tree {
|
||||
// ref
|
||||
myhtml_t* myhtml;
|
||||
mchar_async_t* mchar;
|
||||
myhtml_token_t* token;
|
||||
mcobject_async_t* tree_obj;
|
||||
mcsync_t* sync;
|
||||
mythread_queue_list_entry_t* queue_entry;
|
||||
mythread_queue_t* queue;
|
||||
myhtml_tag_t* tags;
|
||||
void* modest;
|
||||
|
||||
// init id's
|
||||
size_t mcasync_token_id;
|
||||
size_t mcasync_attr_id;
|
||||
size_t mcasync_tree_id;
|
||||
size_t mchar_node_id;
|
||||
myhtml_token_attr_t* attr_current;
|
||||
myhtml_tag_id_t tmp_tag_id;
|
||||
myhtml_token_node_t* current_token_node;
|
||||
mythread_queue_node_t* current_qnode;
|
||||
|
||||
mcobject_t* mcobject_incoming_buf;
|
||||
myhtml_incoming_buffer_t* incoming_buf;
|
||||
myhtml_incoming_buffer_t* incoming_buf_first;
|
||||
|
||||
myhtml_tree_indexes_t* indexes;
|
||||
|
||||
// ref for nodes
|
||||
myhtml_tree_node_t* document;
|
||||
myhtml_tree_node_t* fragment;
|
||||
myhtml_tree_node_t* node_head;
|
||||
myhtml_tree_node_t* node_html;
|
||||
myhtml_tree_node_t* node_body;
|
||||
myhtml_tree_node_t* node_form;
|
||||
myhtml_tree_doctype_t doctype;
|
||||
|
||||
// for build tree
|
||||
myhtml_tree_list_t* active_formatting;
|
||||
myhtml_tree_list_t* open_elements;
|
||||
myhtml_tree_list_t* other_elements;
|
||||
myhtml_tree_token_list_t* token_list;
|
||||
myhtml_tree_insertion_list_t* template_insertion;
|
||||
myhtml_async_args_t* async_args;
|
||||
myhtml_stream_buffer_t* stream_buffer;
|
||||
myhtml_token_node_t* volatile token_last_done;
|
||||
|
||||
// for detect namespace out of tree builder
|
||||
myhtml_token_node_t* token_namespace;
|
||||
|
||||
// tree params
|
||||
enum myhtml_tokenizer_state state;
|
||||
enum myhtml_tokenizer_state state_of_builder;
|
||||
enum myhtml_insertion_mode insert_mode;
|
||||
enum myhtml_insertion_mode orig_insert_mode;
|
||||
enum myhtml_tree_compat_mode compat_mode;
|
||||
volatile enum myhtml_tree_flags flags;
|
||||
volatile myhtml_tree_parse_flags_t parse_flags;
|
||||
bool foster_parenting;
|
||||
size_t global_offset;
|
||||
|
||||
myhtml_encoding_t encoding;
|
||||
myhtml_encoding_t encoding_usereq;
|
||||
myhtml_tree_temp_tag_name_t temp_tag_name;
|
||||
|
||||
/* callback */
|
||||
myhtml_callback_token_f callback_before_token;
|
||||
myhtml_callback_token_f callback_after_token;
|
||||
|
||||
void* callback_before_token_ctx;
|
||||
void* callback_after_token_ctx;
|
||||
|
||||
myhtml_callback_tree_node_f callback_tree_node_insert;
|
||||
myhtml_callback_tree_node_f callback_tree_node_remove;
|
||||
|
||||
void* callback_tree_node_insert_ctx;
|
||||
void* callback_tree_node_remove_ctx;
|
||||
};
|
||||
|
||||
// base
|
||||
myhtml_tree_t * myhtml_tree_create(void);
|
||||
myhtml_status_t myhtml_tree_init(myhtml_tree_t* tree, myhtml_t* myhtml);
|
||||
void myhtml_tree_clean(myhtml_tree_t* tree);
|
||||
void myhtml_tree_clean_all(myhtml_tree_t* tree);
|
||||
myhtml_tree_t * myhtml_tree_destroy(myhtml_tree_t* tree);
|
||||
|
||||
/* parse flags */
|
||||
myhtml_tree_parse_flags_t myhtml_tree_parse_flags(myhtml_tree_t* tree);
|
||||
void myhtml_tree_parse_flags_set(myhtml_tree_t* tree, myhtml_tree_parse_flags_t flags);
|
||||
|
||||
myhtml_t * myhtml_tree_get_myhtml(myhtml_tree_t* tree);
|
||||
myhtml_tag_t * myhtml_tree_get_tag(myhtml_tree_t* tree);
|
||||
myhtml_tag_index_t * myhtml_tree_get_tag_index(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_tree_get_document(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_tree_get_node_html(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_tree_get_node_head(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_tree_get_node_body(myhtml_tree_t* tree);
|
||||
|
||||
mchar_async_t * myhtml_tree_get_mchar(myhtml_tree_t* tree);
|
||||
size_t myhtml_tree_get_mchar_node_id(myhtml_tree_t* tree);
|
||||
|
||||
// list
|
||||
myhtml_tree_list_t * myhtml_tree_list_init(void);
|
||||
void myhtml_tree_list_clean(myhtml_tree_list_t* list);
|
||||
myhtml_tree_list_t * myhtml_tree_list_destroy(myhtml_tree_list_t* list, bool destroy_self);
|
||||
|
||||
void myhtml_tree_list_append(myhtml_tree_list_t* list, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_list_append_after_index(myhtml_tree_list_t* list, myhtml_tree_node_t* node, size_t index);
|
||||
void myhtml_tree_list_insert_by_index(myhtml_tree_list_t* list, myhtml_tree_node_t* node, size_t index);
|
||||
myhtml_tree_node_t * myhtml_tree_list_current_node(myhtml_tree_list_t* list);
|
||||
|
||||
// token list
|
||||
myhtml_tree_token_list_t * myhtml_tree_token_list_init(void);
|
||||
void myhtml_tree_token_list_clean(myhtml_tree_token_list_t* list);
|
||||
myhtml_tree_token_list_t * myhtml_tree_token_list_destroy(myhtml_tree_token_list_t* list, bool destroy_self);
|
||||
|
||||
void myhtml_tree_token_list_append(myhtml_tree_token_list_t* list, myhtml_token_node_t* token);
|
||||
void myhtml_tree_token_list_append_after_index(myhtml_tree_token_list_t* list, myhtml_token_node_t* token, size_t index);
|
||||
myhtml_token_node_t * myhtml_tree_token_list_current_node(myhtml_tree_token_list_t* list);
|
||||
|
||||
// active formatting
|
||||
myhtml_tree_list_t * myhtml_tree_active_formatting_init(myhtml_tree_t* tree);
|
||||
void myhtml_tree_active_formatting_clean(myhtml_tree_t* tree);
|
||||
myhtml_tree_list_t * myhtml_tree_active_formatting_destroy(myhtml_tree_t* tree);
|
||||
|
||||
bool myhtml_tree_active_formatting_is_marker(myhtml_tree_t* tree, myhtml_tree_node_t* idx);
|
||||
myhtml_tree_node_t* myhtml_tree_active_formatting_between_last_marker(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, size_t* return_idx);
|
||||
|
||||
void myhtml_tree_active_formatting_append(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_active_formatting_append_with_check(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_active_formatting_pop(myhtml_tree_t* tree);
|
||||
void myhtml_tree_active_formatting_remove(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_active_formatting_remove_by_index(myhtml_tree_t* tree, size_t idx);
|
||||
|
||||
void myhtml_tree_active_formatting_reconstruction(myhtml_tree_t* tree);
|
||||
void myhtml_tree_active_formatting_up_to_last_marker(myhtml_tree_t* tree);
|
||||
|
||||
bool myhtml_tree_active_formatting_find(myhtml_tree_t* tree, myhtml_tree_node_t* idx, size_t* return_idx);
|
||||
myhtml_tree_node_t* myhtml_tree_active_formatting_current_node(myhtml_tree_t* tree);
|
||||
|
||||
// open elements
|
||||
myhtml_tree_list_t * myhtml_tree_open_elements_init(myhtml_tree_t* tree);
|
||||
void myhtml_tree_open_elements_clean(myhtml_tree_t* tree);
|
||||
myhtml_tree_list_t * myhtml_tree_open_elements_destroy(myhtml_tree_t* tree);
|
||||
|
||||
myhtml_tree_node_t* myhtml_tree_current_node(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_tree_adjusted_current_node(myhtml_tree_t* tree);
|
||||
|
||||
void myhtml_tree_open_elements_append(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_open_elements_append_after_index(myhtml_tree_t* tree, myhtml_tree_node_t* node, size_t index);
|
||||
void myhtml_tree_open_elements_pop(myhtml_tree_t* tree);
|
||||
void myhtml_tree_open_elements_pop_until(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, myhtml_namespace_t mynamespace, bool is_exclude);
|
||||
void myhtml_tree_open_elements_pop_until_by_node(myhtml_tree_t* tree, myhtml_tree_node_t* node_idx, bool is_exclude);
|
||||
void myhtml_tree_open_elements_pop_until_by_index(myhtml_tree_t* tree, size_t idx, bool is_exclude);
|
||||
void myhtml_tree_open_elements_remove(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
|
||||
bool myhtml_tree_open_elements_find(myhtml_tree_t* tree, myhtml_tree_node_t* idx, size_t* pos);
|
||||
bool myhtml_tree_open_elements_find_reverse(myhtml_tree_t* tree, myhtml_tree_node_t* idx, size_t* pos);
|
||||
myhtml_tree_node_t * myhtml_tree_open_elements_find_by_tag_idx(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, myhtml_namespace_t mynamespace, size_t* return_index);
|
||||
myhtml_tree_node_t * myhtml_tree_open_elements_find_by_tag_idx_reverse(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, myhtml_namespace_t mynamespace, size_t* return_index);
|
||||
myhtml_tree_node_t * myhtml_tree_element_in_scope(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, myhtml_namespace_t mynamespace, enum myhtml_tag_categories category);
|
||||
bool myhtml_tree_element_in_scope_by_node(myhtml_tree_t* tree, myhtml_tree_node_t* node, enum myhtml_tag_categories category);
|
||||
void myhtml_tree_generate_implied_end_tags(myhtml_tree_t* tree, myhtml_tag_id_t exclude_tag_idx, myhtml_namespace_t mynamespace);
|
||||
void myhtml_tree_generate_all_implied_end_tags(myhtml_tree_t* tree, myhtml_tag_id_t exclude_tag_idx, myhtml_namespace_t mynamespace);
|
||||
myhtml_tree_node_t * myhtml_tree_appropriate_place_inserting(myhtml_tree_t* tree, myhtml_tree_node_t* override_target, enum myhtml_tree_insertion_mode* mode);
|
||||
myhtml_tree_node_t * myhtml_tree_appropriate_place_inserting_in_tree(myhtml_tree_t* tree, myhtml_tree_node_t* target, enum myhtml_tree_insertion_mode* mode);
|
||||
|
||||
// template insertion
|
||||
myhtml_tree_insertion_list_t * myhtml_tree_template_insertion_init(myhtml_tree_t* tree);
|
||||
void myhtml_tree_template_insertion_clean(myhtml_tree_t* tree);
|
||||
myhtml_tree_insertion_list_t * myhtml_tree_template_insertion_destroy(myhtml_tree_t* tree);
|
||||
|
||||
void myhtml_tree_template_insertion_append(myhtml_tree_t* tree, enum myhtml_insertion_mode insert_mode);
|
||||
void myhtml_tree_template_insertion_pop(myhtml_tree_t* tree);
|
||||
|
||||
void myhtml_tree_reset_insertion_mode_appropriately(myhtml_tree_t* tree);
|
||||
|
||||
bool myhtml_tree_adoption_agency_algorithm(myhtml_tree_t* tree, myhtml_tag_id_t subject_tag_idx);
|
||||
size_t myhtml_tree_template_insertion_length(myhtml_tree_t* tree);
|
||||
|
||||
// other for a tree
|
||||
myhtml_tree_node_t * myhtml_tree_node_create(myhtml_tree_t* tree);
|
||||
void myhtml_tree_node_delete(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_node_delete_recursive(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_node_clean(myhtml_tree_node_t* tree_node);
|
||||
void myhtml_tree_node_free(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
myhtml_tree_node_t * myhtml_tree_node_clone(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
|
||||
void myhtml_tree_print_node(myhtml_tree_t* tree, myhtml_tree_node_t* node, FILE* out);
|
||||
void myhtml_tree_print_node_children(myhtml_tree_t* tree, myhtml_tree_node_t* node, FILE* out, size_t inc);
|
||||
void myhtml_tree_print_by_node(myhtml_tree_t* tree, myhtml_tree_node_t* node, FILE* out, size_t inc);
|
||||
|
||||
void myhtml_tree_node_add_child(myhtml_tree_t* myhtml_tree, myhtml_tree_node_t* root, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_node_insert_before(myhtml_tree_t* myhtml_tree, myhtml_tree_node_t* root, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_node_insert_after(myhtml_tree_t* myhtml_tree, myhtml_tree_node_t* root, myhtml_tree_node_t* node);
|
||||
void myhtml_tree_node_insert_by_mode(myhtml_tree_t* tree, myhtml_tree_node_t* adjusted_location, myhtml_tree_node_t* node, enum myhtml_tree_insertion_mode mode);
|
||||
myhtml_tree_node_t * myhtml_tree_node_remove(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_html_element(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_foreign_element(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_by_token(myhtml_tree_t* tree, myhtml_token_node_t* token, enum myhtml_namespace ns);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert(myhtml_tree_t* tree, myhtml_tag_id_t tag_idx, enum myhtml_namespace ns);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_by_node(myhtml_tree_t* tree, myhtml_tree_node_t* idx);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_comment(myhtml_tree_t* tree, myhtml_token_node_t* token, myhtml_tree_node_t* parent);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_doctype(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_root(myhtml_tree_t* tree, myhtml_token_node_t* token, enum myhtml_namespace ns);
|
||||
myhtml_tree_node_t * myhtml_tree_node_insert_text(myhtml_tree_t* tree, myhtml_token_node_t* token);
|
||||
myhtml_tree_node_t * myhtml_tree_node_find_parent_by_tag_id(myhtml_tree_node_t* node, myhtml_tag_id_t tag_id);
|
||||
|
||||
// indexes
|
||||
myhtml_tree_indexes_t * myhtml_tree_index_create(myhtml_tree_t* tree, myhtml_tag_t* tags);
|
||||
void myhtml_tree_index_clean(myhtml_tree_t* tree, myhtml_tag_t* tags);
|
||||
myhtml_tree_indexes_t * myhtml_tree_index_destroy(myhtml_tree_t* tree, myhtml_tag_t* tags);
|
||||
|
||||
void myhtml_tree_index_append(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
myhtml_tree_node_t * myhtml_tree_index_get(myhtml_tree_t* tree, myhtml_tag_id_t tag_id);
|
||||
|
||||
// other
|
||||
void myhtml_tree_wait_for_last_done_token(myhtml_tree_t* tree, myhtml_token_node_t* token_for_wait);
|
||||
|
||||
void myhtml_tree_tags_close_p(myhtml_tree_t* tree);
|
||||
myhtml_tree_node_t * myhtml_tree_generic_raw_text_element_parsing_algorithm(myhtml_tree_t* tree, myhtml_token_node_t* token_node);
|
||||
void myhtml_tree_clear_stack_back_table_context(myhtml_tree_t* tree);
|
||||
void myhtml_tree_clear_stack_back_table_body_context(myhtml_tree_t* tree);
|
||||
void myhtml_tree_clear_stack_back_table_row_context(myhtml_tree_t* tree);
|
||||
void myhtml_tree_close_cell(myhtml_tree_t* tree, myhtml_tree_node_t* tr_or_th_node);
|
||||
|
||||
bool myhtml_tree_is_mathml_integration_point(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
bool myhtml_tree_is_html_integration_point(myhtml_tree_t* tree, myhtml_tree_node_t* node);
|
||||
|
||||
// temp tag name
|
||||
myhtml_status_t myhtml_tree_temp_tag_name_init(myhtml_tree_temp_tag_name_t* temp_tag_name);
|
||||
void myhtml_tree_temp_tag_name_clean(myhtml_tree_temp_tag_name_t* temp_tag_name);
|
||||
myhtml_tree_temp_tag_name_t * myhtml_tree_temp_tag_name_destroy(myhtml_tree_temp_tag_name_t* temp_tag_name, bool self_destroy);
|
||||
myhtml_status_t myhtml_tree_temp_tag_name_append(myhtml_tree_temp_tag_name_t* temp_tag_name, const char* name, size_t name_len);
|
||||
myhtml_status_t myhtml_tree_temp_tag_name_append_one(myhtml_tree_temp_tag_name_t* temp_tag_name, const char name);
|
||||
|
||||
/* special tonek list */
|
||||
myhtml_status_t myhtml_tree_special_list_init(myhtml_tree_special_token_list_t* special);
|
||||
myhtml_status_t myhtml_tree_special_list_append(myhtml_tree_special_token_list_t* special, myhtml_token_node_t *token, myhtml_namespace_t ns);
|
||||
size_t myhtml_tree_special_list_length(myhtml_tree_special_token_list_t* special);
|
||||
myhtml_tree_special_token_t * myhtml_tree_special_list_get_last(myhtml_tree_special_token_list_t* special);
|
||||
size_t myhtml_tree_special_list_pop(myhtml_tree_special_token_list_t* special);
|
||||
|
||||
/* incoming buffer */
|
||||
myhtml_incoming_buffer_t * myhtml_tree_incoming_buffer_first(myhtml_tree_t *tree);
|
||||
const char * myhtml_tree_incomming_buffer_make_data(myhtml_tree_t *tree, size_t begin, size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* myhtml_tree_h */
|
||||
|
||||
|
48
include/myhtml/utils.h
Normal file
48
include/myhtml/utils.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_UTILS_H
|
||||
#define MyHTML_UTILS_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
|
||||
#define myhtml_utils_whithspace(onechar, action, logic) \
|
||||
(onechar action ' ' logic \
|
||||
onechar action '\t' logic \
|
||||
onechar action '\n' logic \
|
||||
onechar action '\f' logic \
|
||||
onechar action '\r')
|
||||
|
||||
size_t myhtml_strncasecmp(const char* str1, const char* str2, size_t size);
|
||||
size_t myhtml_strcasecmp(const char* str1, const char* str2);
|
||||
size_t myhtml_strncmp(const char* str1, const char* str2, size_t size);
|
||||
size_t myhtml_strcmp(const char* str1, const char* str2);
|
||||
size_t myhtml_strcmp_ws(const char* str1, const char* str2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* utils_h */
|
129
include/myhtml/utils/mchar_async.h
Normal file
129
include/myhtml/utils/mchar_async.h
Normal file
@ -0,0 +1,129 @@
|
||||
/*
|
||||
Copyright (C) 2015-2016 Alexander Borisov
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Author: lex.borisov@gmail.com (Alexander Borisov)
|
||||
*/
|
||||
|
||||
#ifndef MyHTML_UTILS_MCHAR_ASYNC_H
|
||||
#define MyHTML_UTILS_MCHAR_ASYNC_H
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <myhtml/myosi.h>
|
||||
#include <myhtml/utils/mcsync.h>
|
||||
|
||||
#define mchar_async_cache_has_nodes(cache) cache.count
|
||||
|
||||
typedef struct mchar_async_node mchar_async_node_t;
|
||||
|
||||
struct mchar_async_cache_node {
|
||||
void *value;
|
||||
size_t size;
|
||||
|
||||
size_t left;
|
||||
size_t right;
|
||||
size_t parent;
|
||||
}
|
||||
typedef mchar_async_cache_node_t;
|
||||
|
||||
struct mchar_async_chunk {
|
||||
char *begin;
|
||||
size_t length;
|
||||
size_t size;
|
||||
|
||||
struct mchar_async_chunk *next;
|
||||
struct mchar_async_chunk *prev;
|
||||
}
|
||||
typedef mchar_async_chunk_t;
|
||||
|
||||
struct mchar_async_cache {
|
||||
mchar_async_cache_node_t *nodes;
|
||||
size_t nodes_size;
|
||||
size_t nodes_length;
|
||||
size_t nodes_root;
|
||||
|
||||
size_t count;
|
||||
|
||||
size_t *index;
|
||||
size_t index_length;
|
||||
size_t index_size;
|
||||
}
|
||||
typedef mchar_async_cache_t;
|
||||
|
||||
struct mchar_async_node {
|
||||
mchar_async_chunk_t *chunk;
|
||||
mchar_async_cache_t cache;
|
||||
};
|
||||
|
||||
struct mchar_async {
|
||||
size_t origin_size;
|
||||
|
||||
mchar_async_chunk_t **chunks;
|
||||
size_t chunks_pos_size;
|
||||
size_t chunks_pos_length;
|
||||
size_t chunks_size;
|
||||
size_t chunks_length;
|
||||
|
||||
mchar_async_cache_t chunk_cache;
|
||||
|
||||
mchar_async_node_t *nodes;
|
||||
size_t nodes_length;
|
||||
size_t nodes_size;
|
||||
|
||||
size_t *nodes_cache;
|
||||
size_t nodes_cache_length;
|
||||
size_t nodes_cache_size;
|
||||
|
||||
mcsync_t *mcsync;
|
||||
}
|
||||
typedef mchar_async_t;
|
||||
|
||||
|
||||
mchar_async_t * mchar_async_create(size_t pos_size, size_t size);
|
||||
void mchar_async_init(mchar_async_t *mchar_async, size_t chunk_len, size_t char_size);
|
||||
void mchar_async_clean(mchar_async_t *mchar_async);
|
||||
mchar_async_t * mchar_async_destroy(mchar_async_t *mchar_async, int destroy_self);
|
||||
|
||||
char * mchar_async_malloc(mchar_async_t *mchar_async, size_t node_idx, size_t size);
|
||||
char * mchar_async_realloc(mchar_async_t *mchar_async, size_t node_idx, char *data, size_t data_len, size_t new_size);
|
||||
void mchar_async_free(mchar_async_t *mchar_async, size_t node_idx, char *entry);
|
||||
|
||||
size_t mchar_async_node_add(mchar_async_t *mchar_async);
|
||||
void mchar_async_node_clean(mchar_async_t *mchar_async, size_t node_idx);
|
||||
void mchar_async_node_delete(mchar_async_t *mchar_async, size_t node_idx);
|
||||
|
||||
mchar_async_chunk_t * mchar_async_chunk_malloc(mchar_async_t *mchar_async, mchar_async_node_t *node, size_t length);
|
||||
char * mchar_async_crop_first_chars(mchar_async_t *mchar_async, size_t node_idx, char *data, size_t crop_len);
|
||||
char * mchar_async_crop_first_chars_without_cache(char *data, size_t crop_len);
|
||||
|
||||
// cache
|
||||
void mchar_async_cache_init(mchar_async_cache_t *cache);
|
||||
mchar_async_cache_t * mchar_async_cache_destroy(mchar_async_cache_t *cache, bool self_destroy);
|
||||
void mchar_async_cache_clean(mchar_async_cache_t *cache);
|
||||
|
||||
void mchar_async_cache_add(mchar_async_cache_t *cache, void* value, size_t size);
|
||||
size_t mchar_async_cache_delete(mchar_async_cache_t *cache, size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* mchar_async_h */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user