Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/INSTALLER +1 -0
- llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/LICENSE +29 -0
- llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/METADATA +167 -0
- llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/RECORD +104 -0
- llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/WHEEL +5 -0
- llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/top_level.txt +1 -0
- llmeval-env/lib/python3.10/site-packages/fsspec/caching.py +881 -0
- llmeval-env/lib/python3.10/site-packages/fsspec/dircache.py +98 -0
- llmeval-env/lib/python3.10/site-packages/fsspec/generic.py +408 -0
- llmeval-env/lib/python3.10/site-packages/fsspec/mapping.py +251 -0
- llmeval-env/lib/python3.10/site-packages/fsspec/registry.py +301 -0
- llmeval-env/lib/python3.10/site-packages/fsspec/utils.py +742 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/INSTALLER +1 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/LICENSE +201 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/METADATA +300 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/RECORD +224 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/WHEEL +5 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/entry_points.txt +6 -0
- llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/top_level.txt +1 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/__init__.py +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/libcharset.h +45 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/localcharset.h +137 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/zconf.h +543 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/zlib.h +1938 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/__init__.py +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/exslt.h +108 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/exsltconfig.h +70 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/exsltexports.h +63 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/SAX.h +202 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/SAX2.h +171 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/__init__.py +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/c14n.h +126 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/catalog.h +182 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/chvalid.h +230 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/debugXML.h +217 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/entities.h +155 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/hash.h +232 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/list.h +137 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/nanoftp.h +186 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/nanohttp.h +81 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/relaxng.h +219 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/schemasInternals.h +959 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/threads.h +87 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/tree.h +1362 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/uri.h +95 -0
- llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/xinclude.h +129 -0
llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
BSD 3-Clause License
|
2 |
+
|
3 |
+
Copyright (c) 2018, Martin Durant
|
4 |
+
All rights reserved.
|
5 |
+
|
6 |
+
Redistribution and use in source and binary forms, with or without
|
7 |
+
modification, are permitted provided that the following conditions are met:
|
8 |
+
|
9 |
+
* Redistributions of source code must retain the above copyright notice, this
|
10 |
+
list of conditions and the following disclaimer.
|
11 |
+
|
12 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
13 |
+
this list of conditions and the following disclaimer in the documentation
|
14 |
+
and/or other materials provided with the distribution.
|
15 |
+
|
16 |
+
* Neither the name of the copyright holder nor the names of its
|
17 |
+
contributors may be used to endorse or promote products derived from
|
18 |
+
this software without specific prior written permission.
|
19 |
+
|
20 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
24 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/METADATA
ADDED
@@ -0,0 +1,167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: fsspec
|
3 |
+
Version: 2024.3.1
|
4 |
+
Summary: File-system specification
|
5 |
+
Home-page: https://github.com/fsspec/filesystem_spec
|
6 |
+
Maintainer: Martin Durant
|
7 |
+
Maintainer-email: [email protected]
|
8 |
+
License: BSD
|
9 |
+
Project-URL: Changelog, https://filesystem-spec.readthedocs.io/en/latest/changelog.html
|
10 |
+
Project-URL: Documentation, https://filesystem-spec.readthedocs.io/en/latest/
|
11 |
+
Keywords: file
|
12 |
+
Classifier: Development Status :: 4 - Beta
|
13 |
+
Classifier: Intended Audience :: Developers
|
14 |
+
Classifier: License :: OSI Approved :: BSD License
|
15 |
+
Classifier: Operating System :: OS Independent
|
16 |
+
Classifier: Programming Language :: Python :: 3.8
|
17 |
+
Classifier: Programming Language :: Python :: 3.9
|
18 |
+
Classifier: Programming Language :: Python :: 3.10
|
19 |
+
Classifier: Programming Language :: Python :: 3.11
|
20 |
+
Requires-Python: >=3.8
|
21 |
+
Description-Content-Type: text/markdown
|
22 |
+
License-File: LICENSE
|
23 |
+
Provides-Extra: abfs
|
24 |
+
Requires-Dist: adlfs ; extra == 'abfs'
|
25 |
+
Provides-Extra: adl
|
26 |
+
Requires-Dist: adlfs ; extra == 'adl'
|
27 |
+
Provides-Extra: arrow
|
28 |
+
Requires-Dist: pyarrow >=1 ; extra == 'arrow'
|
29 |
+
Provides-Extra: dask
|
30 |
+
Requires-Dist: dask ; extra == 'dask'
|
31 |
+
Requires-Dist: distributed ; extra == 'dask'
|
32 |
+
Provides-Extra: devel
|
33 |
+
Requires-Dist: pytest ; extra == 'devel'
|
34 |
+
Requires-Dist: pytest-cov ; extra == 'devel'
|
35 |
+
Provides-Extra: dropbox
|
36 |
+
Requires-Dist: dropboxdrivefs ; extra == 'dropbox'
|
37 |
+
Requires-Dist: requests ; extra == 'dropbox'
|
38 |
+
Requires-Dist: dropbox ; extra == 'dropbox'
|
39 |
+
Provides-Extra: entrypoints
|
40 |
+
Provides-Extra: full
|
41 |
+
Requires-Dist: adlfs ; extra == 'full'
|
42 |
+
Requires-Dist: aiohttp !=4.0.0a0,!=4.0.0a1 ; extra == 'full'
|
43 |
+
Requires-Dist: dask ; extra == 'full'
|
44 |
+
Requires-Dist: distributed ; extra == 'full'
|
45 |
+
Requires-Dist: dropbox ; extra == 'full'
|
46 |
+
Requires-Dist: dropboxdrivefs ; extra == 'full'
|
47 |
+
Requires-Dist: fusepy ; extra == 'full'
|
48 |
+
Requires-Dist: gcsfs ; extra == 'full'
|
49 |
+
Requires-Dist: libarchive-c ; extra == 'full'
|
50 |
+
Requires-Dist: ocifs ; extra == 'full'
|
51 |
+
Requires-Dist: panel ; extra == 'full'
|
52 |
+
Requires-Dist: paramiko ; extra == 'full'
|
53 |
+
Requires-Dist: pyarrow >=1 ; extra == 'full'
|
54 |
+
Requires-Dist: pygit2 ; extra == 'full'
|
55 |
+
Requires-Dist: requests ; extra == 'full'
|
56 |
+
Requires-Dist: s3fs ; extra == 'full'
|
57 |
+
Requires-Dist: smbprotocol ; extra == 'full'
|
58 |
+
Requires-Dist: tqdm ; extra == 'full'
|
59 |
+
Provides-Extra: fuse
|
60 |
+
Requires-Dist: fusepy ; extra == 'fuse'
|
61 |
+
Provides-Extra: gcs
|
62 |
+
Requires-Dist: gcsfs ; extra == 'gcs'
|
63 |
+
Provides-Extra: git
|
64 |
+
Requires-Dist: pygit2 ; extra == 'git'
|
65 |
+
Provides-Extra: github
|
66 |
+
Requires-Dist: requests ; extra == 'github'
|
67 |
+
Provides-Extra: gs
|
68 |
+
Requires-Dist: gcsfs ; extra == 'gs'
|
69 |
+
Provides-Extra: gui
|
70 |
+
Requires-Dist: panel ; extra == 'gui'
|
71 |
+
Provides-Extra: hdfs
|
72 |
+
Requires-Dist: pyarrow >=1 ; extra == 'hdfs'
|
73 |
+
Provides-Extra: http
|
74 |
+
Requires-Dist: aiohttp !=4.0.0a0,!=4.0.0a1 ; extra == 'http'
|
75 |
+
Provides-Extra: libarchive
|
76 |
+
Requires-Dist: libarchive-c ; extra == 'libarchive'
|
77 |
+
Provides-Extra: oci
|
78 |
+
Requires-Dist: ocifs ; extra == 'oci'
|
79 |
+
Provides-Extra: s3
|
80 |
+
Requires-Dist: s3fs ; extra == 's3'
|
81 |
+
Provides-Extra: sftp
|
82 |
+
Requires-Dist: paramiko ; extra == 'sftp'
|
83 |
+
Provides-Extra: smb
|
84 |
+
Requires-Dist: smbprotocol ; extra == 'smb'
|
85 |
+
Provides-Extra: ssh
|
86 |
+
Requires-Dist: paramiko ; extra == 'ssh'
|
87 |
+
Provides-Extra: tqdm
|
88 |
+
Requires-Dist: tqdm ; extra == 'tqdm'
|
89 |
+
|
90 |
+
# filesystem_spec
|
91 |
+
|
92 |
+
[](https://pypi.python.org/pypi/fsspec/)
|
93 |
+
[](https://anaconda.org/conda-forge/fsspec)
|
94 |
+

|
95 |
+
[](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
|
96 |
+
[](https://pepy.tech/project/fsspec)
|
97 |
+
|
98 |
+
A specification for pythonic filesystems.
|
99 |
+
|
100 |
+
## Install
|
101 |
+
|
102 |
+
```bash
|
103 |
+
pip install fsspec
|
104 |
+
```
|
105 |
+
|
106 |
+
would install the base fsspec. Various optionally supported features might require specification of custom
|
107 |
+
extra require, e.g. `pip install fsspec[ssh]` will install dependencies for `ssh` backends support.
|
108 |
+
Use `pip install fsspec[full]` for installation of all known extra dependencies.
|
109 |
+
|
110 |
+
Up-to-date package also provided through conda-forge distribution:
|
111 |
+
|
112 |
+
```bash
|
113 |
+
conda install -c conda-forge fsspec
|
114 |
+
```
|
115 |
+
|
116 |
+
|
117 |
+
## Purpose
|
118 |
+
|
119 |
+
To produce a template or specification for a file-system interface, that specific implementations should follow,
|
120 |
+
so that applications making use of them can rely on a common behaviour and not have to worry about the specific
|
121 |
+
internal implementation decisions with any given backend. Many such implementations are included in this package,
|
122 |
+
or in sister projects such as `s3fs` and `gcsfs`.
|
123 |
+
|
124 |
+
In addition, if this is well-designed, then additional functionality, such as a key-value store or FUSE
|
125 |
+
mounting of the file-system implementation may be available for all implementations "for free".
|
126 |
+
|
127 |
+
## Documentation
|
128 |
+
|
129 |
+
Please refer to [RTD](https://filesystem-spec.readthedocs.io/en/latest/?badge=latest)
|
130 |
+
|
131 |
+
## Develop
|
132 |
+
|
133 |
+
fsspec uses GitHub Actions for CI. Environment files can be found
|
134 |
+
in the "ci/" directory. Note that the main environment is called "py38",
|
135 |
+
but it is expected that the version of python installed be adjustable at
|
136 |
+
CI runtime. For local use, pick a version suitable for you.
|
137 |
+
|
138 |
+
### Testing
|
139 |
+
|
140 |
+
Tests can be run in the dev environment, if activated, via ``pytest fsspec``.
|
141 |
+
|
142 |
+
The full fsspec suite requires a system-level docker, docker-compose, and fuse
|
143 |
+
installation. If only making changes to one backend implementation, it is
|
144 |
+
not generally necessary to run all tests locally.
|
145 |
+
|
146 |
+
It is expected that contributors ensure that any change to fsspec does not
|
147 |
+
cause issues or regressions for either other fsspec-related packages such
|
148 |
+
as gcsfs and s3fs, nor for downstream users of fsspec. The "downstream" CI
|
149 |
+
run and corresponding environment file run a set of tests from the dask
|
150 |
+
test suite, and very minimal tests against pandas and zarr from the
|
151 |
+
test_downstream.py module in this repo.
|
152 |
+
|
153 |
+
### Code Formatting
|
154 |
+
|
155 |
+
fsspec uses [Black](https://black.readthedocs.io/en/stable) to ensure
|
156 |
+
a consistent code format throughout the project.
|
157 |
+
Run ``black fsspec`` from the root of the filesystem_spec repository to
|
158 |
+
auto-format your code. Additionally, many editors have plugins that will apply
|
159 |
+
``black`` as you edit files. ``black`` is included in the ``tox`` environments.
|
160 |
+
|
161 |
+
Optionally, you may wish to setup [pre-commit hooks](https://pre-commit.com) to
|
162 |
+
automatically run ``black`` when you make a git commit.
|
163 |
+
Run ``pre-commit install --install-hooks`` from the root of the
|
164 |
+
filesystem_spec repository to setup pre-commit hooks. ``black`` will now be run
|
165 |
+
before you commit, reformatting any changed files. You can format without
|
166 |
+
committing via ``pre-commit run`` or skip these checks with ``git commit
|
167 |
+
--no-verify``.
|
llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/RECORD
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fsspec-2024.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
2 |
+
fsspec-2024.3.1.dist-info/LICENSE,sha256=LcNUls5TpzB5FcAIqESq1T53K0mzTN0ARFBnaRQH7JQ,1513
|
3 |
+
fsspec-2024.3.1.dist-info/METADATA,sha256=Wv4QVGqB4lYfHfgP-Cfby1Nce57WYXXAhH0f6Ju5FUM,6786
|
4 |
+
fsspec-2024.3.1.dist-info/RECORD,,
|
5 |
+
fsspec-2024.3.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6 |
+
fsspec-2024.3.1.dist-info/top_level.txt,sha256=blt2pDrQDwN3Gklcw13CSPLQRd6aaOgJ8AxqrW395MI,7
|
7 |
+
fsspec/__init__.py,sha256=C8G5rqeNAes0NHYFhdxcw-ZMg4yDipqzSNc4NIR7uoc,2010
|
8 |
+
fsspec/__pycache__/__init__.cpython-310.pyc,,
|
9 |
+
fsspec/__pycache__/_version.cpython-310.pyc,,
|
10 |
+
fsspec/__pycache__/archive.cpython-310.pyc,,
|
11 |
+
fsspec/__pycache__/asyn.cpython-310.pyc,,
|
12 |
+
fsspec/__pycache__/caching.cpython-310.pyc,,
|
13 |
+
fsspec/__pycache__/callbacks.cpython-310.pyc,,
|
14 |
+
fsspec/__pycache__/compression.cpython-310.pyc,,
|
15 |
+
fsspec/__pycache__/config.cpython-310.pyc,,
|
16 |
+
fsspec/__pycache__/conftest.cpython-310.pyc,,
|
17 |
+
fsspec/__pycache__/core.cpython-310.pyc,,
|
18 |
+
fsspec/__pycache__/dircache.cpython-310.pyc,,
|
19 |
+
fsspec/__pycache__/exceptions.cpython-310.pyc,,
|
20 |
+
fsspec/__pycache__/fuse.cpython-310.pyc,,
|
21 |
+
fsspec/__pycache__/generic.cpython-310.pyc,,
|
22 |
+
fsspec/__pycache__/gui.cpython-310.pyc,,
|
23 |
+
fsspec/__pycache__/mapping.cpython-310.pyc,,
|
24 |
+
fsspec/__pycache__/parquet.cpython-310.pyc,,
|
25 |
+
fsspec/__pycache__/registry.cpython-310.pyc,,
|
26 |
+
fsspec/__pycache__/spec.cpython-310.pyc,,
|
27 |
+
fsspec/__pycache__/transaction.cpython-310.pyc,,
|
28 |
+
fsspec/__pycache__/utils.cpython-310.pyc,,
|
29 |
+
fsspec/_version.py,sha256=wHq_BWmvVWba6IeFL8lWxmbw1fXQhCR4NJHH8b77Nxs,500
|
30 |
+
fsspec/archive.py,sha256=S__DzfZj-urAN3tp2W6jJ6YDiXG1fAl7FjvWUN73qIE,2386
|
31 |
+
fsspec/asyn.py,sha256=AOd2SXH2YPCaQL5jA6IegYevdMFkAnGD7Seh9DC2gSE,36404
|
32 |
+
fsspec/caching.py,sha256=TrZqKo3drK9Afujg7grZRiLNcmgUr84rnvMcojzURnI,28819
|
33 |
+
fsspec/callbacks.py,sha256=BDIwLzK6rr_0V5ch557fSzsivCElpdqhXr5dZ9Te-EE,9210
|
34 |
+
fsspec/compression.py,sha256=Yyd8FXw2rwWRtVoRVah_yguv-J7BUcBo4yDu6Qt52a0,4859
|
35 |
+
fsspec/config.py,sha256=LF4Zmu1vhJW7Je9Q-cwkRc3xP7Rhyy7Xnwj26Z6sv2g,4279
|
36 |
+
fsspec/conftest.py,sha256=fVfx-NLrH_OZS1TIpYNoPzM7efEcMoL62reHOdYeFCA,1245
|
37 |
+
fsspec/core.py,sha256=kkwJ7IR3-i1C9SAZ_oGrPpbM5hqpBZ2OLkuHU5a1sYE,22471
|
38 |
+
fsspec/dircache.py,sha256=YzogWJrhEastHU7vWz-cJiJ7sdtLXFXhEpInGKd4EcM,2717
|
39 |
+
fsspec/exceptions.py,sha256=xcS7LiRrQ748kvOB9mrUR14kpjNztrHgEkZWi9M-VaI,330
|
40 |
+
fsspec/fuse.py,sha256=66amOa6wdIbS0DMhhfAPUoOB37HPorfXD1izV0prmTY,10145
|
41 |
+
fsspec/generic.py,sha256=jIA7wBwtUzJhTth78PTzWbOBjGom2e4IjmQ_KBSlHPg,13575
|
42 |
+
fsspec/gui.py,sha256=XKoXZpUhRE7jOhRCJH4-jRbKhVu56aS8h9tecvPD3nc,13932
|
43 |
+
fsspec/implementations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44 |
+
fsspec/implementations/__pycache__/__init__.cpython-310.pyc,,
|
45 |
+
fsspec/implementations/__pycache__/arrow.cpython-310.pyc,,
|
46 |
+
fsspec/implementations/__pycache__/cache_mapper.cpython-310.pyc,,
|
47 |
+
fsspec/implementations/__pycache__/cache_metadata.cpython-310.pyc,,
|
48 |
+
fsspec/implementations/__pycache__/cached.cpython-310.pyc,,
|
49 |
+
fsspec/implementations/__pycache__/dask.cpython-310.pyc,,
|
50 |
+
fsspec/implementations/__pycache__/data.cpython-310.pyc,,
|
51 |
+
fsspec/implementations/__pycache__/dbfs.cpython-310.pyc,,
|
52 |
+
fsspec/implementations/__pycache__/dirfs.cpython-310.pyc,,
|
53 |
+
fsspec/implementations/__pycache__/ftp.cpython-310.pyc,,
|
54 |
+
fsspec/implementations/__pycache__/git.cpython-310.pyc,,
|
55 |
+
fsspec/implementations/__pycache__/github.cpython-310.pyc,,
|
56 |
+
fsspec/implementations/__pycache__/http.cpython-310.pyc,,
|
57 |
+
fsspec/implementations/__pycache__/jupyter.cpython-310.pyc,,
|
58 |
+
fsspec/implementations/__pycache__/libarchive.cpython-310.pyc,,
|
59 |
+
fsspec/implementations/__pycache__/local.cpython-310.pyc,,
|
60 |
+
fsspec/implementations/__pycache__/memory.cpython-310.pyc,,
|
61 |
+
fsspec/implementations/__pycache__/reference.cpython-310.pyc,,
|
62 |
+
fsspec/implementations/__pycache__/sftp.cpython-310.pyc,,
|
63 |
+
fsspec/implementations/__pycache__/smb.cpython-310.pyc,,
|
64 |
+
fsspec/implementations/__pycache__/tar.cpython-310.pyc,,
|
65 |
+
fsspec/implementations/__pycache__/webhdfs.cpython-310.pyc,,
|
66 |
+
fsspec/implementations/__pycache__/zip.cpython-310.pyc,,
|
67 |
+
fsspec/implementations/arrow.py,sha256=_7TLuV6ZzNlpmUU_v6ud56u2wadzsKmY5qugPBxgMEs,8649
|
68 |
+
fsspec/implementations/cache_mapper.py,sha256=iHgBA6gjzDJ7_mBboHFzpLTf55HP3UEwUOZ43xyUK4M,2429
|
69 |
+
fsspec/implementations/cache_metadata.py,sha256=ZvyA7Y3KK-5Ct4E5pELzD6mH_5T03XqaKVT96qYDADU,8576
|
70 |
+
fsspec/implementations/cached.py,sha256=CuxQXQ6f-MRnLvsRzvauEhpmXEgicZZCfViKjIu1kn4,33029
|
71 |
+
fsspec/implementations/dask.py,sha256=CXZbJzIVOhKV8ILcxuy3bTvcacCueAbyQxmvAkbPkrk,4466
|
72 |
+
fsspec/implementations/data.py,sha256=LDLczxRh8h7x39Zjrd-GgzdQHr78yYxDlrv2C9Uxb5E,1658
|
73 |
+
fsspec/implementations/dbfs.py,sha256=cix9OYUveuSOx5UO5uRUwNUkYqjzyY0fkKnca1kTgZ0,15014
|
74 |
+
fsspec/implementations/dirfs.py,sha256=inDIRSDPhI1_ud1MMBFrpZQ11VIAMJ_dZQtbE4V08Ng,11384
|
75 |
+
fsspec/implementations/ftp.py,sha256=rp6cTog8xqjDPlKdSLKcsyP7K593_ByMabxGbNSEpTo,11655
|
76 |
+
fsspec/implementations/git.py,sha256=vKGI-Vd5q4H2RrvhebkPc9NwlfkZ980OUGhebeCw-M0,4034
|
77 |
+
fsspec/implementations/github.py,sha256=0kIiKkeAaROuHgdWBHVQFrzJ2ZfoDgymCehL_kJXHYA,7565
|
78 |
+
fsspec/implementations/http.py,sha256=yr6t0OhLwZx_pvNQ05detAehcQjRw0Pg6XdwWv81jxk,29601
|
79 |
+
fsspec/implementations/jupyter.py,sha256=B2uj7OEm7yIk-vRSsO37_ND0t0EBvn4B-Su43ibN4Pg,3811
|
80 |
+
fsspec/implementations/libarchive.py,sha256=5_I2DiLXwQ1JC8x-K7jXu-tBwhO9dj7tFLnb0bTnVMQ,7102
|
81 |
+
fsspec/implementations/local.py,sha256=XLsBoG4lf92w5ZddmbHXcStThSYxHgeoJEd2Mp5Uo0Y,14327
|
82 |
+
fsspec/implementations/memory.py,sha256=tlaGCekgZ2Z_9n8B6hsSpo6_V89PwjugkOmD445QrqE,9778
|
83 |
+
fsspec/implementations/reference.py,sha256=3dPi55riD_cROCafpeoUm2Xbb1vpXpyQijl09f5jTsE,43871
|
84 |
+
fsspec/implementations/sftp.py,sha256=fMY9XZcmpjszQ2tCqO_TPaJesaeD_Dv7ptYzgUPGoO0,5631
|
85 |
+
fsspec/implementations/smb.py,sha256=_hR5MKwDUCi3u5zEzvnenIWRIGPMhuUryWRYvNSp0WE,10804
|
86 |
+
fsspec/implementations/tar.py,sha256=dam78Tp_CozybNqCY2JYgGBS3Uc9FuJUAT9oB0lolOs,4111
|
87 |
+
fsspec/implementations/webhdfs.py,sha256=wqVfno7z0TY1HepaIvKTUUcl_bi5NkV6qWsST8t_s7Y,16745
|
88 |
+
fsspec/implementations/zip.py,sha256=vc1fNz-yO8uWQ9bQUqBFYpTcgsfZQq9vDwwg4Aufs9Y,4417
|
89 |
+
fsspec/mapping.py,sha256=hSsiRo-dgAOj6oHf67bF3i11U4xREglXToHGUX4GhRY,8261
|
90 |
+
fsspec/parquet.py,sha256=qVxDhwc960SGOt5etcYAJxCr-7HQKP01687KpDR02Gw,19463
|
91 |
+
fsspec/registry.py,sha256=VjnfGUg39lvlCDxOoGSeYm8UL12wZC5yQ5n8-W92eD0,11173
|
92 |
+
fsspec/spec.py,sha256=3t96RgizRN_slIuHXnuR0bXjVUfBS1TfuDrEua4oQvE,66277
|
93 |
+
fsspec/tests/abstract/__init__.py,sha256=i1wcFixV6QhOwdoB24c8oXjzobISNqiKVz9kl2DvAY8,10028
|
94 |
+
fsspec/tests/abstract/__pycache__/__init__.cpython-310.pyc,,
|
95 |
+
fsspec/tests/abstract/__pycache__/common.cpython-310.pyc,,
|
96 |
+
fsspec/tests/abstract/__pycache__/copy.cpython-310.pyc,,
|
97 |
+
fsspec/tests/abstract/__pycache__/get.cpython-310.pyc,,
|
98 |
+
fsspec/tests/abstract/__pycache__/put.cpython-310.pyc,,
|
99 |
+
fsspec/tests/abstract/common.py,sha256=1GQwNo5AONzAnzZj0fWgn8NJPLXALehbsuGxS3FzWVU,4973
|
100 |
+
fsspec/tests/abstract/copy.py,sha256=gU5-d97U3RSde35Vp4RxPY4rWwL744HiSrJ8IBOp9-8,19967
|
101 |
+
fsspec/tests/abstract/get.py,sha256=vNR4HztvTR7Cj56AMo7_tx7TeYz1Jgr_2Wb8Lv-UiBY,20755
|
102 |
+
fsspec/tests/abstract/put.py,sha256=7aih17OKB_IZZh1Mkq1eBDIjobhtMQmI8x-Pw-S_aZk,21201
|
103 |
+
fsspec/transaction.py,sha256=xliRG6U2Zf3khG4xcw9WiB-yAoqJSHEGK_VjHOdtgo0,2398
|
104 |
+
fsspec/utils.py,sha256=kYBiiw_0AEFJPCYwYlbZ7QxiGwuXdaaxrK6KM3mcFak,23052
|
llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.43.0)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
llmeval-env/lib/python3.10/site-packages/fsspec-2024.3.1.dist-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fsspec
|
llmeval-env/lib/python3.10/site-packages/fsspec/caching.py
ADDED
@@ -0,0 +1,881 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import collections
|
4 |
+
import functools
|
5 |
+
import logging
|
6 |
+
import math
|
7 |
+
import os
|
8 |
+
import threading
|
9 |
+
import warnings
|
10 |
+
from concurrent.futures import Future, ThreadPoolExecutor
|
11 |
+
from typing import (
|
12 |
+
TYPE_CHECKING,
|
13 |
+
Any,
|
14 |
+
Callable,
|
15 |
+
ClassVar,
|
16 |
+
Generic,
|
17 |
+
NamedTuple,
|
18 |
+
OrderedDict,
|
19 |
+
TypeVar,
|
20 |
+
)
|
21 |
+
|
22 |
+
if TYPE_CHECKING:
|
23 |
+
import mmap
|
24 |
+
|
25 |
+
from typing_extensions import ParamSpec
|
26 |
+
|
27 |
+
P = ParamSpec("P")
|
28 |
+
else:
|
29 |
+
P = TypeVar("P")
|
30 |
+
|
31 |
+
T = TypeVar("T")
|
32 |
+
|
33 |
+
|
34 |
+
logger = logging.getLogger("fsspec")
|
35 |
+
|
36 |
+
Fetcher = Callable[[int, int], bytes] # Maps (start, end) to bytes
|
37 |
+
|
38 |
+
|
39 |
+
class BaseCache:
|
40 |
+
"""Pass-though cache: doesn't keep anything, calls every time
|
41 |
+
|
42 |
+
Acts as base class for other cachers
|
43 |
+
|
44 |
+
Parameters
|
45 |
+
----------
|
46 |
+
blocksize: int
|
47 |
+
How far to read ahead in numbers of bytes
|
48 |
+
fetcher: func
|
49 |
+
Function of the form f(start, end) which gets bytes from remote as
|
50 |
+
specified
|
51 |
+
size: int
|
52 |
+
How big this file is
|
53 |
+
"""
|
54 |
+
|
55 |
+
name: ClassVar[str] = "none"
|
56 |
+
|
57 |
+
def __init__(self, blocksize: int, fetcher: Fetcher, size: int) -> None:
|
58 |
+
self.blocksize = blocksize
|
59 |
+
self.fetcher = fetcher
|
60 |
+
self.size = size
|
61 |
+
|
62 |
+
def _fetch(self, start: int | None, stop: int | None) -> bytes:
|
63 |
+
if start is None:
|
64 |
+
start = 0
|
65 |
+
if stop is None:
|
66 |
+
stop = self.size
|
67 |
+
if start >= self.size or start >= stop:
|
68 |
+
return b""
|
69 |
+
return self.fetcher(start, stop)
|
70 |
+
|
71 |
+
|
72 |
+
class MMapCache(BaseCache):
|
73 |
+
"""memory-mapped sparse file cache
|
74 |
+
|
75 |
+
Opens temporary file, which is filled blocks-wise when data is requested.
|
76 |
+
Ensure there is enough disc space in the temporary location.
|
77 |
+
|
78 |
+
This cache method might only work on posix
|
79 |
+
"""
|
80 |
+
|
81 |
+
name = "mmap"
|
82 |
+
|
83 |
+
def __init__(
|
84 |
+
self,
|
85 |
+
blocksize: int,
|
86 |
+
fetcher: Fetcher,
|
87 |
+
size: int,
|
88 |
+
location: str | None = None,
|
89 |
+
blocks: set[int] | None = None,
|
90 |
+
) -> None:
|
91 |
+
super().__init__(blocksize, fetcher, size)
|
92 |
+
self.blocks = set() if blocks is None else blocks
|
93 |
+
self.location = location
|
94 |
+
self.cache = self._makefile()
|
95 |
+
|
96 |
+
def _makefile(self) -> mmap.mmap | bytearray:
|
97 |
+
import mmap
|
98 |
+
import tempfile
|
99 |
+
|
100 |
+
if self.size == 0:
|
101 |
+
return bytearray()
|
102 |
+
|
103 |
+
# posix version
|
104 |
+
if self.location is None or not os.path.exists(self.location):
|
105 |
+
if self.location is None:
|
106 |
+
fd = tempfile.TemporaryFile()
|
107 |
+
self.blocks = set()
|
108 |
+
else:
|
109 |
+
fd = open(self.location, "wb+")
|
110 |
+
fd.seek(self.size - 1)
|
111 |
+
fd.write(b"1")
|
112 |
+
fd.flush()
|
113 |
+
else:
|
114 |
+
fd = open(self.location, "r+b")
|
115 |
+
|
116 |
+
return mmap.mmap(fd.fileno(), self.size)
|
117 |
+
|
118 |
+
def _fetch(self, start: int | None, end: int | None) -> bytes:
|
119 |
+
logger.debug(f"MMap cache fetching {start}-{end}")
|
120 |
+
if start is None:
|
121 |
+
start = 0
|
122 |
+
if end is None:
|
123 |
+
end = self.size
|
124 |
+
if start >= self.size or start >= end:
|
125 |
+
return b""
|
126 |
+
start_block = start // self.blocksize
|
127 |
+
end_block = end // self.blocksize
|
128 |
+
need = [i for i in range(start_block, end_block + 1) if i not in self.blocks]
|
129 |
+
while need:
|
130 |
+
# TODO: not a for loop so we can consolidate blocks later to
|
131 |
+
# make fewer fetch calls; this could be parallel
|
132 |
+
i = need.pop(0)
|
133 |
+
sstart = i * self.blocksize
|
134 |
+
send = min(sstart + self.blocksize, self.size)
|
135 |
+
logger.debug(f"MMap get block #{i} ({sstart}-{send}")
|
136 |
+
self.cache[sstart:send] = self.fetcher(sstart, send)
|
137 |
+
self.blocks.add(i)
|
138 |
+
|
139 |
+
return self.cache[start:end]
|
140 |
+
|
141 |
+
def __getstate__(self) -> dict[str, Any]:
|
142 |
+
state = self.__dict__.copy()
|
143 |
+
# Remove the unpicklable entries.
|
144 |
+
del state["cache"]
|
145 |
+
return state
|
146 |
+
|
147 |
+
def __setstate__(self, state: dict[str, Any]) -> None:
|
148 |
+
# Restore instance attributes
|
149 |
+
self.__dict__.update(state)
|
150 |
+
self.cache = self._makefile()
|
151 |
+
|
152 |
+
|
153 |
+
class ReadAheadCache(BaseCache):
|
154 |
+
"""Cache which reads only when we get beyond a block of data
|
155 |
+
|
156 |
+
This is a much simpler version of BytesCache, and does not attempt to
|
157 |
+
fill holes in the cache or keep fragments alive. It is best suited to
|
158 |
+
many small reads in a sequential order (e.g., reading lines from a file).
|
159 |
+
"""
|
160 |
+
|
161 |
+
name = "readahead"
|
162 |
+
|
163 |
+
def __init__(self, blocksize: int, fetcher: Fetcher, size: int) -> None:
|
164 |
+
super().__init__(blocksize, fetcher, size)
|
165 |
+
self.cache = b""
|
166 |
+
self.start = 0
|
167 |
+
self.end = 0
|
168 |
+
|
169 |
+
def _fetch(self, start: int | None, end: int | None) -> bytes:
|
170 |
+
if start is None:
|
171 |
+
start = 0
|
172 |
+
if end is None or end > self.size:
|
173 |
+
end = self.size
|
174 |
+
if start >= self.size or start >= end:
|
175 |
+
return b""
|
176 |
+
l = end - start
|
177 |
+
if start >= self.start and end <= self.end:
|
178 |
+
# cache hit
|
179 |
+
return self.cache[start - self.start : end - self.start]
|
180 |
+
elif self.start <= start < self.end:
|
181 |
+
# partial hit
|
182 |
+
part = self.cache[start - self.start :]
|
183 |
+
l -= len(part)
|
184 |
+
start = self.end
|
185 |
+
else:
|
186 |
+
# miss
|
187 |
+
part = b""
|
188 |
+
end = min(self.size, end + self.blocksize)
|
189 |
+
self.cache = self.fetcher(start, end) # new block replaces old
|
190 |
+
self.start = start
|
191 |
+
self.end = self.start + len(self.cache)
|
192 |
+
return part + self.cache[:l]
|
193 |
+
|
194 |
+
|
195 |
+
class FirstChunkCache(BaseCache):
|
196 |
+
"""Caches the first block of a file only
|
197 |
+
|
198 |
+
This may be useful for file types where the metadata is stored in the header,
|
199 |
+
but is randomly accessed.
|
200 |
+
"""
|
201 |
+
|
202 |
+
name = "first"
|
203 |
+
|
204 |
+
def __init__(self, blocksize: int, fetcher: Fetcher, size: int) -> None:
|
205 |
+
super().__init__(blocksize, fetcher, size)
|
206 |
+
self.cache: bytes | None = None
|
207 |
+
|
208 |
+
def _fetch(self, start: int | None, end: int | None) -> bytes:
|
209 |
+
start = start or 0
|
210 |
+
end = end or self.size
|
211 |
+
if start < self.blocksize:
|
212 |
+
if self.cache is None:
|
213 |
+
if end > self.blocksize:
|
214 |
+
data = self.fetcher(0, end)
|
215 |
+
self.cache = data[: self.blocksize]
|
216 |
+
return data[start:]
|
217 |
+
self.cache = self.fetcher(0, self.blocksize)
|
218 |
+
part = self.cache[start:end]
|
219 |
+
if end > self.blocksize:
|
220 |
+
part += self.fetcher(self.blocksize, end)
|
221 |
+
return part
|
222 |
+
else:
|
223 |
+
return self.fetcher(start, end)
|
224 |
+
|
225 |
+
|
226 |
+
class BlockCache(BaseCache):
|
227 |
+
"""
|
228 |
+
Cache holding memory as a set of blocks.
|
229 |
+
|
230 |
+
Requests are only ever made ``blocksize`` at a time, and are
|
231 |
+
stored in an LRU cache. The least recently accessed block is
|
232 |
+
discarded when more than ``maxblocks`` are stored.
|
233 |
+
|
234 |
+
Parameters
|
235 |
+
----------
|
236 |
+
blocksize : int
|
237 |
+
The number of bytes to store in each block.
|
238 |
+
Requests are only ever made for ``blocksize``, so this
|
239 |
+
should balance the overhead of making a request against
|
240 |
+
the granularity of the blocks.
|
241 |
+
fetcher : Callable
|
242 |
+
size : int
|
243 |
+
The total size of the file being cached.
|
244 |
+
maxblocks : int
|
245 |
+
The maximum number of blocks to cache for. The maximum memory
|
246 |
+
use for this cache is then ``blocksize * maxblocks``.
|
247 |
+
"""
|
248 |
+
|
249 |
+
name = "blockcache"
|
250 |
+
|
251 |
+
def __init__(
|
252 |
+
self, blocksize: int, fetcher: Fetcher, size: int, maxblocks: int = 32
|
253 |
+
) -> None:
|
254 |
+
super().__init__(blocksize, fetcher, size)
|
255 |
+
self.nblocks = math.ceil(size / blocksize)
|
256 |
+
self.maxblocks = maxblocks
|
257 |
+
self._fetch_block_cached = functools.lru_cache(maxblocks)(self._fetch_block)
|
258 |
+
|
259 |
+
def __repr__(self) -> str:
|
260 |
+
return (
|
261 |
+
f"<BlockCache blocksize={self.blocksize}, "
|
262 |
+
f"size={self.size}, nblocks={self.nblocks}>"
|
263 |
+
)
|
264 |
+
|
265 |
+
def cache_info(self):
|
266 |
+
"""
|
267 |
+
The statistics on the block cache.
|
268 |
+
|
269 |
+
Returns
|
270 |
+
-------
|
271 |
+
NamedTuple
|
272 |
+
Returned directly from the LRU Cache used internally.
|
273 |
+
"""
|
274 |
+
return self._fetch_block_cached.cache_info()
|
275 |
+
|
276 |
+
def __getstate__(self) -> dict[str, Any]:
|
277 |
+
state = self.__dict__
|
278 |
+
del state["_fetch_block_cached"]
|
279 |
+
return state
|
280 |
+
|
281 |
+
def __setstate__(self, state: dict[str, Any]) -> None:
|
282 |
+
self.__dict__.update(state)
|
283 |
+
self._fetch_block_cached = functools.lru_cache(state["maxblocks"])(
|
284 |
+
self._fetch_block
|
285 |
+
)
|
286 |
+
|
287 |
+
def _fetch(self, start: int | None, end: int | None) -> bytes:
|
288 |
+
if start is None:
|
289 |
+
start = 0
|
290 |
+
if end is None:
|
291 |
+
end = self.size
|
292 |
+
if start >= self.size or start >= end:
|
293 |
+
return b""
|
294 |
+
|
295 |
+
# byte position -> block numbers
|
296 |
+
start_block_number = start // self.blocksize
|
297 |
+
end_block_number = end // self.blocksize
|
298 |
+
|
299 |
+
# these are cached, so safe to do multiple calls for the same start and end.
|
300 |
+
for block_number in range(start_block_number, end_block_number + 1):
|
301 |
+
self._fetch_block_cached(block_number)
|
302 |
+
|
303 |
+
return self._read_cache(
|
304 |
+
start,
|
305 |
+
end,
|
306 |
+
start_block_number=start_block_number,
|
307 |
+
end_block_number=end_block_number,
|
308 |
+
)
|
309 |
+
|
310 |
+
def _fetch_block(self, block_number: int) -> bytes:
|
311 |
+
"""
|
312 |
+
Fetch the block of data for `block_number`.
|
313 |
+
"""
|
314 |
+
if block_number > self.nblocks:
|
315 |
+
raise ValueError(
|
316 |
+
f"'block_number={block_number}' is greater than "
|
317 |
+
f"the number of blocks ({self.nblocks})"
|
318 |
+
)
|
319 |
+
|
320 |
+
start = block_number * self.blocksize
|
321 |
+
end = start + self.blocksize
|
322 |
+
logger.info("BlockCache fetching block %d", block_number)
|
323 |
+
block_contents = super()._fetch(start, end)
|
324 |
+
return block_contents
|
325 |
+
|
326 |
+
def _read_cache(
|
327 |
+
self, start: int, end: int, start_block_number: int, end_block_number: int
|
328 |
+
) -> bytes:
|
329 |
+
"""
|
330 |
+
Read from our block cache.
|
331 |
+
|
332 |
+
Parameters
|
333 |
+
----------
|
334 |
+
start, end : int
|
335 |
+
The start and end byte positions.
|
336 |
+
start_block_number, end_block_number : int
|
337 |
+
The start and end block numbers.
|
338 |
+
"""
|
339 |
+
start_pos = start % self.blocksize
|
340 |
+
end_pos = end % self.blocksize
|
341 |
+
|
342 |
+
if start_block_number == end_block_number:
|
343 |
+
block: bytes = self._fetch_block_cached(start_block_number)
|
344 |
+
return block[start_pos:end_pos]
|
345 |
+
|
346 |
+
else:
|
347 |
+
# read from the initial
|
348 |
+
out = [self._fetch_block_cached(start_block_number)[start_pos:]]
|
349 |
+
|
350 |
+
# intermediate blocks
|
351 |
+
# Note: it'd be nice to combine these into one big request. However
|
352 |
+
# that doesn't play nicely with our LRU cache.
|
353 |
+
out.extend(
|
354 |
+
map(
|
355 |
+
self._fetch_block_cached,
|
356 |
+
range(start_block_number + 1, end_block_number),
|
357 |
+
)
|
358 |
+
)
|
359 |
+
|
360 |
+
# final block
|
361 |
+
out.append(self._fetch_block_cached(end_block_number)[:end_pos])
|
362 |
+
|
363 |
+
return b"".join(out)
|
364 |
+
|
365 |
+
|
366 |
+
class BytesCache(BaseCache):
|
367 |
+
"""Cache which holds data in a in-memory bytes object
|
368 |
+
|
369 |
+
Implements read-ahead by the block size, for semi-random reads progressing
|
370 |
+
through the file.
|
371 |
+
|
372 |
+
Parameters
|
373 |
+
----------
|
374 |
+
trim: bool
|
375 |
+
As we read more data, whether to discard the start of the buffer when
|
376 |
+
we are more than a blocksize ahead of it.
|
377 |
+
"""
|
378 |
+
|
379 |
+
name: ClassVar[str] = "bytes"
|
380 |
+
|
381 |
+
def __init__(
|
382 |
+
self, blocksize: int, fetcher: Fetcher, size: int, trim: bool = True
|
383 |
+
) -> None:
|
384 |
+
super().__init__(blocksize, fetcher, size)
|
385 |
+
self.cache = b""
|
386 |
+
self.start: int | None = None
|
387 |
+
self.end: int | None = None
|
388 |
+
self.trim = trim
|
389 |
+
|
390 |
+
def _fetch(self, start: int | None, end: int | None) -> bytes:
|
391 |
+
# TODO: only set start/end after fetch, in case it fails?
|
392 |
+
# is this where retry logic might go?
|
393 |
+
if start is None:
|
394 |
+
start = 0
|
395 |
+
if end is None:
|
396 |
+
end = self.size
|
397 |
+
if start >= self.size or start >= end:
|
398 |
+
return b""
|
399 |
+
if (
|
400 |
+
self.start is not None
|
401 |
+
and start >= self.start
|
402 |
+
and self.end is not None
|
403 |
+
and end < self.end
|
404 |
+
):
|
405 |
+
# cache hit: we have all the required data
|
406 |
+
offset = start - self.start
|
407 |
+
return self.cache[offset : offset + end - start]
|
408 |
+
|
409 |
+
if self.blocksize:
|
410 |
+
bend = min(self.size, end + self.blocksize)
|
411 |
+
else:
|
412 |
+
bend = end
|
413 |
+
|
414 |
+
if bend == start or start > self.size:
|
415 |
+
return b""
|
416 |
+
|
417 |
+
if (self.start is None or start < self.start) and (
|
418 |
+
self.end is None or end > self.end
|
419 |
+
):
|
420 |
+
# First read, or extending both before and after
|
421 |
+
self.cache = self.fetcher(start, bend)
|
422 |
+
self.start = start
|
423 |
+
else:
|
424 |
+
assert self.start is not None
|
425 |
+
assert self.end is not None
|
426 |
+
|
427 |
+
if start < self.start:
|
428 |
+
if self.end is None or self.end - end > self.blocksize:
|
429 |
+
self.cache = self.fetcher(start, bend)
|
430 |
+
self.start = start
|
431 |
+
else:
|
432 |
+
new = self.fetcher(start, self.start)
|
433 |
+
self.start = start
|
434 |
+
self.cache = new + self.cache
|
435 |
+
elif self.end is not None and bend > self.end:
|
436 |
+
if self.end > self.size:
|
437 |
+
pass
|
438 |
+
elif end - self.end > self.blocksize:
|
439 |
+
self.cache = self.fetcher(start, bend)
|
440 |
+
self.start = start
|
441 |
+
else:
|
442 |
+
new = self.fetcher(self.end, bend)
|
443 |
+
self.cache = self.cache + new
|
444 |
+
|
445 |
+
self.end = self.start + len(self.cache)
|
446 |
+
offset = start - self.start
|
447 |
+
out = self.cache[offset : offset + end - start]
|
448 |
+
if self.trim:
|
449 |
+
num = (self.end - self.start) // (self.blocksize + 1)
|
450 |
+
if num > 1:
|
451 |
+
self.start += self.blocksize * num
|
452 |
+
self.cache = self.cache[self.blocksize * num :]
|
453 |
+
return out
|
454 |
+
|
455 |
+
def __len__(self) -> int:
|
456 |
+
return len(self.cache)
|
457 |
+
|
458 |
+
|
459 |
+
class AllBytes(BaseCache):
|
460 |
+
"""Cache entire contents of the file"""
|
461 |
+
|
462 |
+
name: ClassVar[str] = "all"
|
463 |
+
|
464 |
+
def __init__(
|
465 |
+
self,
|
466 |
+
blocksize: int | None = None,
|
467 |
+
fetcher: Fetcher | None = None,
|
468 |
+
size: int | None = None,
|
469 |
+
data: bytes | None = None,
|
470 |
+
) -> None:
|
471 |
+
super().__init__(blocksize, fetcher, size) # type: ignore[arg-type]
|
472 |
+
if data is None:
|
473 |
+
data = self.fetcher(0, self.size)
|
474 |
+
self.data = data
|
475 |
+
|
476 |
+
def _fetch(self, start: int | None, stop: int | None) -> bytes:
|
477 |
+
return self.data[start:stop]
|
478 |
+
|
479 |
+
|
480 |
+
class KnownPartsOfAFile(BaseCache):
|
481 |
+
"""
|
482 |
+
Cache holding known file parts.
|
483 |
+
|
484 |
+
Parameters
|
485 |
+
----------
|
486 |
+
blocksize: int
|
487 |
+
How far to read ahead in numbers of bytes
|
488 |
+
fetcher: func
|
489 |
+
Function of the form f(start, end) which gets bytes from remote as
|
490 |
+
specified
|
491 |
+
size: int
|
492 |
+
How big this file is
|
493 |
+
data: dict
|
494 |
+
A dictionary mapping explicit `(start, stop)` file-offset tuples
|
495 |
+
with known bytes.
|
496 |
+
strict: bool, default True
|
497 |
+
Whether to fetch reads that go beyond a known byte-range boundary.
|
498 |
+
If `False`, any read that ends outside a known part will be zero
|
499 |
+
padded. Note that zero padding will not be used for reads that
|
500 |
+
begin outside a known byte-range.
|
501 |
+
"""
|
502 |
+
|
503 |
+
name: ClassVar[str] = "parts"
|
504 |
+
|
505 |
+
def __init__(
|
506 |
+
self,
|
507 |
+
blocksize: int,
|
508 |
+
fetcher: Fetcher,
|
509 |
+
size: int,
|
510 |
+
data: dict[tuple[int, int], bytes] = {},
|
511 |
+
strict: bool = True,
|
512 |
+
**_: Any,
|
513 |
+
):
|
514 |
+
super().__init__(blocksize, fetcher, size)
|
515 |
+
self.strict = strict
|
516 |
+
|
517 |
+
# simple consolidation of contiguous blocks
|
518 |
+
if data:
|
519 |
+
old_offsets = sorted(data.keys())
|
520 |
+
offsets = [old_offsets[0]]
|
521 |
+
blocks = [data.pop(old_offsets[0])]
|
522 |
+
for start, stop in old_offsets[1:]:
|
523 |
+
start0, stop0 = offsets[-1]
|
524 |
+
if start == stop0:
|
525 |
+
offsets[-1] = (start0, stop)
|
526 |
+
blocks[-1] += data.pop((start, stop))
|
527 |
+
else:
|
528 |
+
offsets.append((start, stop))
|
529 |
+
blocks.append(data.pop((start, stop)))
|
530 |
+
|
531 |
+
self.data = dict(zip(offsets, blocks))
|
532 |
+
else:
|
533 |
+
self.data = data
|
534 |
+
|
535 |
+
def _fetch(self, start: int | None, stop: int | None) -> bytes:
|
536 |
+
if start is None:
|
537 |
+
start = 0
|
538 |
+
if stop is None:
|
539 |
+
stop = self.size
|
540 |
+
|
541 |
+
out = b""
|
542 |
+
for (loc0, loc1), data in self.data.items():
|
543 |
+
# If self.strict=False, use zero-padded data
|
544 |
+
# for reads beyond the end of a "known" buffer
|
545 |
+
if loc0 <= start < loc1:
|
546 |
+
off = start - loc0
|
547 |
+
out = data[off : off + stop - start]
|
548 |
+
if not self.strict or loc0 <= stop <= loc1:
|
549 |
+
# The request is within a known range, or
|
550 |
+
# it begins within a known range, and we
|
551 |
+
# are allowed to pad reads beyond the
|
552 |
+
# buffer with zero
|
553 |
+
out += b"\x00" * (stop - start - len(out))
|
554 |
+
return out
|
555 |
+
else:
|
556 |
+
# The request ends outside a known range,
|
557 |
+
# and we are being "strict" about reads
|
558 |
+
# beyond the buffer
|
559 |
+
start = loc1
|
560 |
+
break
|
561 |
+
|
562 |
+
# We only get here if there is a request outside the
|
563 |
+
# known parts of the file. In an ideal world, this
|
564 |
+
# should never happen
|
565 |
+
if self.fetcher is None:
|
566 |
+
# We cannot fetch the data, so raise an error
|
567 |
+
raise ValueError(f"Read is outside the known file parts: {(start, stop)}. ")
|
568 |
+
# We can fetch the data, but should warn the user
|
569 |
+
# that this may be slow
|
570 |
+
warnings.warn(
|
571 |
+
f"Read is outside the known file parts: {(start, stop)}. "
|
572 |
+
f"IO/caching performance may be poor!"
|
573 |
+
)
|
574 |
+
logger.debug(f"KnownPartsOfAFile cache fetching {start}-{stop}")
|
575 |
+
return out + super()._fetch(start, stop)
|
576 |
+
|
577 |
+
|
578 |
+
class UpdatableLRU(Generic[P, T]):
|
579 |
+
"""
|
580 |
+
Custom implementation of LRU cache that allows updating keys
|
581 |
+
|
582 |
+
Used by BackgroudBlockCache
|
583 |
+
"""
|
584 |
+
|
585 |
+
class CacheInfo(NamedTuple):
|
586 |
+
hits: int
|
587 |
+
misses: int
|
588 |
+
maxsize: int
|
589 |
+
currsize: int
|
590 |
+
|
591 |
+
def __init__(self, func: Callable[P, T], max_size: int = 128) -> None:
|
592 |
+
self._cache: OrderedDict[Any, T] = collections.OrderedDict()
|
593 |
+
self._func = func
|
594 |
+
self._max_size = max_size
|
595 |
+
self._hits = 0
|
596 |
+
self._misses = 0
|
597 |
+
self._lock = threading.Lock()
|
598 |
+
|
599 |
+
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> T:
|
600 |
+
if kwargs:
|
601 |
+
raise TypeError(f"Got unexpected keyword argument {kwargs.keys()}")
|
602 |
+
with self._lock:
|
603 |
+
if args in self._cache:
|
604 |
+
self._cache.move_to_end(args)
|
605 |
+
self._hits += 1
|
606 |
+
return self._cache[args]
|
607 |
+
|
608 |
+
result = self._func(*args, **kwargs)
|
609 |
+
|
610 |
+
with self._lock:
|
611 |
+
self._cache[args] = result
|
612 |
+
self._misses += 1
|
613 |
+
if len(self._cache) > self._max_size:
|
614 |
+
self._cache.popitem(last=False)
|
615 |
+
|
616 |
+
return result
|
617 |
+
|
618 |
+
def is_key_cached(self, *args: Any) -> bool:
|
619 |
+
with self._lock:
|
620 |
+
return args in self._cache
|
621 |
+
|
622 |
+
def add_key(self, result: T, *args: Any) -> None:
|
623 |
+
with self._lock:
|
624 |
+
self._cache[args] = result
|
625 |
+
if len(self._cache) > self._max_size:
|
626 |
+
self._cache.popitem(last=False)
|
627 |
+
|
628 |
+
def cache_info(self) -> UpdatableLRU.CacheInfo:
|
629 |
+
with self._lock:
|
630 |
+
return self.CacheInfo(
|
631 |
+
maxsize=self._max_size,
|
632 |
+
currsize=len(self._cache),
|
633 |
+
hits=self._hits,
|
634 |
+
misses=self._misses,
|
635 |
+
)
|
636 |
+
|
637 |
+
|
638 |
+
class BackgroundBlockCache(BaseCache):
|
639 |
+
"""
|
640 |
+
Cache holding memory as a set of blocks with pre-loading of
|
641 |
+
the next block in the background.
|
642 |
+
|
643 |
+
Requests are only ever made ``blocksize`` at a time, and are
|
644 |
+
stored in an LRU cache. The least recently accessed block is
|
645 |
+
discarded when more than ``maxblocks`` are stored. If the
|
646 |
+
next block is not in cache, it is loaded in a separate thread
|
647 |
+
in non-blocking way.
|
648 |
+
|
649 |
+
Parameters
|
650 |
+
----------
|
651 |
+
blocksize : int
|
652 |
+
The number of bytes to store in each block.
|
653 |
+
Requests are only ever made for ``blocksize``, so this
|
654 |
+
should balance the overhead of making a request against
|
655 |
+
the granularity of the blocks.
|
656 |
+
fetcher : Callable
|
657 |
+
size : int
|
658 |
+
The total size of the file being cached.
|
659 |
+
maxblocks : int
|
660 |
+
The maximum number of blocks to cache for. The maximum memory
|
661 |
+
use for this cache is then ``blocksize * maxblocks``.
|
662 |
+
"""
|
663 |
+
|
664 |
+
name: ClassVar[str] = "background"
|
665 |
+
|
666 |
+
def __init__(
|
667 |
+
self, blocksize: int, fetcher: Fetcher, size: int, maxblocks: int = 32
|
668 |
+
) -> None:
|
669 |
+
super().__init__(blocksize, fetcher, size)
|
670 |
+
self.nblocks = math.ceil(size / blocksize)
|
671 |
+
self.maxblocks = maxblocks
|
672 |
+
self._fetch_block_cached = UpdatableLRU(self._fetch_block, maxblocks)
|
673 |
+
|
674 |
+
self._thread_executor = ThreadPoolExecutor(max_workers=1)
|
675 |
+
self._fetch_future_block_number: int | None = None
|
676 |
+
self._fetch_future: Future[bytes] | None = None
|
677 |
+
self._fetch_future_lock = threading.Lock()
|
678 |
+
|
679 |
+
def __repr__(self) -> str:
|
680 |
+
return (
|
681 |
+
f"<BackgroundBlockCache blocksize={self.blocksize}, "
|
682 |
+
f"size={self.size}, nblocks={self.nblocks}>"
|
683 |
+
)
|
684 |
+
|
685 |
+
def cache_info(self) -> UpdatableLRU.CacheInfo:
|
686 |
+
"""
|
687 |
+
The statistics on the block cache.
|
688 |
+
|
689 |
+
Returns
|
690 |
+
-------
|
691 |
+
NamedTuple
|
692 |
+
Returned directly from the LRU Cache used internally.
|
693 |
+
"""
|
694 |
+
return self._fetch_block_cached.cache_info()
|
695 |
+
|
696 |
+
def __getstate__(self) -> dict[str, Any]:
|
697 |
+
state = self.__dict__
|
698 |
+
del state["_fetch_block_cached"]
|
699 |
+
del state["_thread_executor"]
|
700 |
+
del state["_fetch_future_block_number"]
|
701 |
+
del state["_fetch_future"]
|
702 |
+
del state["_fetch_future_lock"]
|
703 |
+
return state
|
704 |
+
|
705 |
+
def __setstate__(self, state) -> None:
|
706 |
+
self.__dict__.update(state)
|
707 |
+
self._fetch_block_cached = UpdatableLRU(self._fetch_block, state["maxblocks"])
|
708 |
+
self._thread_executor = ThreadPoolExecutor(max_workers=1)
|
709 |
+
self._fetch_future_block_number = None
|
710 |
+
self._fetch_future = None
|
711 |
+
self._fetch_future_lock = threading.Lock()
|
712 |
+
|
713 |
+
def _fetch(self, start: int | None, end: int | None) -> bytes:
|
714 |
+
if start is None:
|
715 |
+
start = 0
|
716 |
+
if end is None:
|
717 |
+
end = self.size
|
718 |
+
if start >= self.size or start >= end:
|
719 |
+
return b""
|
720 |
+
|
721 |
+
# byte position -> block numbers
|
722 |
+
start_block_number = start // self.blocksize
|
723 |
+
end_block_number = end // self.blocksize
|
724 |
+
|
725 |
+
fetch_future_block_number = None
|
726 |
+
fetch_future = None
|
727 |
+
with self._fetch_future_lock:
|
728 |
+
# Background thread is running. Check we we can or must join it.
|
729 |
+
if self._fetch_future is not None:
|
730 |
+
assert self._fetch_future_block_number is not None
|
731 |
+
if self._fetch_future.done():
|
732 |
+
logger.info("BlockCache joined background fetch without waiting.")
|
733 |
+
self._fetch_block_cached.add_key(
|
734 |
+
self._fetch_future.result(), self._fetch_future_block_number
|
735 |
+
)
|
736 |
+
# Cleanup the fetch variables. Done with fetching the block.
|
737 |
+
self._fetch_future_block_number = None
|
738 |
+
self._fetch_future = None
|
739 |
+
else:
|
740 |
+
# Must join if we need the block for the current fetch
|
741 |
+
must_join = bool(
|
742 |
+
start_block_number
|
743 |
+
<= self._fetch_future_block_number
|
744 |
+
<= end_block_number
|
745 |
+
)
|
746 |
+
if must_join:
|
747 |
+
# Copy to the local variables to release lock
|
748 |
+
# before waiting for result
|
749 |
+
fetch_future_block_number = self._fetch_future_block_number
|
750 |
+
fetch_future = self._fetch_future
|
751 |
+
|
752 |
+
# Cleanup the fetch variables. Have a local copy.
|
753 |
+
self._fetch_future_block_number = None
|
754 |
+
self._fetch_future = None
|
755 |
+
|
756 |
+
# Need to wait for the future for the current read
|
757 |
+
if fetch_future is not None:
|
758 |
+
logger.info("BlockCache waiting for background fetch.")
|
759 |
+
# Wait until result and put it in cache
|
760 |
+
self._fetch_block_cached.add_key(
|
761 |
+
fetch_future.result(), fetch_future_block_number
|
762 |
+
)
|
763 |
+
|
764 |
+
# these are cached, so safe to do multiple calls for the same start and end.
|
765 |
+
for block_number in range(start_block_number, end_block_number + 1):
|
766 |
+
self._fetch_block_cached(block_number)
|
767 |
+
|
768 |
+
# fetch next block in the background if nothing is running in the background,
|
769 |
+
# the block is within file and it is not already cached
|
770 |
+
end_block_plus_1 = end_block_number + 1
|
771 |
+
with self._fetch_future_lock:
|
772 |
+
if (
|
773 |
+
self._fetch_future is None
|
774 |
+
and end_block_plus_1 <= self.nblocks
|
775 |
+
and not self._fetch_block_cached.is_key_cached(end_block_plus_1)
|
776 |
+
):
|
777 |
+
self._fetch_future_block_number = end_block_plus_1
|
778 |
+
self._fetch_future = self._thread_executor.submit(
|
779 |
+
self._fetch_block, end_block_plus_1, "async"
|
780 |
+
)
|
781 |
+
|
782 |
+
return self._read_cache(
|
783 |
+
start,
|
784 |
+
end,
|
785 |
+
start_block_number=start_block_number,
|
786 |
+
end_block_number=end_block_number,
|
787 |
+
)
|
788 |
+
|
789 |
+
def _fetch_block(self, block_number: int, log_info: str = "sync") -> bytes:
|
790 |
+
"""
|
791 |
+
Fetch the block of data for `block_number`.
|
792 |
+
"""
|
793 |
+
if block_number > self.nblocks:
|
794 |
+
raise ValueError(
|
795 |
+
f"'block_number={block_number}' is greater than "
|
796 |
+
f"the number of blocks ({self.nblocks})"
|
797 |
+
)
|
798 |
+
|
799 |
+
start = block_number * self.blocksize
|
800 |
+
end = start + self.blocksize
|
801 |
+
logger.info("BlockCache fetching block (%s) %d", log_info, block_number)
|
802 |
+
block_contents = super()._fetch(start, end)
|
803 |
+
return block_contents
|
804 |
+
|
805 |
+
def _read_cache(
|
806 |
+
self, start: int, end: int, start_block_number: int, end_block_number: int
|
807 |
+
) -> bytes:
|
808 |
+
"""
|
809 |
+
Read from our block cache.
|
810 |
+
|
811 |
+
Parameters
|
812 |
+
----------
|
813 |
+
start, end : int
|
814 |
+
The start and end byte positions.
|
815 |
+
start_block_number, end_block_number : int
|
816 |
+
The start and end block numbers.
|
817 |
+
"""
|
818 |
+
start_pos = start % self.blocksize
|
819 |
+
end_pos = end % self.blocksize
|
820 |
+
|
821 |
+
if start_block_number == end_block_number:
|
822 |
+
block = self._fetch_block_cached(start_block_number)
|
823 |
+
return block[start_pos:end_pos]
|
824 |
+
|
825 |
+
else:
|
826 |
+
# read from the initial
|
827 |
+
out = [self._fetch_block_cached(start_block_number)[start_pos:]]
|
828 |
+
|
829 |
+
# intermediate blocks
|
830 |
+
# Note: it'd be nice to combine these into one big request. However
|
831 |
+
# that doesn't play nicely with our LRU cache.
|
832 |
+
out.extend(
|
833 |
+
map(
|
834 |
+
self._fetch_block_cached,
|
835 |
+
range(start_block_number + 1, end_block_number),
|
836 |
+
)
|
837 |
+
)
|
838 |
+
|
839 |
+
# final block
|
840 |
+
out.append(self._fetch_block_cached(end_block_number)[:end_pos])
|
841 |
+
|
842 |
+
return b"".join(out)
|
843 |
+
|
844 |
+
|
845 |
+
caches: dict[str | None, type[BaseCache]] = {
|
846 |
+
# one custom case
|
847 |
+
None: BaseCache,
|
848 |
+
}
|
849 |
+
|
850 |
+
|
851 |
+
def register_cache(cls: type[BaseCache], clobber: bool = False) -> None:
|
852 |
+
"""'Register' cache implementation.
|
853 |
+
|
854 |
+
Parameters
|
855 |
+
----------
|
856 |
+
clobber: bool, optional
|
857 |
+
If set to True (default is False) - allow to overwrite existing
|
858 |
+
entry.
|
859 |
+
|
860 |
+
Raises
|
861 |
+
------
|
862 |
+
ValueError
|
863 |
+
"""
|
864 |
+
name = cls.name
|
865 |
+
if not clobber and name in caches:
|
866 |
+
raise ValueError(f"Cache with name {name!r} is already known: {caches[name]}")
|
867 |
+
caches[name] = cls
|
868 |
+
|
869 |
+
|
870 |
+
for c in (
|
871 |
+
BaseCache,
|
872 |
+
MMapCache,
|
873 |
+
BytesCache,
|
874 |
+
ReadAheadCache,
|
875 |
+
BlockCache,
|
876 |
+
FirstChunkCache,
|
877 |
+
AllBytes,
|
878 |
+
KnownPartsOfAFile,
|
879 |
+
BackgroundBlockCache,
|
880 |
+
):
|
881 |
+
register_cache(c)
|
llmeval-env/lib/python3.10/site-packages/fsspec/dircache.py
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
from collections.abc import MutableMapping
|
3 |
+
from functools import lru_cache
|
4 |
+
|
5 |
+
|
6 |
+
class DirCache(MutableMapping):
|
7 |
+
"""
|
8 |
+
Caching of directory listings, in a structure like::
|
9 |
+
|
10 |
+
{"path0": [
|
11 |
+
{"name": "path0/file0",
|
12 |
+
"size": 123,
|
13 |
+
"type": "file",
|
14 |
+
...
|
15 |
+
},
|
16 |
+
{"name": "path0/file1",
|
17 |
+
},
|
18 |
+
...
|
19 |
+
],
|
20 |
+
"path1": [...]
|
21 |
+
}
|
22 |
+
|
23 |
+
Parameters to this class control listing expiry or indeed turn
|
24 |
+
caching off
|
25 |
+
"""
|
26 |
+
|
27 |
+
def __init__(
|
28 |
+
self,
|
29 |
+
use_listings_cache=True,
|
30 |
+
listings_expiry_time=None,
|
31 |
+
max_paths=None,
|
32 |
+
**kwargs,
|
33 |
+
):
|
34 |
+
"""
|
35 |
+
|
36 |
+
Parameters
|
37 |
+
----------
|
38 |
+
use_listings_cache: bool
|
39 |
+
If False, this cache never returns items, but always reports KeyError,
|
40 |
+
and setting items has no effect
|
41 |
+
listings_expiry_time: int or float (optional)
|
42 |
+
Time in seconds that a listing is considered valid. If None,
|
43 |
+
listings do not expire.
|
44 |
+
max_paths: int (optional)
|
45 |
+
The number of most recent listings that are considered valid; 'recent'
|
46 |
+
refers to when the entry was set.
|
47 |
+
"""
|
48 |
+
self._cache = {}
|
49 |
+
self._times = {}
|
50 |
+
if max_paths:
|
51 |
+
self._q = lru_cache(max_paths + 1)(lambda key: self._cache.pop(key, None))
|
52 |
+
self.use_listings_cache = use_listings_cache
|
53 |
+
self.listings_expiry_time = listings_expiry_time
|
54 |
+
self.max_paths = max_paths
|
55 |
+
|
56 |
+
def __getitem__(self, item):
|
57 |
+
if self.listings_expiry_time is not None:
|
58 |
+
if self._times.get(item, 0) - time.time() < -self.listings_expiry_time:
|
59 |
+
del self._cache[item]
|
60 |
+
if self.max_paths:
|
61 |
+
self._q(item)
|
62 |
+
return self._cache[item] # maybe raises KeyError
|
63 |
+
|
64 |
+
def clear(self):
|
65 |
+
self._cache.clear()
|
66 |
+
|
67 |
+
def __len__(self):
|
68 |
+
return len(self._cache)
|
69 |
+
|
70 |
+
def __contains__(self, item):
|
71 |
+
try:
|
72 |
+
self[item]
|
73 |
+
return True
|
74 |
+
except KeyError:
|
75 |
+
return False
|
76 |
+
|
77 |
+
def __setitem__(self, key, value):
|
78 |
+
if not self.use_listings_cache:
|
79 |
+
return
|
80 |
+
if self.max_paths:
|
81 |
+
self._q(key)
|
82 |
+
self._cache[key] = value
|
83 |
+
if self.listings_expiry_time is not None:
|
84 |
+
self._times[key] = time.time()
|
85 |
+
|
86 |
+
def __delitem__(self, key):
|
87 |
+
del self._cache[key]
|
88 |
+
|
89 |
+
def __iter__(self):
|
90 |
+
entries = list(self._cache)
|
91 |
+
|
92 |
+
return (k for k in entries if k in self)
|
93 |
+
|
94 |
+
def __reduce__(self):
|
95 |
+
return (
|
96 |
+
DirCache,
|
97 |
+
(self.use_listings_cache, self.listings_expiry_time, self.max_paths),
|
98 |
+
)
|
llmeval-env/lib/python3.10/site-packages/fsspec/generic.py
ADDED
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import inspect
|
4 |
+
import logging
|
5 |
+
import os
|
6 |
+
import shutil
|
7 |
+
import uuid
|
8 |
+
from typing import Optional
|
9 |
+
|
10 |
+
from .asyn import AsyncFileSystem, _run_coros_in_chunks, sync_wrapper
|
11 |
+
from .callbacks import DEFAULT_CALLBACK
|
12 |
+
from .core import filesystem, get_filesystem_class, split_protocol, url_to_fs
|
13 |
+
|
14 |
+
_generic_fs = {}
|
15 |
+
logger = logging.getLogger("fsspec.generic")
|
16 |
+
|
17 |
+
|
18 |
+
def set_generic_fs(protocol, **storage_options):
|
19 |
+
_generic_fs[protocol] = filesystem(protocol, **storage_options)
|
20 |
+
|
21 |
+
|
22 |
+
default_method = "default"
|
23 |
+
|
24 |
+
|
25 |
+
def _resolve_fs(url, method=None, protocol=None, storage_options=None):
|
26 |
+
"""Pick instance of backend FS"""
|
27 |
+
method = method or default_method
|
28 |
+
protocol = protocol or split_protocol(url)[0]
|
29 |
+
storage_options = storage_options or {}
|
30 |
+
if method == "default":
|
31 |
+
return filesystem(protocol)
|
32 |
+
if method == "generic":
|
33 |
+
return _generic_fs[protocol]
|
34 |
+
if method == "current":
|
35 |
+
cls = get_filesystem_class(protocol)
|
36 |
+
return cls.current()
|
37 |
+
if method == "options":
|
38 |
+
fs, _ = url_to_fs(url, **storage_options.get(protocol, {}))
|
39 |
+
return fs
|
40 |
+
raise ValueError(f"Unknown FS resolution method: {method}")
|
41 |
+
|
42 |
+
|
43 |
+
def rsync(
|
44 |
+
source,
|
45 |
+
destination,
|
46 |
+
delete_missing=False,
|
47 |
+
source_field="size",
|
48 |
+
dest_field="size",
|
49 |
+
update_cond="different",
|
50 |
+
inst_kwargs=None,
|
51 |
+
fs=None,
|
52 |
+
**kwargs,
|
53 |
+
):
|
54 |
+
"""Sync files between two directory trees
|
55 |
+
|
56 |
+
(experimental)
|
57 |
+
|
58 |
+
Parameters
|
59 |
+
----------
|
60 |
+
source: str
|
61 |
+
Root of the directory tree to take files from. This must be a directory, but
|
62 |
+
do not include any terminating "/" character
|
63 |
+
destination: str
|
64 |
+
Root path to copy into. The contents of this location should be
|
65 |
+
identical to the contents of ``source`` when done. This will be made a
|
66 |
+
directory, and the terminal "/" should not be included.
|
67 |
+
delete_missing: bool
|
68 |
+
If there are paths in the destination that don't exist in the
|
69 |
+
source and this is True, delete them. Otherwise, leave them alone.
|
70 |
+
source_field: str | callable
|
71 |
+
If ``update_field`` is "different", this is the key in the info
|
72 |
+
of source files to consider for difference. Maybe a function of the
|
73 |
+
info dict.
|
74 |
+
dest_field: str | callable
|
75 |
+
If ``update_field`` is "different", this is the key in the info
|
76 |
+
of destination files to consider for difference. May be a function of
|
77 |
+
the info dict.
|
78 |
+
update_cond: "different"|"always"|"never"
|
79 |
+
If "always", every file is copied, regardless of whether it exists in
|
80 |
+
the destination. If "never", files that exist in the destination are
|
81 |
+
not copied again. If "different" (default), only copy if the info
|
82 |
+
fields given by ``source_field`` and ``dest_field`` (usually "size")
|
83 |
+
are different. Other comparisons may be added in the future.
|
84 |
+
inst_kwargs: dict|None
|
85 |
+
If ``fs`` is None, use this set of keyword arguments to make a
|
86 |
+
GenericFileSystem instance
|
87 |
+
fs: GenericFileSystem|None
|
88 |
+
Instance to use if explicitly given. The instance defines how to
|
89 |
+
to make downstream file system instances from paths.
|
90 |
+
|
91 |
+
Returns
|
92 |
+
-------
|
93 |
+
dict of the copy operations that were performed, {source: destination}
|
94 |
+
"""
|
95 |
+
fs = fs or GenericFileSystem(**(inst_kwargs or {}))
|
96 |
+
source = fs._strip_protocol(source)
|
97 |
+
destination = fs._strip_protocol(destination)
|
98 |
+
allfiles = fs.find(source, withdirs=True, detail=True)
|
99 |
+
if not fs.isdir(source):
|
100 |
+
raise ValueError("Can only rsync on a directory")
|
101 |
+
otherfiles = fs.find(destination, withdirs=True, detail=True)
|
102 |
+
dirs = [
|
103 |
+
a
|
104 |
+
for a, v in allfiles.items()
|
105 |
+
if v["type"] == "directory" and a.replace(source, destination) not in otherfiles
|
106 |
+
]
|
107 |
+
logger.debug(f"{len(dirs)} directories to create")
|
108 |
+
if dirs:
|
109 |
+
fs.make_many_dirs(
|
110 |
+
[dirn.replace(source, destination) for dirn in dirs], exist_ok=True
|
111 |
+
)
|
112 |
+
allfiles = {a: v for a, v in allfiles.items() if v["type"] == "file"}
|
113 |
+
logger.debug(f"{len(allfiles)} files to consider for copy")
|
114 |
+
to_delete = [
|
115 |
+
o
|
116 |
+
for o, v in otherfiles.items()
|
117 |
+
if o.replace(destination, source) not in allfiles and v["type"] == "file"
|
118 |
+
]
|
119 |
+
for k, v in allfiles.copy().items():
|
120 |
+
otherfile = k.replace(source, destination)
|
121 |
+
if otherfile in otherfiles:
|
122 |
+
if update_cond == "always":
|
123 |
+
allfiles[k] = otherfile
|
124 |
+
elif update_cond == "different":
|
125 |
+
inf1 = source_field(v) if callable(source_field) else v[source_field]
|
126 |
+
v2 = otherfiles[otherfile]
|
127 |
+
inf2 = dest_field(v2) if callable(dest_field) else v2[dest_field]
|
128 |
+
if inf1 != inf2:
|
129 |
+
# details mismatch, make copy
|
130 |
+
allfiles[k] = otherfile
|
131 |
+
else:
|
132 |
+
# details match, don't copy
|
133 |
+
allfiles.pop(k)
|
134 |
+
else:
|
135 |
+
# file not in target yet
|
136 |
+
allfiles[k] = otherfile
|
137 |
+
logger.debug(f"{len(allfiles)} files to copy")
|
138 |
+
if allfiles:
|
139 |
+
source_files, target_files = zip(*allfiles.items())
|
140 |
+
fs.cp(source_files, target_files, **kwargs)
|
141 |
+
logger.debug(f"{len(to_delete)} files to delete")
|
142 |
+
if delete_missing:
|
143 |
+
fs.rm(to_delete)
|
144 |
+
return allfiles
|
145 |
+
|
146 |
+
|
147 |
+
class GenericFileSystem(AsyncFileSystem):
|
148 |
+
"""Wrapper over all other FS types
|
149 |
+
|
150 |
+
<experimental!>
|
151 |
+
|
152 |
+
This implementation is a single unified interface to be able to run FS operations
|
153 |
+
over generic URLs, and dispatch to the specific implementations using the URL
|
154 |
+
protocol prefix.
|
155 |
+
|
156 |
+
Note: instances of this FS are always async, even if you never use it with any async
|
157 |
+
backend.
|
158 |
+
"""
|
159 |
+
|
160 |
+
protocol = "generic" # there is no real reason to ever use a protocol with this FS
|
161 |
+
|
162 |
+
def __init__(self, default_method="default", **kwargs):
|
163 |
+
"""
|
164 |
+
|
165 |
+
Parameters
|
166 |
+
----------
|
167 |
+
default_method: str (optional)
|
168 |
+
Defines how to configure backend FS instances. Options are:
|
169 |
+
- "default": instantiate like FSClass(), with no
|
170 |
+
extra arguments; this is the default instance of that FS, and can be
|
171 |
+
configured via the config system
|
172 |
+
- "generic": takes instances from the `_generic_fs` dict in this module,
|
173 |
+
which you must populate before use. Keys are by protocol
|
174 |
+
- "current": takes the most recently instantiated version of each FS
|
175 |
+
"""
|
176 |
+
self.method = default_method
|
177 |
+
super().__init__(**kwargs)
|
178 |
+
|
179 |
+
def _parent(self, path):
|
180 |
+
fs = _resolve_fs(path, self.method)
|
181 |
+
return fs.unstrip_protocol(fs._parent(path))
|
182 |
+
|
183 |
+
def _strip_protocol(self, path):
|
184 |
+
# normalization only
|
185 |
+
fs = _resolve_fs(path, self.method)
|
186 |
+
return fs.unstrip_protocol(fs._strip_protocol(path))
|
187 |
+
|
188 |
+
async def _find(self, path, maxdepth=None, withdirs=False, detail=False, **kwargs):
|
189 |
+
fs = _resolve_fs(path, self.method)
|
190 |
+
if fs.async_impl:
|
191 |
+
out = await fs._find(
|
192 |
+
path, maxdepth=maxdepth, withdirs=withdirs, detail=True, **kwargs
|
193 |
+
)
|
194 |
+
else:
|
195 |
+
out = fs.find(
|
196 |
+
path, maxdepth=maxdepth, withdirs=withdirs, detail=True, **kwargs
|
197 |
+
)
|
198 |
+
result = {}
|
199 |
+
for k, v in out.items():
|
200 |
+
name = fs.unstrip_protocol(k)
|
201 |
+
v["name"] = name
|
202 |
+
result[name] = v
|
203 |
+
if detail:
|
204 |
+
return result
|
205 |
+
return list(result)
|
206 |
+
|
207 |
+
async def _info(self, url, **kwargs):
|
208 |
+
fs = _resolve_fs(url, self.method)
|
209 |
+
if fs.async_impl:
|
210 |
+
out = await fs._info(url, **kwargs)
|
211 |
+
else:
|
212 |
+
out = fs.info(url, **kwargs)
|
213 |
+
out["name"] = fs.unstrip_protocol(out["name"])
|
214 |
+
return out
|
215 |
+
|
216 |
+
async def _ls(
|
217 |
+
self,
|
218 |
+
url,
|
219 |
+
detail=True,
|
220 |
+
**kwargs,
|
221 |
+
):
|
222 |
+
fs = _resolve_fs(url, self.method)
|
223 |
+
if fs.async_impl:
|
224 |
+
out = await fs._ls(url, detail=True, **kwargs)
|
225 |
+
else:
|
226 |
+
out = fs.ls(url, detail=True, **kwargs)
|
227 |
+
for o in out:
|
228 |
+
o["name"] = fs.unstrip_protocol(o["name"])
|
229 |
+
if detail:
|
230 |
+
return out
|
231 |
+
else:
|
232 |
+
return [o["name"] for o in out]
|
233 |
+
|
234 |
+
async def _cat_file(
|
235 |
+
self,
|
236 |
+
url,
|
237 |
+
**kwargs,
|
238 |
+
):
|
239 |
+
fs = _resolve_fs(url, self.method)
|
240 |
+
if fs.async_impl:
|
241 |
+
return await fs._cat_file(url, **kwargs)
|
242 |
+
else:
|
243 |
+
return fs.cat_file(url, **kwargs)
|
244 |
+
|
245 |
+
async def _pipe_file(
|
246 |
+
self,
|
247 |
+
path,
|
248 |
+
value,
|
249 |
+
**kwargs,
|
250 |
+
):
|
251 |
+
fs = _resolve_fs(path, self.method)
|
252 |
+
if fs.async_impl:
|
253 |
+
return await fs._pipe_file(path, value, **kwargs)
|
254 |
+
else:
|
255 |
+
return fs.pipe_file(path, value, **kwargs)
|
256 |
+
|
257 |
+
async def _rm(self, url, **kwargs):
|
258 |
+
urls = url
|
259 |
+
if isinstance(urls, str):
|
260 |
+
urls = [urls]
|
261 |
+
fs = _resolve_fs(urls[0], self.method)
|
262 |
+
if fs.async_impl:
|
263 |
+
await fs._rm(urls, **kwargs)
|
264 |
+
else:
|
265 |
+
fs.rm(url, **kwargs)
|
266 |
+
|
267 |
+
async def _makedirs(self, path, exist_ok=False):
|
268 |
+
logger.debug("Make dir %s", path)
|
269 |
+
fs = _resolve_fs(path, self.method)
|
270 |
+
if fs.async_impl:
|
271 |
+
await fs._makedirs(path, exist_ok=exist_ok)
|
272 |
+
else:
|
273 |
+
fs.makedirs(path, exist_ok=exist_ok)
|
274 |
+
|
275 |
+
def rsync(self, source, destination, **kwargs):
|
276 |
+
"""Sync files between two directory trees
|
277 |
+
|
278 |
+
See `func:rsync` for more details.
|
279 |
+
"""
|
280 |
+
rsync(source, destination, fs=self, **kwargs)
|
281 |
+
|
282 |
+
async def _cp_file(
|
283 |
+
self,
|
284 |
+
url,
|
285 |
+
url2,
|
286 |
+
blocksize=2**20,
|
287 |
+
callback=DEFAULT_CALLBACK,
|
288 |
+
**kwargs,
|
289 |
+
):
|
290 |
+
fs = _resolve_fs(url, self.method)
|
291 |
+
fs2 = _resolve_fs(url2, self.method)
|
292 |
+
if fs is fs2:
|
293 |
+
# pure remote
|
294 |
+
if fs.async_impl:
|
295 |
+
return await fs._cp_file(url, url2, **kwargs)
|
296 |
+
else:
|
297 |
+
return fs.cp_file(url, url2, **kwargs)
|
298 |
+
kw = {"blocksize": 0, "cache_type": "none"}
|
299 |
+
try:
|
300 |
+
f1 = (
|
301 |
+
await fs.open_async(url, "rb")
|
302 |
+
if hasattr(fs, "open_async")
|
303 |
+
else fs.open(url, "rb", **kw)
|
304 |
+
)
|
305 |
+
callback.set_size(await maybe_await(f1.size))
|
306 |
+
f2 = (
|
307 |
+
await fs2.open_async(url2, "wb")
|
308 |
+
if hasattr(fs2, "open_async")
|
309 |
+
else fs2.open(url2, "wb", **kw)
|
310 |
+
)
|
311 |
+
while f1.size is None or f2.tell() < f1.size:
|
312 |
+
data = await maybe_await(f1.read(blocksize))
|
313 |
+
if f1.size is None and not data:
|
314 |
+
break
|
315 |
+
await maybe_await(f2.write(data))
|
316 |
+
callback.absolute_update(f2.tell())
|
317 |
+
finally:
|
318 |
+
try:
|
319 |
+
await maybe_await(f2.close())
|
320 |
+
await maybe_await(f1.close())
|
321 |
+
except NameError:
|
322 |
+
# fail while opening f1 or f2
|
323 |
+
pass
|
324 |
+
|
325 |
+
async def _make_many_dirs(self, urls, exist_ok=True):
|
326 |
+
fs = _resolve_fs(urls[0], self.method)
|
327 |
+
if fs.async_impl:
|
328 |
+
coros = [fs._makedirs(u, exist_ok=exist_ok) for u in urls]
|
329 |
+
await _run_coros_in_chunks(coros)
|
330 |
+
else:
|
331 |
+
for u in urls:
|
332 |
+
fs.makedirs(u, exist_ok=exist_ok)
|
333 |
+
|
334 |
+
make_many_dirs = sync_wrapper(_make_many_dirs)
|
335 |
+
|
336 |
+
async def _copy(
|
337 |
+
self,
|
338 |
+
path1: list[str],
|
339 |
+
path2: list[str],
|
340 |
+
recursive: bool = False,
|
341 |
+
on_error: str = "ignore",
|
342 |
+
maxdepth: Optional[int] = None,
|
343 |
+
batch_size: Optional[int] = None,
|
344 |
+
tempdir: Optional[str] = None,
|
345 |
+
**kwargs,
|
346 |
+
):
|
347 |
+
if recursive:
|
348 |
+
raise NotImplementedError
|
349 |
+
fs = _resolve_fs(path1[0], self.method)
|
350 |
+
fs2 = _resolve_fs(path2[0], self.method)
|
351 |
+
# not expanding paths atm., assume call is from rsync()
|
352 |
+
if fs is fs2:
|
353 |
+
# pure remote
|
354 |
+
if fs.async_impl:
|
355 |
+
return await fs._copy(path1, path2, **kwargs)
|
356 |
+
else:
|
357 |
+
return fs.copy(path1, path2, **kwargs)
|
358 |
+
await copy_file_op(
|
359 |
+
fs, path1, fs2, path2, tempdir, batch_size, on_error=on_error
|
360 |
+
)
|
361 |
+
|
362 |
+
|
363 |
+
async def copy_file_op(
|
364 |
+
fs1, url1, fs2, url2, tempdir=None, batch_size=20, on_error="ignore"
|
365 |
+
):
|
366 |
+
import tempfile
|
367 |
+
|
368 |
+
tempdir = tempdir or tempfile.mkdtemp()
|
369 |
+
try:
|
370 |
+
coros = [
|
371 |
+
_copy_file_op(
|
372 |
+
fs1,
|
373 |
+
u1,
|
374 |
+
fs2,
|
375 |
+
u2,
|
376 |
+
os.path.join(tempdir, uuid.uuid4().hex),
|
377 |
+
on_error=on_error,
|
378 |
+
)
|
379 |
+
for u1, u2 in zip(url1, url2)
|
380 |
+
]
|
381 |
+
await _run_coros_in_chunks(coros, batch_size=batch_size)
|
382 |
+
finally:
|
383 |
+
shutil.rmtree(tempdir)
|
384 |
+
|
385 |
+
|
386 |
+
async def _copy_file_op(fs1, url1, fs2, url2, local, on_error="ignore"):
|
387 |
+
ex = () if on_error == "raise" else Exception
|
388 |
+
logger.debug("Copy %s -> %s", url1, url2)
|
389 |
+
try:
|
390 |
+
if fs1.async_impl:
|
391 |
+
await fs1._get_file(url1, local)
|
392 |
+
else:
|
393 |
+
fs1.get_file(url1, local)
|
394 |
+
if fs2.async_impl:
|
395 |
+
await fs2._put_file(local, url2)
|
396 |
+
else:
|
397 |
+
fs2.put_file(local, url2)
|
398 |
+
os.unlink(local)
|
399 |
+
logger.debug("Copy %s -> %s; done", url1, url2)
|
400 |
+
except ex as e:
|
401 |
+
logger.debug("ignoring cp exception for %s: %s", url1, e)
|
402 |
+
|
403 |
+
|
404 |
+
async def maybe_await(cor):
|
405 |
+
if inspect.iscoroutine(cor):
|
406 |
+
return await cor
|
407 |
+
else:
|
408 |
+
return cor
|
llmeval-env/lib/python3.10/site-packages/fsspec/mapping.py
ADDED
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import array
|
2 |
+
import logging
|
3 |
+
import posixpath
|
4 |
+
import warnings
|
5 |
+
from collections.abc import MutableMapping
|
6 |
+
from functools import cached_property
|
7 |
+
|
8 |
+
from fsspec.core import url_to_fs
|
9 |
+
|
10 |
+
logger = logging.getLogger("fsspec.mapping")
|
11 |
+
|
12 |
+
|
13 |
+
class FSMap(MutableMapping):
|
14 |
+
"""Wrap a FileSystem instance as a mutable wrapping.
|
15 |
+
|
16 |
+
The keys of the mapping become files under the given root, and the
|
17 |
+
values (which must be bytes) the contents of those files.
|
18 |
+
|
19 |
+
Parameters
|
20 |
+
----------
|
21 |
+
root: string
|
22 |
+
prefix for all the files
|
23 |
+
fs: FileSystem instance
|
24 |
+
check: bool (=True)
|
25 |
+
performs a touch at the location, to check for write access.
|
26 |
+
|
27 |
+
Examples
|
28 |
+
--------
|
29 |
+
>>> fs = FileSystem(**parameters) # doctest: +SKIP
|
30 |
+
>>> d = FSMap('my-data/path/', fs) # doctest: +SKIP
|
31 |
+
or, more likely
|
32 |
+
>>> d = fs.get_mapper('my-data/path/')
|
33 |
+
|
34 |
+
>>> d['loc1'] = b'Hello World' # doctest: +SKIP
|
35 |
+
>>> list(d.keys()) # doctest: +SKIP
|
36 |
+
['loc1']
|
37 |
+
>>> d['loc1'] # doctest: +SKIP
|
38 |
+
b'Hello World'
|
39 |
+
"""
|
40 |
+
|
41 |
+
def __init__(self, root, fs, check=False, create=False, missing_exceptions=None):
|
42 |
+
self.fs = fs
|
43 |
+
self.root = fs._strip_protocol(root)
|
44 |
+
self._root_key_to_str = fs._strip_protocol(posixpath.join(root, "x"))[:-1]
|
45 |
+
if missing_exceptions is None:
|
46 |
+
missing_exceptions = (
|
47 |
+
FileNotFoundError,
|
48 |
+
IsADirectoryError,
|
49 |
+
NotADirectoryError,
|
50 |
+
)
|
51 |
+
self.missing_exceptions = missing_exceptions
|
52 |
+
self.check = check
|
53 |
+
self.create = create
|
54 |
+
if create:
|
55 |
+
if not self.fs.exists(root):
|
56 |
+
self.fs.mkdir(root)
|
57 |
+
if check:
|
58 |
+
if not self.fs.exists(root):
|
59 |
+
raise ValueError(
|
60 |
+
f"Path {root} does not exist. Create "
|
61 |
+
f" with the ``create=True`` keyword"
|
62 |
+
)
|
63 |
+
self.fs.touch(root + "/a")
|
64 |
+
self.fs.rm(root + "/a")
|
65 |
+
|
66 |
+
@cached_property
|
67 |
+
def dirfs(self):
|
68 |
+
"""dirfs instance that can be used with the same keys as the mapper"""
|
69 |
+
from .implementations.dirfs import DirFileSystem
|
70 |
+
|
71 |
+
return DirFileSystem(path=self._root_key_to_str, fs=self.fs)
|
72 |
+
|
73 |
+
def clear(self):
|
74 |
+
"""Remove all keys below root - empties out mapping"""
|
75 |
+
logger.info("Clear mapping at %s", self.root)
|
76 |
+
try:
|
77 |
+
self.fs.rm(self.root, True)
|
78 |
+
self.fs.mkdir(self.root)
|
79 |
+
except: # noqa: E722
|
80 |
+
pass
|
81 |
+
|
82 |
+
def getitems(self, keys, on_error="raise"):
|
83 |
+
"""Fetch multiple items from the store
|
84 |
+
|
85 |
+
If the backend is async-able, this might proceed concurrently
|
86 |
+
|
87 |
+
Parameters
|
88 |
+
----------
|
89 |
+
keys: list(str)
|
90 |
+
They keys to be fetched
|
91 |
+
on_error : "raise", "omit", "return"
|
92 |
+
If raise, an underlying exception will be raised (converted to KeyError
|
93 |
+
if the type is in self.missing_exceptions); if omit, keys with exception
|
94 |
+
will simply not be included in the output; if "return", all keys are
|
95 |
+
included in the output, but the value will be bytes or an exception
|
96 |
+
instance.
|
97 |
+
|
98 |
+
Returns
|
99 |
+
-------
|
100 |
+
dict(key, bytes|exception)
|
101 |
+
"""
|
102 |
+
keys2 = [self._key_to_str(k) for k in keys]
|
103 |
+
oe = on_error if on_error == "raise" else "return"
|
104 |
+
try:
|
105 |
+
out = self.fs.cat(keys2, on_error=oe)
|
106 |
+
if isinstance(out, bytes):
|
107 |
+
out = {keys2[0]: out}
|
108 |
+
except self.missing_exceptions as e:
|
109 |
+
raise KeyError from e
|
110 |
+
out = {
|
111 |
+
k: (KeyError() if isinstance(v, self.missing_exceptions) else v)
|
112 |
+
for k, v in out.items()
|
113 |
+
}
|
114 |
+
return {
|
115 |
+
key: out[k2]
|
116 |
+
for key, k2 in zip(keys, keys2)
|
117 |
+
if on_error == "return" or not isinstance(out[k2], BaseException)
|
118 |
+
}
|
119 |
+
|
120 |
+
def setitems(self, values_dict):
|
121 |
+
"""Set the values of multiple items in the store
|
122 |
+
|
123 |
+
Parameters
|
124 |
+
----------
|
125 |
+
values_dict: dict(str, bytes)
|
126 |
+
"""
|
127 |
+
values = {self._key_to_str(k): maybe_convert(v) for k, v in values_dict.items()}
|
128 |
+
self.fs.pipe(values)
|
129 |
+
|
130 |
+
def delitems(self, keys):
|
131 |
+
"""Remove multiple keys from the store"""
|
132 |
+
self.fs.rm([self._key_to_str(k) for k in keys])
|
133 |
+
|
134 |
+
def _key_to_str(self, key):
|
135 |
+
"""Generate full path for the key"""
|
136 |
+
if not isinstance(key, str):
|
137 |
+
# raise TypeError("key must be of type `str`, got `{type(key).__name__}`"
|
138 |
+
warnings.warn(
|
139 |
+
"from fsspec 2023.5 onward FSMap non-str keys will raise TypeError",
|
140 |
+
DeprecationWarning,
|
141 |
+
)
|
142 |
+
if isinstance(key, list):
|
143 |
+
key = tuple(key)
|
144 |
+
key = str(key)
|
145 |
+
return f"{self._root_key_to_str}{key}".rstrip("/")
|
146 |
+
|
147 |
+
def _str_to_key(self, s):
|
148 |
+
"""Strip path of to leave key name"""
|
149 |
+
return s[len(self.root) :].lstrip("/")
|
150 |
+
|
151 |
+
def __getitem__(self, key, default=None):
|
152 |
+
"""Retrieve data"""
|
153 |
+
k = self._key_to_str(key)
|
154 |
+
try:
|
155 |
+
result = self.fs.cat(k)
|
156 |
+
except self.missing_exceptions:
|
157 |
+
if default is not None:
|
158 |
+
return default
|
159 |
+
raise KeyError(key)
|
160 |
+
return result
|
161 |
+
|
162 |
+
def pop(self, key, default=None):
|
163 |
+
"""Pop data"""
|
164 |
+
result = self.__getitem__(key, default)
|
165 |
+
try:
|
166 |
+
del self[key]
|
167 |
+
except KeyError:
|
168 |
+
pass
|
169 |
+
return result
|
170 |
+
|
171 |
+
def __setitem__(self, key, value):
|
172 |
+
"""Store value in key"""
|
173 |
+
key = self._key_to_str(key)
|
174 |
+
self.fs.mkdirs(self.fs._parent(key), exist_ok=True)
|
175 |
+
self.fs.pipe_file(key, maybe_convert(value))
|
176 |
+
|
177 |
+
def __iter__(self):
|
178 |
+
return (self._str_to_key(x) for x in self.fs.find(self.root))
|
179 |
+
|
180 |
+
def __len__(self):
|
181 |
+
return len(self.fs.find(self.root))
|
182 |
+
|
183 |
+
def __delitem__(self, key):
|
184 |
+
"""Remove key"""
|
185 |
+
try:
|
186 |
+
self.fs.rm(self._key_to_str(key))
|
187 |
+
except: # noqa: E722
|
188 |
+
raise KeyError
|
189 |
+
|
190 |
+
def __contains__(self, key):
|
191 |
+
"""Does key exist in mapping?"""
|
192 |
+
path = self._key_to_str(key)
|
193 |
+
return self.fs.isfile(path)
|
194 |
+
|
195 |
+
def __reduce__(self):
|
196 |
+
return FSMap, (self.root, self.fs, False, False, self.missing_exceptions)
|
197 |
+
|
198 |
+
|
199 |
+
def maybe_convert(value):
|
200 |
+
if isinstance(value, array.array) or hasattr(value, "__array__"):
|
201 |
+
# bytes-like things
|
202 |
+
if hasattr(value, "dtype") and value.dtype.kind in "Mm":
|
203 |
+
# The buffer interface doesn't support datetime64/timdelta64 numpy
|
204 |
+
# arrays
|
205 |
+
value = value.view("int64")
|
206 |
+
value = bytes(memoryview(value))
|
207 |
+
return value
|
208 |
+
|
209 |
+
|
210 |
+
def get_mapper(
|
211 |
+
url="",
|
212 |
+
check=False,
|
213 |
+
create=False,
|
214 |
+
missing_exceptions=None,
|
215 |
+
alternate_root=None,
|
216 |
+
**kwargs,
|
217 |
+
):
|
218 |
+
"""Create key-value interface for given URL and options
|
219 |
+
|
220 |
+
The URL will be of the form "protocol://location" and point to the root
|
221 |
+
of the mapper required. All keys will be file-names below this location,
|
222 |
+
and their values the contents of each key.
|
223 |
+
|
224 |
+
Also accepts compound URLs like zip::s3://bucket/file.zip , see ``fsspec.open``.
|
225 |
+
|
226 |
+
Parameters
|
227 |
+
----------
|
228 |
+
url: str
|
229 |
+
Root URL of mapping
|
230 |
+
check: bool
|
231 |
+
Whether to attempt to read from the location before instantiation, to
|
232 |
+
check that the mapping does exist
|
233 |
+
create: bool
|
234 |
+
Whether to make the directory corresponding to the root before
|
235 |
+
instantiating
|
236 |
+
missing_exceptions: None or tuple
|
237 |
+
If given, these exception types will be regarded as missing keys and
|
238 |
+
return KeyError when trying to read data. By default, you get
|
239 |
+
(FileNotFoundError, IsADirectoryError, NotADirectoryError)
|
240 |
+
alternate_root: None or str
|
241 |
+
In cases of complex URLs, the parser may fail to pick the correct part
|
242 |
+
for the mapper root, so this arg can override
|
243 |
+
|
244 |
+
Returns
|
245 |
+
-------
|
246 |
+
``FSMap`` instance, the dict-like key-value store.
|
247 |
+
"""
|
248 |
+
# Removing protocol here - could defer to each open() on the backend
|
249 |
+
fs, urlpath = url_to_fs(url, **kwargs)
|
250 |
+
root = alternate_root if alternate_root is not None else urlpath
|
251 |
+
return FSMap(root, fs, check, create, missing_exceptions=missing_exceptions)
|
llmeval-env/lib/python3.10/site-packages/fsspec/registry.py
ADDED
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import importlib
|
4 |
+
import types
|
5 |
+
import warnings
|
6 |
+
|
7 |
+
__all__ = ["registry", "get_filesystem_class", "default"]
|
8 |
+
|
9 |
+
# internal, mutable
|
10 |
+
_registry: dict[str, type] = {}
|
11 |
+
|
12 |
+
# external, immutable
|
13 |
+
registry = types.MappingProxyType(_registry)
|
14 |
+
default = "file"
|
15 |
+
|
16 |
+
|
17 |
+
def register_implementation(name, cls, clobber=False, errtxt=None):
|
18 |
+
"""Add implementation class to the registry
|
19 |
+
|
20 |
+
Parameters
|
21 |
+
----------
|
22 |
+
name: str
|
23 |
+
Protocol name to associate with the class
|
24 |
+
cls: class or str
|
25 |
+
if a class: fsspec-compliant implementation class (normally inherits from
|
26 |
+
``fsspec.AbstractFileSystem``, gets added straight to the registry. If a
|
27 |
+
str, the full path to an implementation class like package.module.class,
|
28 |
+
which gets added to known_implementations,
|
29 |
+
so the import is deferred until the filesystem is actually used.
|
30 |
+
clobber: bool (optional)
|
31 |
+
Whether to overwrite a protocol with the same name; if False, will raise
|
32 |
+
instead.
|
33 |
+
errtxt: str (optional)
|
34 |
+
If given, then a failure to import the given class will result in this
|
35 |
+
text being given.
|
36 |
+
"""
|
37 |
+
if isinstance(cls, str):
|
38 |
+
if name in known_implementations and clobber is False:
|
39 |
+
if cls != known_implementations[name]["class"]:
|
40 |
+
raise ValueError(
|
41 |
+
f"Name ({name}) already in the known_implementations and clobber "
|
42 |
+
f"is False"
|
43 |
+
)
|
44 |
+
else:
|
45 |
+
known_implementations[name] = {
|
46 |
+
"class": cls,
|
47 |
+
"err": errtxt or f"{cls} import failed for protocol {name}",
|
48 |
+
}
|
49 |
+
|
50 |
+
else:
|
51 |
+
if name in registry and clobber is False:
|
52 |
+
if _registry[name] is not cls:
|
53 |
+
raise ValueError(
|
54 |
+
f"Name ({name}) already in the registry and clobber is False"
|
55 |
+
)
|
56 |
+
else:
|
57 |
+
_registry[name] = cls
|
58 |
+
|
59 |
+
|
60 |
+
# protocols mapped to the class which implements them. This dict can be
|
61 |
+
# updated with register_implementation
|
62 |
+
known_implementations = {
|
63 |
+
"abfs": {
|
64 |
+
"class": "adlfs.AzureBlobFileSystem",
|
65 |
+
"err": "Install adlfs to access Azure Datalake Gen2 and Azure Blob Storage",
|
66 |
+
},
|
67 |
+
"adl": {
|
68 |
+
"class": "adlfs.AzureDatalakeFileSystem",
|
69 |
+
"err": "Install adlfs to access Azure Datalake Gen1",
|
70 |
+
},
|
71 |
+
"arrow_hdfs": {
|
72 |
+
"class": "fsspec.implementations.arrow.HadoopFileSystem",
|
73 |
+
"err": "pyarrow and local java libraries required for HDFS",
|
74 |
+
},
|
75 |
+
"asynclocal": {
|
76 |
+
"class": "morefs.asyn_local.AsyncLocalFileSystem",
|
77 |
+
"err": "Install 'morefs[asynclocalfs]' to use AsyncLocalFileSystem",
|
78 |
+
},
|
79 |
+
"az": {
|
80 |
+
"class": "adlfs.AzureBlobFileSystem",
|
81 |
+
"err": "Install adlfs to access Azure Datalake Gen2 and Azure Blob Storage",
|
82 |
+
},
|
83 |
+
"blockcache": {"class": "fsspec.implementations.cached.CachingFileSystem"},
|
84 |
+
"box": {
|
85 |
+
"class": "boxfs.BoxFileSystem",
|
86 |
+
"err": "Please install boxfs to access BoxFileSystem",
|
87 |
+
},
|
88 |
+
"cached": {"class": "fsspec.implementations.cached.CachingFileSystem"},
|
89 |
+
"dask": {
|
90 |
+
"class": "fsspec.implementations.dask.DaskWorkerFileSystem",
|
91 |
+
"err": "Install dask distributed to access worker file system",
|
92 |
+
},
|
93 |
+
"data": {"class": "fsspec.implementations.data.DataFileSystem"},
|
94 |
+
"dbfs": {
|
95 |
+
"class": "fsspec.implementations.dbfs.DatabricksFileSystem",
|
96 |
+
"err": "Install the requests package to use the DatabricksFileSystem",
|
97 |
+
},
|
98 |
+
"dir": {"class": "fsspec.implementations.dirfs.DirFileSystem"},
|
99 |
+
"dropbox": {
|
100 |
+
"class": "dropboxdrivefs.DropboxDriveFileSystem",
|
101 |
+
"err": (
|
102 |
+
'DropboxFileSystem requires "dropboxdrivefs","requests" and "'
|
103 |
+
'"dropbox" to be installed'
|
104 |
+
),
|
105 |
+
},
|
106 |
+
"dvc": {
|
107 |
+
"class": "dvc.api.DVCFileSystem",
|
108 |
+
"err": "Install dvc to access DVCFileSystem",
|
109 |
+
},
|
110 |
+
"file": {"class": "fsspec.implementations.local.LocalFileSystem"},
|
111 |
+
"filecache": {"class": "fsspec.implementations.cached.WholeFileCacheFileSystem"},
|
112 |
+
"ftp": {"class": "fsspec.implementations.ftp.FTPFileSystem"},
|
113 |
+
"gcs": {
|
114 |
+
"class": "gcsfs.GCSFileSystem",
|
115 |
+
"err": "Please install gcsfs to access Google Storage",
|
116 |
+
},
|
117 |
+
"gdrive": {
|
118 |
+
"class": "gdrivefs.GoogleDriveFileSystem",
|
119 |
+
"err": "Please install gdrivefs for access to Google Drive",
|
120 |
+
},
|
121 |
+
"generic": {"class": "fsspec.generic.GenericFileSystem"},
|
122 |
+
"git": {
|
123 |
+
"class": "fsspec.implementations.git.GitFileSystem",
|
124 |
+
"err": "Install pygit2 to browse local git repos",
|
125 |
+
},
|
126 |
+
"github": {
|
127 |
+
"class": "fsspec.implementations.github.GithubFileSystem",
|
128 |
+
"err": "Install the requests package to use the github FS",
|
129 |
+
},
|
130 |
+
"gs": {
|
131 |
+
"class": "gcsfs.GCSFileSystem",
|
132 |
+
"err": "Please install gcsfs to access Google Storage",
|
133 |
+
},
|
134 |
+
"hdfs": {
|
135 |
+
"class": "fsspec.implementations.arrow.HadoopFileSystem",
|
136 |
+
"err": "pyarrow and local java libraries required for HDFS",
|
137 |
+
},
|
138 |
+
"hf": {
|
139 |
+
"class": "huggingface_hub.HfFileSystem",
|
140 |
+
"err": "Install huggingface_hub to access HfFileSystem",
|
141 |
+
},
|
142 |
+
"http": {
|
143 |
+
"class": "fsspec.implementations.http.HTTPFileSystem",
|
144 |
+
"err": 'HTTPFileSystem requires "requests" and "aiohttp" to be installed',
|
145 |
+
},
|
146 |
+
"https": {
|
147 |
+
"class": "fsspec.implementations.http.HTTPFileSystem",
|
148 |
+
"err": 'HTTPFileSystem requires "requests" and "aiohttp" to be installed',
|
149 |
+
},
|
150 |
+
"jlab": {
|
151 |
+
"class": "fsspec.implementations.jupyter.JupyterFileSystem",
|
152 |
+
"err": "Jupyter FS requires requests to be installed",
|
153 |
+
},
|
154 |
+
"jupyter": {
|
155 |
+
"class": "fsspec.implementations.jupyter.JupyterFileSystem",
|
156 |
+
"err": "Jupyter FS requires requests to be installed",
|
157 |
+
},
|
158 |
+
"lakefs": {
|
159 |
+
"class": "lakefs_spec.LakeFSFileSystem",
|
160 |
+
"err": "Please install lakefs-spec to access LakeFSFileSystem",
|
161 |
+
},
|
162 |
+
"libarchive": {
|
163 |
+
"class": "fsspec.implementations.libarchive.LibArchiveFileSystem",
|
164 |
+
"err": "LibArchive requires to be installed",
|
165 |
+
},
|
166 |
+
"local": {"class": "fsspec.implementations.local.LocalFileSystem"},
|
167 |
+
"memory": {"class": "fsspec.implementations.memory.MemoryFileSystem"},
|
168 |
+
"oci": {
|
169 |
+
"class": "ocifs.OCIFileSystem",
|
170 |
+
"err": "Install ocifs to access OCI Object Storage",
|
171 |
+
},
|
172 |
+
"ocilake": {
|
173 |
+
"class": "ocifs.OCIFileSystem",
|
174 |
+
"err": "Install ocifs to access OCI Data Lake",
|
175 |
+
},
|
176 |
+
"oss": {
|
177 |
+
"class": "ossfs.OSSFileSystem",
|
178 |
+
"err": "Install ossfs to access Alibaba Object Storage System",
|
179 |
+
},
|
180 |
+
"reference": {"class": "fsspec.implementations.reference.ReferenceFileSystem"},
|
181 |
+
"root": {
|
182 |
+
"class": "fsspec_xrootd.XRootDFileSystem",
|
183 |
+
"err": (
|
184 |
+
"Install fsspec-xrootd to access xrootd storage system. "
|
185 |
+
"Note: 'root' is the protocol name for xrootd storage systems, "
|
186 |
+
"not referring to root directories"
|
187 |
+
),
|
188 |
+
},
|
189 |
+
"s3": {"class": "s3fs.S3FileSystem", "err": "Install s3fs to access S3"},
|
190 |
+
"s3a": {"class": "s3fs.S3FileSystem", "err": "Install s3fs to access S3"},
|
191 |
+
"sftp": {
|
192 |
+
"class": "fsspec.implementations.sftp.SFTPFileSystem",
|
193 |
+
"err": 'SFTPFileSystem requires "paramiko" to be installed',
|
194 |
+
},
|
195 |
+
"simplecache": {"class": "fsspec.implementations.cached.SimpleCacheFileSystem"},
|
196 |
+
"smb": {
|
197 |
+
"class": "fsspec.implementations.smb.SMBFileSystem",
|
198 |
+
"err": 'SMB requires "smbprotocol" or "smbprotocol[kerberos]" installed',
|
199 |
+
},
|
200 |
+
"ssh": {
|
201 |
+
"class": "fsspec.implementations.sftp.SFTPFileSystem",
|
202 |
+
"err": 'SFTPFileSystem requires "paramiko" to be installed',
|
203 |
+
},
|
204 |
+
"tar": {"class": "fsspec.implementations.tar.TarFileSystem"},
|
205 |
+
"wandb": {"class": "wandbfs.WandbFS", "err": "Install wandbfs to access wandb"},
|
206 |
+
"webdav": {
|
207 |
+
"class": "webdav4.fsspec.WebdavFileSystem",
|
208 |
+
"err": "Install webdav4 to access WebDAV",
|
209 |
+
},
|
210 |
+
"webhdfs": {
|
211 |
+
"class": "fsspec.implementations.webhdfs.WebHDFS",
|
212 |
+
"err": 'webHDFS access requires "requests" to be installed',
|
213 |
+
},
|
214 |
+
"zip": {"class": "fsspec.implementations.zip.ZipFileSystem"},
|
215 |
+
}
|
216 |
+
|
217 |
+
|
218 |
+
def get_filesystem_class(protocol):
|
219 |
+
"""Fetch named protocol implementation from the registry
|
220 |
+
|
221 |
+
The dict ``known_implementations`` maps protocol names to the locations
|
222 |
+
of classes implementing the corresponding file-system. When used for the
|
223 |
+
first time, appropriate imports will happen and the class will be placed in
|
224 |
+
the registry. All subsequent calls will fetch directly from the registry.
|
225 |
+
|
226 |
+
Some protocol implementations require additional dependencies, and so the
|
227 |
+
import may fail. In this case, the string in the "err" field of the
|
228 |
+
``known_implementations`` will be given as the error message.
|
229 |
+
"""
|
230 |
+
if not protocol:
|
231 |
+
protocol = default
|
232 |
+
|
233 |
+
if protocol not in registry:
|
234 |
+
if protocol not in known_implementations:
|
235 |
+
raise ValueError(f"Protocol not known: {protocol}")
|
236 |
+
bit = known_implementations[protocol]
|
237 |
+
try:
|
238 |
+
register_implementation(protocol, _import_class(bit["class"]))
|
239 |
+
except ImportError as e:
|
240 |
+
raise ImportError(bit["err"]) from e
|
241 |
+
cls = registry[protocol]
|
242 |
+
if getattr(cls, "protocol", None) in ("abstract", None):
|
243 |
+
cls.protocol = protocol
|
244 |
+
|
245 |
+
return cls
|
246 |
+
|
247 |
+
|
248 |
+
s3_msg = """Your installed version of s3fs is very old and known to cause
|
249 |
+
severe performance issues, see also https://github.com/dask/dask/issues/10276
|
250 |
+
|
251 |
+
To fix, you should specify a lower version bound on s3fs, or
|
252 |
+
update the current installation.
|
253 |
+
"""
|
254 |
+
|
255 |
+
|
256 |
+
def _import_class(cls, minv=None):
|
257 |
+
"""Take a string FQP and return the imported class or identifier
|
258 |
+
|
259 |
+
cls is of the form "package.module.klass" or "package.module:subobject.klass"
|
260 |
+
"""
|
261 |
+
if ":" in cls:
|
262 |
+
mod, name = cls.rsplit(":", 1)
|
263 |
+
s3 = mod == "s3fs"
|
264 |
+
mod = importlib.import_module(mod)
|
265 |
+
if s3 and mod.__version__.split(".") < ["0", "5"]:
|
266 |
+
warnings.warn(s3_msg)
|
267 |
+
for part in name.split("."):
|
268 |
+
mod = getattr(mod, part)
|
269 |
+
return mod
|
270 |
+
else:
|
271 |
+
mod, name = cls.rsplit(".", 1)
|
272 |
+
s3 = mod == "s3fs"
|
273 |
+
mod = importlib.import_module(mod)
|
274 |
+
if s3 and mod.__version__.split(".") < ["0", "5"]:
|
275 |
+
warnings.warn(s3_msg)
|
276 |
+
return getattr(mod, name)
|
277 |
+
|
278 |
+
|
279 |
+
def filesystem(protocol, **storage_options):
|
280 |
+
"""Instantiate filesystems for given protocol and arguments
|
281 |
+
|
282 |
+
``storage_options`` are specific to the protocol being chosen, and are
|
283 |
+
passed directly to the class.
|
284 |
+
"""
|
285 |
+
if protocol == "arrow_hdfs":
|
286 |
+
warnings.warn(
|
287 |
+
"The 'arrow_hdfs' protocol has been deprecated and will be "
|
288 |
+
"removed in the future. Specify it as 'hdfs'.",
|
289 |
+
DeprecationWarning,
|
290 |
+
)
|
291 |
+
|
292 |
+
cls = get_filesystem_class(protocol)
|
293 |
+
return cls(**storage_options)
|
294 |
+
|
295 |
+
|
296 |
+
def available_protocols():
|
297 |
+
"""Return a list of the implemented protocols.
|
298 |
+
|
299 |
+
Note that any given protocol may require extra packages to be importable.
|
300 |
+
"""
|
301 |
+
return list(known_implementations)
|
llmeval-env/lib/python3.10/site-packages/fsspec/utils.py
ADDED
@@ -0,0 +1,742 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from __future__ import annotations
|
2 |
+
|
3 |
+
import contextlib
|
4 |
+
import logging
|
5 |
+
import math
|
6 |
+
import os
|
7 |
+
import pathlib
|
8 |
+
import re
|
9 |
+
import sys
|
10 |
+
import tempfile
|
11 |
+
from functools import partial
|
12 |
+
from hashlib import md5
|
13 |
+
from importlib.metadata import version
|
14 |
+
from typing import (
|
15 |
+
IO,
|
16 |
+
TYPE_CHECKING,
|
17 |
+
Any,
|
18 |
+
Callable,
|
19 |
+
Iterable,
|
20 |
+
Iterator,
|
21 |
+
Sequence,
|
22 |
+
TypeVar,
|
23 |
+
)
|
24 |
+
from urllib.parse import urlsplit
|
25 |
+
|
26 |
+
if TYPE_CHECKING:
|
27 |
+
from typing_extensions import TypeGuard
|
28 |
+
|
29 |
+
from fsspec.spec import AbstractFileSystem
|
30 |
+
|
31 |
+
|
32 |
+
DEFAULT_BLOCK_SIZE = 5 * 2**20
|
33 |
+
|
34 |
+
T = TypeVar("T")
|
35 |
+
|
36 |
+
|
37 |
+
def infer_storage_options(
|
38 |
+
urlpath: str, inherit_storage_options: dict[str, Any] | None = None
|
39 |
+
) -> dict[str, Any]:
|
40 |
+
"""Infer storage options from URL path and merge it with existing storage
|
41 |
+
options.
|
42 |
+
|
43 |
+
Parameters
|
44 |
+
----------
|
45 |
+
urlpath: str or unicode
|
46 |
+
Either local absolute file path or URL (hdfs://namenode:8020/file.csv)
|
47 |
+
inherit_storage_options: dict (optional)
|
48 |
+
Its contents will get merged with the inferred information from the
|
49 |
+
given path
|
50 |
+
|
51 |
+
Returns
|
52 |
+
-------
|
53 |
+
Storage options dict.
|
54 |
+
|
55 |
+
Examples
|
56 |
+
--------
|
57 |
+
>>> infer_storage_options('/mnt/datasets/test.csv') # doctest: +SKIP
|
58 |
+
{"protocol": "file", "path", "/mnt/datasets/test.csv"}
|
59 |
+
>>> infer_storage_options(
|
60 |
+
... 'hdfs://username:pwd@node:123/mnt/datasets/test.csv?q=1',
|
61 |
+
... inherit_storage_options={'extra': 'value'},
|
62 |
+
... ) # doctest: +SKIP
|
63 |
+
{"protocol": "hdfs", "username": "username", "password": "pwd",
|
64 |
+
"host": "node", "port": 123, "path": "/mnt/datasets/test.csv",
|
65 |
+
"url_query": "q=1", "extra": "value"}
|
66 |
+
"""
|
67 |
+
# Handle Windows paths including disk name in this special case
|
68 |
+
if (
|
69 |
+
re.match(r"^[a-zA-Z]:[\\/]", urlpath)
|
70 |
+
or re.match(r"^[a-zA-Z0-9]+://", urlpath) is None
|
71 |
+
):
|
72 |
+
return {"protocol": "file", "path": urlpath}
|
73 |
+
|
74 |
+
parsed_path = urlsplit(urlpath)
|
75 |
+
protocol = parsed_path.scheme or "file"
|
76 |
+
if parsed_path.fragment:
|
77 |
+
path = "#".join([parsed_path.path, parsed_path.fragment])
|
78 |
+
else:
|
79 |
+
path = parsed_path.path
|
80 |
+
if protocol == "file":
|
81 |
+
# Special case parsing file protocol URL on Windows according to:
|
82 |
+
# https://msdn.microsoft.com/en-us/library/jj710207.aspx
|
83 |
+
windows_path = re.match(r"^/([a-zA-Z])[:|]([\\/].*)$", path)
|
84 |
+
if windows_path:
|
85 |
+
path = "%s:%s" % windows_path.groups()
|
86 |
+
|
87 |
+
if protocol in ["http", "https"]:
|
88 |
+
# for HTTP, we don't want to parse, as requests will anyway
|
89 |
+
return {"protocol": protocol, "path": urlpath}
|
90 |
+
|
91 |
+
options: dict[str, Any] = {"protocol": protocol, "path": path}
|
92 |
+
|
93 |
+
if parsed_path.netloc:
|
94 |
+
# Parse `hostname` from netloc manually because `parsed_path.hostname`
|
95 |
+
# lowercases the hostname which is not always desirable (e.g. in S3):
|
96 |
+
# https://github.com/dask/dask/issues/1417
|
97 |
+
options["host"] = parsed_path.netloc.rsplit("@", 1)[-1].rsplit(":", 1)[0]
|
98 |
+
|
99 |
+
if protocol in ("s3", "s3a", "gcs", "gs"):
|
100 |
+
options["path"] = options["host"] + options["path"]
|
101 |
+
else:
|
102 |
+
options["host"] = options["host"]
|
103 |
+
if parsed_path.port:
|
104 |
+
options["port"] = parsed_path.port
|
105 |
+
if parsed_path.username:
|
106 |
+
options["username"] = parsed_path.username
|
107 |
+
if parsed_path.password:
|
108 |
+
options["password"] = parsed_path.password
|
109 |
+
|
110 |
+
if parsed_path.query:
|
111 |
+
options["url_query"] = parsed_path.query
|
112 |
+
if parsed_path.fragment:
|
113 |
+
options["url_fragment"] = parsed_path.fragment
|
114 |
+
|
115 |
+
if inherit_storage_options:
|
116 |
+
update_storage_options(options, inherit_storage_options)
|
117 |
+
|
118 |
+
return options
|
119 |
+
|
120 |
+
|
121 |
+
def update_storage_options(
|
122 |
+
options: dict[str, Any], inherited: dict[str, Any] | None = None
|
123 |
+
) -> None:
|
124 |
+
if not inherited:
|
125 |
+
inherited = {}
|
126 |
+
collisions = set(options) & set(inherited)
|
127 |
+
if collisions:
|
128 |
+
for collision in collisions:
|
129 |
+
if options.get(collision) != inherited.get(collision):
|
130 |
+
raise KeyError(
|
131 |
+
f"Collision between inferred and specified storage "
|
132 |
+
f"option:\n{collision}"
|
133 |
+
)
|
134 |
+
options.update(inherited)
|
135 |
+
|
136 |
+
|
137 |
+
# Compression extensions registered via fsspec.compression.register_compression
|
138 |
+
compressions: dict[str, str] = {}
|
139 |
+
|
140 |
+
|
141 |
+
def infer_compression(filename: str) -> str | None:
|
142 |
+
"""Infer compression, if available, from filename.
|
143 |
+
|
144 |
+
Infer a named compression type, if registered and available, from filename
|
145 |
+
extension. This includes builtin (gz, bz2, zip) compressions, as well as
|
146 |
+
optional compressions. See fsspec.compression.register_compression.
|
147 |
+
"""
|
148 |
+
extension = os.path.splitext(filename)[-1].strip(".").lower()
|
149 |
+
if extension in compressions:
|
150 |
+
return compressions[extension]
|
151 |
+
return None
|
152 |
+
|
153 |
+
|
154 |
+
def build_name_function(max_int: float) -> Callable[[int], str]:
|
155 |
+
"""Returns a function that receives a single integer
|
156 |
+
and returns it as a string padded by enough zero characters
|
157 |
+
to align with maximum possible integer
|
158 |
+
|
159 |
+
>>> name_f = build_name_function(57)
|
160 |
+
|
161 |
+
>>> name_f(7)
|
162 |
+
'07'
|
163 |
+
>>> name_f(31)
|
164 |
+
'31'
|
165 |
+
>>> build_name_function(1000)(42)
|
166 |
+
'0042'
|
167 |
+
>>> build_name_function(999)(42)
|
168 |
+
'042'
|
169 |
+
>>> build_name_function(0)(0)
|
170 |
+
'0'
|
171 |
+
"""
|
172 |
+
# handle corner cases max_int is 0 or exact power of 10
|
173 |
+
max_int += 1e-8
|
174 |
+
|
175 |
+
pad_length = int(math.ceil(math.log10(max_int)))
|
176 |
+
|
177 |
+
def name_function(i: int) -> str:
|
178 |
+
return str(i).zfill(pad_length)
|
179 |
+
|
180 |
+
return name_function
|
181 |
+
|
182 |
+
|
183 |
+
def seek_delimiter(file: IO[bytes], delimiter: bytes, blocksize: int) -> bool:
|
184 |
+
r"""Seek current file to file start, file end, or byte after delimiter seq.
|
185 |
+
|
186 |
+
Seeks file to next chunk delimiter, where chunks are defined on file start,
|
187 |
+
a delimiting sequence, and file end. Use file.tell() to see location afterwards.
|
188 |
+
Note that file start is a valid split, so must be at offset > 0 to seek for
|
189 |
+
delimiter.
|
190 |
+
|
191 |
+
Parameters
|
192 |
+
----------
|
193 |
+
file: a file
|
194 |
+
delimiter: bytes
|
195 |
+
a delimiter like ``b'\n'`` or message sentinel, matching file .read() type
|
196 |
+
blocksize: int
|
197 |
+
Number of bytes to read from the file at once.
|
198 |
+
|
199 |
+
|
200 |
+
Returns
|
201 |
+
-------
|
202 |
+
Returns True if a delimiter was found, False if at file start or end.
|
203 |
+
|
204 |
+
"""
|
205 |
+
|
206 |
+
if file.tell() == 0:
|
207 |
+
# beginning-of-file, return without seek
|
208 |
+
return False
|
209 |
+
|
210 |
+
# Interface is for binary IO, with delimiter as bytes, but initialize last
|
211 |
+
# with result of file.read to preserve compatibility with text IO.
|
212 |
+
last: bytes | None = None
|
213 |
+
while True:
|
214 |
+
current = file.read(blocksize)
|
215 |
+
if not current:
|
216 |
+
# end-of-file without delimiter
|
217 |
+
return False
|
218 |
+
full = last + current if last else current
|
219 |
+
try:
|
220 |
+
if delimiter in full:
|
221 |
+
i = full.index(delimiter)
|
222 |
+
file.seek(file.tell() - (len(full) - i) + len(delimiter))
|
223 |
+
return True
|
224 |
+
elif len(current) < blocksize:
|
225 |
+
# end-of-file without delimiter
|
226 |
+
return False
|
227 |
+
except (OSError, ValueError):
|
228 |
+
pass
|
229 |
+
last = full[-len(delimiter) :]
|
230 |
+
|
231 |
+
|
232 |
+
def read_block(
|
233 |
+
f: IO[bytes],
|
234 |
+
offset: int,
|
235 |
+
length: int | None,
|
236 |
+
delimiter: bytes | None = None,
|
237 |
+
split_before: bool = False,
|
238 |
+
) -> bytes:
|
239 |
+
"""Read a block of bytes from a file
|
240 |
+
|
241 |
+
Parameters
|
242 |
+
----------
|
243 |
+
f: File
|
244 |
+
Open file
|
245 |
+
offset: int
|
246 |
+
Byte offset to start read
|
247 |
+
length: int
|
248 |
+
Number of bytes to read, read through end of file if None
|
249 |
+
delimiter: bytes (optional)
|
250 |
+
Ensure reading starts and stops at delimiter bytestring
|
251 |
+
split_before: bool (optional)
|
252 |
+
Start/stop read *before* delimiter bytestring.
|
253 |
+
|
254 |
+
|
255 |
+
If using the ``delimiter=`` keyword argument we ensure that the read
|
256 |
+
starts and stops at delimiter boundaries that follow the locations
|
257 |
+
``offset`` and ``offset + length``. If ``offset`` is zero then we
|
258 |
+
start at zero, regardless of delimiter. The bytestring returned WILL
|
259 |
+
include the terminating delimiter string.
|
260 |
+
|
261 |
+
Examples
|
262 |
+
--------
|
263 |
+
|
264 |
+
>>> from io import BytesIO # doctest: +SKIP
|
265 |
+
>>> f = BytesIO(b'Alice, 100\\nBob, 200\\nCharlie, 300') # doctest: +SKIP
|
266 |
+
>>> read_block(f, 0, 13) # doctest: +SKIP
|
267 |
+
b'Alice, 100\\nBo'
|
268 |
+
|
269 |
+
>>> read_block(f, 0, 13, delimiter=b'\\n') # doctest: +SKIP
|
270 |
+
b'Alice, 100\\nBob, 200\\n'
|
271 |
+
|
272 |
+
>>> read_block(f, 10, 10, delimiter=b'\\n') # doctest: +SKIP
|
273 |
+
b'Bob, 200\\nCharlie, 300'
|
274 |
+
"""
|
275 |
+
if delimiter:
|
276 |
+
f.seek(offset)
|
277 |
+
found_start_delim = seek_delimiter(f, delimiter, 2**16)
|
278 |
+
if length is None:
|
279 |
+
return f.read()
|
280 |
+
start = f.tell()
|
281 |
+
length -= start - offset
|
282 |
+
|
283 |
+
f.seek(start + length)
|
284 |
+
found_end_delim = seek_delimiter(f, delimiter, 2**16)
|
285 |
+
end = f.tell()
|
286 |
+
|
287 |
+
# Adjust split location to before delimiter if seek found the
|
288 |
+
# delimiter sequence, not start or end of file.
|
289 |
+
if found_start_delim and split_before:
|
290 |
+
start -= len(delimiter)
|
291 |
+
|
292 |
+
if found_end_delim and split_before:
|
293 |
+
end -= len(delimiter)
|
294 |
+
|
295 |
+
offset = start
|
296 |
+
length = end - start
|
297 |
+
|
298 |
+
f.seek(offset)
|
299 |
+
|
300 |
+
# TODO: allow length to be None and read to the end of the file?
|
301 |
+
assert length is not None
|
302 |
+
b = f.read(length)
|
303 |
+
return b
|
304 |
+
|
305 |
+
|
306 |
+
def tokenize(*args: Any, **kwargs: Any) -> str:
|
307 |
+
"""Deterministic token
|
308 |
+
|
309 |
+
(modified from dask.base)
|
310 |
+
|
311 |
+
>>> tokenize([1, 2, '3'])
|
312 |
+
'9d71491b50023b06fc76928e6eddb952'
|
313 |
+
|
314 |
+
>>> tokenize('Hello') == tokenize('Hello')
|
315 |
+
True
|
316 |
+
"""
|
317 |
+
if kwargs:
|
318 |
+
args += (kwargs,)
|
319 |
+
try:
|
320 |
+
h = md5(str(args).encode())
|
321 |
+
except ValueError:
|
322 |
+
# FIPS systems: https://github.com/fsspec/filesystem_spec/issues/380
|
323 |
+
h = md5(str(args).encode(), usedforsecurity=False)
|
324 |
+
return h.hexdigest()
|
325 |
+
|
326 |
+
|
327 |
+
def stringify_path(filepath: str | os.PathLike[str] | pathlib.Path) -> str:
|
328 |
+
"""Attempt to convert a path-like object to a string.
|
329 |
+
|
330 |
+
Parameters
|
331 |
+
----------
|
332 |
+
filepath: object to be converted
|
333 |
+
|
334 |
+
Returns
|
335 |
+
-------
|
336 |
+
filepath_str: maybe a string version of the object
|
337 |
+
|
338 |
+
Notes
|
339 |
+
-----
|
340 |
+
Objects supporting the fspath protocol are coerced according to its
|
341 |
+
__fspath__ method.
|
342 |
+
|
343 |
+
For backwards compatibility with older Python version, pathlib.Path
|
344 |
+
objects are specially coerced.
|
345 |
+
|
346 |
+
Any other object is passed through unchanged, which includes bytes,
|
347 |
+
strings, buffers, or anything else that's not even path-like.
|
348 |
+
"""
|
349 |
+
if isinstance(filepath, str):
|
350 |
+
return filepath
|
351 |
+
elif hasattr(filepath, "__fspath__"):
|
352 |
+
return filepath.__fspath__()
|
353 |
+
elif isinstance(filepath, pathlib.Path):
|
354 |
+
return str(filepath)
|
355 |
+
elif hasattr(filepath, "path"):
|
356 |
+
return filepath.path
|
357 |
+
else:
|
358 |
+
return filepath # type: ignore[return-value]
|
359 |
+
|
360 |
+
|
361 |
+
def make_instance(
|
362 |
+
cls: Callable[..., T], args: Sequence[Any], kwargs: dict[str, Any]
|
363 |
+
) -> T:
|
364 |
+
inst = cls(*args, **kwargs)
|
365 |
+
inst._determine_worker() # type: ignore[attr-defined]
|
366 |
+
return inst
|
367 |
+
|
368 |
+
|
369 |
+
def common_prefix(paths: Iterable[str]) -> str:
|
370 |
+
"""For a list of paths, find the shortest prefix common to all"""
|
371 |
+
parts = [p.split("/") for p in paths]
|
372 |
+
lmax = min(len(p) for p in parts)
|
373 |
+
end = 0
|
374 |
+
for i in range(lmax):
|
375 |
+
end = all(p[i] == parts[0][i] for p in parts)
|
376 |
+
if not end:
|
377 |
+
break
|
378 |
+
i += end
|
379 |
+
return "/".join(parts[0][:i])
|
380 |
+
|
381 |
+
|
382 |
+
def other_paths(
|
383 |
+
paths: list[str],
|
384 |
+
path2: str | list[str],
|
385 |
+
exists: bool = False,
|
386 |
+
flatten: bool = False,
|
387 |
+
) -> list[str]:
|
388 |
+
"""In bulk file operations, construct a new file tree from a list of files
|
389 |
+
|
390 |
+
Parameters
|
391 |
+
----------
|
392 |
+
paths: list of str
|
393 |
+
The input file tree
|
394 |
+
path2: str or list of str
|
395 |
+
Root to construct the new list in. If this is already a list of str, we just
|
396 |
+
assert it has the right number of elements.
|
397 |
+
exists: bool (optional)
|
398 |
+
For a str destination, it is already exists (and is a dir), files should
|
399 |
+
end up inside.
|
400 |
+
flatten: bool (optional)
|
401 |
+
Whether to flatten the input directory tree structure so that the output files
|
402 |
+
are in the same directory.
|
403 |
+
|
404 |
+
Returns
|
405 |
+
-------
|
406 |
+
list of str
|
407 |
+
"""
|
408 |
+
|
409 |
+
if isinstance(path2, str):
|
410 |
+
path2 = path2.rstrip("/")
|
411 |
+
|
412 |
+
if flatten:
|
413 |
+
path2 = ["/".join((path2, p.split("/")[-1])) for p in paths]
|
414 |
+
else:
|
415 |
+
cp = common_prefix(paths)
|
416 |
+
if exists:
|
417 |
+
cp = cp.rsplit("/", 1)[0]
|
418 |
+
if not cp and all(not s.startswith("/") for s in paths):
|
419 |
+
path2 = ["/".join([path2, p]) for p in paths]
|
420 |
+
else:
|
421 |
+
path2 = [p.replace(cp, path2, 1) for p in paths]
|
422 |
+
else:
|
423 |
+
assert len(paths) == len(path2)
|
424 |
+
return path2
|
425 |
+
|
426 |
+
|
427 |
+
def is_exception(obj: Any) -> bool:
|
428 |
+
return isinstance(obj, BaseException)
|
429 |
+
|
430 |
+
|
431 |
+
def isfilelike(f: Any) -> TypeGuard[IO[bytes]]:
|
432 |
+
for attr in ["read", "close", "tell"]:
|
433 |
+
if not hasattr(f, attr):
|
434 |
+
return False
|
435 |
+
return True
|
436 |
+
|
437 |
+
|
438 |
+
def get_protocol(url: str) -> str:
|
439 |
+
url = stringify_path(url)
|
440 |
+
parts = re.split(r"(\:\:|\://)", url, 1)
|
441 |
+
if len(parts) > 1:
|
442 |
+
return parts[0]
|
443 |
+
return "file"
|
444 |
+
|
445 |
+
|
446 |
+
def can_be_local(path: str) -> bool:
|
447 |
+
"""Can the given URL be used with open_local?"""
|
448 |
+
from fsspec import get_filesystem_class
|
449 |
+
|
450 |
+
try:
|
451 |
+
return getattr(get_filesystem_class(get_protocol(path)), "local_file", False)
|
452 |
+
except (ValueError, ImportError):
|
453 |
+
# not in registry or import failed
|
454 |
+
return False
|
455 |
+
|
456 |
+
|
457 |
+
def get_package_version_without_import(name: str) -> str | None:
|
458 |
+
"""For given package name, try to find the version without importing it
|
459 |
+
|
460 |
+
Import and package.__version__ is still the backup here, so an import
|
461 |
+
*might* happen.
|
462 |
+
|
463 |
+
Returns either the version string, or None if the package
|
464 |
+
or the version was not readily found.
|
465 |
+
"""
|
466 |
+
if name in sys.modules:
|
467 |
+
mod = sys.modules[name]
|
468 |
+
if hasattr(mod, "__version__"):
|
469 |
+
return mod.__version__
|
470 |
+
try:
|
471 |
+
return version(name)
|
472 |
+
except: # noqa: E722
|
473 |
+
pass
|
474 |
+
try:
|
475 |
+
import importlib
|
476 |
+
|
477 |
+
mod = importlib.import_module(name)
|
478 |
+
return mod.__version__
|
479 |
+
except (ImportError, AttributeError):
|
480 |
+
return None
|
481 |
+
|
482 |
+
|
483 |
+
def setup_logging(
|
484 |
+
logger: logging.Logger | None = None,
|
485 |
+
logger_name: str | None = None,
|
486 |
+
level: str = "DEBUG",
|
487 |
+
clear: bool = True,
|
488 |
+
) -> logging.Logger:
|
489 |
+
if logger is None and logger_name is None:
|
490 |
+
raise ValueError("Provide either logger object or logger name")
|
491 |
+
logger = logger or logging.getLogger(logger_name)
|
492 |
+
handle = logging.StreamHandler()
|
493 |
+
formatter = logging.Formatter(
|
494 |
+
"%(asctime)s - %(name)s - %(levelname)s - %(funcName)s -- %(message)s"
|
495 |
+
)
|
496 |
+
handle.setFormatter(formatter)
|
497 |
+
if clear:
|
498 |
+
logger.handlers.clear()
|
499 |
+
logger.addHandler(handle)
|
500 |
+
logger.setLevel(level)
|
501 |
+
return logger
|
502 |
+
|
503 |
+
|
504 |
+
def _unstrip_protocol(name: str, fs: AbstractFileSystem) -> str:
|
505 |
+
return fs.unstrip_protocol(name)
|
506 |
+
|
507 |
+
|
508 |
+
def mirror_from(
|
509 |
+
origin_name: str, methods: Iterable[str]
|
510 |
+
) -> Callable[[type[T]], type[T]]:
|
511 |
+
"""Mirror attributes and methods from the given
|
512 |
+
origin_name attribute of the instance to the
|
513 |
+
decorated class"""
|
514 |
+
|
515 |
+
def origin_getter(method: str, self: Any) -> Any:
|
516 |
+
origin = getattr(self, origin_name)
|
517 |
+
return getattr(origin, method)
|
518 |
+
|
519 |
+
def wrapper(cls: type[T]) -> type[T]:
|
520 |
+
for method in methods:
|
521 |
+
wrapped_method = partial(origin_getter, method)
|
522 |
+
setattr(cls, method, property(wrapped_method))
|
523 |
+
return cls
|
524 |
+
|
525 |
+
return wrapper
|
526 |
+
|
527 |
+
|
528 |
+
@contextlib.contextmanager
|
529 |
+
def nullcontext(obj: T) -> Iterator[T]:
|
530 |
+
yield obj
|
531 |
+
|
532 |
+
|
533 |
+
def merge_offset_ranges(
|
534 |
+
paths: list[str],
|
535 |
+
starts: list[int] | int,
|
536 |
+
ends: list[int] | int,
|
537 |
+
max_gap: int = 0,
|
538 |
+
max_block: int | None = None,
|
539 |
+
sort: bool = True,
|
540 |
+
) -> tuple[list[str], list[int], list[int]]:
|
541 |
+
"""Merge adjacent byte-offset ranges when the inter-range
|
542 |
+
gap is <= `max_gap`, and when the merged byte range does not
|
543 |
+
exceed `max_block` (if specified). By default, this function
|
544 |
+
will re-order the input paths and byte ranges to ensure sorted
|
545 |
+
order. If the user can guarantee that the inputs are already
|
546 |
+
sorted, passing `sort=False` will skip the re-ordering.
|
547 |
+
"""
|
548 |
+
# Check input
|
549 |
+
if not isinstance(paths, list):
|
550 |
+
raise TypeError
|
551 |
+
if not isinstance(starts, list):
|
552 |
+
starts = [starts] * len(paths)
|
553 |
+
if not isinstance(ends, list):
|
554 |
+
ends = [ends] * len(paths)
|
555 |
+
if len(starts) != len(paths) or len(ends) != len(paths):
|
556 |
+
raise ValueError
|
557 |
+
|
558 |
+
# Early Return
|
559 |
+
if len(starts) <= 1:
|
560 |
+
return paths, starts, ends
|
561 |
+
|
562 |
+
starts = [s or 0 for s in starts]
|
563 |
+
# Sort by paths and then ranges if `sort=True`
|
564 |
+
if sort:
|
565 |
+
paths, starts, ends = (
|
566 |
+
list(v)
|
567 |
+
for v in zip(
|
568 |
+
*sorted(
|
569 |
+
zip(paths, starts, ends),
|
570 |
+
)
|
571 |
+
)
|
572 |
+
)
|
573 |
+
|
574 |
+
if paths:
|
575 |
+
# Loop through the coupled `paths`, `starts`, and
|
576 |
+
# `ends`, and merge adjacent blocks when appropriate
|
577 |
+
new_paths = paths[:1]
|
578 |
+
new_starts = starts[:1]
|
579 |
+
new_ends = ends[:1]
|
580 |
+
for i in range(1, len(paths)):
|
581 |
+
if paths[i] == paths[i - 1] and new_ends[-1] is None:
|
582 |
+
continue
|
583 |
+
elif (
|
584 |
+
paths[i] != paths[i - 1]
|
585 |
+
or ((starts[i] - new_ends[-1]) > max_gap)
|
586 |
+
or (max_block is not None and (ends[i] - new_starts[-1]) > max_block)
|
587 |
+
):
|
588 |
+
# Cannot merge with previous block.
|
589 |
+
# Add new `paths`, `starts`, and `ends` elements
|
590 |
+
new_paths.append(paths[i])
|
591 |
+
new_starts.append(starts[i])
|
592 |
+
new_ends.append(ends[i])
|
593 |
+
else:
|
594 |
+
# Merge with previous block by updating the
|
595 |
+
# last element of `ends`
|
596 |
+
new_ends[-1] = ends[i]
|
597 |
+
return new_paths, new_starts, new_ends
|
598 |
+
|
599 |
+
# `paths` is empty. Just return input lists
|
600 |
+
return paths, starts, ends
|
601 |
+
|
602 |
+
|
603 |
+
def file_size(filelike: IO[bytes]) -> int:
|
604 |
+
"""Find length of any open read-mode file-like"""
|
605 |
+
pos = filelike.tell()
|
606 |
+
try:
|
607 |
+
return filelike.seek(0, 2)
|
608 |
+
finally:
|
609 |
+
filelike.seek(pos)
|
610 |
+
|
611 |
+
|
612 |
+
@contextlib.contextmanager
|
613 |
+
def atomic_write(path: str, mode: str = "wb"):
|
614 |
+
"""
|
615 |
+
A context manager that opens a temporary file next to `path` and, on exit,
|
616 |
+
replaces `path` with the temporary file, thereby updating `path`
|
617 |
+
atomically.
|
618 |
+
"""
|
619 |
+
fd, fn = tempfile.mkstemp(
|
620 |
+
dir=os.path.dirname(path), prefix=os.path.basename(path) + "-"
|
621 |
+
)
|
622 |
+
try:
|
623 |
+
with open(fd, mode) as fp:
|
624 |
+
yield fp
|
625 |
+
except BaseException:
|
626 |
+
with contextlib.suppress(FileNotFoundError):
|
627 |
+
os.unlink(fn)
|
628 |
+
raise
|
629 |
+
else:
|
630 |
+
os.replace(fn, path)
|
631 |
+
|
632 |
+
|
633 |
+
def _translate(pat, STAR, QUESTION_MARK):
|
634 |
+
# Copied from: https://github.com/python/cpython/pull/106703.
|
635 |
+
res: list[str] = []
|
636 |
+
add = res.append
|
637 |
+
i, n = 0, len(pat)
|
638 |
+
while i < n:
|
639 |
+
c = pat[i]
|
640 |
+
i = i + 1
|
641 |
+
if c == "*":
|
642 |
+
# compress consecutive `*` into one
|
643 |
+
if (not res) or res[-1] is not STAR:
|
644 |
+
add(STAR)
|
645 |
+
elif c == "?":
|
646 |
+
add(QUESTION_MARK)
|
647 |
+
elif c == "[":
|
648 |
+
j = i
|
649 |
+
if j < n and pat[j] == "!":
|
650 |
+
j = j + 1
|
651 |
+
if j < n and pat[j] == "]":
|
652 |
+
j = j + 1
|
653 |
+
while j < n and pat[j] != "]":
|
654 |
+
j = j + 1
|
655 |
+
if j >= n:
|
656 |
+
add("\\[")
|
657 |
+
else:
|
658 |
+
stuff = pat[i:j]
|
659 |
+
if "-" not in stuff:
|
660 |
+
stuff = stuff.replace("\\", r"\\")
|
661 |
+
else:
|
662 |
+
chunks = []
|
663 |
+
k = i + 2 if pat[i] == "!" else i + 1
|
664 |
+
while True:
|
665 |
+
k = pat.find("-", k, j)
|
666 |
+
if k < 0:
|
667 |
+
break
|
668 |
+
chunks.append(pat[i:k])
|
669 |
+
i = k + 1
|
670 |
+
k = k + 3
|
671 |
+
chunk = pat[i:j]
|
672 |
+
if chunk:
|
673 |
+
chunks.append(chunk)
|
674 |
+
else:
|
675 |
+
chunks[-1] += "-"
|
676 |
+
# Remove empty ranges -- invalid in RE.
|
677 |
+
for k in range(len(chunks) - 1, 0, -1):
|
678 |
+
if chunks[k - 1][-1] > chunks[k][0]:
|
679 |
+
chunks[k - 1] = chunks[k - 1][:-1] + chunks[k][1:]
|
680 |
+
del chunks[k]
|
681 |
+
# Escape backslashes and hyphens for set difference (--).
|
682 |
+
# Hyphens that create ranges shouldn't be escaped.
|
683 |
+
stuff = "-".join(
|
684 |
+
s.replace("\\", r"\\").replace("-", r"\-") for s in chunks
|
685 |
+
)
|
686 |
+
# Escape set operations (&&, ~~ and ||).
|
687 |
+
stuff = re.sub(r"([&~|])", r"\\\1", stuff)
|
688 |
+
i = j + 1
|
689 |
+
if not stuff:
|
690 |
+
# Empty range: never match.
|
691 |
+
add("(?!)")
|
692 |
+
elif stuff == "!":
|
693 |
+
# Negated empty range: match any character.
|
694 |
+
add(".")
|
695 |
+
else:
|
696 |
+
if stuff[0] == "!":
|
697 |
+
stuff = "^" + stuff[1:]
|
698 |
+
elif stuff[0] in ("^", "["):
|
699 |
+
stuff = "\\" + stuff
|
700 |
+
add(f"[{stuff}]")
|
701 |
+
else:
|
702 |
+
add(re.escape(c))
|
703 |
+
assert i == n
|
704 |
+
return res
|
705 |
+
|
706 |
+
|
707 |
+
def glob_translate(pat):
|
708 |
+
# Copied from: https://github.com/python/cpython/pull/106703.
|
709 |
+
# The keyword parameters' values are fixed to:
|
710 |
+
# recursive=True, include_hidden=True, seps=None
|
711 |
+
"""Translate a pathname with shell wildcards to a regular expression."""
|
712 |
+
if os.path.altsep:
|
713 |
+
seps = os.path.sep + os.path.altsep
|
714 |
+
else:
|
715 |
+
seps = os.path.sep
|
716 |
+
escaped_seps = "".join(map(re.escape, seps))
|
717 |
+
any_sep = f"[{escaped_seps}]" if len(seps) > 1 else escaped_seps
|
718 |
+
not_sep = f"[^{escaped_seps}]"
|
719 |
+
one_last_segment = f"{not_sep}+"
|
720 |
+
one_segment = f"{one_last_segment}{any_sep}"
|
721 |
+
any_segments = f"(?:.+{any_sep})?"
|
722 |
+
any_last_segments = ".*"
|
723 |
+
results = []
|
724 |
+
parts = re.split(any_sep, pat)
|
725 |
+
last_part_idx = len(parts) - 1
|
726 |
+
for idx, part in enumerate(parts):
|
727 |
+
if part == "*":
|
728 |
+
results.append(one_segment if idx < last_part_idx else one_last_segment)
|
729 |
+
continue
|
730 |
+
if part == "**":
|
731 |
+
results.append(any_segments if idx < last_part_idx else any_last_segments)
|
732 |
+
continue
|
733 |
+
elif "**" in part:
|
734 |
+
raise ValueError(
|
735 |
+
"Invalid pattern: '**' can only be an entire path component"
|
736 |
+
)
|
737 |
+
if part:
|
738 |
+
results.extend(_translate(part, f"{not_sep}*", not_sep))
|
739 |
+
if idx < last_part_idx:
|
740 |
+
results.append(any_sep)
|
741 |
+
res = "".join(results)
|
742 |
+
return rf"(?s:{res})\Z"
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/INSTALLER
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
pip
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Apache License
|
2 |
+
Version 2.0, January 2004
|
3 |
+
http://www.apache.org/licenses/
|
4 |
+
|
5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6 |
+
|
7 |
+
1. Definitions.
|
8 |
+
|
9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
11 |
+
|
12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13 |
+
the copyright owner that is granting the License.
|
14 |
+
|
15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
16 |
+
other entities that control, are controlled by, or are under common
|
17 |
+
control with that entity. For the purposes of this definition,
|
18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
19 |
+
direction or management of such entity, whether by contract or
|
20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22 |
+
|
23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24 |
+
exercising permissions granted by this License.
|
25 |
+
|
26 |
+
"Source" form shall mean the preferred form for making modifications,
|
27 |
+
including but not limited to software source code, documentation
|
28 |
+
source, and configuration files.
|
29 |
+
|
30 |
+
"Object" form shall mean any form resulting from mechanical
|
31 |
+
transformation or translation of a Source form, including but
|
32 |
+
not limited to compiled object code, generated documentation,
|
33 |
+
and conversions to other media types.
|
34 |
+
|
35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
36 |
+
Object form, made available under the License, as indicated by a
|
37 |
+
copyright notice that is included in or attached to the work
|
38 |
+
(an example is provided in the Appendix below).
|
39 |
+
|
40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41 |
+
form, that is based on (or derived from) the Work and for which the
|
42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
44 |
+
of this License, Derivative Works shall not include works that remain
|
45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46 |
+
the Work and Derivative Works thereof.
|
47 |
+
|
48 |
+
"Contribution" shall mean any work of authorship, including
|
49 |
+
the original version of the Work and any modifications or additions
|
50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
54 |
+
means any form of electronic, verbal, or written communication sent
|
55 |
+
to the Licensor or its representatives, including but not limited to
|
56 |
+
communication on electronic mailing lists, source code control systems,
|
57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
59 |
+
excluding communication that is conspicuously marked or otherwise
|
60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
61 |
+
|
62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
64 |
+
subsequently incorporated within the Work.
|
65 |
+
|
66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
71 |
+
Work and such Derivative Works in Source or Object form.
|
72 |
+
|
73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76 |
+
(except as stated in this section) patent license to make, have made,
|
77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78 |
+
where such license applies only to those patent claims licensable
|
79 |
+
by such Contributor that are necessarily infringed by their
|
80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
82 |
+
institute patent litigation against any entity (including a
|
83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84 |
+
or a Contribution incorporated within the Work constitutes direct
|
85 |
+
or contributory patent infringement, then any patent licenses
|
86 |
+
granted to You under this License for that Work shall terminate
|
87 |
+
as of the date such litigation is filed.
|
88 |
+
|
89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
90 |
+
Work or Derivative Works thereof in any medium, with or without
|
91 |
+
modifications, and in Source or Object form, provided that You
|
92 |
+
meet the following conditions:
|
93 |
+
|
94 |
+
(a) You must give any other recipients of the Work or
|
95 |
+
Derivative Works a copy of this License; and
|
96 |
+
|
97 |
+
(b) You must cause any modified files to carry prominent notices
|
98 |
+
stating that You changed the files; and
|
99 |
+
|
100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
101 |
+
that You distribute, all copyright, patent, trademark, and
|
102 |
+
attribution notices from the Source form of the Work,
|
103 |
+
excluding those notices that do not pertain to any part of
|
104 |
+
the Derivative Works; and
|
105 |
+
|
106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107 |
+
distribution, then any Derivative Works that You distribute must
|
108 |
+
include a readable copy of the attribution notices contained
|
109 |
+
within such NOTICE file, excluding those notices that do not
|
110 |
+
pertain to any part of the Derivative Works, in at least one
|
111 |
+
of the following places: within a NOTICE text file distributed
|
112 |
+
as part of the Derivative Works; within the Source form or
|
113 |
+
documentation, if provided along with the Derivative Works; or,
|
114 |
+
within a display generated by the Derivative Works, if and
|
115 |
+
wherever such third-party notices normally appear. The contents
|
116 |
+
of the NOTICE file are for informational purposes only and
|
117 |
+
do not modify the License. You may add Your own attribution
|
118 |
+
notices within Derivative Works that You distribute, alongside
|
119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
120 |
+
that such additional attribution notices cannot be construed
|
121 |
+
as modifying the License.
|
122 |
+
|
123 |
+
You may add Your own copyright statement to Your modifications and
|
124 |
+
may provide additional or different license terms and conditions
|
125 |
+
for use, reproduction, or distribution of Your modifications, or
|
126 |
+
for any such Derivative Works as a whole, provided Your use,
|
127 |
+
reproduction, and distribution of the Work otherwise complies with
|
128 |
+
the conditions stated in this License.
|
129 |
+
|
130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
132 |
+
by You to the Licensor shall be under the terms and conditions of
|
133 |
+
this License, without any additional terms or conditions.
|
134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135 |
+
the terms of any separate license agreement you may have executed
|
136 |
+
with Licensor regarding such Contributions.
|
137 |
+
|
138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
140 |
+
except as required for reasonable and customary use in describing the
|
141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
142 |
+
|
143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144 |
+
agreed to in writing, Licensor provides the Work (and each
|
145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147 |
+
implied, including, without limitation, any warranties or conditions
|
148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150 |
+
appropriateness of using or redistributing the Work and assume any
|
151 |
+
risks associated with Your exercise of permissions under this License.
|
152 |
+
|
153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
154 |
+
whether in tort (including negligence), contract, or otherwise,
|
155 |
+
unless required by applicable law (such as deliberate and grossly
|
156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157 |
+
liable to You for damages, including any direct, indirect, special,
|
158 |
+
incidental, or consequential damages of any character arising as a
|
159 |
+
result of this License or out of the use or inability to use the
|
160 |
+
Work (including but not limited to damages for loss of goodwill,
|
161 |
+
work stoppage, computer failure or malfunction, or any and all
|
162 |
+
other commercial damages or losses), even if such Contributor
|
163 |
+
has been advised of the possibility of such damages.
|
164 |
+
|
165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168 |
+
or other liability obligations and/or rights consistent with this
|
169 |
+
License. However, in accepting such obligations, You may act only
|
170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171 |
+
of any other Contributor, and only if You agree to indemnify,
|
172 |
+
defend, and hold each Contributor harmless for any liability
|
173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
174 |
+
of your accepting any such warranty or additional liability.
|
175 |
+
|
176 |
+
END OF TERMS AND CONDITIONS
|
177 |
+
|
178 |
+
APPENDIX: How to apply the Apache License to your work.
|
179 |
+
|
180 |
+
To apply the Apache License to your work, attach the following
|
181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182 |
+
replaced with your own identifying information. (Don't include
|
183 |
+
the brackets!) The text should be enclosed in the appropriate
|
184 |
+
comment syntax for the file format. We also recommend that a
|
185 |
+
file or class name and description of purpose be included on the
|
186 |
+
same "printed page" as the copyright notice for easier
|
187 |
+
identification within third-party archives.
|
188 |
+
|
189 |
+
Copyright [yyyy] [name of copyright owner]
|
190 |
+
|
191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192 |
+
you may not use this file except in compliance with the License.
|
193 |
+
You may obtain a copy of the License at
|
194 |
+
|
195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
196 |
+
|
197 |
+
Unless required by applicable law or agreed to in writing, software
|
198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200 |
+
See the License for the specific language governing permissions and
|
201 |
+
limitations under the License.
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/METADATA
ADDED
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Metadata-Version: 2.1
|
2 |
+
Name: huggingface-hub
|
3 |
+
Version: 0.23.0
|
4 |
+
Summary: Client library to download and publish models, datasets and other repos on the huggingface.co hub
|
5 |
+
Home-page: https://github.com/huggingface/huggingface_hub
|
6 |
+
Author: Hugging Face, Inc.
|
7 |
+
Author-email: [email protected]
|
8 |
+
License: Apache
|
9 |
+
Keywords: model-hub machine-learning models natural-language-processing deep-learning pytorch pretrained-models
|
10 |
+
Platform: UNKNOWN
|
11 |
+
Classifier: Intended Audience :: Developers
|
12 |
+
Classifier: Intended Audience :: Education
|
13 |
+
Classifier: Intended Audience :: Science/Research
|
14 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
15 |
+
Classifier: Operating System :: OS Independent
|
16 |
+
Classifier: Programming Language :: Python :: 3
|
17 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
18 |
+
Classifier: Programming Language :: Python :: 3.8
|
19 |
+
Classifier: Programming Language :: Python :: 3.9
|
20 |
+
Classifier: Programming Language :: Python :: 3.10
|
21 |
+
Classifier: Programming Language :: Python :: 3.11
|
22 |
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
23 |
+
Requires-Python: >=3.8.0
|
24 |
+
Description-Content-Type: text/markdown
|
25 |
+
License-File: LICENSE
|
26 |
+
Requires-Dist: filelock
|
27 |
+
Requires-Dist: fsspec >=2023.5.0
|
28 |
+
Requires-Dist: packaging >=20.9
|
29 |
+
Requires-Dist: pyyaml >=5.1
|
30 |
+
Requires-Dist: requests
|
31 |
+
Requires-Dist: tqdm >=4.42.1
|
32 |
+
Requires-Dist: typing-extensions >=3.7.4.3
|
33 |
+
Provides-Extra: all
|
34 |
+
Requires-Dist: InquirerPy ==0.3.4 ; extra == 'all'
|
35 |
+
Requires-Dist: aiohttp ; extra == 'all'
|
36 |
+
Requires-Dist: minijinja >=1.0 ; extra == 'all'
|
37 |
+
Requires-Dist: jedi ; extra == 'all'
|
38 |
+
Requires-Dist: Jinja2 ; extra == 'all'
|
39 |
+
Requires-Dist: pytest ; extra == 'all'
|
40 |
+
Requires-Dist: pytest-cov ; extra == 'all'
|
41 |
+
Requires-Dist: pytest-env ; extra == 'all'
|
42 |
+
Requires-Dist: pytest-xdist ; extra == 'all'
|
43 |
+
Requires-Dist: pytest-vcr ; extra == 'all'
|
44 |
+
Requires-Dist: pytest-asyncio ; extra == 'all'
|
45 |
+
Requires-Dist: pytest-rerunfailures ; extra == 'all'
|
46 |
+
Requires-Dist: urllib3 <2.0 ; extra == 'all'
|
47 |
+
Requires-Dist: soundfile ; extra == 'all'
|
48 |
+
Requires-Dist: Pillow ; extra == 'all'
|
49 |
+
Requires-Dist: gradio ; extra == 'all'
|
50 |
+
Requires-Dist: numpy ; extra == 'all'
|
51 |
+
Requires-Dist: fastapi ; extra == 'all'
|
52 |
+
Requires-Dist: ruff >=0.3.0 ; extra == 'all'
|
53 |
+
Requires-Dist: mypy ==1.5.1 ; extra == 'all'
|
54 |
+
Requires-Dist: typing-extensions >=4.8.0 ; extra == 'all'
|
55 |
+
Requires-Dist: types-PyYAML ; extra == 'all'
|
56 |
+
Requires-Dist: types-requests ; extra == 'all'
|
57 |
+
Requires-Dist: types-simplejson ; extra == 'all'
|
58 |
+
Requires-Dist: types-toml ; extra == 'all'
|
59 |
+
Requires-Dist: types-tqdm ; extra == 'all'
|
60 |
+
Requires-Dist: types-urllib3 ; extra == 'all'
|
61 |
+
Provides-Extra: cli
|
62 |
+
Requires-Dist: InquirerPy ==0.3.4 ; extra == 'cli'
|
63 |
+
Provides-Extra: dev
|
64 |
+
Requires-Dist: InquirerPy ==0.3.4 ; extra == 'dev'
|
65 |
+
Requires-Dist: aiohttp ; extra == 'dev'
|
66 |
+
Requires-Dist: minijinja >=1.0 ; extra == 'dev'
|
67 |
+
Requires-Dist: jedi ; extra == 'dev'
|
68 |
+
Requires-Dist: Jinja2 ; extra == 'dev'
|
69 |
+
Requires-Dist: pytest ; extra == 'dev'
|
70 |
+
Requires-Dist: pytest-cov ; extra == 'dev'
|
71 |
+
Requires-Dist: pytest-env ; extra == 'dev'
|
72 |
+
Requires-Dist: pytest-xdist ; extra == 'dev'
|
73 |
+
Requires-Dist: pytest-vcr ; extra == 'dev'
|
74 |
+
Requires-Dist: pytest-asyncio ; extra == 'dev'
|
75 |
+
Requires-Dist: pytest-rerunfailures ; extra == 'dev'
|
76 |
+
Requires-Dist: urllib3 <2.0 ; extra == 'dev'
|
77 |
+
Requires-Dist: soundfile ; extra == 'dev'
|
78 |
+
Requires-Dist: Pillow ; extra == 'dev'
|
79 |
+
Requires-Dist: gradio ; extra == 'dev'
|
80 |
+
Requires-Dist: numpy ; extra == 'dev'
|
81 |
+
Requires-Dist: fastapi ; extra == 'dev'
|
82 |
+
Requires-Dist: ruff >=0.3.0 ; extra == 'dev'
|
83 |
+
Requires-Dist: mypy ==1.5.1 ; extra == 'dev'
|
84 |
+
Requires-Dist: typing-extensions >=4.8.0 ; extra == 'dev'
|
85 |
+
Requires-Dist: types-PyYAML ; extra == 'dev'
|
86 |
+
Requires-Dist: types-requests ; extra == 'dev'
|
87 |
+
Requires-Dist: types-simplejson ; extra == 'dev'
|
88 |
+
Requires-Dist: types-toml ; extra == 'dev'
|
89 |
+
Requires-Dist: types-tqdm ; extra == 'dev'
|
90 |
+
Requires-Dist: types-urllib3 ; extra == 'dev'
|
91 |
+
Provides-Extra: fastai
|
92 |
+
Requires-Dist: toml ; extra == 'fastai'
|
93 |
+
Requires-Dist: fastai >=2.4 ; extra == 'fastai'
|
94 |
+
Requires-Dist: fastcore >=1.3.27 ; extra == 'fastai'
|
95 |
+
Provides-Extra: hf_transfer
|
96 |
+
Requires-Dist: hf-transfer >=0.1.4 ; extra == 'hf_transfer'
|
97 |
+
Provides-Extra: inference
|
98 |
+
Requires-Dist: aiohttp ; extra == 'inference'
|
99 |
+
Requires-Dist: minijinja >=1.0 ; extra == 'inference'
|
100 |
+
Provides-Extra: quality
|
101 |
+
Requires-Dist: ruff >=0.3.0 ; extra == 'quality'
|
102 |
+
Requires-Dist: mypy ==1.5.1 ; extra == 'quality'
|
103 |
+
Provides-Extra: tensorflow
|
104 |
+
Requires-Dist: tensorflow ; extra == 'tensorflow'
|
105 |
+
Requires-Dist: pydot ; extra == 'tensorflow'
|
106 |
+
Requires-Dist: graphviz ; extra == 'tensorflow'
|
107 |
+
Provides-Extra: tensorflow-testing
|
108 |
+
Requires-Dist: tensorflow ; extra == 'tensorflow-testing'
|
109 |
+
Requires-Dist: keras <3.0 ; extra == 'tensorflow-testing'
|
110 |
+
Provides-Extra: testing
|
111 |
+
Requires-Dist: InquirerPy ==0.3.4 ; extra == 'testing'
|
112 |
+
Requires-Dist: aiohttp ; extra == 'testing'
|
113 |
+
Requires-Dist: minijinja >=1.0 ; extra == 'testing'
|
114 |
+
Requires-Dist: jedi ; extra == 'testing'
|
115 |
+
Requires-Dist: Jinja2 ; extra == 'testing'
|
116 |
+
Requires-Dist: pytest ; extra == 'testing'
|
117 |
+
Requires-Dist: pytest-cov ; extra == 'testing'
|
118 |
+
Requires-Dist: pytest-env ; extra == 'testing'
|
119 |
+
Requires-Dist: pytest-xdist ; extra == 'testing'
|
120 |
+
Requires-Dist: pytest-vcr ; extra == 'testing'
|
121 |
+
Requires-Dist: pytest-asyncio ; extra == 'testing'
|
122 |
+
Requires-Dist: pytest-rerunfailures ; extra == 'testing'
|
123 |
+
Requires-Dist: urllib3 <2.0 ; extra == 'testing'
|
124 |
+
Requires-Dist: soundfile ; extra == 'testing'
|
125 |
+
Requires-Dist: Pillow ; extra == 'testing'
|
126 |
+
Requires-Dist: gradio ; extra == 'testing'
|
127 |
+
Requires-Dist: numpy ; extra == 'testing'
|
128 |
+
Requires-Dist: fastapi ; extra == 'testing'
|
129 |
+
Provides-Extra: torch
|
130 |
+
Requires-Dist: torch ; extra == 'torch'
|
131 |
+
Requires-Dist: safetensors ; extra == 'torch'
|
132 |
+
Provides-Extra: typing
|
133 |
+
Requires-Dist: typing-extensions >=4.8.0 ; extra == 'typing'
|
134 |
+
Requires-Dist: types-PyYAML ; extra == 'typing'
|
135 |
+
Requires-Dist: types-requests ; extra == 'typing'
|
136 |
+
Requires-Dist: types-simplejson ; extra == 'typing'
|
137 |
+
Requires-Dist: types-toml ; extra == 'typing'
|
138 |
+
Requires-Dist: types-tqdm ; extra == 'typing'
|
139 |
+
Requires-Dist: types-urllib3 ; extra == 'typing'
|
140 |
+
|
141 |
+
<p align="center">
|
142 |
+
<br/>
|
143 |
+
<img alt="huggingface_hub library logo" src="https://huggingface.co/datasets/huggingface/documentation-images/raw/main/huggingface_hub.svg" width="376" height="59" style="max-width: 100%;">
|
144 |
+
<br/>
|
145 |
+
</p>
|
146 |
+
|
147 |
+
<p align="center">
|
148 |
+
<i>The official Python client for the Huggingface Hub.</i>
|
149 |
+
</p>
|
150 |
+
|
151 |
+
<p align="center">
|
152 |
+
<a href="https://huggingface.co/docs/huggingface_hub/en/index"><img alt="Documentation" src="https://img.shields.io/website/http/huggingface.co/docs/huggingface_hub/index.svg?down_color=red&down_message=offline&up_message=online&label=doc"></a>
|
153 |
+
<a href="https://github.com/huggingface/huggingface_hub/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/huggingface/huggingface_hub.svg"></a>
|
154 |
+
<a href="https://github.com/huggingface/huggingface_hub"><img alt="PyPi version" src="https://img.shields.io/pypi/pyversions/huggingface_hub.svg"></a>
|
155 |
+
<a href="https://pypi.org/project/huggingface-hub"><img alt="downloads" src="https://static.pepy.tech/badge/huggingface_hub/month"></a>
|
156 |
+
<a href="https://codecov.io/gh/huggingface/huggingface_hub"><img alt="Code coverage" src="https://codecov.io/gh/huggingface/huggingface_hub/branch/main/graph/badge.svg?token=RXP95LE2XL"></a>
|
157 |
+
</p>
|
158 |
+
|
159 |
+
<h4 align="center">
|
160 |
+
<p>
|
161 |
+
<b>English</b> |
|
162 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/README_de.md">Deutsch</a> |
|
163 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/README_hi.md">हिंदी</a> |
|
164 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/README_ko.md">한국어</a> |
|
165 |
+
<a href="https://github.com/huggingface/huggingface_hub/blob/main/README_cn.md">中文(简体)</a>
|
166 |
+
<p>
|
167 |
+
</h4>
|
168 |
+
|
169 |
+
---
|
170 |
+
|
171 |
+
**Documentation**: <a href="https://hf.co/docs/huggingface_hub" target="_blank">https://hf.co/docs/huggingface_hub</a>
|
172 |
+
|
173 |
+
**Source Code**: <a href="https://github.com/huggingface/huggingface_hub" target="_blank">https://github.com/huggingface/huggingface_hub</a>
|
174 |
+
|
175 |
+
---
|
176 |
+
|
177 |
+
## Welcome to the huggingface_hub library
|
178 |
+
|
179 |
+
The `huggingface_hub` library allows you to interact with the [Hugging Face Hub](https://huggingface.co/), a platform democratizing open-source Machine Learning for creators and collaborators. Discover pre-trained models and datasets for your projects or play with the thousands of machine learning apps hosted on the Hub. You can also create and share your own models, datasets and demos with the community. The `huggingface_hub` library provides a simple way to do all these things with Python.
|
180 |
+
|
181 |
+
## Key features
|
182 |
+
|
183 |
+
- [Download files](https://huggingface.co/docs/huggingface_hub/en/guides/download) from the Hub.
|
184 |
+
- [Upload files](https://huggingface.co/docs/huggingface_hub/en/guides/upload) to the Hub.
|
185 |
+
- [Manage your repositories](https://huggingface.co/docs/huggingface_hub/en/guides/repository).
|
186 |
+
- [Run Inference](https://huggingface.co/docs/huggingface_hub/en/guides/inference) on deployed models.
|
187 |
+
- [Search](https://huggingface.co/docs/huggingface_hub/en/guides/search) for models, datasets and Spaces.
|
188 |
+
- [Share Model Cards](https://huggingface.co/docs/huggingface_hub/en/guides/model-cards) to document your models.
|
189 |
+
- [Engage with the community](https://huggingface.co/docs/huggingface_hub/en/guides/community) through PRs and comments.
|
190 |
+
|
191 |
+
## Installation
|
192 |
+
|
193 |
+
Install the `huggingface_hub` package with [pip](https://pypi.org/project/huggingface-hub/):
|
194 |
+
|
195 |
+
```bash
|
196 |
+
pip install huggingface_hub
|
197 |
+
```
|
198 |
+
|
199 |
+
If you prefer, you can also install it with [conda](https://huggingface.co/docs/huggingface_hub/en/installation#install-with-conda).
|
200 |
+
|
201 |
+
In order to keep the package minimal by default, `huggingface_hub` comes with optional dependencies useful for some use cases. For example, if you want have a complete experience for Inference, run:
|
202 |
+
|
203 |
+
```bash
|
204 |
+
pip install huggingface_hub[inference]
|
205 |
+
```
|
206 |
+
|
207 |
+
To learn more installation and optional dependencies, check out the [installation guide](https://huggingface.co/docs/huggingface_hub/en/installation).
|
208 |
+
|
209 |
+
## Quick start
|
210 |
+
|
211 |
+
### Download files
|
212 |
+
|
213 |
+
Download a single file
|
214 |
+
|
215 |
+
```py
|
216 |
+
from huggingface_hub import hf_hub_download
|
217 |
+
|
218 |
+
hf_hub_download(repo_id="tiiuae/falcon-7b-instruct", filename="config.json")
|
219 |
+
```
|
220 |
+
|
221 |
+
Or an entire repository
|
222 |
+
|
223 |
+
```py
|
224 |
+
from huggingface_hub import snapshot_download
|
225 |
+
|
226 |
+
snapshot_download("stabilityai/stable-diffusion-2-1")
|
227 |
+
```
|
228 |
+
|
229 |
+
Files will be downloaded in a local cache folder. More details in [this guide](https://huggingface.co/docs/huggingface_hub/en/guides/manage-cache).
|
230 |
+
|
231 |
+
### Login
|
232 |
+
|
233 |
+
The Hugging Face Hub uses tokens to authenticate applications (see [docs](https://huggingface.co/docs/hub/security-tokens)). To login your machine, run the following CLI:
|
234 |
+
|
235 |
+
```bash
|
236 |
+
huggingface-cli login
|
237 |
+
# or using an environment variable
|
238 |
+
huggingface-cli login --token $HUGGINGFACE_TOKEN
|
239 |
+
```
|
240 |
+
|
241 |
+
### Create a repository
|
242 |
+
|
243 |
+
```py
|
244 |
+
from huggingface_hub import create_repo
|
245 |
+
|
246 |
+
create_repo(repo_id="super-cool-model")
|
247 |
+
```
|
248 |
+
|
249 |
+
### Upload files
|
250 |
+
|
251 |
+
Upload a single file
|
252 |
+
|
253 |
+
```py
|
254 |
+
from huggingface_hub import upload_file
|
255 |
+
|
256 |
+
upload_file(
|
257 |
+
path_or_fileobj="/home/lysandre/dummy-test/README.md",
|
258 |
+
path_in_repo="README.md",
|
259 |
+
repo_id="lysandre/test-model",
|
260 |
+
)
|
261 |
+
```
|
262 |
+
|
263 |
+
Or an entire folder
|
264 |
+
|
265 |
+
```py
|
266 |
+
from huggingface_hub import upload_folder
|
267 |
+
|
268 |
+
upload_folder(
|
269 |
+
folder_path="/path/to/local/space",
|
270 |
+
repo_id="username/my-cool-space",
|
271 |
+
repo_type="space",
|
272 |
+
)
|
273 |
+
```
|
274 |
+
|
275 |
+
For details in the [upload guide](https://huggingface.co/docs/huggingface_hub/en/guides/upload).
|
276 |
+
|
277 |
+
## Integrating to the Hub.
|
278 |
+
|
279 |
+
We're partnering with cool open source ML libraries to provide free model hosting and versioning. You can find the existing integrations [here](https://huggingface.co/docs/hub/libraries).
|
280 |
+
|
281 |
+
The advantages are:
|
282 |
+
|
283 |
+
- Free model or dataset hosting for libraries and their users.
|
284 |
+
- Built-in file versioning, even with very large files, thanks to a git-based approach.
|
285 |
+
- Serverless inference API for all models publicly available.
|
286 |
+
- In-browser widgets to play with the uploaded models.
|
287 |
+
- Anyone can upload a new model for your library, they just need to add the corresponding tag for the model to be discoverable.
|
288 |
+
- Fast downloads! We use Cloudfront (a CDN) to geo-replicate downloads so they're blazing fast from anywhere on the globe.
|
289 |
+
- Usage stats and more features to come.
|
290 |
+
|
291 |
+
If you would like to integrate your library, feel free to open an issue to begin the discussion. We wrote a [step-by-step guide](https://huggingface.co/docs/hub/adding-a-library) with ❤️ showing how to do this integration.
|
292 |
+
|
293 |
+
## Contributions (feature requests, bugs, etc.) are super welcome 💙💚💛💜🧡❤️
|
294 |
+
|
295 |
+
Everyone is welcome to contribute, and we value everybody's contribution. Code is not the only way to help the community.
|
296 |
+
Answering questions, helping others, reaching out and improving the documentations are immensely valuable to the community.
|
297 |
+
We wrote a [contribution guide](https://github.com/huggingface/huggingface_hub/blob/main/CONTRIBUTING.md) to summarize
|
298 |
+
how to get started to contribute to this repository.
|
299 |
+
|
300 |
+
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/RECORD
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
../../../bin/huggingface-cli,sha256=JlIXlvToHPKBYEDy0_2MR77fOIewyVoAtdLiaIwsonE,273
|
2 |
+
huggingface_hub-0.23.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
3 |
+
huggingface_hub-0.23.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
4 |
+
huggingface_hub-0.23.0.dist-info/METADATA,sha256=_OWllpyp_iC9C7uiCKcZfHiPBLna6BYgSY3FCx7zr-A,12994
|
5 |
+
huggingface_hub-0.23.0.dist-info/RECORD,,
|
6 |
+
huggingface_hub-0.23.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
7 |
+
huggingface_hub-0.23.0.dist-info/entry_points.txt,sha256=Y3Z2L02rBG7va_iE6RPXolIgwOdwUFONyRN3kXMxZ0g,131
|
8 |
+
huggingface_hub-0.23.0.dist-info/top_level.txt,sha256=8KzlQJAY4miUvjAssOAJodqKOw3harNzuiwGQ9qLSSk,16
|
9 |
+
huggingface_hub/__init__.py,sha256=xXb4llMkyN0SvoFdcDDPqiHEiI3C-sZsSHQYLo3NK04,32692
|
10 |
+
huggingface_hub/__pycache__/__init__.cpython-310.pyc,,
|
11 |
+
huggingface_hub/__pycache__/_commit_api.cpython-310.pyc,,
|
12 |
+
huggingface_hub/__pycache__/_commit_scheduler.cpython-310.pyc,,
|
13 |
+
huggingface_hub/__pycache__/_inference_endpoints.cpython-310.pyc,,
|
14 |
+
huggingface_hub/__pycache__/_local_folder.cpython-310.pyc,,
|
15 |
+
huggingface_hub/__pycache__/_login.cpython-310.pyc,,
|
16 |
+
huggingface_hub/__pycache__/_multi_commits.cpython-310.pyc,,
|
17 |
+
huggingface_hub/__pycache__/_snapshot_download.cpython-310.pyc,,
|
18 |
+
huggingface_hub/__pycache__/_space_api.cpython-310.pyc,,
|
19 |
+
huggingface_hub/__pycache__/_tensorboard_logger.cpython-310.pyc,,
|
20 |
+
huggingface_hub/__pycache__/_webhooks_payload.cpython-310.pyc,,
|
21 |
+
huggingface_hub/__pycache__/_webhooks_server.cpython-310.pyc,,
|
22 |
+
huggingface_hub/__pycache__/community.cpython-310.pyc,,
|
23 |
+
huggingface_hub/__pycache__/constants.cpython-310.pyc,,
|
24 |
+
huggingface_hub/__pycache__/errors.cpython-310.pyc,,
|
25 |
+
huggingface_hub/__pycache__/fastai_utils.cpython-310.pyc,,
|
26 |
+
huggingface_hub/__pycache__/file_download.cpython-310.pyc,,
|
27 |
+
huggingface_hub/__pycache__/hf_api.cpython-310.pyc,,
|
28 |
+
huggingface_hub/__pycache__/hf_file_system.cpython-310.pyc,,
|
29 |
+
huggingface_hub/__pycache__/hub_mixin.cpython-310.pyc,,
|
30 |
+
huggingface_hub/__pycache__/inference_api.cpython-310.pyc,,
|
31 |
+
huggingface_hub/__pycache__/keras_mixin.cpython-310.pyc,,
|
32 |
+
huggingface_hub/__pycache__/lfs.cpython-310.pyc,,
|
33 |
+
huggingface_hub/__pycache__/repocard.cpython-310.pyc,,
|
34 |
+
huggingface_hub/__pycache__/repocard_data.cpython-310.pyc,,
|
35 |
+
huggingface_hub/__pycache__/repository.cpython-310.pyc,,
|
36 |
+
huggingface_hub/_commit_api.py,sha256=Z1sQnJx1xWfspsX6vS8eGTmr-9QujIoItjbnJVVyyCQ,29299
|
37 |
+
huggingface_hub/_commit_scheduler.py,sha256=nlJS_vnLb8i92NLrRwJX8Mg9QZ7f3kfLbLlQuEd5YjU,13647
|
38 |
+
huggingface_hub/_inference_endpoints.py,sha256=rBx6xgnSJq0JtntF1_zphj7NsCmduICqgZfmvscdE_w,15667
|
39 |
+
huggingface_hub/_local_folder.py,sha256=ajjI3vRgV9kGrx2ZPeTnDm8lfGN1eyMshn5gxM_7Q38,8441
|
40 |
+
huggingface_hub/_login.py,sha256=E-3hbns3Jo0mjnyPWQVz9c0xPEXuQ-KQhZCQ9R1BE7o,15478
|
41 |
+
huggingface_hub/_multi_commits.py,sha256=mFmCP_5hNsruEgDF6kOVyaFkpnbSdNxPWfGUlFbl5O8,12535
|
42 |
+
huggingface_hub/_snapshot_download.py,sha256=pN7CEl8X_JJRdrFDeBk0nYecVM7rvULJty9vuxrHnMU,14039
|
43 |
+
huggingface_hub/_space_api.py,sha256=Mae_lqTRyTWyszI5mlObJ2fn9slPxkFPcFTEVADoNQM,5255
|
44 |
+
huggingface_hub/_tensorboard_logger.py,sha256=x_56MOZiU2-9QQ1XHOWem39ySRLe29hkalxy2nRaRL4,7470
|
45 |
+
huggingface_hub/_webhooks_payload.py,sha256=Xm3KaK7tCOGBlXkuZvbym6zjHXrT1XCrbUFWuXiBmNY,3617
|
46 |
+
huggingface_hub/_webhooks_server.py,sha256=9RQ4AS5JVssJhM66FzlyOSQhKwrKG-dV_x6SA8GeOQw,15497
|
47 |
+
huggingface_hub/commands/__init__.py,sha256=AkbM2a-iGh0Vq_xAWhK3mu3uZ44km8-X5uWjKcvcrUQ,928
|
48 |
+
huggingface_hub/commands/__pycache__/__init__.cpython-310.pyc,,
|
49 |
+
huggingface_hub/commands/__pycache__/_cli_utils.cpython-310.pyc,,
|
50 |
+
huggingface_hub/commands/__pycache__/delete_cache.cpython-310.pyc,,
|
51 |
+
huggingface_hub/commands/__pycache__/download.cpython-310.pyc,,
|
52 |
+
huggingface_hub/commands/__pycache__/env.cpython-310.pyc,,
|
53 |
+
huggingface_hub/commands/__pycache__/huggingface_cli.cpython-310.pyc,,
|
54 |
+
huggingface_hub/commands/__pycache__/lfs.cpython-310.pyc,,
|
55 |
+
huggingface_hub/commands/__pycache__/scan_cache.cpython-310.pyc,,
|
56 |
+
huggingface_hub/commands/__pycache__/tag.cpython-310.pyc,,
|
57 |
+
huggingface_hub/commands/__pycache__/upload.cpython-310.pyc,,
|
58 |
+
huggingface_hub/commands/__pycache__/user.cpython-310.pyc,,
|
59 |
+
huggingface_hub/commands/_cli_utils.py,sha256=qRdl9opi3yJxIVNCnrmte-jFWmYbjVqd8gBlin8NNzY,1971
|
60 |
+
huggingface_hub/commands/delete_cache.py,sha256=Rb1BtIltJPnQ-th7tcK_L4mFqfk785t3KXV77xXKBP4,16131
|
61 |
+
huggingface_hub/commands/download.py,sha256=s0dSqUTWG26Q5F2rEFAr_jY2xW4yOvDbSM20vYCjD3I,7880
|
62 |
+
huggingface_hub/commands/env.py,sha256=yYl4DSS14V8t244nAi0t77Izx5LIdgS_dy6xiV5VQME,1226
|
63 |
+
huggingface_hub/commands/huggingface_cli.py,sha256=-MkVPxIKIhP1aTFcExz7krEEDdaVpG9cV7P70ZBJh-U,2030
|
64 |
+
huggingface_hub/commands/lfs.py,sha256=6E769AoRxUDiIOapn1_QvTbNtdUnUiouu2F4Gopp4do,7318
|
65 |
+
huggingface_hub/commands/scan_cache.py,sha256=4o_jQsZloicRa-P8gncUBncVyWswpSF9T6KGlNrGodk,5183
|
66 |
+
huggingface_hub/commands/tag.py,sha256=gCoR8G95lhHBzyVytTxT7MnqTmjKYtStDnHXcysOJwg,6287
|
67 |
+
huggingface_hub/commands/upload.py,sha256=Mr69qO60otqCVw0sVSBPykUTkL9HO-pkCyulSD2mROM,13622
|
68 |
+
huggingface_hub/commands/user.py,sha256=QApZJOCQEHADhjunM3hlQ72uqHsearCiCE4SdpzGdcc,6893
|
69 |
+
huggingface_hub/community.py,sha256=SBaOfI-3atCzRbO0gDS8BYxctbdvD4G0X6D0GfY8Fgc,12203
|
70 |
+
huggingface_hub/constants.py,sha256=_xLHaNnAcA9KnENaABbsee3UctmaViE8AQ6njk17ni4,7591
|
71 |
+
huggingface_hub/errors.py,sha256=IM0lNbExLzaYEs0HrrPvY4-kyj6DiP2Szu7Jy9slHOE,2083
|
72 |
+
huggingface_hub/fastai_utils.py,sha256=5I7zAfgHJU_mZnxnf9wgWTHrCRu_EAV8VTangDVfE_o,16676
|
73 |
+
huggingface_hub/file_download.py,sha256=n5ovYqh1-xe3ptRHuS-EXn6X_-3ZVI7C-pQrHD45DtA,82236
|
74 |
+
huggingface_hub/hf_api.py,sha256=hyMkURhYXalCNG4Qqx3PhN7Ucru8m18ZidEok_T2504,375216
|
75 |
+
huggingface_hub/hf_file_system.py,sha256=r7NGKIIF0o2GaFn_qZzvoCGi6Vyhc3BH8wcFGFztyCw,37425
|
76 |
+
huggingface_hub/hub_mixin.py,sha256=ktwuDqSXFU2q2_xj676R-zag_tB3QEiMMVFueJ3YD9g,34644
|
77 |
+
huggingface_hub/inference/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
78 |
+
huggingface_hub/inference/__pycache__/__init__.cpython-310.pyc,,
|
79 |
+
huggingface_hub/inference/__pycache__/_client.cpython-310.pyc,,
|
80 |
+
huggingface_hub/inference/__pycache__/_common.cpython-310.pyc,,
|
81 |
+
huggingface_hub/inference/__pycache__/_templating.cpython-310.pyc,,
|
82 |
+
huggingface_hub/inference/__pycache__/_types.cpython-310.pyc,,
|
83 |
+
huggingface_hub/inference/_client.py,sha256=NveAWL3hx8dwse0t_0U3dlRJoEtZ1G12TxZxvWimMF0,117568
|
84 |
+
huggingface_hub/inference/_common.py,sha256=L4b0A_raoWAUfl7d2vn6-rLfUcHcG5kjn_wUYIkx4uY,16362
|
85 |
+
huggingface_hub/inference/_generated/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
86 |
+
huggingface_hub/inference/_generated/__pycache__/__init__.cpython-310.pyc,,
|
87 |
+
huggingface_hub/inference/_generated/__pycache__/_async_client.cpython-310.pyc,,
|
88 |
+
huggingface_hub/inference/_generated/_async_client.py,sha256=Yva-stGgFAFH0vFF7o9JE3GbX14bGNz0AhQStfZDB8U,120700
|
89 |
+
huggingface_hub/inference/_generated/types/__init__.py,sha256=Ro2qZb2STQz8V3bfElXY4DvmkxKuBaPjzY5BgH-1khI,5110
|
90 |
+
huggingface_hub/inference/_generated/types/__pycache__/__init__.cpython-310.pyc,,
|
91 |
+
huggingface_hub/inference/_generated/types/__pycache__/audio_classification.cpython-310.pyc,,
|
92 |
+
huggingface_hub/inference/_generated/types/__pycache__/audio_to_audio.cpython-310.pyc,,
|
93 |
+
huggingface_hub/inference/_generated/types/__pycache__/automatic_speech_recognition.cpython-310.pyc,,
|
94 |
+
huggingface_hub/inference/_generated/types/__pycache__/base.cpython-310.pyc,,
|
95 |
+
huggingface_hub/inference/_generated/types/__pycache__/chat_completion.cpython-310.pyc,,
|
96 |
+
huggingface_hub/inference/_generated/types/__pycache__/depth_estimation.cpython-310.pyc,,
|
97 |
+
huggingface_hub/inference/_generated/types/__pycache__/document_question_answering.cpython-310.pyc,,
|
98 |
+
huggingface_hub/inference/_generated/types/__pycache__/feature_extraction.cpython-310.pyc,,
|
99 |
+
huggingface_hub/inference/_generated/types/__pycache__/fill_mask.cpython-310.pyc,,
|
100 |
+
huggingface_hub/inference/_generated/types/__pycache__/image_classification.cpython-310.pyc,,
|
101 |
+
huggingface_hub/inference/_generated/types/__pycache__/image_segmentation.cpython-310.pyc,,
|
102 |
+
huggingface_hub/inference/_generated/types/__pycache__/image_to_image.cpython-310.pyc,,
|
103 |
+
huggingface_hub/inference/_generated/types/__pycache__/image_to_text.cpython-310.pyc,,
|
104 |
+
huggingface_hub/inference/_generated/types/__pycache__/object_detection.cpython-310.pyc,,
|
105 |
+
huggingface_hub/inference/_generated/types/__pycache__/question_answering.cpython-310.pyc,,
|
106 |
+
huggingface_hub/inference/_generated/types/__pycache__/sentence_similarity.cpython-310.pyc,,
|
107 |
+
huggingface_hub/inference/_generated/types/__pycache__/summarization.cpython-310.pyc,,
|
108 |
+
huggingface_hub/inference/_generated/types/__pycache__/table_question_answering.cpython-310.pyc,,
|
109 |
+
huggingface_hub/inference/_generated/types/__pycache__/text2text_generation.cpython-310.pyc,,
|
110 |
+
huggingface_hub/inference/_generated/types/__pycache__/text_classification.cpython-310.pyc,,
|
111 |
+
huggingface_hub/inference/_generated/types/__pycache__/text_generation.cpython-310.pyc,,
|
112 |
+
huggingface_hub/inference/_generated/types/__pycache__/text_to_audio.cpython-310.pyc,,
|
113 |
+
huggingface_hub/inference/_generated/types/__pycache__/text_to_image.cpython-310.pyc,,
|
114 |
+
huggingface_hub/inference/_generated/types/__pycache__/token_classification.cpython-310.pyc,,
|
115 |
+
huggingface_hub/inference/_generated/types/__pycache__/translation.cpython-310.pyc,,
|
116 |
+
huggingface_hub/inference/_generated/types/__pycache__/video_classification.cpython-310.pyc,,
|
117 |
+
huggingface_hub/inference/_generated/types/__pycache__/visual_question_answering.cpython-310.pyc,,
|
118 |
+
huggingface_hub/inference/_generated/types/__pycache__/zero_shot_classification.cpython-310.pyc,,
|
119 |
+
huggingface_hub/inference/_generated/types/__pycache__/zero_shot_image_classification.cpython-310.pyc,,
|
120 |
+
huggingface_hub/inference/_generated/types/__pycache__/zero_shot_object_detection.cpython-310.pyc,,
|
121 |
+
huggingface_hub/inference/_generated/types/audio_classification.py,sha256=wk4kUTLQZoXWLpiUOpKRHRRE-JYqqJlzGVe62VACR-0,1347
|
122 |
+
huggingface_hub/inference/_generated/types/audio_to_audio.py,sha256=n7GeCepzt254yoSLsdjrI1j4fzYgjWzxoaKE5gZJc48,881
|
123 |
+
huggingface_hub/inference/_generated/types/automatic_speech_recognition.py,sha256=-7UHu5QTGwSrJFnrbMgzeUFpJQOGyTmfK_QHgtnx6j8,5352
|
124 |
+
huggingface_hub/inference/_generated/types/base.py,sha256=Cq4gUVtwwLmWyiIIq4NSL8kRk0EWk9QWWHc5Vup2LVg,6213
|
125 |
+
huggingface_hub/inference/_generated/types/chat_completion.py,sha256=cPe_VAs-bfsUELY0fZtMnId6fdVoJnAcRmJItD5Otck,8185
|
126 |
+
huggingface_hub/inference/_generated/types/depth_estimation.py,sha256=lmLmd8S313ZMCG94RblwquL0UN_0hJmXAhWUqSIrtwc,898
|
127 |
+
huggingface_hub/inference/_generated/types/document_question_answering.py,sha256=_hBzK4Pu9X_zXsgOO4JNSloIKuVfE5m7eGwEw5YTfZ4,3264
|
128 |
+
huggingface_hub/inference/_generated/types/feature_extraction.py,sha256=KerTrRR5YR02X0qBDzrtK8953amCGf_adSUbfWOozD4,664
|
129 |
+
huggingface_hub/inference/_generated/types/fill_mask.py,sha256=JcYIbTDXc4f7k2FNY3fCWtJ9ke3HUZFz2pDOOrDuxOs,1714
|
130 |
+
huggingface_hub/inference/_generated/types/image_classification.py,sha256=W1QVfc0j7t6qbxjICUQDwygRx43yPPGZKyStogHkHqg,1359
|
131 |
+
huggingface_hub/inference/_generated/types/image_segmentation.py,sha256=nVQc5Qhv37qqmTn_M8xegpNgk14ozKelsGIYC8hba_0,1803
|
132 |
+
huggingface_hub/inference/_generated/types/image_to_image.py,sha256=MbubS9pD8bFP9LoI4QoQxJwpUGeNXi5iSEk8Ymhbh0M,1797
|
133 |
+
huggingface_hub/inference/_generated/types/image_to_text.py,sha256=mloLf-LO7oR_2HbPY1-XMM18BfjMODytRaxTXYkIXoY,4827
|
134 |
+
huggingface_hub/inference/_generated/types/object_detection.py,sha256=F8ly6GSE8dupsekPVf6G5nI8teZAIP4iXw6u3zm1JiE,1569
|
135 |
+
huggingface_hub/inference/_generated/types/question_answering.py,sha256=xLDy5oA-k9JPncSU6NqPAPb8rWPerfTbU857G3e7JZ0,2884
|
136 |
+
huggingface_hub/inference/_generated/types/sentence_similarity.py,sha256=edH-TWfnZ4J0zJD-zqfcRMLwOV0dTt1g5Y0caYnVuPc,1018
|
137 |
+
huggingface_hub/inference/_generated/types/summarization.py,sha256=RWCXh7yftI_JWvLsr7JiDpQPexq1klYP158tUICUcbM,1574
|
138 |
+
huggingface_hub/inference/_generated/types/table_question_answering.py,sha256=PuVZlR6dI6FEUK7pjMSVMtzkDgrcxdKjfcnDbVmPdSs,1569
|
139 |
+
huggingface_hub/inference/_generated/types/text2text_generation.py,sha256=SZYfdhyraG5vZ2Jzm1C8k9w9IYLxMtm5UUu1tU2oOQk,1604
|
140 |
+
huggingface_hub/inference/_generated/types/text_classification.py,sha256=vC7B1sBzZ4gdLjE2i2Y7w5cpdaFwQKK1dlWqW0asjIk,1347
|
141 |
+
huggingface_hub/inference/_generated/types/text_generation.py,sha256=wR2DrDazFmeqIchkHXPUv17d4zWUmiUSPBdUFCDqJNY,4284
|
142 |
+
huggingface_hub/inference/_generated/types/text_to_audio.py,sha256=cgvECsiwsycgP9Tfs_GU1CJfo9AngVn6x9s4fHCP-g4,4819
|
143 |
+
huggingface_hub/inference/_generated/types/text_to_image.py,sha256=oBGeJ-S9WfsMxVQlvEOll9yaCyMXZ277wsYFD8bt87U,1931
|
144 |
+
huggingface_hub/inference/_generated/types/token_classification.py,sha256=7oL8AZOTWtf2bYD2T3236GDNMtUl7FtydaB6We7wbfw,1890
|
145 |
+
huggingface_hub/inference/_generated/types/translation.py,sha256=MruCx6yhzQGlxSdBRXCVoEhRzRSa5Ks4bjZ1PDrlTeQ,1562
|
146 |
+
huggingface_hub/inference/_generated/types/video_classification.py,sha256=BI2_PP-pxLT6w9TuX6QCZz4BsG-ZukTXnW6fWMchI5M,1579
|
147 |
+
huggingface_hub/inference/_generated/types/visual_question_answering.py,sha256=0PHNnjwxxHvG3SjOz7O7DckbBeGYDsRmlagG11qIkkM,1667
|
148 |
+
huggingface_hub/inference/_generated/types/zero_shot_classification.py,sha256=u6jfFCqDv9XqeAN5E9_Xf7jqMZgqTRFF_S9PtWbiBUk,1963
|
149 |
+
huggingface_hub/inference/_generated/types/zero_shot_image_classification.py,sha256=qVH6Ms0FjF8TraGy4BYiS8lmvGq9xiIDdXqGFynLHMA,1689
|
150 |
+
huggingface_hub/inference/_generated/types/zero_shot_object_detection.py,sha256=PU4OOlQ2aAOosW2JlG2Z27MEQpmE6BxcygH_ns3w1KQ,1662
|
151 |
+
huggingface_hub/inference/_templating.py,sha256=LCy-U_25R-l5dhcEHsyRwiOrgvKQHXkdSmynWCfsPjI,3991
|
152 |
+
huggingface_hub/inference/_types.py,sha256=C73l5-RO8P1UMBHF8OAO9CRUq7Xdv33pcADoJsGMPSU,1782
|
153 |
+
huggingface_hub/inference_api.py,sha256=UXOKu_Ez2I3hDsjguqCcCrj03WFDndehpngYiIAucdg,8331
|
154 |
+
huggingface_hub/keras_mixin.py,sha256=2DF-hNGdxJCxqvcw46id-ExH_865ZAXsJd2vmpAuWHQ,19484
|
155 |
+
huggingface_hub/lfs.py,sha256=GNmKV_SURcGxMa3p_OyF8ttoq7fZhHjgpyxYzP4VTqU,19690
|
156 |
+
huggingface_hub/repocard.py,sha256=oUrGim27nCHkevPDZDbUp68uKTxB8xbdoyeqv24pexc,34605
|
157 |
+
huggingface_hub/repocard_data.py,sha256=1hIkI8xp0EmW2aR3LtHMrjIMk_W-KJxHslMjpNMwVPg,31911
|
158 |
+
huggingface_hub/repository.py,sha256=87QxXPTK9PCztFW69oD4RZsNMLL9yxoQDdn-F81wSdM,54548
|
159 |
+
huggingface_hub/serialization/__init__.py,sha256=W74TaCtYnMfpvGEQr1SS-OBmqPUFnM9AeWT9hTJCG9Y,910
|
160 |
+
huggingface_hub/serialization/__pycache__/__init__.cpython-310.pyc,,
|
161 |
+
huggingface_hub/serialization/__pycache__/_base.cpython-310.pyc,,
|
162 |
+
huggingface_hub/serialization/__pycache__/_numpy.cpython-310.pyc,,
|
163 |
+
huggingface_hub/serialization/__pycache__/_tensorflow.cpython-310.pyc,,
|
164 |
+
huggingface_hub/serialization/__pycache__/_torch.cpython-310.pyc,,
|
165 |
+
huggingface_hub/serialization/_base.py,sha256=AgO-16i-vyosbERnLSCFYgaXbVqQDM7xfIne8gsWrLQ,7133
|
166 |
+
huggingface_hub/serialization/_numpy.py,sha256=idULJp1js6L6E8o-MiGVqNa4lBfXS2cfAmqivnpsaYs,2671
|
167 |
+
huggingface_hub/serialization/_tensorflow.py,sha256=Rf4kw1NYxEaoUXB8aLtQLHrTjgobaEAJdzO0w0kbP58,3559
|
168 |
+
huggingface_hub/serialization/_torch.py,sha256=xYR6e_G9laMTroWLiQRABSuloTQuuRSQNyYHdT_rmXU,7687
|
169 |
+
huggingface_hub/templates/datasetcard_template.md,sha256=W-EMqR6wndbrnZorkVv56URWPG49l7MATGeI015kTvs,5503
|
170 |
+
huggingface_hub/templates/modelcard_template.md,sha256=4AqArS3cqdtbit5Bo-DhjcnDFR-pza5hErLLTPM4Yuc,6870
|
171 |
+
huggingface_hub/utils/__init__.py,sha256=44yhxTtWsuMGrZcALK-3UuVazGBtc94z9nZwLmLnu8w,3589
|
172 |
+
huggingface_hub/utils/__pycache__/__init__.cpython-310.pyc,,
|
173 |
+
huggingface_hub/utils/__pycache__/_cache_assets.cpython-310.pyc,,
|
174 |
+
huggingface_hub/utils/__pycache__/_cache_manager.cpython-310.pyc,,
|
175 |
+
huggingface_hub/utils/__pycache__/_chunk_utils.cpython-310.pyc,,
|
176 |
+
huggingface_hub/utils/__pycache__/_datetime.cpython-310.pyc,,
|
177 |
+
huggingface_hub/utils/__pycache__/_deprecation.cpython-310.pyc,,
|
178 |
+
huggingface_hub/utils/__pycache__/_errors.cpython-310.pyc,,
|
179 |
+
huggingface_hub/utils/__pycache__/_experimental.cpython-310.pyc,,
|
180 |
+
huggingface_hub/utils/__pycache__/_fixes.cpython-310.pyc,,
|
181 |
+
huggingface_hub/utils/__pycache__/_git_credential.cpython-310.pyc,,
|
182 |
+
huggingface_hub/utils/__pycache__/_headers.cpython-310.pyc,,
|
183 |
+
huggingface_hub/utils/__pycache__/_hf_folder.cpython-310.pyc,,
|
184 |
+
huggingface_hub/utils/__pycache__/_http.cpython-310.pyc,,
|
185 |
+
huggingface_hub/utils/__pycache__/_pagination.cpython-310.pyc,,
|
186 |
+
huggingface_hub/utils/__pycache__/_paths.cpython-310.pyc,,
|
187 |
+
huggingface_hub/utils/__pycache__/_runtime.cpython-310.pyc,,
|
188 |
+
huggingface_hub/utils/__pycache__/_safetensors.cpython-310.pyc,,
|
189 |
+
huggingface_hub/utils/__pycache__/_subprocess.cpython-310.pyc,,
|
190 |
+
huggingface_hub/utils/__pycache__/_telemetry.cpython-310.pyc,,
|
191 |
+
huggingface_hub/utils/__pycache__/_token.cpython-310.pyc,,
|
192 |
+
huggingface_hub/utils/__pycache__/_typing.cpython-310.pyc,,
|
193 |
+
huggingface_hub/utils/__pycache__/_validators.cpython-310.pyc,,
|
194 |
+
huggingface_hub/utils/__pycache__/endpoint_helpers.cpython-310.pyc,,
|
195 |
+
huggingface_hub/utils/__pycache__/insecure_hashlib.cpython-310.pyc,,
|
196 |
+
huggingface_hub/utils/__pycache__/logging.cpython-310.pyc,,
|
197 |
+
huggingface_hub/utils/__pycache__/sha.cpython-310.pyc,,
|
198 |
+
huggingface_hub/utils/__pycache__/tqdm.cpython-310.pyc,,
|
199 |
+
huggingface_hub/utils/_cache_assets.py,sha256=kai77HPQMfYpROouMBQCr_gdBCaeTm996Sqj0dExbNg,5728
|
200 |
+
huggingface_hub/utils/_cache_manager.py,sha256=Fs1XVP1UGzUTogMfMfEi_MfpURzHyW__djX0s2oLmrY,29307
|
201 |
+
huggingface_hub/utils/_chunk_utils.py,sha256=kRCaj5228_vKcyLWspd8Xq01f17Jz6ds5Sr9ed5d_RU,2130
|
202 |
+
huggingface_hub/utils/_datetime.py,sha256=DHnktKm1taeOe2XCBgNU4pVck5d70qu8FJ7nACD6C3k,2554
|
203 |
+
huggingface_hub/utils/_deprecation.py,sha256=HZhRGGUX_QMKBBBwHHlffLtmCSK01TOpeXHefZbPfwI,4872
|
204 |
+
huggingface_hub/utils/_errors.py,sha256=N5nUkCCaj8393wntazeTcKNrwDZfsDVHVMxxreHPfaE,15141
|
205 |
+
huggingface_hub/utils/_experimental.py,sha256=crCPH6k6-11wwH2GZuZzZzZbjUotay49ywV1SSJhMHM,2395
|
206 |
+
huggingface_hub/utils/_fixes.py,sha256=wJ0FGewO6_zZFo65crJWcth9zODZz4TdyeDxkGNSeB0,2898
|
207 |
+
huggingface_hub/utils/_git_credential.py,sha256=SDdsiREr1TcAR2Ze2TB0E5cYzVJgvDZrs60od9lAsMc,4596
|
208 |
+
huggingface_hub/utils/_headers.py,sha256=05sDPAi7-Fs3Z4YLbrTJTAbIT7yjSX9DEqotd6gHqhQ,9593
|
209 |
+
huggingface_hub/utils/_hf_folder.py,sha256=gWH-TT9h_6X_CyrtLTtKNEawf9kKlCHraFiOu09BuLk,3613
|
210 |
+
huggingface_hub/utils/_http.py,sha256=-Vuphx-pX9dvVBUf-AS2dECjO0HJBscXzith_FKOgO4,13458
|
211 |
+
huggingface_hub/utils/_pagination.py,sha256=hzLFLd8i_DKkPRVYzOx2CxLt5lcocEiAxDJriQUjAjY,1841
|
212 |
+
huggingface_hub/utils/_paths.py,sha256=bs6PlgsVdAINC9bAKivVOcOod1lIun0YgJbQ3VpmpPE,4646
|
213 |
+
huggingface_hub/utils/_runtime.py,sha256=QooW0cgJ349PX8x46KBluN01KMMvUm0ZQ9SsmidBH74,11041
|
214 |
+
huggingface_hub/utils/_safetensors.py,sha256=GW3nyv7xQcuwObKYeYoT9VhURVzG1DZTbKBKho8Bbos,4458
|
215 |
+
huggingface_hub/utils/_subprocess.py,sha256=34ETD8JvLzm16NRZHciaCLXdE9aRyxuDdOA5gdNvMJ8,4617
|
216 |
+
huggingface_hub/utils/_telemetry.py,sha256=jHAdgWNcL9nVvMT3ec3i78O-cwL09GnlifuokzpQjMI,4641
|
217 |
+
huggingface_hub/utils/_token.py,sha256=cxBZaafW2IsJ2dKWd55v7056zycW1ewp_nPk8dNcSO4,5476
|
218 |
+
huggingface_hub/utils/_typing.py,sha256=pXh7GtVtSBD_Fvvthex9BRTAJZ6bWScUOw06oJS0Lek,2025
|
219 |
+
huggingface_hub/utils/_validators.py,sha256=dDsVG31iooTYrIyi5Vwr1DukL0fEmJwu3ceVNduhsuE,9204
|
220 |
+
huggingface_hub/utils/endpoint_helpers.py,sha256=n_VguR_L2Vl6Mi_4PFO2iAd5xaPeQRiD8KRBpzs4nMw,9536
|
221 |
+
huggingface_hub/utils/insecure_hashlib.py,sha256=OjxlvtSQHpbLp9PWSrXBDJ0wHjxCBU-SQJgucEEXDbU,1058
|
222 |
+
huggingface_hub/utils/logging.py,sha256=Cp03s0uEl3kDM9XHQW9a8GAoExODQ-e7kEtgMt-_To8,4728
|
223 |
+
huggingface_hub/utils/sha.py,sha256=QLlIwPCyz46MmUc_4L8xl87KfYoBks9kPgsMZ5JCz-o,902
|
224 |
+
huggingface_hub/utils/tqdm.py,sha256=x35PqUA8bBBztPrqhv87Y_TGl5CdlfBs4pe6k1YyDJ8,9390
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/WHEEL
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Wheel-Version: 1.0
|
2 |
+
Generator: bdist_wheel (0.43.0)
|
3 |
+
Root-Is-Purelib: true
|
4 |
+
Tag: py3-none-any
|
5 |
+
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/entry_points.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[console_scripts]
|
2 |
+
huggingface-cli = huggingface_hub.commands.huggingface_cli:main
|
3 |
+
|
4 |
+
[fsspec.specs]
|
5 |
+
hf=huggingface_hub.HfFileSystem
|
6 |
+
|
llmeval-env/lib/python3.10/site-packages/huggingface_hub-0.23.0.dist-info/top_level.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
huggingface_hub
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (186 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/__init__.py
ADDED
File without changes
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (194 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/libcharset.h
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Copyright (C) 2003 Free Software Foundation, Inc.
|
2 |
+
This file is part of the GNU CHARSET Library.
|
3 |
+
|
4 |
+
The GNU CHARSET Library is free software; you can redistribute it and/or
|
5 |
+
modify it under the terms of the GNU Lesser General Public License as
|
6 |
+
published by the Free Software Foundation; either version 2 of the
|
7 |
+
License, or (at your option) any later version.
|
8 |
+
|
9 |
+
The GNU CHARSET Library is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12 |
+
Lesser General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU Lesser General Public License
|
15 |
+
along with the GNU CHARSET Library; see the file COPYING.LIB. If not,
|
16 |
+
see <https://www.gnu.org/licenses/>. */
|
17 |
+
|
18 |
+
#ifndef _LIBCHARSET_H
|
19 |
+
#define _LIBCHARSET_H
|
20 |
+
|
21 |
+
#include <localcharset.h>
|
22 |
+
|
23 |
+
|
24 |
+
#ifdef __cplusplus
|
25 |
+
extern "C" {
|
26 |
+
#endif
|
27 |
+
|
28 |
+
|
29 |
+
/* Support for relocatable packages. */
|
30 |
+
|
31 |
+
/* Sets the original and the current installation prefix of the package.
|
32 |
+
Relocation simply replaces a pathname starting with the original prefix
|
33 |
+
by the corresponding pathname with the current prefix instead. Both
|
34 |
+
prefixes should be directory names without trailing slash (i.e. use ""
|
35 |
+
instead of "/"). */
|
36 |
+
extern void libcharset_set_relocation_prefix (const char *orig_prefix,
|
37 |
+
const char *curr_prefix);
|
38 |
+
|
39 |
+
|
40 |
+
#ifdef __cplusplus
|
41 |
+
}
|
42 |
+
#endif
|
43 |
+
|
44 |
+
|
45 |
+
#endif /* _LIBCHARSET_H */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/localcharset.h
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Determine a canonical name for the current locale's character encoding.
|
2 |
+
Copyright (C) 2000-2003, 2009-2019 Free Software Foundation, Inc.
|
3 |
+
This file is part of the GNU CHARSET Library.
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify it
|
6 |
+
under the terms of the GNU Lesser General Public License as published
|
7 |
+
by the Free Software Foundation; either version 2, or (at your option)
|
8 |
+
any later version.
|
9 |
+
|
10 |
+
This program is distributed in the hope that it will be useful,
|
11 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 |
+
Lesser General Public License for more details.
|
14 |
+
|
15 |
+
You should have received a copy of the GNU Lesser General Public License
|
16 |
+
along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
17 |
+
|
18 |
+
#ifndef _LOCALCHARSET_H
|
19 |
+
#define _LOCALCHARSET_H
|
20 |
+
|
21 |
+
|
22 |
+
#ifdef __cplusplus
|
23 |
+
extern "C" {
|
24 |
+
#endif
|
25 |
+
|
26 |
+
|
27 |
+
/* Determine the current locale's character encoding, and canonicalize it
|
28 |
+
into one of the canonical names listed below.
|
29 |
+
The result must not be freed; it is statically allocated. The result
|
30 |
+
becomes invalid when setlocale() is used to change the global locale, or
|
31 |
+
when the value of one of the environment variables LC_ALL, LC_CTYPE, LANG
|
32 |
+
is changed; threads in multithreaded programs should not do this.
|
33 |
+
If the canonical name cannot be determined, the result is a non-canonical
|
34 |
+
name. */
|
35 |
+
extern const char * locale_charset (void);
|
36 |
+
|
37 |
+
/* About GNU canonical names for character encodings:
|
38 |
+
|
39 |
+
Every canonical name must be supported by GNU libiconv. Support by GNU libc
|
40 |
+
is also desirable.
|
41 |
+
|
42 |
+
The name is case insensitive. Usually an upper case MIME charset name is
|
43 |
+
preferred.
|
44 |
+
|
45 |
+
The current list of these GNU canonical names is:
|
46 |
+
|
47 |
+
name MIME? used by which systems
|
48 |
+
(darwin = Mac OS X, windows = native Windows)
|
49 |
+
|
50 |
+
ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin
|
51 |
+
ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
52 |
+
ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
53 |
+
ISO-8859-3 Y glibc solaris cygwin
|
54 |
+
ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin
|
55 |
+
ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
56 |
+
ISO-8859-6 Y glibc aix hpux solaris cygwin
|
57 |
+
ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin zos
|
58 |
+
ISO-8859-8 Y glibc aix hpux osf solaris cygwin zos
|
59 |
+
ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin zos
|
60 |
+
ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin
|
61 |
+
ISO-8859-14 glibc cygwin
|
62 |
+
ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin
|
63 |
+
KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin
|
64 |
+
KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin
|
65 |
+
KOI8-T glibc
|
66 |
+
CP437 dos
|
67 |
+
CP775 dos
|
68 |
+
CP850 aix osf dos
|
69 |
+
CP852 dos
|
70 |
+
CP855 dos
|
71 |
+
CP856 aix
|
72 |
+
CP857 dos
|
73 |
+
CP861 dos
|
74 |
+
CP862 dos
|
75 |
+
CP864 dos
|
76 |
+
CP865 dos
|
77 |
+
CP866 freebsd netbsd openbsd darwin dos
|
78 |
+
CP869 dos
|
79 |
+
CP874 windows dos
|
80 |
+
CP922 aix
|
81 |
+
CP932 aix cygwin windows dos
|
82 |
+
CP943 aix zos
|
83 |
+
CP949 osf darwin windows dos
|
84 |
+
CP950 windows dos
|
85 |
+
CP1046 aix
|
86 |
+
CP1124 aix
|
87 |
+
CP1125 dos
|
88 |
+
CP1129 aix
|
89 |
+
CP1131 freebsd darwin
|
90 |
+
CP1250 windows
|
91 |
+
CP1251 glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows
|
92 |
+
CP1252 aix windows
|
93 |
+
CP1253 windows
|
94 |
+
CP1254 windows
|
95 |
+
CP1255 glibc windows
|
96 |
+
CP1256 windows
|
97 |
+
CP1257 windows
|
98 |
+
GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin zos
|
99 |
+
EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin
|
100 |
+
EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin zos
|
101 |
+
EUC-TW glibc aix hpux irix osf solaris netbsd
|
102 |
+
BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin zos
|
103 |
+
BIG5-HKSCS glibc hpux solaris netbsd darwin
|
104 |
+
GBK glibc aix osf solaris freebsd darwin cygwin windows dos
|
105 |
+
GB18030 glibc hpux solaris freebsd netbsd darwin
|
106 |
+
SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin
|
107 |
+
JOHAB glibc solaris windows
|
108 |
+
TIS-620 glibc aix hpux osf solaris cygwin zos
|
109 |
+
VISCII Y glibc
|
110 |
+
TCVN5712-1 glibc
|
111 |
+
ARMSCII-8 glibc freebsd netbsd darwin
|
112 |
+
GEORGIAN-PS glibc cygwin
|
113 |
+
PT154 glibc netbsd cygwin
|
114 |
+
HP-ROMAN8 hpux
|
115 |
+
HP-ARABIC8 hpux
|
116 |
+
HP-GREEK8 hpux
|
117 |
+
HP-HEBREW8 hpux
|
118 |
+
HP-TURKISH8 hpux
|
119 |
+
HP-KANA8 hpux
|
120 |
+
DEC-KANJI osf
|
121 |
+
DEC-HANYU osf
|
122 |
+
UTF-8 Y glibc aix hpux osf solaris netbsd darwin cygwin zos
|
123 |
+
|
124 |
+
Note: Names which are not marked as being a MIME name should not be used in
|
125 |
+
Internet protocols for information interchange (mail, news, etc.).
|
126 |
+
|
127 |
+
Note: ASCII and ANSI_X3.4-1968 are synonymous canonical names. Applications
|
128 |
+
must understand both names and treat them as equivalent.
|
129 |
+
*/
|
130 |
+
|
131 |
+
|
132 |
+
#ifdef __cplusplus
|
133 |
+
}
|
134 |
+
#endif
|
135 |
+
|
136 |
+
|
137 |
+
#endif /* _LOCALCHARSET_H */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/zconf.h
ADDED
@@ -0,0 +1,543 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* zconf.h -- configuration of the zlib compression library
|
2 |
+
* Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler
|
3 |
+
* For conditions of distribution and use, see copyright notice in zlib.h
|
4 |
+
*/
|
5 |
+
|
6 |
+
/* @(#) $Id$ */
|
7 |
+
|
8 |
+
#ifndef ZCONF_H
|
9 |
+
#define ZCONF_H
|
10 |
+
|
11 |
+
/*
|
12 |
+
* If you *really* need a unique prefix for all types and library functions,
|
13 |
+
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
14 |
+
* Even better than compiling with -DZ_PREFIX would be to use configure to set
|
15 |
+
* this permanently in zconf.h using "./configure --zprefix".
|
16 |
+
*/
|
17 |
+
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
18 |
+
# define Z_PREFIX_SET
|
19 |
+
|
20 |
+
/* all linked symbols and init macros */
|
21 |
+
# define _dist_code z__dist_code
|
22 |
+
# define _length_code z__length_code
|
23 |
+
# define _tr_align z__tr_align
|
24 |
+
# define _tr_flush_bits z__tr_flush_bits
|
25 |
+
# define _tr_flush_block z__tr_flush_block
|
26 |
+
# define _tr_init z__tr_init
|
27 |
+
# define _tr_stored_block z__tr_stored_block
|
28 |
+
# define _tr_tally z__tr_tally
|
29 |
+
# define adler32 z_adler32
|
30 |
+
# define adler32_combine z_adler32_combine
|
31 |
+
# define adler32_combine64 z_adler32_combine64
|
32 |
+
# define adler32_z z_adler32_z
|
33 |
+
# ifndef Z_SOLO
|
34 |
+
# define compress z_compress
|
35 |
+
# define compress2 z_compress2
|
36 |
+
# define compressBound z_compressBound
|
37 |
+
# endif
|
38 |
+
# define crc32 z_crc32
|
39 |
+
# define crc32_combine z_crc32_combine
|
40 |
+
# define crc32_combine64 z_crc32_combine64
|
41 |
+
# define crc32_combine_gen z_crc32_combine_gen
|
42 |
+
# define crc32_combine_gen64 z_crc32_combine_gen64
|
43 |
+
# define crc32_combine_op z_crc32_combine_op
|
44 |
+
# define crc32_z z_crc32_z
|
45 |
+
# define deflate z_deflate
|
46 |
+
# define deflateBound z_deflateBound
|
47 |
+
# define deflateCopy z_deflateCopy
|
48 |
+
# define deflateEnd z_deflateEnd
|
49 |
+
# define deflateGetDictionary z_deflateGetDictionary
|
50 |
+
# define deflateInit z_deflateInit
|
51 |
+
# define deflateInit2 z_deflateInit2
|
52 |
+
# define deflateInit2_ z_deflateInit2_
|
53 |
+
# define deflateInit_ z_deflateInit_
|
54 |
+
# define deflateParams z_deflateParams
|
55 |
+
# define deflatePending z_deflatePending
|
56 |
+
# define deflatePrime z_deflatePrime
|
57 |
+
# define deflateReset z_deflateReset
|
58 |
+
# define deflateResetKeep z_deflateResetKeep
|
59 |
+
# define deflateSetDictionary z_deflateSetDictionary
|
60 |
+
# define deflateSetHeader z_deflateSetHeader
|
61 |
+
# define deflateTune z_deflateTune
|
62 |
+
# define deflate_copyright z_deflate_copyright
|
63 |
+
# define get_crc_table z_get_crc_table
|
64 |
+
# ifndef Z_SOLO
|
65 |
+
# define gz_error z_gz_error
|
66 |
+
# define gz_intmax z_gz_intmax
|
67 |
+
# define gz_strwinerror z_gz_strwinerror
|
68 |
+
# define gzbuffer z_gzbuffer
|
69 |
+
# define gzclearerr z_gzclearerr
|
70 |
+
# define gzclose z_gzclose
|
71 |
+
# define gzclose_r z_gzclose_r
|
72 |
+
# define gzclose_w z_gzclose_w
|
73 |
+
# define gzdirect z_gzdirect
|
74 |
+
# define gzdopen z_gzdopen
|
75 |
+
# define gzeof z_gzeof
|
76 |
+
# define gzerror z_gzerror
|
77 |
+
# define gzflush z_gzflush
|
78 |
+
# define gzfread z_gzfread
|
79 |
+
# define gzfwrite z_gzfwrite
|
80 |
+
# define gzgetc z_gzgetc
|
81 |
+
# define gzgetc_ z_gzgetc_
|
82 |
+
# define gzgets z_gzgets
|
83 |
+
# define gzoffset z_gzoffset
|
84 |
+
# define gzoffset64 z_gzoffset64
|
85 |
+
# define gzopen z_gzopen
|
86 |
+
# define gzopen64 z_gzopen64
|
87 |
+
# ifdef _WIN32
|
88 |
+
# define gzopen_w z_gzopen_w
|
89 |
+
# endif
|
90 |
+
# define gzprintf z_gzprintf
|
91 |
+
# define gzputc z_gzputc
|
92 |
+
# define gzputs z_gzputs
|
93 |
+
# define gzread z_gzread
|
94 |
+
# define gzrewind z_gzrewind
|
95 |
+
# define gzseek z_gzseek
|
96 |
+
# define gzseek64 z_gzseek64
|
97 |
+
# define gzsetparams z_gzsetparams
|
98 |
+
# define gztell z_gztell
|
99 |
+
# define gztell64 z_gztell64
|
100 |
+
# define gzungetc z_gzungetc
|
101 |
+
# define gzvprintf z_gzvprintf
|
102 |
+
# define gzwrite z_gzwrite
|
103 |
+
# endif
|
104 |
+
# define inflate z_inflate
|
105 |
+
# define inflateBack z_inflateBack
|
106 |
+
# define inflateBackEnd z_inflateBackEnd
|
107 |
+
# define inflateBackInit z_inflateBackInit
|
108 |
+
# define inflateBackInit_ z_inflateBackInit_
|
109 |
+
# define inflateCodesUsed z_inflateCodesUsed
|
110 |
+
# define inflateCopy z_inflateCopy
|
111 |
+
# define inflateEnd z_inflateEnd
|
112 |
+
# define inflateGetDictionary z_inflateGetDictionary
|
113 |
+
# define inflateGetHeader z_inflateGetHeader
|
114 |
+
# define inflateInit z_inflateInit
|
115 |
+
# define inflateInit2 z_inflateInit2
|
116 |
+
# define inflateInit2_ z_inflateInit2_
|
117 |
+
# define inflateInit_ z_inflateInit_
|
118 |
+
# define inflateMark z_inflateMark
|
119 |
+
# define inflatePrime z_inflatePrime
|
120 |
+
# define inflateReset z_inflateReset
|
121 |
+
# define inflateReset2 z_inflateReset2
|
122 |
+
# define inflateResetKeep z_inflateResetKeep
|
123 |
+
# define inflateSetDictionary z_inflateSetDictionary
|
124 |
+
# define inflateSync z_inflateSync
|
125 |
+
# define inflateSyncPoint z_inflateSyncPoint
|
126 |
+
# define inflateUndermine z_inflateUndermine
|
127 |
+
# define inflateValidate z_inflateValidate
|
128 |
+
# define inflate_copyright z_inflate_copyright
|
129 |
+
# define inflate_fast z_inflate_fast
|
130 |
+
# define inflate_table z_inflate_table
|
131 |
+
# ifndef Z_SOLO
|
132 |
+
# define uncompress z_uncompress
|
133 |
+
# define uncompress2 z_uncompress2
|
134 |
+
# endif
|
135 |
+
# define zError z_zError
|
136 |
+
# ifndef Z_SOLO
|
137 |
+
# define zcalloc z_zcalloc
|
138 |
+
# define zcfree z_zcfree
|
139 |
+
# endif
|
140 |
+
# define zlibCompileFlags z_zlibCompileFlags
|
141 |
+
# define zlibVersion z_zlibVersion
|
142 |
+
|
143 |
+
/* all zlib typedefs in zlib.h and zconf.h */
|
144 |
+
# define Byte z_Byte
|
145 |
+
# define Bytef z_Bytef
|
146 |
+
# define alloc_func z_alloc_func
|
147 |
+
# define charf z_charf
|
148 |
+
# define free_func z_free_func
|
149 |
+
# ifndef Z_SOLO
|
150 |
+
# define gzFile z_gzFile
|
151 |
+
# endif
|
152 |
+
# define gz_header z_gz_header
|
153 |
+
# define gz_headerp z_gz_headerp
|
154 |
+
# define in_func z_in_func
|
155 |
+
# define intf z_intf
|
156 |
+
# define out_func z_out_func
|
157 |
+
# define uInt z_uInt
|
158 |
+
# define uIntf z_uIntf
|
159 |
+
# define uLong z_uLong
|
160 |
+
# define uLongf z_uLongf
|
161 |
+
# define voidp z_voidp
|
162 |
+
# define voidpc z_voidpc
|
163 |
+
# define voidpf z_voidpf
|
164 |
+
|
165 |
+
/* all zlib structs in zlib.h and zconf.h */
|
166 |
+
# define gz_header_s z_gz_header_s
|
167 |
+
# define internal_state z_internal_state
|
168 |
+
|
169 |
+
#endif
|
170 |
+
|
171 |
+
#if defined(__MSDOS__) && !defined(MSDOS)
|
172 |
+
# define MSDOS
|
173 |
+
#endif
|
174 |
+
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
175 |
+
# define OS2
|
176 |
+
#endif
|
177 |
+
#if defined(_WINDOWS) && !defined(WINDOWS)
|
178 |
+
# define WINDOWS
|
179 |
+
#endif
|
180 |
+
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
181 |
+
# ifndef WIN32
|
182 |
+
# define WIN32
|
183 |
+
# endif
|
184 |
+
#endif
|
185 |
+
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
186 |
+
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
187 |
+
# ifndef SYS16BIT
|
188 |
+
# define SYS16BIT
|
189 |
+
# endif
|
190 |
+
# endif
|
191 |
+
#endif
|
192 |
+
|
193 |
+
/*
|
194 |
+
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
195 |
+
* than 64k bytes at a time (needed on systems with 16-bit int).
|
196 |
+
*/
|
197 |
+
#ifdef SYS16BIT
|
198 |
+
# define MAXSEG_64K
|
199 |
+
#endif
|
200 |
+
#ifdef MSDOS
|
201 |
+
# define UNALIGNED_OK
|
202 |
+
#endif
|
203 |
+
|
204 |
+
#ifdef __STDC_VERSION__
|
205 |
+
# ifndef STDC
|
206 |
+
# define STDC
|
207 |
+
# endif
|
208 |
+
# if __STDC_VERSION__ >= 199901L
|
209 |
+
# ifndef STDC99
|
210 |
+
# define STDC99
|
211 |
+
# endif
|
212 |
+
# endif
|
213 |
+
#endif
|
214 |
+
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
215 |
+
# define STDC
|
216 |
+
#endif
|
217 |
+
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
218 |
+
# define STDC
|
219 |
+
#endif
|
220 |
+
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
221 |
+
# define STDC
|
222 |
+
#endif
|
223 |
+
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
224 |
+
# define STDC
|
225 |
+
#endif
|
226 |
+
|
227 |
+
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
228 |
+
# define STDC
|
229 |
+
#endif
|
230 |
+
|
231 |
+
#ifndef STDC
|
232 |
+
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
233 |
+
# define const /* note: need a more gentle solution here */
|
234 |
+
# endif
|
235 |
+
#endif
|
236 |
+
|
237 |
+
#if defined(ZLIB_CONST) && !defined(z_const)
|
238 |
+
# define z_const const
|
239 |
+
#else
|
240 |
+
# define z_const
|
241 |
+
#endif
|
242 |
+
|
243 |
+
#ifdef Z_SOLO
|
244 |
+
# ifdef _WIN64
|
245 |
+
typedef unsigned long long z_size_t;
|
246 |
+
# else
|
247 |
+
typedef unsigned long z_size_t;
|
248 |
+
# endif
|
249 |
+
#else
|
250 |
+
# define z_longlong long long
|
251 |
+
# if defined(NO_SIZE_T)
|
252 |
+
typedef unsigned NO_SIZE_T z_size_t;
|
253 |
+
# elif defined(STDC)
|
254 |
+
# include <stddef.h>
|
255 |
+
typedef size_t z_size_t;
|
256 |
+
# else
|
257 |
+
typedef unsigned long z_size_t;
|
258 |
+
# endif
|
259 |
+
# undef z_longlong
|
260 |
+
#endif
|
261 |
+
|
262 |
+
/* Maximum value for memLevel in deflateInit2 */
|
263 |
+
#ifndef MAX_MEM_LEVEL
|
264 |
+
# ifdef MAXSEG_64K
|
265 |
+
# define MAX_MEM_LEVEL 8
|
266 |
+
# else
|
267 |
+
# define MAX_MEM_LEVEL 9
|
268 |
+
# endif
|
269 |
+
#endif
|
270 |
+
|
271 |
+
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
272 |
+
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
273 |
+
* created by gzip. (Files created by minigzip can still be extracted by
|
274 |
+
* gzip.)
|
275 |
+
*/
|
276 |
+
#ifndef MAX_WBITS
|
277 |
+
# define MAX_WBITS 15 /* 32K LZ77 window */
|
278 |
+
#endif
|
279 |
+
|
280 |
+
/* The memory requirements for deflate are (in bytes):
|
281 |
+
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
282 |
+
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
283 |
+
plus a few kilobytes for small objects. For example, if you want to reduce
|
284 |
+
the default memory requirements from 256K to 128K, compile with
|
285 |
+
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
286 |
+
Of course this will generally degrade compression (there's no free lunch).
|
287 |
+
|
288 |
+
The memory requirements for inflate are (in bytes) 1 << windowBits
|
289 |
+
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
|
290 |
+
for small objects.
|
291 |
+
*/
|
292 |
+
|
293 |
+
/* Type declarations */
|
294 |
+
|
295 |
+
#ifndef OF /* function prototypes */
|
296 |
+
# ifdef STDC
|
297 |
+
# define OF(args) args
|
298 |
+
# else
|
299 |
+
# define OF(args) ()
|
300 |
+
# endif
|
301 |
+
#endif
|
302 |
+
|
303 |
+
/* The following definitions for FAR are needed only for MSDOS mixed
|
304 |
+
* model programming (small or medium model with some far allocations).
|
305 |
+
* This was tested only with MSC; for other MSDOS compilers you may have
|
306 |
+
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
307 |
+
* just define FAR to be empty.
|
308 |
+
*/
|
309 |
+
#ifdef SYS16BIT
|
310 |
+
# if defined(M_I86SM) || defined(M_I86MM)
|
311 |
+
/* MSC small or medium model */
|
312 |
+
# define SMALL_MEDIUM
|
313 |
+
# ifdef _MSC_VER
|
314 |
+
# define FAR _far
|
315 |
+
# else
|
316 |
+
# define FAR far
|
317 |
+
# endif
|
318 |
+
# endif
|
319 |
+
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
320 |
+
/* Turbo C small or medium model */
|
321 |
+
# define SMALL_MEDIUM
|
322 |
+
# ifdef __BORLANDC__
|
323 |
+
# define FAR _far
|
324 |
+
# else
|
325 |
+
# define FAR far
|
326 |
+
# endif
|
327 |
+
# endif
|
328 |
+
#endif
|
329 |
+
|
330 |
+
#if defined(WINDOWS) || defined(WIN32)
|
331 |
+
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
332 |
+
* This is not mandatory, but it offers a little performance increase.
|
333 |
+
*/
|
334 |
+
# ifdef ZLIB_DLL
|
335 |
+
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
336 |
+
# ifdef ZLIB_INTERNAL
|
337 |
+
# define ZEXTERN extern __declspec(dllexport)
|
338 |
+
# else
|
339 |
+
# define ZEXTERN extern __declspec(dllimport)
|
340 |
+
# endif
|
341 |
+
# endif
|
342 |
+
# endif /* ZLIB_DLL */
|
343 |
+
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
344 |
+
* define ZLIB_WINAPI.
|
345 |
+
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
346 |
+
*/
|
347 |
+
# ifdef ZLIB_WINAPI
|
348 |
+
# ifdef FAR
|
349 |
+
# undef FAR
|
350 |
+
# endif
|
351 |
+
# ifndef WIN32_LEAN_AND_MEAN
|
352 |
+
# define WIN32_LEAN_AND_MEAN
|
353 |
+
# endif
|
354 |
+
# include <windows.h>
|
355 |
+
/* No need for _export, use ZLIB.DEF instead. */
|
356 |
+
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
357 |
+
# define ZEXPORT WINAPI
|
358 |
+
# ifdef WIN32
|
359 |
+
# define ZEXPORTVA WINAPIV
|
360 |
+
# else
|
361 |
+
# define ZEXPORTVA FAR CDECL
|
362 |
+
# endif
|
363 |
+
# endif
|
364 |
+
#endif
|
365 |
+
|
366 |
+
#if defined (__BEOS__)
|
367 |
+
# ifdef ZLIB_DLL
|
368 |
+
# ifdef ZLIB_INTERNAL
|
369 |
+
# define ZEXPORT __declspec(dllexport)
|
370 |
+
# define ZEXPORTVA __declspec(dllexport)
|
371 |
+
# else
|
372 |
+
# define ZEXPORT __declspec(dllimport)
|
373 |
+
# define ZEXPORTVA __declspec(dllimport)
|
374 |
+
# endif
|
375 |
+
# endif
|
376 |
+
#endif
|
377 |
+
|
378 |
+
#ifndef ZEXTERN
|
379 |
+
# define ZEXTERN extern
|
380 |
+
#endif
|
381 |
+
#ifndef ZEXPORT
|
382 |
+
# define ZEXPORT
|
383 |
+
#endif
|
384 |
+
#ifndef ZEXPORTVA
|
385 |
+
# define ZEXPORTVA
|
386 |
+
#endif
|
387 |
+
|
388 |
+
#ifndef FAR
|
389 |
+
# define FAR
|
390 |
+
#endif
|
391 |
+
|
392 |
+
#if !defined(__MACTYPES__)
|
393 |
+
typedef unsigned char Byte; /* 8 bits */
|
394 |
+
#endif
|
395 |
+
typedef unsigned int uInt; /* 16 bits or more */
|
396 |
+
typedef unsigned long uLong; /* 32 bits or more */
|
397 |
+
|
398 |
+
#ifdef SMALL_MEDIUM
|
399 |
+
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
400 |
+
# define Bytef Byte FAR
|
401 |
+
#else
|
402 |
+
typedef Byte FAR Bytef;
|
403 |
+
#endif
|
404 |
+
typedef char FAR charf;
|
405 |
+
typedef int FAR intf;
|
406 |
+
typedef uInt FAR uIntf;
|
407 |
+
typedef uLong FAR uLongf;
|
408 |
+
|
409 |
+
#ifdef STDC
|
410 |
+
typedef void const *voidpc;
|
411 |
+
typedef void FAR *voidpf;
|
412 |
+
typedef void *voidp;
|
413 |
+
#else
|
414 |
+
typedef Byte const *voidpc;
|
415 |
+
typedef Byte FAR *voidpf;
|
416 |
+
typedef Byte *voidp;
|
417 |
+
#endif
|
418 |
+
|
419 |
+
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
420 |
+
# include <limits.h>
|
421 |
+
# if (UINT_MAX == 0xffffffffUL)
|
422 |
+
# define Z_U4 unsigned
|
423 |
+
# elif (ULONG_MAX == 0xffffffffUL)
|
424 |
+
# define Z_U4 unsigned long
|
425 |
+
# elif (USHRT_MAX == 0xffffffffUL)
|
426 |
+
# define Z_U4 unsigned short
|
427 |
+
# endif
|
428 |
+
#endif
|
429 |
+
|
430 |
+
#ifdef Z_U4
|
431 |
+
typedef Z_U4 z_crc_t;
|
432 |
+
#else
|
433 |
+
typedef unsigned long z_crc_t;
|
434 |
+
#endif
|
435 |
+
|
436 |
+
#if 1 /* was set to #if 1 by ./configure */
|
437 |
+
# define Z_HAVE_UNISTD_H
|
438 |
+
#endif
|
439 |
+
|
440 |
+
#if 1 /* was set to #if 1 by ./configure */
|
441 |
+
# define Z_HAVE_STDARG_H
|
442 |
+
#endif
|
443 |
+
|
444 |
+
#ifdef STDC
|
445 |
+
# ifndef Z_SOLO
|
446 |
+
# include <sys/types.h> /* for off_t */
|
447 |
+
# endif
|
448 |
+
#endif
|
449 |
+
|
450 |
+
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
451 |
+
# ifndef Z_SOLO
|
452 |
+
# include <stdarg.h> /* for va_list */
|
453 |
+
# endif
|
454 |
+
#endif
|
455 |
+
|
456 |
+
#ifdef _WIN32
|
457 |
+
# ifndef Z_SOLO
|
458 |
+
# include <stddef.h> /* for wchar_t */
|
459 |
+
# endif
|
460 |
+
#endif
|
461 |
+
|
462 |
+
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
463 |
+
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
464 |
+
* though the former does not conform to the LFS document), but considering
|
465 |
+
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
466 |
+
* equivalently requesting no 64-bit operations
|
467 |
+
*/
|
468 |
+
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
|
469 |
+
# undef _LARGEFILE64_SOURCE
|
470 |
+
#endif
|
471 |
+
|
472 |
+
#ifndef Z_HAVE_UNISTD_H
|
473 |
+
# ifdef __WATCOMC__
|
474 |
+
# define Z_HAVE_UNISTD_H
|
475 |
+
# endif
|
476 |
+
#endif
|
477 |
+
#ifndef Z_HAVE_UNISTD_H
|
478 |
+
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
|
479 |
+
# define Z_HAVE_UNISTD_H
|
480 |
+
# endif
|
481 |
+
#endif
|
482 |
+
#ifndef Z_SOLO
|
483 |
+
# if defined(Z_HAVE_UNISTD_H)
|
484 |
+
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
|
485 |
+
# ifdef VMS
|
486 |
+
# include <unixio.h> /* for off_t */
|
487 |
+
# endif
|
488 |
+
# ifndef z_off_t
|
489 |
+
# define z_off_t off_t
|
490 |
+
# endif
|
491 |
+
# endif
|
492 |
+
#endif
|
493 |
+
|
494 |
+
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
|
495 |
+
# define Z_LFS64
|
496 |
+
#endif
|
497 |
+
|
498 |
+
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
|
499 |
+
# define Z_LARGE64
|
500 |
+
#endif
|
501 |
+
|
502 |
+
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
|
503 |
+
# define Z_WANT64
|
504 |
+
#endif
|
505 |
+
|
506 |
+
#if !defined(SEEK_SET) && !defined(Z_SOLO)
|
507 |
+
# define SEEK_SET 0 /* Seek from beginning of file. */
|
508 |
+
# define SEEK_CUR 1 /* Seek from current position. */
|
509 |
+
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
510 |
+
#endif
|
511 |
+
|
512 |
+
#ifndef z_off_t
|
513 |
+
# define z_off_t long
|
514 |
+
#endif
|
515 |
+
|
516 |
+
#if !defined(_WIN32) && defined(Z_LARGE64)
|
517 |
+
# define z_off64_t off64_t
|
518 |
+
#else
|
519 |
+
# if defined(_WIN32) && !defined(__GNUC__)
|
520 |
+
# define z_off64_t __int64
|
521 |
+
# else
|
522 |
+
# define z_off64_t z_off_t
|
523 |
+
# endif
|
524 |
+
#endif
|
525 |
+
|
526 |
+
/* MVS linker does not support external names larger than 8 bytes */
|
527 |
+
#if defined(__MVS__)
|
528 |
+
#pragma map(deflateInit_,"DEIN")
|
529 |
+
#pragma map(deflateInit2_,"DEIN2")
|
530 |
+
#pragma map(deflateEnd,"DEEND")
|
531 |
+
#pragma map(deflateBound,"DEBND")
|
532 |
+
#pragma map(inflateInit_,"ININ")
|
533 |
+
#pragma map(inflateInit2_,"ININ2")
|
534 |
+
#pragma map(inflateEnd,"INEND")
|
535 |
+
#pragma map(inflateSync,"INSY")
|
536 |
+
#pragma map(inflateSetDictionary,"INSEDI")
|
537 |
+
#pragma map(compressBound,"CMBND")
|
538 |
+
#pragma map(inflate_table,"INTABL")
|
539 |
+
#pragma map(inflate_fast,"INFA")
|
540 |
+
#pragma map(inflate_copyright,"INCOPY")
|
541 |
+
#endif
|
542 |
+
|
543 |
+
#endif /* ZCONF_H */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/extlibs/zlib.h
ADDED
@@ -0,0 +1,1938 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
2 |
+
version 1.3.1, January 22nd, 2024
|
3 |
+
|
4 |
+
Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
5 |
+
|
6 |
+
This software is provided 'as-is', without any express or implied
|
7 |
+
warranty. In no event will the authors be held liable for any damages
|
8 |
+
arising from the use of this software.
|
9 |
+
|
10 |
+
Permission is granted to anyone to use this software for any purpose,
|
11 |
+
including commercial applications, and to alter it and redistribute it
|
12 |
+
freely, subject to the following restrictions:
|
13 |
+
|
14 |
+
1. The origin of this software must not be misrepresented; you must not
|
15 |
+
claim that you wrote the original software. If you use this software
|
16 |
+
in a product, an acknowledgment in the product documentation would be
|
17 |
+
appreciated but is not required.
|
18 |
+
2. Altered source versions must be plainly marked as such, and must not be
|
19 |
+
misrepresented as being the original software.
|
20 |
+
3. This notice may not be removed or altered from any source distribution.
|
21 |
+
|
22 |
+
Jean-loup Gailly Mark Adler
|
23 | |
24 |
+
|
25 |
+
|
26 |
+
The data format used by the zlib library is described by RFCs (Request for
|
27 |
+
Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
|
28 |
+
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
29 |
+
*/
|
30 |
+
|
31 |
+
#ifndef ZLIB_H
|
32 |
+
#define ZLIB_H
|
33 |
+
|
34 |
+
#include "zconf.h"
|
35 |
+
|
36 |
+
#ifdef __cplusplus
|
37 |
+
extern "C" {
|
38 |
+
#endif
|
39 |
+
|
40 |
+
#define ZLIB_VERSION "1.3.1"
|
41 |
+
#define ZLIB_VERNUM 0x1310
|
42 |
+
#define ZLIB_VER_MAJOR 1
|
43 |
+
#define ZLIB_VER_MINOR 3
|
44 |
+
#define ZLIB_VER_REVISION 1
|
45 |
+
#define ZLIB_VER_SUBREVISION 0
|
46 |
+
|
47 |
+
/*
|
48 |
+
The 'zlib' compression library provides in-memory compression and
|
49 |
+
decompression functions, including integrity checks of the uncompressed data.
|
50 |
+
This version of the library supports only one compression method (deflation)
|
51 |
+
but other algorithms will be added later and will have the same stream
|
52 |
+
interface.
|
53 |
+
|
54 |
+
Compression can be done in a single step if the buffers are large enough,
|
55 |
+
or can be done by repeated calls of the compression function. In the latter
|
56 |
+
case, the application must provide more input and/or consume the output
|
57 |
+
(providing more output space) before each call.
|
58 |
+
|
59 |
+
The compressed data format used by default by the in-memory functions is
|
60 |
+
the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
|
61 |
+
around a deflate stream, which is itself documented in RFC 1951.
|
62 |
+
|
63 |
+
The library also supports reading and writing files in gzip (.gz) format
|
64 |
+
with an interface similar to that of stdio using the functions that start
|
65 |
+
with "gz". The gzip format is different from the zlib format. gzip is a
|
66 |
+
gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
|
67 |
+
|
68 |
+
This library can optionally read and write gzip and raw deflate streams in
|
69 |
+
memory as well.
|
70 |
+
|
71 |
+
The zlib format was designed to be compact and fast for use in memory
|
72 |
+
and on communications channels. The gzip format was designed for single-
|
73 |
+
file compression on file systems, has a larger header than zlib to maintain
|
74 |
+
directory information, and uses a different, slower check method than zlib.
|
75 |
+
|
76 |
+
The library does not install any signal handler. The decoder checks
|
77 |
+
the consistency of the compressed data, so the library should never crash
|
78 |
+
even in the case of corrupted input.
|
79 |
+
*/
|
80 |
+
|
81 |
+
typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size);
|
82 |
+
typedef void (*free_func)(voidpf opaque, voidpf address);
|
83 |
+
|
84 |
+
struct internal_state;
|
85 |
+
|
86 |
+
typedef struct z_stream_s {
|
87 |
+
z_const Bytef *next_in; /* next input byte */
|
88 |
+
uInt avail_in; /* number of bytes available at next_in */
|
89 |
+
uLong total_in; /* total number of input bytes read so far */
|
90 |
+
|
91 |
+
Bytef *next_out; /* next output byte will go here */
|
92 |
+
uInt avail_out; /* remaining free space at next_out */
|
93 |
+
uLong total_out; /* total number of bytes output so far */
|
94 |
+
|
95 |
+
z_const char *msg; /* last error message, NULL if no error */
|
96 |
+
struct internal_state FAR *state; /* not visible by applications */
|
97 |
+
|
98 |
+
alloc_func zalloc; /* used to allocate the internal state */
|
99 |
+
free_func zfree; /* used to free the internal state */
|
100 |
+
voidpf opaque; /* private data object passed to zalloc and zfree */
|
101 |
+
|
102 |
+
int data_type; /* best guess about the data type: binary or text
|
103 |
+
for deflate, or the decoding state for inflate */
|
104 |
+
uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */
|
105 |
+
uLong reserved; /* reserved for future use */
|
106 |
+
} z_stream;
|
107 |
+
|
108 |
+
typedef z_stream FAR *z_streamp;
|
109 |
+
|
110 |
+
/*
|
111 |
+
gzip header information passed to and from zlib routines. See RFC 1952
|
112 |
+
for more details on the meanings of these fields.
|
113 |
+
*/
|
114 |
+
typedef struct gz_header_s {
|
115 |
+
int text; /* true if compressed data believed to be text */
|
116 |
+
uLong time; /* modification time */
|
117 |
+
int xflags; /* extra flags (not used when writing a gzip file) */
|
118 |
+
int os; /* operating system */
|
119 |
+
Bytef *extra; /* pointer to extra field or Z_NULL if none */
|
120 |
+
uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
|
121 |
+
uInt extra_max; /* space at extra (only when reading header) */
|
122 |
+
Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
|
123 |
+
uInt name_max; /* space at name (only when reading header) */
|
124 |
+
Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
|
125 |
+
uInt comm_max; /* space at comment (only when reading header) */
|
126 |
+
int hcrc; /* true if there was or will be a header crc */
|
127 |
+
int done; /* true when done reading gzip header (not used
|
128 |
+
when writing a gzip file) */
|
129 |
+
} gz_header;
|
130 |
+
|
131 |
+
typedef gz_header FAR *gz_headerp;
|
132 |
+
|
133 |
+
/*
|
134 |
+
The application must update next_in and avail_in when avail_in has dropped
|
135 |
+
to zero. It must update next_out and avail_out when avail_out has dropped
|
136 |
+
to zero. The application must initialize zalloc, zfree and opaque before
|
137 |
+
calling the init function. All other fields are set by the compression
|
138 |
+
library and must not be updated by the application.
|
139 |
+
|
140 |
+
The opaque value provided by the application will be passed as the first
|
141 |
+
parameter for calls of zalloc and zfree. This can be useful for custom
|
142 |
+
memory management. The compression library attaches no meaning to the
|
143 |
+
opaque value.
|
144 |
+
|
145 |
+
zalloc must return Z_NULL if there is not enough memory for the object.
|
146 |
+
If zlib is used in a multi-threaded application, zalloc and zfree must be
|
147 |
+
thread safe. In that case, zlib is thread-safe. When zalloc and zfree are
|
148 |
+
Z_NULL on entry to the initialization function, they are set to internal
|
149 |
+
routines that use the standard library functions malloc() and free().
|
150 |
+
|
151 |
+
On 16-bit systems, the functions zalloc and zfree must be able to allocate
|
152 |
+
exactly 65536 bytes, but will not be required to allocate more than this if
|
153 |
+
the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers
|
154 |
+
returned by zalloc for objects of exactly 65536 bytes *must* have their
|
155 |
+
offset normalized to zero. The default allocation function provided by this
|
156 |
+
library ensures this (see zutil.c). To reduce memory requirements and avoid
|
157 |
+
any allocation of 64K objects, at the expense of compression ratio, compile
|
158 |
+
the library with -DMAX_WBITS=14 (see zconf.h).
|
159 |
+
|
160 |
+
The fields total_in and total_out can be used for statistics or progress
|
161 |
+
reports. After compression, total_in holds the total size of the
|
162 |
+
uncompressed data and may be saved for use by the decompressor (particularly
|
163 |
+
if the decompressor wants to decompress everything in a single step).
|
164 |
+
*/
|
165 |
+
|
166 |
+
/* constants */
|
167 |
+
|
168 |
+
#define Z_NO_FLUSH 0
|
169 |
+
#define Z_PARTIAL_FLUSH 1
|
170 |
+
#define Z_SYNC_FLUSH 2
|
171 |
+
#define Z_FULL_FLUSH 3
|
172 |
+
#define Z_FINISH 4
|
173 |
+
#define Z_BLOCK 5
|
174 |
+
#define Z_TREES 6
|
175 |
+
/* Allowed flush values; see deflate() and inflate() below for details */
|
176 |
+
|
177 |
+
#define Z_OK 0
|
178 |
+
#define Z_STREAM_END 1
|
179 |
+
#define Z_NEED_DICT 2
|
180 |
+
#define Z_ERRNO (-1)
|
181 |
+
#define Z_STREAM_ERROR (-2)
|
182 |
+
#define Z_DATA_ERROR (-3)
|
183 |
+
#define Z_MEM_ERROR (-4)
|
184 |
+
#define Z_BUF_ERROR (-5)
|
185 |
+
#define Z_VERSION_ERROR (-6)
|
186 |
+
/* Return codes for the compression/decompression functions. Negative values
|
187 |
+
* are errors, positive values are used for special but normal events.
|
188 |
+
*/
|
189 |
+
|
190 |
+
#define Z_NO_COMPRESSION 0
|
191 |
+
#define Z_BEST_SPEED 1
|
192 |
+
#define Z_BEST_COMPRESSION 9
|
193 |
+
#define Z_DEFAULT_COMPRESSION (-1)
|
194 |
+
/* compression levels */
|
195 |
+
|
196 |
+
#define Z_FILTERED 1
|
197 |
+
#define Z_HUFFMAN_ONLY 2
|
198 |
+
#define Z_RLE 3
|
199 |
+
#define Z_FIXED 4
|
200 |
+
#define Z_DEFAULT_STRATEGY 0
|
201 |
+
/* compression strategy; see deflateInit2() below for details */
|
202 |
+
|
203 |
+
#define Z_BINARY 0
|
204 |
+
#define Z_TEXT 1
|
205 |
+
#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
|
206 |
+
#define Z_UNKNOWN 2
|
207 |
+
/* Possible values of the data_type field for deflate() */
|
208 |
+
|
209 |
+
#define Z_DEFLATED 8
|
210 |
+
/* The deflate compression method (the only one supported in this version) */
|
211 |
+
|
212 |
+
#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
|
213 |
+
|
214 |
+
#define zlib_version zlibVersion()
|
215 |
+
/* for compatibility with versions < 1.0.2 */
|
216 |
+
|
217 |
+
|
218 |
+
/* basic functions */
|
219 |
+
|
220 |
+
ZEXTERN const char * ZEXPORT zlibVersion(void);
|
221 |
+
/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
|
222 |
+
If the first character differs, the library code actually used is not
|
223 |
+
compatible with the zlib.h header file used by the application. This check
|
224 |
+
is automatically made by deflateInit and inflateInit.
|
225 |
+
*/
|
226 |
+
|
227 |
+
/*
|
228 |
+
ZEXTERN int ZEXPORT deflateInit(z_streamp strm, int level);
|
229 |
+
|
230 |
+
Initializes the internal stream state for compression. The fields
|
231 |
+
zalloc, zfree and opaque must be initialized before by the caller. If
|
232 |
+
zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
|
233 |
+
allocation functions. total_in, total_out, adler, and msg are initialized.
|
234 |
+
|
235 |
+
The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
|
236 |
+
1 gives best speed, 9 gives best compression, 0 gives no compression at all
|
237 |
+
(the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION
|
238 |
+
requests a default compromise between speed and compression (currently
|
239 |
+
equivalent to level 6).
|
240 |
+
|
241 |
+
deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
242 |
+
memory, Z_STREAM_ERROR if level is not a valid compression level, or
|
243 |
+
Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
|
244 |
+
with the version assumed by the caller (ZLIB_VERSION). msg is set to null
|
245 |
+
if there is no error message. deflateInit does not perform any compression:
|
246 |
+
this will be done by deflate().
|
247 |
+
*/
|
248 |
+
|
249 |
+
|
250 |
+
ZEXTERN int ZEXPORT deflate(z_streamp strm, int flush);
|
251 |
+
/*
|
252 |
+
deflate compresses as much data as possible, and stops when the input
|
253 |
+
buffer becomes empty or the output buffer becomes full. It may introduce
|
254 |
+
some output latency (reading input without producing any output) except when
|
255 |
+
forced to flush.
|
256 |
+
|
257 |
+
The detailed semantics are as follows. deflate performs one or both of the
|
258 |
+
following actions:
|
259 |
+
|
260 |
+
- Compress more input starting at next_in and update next_in and avail_in
|
261 |
+
accordingly. If not all input can be processed (because there is not
|
262 |
+
enough room in the output buffer), next_in and avail_in are updated and
|
263 |
+
processing will resume at this point for the next call of deflate().
|
264 |
+
|
265 |
+
- Generate more output starting at next_out and update next_out and avail_out
|
266 |
+
accordingly. This action is forced if the parameter flush is non zero.
|
267 |
+
Forcing flush frequently degrades the compression ratio, so this parameter
|
268 |
+
should be set only when necessary. Some output may be provided even if
|
269 |
+
flush is zero.
|
270 |
+
|
271 |
+
Before the call of deflate(), the application should ensure that at least
|
272 |
+
one of the actions is possible, by providing more input and/or consuming more
|
273 |
+
output, and updating avail_in or avail_out accordingly; avail_out should
|
274 |
+
never be zero before the call. The application can consume the compressed
|
275 |
+
output when it wants, for example when the output buffer is full (avail_out
|
276 |
+
== 0), or after each call of deflate(). If deflate returns Z_OK and with
|
277 |
+
zero avail_out, it must be called again after making room in the output
|
278 |
+
buffer because there might be more output pending. See deflatePending(),
|
279 |
+
which can be used if desired to determine whether or not there is more output
|
280 |
+
in that case.
|
281 |
+
|
282 |
+
Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
|
283 |
+
decide how much data to accumulate before producing output, in order to
|
284 |
+
maximize compression.
|
285 |
+
|
286 |
+
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
|
287 |
+
flushed to the output buffer and the output is aligned on a byte boundary, so
|
288 |
+
that the decompressor can get all input data available so far. (In
|
289 |
+
particular avail_in is zero after the call if enough output space has been
|
290 |
+
provided before the call.) Flushing may degrade compression for some
|
291 |
+
compression algorithms and so it should be used only when necessary. This
|
292 |
+
completes the current deflate block and follows it with an empty stored block
|
293 |
+
that is three bits plus filler bits to the next byte, followed by four bytes
|
294 |
+
(00 00 ff ff).
|
295 |
+
|
296 |
+
If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
|
297 |
+
output buffer, but the output is not aligned to a byte boundary. All of the
|
298 |
+
input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
|
299 |
+
This completes the current deflate block and follows it with an empty fixed
|
300 |
+
codes block that is 10 bits long. This assures that enough bytes are output
|
301 |
+
in order for the decompressor to finish the block before the empty fixed
|
302 |
+
codes block.
|
303 |
+
|
304 |
+
If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
|
305 |
+
for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
|
306 |
+
seven bits of the current block are held to be written as the next byte after
|
307 |
+
the next deflate block is completed. In this case, the decompressor may not
|
308 |
+
be provided enough bits at this point in order to complete decompression of
|
309 |
+
the data provided so far to the compressor. It may need to wait for the next
|
310 |
+
block to be emitted. This is for advanced applications that need to control
|
311 |
+
the emission of deflate blocks.
|
312 |
+
|
313 |
+
If flush is set to Z_FULL_FLUSH, all output is flushed as with
|
314 |
+
Z_SYNC_FLUSH, and the compression state is reset so that decompression can
|
315 |
+
restart from this point if previous compressed data has been damaged or if
|
316 |
+
random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
|
317 |
+
compression.
|
318 |
+
|
319 |
+
If deflate returns with avail_out == 0, this function must be called again
|
320 |
+
with the same value of the flush parameter and more output space (updated
|
321 |
+
avail_out), until the flush is complete (deflate returns with non-zero
|
322 |
+
avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
|
323 |
+
avail_out is greater than six when the flush marker begins, in order to avoid
|
324 |
+
repeated flush markers upon calling deflate() again when avail_out == 0.
|
325 |
+
|
326 |
+
If the parameter flush is set to Z_FINISH, pending input is processed,
|
327 |
+
pending output is flushed and deflate returns with Z_STREAM_END if there was
|
328 |
+
enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this
|
329 |
+
function must be called again with Z_FINISH and more output space (updated
|
330 |
+
avail_out) but no more input data, until it returns with Z_STREAM_END or an
|
331 |
+
error. After deflate has returned Z_STREAM_END, the only possible operations
|
332 |
+
on the stream are deflateReset or deflateEnd.
|
333 |
+
|
334 |
+
Z_FINISH can be used in the first deflate call after deflateInit if all the
|
335 |
+
compression is to be done in a single step. In order to complete in one
|
336 |
+
call, avail_out must be at least the value returned by deflateBound (see
|
337 |
+
below). Then deflate is guaranteed to return Z_STREAM_END. If not enough
|
338 |
+
output space is provided, deflate will not return Z_STREAM_END, and it must
|
339 |
+
be called again as described above.
|
340 |
+
|
341 |
+
deflate() sets strm->adler to the Adler-32 checksum of all input read
|
342 |
+
so far (that is, total_in bytes). If a gzip stream is being generated, then
|
343 |
+
strm->adler will be the CRC-32 checksum of the input read so far. (See
|
344 |
+
deflateInit2 below.)
|
345 |
+
|
346 |
+
deflate() may update strm->data_type if it can make a good guess about
|
347 |
+
the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is
|
348 |
+
considered binary. This field is only for information purposes and does not
|
349 |
+
affect the compression algorithm in any manner.
|
350 |
+
|
351 |
+
deflate() returns Z_OK if some progress has been made (more input
|
352 |
+
processed or more output produced), Z_STREAM_END if all input has been
|
353 |
+
consumed and all output has been produced (only when flush is set to
|
354 |
+
Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
|
355 |
+
if next_in or next_out was Z_NULL or the state was inadvertently written over
|
356 |
+
by the application), or Z_BUF_ERROR if no progress is possible (for example
|
357 |
+
avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and
|
358 |
+
deflate() can be called again with more input and more output space to
|
359 |
+
continue compressing.
|
360 |
+
*/
|
361 |
+
|
362 |
+
|
363 |
+
ZEXTERN int ZEXPORT deflateEnd(z_streamp strm);
|
364 |
+
/*
|
365 |
+
All dynamically allocated data structures for this stream are freed.
|
366 |
+
This function discards any unprocessed input and does not flush any pending
|
367 |
+
output.
|
368 |
+
|
369 |
+
deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
|
370 |
+
stream state was inconsistent, Z_DATA_ERROR if the stream was freed
|
371 |
+
prematurely (some input or output was discarded). In the error case, msg
|
372 |
+
may be set but then points to a static string (which must not be
|
373 |
+
deallocated).
|
374 |
+
*/
|
375 |
+
|
376 |
+
|
377 |
+
/*
|
378 |
+
ZEXTERN int ZEXPORT inflateInit(z_streamp strm);
|
379 |
+
|
380 |
+
Initializes the internal stream state for decompression. The fields
|
381 |
+
next_in, avail_in, zalloc, zfree and opaque must be initialized before by
|
382 |
+
the caller. In the current version of inflate, the provided input is not
|
383 |
+
read or consumed. The allocation of a sliding window will be deferred to
|
384 |
+
the first call of inflate (if the decompression does not complete on the
|
385 |
+
first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
|
386 |
+
them to use default allocation functions. total_in, total_out, adler, and
|
387 |
+
msg are initialized.
|
388 |
+
|
389 |
+
inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
390 |
+
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
391 |
+
version assumed by the caller, or Z_STREAM_ERROR if the parameters are
|
392 |
+
invalid, such as a null pointer to the structure. msg is set to null if
|
393 |
+
there is no error message. inflateInit does not perform any decompression.
|
394 |
+
Actual decompression will be done by inflate(). So next_in, and avail_in,
|
395 |
+
next_out, and avail_out are unused and unchanged. The current
|
396 |
+
implementation of inflateInit() does not process any header information --
|
397 |
+
that is deferred until inflate() is called.
|
398 |
+
*/
|
399 |
+
|
400 |
+
|
401 |
+
ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
|
402 |
+
/*
|
403 |
+
inflate decompresses as much data as possible, and stops when the input
|
404 |
+
buffer becomes empty or the output buffer becomes full. It may introduce
|
405 |
+
some output latency (reading input without producing any output) except when
|
406 |
+
forced to flush.
|
407 |
+
|
408 |
+
The detailed semantics are as follows. inflate performs one or both of the
|
409 |
+
following actions:
|
410 |
+
|
411 |
+
- Decompress more input starting at next_in and update next_in and avail_in
|
412 |
+
accordingly. If not all input can be processed (because there is not
|
413 |
+
enough room in the output buffer), then next_in and avail_in are updated
|
414 |
+
accordingly, and processing will resume at this point for the next call of
|
415 |
+
inflate().
|
416 |
+
|
417 |
+
- Generate more output starting at next_out and update next_out and avail_out
|
418 |
+
accordingly. inflate() provides as much output as possible, until there is
|
419 |
+
no more input data or no more space in the output buffer (see below about
|
420 |
+
the flush parameter).
|
421 |
+
|
422 |
+
Before the call of inflate(), the application should ensure that at least
|
423 |
+
one of the actions is possible, by providing more input and/or consuming more
|
424 |
+
output, and updating the next_* and avail_* values accordingly. If the
|
425 |
+
caller of inflate() does not provide both available input and available
|
426 |
+
output space, it is possible that there will be no progress made. The
|
427 |
+
application can consume the uncompressed output when it wants, for example
|
428 |
+
when the output buffer is full (avail_out == 0), or after each call of
|
429 |
+
inflate(). If inflate returns Z_OK and with zero avail_out, it must be
|
430 |
+
called again after making room in the output buffer because there might be
|
431 |
+
more output pending.
|
432 |
+
|
433 |
+
The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
|
434 |
+
Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much
|
435 |
+
output as possible to the output buffer. Z_BLOCK requests that inflate()
|
436 |
+
stop if and when it gets to the next deflate block boundary. When decoding
|
437 |
+
the zlib or gzip format, this will cause inflate() to return immediately
|
438 |
+
after the header and before the first block. When doing a raw inflate,
|
439 |
+
inflate() will go ahead and process the first block, and will return when it
|
440 |
+
gets to the end of that block, or when it runs out of data.
|
441 |
+
|
442 |
+
The Z_BLOCK option assists in appending to or combining deflate streams.
|
443 |
+
To assist in this, on return inflate() always sets strm->data_type to the
|
444 |
+
number of unused bits in the last byte taken from strm->next_in, plus 64 if
|
445 |
+
inflate() is currently decoding the last block in the deflate stream, plus
|
446 |
+
128 if inflate() returned immediately after decoding an end-of-block code or
|
447 |
+
decoding the complete header up to just before the first byte of the deflate
|
448 |
+
stream. The end-of-block will not be indicated until all of the uncompressed
|
449 |
+
data from that block has been written to strm->next_out. The number of
|
450 |
+
unused bits may in general be greater than seven, except when bit 7 of
|
451 |
+
data_type is set, in which case the number of unused bits will be less than
|
452 |
+
eight. data_type is set as noted here every time inflate() returns for all
|
453 |
+
flush options, and so can be used to determine the amount of currently
|
454 |
+
consumed input in bits.
|
455 |
+
|
456 |
+
The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
|
457 |
+
end of each deflate block header is reached, before any actual data in that
|
458 |
+
block is decoded. This allows the caller to determine the length of the
|
459 |
+
deflate block header for later use in random access within a deflate block.
|
460 |
+
256 is added to the value of strm->data_type when inflate() returns
|
461 |
+
immediately after reaching the end of the deflate block header.
|
462 |
+
|
463 |
+
inflate() should normally be called until it returns Z_STREAM_END or an
|
464 |
+
error. However if all decompression is to be performed in a single step (a
|
465 |
+
single call of inflate), the parameter flush should be set to Z_FINISH. In
|
466 |
+
this case all pending input is processed and all pending output is flushed;
|
467 |
+
avail_out must be large enough to hold all of the uncompressed data for the
|
468 |
+
operation to complete. (The size of the uncompressed data may have been
|
469 |
+
saved by the compressor for this purpose.) The use of Z_FINISH is not
|
470 |
+
required to perform an inflation in one step. However it may be used to
|
471 |
+
inform inflate that a faster approach can be used for the single inflate()
|
472 |
+
call. Z_FINISH also informs inflate to not maintain a sliding window if the
|
473 |
+
stream completes, which reduces inflate's memory footprint. If the stream
|
474 |
+
does not complete, either because not all of the stream is provided or not
|
475 |
+
enough output space is provided, then a sliding window will be allocated and
|
476 |
+
inflate() can be called again to continue the operation as if Z_NO_FLUSH had
|
477 |
+
been used.
|
478 |
+
|
479 |
+
In this implementation, inflate() always flushes as much output as
|
480 |
+
possible to the output buffer, and always uses the faster approach on the
|
481 |
+
first call. So the effects of the flush parameter in this implementation are
|
482 |
+
on the return value of inflate() as noted below, when inflate() returns early
|
483 |
+
when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
|
484 |
+
memory for a sliding window when Z_FINISH is used.
|
485 |
+
|
486 |
+
If a preset dictionary is needed after this call (see inflateSetDictionary
|
487 |
+
below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
|
488 |
+
chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
|
489 |
+
strm->adler to the Adler-32 checksum of all output produced so far (that is,
|
490 |
+
total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
|
491 |
+
below. At the end of the stream, inflate() checks that its computed Adler-32
|
492 |
+
checksum is equal to that saved by the compressor and returns Z_STREAM_END
|
493 |
+
only if the checksum is correct.
|
494 |
+
|
495 |
+
inflate() can decompress and check either zlib-wrapped or gzip-wrapped
|
496 |
+
deflate data. The header type is detected automatically, if requested when
|
497 |
+
initializing with inflateInit2(). Any information contained in the gzip
|
498 |
+
header is not retained unless inflateGetHeader() is used. When processing
|
499 |
+
gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
|
500 |
+
produced so far. The CRC-32 is checked against the gzip trailer, as is the
|
501 |
+
uncompressed length, modulo 2^32.
|
502 |
+
|
503 |
+
inflate() returns Z_OK if some progress has been made (more input processed
|
504 |
+
or more output produced), Z_STREAM_END if the end of the compressed data has
|
505 |
+
been reached and all uncompressed output has been produced, Z_NEED_DICT if a
|
506 |
+
preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
|
507 |
+
corrupted (input stream not conforming to the zlib format or incorrect check
|
508 |
+
value, in which case strm->msg points to a string with a more specific
|
509 |
+
error), Z_STREAM_ERROR if the stream structure was inconsistent (for example
|
510 |
+
next_in or next_out was Z_NULL, or the state was inadvertently written over
|
511 |
+
by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR
|
512 |
+
if no progress was possible or if there was not enough room in the output
|
513 |
+
buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
|
514 |
+
inflate() can be called again with more input and more output space to
|
515 |
+
continue decompressing. If Z_DATA_ERROR is returned, the application may
|
516 |
+
then call inflateSync() to look for a good compression block if a partial
|
517 |
+
recovery of the data is to be attempted.
|
518 |
+
*/
|
519 |
+
|
520 |
+
|
521 |
+
ZEXTERN int ZEXPORT inflateEnd(z_streamp strm);
|
522 |
+
/*
|
523 |
+
All dynamically allocated data structures for this stream are freed.
|
524 |
+
This function discards any unprocessed input and does not flush any pending
|
525 |
+
output.
|
526 |
+
|
527 |
+
inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state
|
528 |
+
was inconsistent.
|
529 |
+
*/
|
530 |
+
|
531 |
+
|
532 |
+
/* Advanced functions */
|
533 |
+
|
534 |
+
/*
|
535 |
+
The following functions are needed only in some special applications.
|
536 |
+
*/
|
537 |
+
|
538 |
+
/*
|
539 |
+
ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
|
540 |
+
int level,
|
541 |
+
int method,
|
542 |
+
int windowBits,
|
543 |
+
int memLevel,
|
544 |
+
int strategy);
|
545 |
+
|
546 |
+
This is another version of deflateInit with more compression options. The
|
547 |
+
fields zalloc, zfree and opaque must be initialized before by the caller.
|
548 |
+
|
549 |
+
The method parameter is the compression method. It must be Z_DEFLATED in
|
550 |
+
this version of the library.
|
551 |
+
|
552 |
+
The windowBits parameter is the base two logarithm of the window size
|
553 |
+
(the size of the history buffer). It should be in the range 8..15 for this
|
554 |
+
version of the library. Larger values of this parameter result in better
|
555 |
+
compression at the expense of memory usage. The default value is 15 if
|
556 |
+
deflateInit is used instead.
|
557 |
+
|
558 |
+
For the current implementation of deflate(), a windowBits value of 8 (a
|
559 |
+
window size of 256 bytes) is not supported. As a result, a request for 8
|
560 |
+
will result in 9 (a 512-byte window). In that case, providing 8 to
|
561 |
+
inflateInit2() will result in an error when the zlib header with 9 is
|
562 |
+
checked against the initialization of inflate(). The remedy is to not use 8
|
563 |
+
with deflateInit2() with this initialization, or at least in that case use 9
|
564 |
+
with inflateInit2().
|
565 |
+
|
566 |
+
windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
|
567 |
+
determines the window size. deflate() will then generate raw deflate data
|
568 |
+
with no zlib header or trailer, and will not compute a check value.
|
569 |
+
|
570 |
+
windowBits can also be greater than 15 for optional gzip encoding. Add
|
571 |
+
16 to windowBits to write a simple gzip header and trailer around the
|
572 |
+
compressed data instead of a zlib wrapper. The gzip header will have no
|
573 |
+
file name, no extra data, no comment, no modification time (set to zero), no
|
574 |
+
header crc, and the operating system will be set to the appropriate value,
|
575 |
+
if the operating system was determined at compile time. If a gzip stream is
|
576 |
+
being written, strm->adler is a CRC-32 instead of an Adler-32.
|
577 |
+
|
578 |
+
For raw deflate or gzip encoding, a request for a 256-byte window is
|
579 |
+
rejected as invalid, since only the zlib header provides a means of
|
580 |
+
transmitting the window size to the decompressor.
|
581 |
+
|
582 |
+
The memLevel parameter specifies how much memory should be allocated
|
583 |
+
for the internal compression state. memLevel=1 uses minimum memory but is
|
584 |
+
slow and reduces compression ratio; memLevel=9 uses maximum memory for
|
585 |
+
optimal speed. The default value is 8. See zconf.h for total memory usage
|
586 |
+
as a function of windowBits and memLevel.
|
587 |
+
|
588 |
+
The strategy parameter is used to tune the compression algorithm. Use the
|
589 |
+
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
|
590 |
+
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
|
591 |
+
string match), or Z_RLE to limit match distances to one (run-length
|
592 |
+
encoding). Filtered data consists mostly of small values with a somewhat
|
593 |
+
random distribution. In this case, the compression algorithm is tuned to
|
594 |
+
compress them better. The effect of Z_FILTERED is to force more Huffman
|
595 |
+
coding and less string matching; it is somewhat intermediate between
|
596 |
+
Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
|
597 |
+
fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
|
598 |
+
strategy parameter only affects the compression ratio but not the
|
599 |
+
correctness of the compressed output even if it is not set appropriately.
|
600 |
+
Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
|
601 |
+
decoder for special applications.
|
602 |
+
|
603 |
+
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
604 |
+
memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
|
605 |
+
method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
|
606 |
+
incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
|
607 |
+
set to null if there is no error message. deflateInit2 does not perform any
|
608 |
+
compression: this will be done by deflate().
|
609 |
+
*/
|
610 |
+
|
611 |
+
ZEXTERN int ZEXPORT deflateSetDictionary(z_streamp strm,
|
612 |
+
const Bytef *dictionary,
|
613 |
+
uInt dictLength);
|
614 |
+
/*
|
615 |
+
Initializes the compression dictionary from the given byte sequence
|
616 |
+
without producing any compressed output. When using the zlib format, this
|
617 |
+
function must be called immediately after deflateInit, deflateInit2 or
|
618 |
+
deflateReset, and before any call of deflate. When doing raw deflate, this
|
619 |
+
function must be called either before any call of deflate, or immediately
|
620 |
+
after the completion of a deflate block, i.e. after all input has been
|
621 |
+
consumed and all output has been delivered when using any of the flush
|
622 |
+
options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
|
623 |
+
compressor and decompressor must use exactly the same dictionary (see
|
624 |
+
inflateSetDictionary).
|
625 |
+
|
626 |
+
The dictionary should consist of strings (byte sequences) that are likely
|
627 |
+
to be encountered later in the data to be compressed, with the most commonly
|
628 |
+
used strings preferably put towards the end of the dictionary. Using a
|
629 |
+
dictionary is most useful when the data to be compressed is short and can be
|
630 |
+
predicted with good accuracy; the data can then be compressed better than
|
631 |
+
with the default empty dictionary.
|
632 |
+
|
633 |
+
Depending on the size of the compression data structures selected by
|
634 |
+
deflateInit or deflateInit2, a part of the dictionary may in effect be
|
635 |
+
discarded, for example if the dictionary is larger than the window size
|
636 |
+
provided in deflateInit or deflateInit2. Thus the strings most likely to be
|
637 |
+
useful should be put at the end of the dictionary, not at the front. In
|
638 |
+
addition, the current implementation of deflate will use at most the window
|
639 |
+
size minus 262 bytes of the provided dictionary.
|
640 |
+
|
641 |
+
Upon return of this function, strm->adler is set to the Adler-32 value
|
642 |
+
of the dictionary; the decompressor may later use this value to determine
|
643 |
+
which dictionary has been used by the compressor. (The Adler-32 value
|
644 |
+
applies to the whole dictionary even if only a subset of the dictionary is
|
645 |
+
actually used by the compressor.) If a raw deflate was requested, then the
|
646 |
+
Adler-32 value is not computed and strm->adler is not set.
|
647 |
+
|
648 |
+
deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
|
649 |
+
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
|
650 |
+
inconsistent (for example if deflate has already been called for this stream
|
651 |
+
or if not at a block boundary for raw deflate). deflateSetDictionary does
|
652 |
+
not perform any compression: this will be done by deflate().
|
653 |
+
*/
|
654 |
+
|
655 |
+
ZEXTERN int ZEXPORT deflateGetDictionary(z_streamp strm,
|
656 |
+
Bytef *dictionary,
|
657 |
+
uInt *dictLength);
|
658 |
+
/*
|
659 |
+
Returns the sliding dictionary being maintained by deflate. dictLength is
|
660 |
+
set to the number of bytes in the dictionary, and that many bytes are copied
|
661 |
+
to dictionary. dictionary must have enough space, where 32768 bytes is
|
662 |
+
always enough. If deflateGetDictionary() is called with dictionary equal to
|
663 |
+
Z_NULL, then only the dictionary length is returned, and nothing is copied.
|
664 |
+
Similarly, if dictLength is Z_NULL, then it is not set.
|
665 |
+
|
666 |
+
deflateGetDictionary() may return a length less than the window size, even
|
667 |
+
when more than the window size in input has been provided. It may return up
|
668 |
+
to 258 bytes less in that case, due to how zlib's implementation of deflate
|
669 |
+
manages the sliding window and lookahead for matches, where matches can be
|
670 |
+
up to 258 bytes long. If the application needs the last window-size bytes of
|
671 |
+
input, then that would need to be saved by the application outside of zlib.
|
672 |
+
|
673 |
+
deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
|
674 |
+
stream state is inconsistent.
|
675 |
+
*/
|
676 |
+
|
677 |
+
ZEXTERN int ZEXPORT deflateCopy(z_streamp dest,
|
678 |
+
z_streamp source);
|
679 |
+
/*
|
680 |
+
Sets the destination stream as a complete copy of the source stream.
|
681 |
+
|
682 |
+
This function can be useful when several compression strategies will be
|
683 |
+
tried, for example when there are several ways of pre-processing the input
|
684 |
+
data with a filter. The streams that will be discarded should then be freed
|
685 |
+
by calling deflateEnd. Note that deflateCopy duplicates the internal
|
686 |
+
compression state which can be quite large, so this strategy is slow and can
|
687 |
+
consume lots of memory.
|
688 |
+
|
689 |
+
deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
|
690 |
+
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
|
691 |
+
(such as zalloc being Z_NULL). msg is left unchanged in both source and
|
692 |
+
destination.
|
693 |
+
*/
|
694 |
+
|
695 |
+
ZEXTERN int ZEXPORT deflateReset(z_streamp strm);
|
696 |
+
/*
|
697 |
+
This function is equivalent to deflateEnd followed by deflateInit, but
|
698 |
+
does not free and reallocate the internal compression state. The stream
|
699 |
+
will leave the compression level and any other attributes that may have been
|
700 |
+
set unchanged. total_in, total_out, adler, and msg are initialized.
|
701 |
+
|
702 |
+
deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
703 |
+
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
704 |
+
*/
|
705 |
+
|
706 |
+
ZEXTERN int ZEXPORT deflateParams(z_streamp strm,
|
707 |
+
int level,
|
708 |
+
int strategy);
|
709 |
+
/*
|
710 |
+
Dynamically update the compression level and compression strategy. The
|
711 |
+
interpretation of level and strategy is as in deflateInit2(). This can be
|
712 |
+
used to switch between compression and straight copy of the input data, or
|
713 |
+
to switch to a different kind of input data requiring a different strategy.
|
714 |
+
If the compression approach (which is a function of the level) or the
|
715 |
+
strategy is changed, and if there have been any deflate() calls since the
|
716 |
+
state was initialized or reset, then the input available so far is
|
717 |
+
compressed with the old level and strategy using deflate(strm, Z_BLOCK).
|
718 |
+
There are three approaches for the compression levels 0, 1..3, and 4..9
|
719 |
+
respectively. The new level and strategy will take effect at the next call
|
720 |
+
of deflate().
|
721 |
+
|
722 |
+
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
|
723 |
+
not have enough output space to complete, then the parameter change will not
|
724 |
+
take effect. In this case, deflateParams() can be called again with the
|
725 |
+
same parameters and more output space to try again.
|
726 |
+
|
727 |
+
In order to assure a change in the parameters on the first try, the
|
728 |
+
deflate stream should be flushed using deflate() with Z_BLOCK or other flush
|
729 |
+
request until strm.avail_out is not zero, before calling deflateParams().
|
730 |
+
Then no more input data should be provided before the deflateParams() call.
|
731 |
+
If this is done, the old level and strategy will be applied to the data
|
732 |
+
compressed before deflateParams(), and the new level and strategy will be
|
733 |
+
applied to the data compressed after deflateParams().
|
734 |
+
|
735 |
+
deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
|
736 |
+
state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
|
737 |
+
there was not enough output space to complete the compression of the
|
738 |
+
available input data before a change in the strategy or approach. Note that
|
739 |
+
in the case of a Z_BUF_ERROR, the parameters are not changed. A return
|
740 |
+
value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
|
741 |
+
retried with more output space.
|
742 |
+
*/
|
743 |
+
|
744 |
+
ZEXTERN int ZEXPORT deflateTune(z_streamp strm,
|
745 |
+
int good_length,
|
746 |
+
int max_lazy,
|
747 |
+
int nice_length,
|
748 |
+
int max_chain);
|
749 |
+
/*
|
750 |
+
Fine tune deflate's internal compression parameters. This should only be
|
751 |
+
used by someone who understands the algorithm used by zlib's deflate for
|
752 |
+
searching for the best matching string, and even then only by the most
|
753 |
+
fanatic optimizer trying to squeeze out the last compressed bit for their
|
754 |
+
specific input data. Read the deflate.c source code for the meaning of the
|
755 |
+
max_lazy, good_length, nice_length, and max_chain parameters.
|
756 |
+
|
757 |
+
deflateTune() can be called after deflateInit() or deflateInit2(), and
|
758 |
+
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
|
759 |
+
*/
|
760 |
+
|
761 |
+
ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
|
762 |
+
uLong sourceLen);
|
763 |
+
/*
|
764 |
+
deflateBound() returns an upper bound on the compressed size after
|
765 |
+
deflation of sourceLen bytes. It must be called after deflateInit() or
|
766 |
+
deflateInit2(), and after deflateSetHeader(), if used. This would be used
|
767 |
+
to allocate an output buffer for deflation in a single pass, and so would be
|
768 |
+
called before deflate(). If that first deflate() call is provided the
|
769 |
+
sourceLen input bytes, an output buffer allocated to the size returned by
|
770 |
+
deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
|
771 |
+
to return Z_STREAM_END. Note that it is possible for the compressed size to
|
772 |
+
be larger than the value returned by deflateBound() if flush options other
|
773 |
+
than Z_FINISH or Z_NO_FLUSH are used.
|
774 |
+
*/
|
775 |
+
|
776 |
+
ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
|
777 |
+
unsigned *pending,
|
778 |
+
int *bits);
|
779 |
+
/*
|
780 |
+
deflatePending() returns the number of bytes and bits of output that have
|
781 |
+
been generated, but not yet provided in the available output. The bytes not
|
782 |
+
provided would be due to the available output space having being consumed.
|
783 |
+
The number of bits of output not provided are between 0 and 7, where they
|
784 |
+
await more bits to join them in order to fill out a full byte. If pending
|
785 |
+
or bits are Z_NULL, then those values are not set.
|
786 |
+
|
787 |
+
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
|
788 |
+
stream state was inconsistent.
|
789 |
+
*/
|
790 |
+
|
791 |
+
ZEXTERN int ZEXPORT deflatePrime(z_streamp strm,
|
792 |
+
int bits,
|
793 |
+
int value);
|
794 |
+
/*
|
795 |
+
deflatePrime() inserts bits in the deflate output stream. The intent
|
796 |
+
is that this function is used to start off the deflate output with the bits
|
797 |
+
leftover from a previous deflate stream when appending to it. As such, this
|
798 |
+
function can only be used for raw deflate, and must be used before the first
|
799 |
+
deflate() call after a deflateInit2() or deflateReset(). bits must be less
|
800 |
+
than or equal to 16, and that many of the least significant bits of value
|
801 |
+
will be inserted in the output.
|
802 |
+
|
803 |
+
deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
|
804 |
+
room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
|
805 |
+
source stream state was inconsistent.
|
806 |
+
*/
|
807 |
+
|
808 |
+
ZEXTERN int ZEXPORT deflateSetHeader(z_streamp strm,
|
809 |
+
gz_headerp head);
|
810 |
+
/*
|
811 |
+
deflateSetHeader() provides gzip header information for when a gzip
|
812 |
+
stream is requested by deflateInit2(). deflateSetHeader() may be called
|
813 |
+
after deflateInit2() or deflateReset() and before the first call of
|
814 |
+
deflate(). The text, time, os, extra field, name, and comment information
|
815 |
+
in the provided gz_header structure are written to the gzip header (xflag is
|
816 |
+
ignored -- the extra flags are set according to the compression level). The
|
817 |
+
caller must assure that, if not Z_NULL, name and comment are terminated with
|
818 |
+
a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
|
819 |
+
available there. If hcrc is true, a gzip header crc is included. Note that
|
820 |
+
the current versions of the command-line version of gzip (up through version
|
821 |
+
1.3.x) do not support header crc's, and will report that it is a "multi-part
|
822 |
+
gzip file" and give up.
|
823 |
+
|
824 |
+
If deflateSetHeader is not used, the default gzip header has text false,
|
825 |
+
the time set to zero, and os set to the current operating system, with no
|
826 |
+
extra, name, or comment fields. The gzip header is returned to the default
|
827 |
+
state by deflateReset().
|
828 |
+
|
829 |
+
deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
830 |
+
stream state was inconsistent.
|
831 |
+
*/
|
832 |
+
|
833 |
+
/*
|
834 |
+
ZEXTERN int ZEXPORT inflateInit2(z_streamp strm,
|
835 |
+
int windowBits);
|
836 |
+
|
837 |
+
This is another version of inflateInit with an extra parameter. The
|
838 |
+
fields next_in, avail_in, zalloc, zfree and opaque must be initialized
|
839 |
+
before by the caller.
|
840 |
+
|
841 |
+
The windowBits parameter is the base two logarithm of the maximum window
|
842 |
+
size (the size of the history buffer). It should be in the range 8..15 for
|
843 |
+
this version of the library. The default value is 15 if inflateInit is used
|
844 |
+
instead. windowBits must be greater than or equal to the windowBits value
|
845 |
+
provided to deflateInit2() while compressing, or it must be equal to 15 if
|
846 |
+
deflateInit2() was not used. If a compressed stream with a larger window
|
847 |
+
size is given as input, inflate() will return with the error code
|
848 |
+
Z_DATA_ERROR instead of trying to allocate a larger window.
|
849 |
+
|
850 |
+
windowBits can also be zero to request that inflate use the window size in
|
851 |
+
the zlib header of the compressed stream.
|
852 |
+
|
853 |
+
windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
|
854 |
+
determines the window size. inflate() will then process raw deflate data,
|
855 |
+
not looking for a zlib or gzip header, not generating a check value, and not
|
856 |
+
looking for any check values for comparison at the end of the stream. This
|
857 |
+
is for use with other formats that use the deflate compressed data format
|
858 |
+
such as zip. Those formats provide their own check values. If a custom
|
859 |
+
format is developed using the raw deflate format for compressed data, it is
|
860 |
+
recommended that a check value such as an Adler-32 or a CRC-32 be applied to
|
861 |
+
the uncompressed data as is done in the zlib, gzip, and zip formats. For
|
862 |
+
most applications, the zlib format should be used as is. Note that comments
|
863 |
+
above on the use in deflateInit2() applies to the magnitude of windowBits.
|
864 |
+
|
865 |
+
windowBits can also be greater than 15 for optional gzip decoding. Add
|
866 |
+
32 to windowBits to enable zlib and gzip decoding with automatic header
|
867 |
+
detection, or add 16 to decode only the gzip format (the zlib format will
|
868 |
+
return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
|
869 |
+
CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
|
870 |
+
below), inflate() will *not* automatically decode concatenated gzip members.
|
871 |
+
inflate() will return Z_STREAM_END at the end of the gzip member. The state
|
872 |
+
would need to be reset to continue decoding a subsequent gzip member. This
|
873 |
+
*must* be done if there is more data after a gzip member, in order for the
|
874 |
+
decompression to be compliant with the gzip standard (RFC 1952).
|
875 |
+
|
876 |
+
inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
877 |
+
memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
|
878 |
+
version assumed by the caller, or Z_STREAM_ERROR if the parameters are
|
879 |
+
invalid, such as a null pointer to the structure. msg is set to null if
|
880 |
+
there is no error message. inflateInit2 does not perform any decompression
|
881 |
+
apart from possibly reading the zlib header if present: actual decompression
|
882 |
+
will be done by inflate(). (So next_in and avail_in may be modified, but
|
883 |
+
next_out and avail_out are unused and unchanged.) The current implementation
|
884 |
+
of inflateInit2() does not process any header information -- that is
|
885 |
+
deferred until inflate() is called.
|
886 |
+
*/
|
887 |
+
|
888 |
+
ZEXTERN int ZEXPORT inflateSetDictionary(z_streamp strm,
|
889 |
+
const Bytef *dictionary,
|
890 |
+
uInt dictLength);
|
891 |
+
/*
|
892 |
+
Initializes the decompression dictionary from the given uncompressed byte
|
893 |
+
sequence. This function must be called immediately after a call of inflate,
|
894 |
+
if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
|
895 |
+
can be determined from the Adler-32 value returned by that call of inflate.
|
896 |
+
The compressor and decompressor must use exactly the same dictionary (see
|
897 |
+
deflateSetDictionary). For raw inflate, this function can be called at any
|
898 |
+
time to set the dictionary. If the provided dictionary is smaller than the
|
899 |
+
window and there is already data in the window, then the provided dictionary
|
900 |
+
will amend what's there. The application must insure that the dictionary
|
901 |
+
that was used for compression is provided.
|
902 |
+
|
903 |
+
inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
|
904 |
+
parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
|
905 |
+
inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
|
906 |
+
expected one (incorrect Adler-32 value). inflateSetDictionary does not
|
907 |
+
perform any decompression: this will be done by subsequent calls of
|
908 |
+
inflate().
|
909 |
+
*/
|
910 |
+
|
911 |
+
ZEXTERN int ZEXPORT inflateGetDictionary(z_streamp strm,
|
912 |
+
Bytef *dictionary,
|
913 |
+
uInt *dictLength);
|
914 |
+
/*
|
915 |
+
Returns the sliding dictionary being maintained by inflate. dictLength is
|
916 |
+
set to the number of bytes in the dictionary, and that many bytes are copied
|
917 |
+
to dictionary. dictionary must have enough space, where 32768 bytes is
|
918 |
+
always enough. If inflateGetDictionary() is called with dictionary equal to
|
919 |
+
Z_NULL, then only the dictionary length is returned, and nothing is copied.
|
920 |
+
Similarly, if dictLength is Z_NULL, then it is not set.
|
921 |
+
|
922 |
+
inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
|
923 |
+
stream state is inconsistent.
|
924 |
+
*/
|
925 |
+
|
926 |
+
ZEXTERN int ZEXPORT inflateSync(z_streamp strm);
|
927 |
+
/*
|
928 |
+
Skips invalid compressed data until a possible full flush point (see above
|
929 |
+
for the description of deflate with Z_FULL_FLUSH) can be found, or until all
|
930 |
+
available input is skipped. No output is provided.
|
931 |
+
|
932 |
+
inflateSync searches for a 00 00 FF FF pattern in the compressed data.
|
933 |
+
All full flush points have this pattern, but not all occurrences of this
|
934 |
+
pattern are full flush points.
|
935 |
+
|
936 |
+
inflateSync returns Z_OK if a possible full flush point has been found,
|
937 |
+
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
|
938 |
+
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
|
939 |
+
In the success case, the application may save the current value of total_in
|
940 |
+
which indicates where valid compressed data was found. In the error case,
|
941 |
+
the application may repeatedly call inflateSync, providing more input each
|
942 |
+
time, until success or end of the input data.
|
943 |
+
*/
|
944 |
+
|
945 |
+
ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
|
946 |
+
z_streamp source);
|
947 |
+
/*
|
948 |
+
Sets the destination stream as a complete copy of the source stream.
|
949 |
+
|
950 |
+
This function can be useful when randomly accessing a large stream. The
|
951 |
+
first pass through the stream can periodically record the inflate state,
|
952 |
+
allowing restarting inflate at those points when randomly accessing the
|
953 |
+
stream.
|
954 |
+
|
955 |
+
inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
|
956 |
+
enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
|
957 |
+
(such as zalloc being Z_NULL). msg is left unchanged in both source and
|
958 |
+
destination.
|
959 |
+
*/
|
960 |
+
|
961 |
+
ZEXTERN int ZEXPORT inflateReset(z_streamp strm);
|
962 |
+
/*
|
963 |
+
This function is equivalent to inflateEnd followed by inflateInit,
|
964 |
+
but does not free and reallocate the internal decompression state. The
|
965 |
+
stream will keep attributes that may have been set by inflateInit2.
|
966 |
+
total_in, total_out, adler, and msg are initialized.
|
967 |
+
|
968 |
+
inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
|
969 |
+
stream state was inconsistent (such as zalloc or state being Z_NULL).
|
970 |
+
*/
|
971 |
+
|
972 |
+
ZEXTERN int ZEXPORT inflateReset2(z_streamp strm,
|
973 |
+
int windowBits);
|
974 |
+
/*
|
975 |
+
This function is the same as inflateReset, but it also permits changing
|
976 |
+
the wrap and window size requests. The windowBits parameter is interpreted
|
977 |
+
the same as it is for inflateInit2. If the window size is changed, then the
|
978 |
+
memory allocated for the window is freed, and the window will be reallocated
|
979 |
+
by inflate() if needed.
|
980 |
+
|
981 |
+
inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
|
982 |
+
stream state was inconsistent (such as zalloc or state being Z_NULL), or if
|
983 |
+
the windowBits parameter is invalid.
|
984 |
+
*/
|
985 |
+
|
986 |
+
ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
|
987 |
+
int bits,
|
988 |
+
int value);
|
989 |
+
/*
|
990 |
+
This function inserts bits in the inflate input stream. The intent is
|
991 |
+
that this function is used to start inflating at a bit position in the
|
992 |
+
middle of a byte. The provided bits will be used before any bytes are used
|
993 |
+
from next_in. This function should only be used with raw inflate, and
|
994 |
+
should be used before the first inflate() call after inflateInit2() or
|
995 |
+
inflateReset(). bits must be less than or equal to 16, and that many of the
|
996 |
+
least significant bits of value will be inserted in the input.
|
997 |
+
|
998 |
+
If bits is negative, then the input stream bit buffer is emptied. Then
|
999 |
+
inflatePrime() can be called again to put bits in the buffer. This is used
|
1000 |
+
to clear out bits leftover after feeding inflate a block description prior
|
1001 |
+
to feeding inflate codes.
|
1002 |
+
|
1003 |
+
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
|
1004 |
+
stream state was inconsistent.
|
1005 |
+
*/
|
1006 |
+
|
1007 |
+
ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
|
1008 |
+
/*
|
1009 |
+
This function returns two values, one in the lower 16 bits of the return
|
1010 |
+
value, and the other in the remaining upper bits, obtained by shifting the
|
1011 |
+
return value down 16 bits. If the upper value is -1 and the lower value is
|
1012 |
+
zero, then inflate() is currently decoding information outside of a block.
|
1013 |
+
If the upper value is -1 and the lower value is non-zero, then inflate is in
|
1014 |
+
the middle of a stored block, with the lower value equaling the number of
|
1015 |
+
bytes from the input remaining to copy. If the upper value is not -1, then
|
1016 |
+
it is the number of bits back from the current bit position in the input of
|
1017 |
+
the code (literal or length/distance pair) currently being processed. In
|
1018 |
+
that case the lower value is the number of bytes already emitted for that
|
1019 |
+
code.
|
1020 |
+
|
1021 |
+
A code is being processed if inflate is waiting for more input to complete
|
1022 |
+
decoding of the code, or if it has completed decoding but is waiting for
|
1023 |
+
more output space to write the literal or match data.
|
1024 |
+
|
1025 |
+
inflateMark() is used to mark locations in the input data for random
|
1026 |
+
access, which may be at bit positions, and to note those cases where the
|
1027 |
+
output of a code may span boundaries of random access blocks. The current
|
1028 |
+
location in the input stream can be determined from avail_in and data_type
|
1029 |
+
as noted in the description for the Z_BLOCK flush parameter for inflate.
|
1030 |
+
|
1031 |
+
inflateMark returns the value noted above, or -65536 if the provided
|
1032 |
+
source stream state was inconsistent.
|
1033 |
+
*/
|
1034 |
+
|
1035 |
+
ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm,
|
1036 |
+
gz_headerp head);
|
1037 |
+
/*
|
1038 |
+
inflateGetHeader() requests that gzip header information be stored in the
|
1039 |
+
provided gz_header structure. inflateGetHeader() may be called after
|
1040 |
+
inflateInit2() or inflateReset(), and before the first call of inflate().
|
1041 |
+
As inflate() processes the gzip stream, head->done is zero until the header
|
1042 |
+
is completed, at which time head->done is set to one. If a zlib stream is
|
1043 |
+
being decoded, then head->done is set to -1 to indicate that there will be
|
1044 |
+
no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be
|
1045 |
+
used to force inflate() to return immediately after header processing is
|
1046 |
+
complete and before any actual data is decompressed.
|
1047 |
+
|
1048 |
+
The text, time, xflags, and os fields are filled in with the gzip header
|
1049 |
+
contents. hcrc is set to true if there is a header CRC. (The header CRC
|
1050 |
+
was valid if done is set to one.) If extra is not Z_NULL, then extra_max
|
1051 |
+
contains the maximum number of bytes to write to extra. Once done is true,
|
1052 |
+
extra_len contains the actual extra field length, and extra contains the
|
1053 |
+
extra field, or that field truncated if extra_max is less than extra_len.
|
1054 |
+
If name is not Z_NULL, then up to name_max characters are written there,
|
1055 |
+
terminated with a zero unless the length is greater than name_max. If
|
1056 |
+
comment is not Z_NULL, then up to comm_max characters are written there,
|
1057 |
+
terminated with a zero unless the length is greater than comm_max. When any
|
1058 |
+
of extra, name, or comment are not Z_NULL and the respective field is not
|
1059 |
+
present in the header, then that field is set to Z_NULL to signal its
|
1060 |
+
absence. This allows the use of deflateSetHeader() with the returned
|
1061 |
+
structure to duplicate the header. However if those fields are set to
|
1062 |
+
allocated memory, then the application will need to save those pointers
|
1063 |
+
elsewhere so that they can be eventually freed.
|
1064 |
+
|
1065 |
+
If inflateGetHeader is not used, then the header information is simply
|
1066 |
+
discarded. The header is always checked for validity, including the header
|
1067 |
+
CRC if present. inflateReset() will reset the process to discard the header
|
1068 |
+
information. The application would need to call inflateGetHeader() again to
|
1069 |
+
retrieve the header from the next gzip stream.
|
1070 |
+
|
1071 |
+
inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
|
1072 |
+
stream state was inconsistent.
|
1073 |
+
*/
|
1074 |
+
|
1075 |
+
/*
|
1076 |
+
ZEXTERN int ZEXPORT inflateBackInit(z_streamp strm, int windowBits,
|
1077 |
+
unsigned char FAR *window);
|
1078 |
+
|
1079 |
+
Initialize the internal stream state for decompression using inflateBack()
|
1080 |
+
calls. The fields zalloc, zfree and opaque in strm must be initialized
|
1081 |
+
before the call. If zalloc and zfree are Z_NULL, then the default library-
|
1082 |
+
derived memory allocation routines are used. windowBits is the base two
|
1083 |
+
logarithm of the window size, in the range 8..15. window is a caller
|
1084 |
+
supplied buffer of that size. Except for special applications where it is
|
1085 |
+
assured that deflate was used with small window sizes, windowBits must be 15
|
1086 |
+
and a 32K byte window must be supplied to be able to decompress general
|
1087 |
+
deflate streams.
|
1088 |
+
|
1089 |
+
See inflateBack() for the usage of these routines.
|
1090 |
+
|
1091 |
+
inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
|
1092 |
+
the parameters are invalid, Z_MEM_ERROR if the internal state could not be
|
1093 |
+
allocated, or Z_VERSION_ERROR if the version of the library does not match
|
1094 |
+
the version of the header file.
|
1095 |
+
*/
|
1096 |
+
|
1097 |
+
typedef unsigned (*in_func)(void FAR *,
|
1098 |
+
z_const unsigned char FAR * FAR *);
|
1099 |
+
typedef int (*out_func)(void FAR *, unsigned char FAR *, unsigned);
|
1100 |
+
|
1101 |
+
ZEXTERN int ZEXPORT inflateBack(z_streamp strm,
|
1102 |
+
in_func in, void FAR *in_desc,
|
1103 |
+
out_func out, void FAR *out_desc);
|
1104 |
+
/*
|
1105 |
+
inflateBack() does a raw inflate with a single call using a call-back
|
1106 |
+
interface for input and output. This is potentially more efficient than
|
1107 |
+
inflate() for file i/o applications, in that it avoids copying between the
|
1108 |
+
output and the sliding window by simply making the window itself the output
|
1109 |
+
buffer. inflate() can be faster on modern CPUs when used with large
|
1110 |
+
buffers. inflateBack() trusts the application to not change the output
|
1111 |
+
buffer passed by the output function, at least until inflateBack() returns.
|
1112 |
+
|
1113 |
+
inflateBackInit() must be called first to allocate the internal state
|
1114 |
+
and to initialize the state with the user-provided window buffer.
|
1115 |
+
inflateBack() may then be used multiple times to inflate a complete, raw
|
1116 |
+
deflate stream with each call. inflateBackEnd() is then called to free the
|
1117 |
+
allocated state.
|
1118 |
+
|
1119 |
+
A raw deflate stream is one with no zlib or gzip header or trailer.
|
1120 |
+
This routine would normally be used in a utility that reads zip or gzip
|
1121 |
+
files and writes out uncompressed files. The utility would decode the
|
1122 |
+
header and process the trailer on its own, hence this routine expects only
|
1123 |
+
the raw deflate stream to decompress. This is different from the default
|
1124 |
+
behavior of inflate(), which expects a zlib header and trailer around the
|
1125 |
+
deflate stream.
|
1126 |
+
|
1127 |
+
inflateBack() uses two subroutines supplied by the caller that are then
|
1128 |
+
called by inflateBack() for input and output. inflateBack() calls those
|
1129 |
+
routines until it reads a complete deflate stream and writes out all of the
|
1130 |
+
uncompressed data, or until it encounters an error. The function's
|
1131 |
+
parameters and return types are defined above in the in_func and out_func
|
1132 |
+
typedefs. inflateBack() will call in(in_desc, &buf) which should return the
|
1133 |
+
number of bytes of provided input, and a pointer to that input in buf. If
|
1134 |
+
there is no input available, in() must return zero -- buf is ignored in that
|
1135 |
+
case -- and inflateBack() will return a buffer error. inflateBack() will
|
1136 |
+
call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
|
1137 |
+
out() should return zero on success, or non-zero on failure. If out()
|
1138 |
+
returns non-zero, inflateBack() will return with an error. Neither in() nor
|
1139 |
+
out() are permitted to change the contents of the window provided to
|
1140 |
+
inflateBackInit(), which is also the buffer that out() uses to write from.
|
1141 |
+
The length written by out() will be at most the window size. Any non-zero
|
1142 |
+
amount of input may be provided by in().
|
1143 |
+
|
1144 |
+
For convenience, inflateBack() can be provided input on the first call by
|
1145 |
+
setting strm->next_in and strm->avail_in. If that input is exhausted, then
|
1146 |
+
in() will be called. Therefore strm->next_in must be initialized before
|
1147 |
+
calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
|
1148 |
+
immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
|
1149 |
+
must also be initialized, and then if strm->avail_in is not zero, input will
|
1150 |
+
initially be taken from strm->next_in[0 .. strm->avail_in - 1].
|
1151 |
+
|
1152 |
+
The in_desc and out_desc parameters of inflateBack() is passed as the
|
1153 |
+
first parameter of in() and out() respectively when they are called. These
|
1154 |
+
descriptors can be optionally used to pass any information that the caller-
|
1155 |
+
supplied in() and out() functions need to do their job.
|
1156 |
+
|
1157 |
+
On return, inflateBack() will set strm->next_in and strm->avail_in to
|
1158 |
+
pass back any unused input that was provided by the last in() call. The
|
1159 |
+
return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
|
1160 |
+
if in() or out() returned an error, Z_DATA_ERROR if there was a format error
|
1161 |
+
in the deflate stream (in which case strm->msg is set to indicate the nature
|
1162 |
+
of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
|
1163 |
+
In the case of Z_BUF_ERROR, an input or output error can be distinguished
|
1164 |
+
using strm->next_in which will be Z_NULL only if in() returned an error. If
|
1165 |
+
strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
|
1166 |
+
non-zero. (in() will always be called before out(), so strm->next_in is
|
1167 |
+
assured to be defined if out() returns non-zero.) Note that inflateBack()
|
1168 |
+
cannot return Z_OK.
|
1169 |
+
*/
|
1170 |
+
|
1171 |
+
ZEXTERN int ZEXPORT inflateBackEnd(z_streamp strm);
|
1172 |
+
/*
|
1173 |
+
All memory allocated by inflateBackInit() is freed.
|
1174 |
+
|
1175 |
+
inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
|
1176 |
+
state was inconsistent.
|
1177 |
+
*/
|
1178 |
+
|
1179 |
+
ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
|
1180 |
+
/* Return flags indicating compile-time options.
|
1181 |
+
|
1182 |
+
Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
|
1183 |
+
1.0: size of uInt
|
1184 |
+
3.2: size of uLong
|
1185 |
+
5.4: size of voidpf (pointer)
|
1186 |
+
7.6: size of z_off_t
|
1187 |
+
|
1188 |
+
Compiler, assembler, and debug options:
|
1189 |
+
8: ZLIB_DEBUG
|
1190 |
+
9: ASMV or ASMINF -- use ASM code
|
1191 |
+
10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
|
1192 |
+
11: 0 (reserved)
|
1193 |
+
|
1194 |
+
One-time table building (smaller code, but not thread-safe if true):
|
1195 |
+
12: BUILDFIXED -- build static block decoding tables when needed
|
1196 |
+
13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
|
1197 |
+
14,15: 0 (reserved)
|
1198 |
+
|
1199 |
+
Library content (indicates missing functionality):
|
1200 |
+
16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
|
1201 |
+
deflate code when not needed)
|
1202 |
+
17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
|
1203 |
+
and decode gzip streams (to avoid linking crc code)
|
1204 |
+
18-19: 0 (reserved)
|
1205 |
+
|
1206 |
+
Operation variations (changes in library functionality):
|
1207 |
+
20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
|
1208 |
+
21: FASTEST -- deflate algorithm with only one, lowest compression level
|
1209 |
+
22,23: 0 (reserved)
|
1210 |
+
|
1211 |
+
The sprintf variant used by gzprintf (zero is best):
|
1212 |
+
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
|
1213 |
+
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
|
1214 |
+
26: 0 = returns value, 1 = void -- 1 means inferred string length returned
|
1215 |
+
|
1216 |
+
Remainder:
|
1217 |
+
27-31: 0 (reserved)
|
1218 |
+
*/
|
1219 |
+
|
1220 |
+
#ifndef Z_SOLO
|
1221 |
+
|
1222 |
+
/* utility functions */
|
1223 |
+
|
1224 |
+
/*
|
1225 |
+
The following utility functions are implemented on top of the basic
|
1226 |
+
stream-oriented functions. To simplify the interface, some default options
|
1227 |
+
are assumed (compression level and memory usage, standard memory allocation
|
1228 |
+
functions). The source code of these utility functions can be modified if
|
1229 |
+
you need special options.
|
1230 |
+
*/
|
1231 |
+
|
1232 |
+
ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
|
1233 |
+
const Bytef *source, uLong sourceLen);
|
1234 |
+
/*
|
1235 |
+
Compresses the source buffer into the destination buffer. sourceLen is
|
1236 |
+
the byte length of the source buffer. Upon entry, destLen is the total size
|
1237 |
+
of the destination buffer, which must be at least the value returned by
|
1238 |
+
compressBound(sourceLen). Upon exit, destLen is the actual size of the
|
1239 |
+
compressed data. compress() is equivalent to compress2() with a level
|
1240 |
+
parameter of Z_DEFAULT_COMPRESSION.
|
1241 |
+
|
1242 |
+
compress returns Z_OK if success, Z_MEM_ERROR if there was not
|
1243 |
+
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
1244 |
+
buffer.
|
1245 |
+
*/
|
1246 |
+
|
1247 |
+
ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
|
1248 |
+
const Bytef *source, uLong sourceLen,
|
1249 |
+
int level);
|
1250 |
+
/*
|
1251 |
+
Compresses the source buffer into the destination buffer. The level
|
1252 |
+
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
1253 |
+
length of the source buffer. Upon entry, destLen is the total size of the
|
1254 |
+
destination buffer, which must be at least the value returned by
|
1255 |
+
compressBound(sourceLen). Upon exit, destLen is the actual size of the
|
1256 |
+
compressed data.
|
1257 |
+
|
1258 |
+
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
1259 |
+
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
1260 |
+
Z_STREAM_ERROR if the level parameter is invalid.
|
1261 |
+
*/
|
1262 |
+
|
1263 |
+
ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
|
1264 |
+
/*
|
1265 |
+
compressBound() returns an upper bound on the compressed size after
|
1266 |
+
compress() or compress2() on sourceLen bytes. It would be used before a
|
1267 |
+
compress() or compress2() call to allocate the destination buffer.
|
1268 |
+
*/
|
1269 |
+
|
1270 |
+
ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
|
1271 |
+
const Bytef *source, uLong sourceLen);
|
1272 |
+
/*
|
1273 |
+
Decompresses the source buffer into the destination buffer. sourceLen is
|
1274 |
+
the byte length of the source buffer. Upon entry, destLen is the total size
|
1275 |
+
of the destination buffer, which must be large enough to hold the entire
|
1276 |
+
uncompressed data. (The size of the uncompressed data must have been saved
|
1277 |
+
previously by the compressor and transmitted to the decompressor by some
|
1278 |
+
mechanism outside the scope of this compression library.) Upon exit, destLen
|
1279 |
+
is the actual size of the uncompressed data.
|
1280 |
+
|
1281 |
+
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
1282 |
+
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
1283 |
+
buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
|
1284 |
+
the case where there is not enough room, uncompress() will fill the output
|
1285 |
+
buffer with the uncompressed data up to that point.
|
1286 |
+
*/
|
1287 |
+
|
1288 |
+
ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
|
1289 |
+
const Bytef *source, uLong *sourceLen);
|
1290 |
+
/*
|
1291 |
+
Same as uncompress, except that sourceLen is a pointer, where the
|
1292 |
+
length of the source is *sourceLen. On return, *sourceLen is the number of
|
1293 |
+
source bytes consumed.
|
1294 |
+
*/
|
1295 |
+
|
1296 |
+
/* gzip file access functions */
|
1297 |
+
|
1298 |
+
/*
|
1299 |
+
This library supports reading and writing files in gzip (.gz) format with
|
1300 |
+
an interface similar to that of stdio, using the functions that start with
|
1301 |
+
"gz". The gzip format is different from the zlib format. gzip is a gzip
|
1302 |
+
wrapper, documented in RFC 1952, wrapped around a deflate stream.
|
1303 |
+
*/
|
1304 |
+
|
1305 |
+
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
|
1306 |
+
|
1307 |
+
/*
|
1308 |
+
ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
|
1309 |
+
|
1310 |
+
Open the gzip (.gz) file at path for reading and decompressing, or
|
1311 |
+
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
|
1312 |
+
but can also include a compression level ("wb9") or a strategy: 'f' for
|
1313 |
+
filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h",
|
1314 |
+
'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
|
1315 |
+
as in "wb9F". (See the description of deflateInit2 for more information
|
1316 |
+
about the strategy parameter.) 'T' will request transparent writing or
|
1317 |
+
appending with no compression and not using the gzip format.
|
1318 |
+
|
1319 |
+
"a" can be used instead of "w" to request that the gzip stream that will
|
1320 |
+
be written be appended to the file. "+" will result in an error, since
|
1321 |
+
reading and writing to the same gzip file is not supported. The addition of
|
1322 |
+
"x" when writing will create the file exclusively, which fails if the file
|
1323 |
+
already exists. On systems that support it, the addition of "e" when
|
1324 |
+
reading or writing will set the flag to close the file on an execve() call.
|
1325 |
+
|
1326 |
+
These functions, as well as gzip, will read and decode a sequence of gzip
|
1327 |
+
streams in a file. The append function of gzopen() can be used to create
|
1328 |
+
such a file. (Also see gzflush() for another way to do this.) When
|
1329 |
+
appending, gzopen does not test whether the file begins with a gzip stream,
|
1330 |
+
nor does it look for the end of the gzip streams to begin appending. gzopen
|
1331 |
+
will simply append a gzip stream to the existing file.
|
1332 |
+
|
1333 |
+
gzopen can be used to read a file which is not in gzip format; in this
|
1334 |
+
case gzread will directly read from the file without decompression. When
|
1335 |
+
reading, this will be detected automatically by looking for the magic two-
|
1336 |
+
byte gzip header.
|
1337 |
+
|
1338 |
+
gzopen returns NULL if the file could not be opened, if there was
|
1339 |
+
insufficient memory to allocate the gzFile state, or if an invalid mode was
|
1340 |
+
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
|
1341 |
+
errno can be checked to determine if the reason gzopen failed was that the
|
1342 |
+
file could not be opened.
|
1343 |
+
*/
|
1344 |
+
|
1345 |
+
ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
|
1346 |
+
/*
|
1347 |
+
Associate a gzFile with the file descriptor fd. File descriptors are
|
1348 |
+
obtained from calls like open, dup, creat, pipe or fileno (if the file has
|
1349 |
+
been previously opened with fopen). The mode parameter is as in gzopen.
|
1350 |
+
|
1351 |
+
The next call of gzclose on the returned gzFile will also close the file
|
1352 |
+
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
|
1353 |
+
fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
|
1354 |
+
mode);. The duplicated descriptor should be saved to avoid a leak, since
|
1355 |
+
gzdopen does not close fd if it fails. If you are using fileno() to get the
|
1356 |
+
file descriptor from a FILE *, then you will have to use dup() to avoid
|
1357 |
+
double-close()ing the file descriptor. Both gzclose() and fclose() will
|
1358 |
+
close the associated file descriptor, so they need to have different file
|
1359 |
+
descriptors.
|
1360 |
+
|
1361 |
+
gzdopen returns NULL if there was insufficient memory to allocate the
|
1362 |
+
gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
|
1363 |
+
provided, or '+' was provided), or if fd is -1. The file descriptor is not
|
1364 |
+
used until the next gz* read, write, seek, or close operation, so gzdopen
|
1365 |
+
will not detect if fd is invalid (unless fd is -1).
|
1366 |
+
*/
|
1367 |
+
|
1368 |
+
ZEXTERN int ZEXPORT gzbuffer(gzFile file, unsigned size);
|
1369 |
+
/*
|
1370 |
+
Set the internal buffer size used by this library's functions for file to
|
1371 |
+
size. The default buffer size is 8192 bytes. This function must be called
|
1372 |
+
after gzopen() or gzdopen(), and before any other calls that read or write
|
1373 |
+
the file. The buffer memory allocation is always deferred to the first read
|
1374 |
+
or write. Three times that size in buffer space is allocated. A larger
|
1375 |
+
buffer size of, for example, 64K or 128K bytes will noticeably increase the
|
1376 |
+
speed of decompression (reading).
|
1377 |
+
|
1378 |
+
The new buffer size also affects the maximum length for gzprintf().
|
1379 |
+
|
1380 |
+
gzbuffer() returns 0 on success, or -1 on failure, such as being called
|
1381 |
+
too late.
|
1382 |
+
*/
|
1383 |
+
|
1384 |
+
ZEXTERN int ZEXPORT gzsetparams(gzFile file, int level, int strategy);
|
1385 |
+
/*
|
1386 |
+
Dynamically update the compression level and strategy for file. See the
|
1387 |
+
description of deflateInit2 for the meaning of these parameters. Previously
|
1388 |
+
provided data is flushed before applying the parameter changes.
|
1389 |
+
|
1390 |
+
gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
|
1391 |
+
opened for writing, Z_ERRNO if there is an error writing the flushed data,
|
1392 |
+
or Z_MEM_ERROR if there is a memory allocation error.
|
1393 |
+
*/
|
1394 |
+
|
1395 |
+
ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len);
|
1396 |
+
/*
|
1397 |
+
Read and decompress up to len uncompressed bytes from file into buf. If
|
1398 |
+
the input file is not in gzip format, gzread copies the given number of
|
1399 |
+
bytes into the buffer directly from the file.
|
1400 |
+
|
1401 |
+
After reaching the end of a gzip stream in the input, gzread will continue
|
1402 |
+
to read, looking for another gzip stream. Any number of gzip streams may be
|
1403 |
+
concatenated in the input file, and will all be decompressed by gzread().
|
1404 |
+
If something other than a gzip stream is encountered after a gzip stream,
|
1405 |
+
that remaining trailing garbage is ignored (and no error is returned).
|
1406 |
+
|
1407 |
+
gzread can be used to read a gzip file that is being concurrently written.
|
1408 |
+
Upon reaching the end of the input, gzread will return with the available
|
1409 |
+
data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
|
1410 |
+
gzclearerr can be used to clear the end of file indicator in order to permit
|
1411 |
+
gzread to be tried again. Z_OK indicates that a gzip stream was completed
|
1412 |
+
on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
|
1413 |
+
middle of a gzip stream. Note that gzread does not return -1 in the event
|
1414 |
+
of an incomplete gzip stream. This error is deferred until gzclose(), which
|
1415 |
+
will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
|
1416 |
+
stream. Alternatively, gzerror can be used before gzclose to detect this
|
1417 |
+
case.
|
1418 |
+
|
1419 |
+
gzread returns the number of uncompressed bytes actually read, less than
|
1420 |
+
len for end of file, or -1 for error. If len is too large to fit in an int,
|
1421 |
+
then nothing is read, -1 is returned, and the error state is set to
|
1422 |
+
Z_STREAM_ERROR.
|
1423 |
+
*/
|
1424 |
+
|
1425 |
+
ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
|
1426 |
+
gzFile file);
|
1427 |
+
/*
|
1428 |
+
Read and decompress up to nitems items of size size from file into buf,
|
1429 |
+
otherwise operating as gzread() does. This duplicates the interface of
|
1430 |
+
stdio's fread(), with size_t request and return types. If the library
|
1431 |
+
defines size_t, then z_size_t is identical to size_t. If not, then z_size_t
|
1432 |
+
is an unsigned integer type that can contain a pointer.
|
1433 |
+
|
1434 |
+
gzfread() returns the number of full items read of size size, or zero if
|
1435 |
+
the end of the file was reached and a full item could not be read, or if
|
1436 |
+
there was an error. gzerror() must be consulted if zero is returned in
|
1437 |
+
order to determine if there was an error. If the multiplication of size and
|
1438 |
+
nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
|
1439 |
+
is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
|
1440 |
+
|
1441 |
+
In the event that the end of file is reached and only a partial item is
|
1442 |
+
available at the end, i.e. the remaining uncompressed data length is not a
|
1443 |
+
multiple of size, then the final partial item is nevertheless read into buf
|
1444 |
+
and the end-of-file flag is set. The length of the partial item read is not
|
1445 |
+
provided, but could be inferred from the result of gztell(). This behavior
|
1446 |
+
is the same as the behavior of fread() implementations in common libraries,
|
1447 |
+
but it prevents the direct use of gzfread() to read a concurrently written
|
1448 |
+
file, resetting and retrying on end-of-file, when size is not 1.
|
1449 |
+
*/
|
1450 |
+
|
1451 |
+
ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
|
1452 |
+
/*
|
1453 |
+
Compress and write the len uncompressed bytes at buf to file. gzwrite
|
1454 |
+
returns the number of uncompressed bytes written or 0 in case of error.
|
1455 |
+
*/
|
1456 |
+
|
1457 |
+
ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
|
1458 |
+
z_size_t nitems, gzFile file);
|
1459 |
+
/*
|
1460 |
+
Compress and write nitems items of size size from buf to file, duplicating
|
1461 |
+
the interface of stdio's fwrite(), with size_t request and return types. If
|
1462 |
+
the library defines size_t, then z_size_t is identical to size_t. If not,
|
1463 |
+
then z_size_t is an unsigned integer type that can contain a pointer.
|
1464 |
+
|
1465 |
+
gzfwrite() returns the number of full items written of size size, or zero
|
1466 |
+
if there was an error. If the multiplication of size and nitems overflows,
|
1467 |
+
i.e. the product does not fit in a z_size_t, then nothing is written, zero
|
1468 |
+
is returned, and the error state is set to Z_STREAM_ERROR.
|
1469 |
+
*/
|
1470 |
+
|
1471 |
+
ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
|
1472 |
+
/*
|
1473 |
+
Convert, format, compress, and write the arguments (...) to file under
|
1474 |
+
control of the string format, as in fprintf. gzprintf returns the number of
|
1475 |
+
uncompressed bytes actually written, or a negative zlib error code in case
|
1476 |
+
of error. The number of uncompressed bytes written is limited to 8191, or
|
1477 |
+
one less than the buffer size given to gzbuffer(). The caller should assure
|
1478 |
+
that this limit is not exceeded. If it is exceeded, then gzprintf() will
|
1479 |
+
return an error (0) with nothing written. In this case, there may also be a
|
1480 |
+
buffer overflow with unpredictable consequences, which is possible only if
|
1481 |
+
zlib was compiled with the insecure functions sprintf() or vsprintf(),
|
1482 |
+
because the secure snprintf() or vsnprintf() functions were not available.
|
1483 |
+
This can be determined using zlibCompileFlags().
|
1484 |
+
*/
|
1485 |
+
|
1486 |
+
ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
|
1487 |
+
/*
|
1488 |
+
Compress and write the given null-terminated string s to file, excluding
|
1489 |
+
the terminating null character.
|
1490 |
+
|
1491 |
+
gzputs returns the number of characters written, or -1 in case of error.
|
1492 |
+
*/
|
1493 |
+
|
1494 |
+
ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
|
1495 |
+
/*
|
1496 |
+
Read and decompress bytes from file into buf, until len-1 characters are
|
1497 |
+
read, or until a newline character is read and transferred to buf, or an
|
1498 |
+
end-of-file condition is encountered. If any characters are read or if len
|
1499 |
+
is one, the string is terminated with a null character. If no characters
|
1500 |
+
are read due to an end-of-file or len is less than one, then the buffer is
|
1501 |
+
left untouched.
|
1502 |
+
|
1503 |
+
gzgets returns buf which is a null-terminated string, or it returns NULL
|
1504 |
+
for end-of-file or in case of error. If there was an error, the contents at
|
1505 |
+
buf are indeterminate.
|
1506 |
+
*/
|
1507 |
+
|
1508 |
+
ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
|
1509 |
+
/*
|
1510 |
+
Compress and write c, converted to an unsigned char, into file. gzputc
|
1511 |
+
returns the value that was written, or -1 in case of error.
|
1512 |
+
*/
|
1513 |
+
|
1514 |
+
ZEXTERN int ZEXPORT gzgetc(gzFile file);
|
1515 |
+
/*
|
1516 |
+
Read and decompress one byte from file. gzgetc returns this byte or -1
|
1517 |
+
in case of end of file or error. This is implemented as a macro for speed.
|
1518 |
+
As such, it does not do all of the checking the other functions do. I.e.
|
1519 |
+
it does not check to see if file is NULL, nor whether the structure file
|
1520 |
+
points to has been clobbered or not.
|
1521 |
+
*/
|
1522 |
+
|
1523 |
+
ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
|
1524 |
+
/*
|
1525 |
+
Push c back onto the stream for file to be read as the first character on
|
1526 |
+
the next read. At least one character of push-back is always allowed.
|
1527 |
+
gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
|
1528 |
+
fail if c is -1, and may fail if a character has been pushed but not read
|
1529 |
+
yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
|
1530 |
+
output buffer size of pushed characters is allowed. (See gzbuffer above.)
|
1531 |
+
The pushed character will be discarded if the stream is repositioned with
|
1532 |
+
gzseek() or gzrewind().
|
1533 |
+
*/
|
1534 |
+
|
1535 |
+
ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
|
1536 |
+
/*
|
1537 |
+
Flush all pending output to file. The parameter flush is as in the
|
1538 |
+
deflate() function. The return value is the zlib error number (see function
|
1539 |
+
gzerror below). gzflush is only permitted when writing.
|
1540 |
+
|
1541 |
+
If the flush parameter is Z_FINISH, the remaining data is written and the
|
1542 |
+
gzip stream is completed in the output. If gzwrite() is called again, a new
|
1543 |
+
gzip stream will be started in the output. gzread() is able to read such
|
1544 |
+
concatenated gzip streams.
|
1545 |
+
|
1546 |
+
gzflush should be called only when strictly necessary because it will
|
1547 |
+
degrade compression if called too often.
|
1548 |
+
*/
|
1549 |
+
|
1550 |
+
/*
|
1551 |
+
ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
|
1552 |
+
z_off_t offset, int whence);
|
1553 |
+
|
1554 |
+
Set the starting position to offset relative to whence for the next gzread
|
1555 |
+
or gzwrite on file. The offset represents a number of bytes in the
|
1556 |
+
uncompressed data stream. The whence parameter is defined as in lseek(2);
|
1557 |
+
the value SEEK_END is not supported.
|
1558 |
+
|
1559 |
+
If the file is opened for reading, this function is emulated but can be
|
1560 |
+
extremely slow. If the file is opened for writing, only forward seeks are
|
1561 |
+
supported; gzseek then compresses a sequence of zeroes up to the new
|
1562 |
+
starting position.
|
1563 |
+
|
1564 |
+
gzseek returns the resulting offset location as measured in bytes from
|
1565 |
+
the beginning of the uncompressed stream, or -1 in case of error, in
|
1566 |
+
particular if the file is opened for writing and the new starting position
|
1567 |
+
would be before the current position.
|
1568 |
+
*/
|
1569 |
+
|
1570 |
+
ZEXTERN int ZEXPORT gzrewind(gzFile file);
|
1571 |
+
/*
|
1572 |
+
Rewind file. This function is supported only for reading.
|
1573 |
+
|
1574 |
+
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET).
|
1575 |
+
*/
|
1576 |
+
|
1577 |
+
/*
|
1578 |
+
ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
|
1579 |
+
|
1580 |
+
Return the starting position for the next gzread or gzwrite on file.
|
1581 |
+
This position represents a number of bytes in the uncompressed data stream,
|
1582 |
+
and is zero when starting, even if appending or reading a gzip stream from
|
1583 |
+
the middle of a file using gzdopen().
|
1584 |
+
|
1585 |
+
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
|
1586 |
+
*/
|
1587 |
+
|
1588 |
+
/*
|
1589 |
+
ZEXTERN z_off_t ZEXPORT gzoffset(gzFile file);
|
1590 |
+
|
1591 |
+
Return the current compressed (actual) read or write offset of file. This
|
1592 |
+
offset includes the count of bytes that precede the gzip stream, for example
|
1593 |
+
when appending or when using gzdopen() for reading. When reading, the
|
1594 |
+
offset does not include as yet unused buffered input. This information can
|
1595 |
+
be used for a progress indicator. On error, gzoffset() returns -1.
|
1596 |
+
*/
|
1597 |
+
|
1598 |
+
ZEXTERN int ZEXPORT gzeof(gzFile file);
|
1599 |
+
/*
|
1600 |
+
Return true (1) if the end-of-file indicator for file has been set while
|
1601 |
+
reading, false (0) otherwise. Note that the end-of-file indicator is set
|
1602 |
+
only if the read tried to go past the end of the input, but came up short.
|
1603 |
+
Therefore, just like feof(), gzeof() may return false even if there is no
|
1604 |
+
more data to read, in the event that the last read request was for the exact
|
1605 |
+
number of bytes remaining in the input file. This will happen if the input
|
1606 |
+
file size is an exact multiple of the buffer size.
|
1607 |
+
|
1608 |
+
If gzeof() returns true, then the read functions will return no more data,
|
1609 |
+
unless the end-of-file indicator is reset by gzclearerr() and the input file
|
1610 |
+
has grown since the previous end of file was detected.
|
1611 |
+
*/
|
1612 |
+
|
1613 |
+
ZEXTERN int ZEXPORT gzdirect(gzFile file);
|
1614 |
+
/*
|
1615 |
+
Return true (1) if file is being copied directly while reading, or false
|
1616 |
+
(0) if file is a gzip stream being decompressed.
|
1617 |
+
|
1618 |
+
If the input file is empty, gzdirect() will return true, since the input
|
1619 |
+
does not contain a gzip stream.
|
1620 |
+
|
1621 |
+
If gzdirect() is used immediately after gzopen() or gzdopen() it will
|
1622 |
+
cause buffers to be allocated to allow reading the file to determine if it
|
1623 |
+
is a gzip file. Therefore if gzbuffer() is used, it should be called before
|
1624 |
+
gzdirect().
|
1625 |
+
|
1626 |
+
When writing, gzdirect() returns true (1) if transparent writing was
|
1627 |
+
requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
|
1628 |
+
gzdirect() is not needed when writing. Transparent writing must be
|
1629 |
+
explicitly requested, so the application already knows the answer. When
|
1630 |
+
linking statically, using gzdirect() will include all of the zlib code for
|
1631 |
+
gzip file reading and decompression, which may not be desired.)
|
1632 |
+
*/
|
1633 |
+
|
1634 |
+
ZEXTERN int ZEXPORT gzclose(gzFile file);
|
1635 |
+
/*
|
1636 |
+
Flush all pending output for file, if necessary, close file and
|
1637 |
+
deallocate the (de)compression state. Note that once file is closed, you
|
1638 |
+
cannot call gzerror with file, since its structures have been deallocated.
|
1639 |
+
gzclose must not be called more than once on the same file, just as free
|
1640 |
+
must not be called more than once on the same allocation.
|
1641 |
+
|
1642 |
+
gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
|
1643 |
+
file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
|
1644 |
+
last read ended in the middle of a gzip stream, or Z_OK on success.
|
1645 |
+
*/
|
1646 |
+
|
1647 |
+
ZEXTERN int ZEXPORT gzclose_r(gzFile file);
|
1648 |
+
ZEXTERN int ZEXPORT gzclose_w(gzFile file);
|
1649 |
+
/*
|
1650 |
+
Same as gzclose(), but gzclose_r() is only for use when reading, and
|
1651 |
+
gzclose_w() is only for use when writing or appending. The advantage to
|
1652 |
+
using these instead of gzclose() is that they avoid linking in zlib
|
1653 |
+
compression or decompression code that is not used when only reading or only
|
1654 |
+
writing respectively. If gzclose() is used, then both compression and
|
1655 |
+
decompression code will be included the application when linking to a static
|
1656 |
+
zlib library.
|
1657 |
+
*/
|
1658 |
+
|
1659 |
+
ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
|
1660 |
+
/*
|
1661 |
+
Return the error message for the last error which occurred on file.
|
1662 |
+
errnum is set to zlib error number. If an error occurred in the file system
|
1663 |
+
and not in the compression library, errnum is set to Z_ERRNO and the
|
1664 |
+
application may consult errno to get the exact error code.
|
1665 |
+
|
1666 |
+
The application must not modify the returned string. Future calls to
|
1667 |
+
this function may invalidate the previously returned string. If file is
|
1668 |
+
closed, then the string previously returned by gzerror will no longer be
|
1669 |
+
available.
|
1670 |
+
|
1671 |
+
gzerror() should be used to distinguish errors from end-of-file for those
|
1672 |
+
functions above that do not distinguish those cases in their return values.
|
1673 |
+
*/
|
1674 |
+
|
1675 |
+
ZEXTERN void ZEXPORT gzclearerr(gzFile file);
|
1676 |
+
/*
|
1677 |
+
Clear the error and end-of-file flags for file. This is analogous to the
|
1678 |
+
clearerr() function in stdio. This is useful for continuing to read a gzip
|
1679 |
+
file that is being written concurrently.
|
1680 |
+
*/
|
1681 |
+
|
1682 |
+
#endif /* !Z_SOLO */
|
1683 |
+
|
1684 |
+
/* checksum functions */
|
1685 |
+
|
1686 |
+
/*
|
1687 |
+
These functions are not related to compression but are exported
|
1688 |
+
anyway because they might be useful in applications using the compression
|
1689 |
+
library.
|
1690 |
+
*/
|
1691 |
+
|
1692 |
+
ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len);
|
1693 |
+
/*
|
1694 |
+
Update a running Adler-32 checksum with the bytes buf[0..len-1] and
|
1695 |
+
return the updated checksum. An Adler-32 value is in the range of a 32-bit
|
1696 |
+
unsigned integer. If buf is Z_NULL, this function returns the required
|
1697 |
+
initial value for the checksum.
|
1698 |
+
|
1699 |
+
An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
|
1700 |
+
much faster.
|
1701 |
+
|
1702 |
+
Usage example:
|
1703 |
+
|
1704 |
+
uLong adler = adler32(0L, Z_NULL, 0);
|
1705 |
+
|
1706 |
+
while (read_buffer(buffer, length) != EOF) {
|
1707 |
+
adler = adler32(adler, buffer, length);
|
1708 |
+
}
|
1709 |
+
if (adler != original_adler) error();
|
1710 |
+
*/
|
1711 |
+
|
1712 |
+
ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
|
1713 |
+
z_size_t len);
|
1714 |
+
/*
|
1715 |
+
Same as adler32(), but with a size_t length.
|
1716 |
+
*/
|
1717 |
+
|
1718 |
+
/*
|
1719 |
+
ZEXTERN uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2,
|
1720 |
+
z_off_t len2);
|
1721 |
+
|
1722 |
+
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
|
1723 |
+
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
|
1724 |
+
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
|
1725 |
+
seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
|
1726 |
+
that the z_off_t type (like off_t) is a signed integer. If len2 is
|
1727 |
+
negative, the result has no meaning or utility.
|
1728 |
+
*/
|
1729 |
+
|
1730 |
+
ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len);
|
1731 |
+
/*
|
1732 |
+
Update a running CRC-32 with the bytes buf[0..len-1] and return the
|
1733 |
+
updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
|
1734 |
+
If buf is Z_NULL, this function returns the required initial value for the
|
1735 |
+
crc. Pre- and post-conditioning (one's complement) is performed within this
|
1736 |
+
function so it shouldn't be done by the application.
|
1737 |
+
|
1738 |
+
Usage example:
|
1739 |
+
|
1740 |
+
uLong crc = crc32(0L, Z_NULL, 0);
|
1741 |
+
|
1742 |
+
while (read_buffer(buffer, length) != EOF) {
|
1743 |
+
crc = crc32(crc, buffer, length);
|
1744 |
+
}
|
1745 |
+
if (crc != original_crc) error();
|
1746 |
+
*/
|
1747 |
+
|
1748 |
+
ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
|
1749 |
+
z_size_t len);
|
1750 |
+
/*
|
1751 |
+
Same as crc32(), but with a size_t length.
|
1752 |
+
*/
|
1753 |
+
|
1754 |
+
/*
|
1755 |
+
ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
|
1756 |
+
|
1757 |
+
Combine two CRC-32 check values into one. For two sequences of bytes,
|
1758 |
+
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
|
1759 |
+
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
|
1760 |
+
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
|
1761 |
+
len2. len2 must be non-negative.
|
1762 |
+
*/
|
1763 |
+
|
1764 |
+
/*
|
1765 |
+
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
|
1766 |
+
|
1767 |
+
Return the operator corresponding to length len2, to be used with
|
1768 |
+
crc32_combine_op(). len2 must be non-negative.
|
1769 |
+
*/
|
1770 |
+
|
1771 |
+
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
|
1772 |
+
/*
|
1773 |
+
Give the same result as crc32_combine(), using op in place of len2. op is
|
1774 |
+
is generated from len2 by crc32_combine_gen(). This will be faster than
|
1775 |
+
crc32_combine() if the generated op is used more than once.
|
1776 |
+
*/
|
1777 |
+
|
1778 |
+
|
1779 |
+
/* various hacks, don't look :) */
|
1780 |
+
|
1781 |
+
/* deflateInit and inflateInit are macros to allow checking the zlib version
|
1782 |
+
* and the compiler's view of z_stream:
|
1783 |
+
*/
|
1784 |
+
ZEXTERN int ZEXPORT deflateInit_(z_streamp strm, int level,
|
1785 |
+
const char *version, int stream_size);
|
1786 |
+
ZEXTERN int ZEXPORT inflateInit_(z_streamp strm,
|
1787 |
+
const char *version, int stream_size);
|
1788 |
+
ZEXTERN int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
|
1789 |
+
int windowBits, int memLevel,
|
1790 |
+
int strategy, const char *version,
|
1791 |
+
int stream_size);
|
1792 |
+
ZEXTERN int ZEXPORT inflateInit2_(z_streamp strm, int windowBits,
|
1793 |
+
const char *version, int stream_size);
|
1794 |
+
ZEXTERN int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits,
|
1795 |
+
unsigned char FAR *window,
|
1796 |
+
const char *version,
|
1797 |
+
int stream_size);
|
1798 |
+
#ifdef Z_PREFIX_SET
|
1799 |
+
# define z_deflateInit(strm, level) \
|
1800 |
+
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
1801 |
+
# define z_inflateInit(strm) \
|
1802 |
+
inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
|
1803 |
+
# define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
|
1804 |
+
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
|
1805 |
+
(strategy), ZLIB_VERSION, (int)sizeof(z_stream))
|
1806 |
+
# define z_inflateInit2(strm, windowBits) \
|
1807 |
+
inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
|
1808 |
+
(int)sizeof(z_stream))
|
1809 |
+
# define z_inflateBackInit(strm, windowBits, window) \
|
1810 |
+
inflateBackInit_((strm), (windowBits), (window), \
|
1811 |
+
ZLIB_VERSION, (int)sizeof(z_stream))
|
1812 |
+
#else
|
1813 |
+
# define deflateInit(strm, level) \
|
1814 |
+
deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
|
1815 |
+
# define inflateInit(strm) \
|
1816 |
+
inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
|
1817 |
+
# define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
|
1818 |
+
deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
|
1819 |
+
(strategy), ZLIB_VERSION, (int)sizeof(z_stream))
|
1820 |
+
# define inflateInit2(strm, windowBits) \
|
1821 |
+
inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
|
1822 |
+
(int)sizeof(z_stream))
|
1823 |
+
# define inflateBackInit(strm, windowBits, window) \
|
1824 |
+
inflateBackInit_((strm), (windowBits), (window), \
|
1825 |
+
ZLIB_VERSION, (int)sizeof(z_stream))
|
1826 |
+
#endif
|
1827 |
+
|
1828 |
+
#ifndef Z_SOLO
|
1829 |
+
|
1830 |
+
/* gzgetc() macro and its supporting function and exposed data structure. Note
|
1831 |
+
* that the real internal state is much larger than the exposed structure.
|
1832 |
+
* This abbreviated structure exposes just enough for the gzgetc() macro. The
|
1833 |
+
* user should not mess with these exposed elements, since their names or
|
1834 |
+
* behavior could change in the future, perhaps even capriciously. They can
|
1835 |
+
* only be used by the gzgetc() macro. You have been warned.
|
1836 |
+
*/
|
1837 |
+
struct gzFile_s {
|
1838 |
+
unsigned have;
|
1839 |
+
unsigned char *next;
|
1840 |
+
z_off64_t pos;
|
1841 |
+
};
|
1842 |
+
ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
|
1843 |
+
#ifdef Z_PREFIX_SET
|
1844 |
+
# undef z_gzgetc
|
1845 |
+
# define z_gzgetc(g) \
|
1846 |
+
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
|
1847 |
+
#else
|
1848 |
+
# define gzgetc(g) \
|
1849 |
+
((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
|
1850 |
+
#endif
|
1851 |
+
|
1852 |
+
/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
|
1853 |
+
* change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
|
1854 |
+
* both are true, the application gets the *64 functions, and the regular
|
1855 |
+
* functions are changed to 64 bits) -- in case these are set on systems
|
1856 |
+
* without large file support, _LFS64_LARGEFILE must also be true
|
1857 |
+
*/
|
1858 |
+
#ifdef Z_LARGE64
|
1859 |
+
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
|
1860 |
+
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
|
1861 |
+
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
|
1862 |
+
ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
|
1863 |
+
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
|
1864 |
+
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
|
1865 |
+
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
|
1866 |
+
#endif
|
1867 |
+
|
1868 |
+
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
|
1869 |
+
# ifdef Z_PREFIX_SET
|
1870 |
+
# define z_gzopen z_gzopen64
|
1871 |
+
# define z_gzseek z_gzseek64
|
1872 |
+
# define z_gztell z_gztell64
|
1873 |
+
# define z_gzoffset z_gzoffset64
|
1874 |
+
# define z_adler32_combine z_adler32_combine64
|
1875 |
+
# define z_crc32_combine z_crc32_combine64
|
1876 |
+
# define z_crc32_combine_gen z_crc32_combine_gen64
|
1877 |
+
# else
|
1878 |
+
# define gzopen gzopen64
|
1879 |
+
# define gzseek gzseek64
|
1880 |
+
# define gztell gztell64
|
1881 |
+
# define gzoffset gzoffset64
|
1882 |
+
# define adler32_combine adler32_combine64
|
1883 |
+
# define crc32_combine crc32_combine64
|
1884 |
+
# define crc32_combine_gen crc32_combine_gen64
|
1885 |
+
# endif
|
1886 |
+
# ifndef Z_LARGE64
|
1887 |
+
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
|
1888 |
+
ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
|
1889 |
+
ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
|
1890 |
+
ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
|
1891 |
+
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
1892 |
+
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
1893 |
+
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
1894 |
+
# endif
|
1895 |
+
#else
|
1896 |
+
ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
|
1897 |
+
ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int);
|
1898 |
+
ZEXTERN z_off_t ZEXPORT gztell(gzFile);
|
1899 |
+
ZEXTERN z_off_t ZEXPORT gzoffset(gzFile);
|
1900 |
+
ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
|
1901 |
+
ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
|
1902 |
+
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
|
1903 |
+
#endif
|
1904 |
+
|
1905 |
+
#else /* Z_SOLO */
|
1906 |
+
|
1907 |
+
ZEXTERN uLong ZEXPORT adler32_combine(uLong, uLong, z_off_t);
|
1908 |
+
ZEXTERN uLong ZEXPORT crc32_combine(uLong, uLong, z_off_t);
|
1909 |
+
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t);
|
1910 |
+
|
1911 |
+
#endif /* !Z_SOLO */
|
1912 |
+
|
1913 |
+
/* undocumented functions */
|
1914 |
+
ZEXTERN const char * ZEXPORT zError(int);
|
1915 |
+
ZEXTERN int ZEXPORT inflateSyncPoint(z_streamp);
|
1916 |
+
ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table(void);
|
1917 |
+
ZEXTERN int ZEXPORT inflateUndermine(z_streamp, int);
|
1918 |
+
ZEXTERN int ZEXPORT inflateValidate(z_streamp, int);
|
1919 |
+
ZEXTERN unsigned long ZEXPORT inflateCodesUsed(z_streamp);
|
1920 |
+
ZEXTERN int ZEXPORT inflateResetKeep(z_streamp);
|
1921 |
+
ZEXTERN int ZEXPORT deflateResetKeep(z_streamp);
|
1922 |
+
#if defined(_WIN32) && !defined(Z_SOLO)
|
1923 |
+
ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path,
|
1924 |
+
const char *mode);
|
1925 |
+
#endif
|
1926 |
+
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
1927 |
+
# ifndef Z_SOLO
|
1928 |
+
ZEXTERN int ZEXPORTVA gzvprintf(gzFile file,
|
1929 |
+
const char *format,
|
1930 |
+
va_list va);
|
1931 |
+
# endif
|
1932 |
+
#endif
|
1933 |
+
|
1934 |
+
#ifdef __cplusplus
|
1935 |
+
}
|
1936 |
+
#endif
|
1937 |
+
|
1938 |
+
#endif /* ZLIB_H */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/__init__.py
ADDED
File without changes
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (195 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/exslt.h
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: main header file
|
3 |
+
*
|
4 |
+
* Copy: See Copyright for the status of this software.
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
#ifndef __EXSLT_H__
|
9 |
+
#define __EXSLT_H__
|
10 |
+
|
11 |
+
#include <libxml/tree.h>
|
12 |
+
#include <libxml/xpath.h>
|
13 |
+
#include "exsltexports.h"
|
14 |
+
#include <libexslt/exsltconfig.h>
|
15 |
+
|
16 |
+
#ifdef __cplusplus
|
17 |
+
extern "C" {
|
18 |
+
#endif
|
19 |
+
|
20 |
+
EXSLTPUBVAR const char *exsltLibraryVersion;
|
21 |
+
EXSLTPUBVAR const int exsltLibexsltVersion;
|
22 |
+
EXSLTPUBVAR const int exsltLibxsltVersion;
|
23 |
+
EXSLTPUBVAR const int exsltLibxmlVersion;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* EXSLT_COMMON_NAMESPACE:
|
27 |
+
*
|
28 |
+
* Namespace for EXSLT common functions
|
29 |
+
*/
|
30 |
+
#define EXSLT_COMMON_NAMESPACE ((const xmlChar *) "http://exslt.org/common")
|
31 |
+
/**
|
32 |
+
* EXSLT_CRYPTO_NAMESPACE:
|
33 |
+
*
|
34 |
+
* Namespace for EXSLT crypto functions
|
35 |
+
*/
|
36 |
+
#define EXSLT_CRYPTO_NAMESPACE ((const xmlChar *) "http://exslt.org/crypto")
|
37 |
+
/**
|
38 |
+
* EXSLT_MATH_NAMESPACE:
|
39 |
+
*
|
40 |
+
* Namespace for EXSLT math functions
|
41 |
+
*/
|
42 |
+
#define EXSLT_MATH_NAMESPACE ((const xmlChar *) "http://exslt.org/math")
|
43 |
+
/**
|
44 |
+
* EXSLT_SETS_NAMESPACE:
|
45 |
+
*
|
46 |
+
* Namespace for EXSLT set functions
|
47 |
+
*/
|
48 |
+
#define EXSLT_SETS_NAMESPACE ((const xmlChar *) "http://exslt.org/sets")
|
49 |
+
/**
|
50 |
+
* EXSLT_FUNCTIONS_NAMESPACE:
|
51 |
+
*
|
52 |
+
* Namespace for EXSLT functions extension functions
|
53 |
+
*/
|
54 |
+
#define EXSLT_FUNCTIONS_NAMESPACE ((const xmlChar *) "http://exslt.org/functions")
|
55 |
+
/**
|
56 |
+
* EXSLT_STRINGS_NAMESPACE:
|
57 |
+
*
|
58 |
+
* Namespace for EXSLT strings functions
|
59 |
+
*/
|
60 |
+
#define EXSLT_STRINGS_NAMESPACE ((const xmlChar *) "http://exslt.org/strings")
|
61 |
+
/**
|
62 |
+
* EXSLT_DATE_NAMESPACE:
|
63 |
+
*
|
64 |
+
* Namespace for EXSLT date functions
|
65 |
+
*/
|
66 |
+
#define EXSLT_DATE_NAMESPACE ((const xmlChar *) "http://exslt.org/dates-and-times")
|
67 |
+
/**
|
68 |
+
* EXSLT_DYNAMIC_NAMESPACE:
|
69 |
+
*
|
70 |
+
* Namespace for EXSLT dynamic functions
|
71 |
+
*/
|
72 |
+
#define EXSLT_DYNAMIC_NAMESPACE ((const xmlChar *) "http://exslt.org/dynamic")
|
73 |
+
|
74 |
+
/**
|
75 |
+
* SAXON_NAMESPACE:
|
76 |
+
*
|
77 |
+
* Namespace for SAXON extensions functions
|
78 |
+
*/
|
79 |
+
#define SAXON_NAMESPACE ((const xmlChar *) "http://icl.com/saxon")
|
80 |
+
|
81 |
+
EXSLTPUBFUN void EXSLTCALL exsltCommonRegister (void);
|
82 |
+
#ifdef EXSLT_CRYPTO_ENABLED
|
83 |
+
EXSLTPUBFUN void EXSLTCALL exsltCryptoRegister (void);
|
84 |
+
#endif
|
85 |
+
EXSLTPUBFUN void EXSLTCALL exsltMathRegister (void);
|
86 |
+
EXSLTPUBFUN void EXSLTCALL exsltSetsRegister (void);
|
87 |
+
EXSLTPUBFUN void EXSLTCALL exsltFuncRegister (void);
|
88 |
+
EXSLTPUBFUN void EXSLTCALL exsltStrRegister (void);
|
89 |
+
EXSLTPUBFUN void EXSLTCALL exsltDateRegister (void);
|
90 |
+
EXSLTPUBFUN void EXSLTCALL exsltSaxonRegister (void);
|
91 |
+
EXSLTPUBFUN void EXSLTCALL exsltDynRegister(void);
|
92 |
+
|
93 |
+
EXSLTPUBFUN void EXSLTCALL exsltRegisterAll (void);
|
94 |
+
|
95 |
+
EXSLTPUBFUN int EXSLTCALL exsltDateXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
96 |
+
const xmlChar *prefix);
|
97 |
+
EXSLTPUBFUN int EXSLTCALL exsltMathXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
98 |
+
const xmlChar *prefix);
|
99 |
+
EXSLTPUBFUN int EXSLTCALL exsltSetsXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
100 |
+
const xmlChar *prefix);
|
101 |
+
EXSLTPUBFUN int EXSLTCALL exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt,
|
102 |
+
const xmlChar *prefix);
|
103 |
+
|
104 |
+
#ifdef __cplusplus
|
105 |
+
}
|
106 |
+
#endif
|
107 |
+
#endif /* __EXSLT_H__ */
|
108 |
+
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/exsltconfig.h
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* exsltconfig.h: compile-time version information for the EXSLT library
|
3 |
+
*
|
4 |
+
* See Copyright for the status of this software.
|
5 |
+
*
|
6 | |
7 |
+
*/
|
8 |
+
|
9 |
+
#ifndef __XML_EXSLTCONFIG_H__
|
10 |
+
#define __XML_EXSLTCONFIG_H__
|
11 |
+
|
12 |
+
#ifdef __cplusplus
|
13 |
+
extern "C" {
|
14 |
+
#endif
|
15 |
+
|
16 |
+
/**
|
17 |
+
* LIBEXSLT_DOTTED_VERSION:
|
18 |
+
*
|
19 |
+
* the version string like "1.2.3"
|
20 |
+
*/
|
21 |
+
#define LIBEXSLT_DOTTED_VERSION "0.8.21"
|
22 |
+
|
23 |
+
/**
|
24 |
+
* LIBEXSLT_VERSION:
|
25 |
+
*
|
26 |
+
* the version number: 1.2.3 value is 10203
|
27 |
+
*/
|
28 |
+
#define LIBEXSLT_VERSION 821
|
29 |
+
|
30 |
+
/**
|
31 |
+
* LIBEXSLT_VERSION_STRING:
|
32 |
+
*
|
33 |
+
* the version number string, 1.2.3 value is "10203"
|
34 |
+
*/
|
35 |
+
#define LIBEXSLT_VERSION_STRING "821"
|
36 |
+
|
37 |
+
/**
|
38 |
+
* LIBEXSLT_VERSION_EXTRA:
|
39 |
+
*
|
40 |
+
* extra version information, used to show a Git commit description
|
41 |
+
*/
|
42 |
+
#define LIBEXSLT_VERSION_EXTRA ""
|
43 |
+
|
44 |
+
/**
|
45 |
+
* WITH_CRYPTO:
|
46 |
+
*
|
47 |
+
* Whether crypto support is configured into exslt
|
48 |
+
*/
|
49 |
+
#if 0
|
50 |
+
#define EXSLT_CRYPTO_ENABLED
|
51 |
+
#endif
|
52 |
+
|
53 |
+
/**
|
54 |
+
* ATTRIBUTE_UNUSED:
|
55 |
+
*
|
56 |
+
* This macro is used to flag unused function parameters to GCC
|
57 |
+
*/
|
58 |
+
#ifdef __GNUC__
|
59 |
+
#ifndef ATTRIBUTE_UNUSED
|
60 |
+
#define ATTRIBUTE_UNUSED __attribute__((unused))
|
61 |
+
#endif
|
62 |
+
#else
|
63 |
+
#define ATTRIBUTE_UNUSED
|
64 |
+
#endif
|
65 |
+
|
66 |
+
#ifdef __cplusplus
|
67 |
+
}
|
68 |
+
#endif
|
69 |
+
|
70 |
+
#endif /* __XML_EXSLTCONFIG_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libexslt/exsltexports.h
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: macros for marking symbols as exportable/importable.
|
3 |
+
*
|
4 |
+
* Copy: See Copyright for the status of this software.
|
5 |
+
*/
|
6 |
+
|
7 |
+
#ifndef __EXSLT_EXPORTS_H__
|
8 |
+
#define __EXSLT_EXPORTS_H__
|
9 |
+
|
10 |
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
11 |
+
/** DOC_DISABLE */
|
12 |
+
|
13 |
+
#ifdef LIBEXSLT_STATIC
|
14 |
+
#define EXSLTPUBLIC
|
15 |
+
#elif defined(IN_LIBEXSLT)
|
16 |
+
#define EXSLTPUBLIC __declspec(dllexport)
|
17 |
+
#else
|
18 |
+
#define EXSLTPUBLIC __declspec(dllimport)
|
19 |
+
#endif
|
20 |
+
|
21 |
+
#define EXSLTCALL __cdecl
|
22 |
+
|
23 |
+
/** DOC_ENABLE */
|
24 |
+
#else /* not Windows */
|
25 |
+
|
26 |
+
/**
|
27 |
+
* EXSLTPUBLIC:
|
28 |
+
*
|
29 |
+
* Macro which declares a public symbol
|
30 |
+
*/
|
31 |
+
#define EXSLTPUBLIC
|
32 |
+
|
33 |
+
/**
|
34 |
+
* EXSLTCALL:
|
35 |
+
*
|
36 |
+
* Macro which declares the calling convention for exported functions
|
37 |
+
*/
|
38 |
+
#define EXSLTCALL
|
39 |
+
|
40 |
+
#endif /* platform switch */
|
41 |
+
|
42 |
+
/*
|
43 |
+
* EXSLTPUBFUN:
|
44 |
+
*
|
45 |
+
* Macro which declares an exportable function
|
46 |
+
*/
|
47 |
+
#define EXSLTPUBFUN EXSLTPUBLIC
|
48 |
+
|
49 |
+
/**
|
50 |
+
* EXSLTPUBVAR:
|
51 |
+
*
|
52 |
+
* Macro which declares an exportable variable
|
53 |
+
*/
|
54 |
+
#define EXSLTPUBVAR EXSLTPUBLIC extern
|
55 |
+
|
56 |
+
/* Compatibility */
|
57 |
+
#if !defined(LIBEXSLT_PUBLIC)
|
58 |
+
#define LIBEXSLT_PUBLIC EXSLTPUBVAR
|
59 |
+
#endif
|
60 |
+
|
61 |
+
#endif /* __EXSLT_EXPORTS_H__ */
|
62 |
+
|
63 |
+
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/SAX.h
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: Old SAX version 1 handler, deprecated
|
3 |
+
* Description: DEPRECATED set of SAX version 1 interfaces used to
|
4 |
+
* build the DOM tree.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
#ifndef __XML_SAX_H__
|
13 |
+
#define __XML_SAX_H__
|
14 |
+
|
15 |
+
#include <libxml/xmlversion.h>
|
16 |
+
#include <libxml/parser.h>
|
17 |
+
|
18 |
+
#ifdef LIBXML_LEGACY_ENABLED
|
19 |
+
|
20 |
+
#ifdef __cplusplus
|
21 |
+
extern "C" {
|
22 |
+
#endif
|
23 |
+
XML_DEPRECATED
|
24 |
+
XMLPUBFUN const xmlChar *
|
25 |
+
getPublicId (void *ctx);
|
26 |
+
XML_DEPRECATED
|
27 |
+
XMLPUBFUN const xmlChar *
|
28 |
+
getSystemId (void *ctx);
|
29 |
+
XML_DEPRECATED
|
30 |
+
XMLPUBFUN void
|
31 |
+
setDocumentLocator (void *ctx,
|
32 |
+
xmlSAXLocatorPtr loc);
|
33 |
+
|
34 |
+
XML_DEPRECATED
|
35 |
+
XMLPUBFUN int
|
36 |
+
getLineNumber (void *ctx);
|
37 |
+
XML_DEPRECATED
|
38 |
+
XMLPUBFUN int
|
39 |
+
getColumnNumber (void *ctx);
|
40 |
+
|
41 |
+
XML_DEPRECATED
|
42 |
+
XMLPUBFUN int
|
43 |
+
isStandalone (void *ctx);
|
44 |
+
XML_DEPRECATED
|
45 |
+
XMLPUBFUN int
|
46 |
+
hasInternalSubset (void *ctx);
|
47 |
+
XML_DEPRECATED
|
48 |
+
XMLPUBFUN int
|
49 |
+
hasExternalSubset (void *ctx);
|
50 |
+
|
51 |
+
XML_DEPRECATED
|
52 |
+
XMLPUBFUN void
|
53 |
+
internalSubset (void *ctx,
|
54 |
+
const xmlChar *name,
|
55 |
+
const xmlChar *ExternalID,
|
56 |
+
const xmlChar *SystemID);
|
57 |
+
XML_DEPRECATED
|
58 |
+
XMLPUBFUN void
|
59 |
+
externalSubset (void *ctx,
|
60 |
+
const xmlChar *name,
|
61 |
+
const xmlChar *ExternalID,
|
62 |
+
const xmlChar *SystemID);
|
63 |
+
XML_DEPRECATED
|
64 |
+
XMLPUBFUN xmlEntityPtr
|
65 |
+
getEntity (void *ctx,
|
66 |
+
const xmlChar *name);
|
67 |
+
XML_DEPRECATED
|
68 |
+
XMLPUBFUN xmlEntityPtr
|
69 |
+
getParameterEntity (void *ctx,
|
70 |
+
const xmlChar *name);
|
71 |
+
XML_DEPRECATED
|
72 |
+
XMLPUBFUN xmlParserInputPtr
|
73 |
+
resolveEntity (void *ctx,
|
74 |
+
const xmlChar *publicId,
|
75 |
+
const xmlChar *systemId);
|
76 |
+
|
77 |
+
XML_DEPRECATED
|
78 |
+
XMLPUBFUN void
|
79 |
+
entityDecl (void *ctx,
|
80 |
+
const xmlChar *name,
|
81 |
+
int type,
|
82 |
+
const xmlChar *publicId,
|
83 |
+
const xmlChar *systemId,
|
84 |
+
xmlChar *content);
|
85 |
+
XML_DEPRECATED
|
86 |
+
XMLPUBFUN void
|
87 |
+
attributeDecl (void *ctx,
|
88 |
+
const xmlChar *elem,
|
89 |
+
const xmlChar *fullname,
|
90 |
+
int type,
|
91 |
+
int def,
|
92 |
+
const xmlChar *defaultValue,
|
93 |
+
xmlEnumerationPtr tree);
|
94 |
+
XML_DEPRECATED
|
95 |
+
XMLPUBFUN void
|
96 |
+
elementDecl (void *ctx,
|
97 |
+
const xmlChar *name,
|
98 |
+
int type,
|
99 |
+
xmlElementContentPtr content);
|
100 |
+
XML_DEPRECATED
|
101 |
+
XMLPUBFUN void
|
102 |
+
notationDecl (void *ctx,
|
103 |
+
const xmlChar *name,
|
104 |
+
const xmlChar *publicId,
|
105 |
+
const xmlChar *systemId);
|
106 |
+
XML_DEPRECATED
|
107 |
+
XMLPUBFUN void
|
108 |
+
unparsedEntityDecl (void *ctx,
|
109 |
+
const xmlChar *name,
|
110 |
+
const xmlChar *publicId,
|
111 |
+
const xmlChar *systemId,
|
112 |
+
const xmlChar *notationName);
|
113 |
+
|
114 |
+
XML_DEPRECATED
|
115 |
+
XMLPUBFUN void
|
116 |
+
startDocument (void *ctx);
|
117 |
+
XML_DEPRECATED
|
118 |
+
XMLPUBFUN void
|
119 |
+
endDocument (void *ctx);
|
120 |
+
XML_DEPRECATED
|
121 |
+
XMLPUBFUN void
|
122 |
+
attribute (void *ctx,
|
123 |
+
const xmlChar *fullname,
|
124 |
+
const xmlChar *value);
|
125 |
+
XML_DEPRECATED
|
126 |
+
XMLPUBFUN void
|
127 |
+
startElement (void *ctx,
|
128 |
+
const xmlChar *fullname,
|
129 |
+
const xmlChar **atts);
|
130 |
+
XML_DEPRECATED
|
131 |
+
XMLPUBFUN void
|
132 |
+
endElement (void *ctx,
|
133 |
+
const xmlChar *name);
|
134 |
+
XML_DEPRECATED
|
135 |
+
XMLPUBFUN void
|
136 |
+
reference (void *ctx,
|
137 |
+
const xmlChar *name);
|
138 |
+
XML_DEPRECATED
|
139 |
+
XMLPUBFUN void
|
140 |
+
characters (void *ctx,
|
141 |
+
const xmlChar *ch,
|
142 |
+
int len);
|
143 |
+
XML_DEPRECATED
|
144 |
+
XMLPUBFUN void
|
145 |
+
ignorableWhitespace (void *ctx,
|
146 |
+
const xmlChar *ch,
|
147 |
+
int len);
|
148 |
+
XML_DEPRECATED
|
149 |
+
XMLPUBFUN void
|
150 |
+
processingInstruction (void *ctx,
|
151 |
+
const xmlChar *target,
|
152 |
+
const xmlChar *data);
|
153 |
+
XML_DEPRECATED
|
154 |
+
XMLPUBFUN void
|
155 |
+
globalNamespace (void *ctx,
|
156 |
+
const xmlChar *href,
|
157 |
+
const xmlChar *prefix);
|
158 |
+
XML_DEPRECATED
|
159 |
+
XMLPUBFUN void
|
160 |
+
setNamespace (void *ctx,
|
161 |
+
const xmlChar *name);
|
162 |
+
XML_DEPRECATED
|
163 |
+
XMLPUBFUN xmlNsPtr
|
164 |
+
getNamespace (void *ctx);
|
165 |
+
XML_DEPRECATED
|
166 |
+
XMLPUBFUN int
|
167 |
+
checkNamespace (void *ctx,
|
168 |
+
xmlChar *nameSpace);
|
169 |
+
XML_DEPRECATED
|
170 |
+
XMLPUBFUN void
|
171 |
+
namespaceDecl (void *ctx,
|
172 |
+
const xmlChar *href,
|
173 |
+
const xmlChar *prefix);
|
174 |
+
XML_DEPRECATED
|
175 |
+
XMLPUBFUN void
|
176 |
+
comment (void *ctx,
|
177 |
+
const xmlChar *value);
|
178 |
+
XML_DEPRECATED
|
179 |
+
XMLPUBFUN void
|
180 |
+
cdataBlock (void *ctx,
|
181 |
+
const xmlChar *value,
|
182 |
+
int len);
|
183 |
+
|
184 |
+
#ifdef LIBXML_SAX1_ENABLED
|
185 |
+
XML_DEPRECATED
|
186 |
+
XMLPUBFUN void
|
187 |
+
initxmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr,
|
188 |
+
int warning);
|
189 |
+
#ifdef LIBXML_HTML_ENABLED
|
190 |
+
XML_DEPRECATED
|
191 |
+
XMLPUBFUN void
|
192 |
+
inithtmlDefaultSAXHandler (xmlSAXHandlerV1 *hdlr);
|
193 |
+
#endif
|
194 |
+
#endif /* LIBXML_SAX1_ENABLED */
|
195 |
+
|
196 |
+
#ifdef __cplusplus
|
197 |
+
}
|
198 |
+
#endif
|
199 |
+
|
200 |
+
#endif /* LIBXML_LEGACY_ENABLED */
|
201 |
+
|
202 |
+
#endif /* __XML_SAX_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/SAX2.h
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: SAX2 parser interface used to build the DOM tree
|
3 |
+
* Description: those are the default SAX2 interfaces used by
|
4 |
+
* the library when building DOM tree.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
#ifndef __XML_SAX2_H__
|
13 |
+
#define __XML_SAX2_H__
|
14 |
+
|
15 |
+
#include <libxml/xmlversion.h>
|
16 |
+
#include <libxml/parser.h>
|
17 |
+
|
18 |
+
#ifdef __cplusplus
|
19 |
+
extern "C" {
|
20 |
+
#endif
|
21 |
+
XMLPUBFUN const xmlChar *
|
22 |
+
xmlSAX2GetPublicId (void *ctx);
|
23 |
+
XMLPUBFUN const xmlChar *
|
24 |
+
xmlSAX2GetSystemId (void *ctx);
|
25 |
+
XMLPUBFUN void
|
26 |
+
xmlSAX2SetDocumentLocator (void *ctx,
|
27 |
+
xmlSAXLocatorPtr loc);
|
28 |
+
|
29 |
+
XMLPUBFUN int
|
30 |
+
xmlSAX2GetLineNumber (void *ctx);
|
31 |
+
XMLPUBFUN int
|
32 |
+
xmlSAX2GetColumnNumber (void *ctx);
|
33 |
+
|
34 |
+
XMLPUBFUN int
|
35 |
+
xmlSAX2IsStandalone (void *ctx);
|
36 |
+
XMLPUBFUN int
|
37 |
+
xmlSAX2HasInternalSubset (void *ctx);
|
38 |
+
XMLPUBFUN int
|
39 |
+
xmlSAX2HasExternalSubset (void *ctx);
|
40 |
+
|
41 |
+
XMLPUBFUN void
|
42 |
+
xmlSAX2InternalSubset (void *ctx,
|
43 |
+
const xmlChar *name,
|
44 |
+
const xmlChar *ExternalID,
|
45 |
+
const xmlChar *SystemID);
|
46 |
+
XMLPUBFUN void
|
47 |
+
xmlSAX2ExternalSubset (void *ctx,
|
48 |
+
const xmlChar *name,
|
49 |
+
const xmlChar *ExternalID,
|
50 |
+
const xmlChar *SystemID);
|
51 |
+
XMLPUBFUN xmlEntityPtr
|
52 |
+
xmlSAX2GetEntity (void *ctx,
|
53 |
+
const xmlChar *name);
|
54 |
+
XMLPUBFUN xmlEntityPtr
|
55 |
+
xmlSAX2GetParameterEntity (void *ctx,
|
56 |
+
const xmlChar *name);
|
57 |
+
XMLPUBFUN xmlParserInputPtr
|
58 |
+
xmlSAX2ResolveEntity (void *ctx,
|
59 |
+
const xmlChar *publicId,
|
60 |
+
const xmlChar *systemId);
|
61 |
+
|
62 |
+
XMLPUBFUN void
|
63 |
+
xmlSAX2EntityDecl (void *ctx,
|
64 |
+
const xmlChar *name,
|
65 |
+
int type,
|
66 |
+
const xmlChar *publicId,
|
67 |
+
const xmlChar *systemId,
|
68 |
+
xmlChar *content);
|
69 |
+
XMLPUBFUN void
|
70 |
+
xmlSAX2AttributeDecl (void *ctx,
|
71 |
+
const xmlChar *elem,
|
72 |
+
const xmlChar *fullname,
|
73 |
+
int type,
|
74 |
+
int def,
|
75 |
+
const xmlChar *defaultValue,
|
76 |
+
xmlEnumerationPtr tree);
|
77 |
+
XMLPUBFUN void
|
78 |
+
xmlSAX2ElementDecl (void *ctx,
|
79 |
+
const xmlChar *name,
|
80 |
+
int type,
|
81 |
+
xmlElementContentPtr content);
|
82 |
+
XMLPUBFUN void
|
83 |
+
xmlSAX2NotationDecl (void *ctx,
|
84 |
+
const xmlChar *name,
|
85 |
+
const xmlChar *publicId,
|
86 |
+
const xmlChar *systemId);
|
87 |
+
XMLPUBFUN void
|
88 |
+
xmlSAX2UnparsedEntityDecl (void *ctx,
|
89 |
+
const xmlChar *name,
|
90 |
+
const xmlChar *publicId,
|
91 |
+
const xmlChar *systemId,
|
92 |
+
const xmlChar *notationName);
|
93 |
+
|
94 |
+
XMLPUBFUN void
|
95 |
+
xmlSAX2StartDocument (void *ctx);
|
96 |
+
XMLPUBFUN void
|
97 |
+
xmlSAX2EndDocument (void *ctx);
|
98 |
+
#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
|
99 |
+
defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
|
100 |
+
XMLPUBFUN void
|
101 |
+
xmlSAX2StartElement (void *ctx,
|
102 |
+
const xmlChar *fullname,
|
103 |
+
const xmlChar **atts);
|
104 |
+
XMLPUBFUN void
|
105 |
+
xmlSAX2EndElement (void *ctx,
|
106 |
+
const xmlChar *name);
|
107 |
+
#endif /* LIBXML_SAX1_ENABLED or LIBXML_HTML_ENABLED or LIBXML_LEGACY_ENABLED */
|
108 |
+
XMLPUBFUN void
|
109 |
+
xmlSAX2StartElementNs (void *ctx,
|
110 |
+
const xmlChar *localname,
|
111 |
+
const xmlChar *prefix,
|
112 |
+
const xmlChar *URI,
|
113 |
+
int nb_namespaces,
|
114 |
+
const xmlChar **namespaces,
|
115 |
+
int nb_attributes,
|
116 |
+
int nb_defaulted,
|
117 |
+
const xmlChar **attributes);
|
118 |
+
XMLPUBFUN void
|
119 |
+
xmlSAX2EndElementNs (void *ctx,
|
120 |
+
const xmlChar *localname,
|
121 |
+
const xmlChar *prefix,
|
122 |
+
const xmlChar *URI);
|
123 |
+
XMLPUBFUN void
|
124 |
+
xmlSAX2Reference (void *ctx,
|
125 |
+
const xmlChar *name);
|
126 |
+
XMLPUBFUN void
|
127 |
+
xmlSAX2Characters (void *ctx,
|
128 |
+
const xmlChar *ch,
|
129 |
+
int len);
|
130 |
+
XMLPUBFUN void
|
131 |
+
xmlSAX2IgnorableWhitespace (void *ctx,
|
132 |
+
const xmlChar *ch,
|
133 |
+
int len);
|
134 |
+
XMLPUBFUN void
|
135 |
+
xmlSAX2ProcessingInstruction (void *ctx,
|
136 |
+
const xmlChar *target,
|
137 |
+
const xmlChar *data);
|
138 |
+
XMLPUBFUN void
|
139 |
+
xmlSAX2Comment (void *ctx,
|
140 |
+
const xmlChar *value);
|
141 |
+
XMLPUBFUN void
|
142 |
+
xmlSAX2CDataBlock (void *ctx,
|
143 |
+
const xmlChar *value,
|
144 |
+
int len);
|
145 |
+
|
146 |
+
#ifdef LIBXML_SAX1_ENABLED
|
147 |
+
XML_DEPRECATED
|
148 |
+
XMLPUBFUN int
|
149 |
+
xmlSAXDefaultVersion (int version);
|
150 |
+
#endif /* LIBXML_SAX1_ENABLED */
|
151 |
+
|
152 |
+
XMLPUBFUN int
|
153 |
+
xmlSAXVersion (xmlSAXHandler *hdlr,
|
154 |
+
int version);
|
155 |
+
XMLPUBFUN void
|
156 |
+
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
|
157 |
+
int warning);
|
158 |
+
#ifdef LIBXML_HTML_ENABLED
|
159 |
+
XMLPUBFUN void
|
160 |
+
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
|
161 |
+
XML_DEPRECATED
|
162 |
+
XMLPUBFUN void
|
163 |
+
htmlDefaultSAXHandlerInit (void);
|
164 |
+
#endif
|
165 |
+
XML_DEPRECATED
|
166 |
+
XMLPUBFUN void
|
167 |
+
xmlDefaultSAXHandlerInit (void);
|
168 |
+
#ifdef __cplusplus
|
169 |
+
}
|
170 |
+
#endif
|
171 |
+
#endif /* __XML_SAX2_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/__init__.py
ADDED
File without changes
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (193 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/c14n.h
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: Provide Canonical XML and Exclusive XML Canonicalization
|
3 |
+
* Description: the c14n modules provides a
|
4 |
+
*
|
5 |
+
* "Canonical XML" implementation
|
6 |
+
* http://www.w3.org/TR/xml-c14n
|
7 |
+
*
|
8 |
+
* and an
|
9 |
+
*
|
10 |
+
* "Exclusive XML Canonicalization" implementation
|
11 |
+
* http://www.w3.org/TR/xml-exc-c14n
|
12 |
+
|
13 |
+
* Copy: See Copyright for the status of this software.
|
14 |
+
*
|
15 |
+
* Author: Aleksey Sanin <[email protected]>
|
16 |
+
*/
|
17 |
+
#ifndef __XML_C14N_H__
|
18 |
+
#define __XML_C14N_H__
|
19 |
+
|
20 |
+
#include <libxml/xmlversion.h>
|
21 |
+
|
22 |
+
#ifdef LIBXML_C14N_ENABLED
|
23 |
+
|
24 |
+
#include <libxml/tree.h>
|
25 |
+
#include <libxml/xpath.h>
|
26 |
+
|
27 |
+
#ifdef __cplusplus
|
28 |
+
extern "C" {
|
29 |
+
#endif /* __cplusplus */
|
30 |
+
|
31 |
+
/*
|
32 |
+
* XML Canonicalization
|
33 |
+
* http://www.w3.org/TR/xml-c14n
|
34 |
+
*
|
35 |
+
* Exclusive XML Canonicalization
|
36 |
+
* http://www.w3.org/TR/xml-exc-c14n
|
37 |
+
*
|
38 |
+
* Canonical form of an XML document could be created if and only if
|
39 |
+
* a) default attributes (if any) are added to all nodes
|
40 |
+
* b) all character and parsed entity references are resolved
|
41 |
+
* In order to achieve this in libxml2 the document MUST be loaded with
|
42 |
+
* following global settings:
|
43 |
+
*
|
44 |
+
* xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
45 |
+
* xmlSubstituteEntitiesDefault(1);
|
46 |
+
*
|
47 |
+
* or corresponding parser context setting:
|
48 |
+
* xmlParserCtxtPtr ctxt;
|
49 |
+
*
|
50 |
+
* ...
|
51 |
+
* ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
52 |
+
* ctxt->replaceEntities = 1;
|
53 |
+
* ...
|
54 |
+
*/
|
55 |
+
|
56 |
+
/*
|
57 |
+
* xmlC14NMode:
|
58 |
+
*
|
59 |
+
* Predefined values for C14N modes
|
60 |
+
*
|
61 |
+
*/
|
62 |
+
typedef enum {
|
63 |
+
XML_C14N_1_0 = 0, /* Original C14N 1.0 spec */
|
64 |
+
XML_C14N_EXCLUSIVE_1_0 = 1, /* Exclusive C14N 1.0 spec */
|
65 |
+
XML_C14N_1_1 = 2 /* C14N 1.1 spec */
|
66 |
+
} xmlC14NMode;
|
67 |
+
|
68 |
+
XMLPUBFUN int
|
69 |
+
xmlC14NDocSaveTo (xmlDocPtr doc,
|
70 |
+
xmlNodeSetPtr nodes,
|
71 |
+
int mode, /* a xmlC14NMode */
|
72 |
+
xmlChar **inclusive_ns_prefixes,
|
73 |
+
int with_comments,
|
74 |
+
xmlOutputBufferPtr buf);
|
75 |
+
|
76 |
+
XMLPUBFUN int
|
77 |
+
xmlC14NDocDumpMemory (xmlDocPtr doc,
|
78 |
+
xmlNodeSetPtr nodes,
|
79 |
+
int mode, /* a xmlC14NMode */
|
80 |
+
xmlChar **inclusive_ns_prefixes,
|
81 |
+
int with_comments,
|
82 |
+
xmlChar **doc_txt_ptr);
|
83 |
+
|
84 |
+
XMLPUBFUN int
|
85 |
+
xmlC14NDocSave (xmlDocPtr doc,
|
86 |
+
xmlNodeSetPtr nodes,
|
87 |
+
int mode, /* a xmlC14NMode */
|
88 |
+
xmlChar **inclusive_ns_prefixes,
|
89 |
+
int with_comments,
|
90 |
+
const char* filename,
|
91 |
+
int compression);
|
92 |
+
|
93 |
+
|
94 |
+
/**
|
95 |
+
* This is the core C14N function
|
96 |
+
*/
|
97 |
+
/**
|
98 |
+
* xmlC14NIsVisibleCallback:
|
99 |
+
* @user_data: user data
|
100 |
+
* @node: the current node
|
101 |
+
* @parent: the parent node
|
102 |
+
*
|
103 |
+
* Signature for a C14N callback on visible nodes
|
104 |
+
*
|
105 |
+
* Returns 1 if the node should be included
|
106 |
+
*/
|
107 |
+
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
|
108 |
+
xmlNodePtr node,
|
109 |
+
xmlNodePtr parent);
|
110 |
+
|
111 |
+
XMLPUBFUN int
|
112 |
+
xmlC14NExecute (xmlDocPtr doc,
|
113 |
+
xmlC14NIsVisibleCallback is_visible_callback,
|
114 |
+
void* user_data,
|
115 |
+
int mode, /* a xmlC14NMode */
|
116 |
+
xmlChar **inclusive_ns_prefixes,
|
117 |
+
int with_comments,
|
118 |
+
xmlOutputBufferPtr buf);
|
119 |
+
|
120 |
+
#ifdef __cplusplus
|
121 |
+
}
|
122 |
+
#endif /* __cplusplus */
|
123 |
+
|
124 |
+
#endif /* LIBXML_C14N_ENABLED */
|
125 |
+
#endif /* __XML_C14N_H__ */
|
126 |
+
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/catalog.h
ADDED
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Summary: interfaces to the Catalog handling system
|
3 |
+
* Description: the catalog module implements the support for
|
4 |
+
* XML Catalogs and SGML catalogs
|
5 |
+
*
|
6 |
+
* SGML Open Technical Resolution TR9401:1997.
|
7 |
+
* http://www.jclark.com/sp/catalog.htm
|
8 |
+
*
|
9 |
+
* XML Catalogs Working Draft 06 August 2001
|
10 |
+
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
|
11 |
+
*
|
12 |
+
* Copy: See Copyright for the status of this software.
|
13 |
+
*
|
14 |
+
* Author: Daniel Veillard
|
15 |
+
*/
|
16 |
+
|
17 |
+
#ifndef __XML_CATALOG_H__
|
18 |
+
#define __XML_CATALOG_H__
|
19 |
+
|
20 |
+
#include <stdio.h>
|
21 |
+
|
22 |
+
#include <libxml/xmlversion.h>
|
23 |
+
#include <libxml/xmlstring.h>
|
24 |
+
#include <libxml/tree.h>
|
25 |
+
|
26 |
+
#ifdef LIBXML_CATALOG_ENABLED
|
27 |
+
|
28 |
+
#ifdef __cplusplus
|
29 |
+
extern "C" {
|
30 |
+
#endif
|
31 |
+
|
32 |
+
/**
|
33 |
+
* XML_CATALOGS_NAMESPACE:
|
34 |
+
*
|
35 |
+
* The namespace for the XML Catalogs elements.
|
36 |
+
*/
|
37 |
+
#define XML_CATALOGS_NAMESPACE \
|
38 |
+
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
|
39 |
+
/**
|
40 |
+
* XML_CATALOG_PI:
|
41 |
+
*
|
42 |
+
* The specific XML Catalog Processing Instruction name.
|
43 |
+
*/
|
44 |
+
#define XML_CATALOG_PI \
|
45 |
+
(const xmlChar *) "oasis-xml-catalog"
|
46 |
+
|
47 |
+
/*
|
48 |
+
* The API is voluntarily limited to general cataloging.
|
49 |
+
*/
|
50 |
+
typedef enum {
|
51 |
+
XML_CATA_PREFER_NONE = 0,
|
52 |
+
XML_CATA_PREFER_PUBLIC = 1,
|
53 |
+
XML_CATA_PREFER_SYSTEM
|
54 |
+
} xmlCatalogPrefer;
|
55 |
+
|
56 |
+
typedef enum {
|
57 |
+
XML_CATA_ALLOW_NONE = 0,
|
58 |
+
XML_CATA_ALLOW_GLOBAL = 1,
|
59 |
+
XML_CATA_ALLOW_DOCUMENT = 2,
|
60 |
+
XML_CATA_ALLOW_ALL = 3
|
61 |
+
} xmlCatalogAllow;
|
62 |
+
|
63 |
+
typedef struct _xmlCatalog xmlCatalog;
|
64 |
+
typedef xmlCatalog *xmlCatalogPtr;
|
65 |
+
|
66 |
+
/*
|
67 |
+
* Operations on a given catalog.
|
68 |
+
*/
|
69 |
+
XMLPUBFUN xmlCatalogPtr
|
70 |
+
xmlNewCatalog (int sgml);
|
71 |
+
XMLPUBFUN xmlCatalogPtr
|
72 |
+
xmlLoadACatalog (const char *filename);
|
73 |
+
XMLPUBFUN xmlCatalogPtr
|
74 |
+
xmlLoadSGMLSuperCatalog (const char *filename);
|
75 |
+
XMLPUBFUN int
|
76 |
+
xmlConvertSGMLCatalog (xmlCatalogPtr catal);
|
77 |
+
XMLPUBFUN int
|
78 |
+
xmlACatalogAdd (xmlCatalogPtr catal,
|
79 |
+
const xmlChar *type,
|
80 |
+
const xmlChar *orig,
|
81 |
+
const xmlChar *replace);
|
82 |
+
XMLPUBFUN int
|
83 |
+
xmlACatalogRemove (xmlCatalogPtr catal,
|
84 |
+
const xmlChar *value);
|
85 |
+
XMLPUBFUN xmlChar *
|
86 |
+
xmlACatalogResolve (xmlCatalogPtr catal,
|
87 |
+
const xmlChar *pubID,
|
88 |
+
const xmlChar *sysID);
|
89 |
+
XMLPUBFUN xmlChar *
|
90 |
+
xmlACatalogResolveSystem(xmlCatalogPtr catal,
|
91 |
+
const xmlChar *sysID);
|
92 |
+
XMLPUBFUN xmlChar *
|
93 |
+
xmlACatalogResolvePublic(xmlCatalogPtr catal,
|
94 |
+
const xmlChar *pubID);
|
95 |
+
XMLPUBFUN xmlChar *
|
96 |
+
xmlACatalogResolveURI (xmlCatalogPtr catal,
|
97 |
+
const xmlChar *URI);
|
98 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
99 |
+
XMLPUBFUN void
|
100 |
+
xmlACatalogDump (xmlCatalogPtr catal,
|
101 |
+
FILE *out);
|
102 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
103 |
+
XMLPUBFUN void
|
104 |
+
xmlFreeCatalog (xmlCatalogPtr catal);
|
105 |
+
XMLPUBFUN int
|
106 |
+
xmlCatalogIsEmpty (xmlCatalogPtr catal);
|
107 |
+
|
108 |
+
/*
|
109 |
+
* Global operations.
|
110 |
+
*/
|
111 |
+
XMLPUBFUN void
|
112 |
+
xmlInitializeCatalog (void);
|
113 |
+
XMLPUBFUN int
|
114 |
+
xmlLoadCatalog (const char *filename);
|
115 |
+
XMLPUBFUN void
|
116 |
+
xmlLoadCatalogs (const char *paths);
|
117 |
+
XMLPUBFUN void
|
118 |
+
xmlCatalogCleanup (void);
|
119 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
120 |
+
XMLPUBFUN void
|
121 |
+
xmlCatalogDump (FILE *out);
|
122 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
123 |
+
XMLPUBFUN xmlChar *
|
124 |
+
xmlCatalogResolve (const xmlChar *pubID,
|
125 |
+
const xmlChar *sysID);
|
126 |
+
XMLPUBFUN xmlChar *
|
127 |
+
xmlCatalogResolveSystem (const xmlChar *sysID);
|
128 |
+
XMLPUBFUN xmlChar *
|
129 |
+
xmlCatalogResolvePublic (const xmlChar *pubID);
|
130 |
+
XMLPUBFUN xmlChar *
|
131 |
+
xmlCatalogResolveURI (const xmlChar *URI);
|
132 |
+
XMLPUBFUN int
|
133 |
+
xmlCatalogAdd (const xmlChar *type,
|
134 |
+
const xmlChar *orig,
|
135 |
+
const xmlChar *replace);
|
136 |
+
XMLPUBFUN int
|
137 |
+
xmlCatalogRemove (const xmlChar *value);
|
138 |
+
XMLPUBFUN xmlDocPtr
|
139 |
+
xmlParseCatalogFile (const char *filename);
|
140 |
+
XMLPUBFUN int
|
141 |
+
xmlCatalogConvert (void);
|
142 |
+
|
143 |
+
/*
|
144 |
+
* Strictly minimal interfaces for per-document catalogs used
|
145 |
+
* by the parser.
|
146 |
+
*/
|
147 |
+
XMLPUBFUN void
|
148 |
+
xmlCatalogFreeLocal (void *catalogs);
|
149 |
+
XMLPUBFUN void *
|
150 |
+
xmlCatalogAddLocal (void *catalogs,
|
151 |
+
const xmlChar *URL);
|
152 |
+
XMLPUBFUN xmlChar *
|
153 |
+
xmlCatalogLocalResolve (void *catalogs,
|
154 |
+
const xmlChar *pubID,
|
155 |
+
const xmlChar *sysID);
|
156 |
+
XMLPUBFUN xmlChar *
|
157 |
+
xmlCatalogLocalResolveURI(void *catalogs,
|
158 |
+
const xmlChar *URI);
|
159 |
+
/*
|
160 |
+
* Preference settings.
|
161 |
+
*/
|
162 |
+
XMLPUBFUN int
|
163 |
+
xmlCatalogSetDebug (int level);
|
164 |
+
XMLPUBFUN xmlCatalogPrefer
|
165 |
+
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
|
166 |
+
XMLPUBFUN void
|
167 |
+
xmlCatalogSetDefaults (xmlCatalogAllow allow);
|
168 |
+
XMLPUBFUN xmlCatalogAllow
|
169 |
+
xmlCatalogGetDefaults (void);
|
170 |
+
|
171 |
+
|
172 |
+
/* DEPRECATED interfaces */
|
173 |
+
XMLPUBFUN const xmlChar *
|
174 |
+
xmlCatalogGetSystem (const xmlChar *sysID);
|
175 |
+
XMLPUBFUN const xmlChar *
|
176 |
+
xmlCatalogGetPublic (const xmlChar *pubID);
|
177 |
+
|
178 |
+
#ifdef __cplusplus
|
179 |
+
}
|
180 |
+
#endif
|
181 |
+
#endif /* LIBXML_CATALOG_ENABLED */
|
182 |
+
#endif /* __XML_CATALOG_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/chvalid.h
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: Unicode character range checking
|
3 |
+
* Description: this module exports interfaces for the character
|
4 |
+
* range validation APIs
|
5 |
+
*
|
6 |
+
* This file is automatically generated from the cvs source
|
7 |
+
* definition files using the genChRanges.py Python script
|
8 |
+
*
|
9 |
+
* Generation date: Mon Mar 27 11:09:48 2006
|
10 |
+
* Sources: chvalid.def
|
11 |
+
* Author: William Brack <[email protected]>
|
12 |
+
*/
|
13 |
+
|
14 |
+
#ifndef __XML_CHVALID_H__
|
15 |
+
#define __XML_CHVALID_H__
|
16 |
+
|
17 |
+
#include <libxml/xmlversion.h>
|
18 |
+
#include <libxml/xmlstring.h>
|
19 |
+
|
20 |
+
#ifdef __cplusplus
|
21 |
+
extern "C" {
|
22 |
+
#endif
|
23 |
+
|
24 |
+
/*
|
25 |
+
* Define our typedefs and structures
|
26 |
+
*
|
27 |
+
*/
|
28 |
+
typedef struct _xmlChSRange xmlChSRange;
|
29 |
+
typedef xmlChSRange *xmlChSRangePtr;
|
30 |
+
struct _xmlChSRange {
|
31 |
+
unsigned short low;
|
32 |
+
unsigned short high;
|
33 |
+
};
|
34 |
+
|
35 |
+
typedef struct _xmlChLRange xmlChLRange;
|
36 |
+
typedef xmlChLRange *xmlChLRangePtr;
|
37 |
+
struct _xmlChLRange {
|
38 |
+
unsigned int low;
|
39 |
+
unsigned int high;
|
40 |
+
};
|
41 |
+
|
42 |
+
typedef struct _xmlChRangeGroup xmlChRangeGroup;
|
43 |
+
typedef xmlChRangeGroup *xmlChRangeGroupPtr;
|
44 |
+
struct _xmlChRangeGroup {
|
45 |
+
int nbShortRange;
|
46 |
+
int nbLongRange;
|
47 |
+
const xmlChSRange *shortRange; /* points to an array of ranges */
|
48 |
+
const xmlChLRange *longRange;
|
49 |
+
};
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Range checking routine
|
53 |
+
*/
|
54 |
+
XMLPUBFUN int
|
55 |
+
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
|
56 |
+
|
57 |
+
|
58 |
+
/**
|
59 |
+
* xmlIsBaseChar_ch:
|
60 |
+
* @c: char to validate
|
61 |
+
*
|
62 |
+
* Automatically generated by genChRanges.py
|
63 |
+
*/
|
64 |
+
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
|
65 |
+
((0x61 <= (c)) && ((c) <= 0x7a)) || \
|
66 |
+
((0xc0 <= (c)) && ((c) <= 0xd6)) || \
|
67 |
+
((0xd8 <= (c)) && ((c) <= 0xf6)) || \
|
68 |
+
(0xf8 <= (c)))
|
69 |
+
|
70 |
+
/**
|
71 |
+
* xmlIsBaseCharQ:
|
72 |
+
* @c: char to validate
|
73 |
+
*
|
74 |
+
* Automatically generated by genChRanges.py
|
75 |
+
*/
|
76 |
+
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
|
77 |
+
xmlIsBaseChar_ch((c)) : \
|
78 |
+
xmlCharInRange((c), &xmlIsBaseCharGroup))
|
79 |
+
|
80 |
+
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
|
81 |
+
|
82 |
+
/**
|
83 |
+
* xmlIsBlank_ch:
|
84 |
+
* @c: char to validate
|
85 |
+
*
|
86 |
+
* Automatically generated by genChRanges.py
|
87 |
+
*/
|
88 |
+
#define xmlIsBlank_ch(c) (((c) == 0x20) || \
|
89 |
+
((0x9 <= (c)) && ((c) <= 0xa)) || \
|
90 |
+
((c) == 0xd))
|
91 |
+
|
92 |
+
/**
|
93 |
+
* xmlIsBlankQ:
|
94 |
+
* @c: char to validate
|
95 |
+
*
|
96 |
+
* Automatically generated by genChRanges.py
|
97 |
+
*/
|
98 |
+
#define xmlIsBlankQ(c) (((c) < 0x100) ? \
|
99 |
+
xmlIsBlank_ch((c)) : 0)
|
100 |
+
|
101 |
+
|
102 |
+
/**
|
103 |
+
* xmlIsChar_ch:
|
104 |
+
* @c: char to validate
|
105 |
+
*
|
106 |
+
* Automatically generated by genChRanges.py
|
107 |
+
*/
|
108 |
+
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
|
109 |
+
((c) == 0xd) || \
|
110 |
+
(0x20 <= (c)))
|
111 |
+
|
112 |
+
/**
|
113 |
+
* xmlIsCharQ:
|
114 |
+
* @c: char to validate
|
115 |
+
*
|
116 |
+
* Automatically generated by genChRanges.py
|
117 |
+
*/
|
118 |
+
#define xmlIsCharQ(c) (((c) < 0x100) ? \
|
119 |
+
xmlIsChar_ch((c)) :\
|
120 |
+
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
|
121 |
+
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
|
122 |
+
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
|
123 |
+
|
124 |
+
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
|
125 |
+
|
126 |
+
/**
|
127 |
+
* xmlIsCombiningQ:
|
128 |
+
* @c: char to validate
|
129 |
+
*
|
130 |
+
* Automatically generated by genChRanges.py
|
131 |
+
*/
|
132 |
+
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \
|
133 |
+
0 : \
|
134 |
+
xmlCharInRange((c), &xmlIsCombiningGroup))
|
135 |
+
|
136 |
+
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
|
137 |
+
|
138 |
+
/**
|
139 |
+
* xmlIsDigit_ch:
|
140 |
+
* @c: char to validate
|
141 |
+
*
|
142 |
+
* Automatically generated by genChRanges.py
|
143 |
+
*/
|
144 |
+
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
|
145 |
+
|
146 |
+
/**
|
147 |
+
* xmlIsDigitQ:
|
148 |
+
* @c: char to validate
|
149 |
+
*
|
150 |
+
* Automatically generated by genChRanges.py
|
151 |
+
*/
|
152 |
+
#define xmlIsDigitQ(c) (((c) < 0x100) ? \
|
153 |
+
xmlIsDigit_ch((c)) : \
|
154 |
+
xmlCharInRange((c), &xmlIsDigitGroup))
|
155 |
+
|
156 |
+
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
|
157 |
+
|
158 |
+
/**
|
159 |
+
* xmlIsExtender_ch:
|
160 |
+
* @c: char to validate
|
161 |
+
*
|
162 |
+
* Automatically generated by genChRanges.py
|
163 |
+
*/
|
164 |
+
#define xmlIsExtender_ch(c) (((c) == 0xb7))
|
165 |
+
|
166 |
+
/**
|
167 |
+
* xmlIsExtenderQ:
|
168 |
+
* @c: char to validate
|
169 |
+
*
|
170 |
+
* Automatically generated by genChRanges.py
|
171 |
+
*/
|
172 |
+
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \
|
173 |
+
xmlIsExtender_ch((c)) : \
|
174 |
+
xmlCharInRange((c), &xmlIsExtenderGroup))
|
175 |
+
|
176 |
+
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
|
177 |
+
|
178 |
+
/**
|
179 |
+
* xmlIsIdeographicQ:
|
180 |
+
* @c: char to validate
|
181 |
+
*
|
182 |
+
* Automatically generated by genChRanges.py
|
183 |
+
*/
|
184 |
+
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
|
185 |
+
0 :\
|
186 |
+
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
|
187 |
+
((c) == 0x3007) || \
|
188 |
+
((0x3021 <= (c)) && ((c) <= 0x3029))))
|
189 |
+
|
190 |
+
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
|
191 |
+
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
|
192 |
+
|
193 |
+
/**
|
194 |
+
* xmlIsPubidChar_ch:
|
195 |
+
* @c: char to validate
|
196 |
+
*
|
197 |
+
* Automatically generated by genChRanges.py
|
198 |
+
*/
|
199 |
+
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
|
200 |
+
|
201 |
+
/**
|
202 |
+
* xmlIsPubidCharQ:
|
203 |
+
* @c: char to validate
|
204 |
+
*
|
205 |
+
* Automatically generated by genChRanges.py
|
206 |
+
*/
|
207 |
+
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
|
208 |
+
xmlIsPubidChar_ch((c)) : 0)
|
209 |
+
|
210 |
+
XMLPUBFUN int
|
211 |
+
xmlIsBaseChar(unsigned int ch);
|
212 |
+
XMLPUBFUN int
|
213 |
+
xmlIsBlank(unsigned int ch);
|
214 |
+
XMLPUBFUN int
|
215 |
+
xmlIsChar(unsigned int ch);
|
216 |
+
XMLPUBFUN int
|
217 |
+
xmlIsCombining(unsigned int ch);
|
218 |
+
XMLPUBFUN int
|
219 |
+
xmlIsDigit(unsigned int ch);
|
220 |
+
XMLPUBFUN int
|
221 |
+
xmlIsExtender(unsigned int ch);
|
222 |
+
XMLPUBFUN int
|
223 |
+
xmlIsIdeographic(unsigned int ch);
|
224 |
+
XMLPUBFUN int
|
225 |
+
xmlIsPubidChar(unsigned int ch);
|
226 |
+
|
227 |
+
#ifdef __cplusplus
|
228 |
+
}
|
229 |
+
#endif
|
230 |
+
#endif /* __XML_CHVALID_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/debugXML.h
ADDED
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: Tree debugging APIs
|
3 |
+
* Description: Interfaces to a set of routines used for debugging the tree
|
4 |
+
* produced by the XML parser.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __DEBUG_XML__
|
12 |
+
#define __DEBUG_XML__
|
13 |
+
#include <stdio.h>
|
14 |
+
#include <libxml/xmlversion.h>
|
15 |
+
#include <libxml/tree.h>
|
16 |
+
|
17 |
+
#ifdef LIBXML_DEBUG_ENABLED
|
18 |
+
|
19 |
+
#include <libxml/xpath.h>
|
20 |
+
|
21 |
+
#ifdef __cplusplus
|
22 |
+
extern "C" {
|
23 |
+
#endif
|
24 |
+
|
25 |
+
/*
|
26 |
+
* The standard Dump routines.
|
27 |
+
*/
|
28 |
+
XMLPUBFUN void
|
29 |
+
xmlDebugDumpString (FILE *output,
|
30 |
+
const xmlChar *str);
|
31 |
+
XMLPUBFUN void
|
32 |
+
xmlDebugDumpAttr (FILE *output,
|
33 |
+
xmlAttrPtr attr,
|
34 |
+
int depth);
|
35 |
+
XMLPUBFUN void
|
36 |
+
xmlDebugDumpAttrList (FILE *output,
|
37 |
+
xmlAttrPtr attr,
|
38 |
+
int depth);
|
39 |
+
XMLPUBFUN void
|
40 |
+
xmlDebugDumpOneNode (FILE *output,
|
41 |
+
xmlNodePtr node,
|
42 |
+
int depth);
|
43 |
+
XMLPUBFUN void
|
44 |
+
xmlDebugDumpNode (FILE *output,
|
45 |
+
xmlNodePtr node,
|
46 |
+
int depth);
|
47 |
+
XMLPUBFUN void
|
48 |
+
xmlDebugDumpNodeList (FILE *output,
|
49 |
+
xmlNodePtr node,
|
50 |
+
int depth);
|
51 |
+
XMLPUBFUN void
|
52 |
+
xmlDebugDumpDocumentHead(FILE *output,
|
53 |
+
xmlDocPtr doc);
|
54 |
+
XMLPUBFUN void
|
55 |
+
xmlDebugDumpDocument (FILE *output,
|
56 |
+
xmlDocPtr doc);
|
57 |
+
XMLPUBFUN void
|
58 |
+
xmlDebugDumpDTD (FILE *output,
|
59 |
+
xmlDtdPtr dtd);
|
60 |
+
XMLPUBFUN void
|
61 |
+
xmlDebugDumpEntities (FILE *output,
|
62 |
+
xmlDocPtr doc);
|
63 |
+
|
64 |
+
/****************************************************************
|
65 |
+
* *
|
66 |
+
* Checking routines *
|
67 |
+
* *
|
68 |
+
****************************************************************/
|
69 |
+
|
70 |
+
XMLPUBFUN int
|
71 |
+
xmlDebugCheckDocument (FILE * output,
|
72 |
+
xmlDocPtr doc);
|
73 |
+
|
74 |
+
/****************************************************************
|
75 |
+
* *
|
76 |
+
* XML shell helpers *
|
77 |
+
* *
|
78 |
+
****************************************************************/
|
79 |
+
|
80 |
+
XMLPUBFUN void
|
81 |
+
xmlLsOneNode (FILE *output, xmlNodePtr node);
|
82 |
+
XMLPUBFUN int
|
83 |
+
xmlLsCountNode (xmlNodePtr node);
|
84 |
+
|
85 |
+
XMLPUBFUN const char *
|
86 |
+
xmlBoolToText (int boolval);
|
87 |
+
|
88 |
+
/****************************************************************
|
89 |
+
* *
|
90 |
+
* The XML shell related structures and functions *
|
91 |
+
* *
|
92 |
+
****************************************************************/
|
93 |
+
|
94 |
+
#ifdef LIBXML_XPATH_ENABLED
|
95 |
+
/**
|
96 |
+
* xmlShellReadlineFunc:
|
97 |
+
* @prompt: a string prompt
|
98 |
+
*
|
99 |
+
* This is a generic signature for the XML shell input function.
|
100 |
+
*
|
101 |
+
* Returns a string which will be freed by the Shell.
|
102 |
+
*/
|
103 |
+
typedef char * (* xmlShellReadlineFunc)(char *prompt);
|
104 |
+
|
105 |
+
/**
|
106 |
+
* xmlShellCtxt:
|
107 |
+
*
|
108 |
+
* A debugging shell context.
|
109 |
+
* TODO: add the defined function tables.
|
110 |
+
*/
|
111 |
+
typedef struct _xmlShellCtxt xmlShellCtxt;
|
112 |
+
typedef xmlShellCtxt *xmlShellCtxtPtr;
|
113 |
+
struct _xmlShellCtxt {
|
114 |
+
char *filename;
|
115 |
+
xmlDocPtr doc;
|
116 |
+
xmlNodePtr node;
|
117 |
+
xmlXPathContextPtr pctxt;
|
118 |
+
int loaded;
|
119 |
+
FILE *output;
|
120 |
+
xmlShellReadlineFunc input;
|
121 |
+
};
|
122 |
+
|
123 |
+
/**
|
124 |
+
* xmlShellCmd:
|
125 |
+
* @ctxt: a shell context
|
126 |
+
* @arg: a string argument
|
127 |
+
* @node: a first node
|
128 |
+
* @node2: a second node
|
129 |
+
*
|
130 |
+
* This is a generic signature for the XML shell functions.
|
131 |
+
*
|
132 |
+
* Returns an int, negative returns indicating errors.
|
133 |
+
*/
|
134 |
+
typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
|
135 |
+
char *arg,
|
136 |
+
xmlNodePtr node,
|
137 |
+
xmlNodePtr node2);
|
138 |
+
|
139 |
+
XMLPUBFUN void
|
140 |
+
xmlShellPrintXPathError (int errorType,
|
141 |
+
const char *arg);
|
142 |
+
XMLPUBFUN void
|
143 |
+
xmlShellPrintXPathResult(xmlXPathObjectPtr list);
|
144 |
+
XMLPUBFUN int
|
145 |
+
xmlShellList (xmlShellCtxtPtr ctxt,
|
146 |
+
char *arg,
|
147 |
+
xmlNodePtr node,
|
148 |
+
xmlNodePtr node2);
|
149 |
+
XMLPUBFUN int
|
150 |
+
xmlShellBase (xmlShellCtxtPtr ctxt,
|
151 |
+
char *arg,
|
152 |
+
xmlNodePtr node,
|
153 |
+
xmlNodePtr node2);
|
154 |
+
XMLPUBFUN int
|
155 |
+
xmlShellDir (xmlShellCtxtPtr ctxt,
|
156 |
+
char *arg,
|
157 |
+
xmlNodePtr node,
|
158 |
+
xmlNodePtr node2);
|
159 |
+
XMLPUBFUN int
|
160 |
+
xmlShellLoad (xmlShellCtxtPtr ctxt,
|
161 |
+
char *filename,
|
162 |
+
xmlNodePtr node,
|
163 |
+
xmlNodePtr node2);
|
164 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
165 |
+
XMLPUBFUN void
|
166 |
+
xmlShellPrintNode (xmlNodePtr node);
|
167 |
+
XMLPUBFUN int
|
168 |
+
xmlShellCat (xmlShellCtxtPtr ctxt,
|
169 |
+
char *arg,
|
170 |
+
xmlNodePtr node,
|
171 |
+
xmlNodePtr node2);
|
172 |
+
XMLPUBFUN int
|
173 |
+
xmlShellWrite (xmlShellCtxtPtr ctxt,
|
174 |
+
char *filename,
|
175 |
+
xmlNodePtr node,
|
176 |
+
xmlNodePtr node2);
|
177 |
+
XMLPUBFUN int
|
178 |
+
xmlShellSave (xmlShellCtxtPtr ctxt,
|
179 |
+
char *filename,
|
180 |
+
xmlNodePtr node,
|
181 |
+
xmlNodePtr node2);
|
182 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
183 |
+
#ifdef LIBXML_VALID_ENABLED
|
184 |
+
XMLPUBFUN int
|
185 |
+
xmlShellValidate (xmlShellCtxtPtr ctxt,
|
186 |
+
char *dtd,
|
187 |
+
xmlNodePtr node,
|
188 |
+
xmlNodePtr node2);
|
189 |
+
#endif /* LIBXML_VALID_ENABLED */
|
190 |
+
XMLPUBFUN int
|
191 |
+
xmlShellDu (xmlShellCtxtPtr ctxt,
|
192 |
+
char *arg,
|
193 |
+
xmlNodePtr tree,
|
194 |
+
xmlNodePtr node2);
|
195 |
+
XMLPUBFUN int
|
196 |
+
xmlShellPwd (xmlShellCtxtPtr ctxt,
|
197 |
+
char *buffer,
|
198 |
+
xmlNodePtr node,
|
199 |
+
xmlNodePtr node2);
|
200 |
+
|
201 |
+
/*
|
202 |
+
* The Shell interface.
|
203 |
+
*/
|
204 |
+
XMLPUBFUN void
|
205 |
+
xmlShell (xmlDocPtr doc,
|
206 |
+
char *filename,
|
207 |
+
xmlShellReadlineFunc input,
|
208 |
+
FILE *output);
|
209 |
+
|
210 |
+
#endif /* LIBXML_XPATH_ENABLED */
|
211 |
+
|
212 |
+
#ifdef __cplusplus
|
213 |
+
}
|
214 |
+
#endif
|
215 |
+
|
216 |
+
#endif /* LIBXML_DEBUG_ENABLED */
|
217 |
+
#endif /* __DEBUG_XML__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/entities.h
ADDED
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: interface for the XML entities handling
|
3 |
+
* Description: this module provides some of the entity API needed
|
4 |
+
* for the parser and applications.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __XML_ENTITIES_H__
|
12 |
+
#define __XML_ENTITIES_H__
|
13 |
+
|
14 |
+
#include <libxml/xmlversion.h>
|
15 |
+
#define XML_TREE_INTERNALS
|
16 |
+
#include <libxml/tree.h>
|
17 |
+
#undef XML_TREE_INTERNALS
|
18 |
+
|
19 |
+
#ifdef __cplusplus
|
20 |
+
extern "C" {
|
21 |
+
#endif
|
22 |
+
|
23 |
+
/*
|
24 |
+
* The different valid entity types.
|
25 |
+
*/
|
26 |
+
typedef enum {
|
27 |
+
XML_INTERNAL_GENERAL_ENTITY = 1,
|
28 |
+
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
|
29 |
+
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
|
30 |
+
XML_INTERNAL_PARAMETER_ENTITY = 4,
|
31 |
+
XML_EXTERNAL_PARAMETER_ENTITY = 5,
|
32 |
+
XML_INTERNAL_PREDEFINED_ENTITY = 6
|
33 |
+
} xmlEntityType;
|
34 |
+
|
35 |
+
/*
|
36 |
+
* An unit of storage for an entity, contains the string, the value
|
37 |
+
* and the linkind data needed for the linking in the hash table.
|
38 |
+
*/
|
39 |
+
|
40 |
+
struct _xmlEntity {
|
41 |
+
void *_private; /* application data */
|
42 |
+
xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
|
43 |
+
const xmlChar *name; /* Entity name */
|
44 |
+
struct _xmlNode *children; /* First child link */
|
45 |
+
struct _xmlNode *last; /* Last child link */
|
46 |
+
struct _xmlDtd *parent; /* -> DTD */
|
47 |
+
struct _xmlNode *next; /* next sibling link */
|
48 |
+
struct _xmlNode *prev; /* previous sibling link */
|
49 |
+
struct _xmlDoc *doc; /* the containing document */
|
50 |
+
|
51 |
+
xmlChar *orig; /* content without ref substitution */
|
52 |
+
xmlChar *content; /* content or ndata if unparsed */
|
53 |
+
int length; /* the content length */
|
54 |
+
xmlEntityType etype; /* The entity type */
|
55 |
+
const xmlChar *ExternalID; /* External identifier for PUBLIC */
|
56 |
+
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
|
57 |
+
|
58 |
+
struct _xmlEntity *nexte; /* unused */
|
59 |
+
const xmlChar *URI; /* the full URI as computed */
|
60 |
+
int owner; /* does the entity own the childrens */
|
61 |
+
int flags; /* various flags */
|
62 |
+
unsigned long expandedSize; /* expanded size */
|
63 |
+
};
|
64 |
+
|
65 |
+
/*
|
66 |
+
* All entities are stored in an hash table.
|
67 |
+
* There is 2 separate hash tables for global and parameter entities.
|
68 |
+
*/
|
69 |
+
|
70 |
+
typedef struct _xmlHashTable xmlEntitiesTable;
|
71 |
+
typedef xmlEntitiesTable *xmlEntitiesTablePtr;
|
72 |
+
|
73 |
+
/*
|
74 |
+
* External functions:
|
75 |
+
*/
|
76 |
+
|
77 |
+
#ifdef LIBXML_LEGACY_ENABLED
|
78 |
+
XML_DEPRECATED
|
79 |
+
XMLPUBFUN void
|
80 |
+
xmlInitializePredefinedEntities (void);
|
81 |
+
#endif /* LIBXML_LEGACY_ENABLED */
|
82 |
+
|
83 |
+
XMLPUBFUN xmlEntityPtr
|
84 |
+
xmlNewEntity (xmlDocPtr doc,
|
85 |
+
const xmlChar *name,
|
86 |
+
int type,
|
87 |
+
const xmlChar *ExternalID,
|
88 |
+
const xmlChar *SystemID,
|
89 |
+
const xmlChar *content);
|
90 |
+
XMLPUBFUN void
|
91 |
+
xmlFreeEntity (xmlEntityPtr entity);
|
92 |
+
XMLPUBFUN xmlEntityPtr
|
93 |
+
xmlAddDocEntity (xmlDocPtr doc,
|
94 |
+
const xmlChar *name,
|
95 |
+
int type,
|
96 |
+
const xmlChar *ExternalID,
|
97 |
+
const xmlChar *SystemID,
|
98 |
+
const xmlChar *content);
|
99 |
+
XMLPUBFUN xmlEntityPtr
|
100 |
+
xmlAddDtdEntity (xmlDocPtr doc,
|
101 |
+
const xmlChar *name,
|
102 |
+
int type,
|
103 |
+
const xmlChar *ExternalID,
|
104 |
+
const xmlChar *SystemID,
|
105 |
+
const xmlChar *content);
|
106 |
+
XMLPUBFUN xmlEntityPtr
|
107 |
+
xmlGetPredefinedEntity (const xmlChar *name);
|
108 |
+
XMLPUBFUN xmlEntityPtr
|
109 |
+
xmlGetDocEntity (const xmlDoc *doc,
|
110 |
+
const xmlChar *name);
|
111 |
+
XMLPUBFUN xmlEntityPtr
|
112 |
+
xmlGetDtdEntity (xmlDocPtr doc,
|
113 |
+
const xmlChar *name);
|
114 |
+
XMLPUBFUN xmlEntityPtr
|
115 |
+
xmlGetParameterEntity (xmlDocPtr doc,
|
116 |
+
const xmlChar *name);
|
117 |
+
#ifdef LIBXML_LEGACY_ENABLED
|
118 |
+
XML_DEPRECATED
|
119 |
+
XMLPUBFUN const xmlChar *
|
120 |
+
xmlEncodeEntities (xmlDocPtr doc,
|
121 |
+
const xmlChar *input);
|
122 |
+
#endif /* LIBXML_LEGACY_ENABLED */
|
123 |
+
XMLPUBFUN xmlChar *
|
124 |
+
xmlEncodeEntitiesReentrant(xmlDocPtr doc,
|
125 |
+
const xmlChar *input);
|
126 |
+
XMLPUBFUN xmlChar *
|
127 |
+
xmlEncodeSpecialChars (const xmlDoc *doc,
|
128 |
+
const xmlChar *input);
|
129 |
+
XMLPUBFUN xmlEntitiesTablePtr
|
130 |
+
xmlCreateEntitiesTable (void);
|
131 |
+
#ifdef LIBXML_TREE_ENABLED
|
132 |
+
XMLPUBFUN xmlEntitiesTablePtr
|
133 |
+
xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
|
134 |
+
#endif /* LIBXML_TREE_ENABLED */
|
135 |
+
XMLPUBFUN void
|
136 |
+
xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
|
137 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
138 |
+
XMLPUBFUN void
|
139 |
+
xmlDumpEntitiesTable (xmlBufferPtr buf,
|
140 |
+
xmlEntitiesTablePtr table);
|
141 |
+
XMLPUBFUN void
|
142 |
+
xmlDumpEntityDecl (xmlBufferPtr buf,
|
143 |
+
xmlEntityPtr ent);
|
144 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
145 |
+
#ifdef LIBXML_LEGACY_ENABLED
|
146 |
+
XMLPUBFUN void
|
147 |
+
xmlCleanupPredefinedEntities(void);
|
148 |
+
#endif /* LIBXML_LEGACY_ENABLED */
|
149 |
+
|
150 |
+
|
151 |
+
#ifdef __cplusplus
|
152 |
+
}
|
153 |
+
#endif
|
154 |
+
|
155 |
+
# endif /* __XML_ENTITIES_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/hash.h
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: Chained hash tables
|
3 |
+
* Description: This module implements the hash table support used in
|
4 |
+
* various places in the library.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Bjorn Reese <[email protected]>
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __XML_HASH_H__
|
12 |
+
#define __XML_HASH_H__
|
13 |
+
|
14 |
+
#include <libxml/xmlversion.h>
|
15 |
+
#include <libxml/dict.h>
|
16 |
+
#include <libxml/xmlstring.h>
|
17 |
+
|
18 |
+
#ifdef __cplusplus
|
19 |
+
extern "C" {
|
20 |
+
#endif
|
21 |
+
|
22 |
+
/*
|
23 |
+
* The hash table.
|
24 |
+
*/
|
25 |
+
typedef struct _xmlHashTable xmlHashTable;
|
26 |
+
typedef xmlHashTable *xmlHashTablePtr;
|
27 |
+
|
28 |
+
/*
|
29 |
+
* Recent version of gcc produce a warning when a function pointer is assigned
|
30 |
+
* to an object pointer, or vice versa. The following macro is a dirty hack
|
31 |
+
* to allow suppression of the warning. If your architecture has function
|
32 |
+
* pointers which are a different size than a void pointer, there may be some
|
33 |
+
* serious trouble within the library.
|
34 |
+
*/
|
35 |
+
/**
|
36 |
+
* XML_CAST_FPTR:
|
37 |
+
* @fptr: pointer to a function
|
38 |
+
*
|
39 |
+
* Macro to do a casting from an object pointer to a
|
40 |
+
* function pointer without encountering a warning from
|
41 |
+
* gcc
|
42 |
+
*
|
43 |
+
* #define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
|
44 |
+
* This macro violated ISO C aliasing rules (gcc4 on s390 broke)
|
45 |
+
* so it is disabled now
|
46 |
+
*/
|
47 |
+
|
48 |
+
#define XML_CAST_FPTR(fptr) fptr
|
49 |
+
|
50 |
+
/*
|
51 |
+
* function types:
|
52 |
+
*/
|
53 |
+
/**
|
54 |
+
* xmlHashDeallocator:
|
55 |
+
* @payload: the data in the hash
|
56 |
+
* @name: the name associated
|
57 |
+
*
|
58 |
+
* Callback to free data from a hash.
|
59 |
+
*/
|
60 |
+
typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
|
61 |
+
/**
|
62 |
+
* xmlHashCopier:
|
63 |
+
* @payload: the data in the hash
|
64 |
+
* @name: the name associated
|
65 |
+
*
|
66 |
+
* Callback to copy data from a hash.
|
67 |
+
*
|
68 |
+
* Returns a copy of the data or NULL in case of error.
|
69 |
+
*/
|
70 |
+
typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
|
71 |
+
/**
|
72 |
+
* xmlHashScanner:
|
73 |
+
* @payload: the data in the hash
|
74 |
+
* @data: extra scanner data
|
75 |
+
* @name: the name associated
|
76 |
+
*
|
77 |
+
* Callback when scanning data in a hash with the simple scanner.
|
78 |
+
*/
|
79 |
+
typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
|
80 |
+
/**
|
81 |
+
* xmlHashScannerFull:
|
82 |
+
* @payload: the data in the hash
|
83 |
+
* @data: extra scanner data
|
84 |
+
* @name: the name associated
|
85 |
+
* @name2: the second name associated
|
86 |
+
* @name3: the third name associated
|
87 |
+
*
|
88 |
+
* Callback when scanning data in a hash with the full scanner.
|
89 |
+
*/
|
90 |
+
typedef void (*xmlHashScannerFull)(void *payload, void *data,
|
91 |
+
const xmlChar *name, const xmlChar *name2,
|
92 |
+
const xmlChar *name3);
|
93 |
+
|
94 |
+
/*
|
95 |
+
* Constructor and destructor.
|
96 |
+
*/
|
97 |
+
XMLPUBFUN xmlHashTablePtr
|
98 |
+
xmlHashCreate (int size);
|
99 |
+
XMLPUBFUN xmlHashTablePtr
|
100 |
+
xmlHashCreateDict (int size,
|
101 |
+
xmlDictPtr dict);
|
102 |
+
XMLPUBFUN void
|
103 |
+
xmlHashFree (xmlHashTablePtr hash,
|
104 |
+
xmlHashDeallocator dealloc);
|
105 |
+
XMLPUBFUN void
|
106 |
+
xmlHashDefaultDeallocator(void *entry,
|
107 |
+
const xmlChar *name);
|
108 |
+
|
109 |
+
/*
|
110 |
+
* Add a new entry to the hash table.
|
111 |
+
*/
|
112 |
+
XMLPUBFUN int
|
113 |
+
xmlHashAddEntry (xmlHashTablePtr hash,
|
114 |
+
const xmlChar *name,
|
115 |
+
void *userdata);
|
116 |
+
XMLPUBFUN int
|
117 |
+
xmlHashUpdateEntry (xmlHashTablePtr hash,
|
118 |
+
const xmlChar *name,
|
119 |
+
void *userdata,
|
120 |
+
xmlHashDeallocator dealloc);
|
121 |
+
XMLPUBFUN int
|
122 |
+
xmlHashAddEntry2 (xmlHashTablePtr hash,
|
123 |
+
const xmlChar *name,
|
124 |
+
const xmlChar *name2,
|
125 |
+
void *userdata);
|
126 |
+
XMLPUBFUN int
|
127 |
+
xmlHashUpdateEntry2 (xmlHashTablePtr hash,
|
128 |
+
const xmlChar *name,
|
129 |
+
const xmlChar *name2,
|
130 |
+
void *userdata,
|
131 |
+
xmlHashDeallocator dealloc);
|
132 |
+
XMLPUBFUN int
|
133 |
+
xmlHashAddEntry3 (xmlHashTablePtr hash,
|
134 |
+
const xmlChar *name,
|
135 |
+
const xmlChar *name2,
|
136 |
+
const xmlChar *name3,
|
137 |
+
void *userdata);
|
138 |
+
XMLPUBFUN int
|
139 |
+
xmlHashUpdateEntry3 (xmlHashTablePtr hash,
|
140 |
+
const xmlChar *name,
|
141 |
+
const xmlChar *name2,
|
142 |
+
const xmlChar *name3,
|
143 |
+
void *userdata,
|
144 |
+
xmlHashDeallocator dealloc);
|
145 |
+
|
146 |
+
/*
|
147 |
+
* Remove an entry from the hash table.
|
148 |
+
*/
|
149 |
+
XMLPUBFUN int
|
150 |
+
xmlHashRemoveEntry (xmlHashTablePtr hash,
|
151 |
+
const xmlChar *name,
|
152 |
+
xmlHashDeallocator dealloc);
|
153 |
+
XMLPUBFUN int
|
154 |
+
xmlHashRemoveEntry2 (xmlHashTablePtr hash,
|
155 |
+
const xmlChar *name,
|
156 |
+
const xmlChar *name2,
|
157 |
+
xmlHashDeallocator dealloc);
|
158 |
+
XMLPUBFUN int
|
159 |
+
xmlHashRemoveEntry3 (xmlHashTablePtr hash,
|
160 |
+
const xmlChar *name,
|
161 |
+
const xmlChar *name2,
|
162 |
+
const xmlChar *name3,
|
163 |
+
xmlHashDeallocator dealloc);
|
164 |
+
|
165 |
+
/*
|
166 |
+
* Retrieve the payload.
|
167 |
+
*/
|
168 |
+
XMLPUBFUN void *
|
169 |
+
xmlHashLookup (xmlHashTablePtr hash,
|
170 |
+
const xmlChar *name);
|
171 |
+
XMLPUBFUN void *
|
172 |
+
xmlHashLookup2 (xmlHashTablePtr hash,
|
173 |
+
const xmlChar *name,
|
174 |
+
const xmlChar *name2);
|
175 |
+
XMLPUBFUN void *
|
176 |
+
xmlHashLookup3 (xmlHashTablePtr hash,
|
177 |
+
const xmlChar *name,
|
178 |
+
const xmlChar *name2,
|
179 |
+
const xmlChar *name3);
|
180 |
+
XMLPUBFUN void *
|
181 |
+
xmlHashQLookup (xmlHashTablePtr hash,
|
182 |
+
const xmlChar *prefix,
|
183 |
+
const xmlChar *name);
|
184 |
+
XMLPUBFUN void *
|
185 |
+
xmlHashQLookup2 (xmlHashTablePtr hash,
|
186 |
+
const xmlChar *prefix,
|
187 |
+
const xmlChar *name,
|
188 |
+
const xmlChar *prefix2,
|
189 |
+
const xmlChar *name2);
|
190 |
+
XMLPUBFUN void *
|
191 |
+
xmlHashQLookup3 (xmlHashTablePtr hash,
|
192 |
+
const xmlChar *prefix,
|
193 |
+
const xmlChar *name,
|
194 |
+
const xmlChar *prefix2,
|
195 |
+
const xmlChar *name2,
|
196 |
+
const xmlChar *prefix3,
|
197 |
+
const xmlChar *name3);
|
198 |
+
|
199 |
+
/*
|
200 |
+
* Helpers.
|
201 |
+
*/
|
202 |
+
XMLPUBFUN xmlHashTablePtr
|
203 |
+
xmlHashCopy (xmlHashTablePtr hash,
|
204 |
+
xmlHashCopier copy);
|
205 |
+
XMLPUBFUN int
|
206 |
+
xmlHashSize (xmlHashTablePtr hash);
|
207 |
+
XMLPUBFUN void
|
208 |
+
xmlHashScan (xmlHashTablePtr hash,
|
209 |
+
xmlHashScanner scan,
|
210 |
+
void *data);
|
211 |
+
XMLPUBFUN void
|
212 |
+
xmlHashScan3 (xmlHashTablePtr hash,
|
213 |
+
const xmlChar *name,
|
214 |
+
const xmlChar *name2,
|
215 |
+
const xmlChar *name3,
|
216 |
+
xmlHashScanner scan,
|
217 |
+
void *data);
|
218 |
+
XMLPUBFUN void
|
219 |
+
xmlHashScanFull (xmlHashTablePtr hash,
|
220 |
+
xmlHashScannerFull scan,
|
221 |
+
void *data);
|
222 |
+
XMLPUBFUN void
|
223 |
+
xmlHashScanFull3 (xmlHashTablePtr hash,
|
224 |
+
const xmlChar *name,
|
225 |
+
const xmlChar *name2,
|
226 |
+
const xmlChar *name3,
|
227 |
+
xmlHashScannerFull scan,
|
228 |
+
void *data);
|
229 |
+
#ifdef __cplusplus
|
230 |
+
}
|
231 |
+
#endif
|
232 |
+
#endif /* ! __XML_HASH_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/list.h
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: lists interfaces
|
3 |
+
* Description: this module implement the list support used in
|
4 |
+
* various place in the library.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Gary Pennington <[email protected]>
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __XML_LINK_INCLUDE__
|
12 |
+
#define __XML_LINK_INCLUDE__
|
13 |
+
|
14 |
+
#include <libxml/xmlversion.h>
|
15 |
+
|
16 |
+
#ifdef __cplusplus
|
17 |
+
extern "C" {
|
18 |
+
#endif
|
19 |
+
|
20 |
+
typedef struct _xmlLink xmlLink;
|
21 |
+
typedef xmlLink *xmlLinkPtr;
|
22 |
+
|
23 |
+
typedef struct _xmlList xmlList;
|
24 |
+
typedef xmlList *xmlListPtr;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* xmlListDeallocator:
|
28 |
+
* @lk: the data to deallocate
|
29 |
+
*
|
30 |
+
* Callback function used to free data from a list.
|
31 |
+
*/
|
32 |
+
typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
|
33 |
+
/**
|
34 |
+
* xmlListDataCompare:
|
35 |
+
* @data0: the first data
|
36 |
+
* @data1: the second data
|
37 |
+
*
|
38 |
+
* Callback function used to compare 2 data.
|
39 |
+
*
|
40 |
+
* Returns 0 is equality, -1 or 1 otherwise depending on the ordering.
|
41 |
+
*/
|
42 |
+
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
|
43 |
+
/**
|
44 |
+
* xmlListWalker:
|
45 |
+
* @data: the data found in the list
|
46 |
+
* @user: extra user provided data to the walker
|
47 |
+
*
|
48 |
+
* Callback function used when walking a list with xmlListWalk().
|
49 |
+
*
|
50 |
+
* Returns 0 to stop walking the list, 1 otherwise.
|
51 |
+
*/
|
52 |
+
typedef int (*xmlListWalker) (const void *data, void *user);
|
53 |
+
|
54 |
+
/* Creation/Deletion */
|
55 |
+
XMLPUBFUN xmlListPtr
|
56 |
+
xmlListCreate (xmlListDeallocator deallocator,
|
57 |
+
xmlListDataCompare compare);
|
58 |
+
XMLPUBFUN void
|
59 |
+
xmlListDelete (xmlListPtr l);
|
60 |
+
|
61 |
+
/* Basic Operators */
|
62 |
+
XMLPUBFUN void *
|
63 |
+
xmlListSearch (xmlListPtr l,
|
64 |
+
void *data);
|
65 |
+
XMLPUBFUN void *
|
66 |
+
xmlListReverseSearch (xmlListPtr l,
|
67 |
+
void *data);
|
68 |
+
XMLPUBFUN int
|
69 |
+
xmlListInsert (xmlListPtr l,
|
70 |
+
void *data) ;
|
71 |
+
XMLPUBFUN int
|
72 |
+
xmlListAppend (xmlListPtr l,
|
73 |
+
void *data) ;
|
74 |
+
XMLPUBFUN int
|
75 |
+
xmlListRemoveFirst (xmlListPtr l,
|
76 |
+
void *data);
|
77 |
+
XMLPUBFUN int
|
78 |
+
xmlListRemoveLast (xmlListPtr l,
|
79 |
+
void *data);
|
80 |
+
XMLPUBFUN int
|
81 |
+
xmlListRemoveAll (xmlListPtr l,
|
82 |
+
void *data);
|
83 |
+
XMLPUBFUN void
|
84 |
+
xmlListClear (xmlListPtr l);
|
85 |
+
XMLPUBFUN int
|
86 |
+
xmlListEmpty (xmlListPtr l);
|
87 |
+
XMLPUBFUN xmlLinkPtr
|
88 |
+
xmlListFront (xmlListPtr l);
|
89 |
+
XMLPUBFUN xmlLinkPtr
|
90 |
+
xmlListEnd (xmlListPtr l);
|
91 |
+
XMLPUBFUN int
|
92 |
+
xmlListSize (xmlListPtr l);
|
93 |
+
|
94 |
+
XMLPUBFUN void
|
95 |
+
xmlListPopFront (xmlListPtr l);
|
96 |
+
XMLPUBFUN void
|
97 |
+
xmlListPopBack (xmlListPtr l);
|
98 |
+
XMLPUBFUN int
|
99 |
+
xmlListPushFront (xmlListPtr l,
|
100 |
+
void *data);
|
101 |
+
XMLPUBFUN int
|
102 |
+
xmlListPushBack (xmlListPtr l,
|
103 |
+
void *data);
|
104 |
+
|
105 |
+
/* Advanced Operators */
|
106 |
+
XMLPUBFUN void
|
107 |
+
xmlListReverse (xmlListPtr l);
|
108 |
+
XMLPUBFUN void
|
109 |
+
xmlListSort (xmlListPtr l);
|
110 |
+
XMLPUBFUN void
|
111 |
+
xmlListWalk (xmlListPtr l,
|
112 |
+
xmlListWalker walker,
|
113 |
+
void *user);
|
114 |
+
XMLPUBFUN void
|
115 |
+
xmlListReverseWalk (xmlListPtr l,
|
116 |
+
xmlListWalker walker,
|
117 |
+
void *user);
|
118 |
+
XMLPUBFUN void
|
119 |
+
xmlListMerge (xmlListPtr l1,
|
120 |
+
xmlListPtr l2);
|
121 |
+
XMLPUBFUN xmlListPtr
|
122 |
+
xmlListDup (const xmlListPtr old);
|
123 |
+
XMLPUBFUN int
|
124 |
+
xmlListCopy (xmlListPtr cur,
|
125 |
+
const xmlListPtr old);
|
126 |
+
/* Link operators */
|
127 |
+
XMLPUBFUN void *
|
128 |
+
xmlLinkGetData (xmlLinkPtr lk);
|
129 |
+
|
130 |
+
/* xmlListUnique() */
|
131 |
+
/* xmlListSwap */
|
132 |
+
|
133 |
+
#ifdef __cplusplus
|
134 |
+
}
|
135 |
+
#endif
|
136 |
+
|
137 |
+
#endif /* __XML_LINK_INCLUDE__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/nanoftp.h
ADDED
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: minimal FTP implementation
|
3 |
+
* Description: minimal FTP implementation allowing to fetch resources
|
4 |
+
* like external subset. This module is DEPRECATED, do not
|
5 |
+
* use any of its functions.
|
6 |
+
*
|
7 |
+
* Copy: See Copyright for the status of this software.
|
8 |
+
*
|
9 |
+
* Author: Daniel Veillard
|
10 |
+
*/
|
11 |
+
|
12 |
+
#ifndef __NANO_FTP_H__
|
13 |
+
#define __NANO_FTP_H__
|
14 |
+
|
15 |
+
#include <libxml/xmlversion.h>
|
16 |
+
|
17 |
+
#if defined(LIBXML_FTP_ENABLED)
|
18 |
+
|
19 |
+
/* Needed for portability to Windows 64 bits */
|
20 |
+
#if defined(_WIN32)
|
21 |
+
#include <winsock2.h>
|
22 |
+
#else
|
23 |
+
/**
|
24 |
+
* SOCKET:
|
25 |
+
*
|
26 |
+
* macro used to provide portability of code to windows sockets
|
27 |
+
*/
|
28 |
+
#define SOCKET int
|
29 |
+
/**
|
30 |
+
* INVALID_SOCKET:
|
31 |
+
*
|
32 |
+
* macro used to provide portability of code to windows sockets
|
33 |
+
* the value to be used when the socket is not valid
|
34 |
+
*/
|
35 |
+
#undef INVALID_SOCKET
|
36 |
+
#define INVALID_SOCKET (-1)
|
37 |
+
#endif
|
38 |
+
|
39 |
+
#ifdef __cplusplus
|
40 |
+
extern "C" {
|
41 |
+
#endif
|
42 |
+
|
43 |
+
/**
|
44 |
+
* ftpListCallback:
|
45 |
+
* @userData: user provided data for the callback
|
46 |
+
* @filename: the file name (including "->" when links are shown)
|
47 |
+
* @attrib: the attribute string
|
48 |
+
* @owner: the owner string
|
49 |
+
* @group: the group string
|
50 |
+
* @size: the file size
|
51 |
+
* @links: the link count
|
52 |
+
* @year: the year
|
53 |
+
* @month: the month
|
54 |
+
* @day: the day
|
55 |
+
* @hour: the hour
|
56 |
+
* @minute: the minute
|
57 |
+
*
|
58 |
+
* A callback for the xmlNanoFTPList command.
|
59 |
+
* Note that only one of year and day:minute are specified.
|
60 |
+
*/
|
61 |
+
typedef void (*ftpListCallback) (void *userData,
|
62 |
+
const char *filename, const char *attrib,
|
63 |
+
const char *owner, const char *group,
|
64 |
+
unsigned long size, int links, int year,
|
65 |
+
const char *month, int day, int hour,
|
66 |
+
int minute);
|
67 |
+
/**
|
68 |
+
* ftpDataCallback:
|
69 |
+
* @userData: the user provided context
|
70 |
+
* @data: the data received
|
71 |
+
* @len: its size in bytes
|
72 |
+
*
|
73 |
+
* A callback for the xmlNanoFTPGet command.
|
74 |
+
*/
|
75 |
+
typedef void (*ftpDataCallback) (void *userData,
|
76 |
+
const char *data,
|
77 |
+
int len);
|
78 |
+
|
79 |
+
/*
|
80 |
+
* Init
|
81 |
+
*/
|
82 |
+
XML_DEPRECATED
|
83 |
+
XMLPUBFUN void
|
84 |
+
xmlNanoFTPInit (void);
|
85 |
+
XML_DEPRECATED
|
86 |
+
XMLPUBFUN void
|
87 |
+
xmlNanoFTPCleanup (void);
|
88 |
+
|
89 |
+
/*
|
90 |
+
* Creating/freeing contexts.
|
91 |
+
*/
|
92 |
+
XML_DEPRECATED
|
93 |
+
XMLPUBFUN void *
|
94 |
+
xmlNanoFTPNewCtxt (const char *URL);
|
95 |
+
XML_DEPRECATED
|
96 |
+
XMLPUBFUN void
|
97 |
+
xmlNanoFTPFreeCtxt (void * ctx);
|
98 |
+
XML_DEPRECATED
|
99 |
+
XMLPUBFUN void *
|
100 |
+
xmlNanoFTPConnectTo (const char *server,
|
101 |
+
int port);
|
102 |
+
/*
|
103 |
+
* Opening/closing session connections.
|
104 |
+
*/
|
105 |
+
XML_DEPRECATED
|
106 |
+
XMLPUBFUN void *
|
107 |
+
xmlNanoFTPOpen (const char *URL);
|
108 |
+
XML_DEPRECATED
|
109 |
+
XMLPUBFUN int
|
110 |
+
xmlNanoFTPConnect (void *ctx);
|
111 |
+
XML_DEPRECATED
|
112 |
+
XMLPUBFUN int
|
113 |
+
xmlNanoFTPClose (void *ctx);
|
114 |
+
XML_DEPRECATED
|
115 |
+
XMLPUBFUN int
|
116 |
+
xmlNanoFTPQuit (void *ctx);
|
117 |
+
XML_DEPRECATED
|
118 |
+
XMLPUBFUN void
|
119 |
+
xmlNanoFTPScanProxy (const char *URL);
|
120 |
+
XML_DEPRECATED
|
121 |
+
XMLPUBFUN void
|
122 |
+
xmlNanoFTPProxy (const char *host,
|
123 |
+
int port,
|
124 |
+
const char *user,
|
125 |
+
const char *passwd,
|
126 |
+
int type);
|
127 |
+
XML_DEPRECATED
|
128 |
+
XMLPUBFUN int
|
129 |
+
xmlNanoFTPUpdateURL (void *ctx,
|
130 |
+
const char *URL);
|
131 |
+
|
132 |
+
/*
|
133 |
+
* Rather internal commands.
|
134 |
+
*/
|
135 |
+
XML_DEPRECATED
|
136 |
+
XMLPUBFUN int
|
137 |
+
xmlNanoFTPGetResponse (void *ctx);
|
138 |
+
XML_DEPRECATED
|
139 |
+
XMLPUBFUN int
|
140 |
+
xmlNanoFTPCheckResponse (void *ctx);
|
141 |
+
|
142 |
+
/*
|
143 |
+
* CD/DIR/GET handlers.
|
144 |
+
*/
|
145 |
+
XML_DEPRECATED
|
146 |
+
XMLPUBFUN int
|
147 |
+
xmlNanoFTPCwd (void *ctx,
|
148 |
+
const char *directory);
|
149 |
+
XML_DEPRECATED
|
150 |
+
XMLPUBFUN int
|
151 |
+
xmlNanoFTPDele (void *ctx,
|
152 |
+
const char *file);
|
153 |
+
|
154 |
+
XML_DEPRECATED
|
155 |
+
XMLPUBFUN SOCKET
|
156 |
+
xmlNanoFTPGetConnection (void *ctx);
|
157 |
+
XML_DEPRECATED
|
158 |
+
XMLPUBFUN int
|
159 |
+
xmlNanoFTPCloseConnection(void *ctx);
|
160 |
+
XML_DEPRECATED
|
161 |
+
XMLPUBFUN int
|
162 |
+
xmlNanoFTPList (void *ctx,
|
163 |
+
ftpListCallback callback,
|
164 |
+
void *userData,
|
165 |
+
const char *filename);
|
166 |
+
XML_DEPRECATED
|
167 |
+
XMLPUBFUN SOCKET
|
168 |
+
xmlNanoFTPGetSocket (void *ctx,
|
169 |
+
const char *filename);
|
170 |
+
XML_DEPRECATED
|
171 |
+
XMLPUBFUN int
|
172 |
+
xmlNanoFTPGet (void *ctx,
|
173 |
+
ftpDataCallback callback,
|
174 |
+
void *userData,
|
175 |
+
const char *filename);
|
176 |
+
XML_DEPRECATED
|
177 |
+
XMLPUBFUN int
|
178 |
+
xmlNanoFTPRead (void *ctx,
|
179 |
+
void *dest,
|
180 |
+
int len);
|
181 |
+
|
182 |
+
#ifdef __cplusplus
|
183 |
+
}
|
184 |
+
#endif
|
185 |
+
#endif /* defined(LIBXML_FTP_ENABLED) || defined(LIBXML_LEGACY_ENABLED) */
|
186 |
+
#endif /* __NANO_FTP_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/nanohttp.h
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: minimal HTTP implementation
|
3 |
+
* Description: minimal HTTP implementation allowing to fetch resources
|
4 |
+
* like external subset.
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __NANO_HTTP_H__
|
12 |
+
#define __NANO_HTTP_H__
|
13 |
+
|
14 |
+
#include <libxml/xmlversion.h>
|
15 |
+
|
16 |
+
#ifdef LIBXML_HTTP_ENABLED
|
17 |
+
|
18 |
+
#ifdef __cplusplus
|
19 |
+
extern "C" {
|
20 |
+
#endif
|
21 |
+
XMLPUBFUN void
|
22 |
+
xmlNanoHTTPInit (void);
|
23 |
+
XMLPUBFUN void
|
24 |
+
xmlNanoHTTPCleanup (void);
|
25 |
+
XMLPUBFUN void
|
26 |
+
xmlNanoHTTPScanProxy (const char *URL);
|
27 |
+
XMLPUBFUN int
|
28 |
+
xmlNanoHTTPFetch (const char *URL,
|
29 |
+
const char *filename,
|
30 |
+
char **contentType);
|
31 |
+
XMLPUBFUN void *
|
32 |
+
xmlNanoHTTPMethod (const char *URL,
|
33 |
+
const char *method,
|
34 |
+
const char *input,
|
35 |
+
char **contentType,
|
36 |
+
const char *headers,
|
37 |
+
int ilen);
|
38 |
+
XMLPUBFUN void *
|
39 |
+
xmlNanoHTTPMethodRedir (const char *URL,
|
40 |
+
const char *method,
|
41 |
+
const char *input,
|
42 |
+
char **contentType,
|
43 |
+
char **redir,
|
44 |
+
const char *headers,
|
45 |
+
int ilen);
|
46 |
+
XMLPUBFUN void *
|
47 |
+
xmlNanoHTTPOpen (const char *URL,
|
48 |
+
char **contentType);
|
49 |
+
XMLPUBFUN void *
|
50 |
+
xmlNanoHTTPOpenRedir (const char *URL,
|
51 |
+
char **contentType,
|
52 |
+
char **redir);
|
53 |
+
XMLPUBFUN int
|
54 |
+
xmlNanoHTTPReturnCode (void *ctx);
|
55 |
+
XMLPUBFUN const char *
|
56 |
+
xmlNanoHTTPAuthHeader (void *ctx);
|
57 |
+
XMLPUBFUN const char *
|
58 |
+
xmlNanoHTTPRedir (void *ctx);
|
59 |
+
XMLPUBFUN int
|
60 |
+
xmlNanoHTTPContentLength( void * ctx );
|
61 |
+
XMLPUBFUN const char *
|
62 |
+
xmlNanoHTTPEncoding (void *ctx);
|
63 |
+
XMLPUBFUN const char *
|
64 |
+
xmlNanoHTTPMimeType (void *ctx);
|
65 |
+
XMLPUBFUN int
|
66 |
+
xmlNanoHTTPRead (void *ctx,
|
67 |
+
void *dest,
|
68 |
+
int len);
|
69 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
70 |
+
XMLPUBFUN int
|
71 |
+
xmlNanoHTTPSave (void *ctxt,
|
72 |
+
const char *filename);
|
73 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
74 |
+
XMLPUBFUN void
|
75 |
+
xmlNanoHTTPClose (void *ctx);
|
76 |
+
#ifdef __cplusplus
|
77 |
+
}
|
78 |
+
#endif
|
79 |
+
|
80 |
+
#endif /* LIBXML_HTTP_ENABLED */
|
81 |
+
#endif /* __NANO_HTTP_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/relaxng.h
ADDED
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: implementation of the Relax-NG validation
|
3 |
+
* Description: implementation of the Relax-NG validation
|
4 |
+
*
|
5 |
+
* Copy: See Copyright for the status of this software.
|
6 |
+
*
|
7 |
+
* Author: Daniel Veillard
|
8 |
+
*/
|
9 |
+
|
10 |
+
#ifndef __XML_RELAX_NG__
|
11 |
+
#define __XML_RELAX_NG__
|
12 |
+
|
13 |
+
#include <libxml/xmlversion.h>
|
14 |
+
#include <libxml/xmlerror.h>
|
15 |
+
#include <libxml/xmlstring.h>
|
16 |
+
#include <libxml/tree.h>
|
17 |
+
|
18 |
+
#ifdef LIBXML_SCHEMAS_ENABLED
|
19 |
+
|
20 |
+
#ifdef __cplusplus
|
21 |
+
extern "C" {
|
22 |
+
#endif
|
23 |
+
|
24 |
+
typedef struct _xmlRelaxNG xmlRelaxNG;
|
25 |
+
typedef xmlRelaxNG *xmlRelaxNGPtr;
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* xmlRelaxNGValidityErrorFunc:
|
30 |
+
* @ctx: the validation context
|
31 |
+
* @msg: the message
|
32 |
+
* @...: extra arguments
|
33 |
+
*
|
34 |
+
* Signature of an error callback from a Relax-NG validation
|
35 |
+
*/
|
36 |
+
typedef void (*xmlRelaxNGValidityErrorFunc) (void *ctx,
|
37 |
+
const char *msg,
|
38 |
+
...) LIBXML_ATTR_FORMAT(2,3);
|
39 |
+
|
40 |
+
/**
|
41 |
+
* xmlRelaxNGValidityWarningFunc:
|
42 |
+
* @ctx: the validation context
|
43 |
+
* @msg: the message
|
44 |
+
* @...: extra arguments
|
45 |
+
*
|
46 |
+
* Signature of a warning callback from a Relax-NG validation
|
47 |
+
*/
|
48 |
+
typedef void (*xmlRelaxNGValidityWarningFunc) (void *ctx,
|
49 |
+
const char *msg,
|
50 |
+
...) LIBXML_ATTR_FORMAT(2,3);
|
51 |
+
|
52 |
+
/**
|
53 |
+
* A schemas validation context
|
54 |
+
*/
|
55 |
+
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
|
56 |
+
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
|
57 |
+
|
58 |
+
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
|
59 |
+
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
|
60 |
+
|
61 |
+
/*
|
62 |
+
* xmlRelaxNGValidErr:
|
63 |
+
*
|
64 |
+
* List of possible Relax NG validation errors
|
65 |
+
*/
|
66 |
+
typedef enum {
|
67 |
+
XML_RELAXNG_OK = 0,
|
68 |
+
XML_RELAXNG_ERR_MEMORY,
|
69 |
+
XML_RELAXNG_ERR_TYPE,
|
70 |
+
XML_RELAXNG_ERR_TYPEVAL,
|
71 |
+
XML_RELAXNG_ERR_DUPID,
|
72 |
+
XML_RELAXNG_ERR_TYPECMP,
|
73 |
+
XML_RELAXNG_ERR_NOSTATE,
|
74 |
+
XML_RELAXNG_ERR_NODEFINE,
|
75 |
+
XML_RELAXNG_ERR_LISTEXTRA,
|
76 |
+
XML_RELAXNG_ERR_LISTEMPTY,
|
77 |
+
XML_RELAXNG_ERR_INTERNODATA,
|
78 |
+
XML_RELAXNG_ERR_INTERSEQ,
|
79 |
+
XML_RELAXNG_ERR_INTEREXTRA,
|
80 |
+
XML_RELAXNG_ERR_ELEMNAME,
|
81 |
+
XML_RELAXNG_ERR_ATTRNAME,
|
82 |
+
XML_RELAXNG_ERR_ELEMNONS,
|
83 |
+
XML_RELAXNG_ERR_ATTRNONS,
|
84 |
+
XML_RELAXNG_ERR_ELEMWRONGNS,
|
85 |
+
XML_RELAXNG_ERR_ATTRWRONGNS,
|
86 |
+
XML_RELAXNG_ERR_ELEMEXTRANS,
|
87 |
+
XML_RELAXNG_ERR_ATTREXTRANS,
|
88 |
+
XML_RELAXNG_ERR_ELEMNOTEMPTY,
|
89 |
+
XML_RELAXNG_ERR_NOELEM,
|
90 |
+
XML_RELAXNG_ERR_NOTELEM,
|
91 |
+
XML_RELAXNG_ERR_ATTRVALID,
|
92 |
+
XML_RELAXNG_ERR_CONTENTVALID,
|
93 |
+
XML_RELAXNG_ERR_EXTRACONTENT,
|
94 |
+
XML_RELAXNG_ERR_INVALIDATTR,
|
95 |
+
XML_RELAXNG_ERR_DATAELEM,
|
96 |
+
XML_RELAXNG_ERR_VALELEM,
|
97 |
+
XML_RELAXNG_ERR_LISTELEM,
|
98 |
+
XML_RELAXNG_ERR_DATATYPE,
|
99 |
+
XML_RELAXNG_ERR_VALUE,
|
100 |
+
XML_RELAXNG_ERR_LIST,
|
101 |
+
XML_RELAXNG_ERR_NOGRAMMAR,
|
102 |
+
XML_RELAXNG_ERR_EXTRADATA,
|
103 |
+
XML_RELAXNG_ERR_LACKDATA,
|
104 |
+
XML_RELAXNG_ERR_INTERNAL,
|
105 |
+
XML_RELAXNG_ERR_ELEMWRONG,
|
106 |
+
XML_RELAXNG_ERR_TEXTWRONG
|
107 |
+
} xmlRelaxNGValidErr;
|
108 |
+
|
109 |
+
/*
|
110 |
+
* xmlRelaxNGParserFlags:
|
111 |
+
*
|
112 |
+
* List of possible Relax NG Parser flags
|
113 |
+
*/
|
114 |
+
typedef enum {
|
115 |
+
XML_RELAXNGP_NONE = 0,
|
116 |
+
XML_RELAXNGP_FREE_DOC = 1,
|
117 |
+
XML_RELAXNGP_CRNG = 2
|
118 |
+
} xmlRelaxNGParserFlag;
|
119 |
+
|
120 |
+
XMLPUBFUN int
|
121 |
+
xmlRelaxNGInitTypes (void);
|
122 |
+
XML_DEPRECATED
|
123 |
+
XMLPUBFUN void
|
124 |
+
xmlRelaxNGCleanupTypes (void);
|
125 |
+
|
126 |
+
/*
|
127 |
+
* Interfaces for parsing.
|
128 |
+
*/
|
129 |
+
XMLPUBFUN xmlRelaxNGParserCtxtPtr
|
130 |
+
xmlRelaxNGNewParserCtxt (const char *URL);
|
131 |
+
XMLPUBFUN xmlRelaxNGParserCtxtPtr
|
132 |
+
xmlRelaxNGNewMemParserCtxt (const char *buffer,
|
133 |
+
int size);
|
134 |
+
XMLPUBFUN xmlRelaxNGParserCtxtPtr
|
135 |
+
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
|
136 |
+
|
137 |
+
XMLPUBFUN int
|
138 |
+
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
|
139 |
+
int flag);
|
140 |
+
|
141 |
+
XMLPUBFUN void
|
142 |
+
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
|
143 |
+
XMLPUBFUN void
|
144 |
+
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
145 |
+
xmlRelaxNGValidityErrorFunc err,
|
146 |
+
xmlRelaxNGValidityWarningFunc warn,
|
147 |
+
void *ctx);
|
148 |
+
XMLPUBFUN int
|
149 |
+
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
150 |
+
xmlRelaxNGValidityErrorFunc *err,
|
151 |
+
xmlRelaxNGValidityWarningFunc *warn,
|
152 |
+
void **ctx);
|
153 |
+
XMLPUBFUN void
|
154 |
+
xmlRelaxNGSetParserStructuredErrors(
|
155 |
+
xmlRelaxNGParserCtxtPtr ctxt,
|
156 |
+
xmlStructuredErrorFunc serror,
|
157 |
+
void *ctx);
|
158 |
+
XMLPUBFUN xmlRelaxNGPtr
|
159 |
+
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
|
160 |
+
XMLPUBFUN void
|
161 |
+
xmlRelaxNGFree (xmlRelaxNGPtr schema);
|
162 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
163 |
+
XMLPUBFUN void
|
164 |
+
xmlRelaxNGDump (FILE *output,
|
165 |
+
xmlRelaxNGPtr schema);
|
166 |
+
XMLPUBFUN void
|
167 |
+
xmlRelaxNGDumpTree (FILE * output,
|
168 |
+
xmlRelaxNGPtr schema);
|
169 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
170 |
+
/*
|
171 |
+
* Interfaces for validating
|
172 |
+
*/
|
173 |
+
XMLPUBFUN void
|
174 |
+
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
175 |
+
xmlRelaxNGValidityErrorFunc err,
|
176 |
+
xmlRelaxNGValidityWarningFunc warn,
|
177 |
+
void *ctx);
|
178 |
+
XMLPUBFUN int
|
179 |
+
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
180 |
+
xmlRelaxNGValidityErrorFunc *err,
|
181 |
+
xmlRelaxNGValidityWarningFunc *warn,
|
182 |
+
void **ctx);
|
183 |
+
XMLPUBFUN void
|
184 |
+
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
185 |
+
xmlStructuredErrorFunc serror, void *ctx);
|
186 |
+
XMLPUBFUN xmlRelaxNGValidCtxtPtr
|
187 |
+
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
|
188 |
+
XMLPUBFUN void
|
189 |
+
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
|
190 |
+
XMLPUBFUN int
|
191 |
+
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
|
192 |
+
xmlDocPtr doc);
|
193 |
+
/*
|
194 |
+
* Interfaces for progressive validation when possible
|
195 |
+
*/
|
196 |
+
XMLPUBFUN int
|
197 |
+
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
|
198 |
+
xmlDocPtr doc,
|
199 |
+
xmlNodePtr elem);
|
200 |
+
XMLPUBFUN int
|
201 |
+
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
|
202 |
+
const xmlChar *data,
|
203 |
+
int len);
|
204 |
+
XMLPUBFUN int
|
205 |
+
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
|
206 |
+
xmlDocPtr doc,
|
207 |
+
xmlNodePtr elem);
|
208 |
+
XMLPUBFUN int
|
209 |
+
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
|
210 |
+
xmlDocPtr doc,
|
211 |
+
xmlNodePtr elem);
|
212 |
+
|
213 |
+
#ifdef __cplusplus
|
214 |
+
}
|
215 |
+
#endif
|
216 |
+
|
217 |
+
#endif /* LIBXML_SCHEMAS_ENABLED */
|
218 |
+
|
219 |
+
#endif /* __XML_RELAX_NG__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/schemasInternals.h
ADDED
@@ -0,0 +1,959 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: internal interfaces for XML Schemas
|
3 |
+
* Description: internal interfaces for the XML Schemas handling
|
4 |
+
* and schema validity checking
|
5 |
+
* The Schemas development is a Work In Progress.
|
6 |
+
* Some of those interfaces are not guaranteed to be API or ABI stable !
|
7 |
+
*
|
8 |
+
* Copy: See Copyright for the status of this software.
|
9 |
+
*
|
10 |
+
* Author: Daniel Veillard
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
#ifndef __XML_SCHEMA_INTERNALS_H__
|
15 |
+
#define __XML_SCHEMA_INTERNALS_H__
|
16 |
+
|
17 |
+
#include <libxml/xmlversion.h>
|
18 |
+
|
19 |
+
#ifdef LIBXML_SCHEMAS_ENABLED
|
20 |
+
|
21 |
+
#include <libxml/xmlregexp.h>
|
22 |
+
#include <libxml/hash.h>
|
23 |
+
#include <libxml/dict.h>
|
24 |
+
#include <libxml/tree.h>
|
25 |
+
|
26 |
+
#ifdef __cplusplus
|
27 |
+
extern "C" {
|
28 |
+
#endif
|
29 |
+
|
30 |
+
typedef enum {
|
31 |
+
XML_SCHEMAS_UNKNOWN = 0,
|
32 |
+
XML_SCHEMAS_STRING = 1,
|
33 |
+
XML_SCHEMAS_NORMSTRING = 2,
|
34 |
+
XML_SCHEMAS_DECIMAL = 3,
|
35 |
+
XML_SCHEMAS_TIME = 4,
|
36 |
+
XML_SCHEMAS_GDAY = 5,
|
37 |
+
XML_SCHEMAS_GMONTH = 6,
|
38 |
+
XML_SCHEMAS_GMONTHDAY = 7,
|
39 |
+
XML_SCHEMAS_GYEAR = 8,
|
40 |
+
XML_SCHEMAS_GYEARMONTH = 9,
|
41 |
+
XML_SCHEMAS_DATE = 10,
|
42 |
+
XML_SCHEMAS_DATETIME = 11,
|
43 |
+
XML_SCHEMAS_DURATION = 12,
|
44 |
+
XML_SCHEMAS_FLOAT = 13,
|
45 |
+
XML_SCHEMAS_DOUBLE = 14,
|
46 |
+
XML_SCHEMAS_BOOLEAN = 15,
|
47 |
+
XML_SCHEMAS_TOKEN = 16,
|
48 |
+
XML_SCHEMAS_LANGUAGE = 17,
|
49 |
+
XML_SCHEMAS_NMTOKEN = 18,
|
50 |
+
XML_SCHEMAS_NMTOKENS = 19,
|
51 |
+
XML_SCHEMAS_NAME = 20,
|
52 |
+
XML_SCHEMAS_QNAME = 21,
|
53 |
+
XML_SCHEMAS_NCNAME = 22,
|
54 |
+
XML_SCHEMAS_ID = 23,
|
55 |
+
XML_SCHEMAS_IDREF = 24,
|
56 |
+
XML_SCHEMAS_IDREFS = 25,
|
57 |
+
XML_SCHEMAS_ENTITY = 26,
|
58 |
+
XML_SCHEMAS_ENTITIES = 27,
|
59 |
+
XML_SCHEMAS_NOTATION = 28,
|
60 |
+
XML_SCHEMAS_ANYURI = 29,
|
61 |
+
XML_SCHEMAS_INTEGER = 30,
|
62 |
+
XML_SCHEMAS_NPINTEGER = 31,
|
63 |
+
XML_SCHEMAS_NINTEGER = 32,
|
64 |
+
XML_SCHEMAS_NNINTEGER = 33,
|
65 |
+
XML_SCHEMAS_PINTEGER = 34,
|
66 |
+
XML_SCHEMAS_INT = 35,
|
67 |
+
XML_SCHEMAS_UINT = 36,
|
68 |
+
XML_SCHEMAS_LONG = 37,
|
69 |
+
XML_SCHEMAS_ULONG = 38,
|
70 |
+
XML_SCHEMAS_SHORT = 39,
|
71 |
+
XML_SCHEMAS_USHORT = 40,
|
72 |
+
XML_SCHEMAS_BYTE = 41,
|
73 |
+
XML_SCHEMAS_UBYTE = 42,
|
74 |
+
XML_SCHEMAS_HEXBINARY = 43,
|
75 |
+
XML_SCHEMAS_BASE64BINARY = 44,
|
76 |
+
XML_SCHEMAS_ANYTYPE = 45,
|
77 |
+
XML_SCHEMAS_ANYSIMPLETYPE = 46
|
78 |
+
} xmlSchemaValType;
|
79 |
+
|
80 |
+
/*
|
81 |
+
* XML Schemas defines multiple type of types.
|
82 |
+
*/
|
83 |
+
typedef enum {
|
84 |
+
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
|
85 |
+
XML_SCHEMA_TYPE_ANY,
|
86 |
+
XML_SCHEMA_TYPE_FACET,
|
87 |
+
XML_SCHEMA_TYPE_SIMPLE,
|
88 |
+
XML_SCHEMA_TYPE_COMPLEX,
|
89 |
+
XML_SCHEMA_TYPE_SEQUENCE = 6,
|
90 |
+
XML_SCHEMA_TYPE_CHOICE,
|
91 |
+
XML_SCHEMA_TYPE_ALL,
|
92 |
+
XML_SCHEMA_TYPE_SIMPLE_CONTENT,
|
93 |
+
XML_SCHEMA_TYPE_COMPLEX_CONTENT,
|
94 |
+
XML_SCHEMA_TYPE_UR,
|
95 |
+
XML_SCHEMA_TYPE_RESTRICTION,
|
96 |
+
XML_SCHEMA_TYPE_EXTENSION,
|
97 |
+
XML_SCHEMA_TYPE_ELEMENT,
|
98 |
+
XML_SCHEMA_TYPE_ATTRIBUTE,
|
99 |
+
XML_SCHEMA_TYPE_ATTRIBUTEGROUP,
|
100 |
+
XML_SCHEMA_TYPE_GROUP,
|
101 |
+
XML_SCHEMA_TYPE_NOTATION,
|
102 |
+
XML_SCHEMA_TYPE_LIST,
|
103 |
+
XML_SCHEMA_TYPE_UNION,
|
104 |
+
XML_SCHEMA_TYPE_ANY_ATTRIBUTE,
|
105 |
+
XML_SCHEMA_TYPE_IDC_UNIQUE,
|
106 |
+
XML_SCHEMA_TYPE_IDC_KEY,
|
107 |
+
XML_SCHEMA_TYPE_IDC_KEYREF,
|
108 |
+
XML_SCHEMA_TYPE_PARTICLE = 25,
|
109 |
+
XML_SCHEMA_TYPE_ATTRIBUTE_USE,
|
110 |
+
XML_SCHEMA_FACET_MININCLUSIVE = 1000,
|
111 |
+
XML_SCHEMA_FACET_MINEXCLUSIVE,
|
112 |
+
XML_SCHEMA_FACET_MAXINCLUSIVE,
|
113 |
+
XML_SCHEMA_FACET_MAXEXCLUSIVE,
|
114 |
+
XML_SCHEMA_FACET_TOTALDIGITS,
|
115 |
+
XML_SCHEMA_FACET_FRACTIONDIGITS,
|
116 |
+
XML_SCHEMA_FACET_PATTERN,
|
117 |
+
XML_SCHEMA_FACET_ENUMERATION,
|
118 |
+
XML_SCHEMA_FACET_WHITESPACE,
|
119 |
+
XML_SCHEMA_FACET_LENGTH,
|
120 |
+
XML_SCHEMA_FACET_MAXLENGTH,
|
121 |
+
XML_SCHEMA_FACET_MINLENGTH,
|
122 |
+
XML_SCHEMA_EXTRA_QNAMEREF = 2000,
|
123 |
+
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
|
124 |
+
} xmlSchemaTypeType;
|
125 |
+
|
126 |
+
typedef enum {
|
127 |
+
XML_SCHEMA_CONTENT_UNKNOWN = 0,
|
128 |
+
XML_SCHEMA_CONTENT_EMPTY = 1,
|
129 |
+
XML_SCHEMA_CONTENT_ELEMENTS,
|
130 |
+
XML_SCHEMA_CONTENT_MIXED,
|
131 |
+
XML_SCHEMA_CONTENT_SIMPLE,
|
132 |
+
XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, /* Obsolete */
|
133 |
+
XML_SCHEMA_CONTENT_BASIC,
|
134 |
+
XML_SCHEMA_CONTENT_ANY
|
135 |
+
} xmlSchemaContentType;
|
136 |
+
|
137 |
+
typedef struct _xmlSchemaVal xmlSchemaVal;
|
138 |
+
typedef xmlSchemaVal *xmlSchemaValPtr;
|
139 |
+
|
140 |
+
typedef struct _xmlSchemaType xmlSchemaType;
|
141 |
+
typedef xmlSchemaType *xmlSchemaTypePtr;
|
142 |
+
|
143 |
+
typedef struct _xmlSchemaFacet xmlSchemaFacet;
|
144 |
+
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Annotation
|
148 |
+
*/
|
149 |
+
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
|
150 |
+
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
|
151 |
+
struct _xmlSchemaAnnot {
|
152 |
+
struct _xmlSchemaAnnot *next;
|
153 |
+
xmlNodePtr content; /* the annotation */
|
154 |
+
};
|
155 |
+
|
156 |
+
/**
|
157 |
+
* XML_SCHEMAS_ANYATTR_SKIP:
|
158 |
+
*
|
159 |
+
* Skip unknown attribute from validation
|
160 |
+
* Obsolete, not used anymore.
|
161 |
+
*/
|
162 |
+
#define XML_SCHEMAS_ANYATTR_SKIP 1
|
163 |
+
/**
|
164 |
+
* XML_SCHEMAS_ANYATTR_LAX:
|
165 |
+
*
|
166 |
+
* Ignore validation non definition on attributes
|
167 |
+
* Obsolete, not used anymore.
|
168 |
+
*/
|
169 |
+
#define XML_SCHEMAS_ANYATTR_LAX 2
|
170 |
+
/**
|
171 |
+
* XML_SCHEMAS_ANYATTR_STRICT:
|
172 |
+
*
|
173 |
+
* Apply strict validation rules on attributes
|
174 |
+
* Obsolete, not used anymore.
|
175 |
+
*/
|
176 |
+
#define XML_SCHEMAS_ANYATTR_STRICT 3
|
177 |
+
/**
|
178 |
+
* XML_SCHEMAS_ANY_SKIP:
|
179 |
+
*
|
180 |
+
* Skip unknown attribute from validation
|
181 |
+
*/
|
182 |
+
#define XML_SCHEMAS_ANY_SKIP 1
|
183 |
+
/**
|
184 |
+
* XML_SCHEMAS_ANY_LAX:
|
185 |
+
*
|
186 |
+
* Used by wildcards.
|
187 |
+
* Validate if type found, don't worry if not found
|
188 |
+
*/
|
189 |
+
#define XML_SCHEMAS_ANY_LAX 2
|
190 |
+
/**
|
191 |
+
* XML_SCHEMAS_ANY_STRICT:
|
192 |
+
*
|
193 |
+
* Used by wildcards.
|
194 |
+
* Apply strict validation rules
|
195 |
+
*/
|
196 |
+
#define XML_SCHEMAS_ANY_STRICT 3
|
197 |
+
/**
|
198 |
+
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
|
199 |
+
*
|
200 |
+
* Used by wildcards.
|
201 |
+
* The attribute is prohibited.
|
202 |
+
*/
|
203 |
+
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
|
204 |
+
/**
|
205 |
+
* XML_SCHEMAS_ATTR_USE_REQUIRED:
|
206 |
+
*
|
207 |
+
* The attribute is required.
|
208 |
+
*/
|
209 |
+
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
|
210 |
+
/**
|
211 |
+
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
|
212 |
+
*
|
213 |
+
* The attribute is optional.
|
214 |
+
*/
|
215 |
+
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
|
216 |
+
/**
|
217 |
+
* XML_SCHEMAS_ATTR_GLOBAL:
|
218 |
+
*
|
219 |
+
* allow elements in no namespace
|
220 |
+
*/
|
221 |
+
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
|
222 |
+
/**
|
223 |
+
* XML_SCHEMAS_ATTR_NSDEFAULT:
|
224 |
+
*
|
225 |
+
* allow elements in no namespace
|
226 |
+
*/
|
227 |
+
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
|
228 |
+
/**
|
229 |
+
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
|
230 |
+
*
|
231 |
+
* this is set when the "type" and "ref" references
|
232 |
+
* have been resolved.
|
233 |
+
*/
|
234 |
+
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
|
235 |
+
/**
|
236 |
+
* XML_SCHEMAS_ATTR_FIXED:
|
237 |
+
*
|
238 |
+
* the attribute has a fixed value
|
239 |
+
*/
|
240 |
+
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
|
241 |
+
|
242 |
+
/**
|
243 |
+
* xmlSchemaAttribute:
|
244 |
+
* An attribute definition.
|
245 |
+
*/
|
246 |
+
|
247 |
+
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
|
248 |
+
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
|
249 |
+
struct _xmlSchemaAttribute {
|
250 |
+
xmlSchemaTypeType type;
|
251 |
+
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
|
252 |
+
const xmlChar *name; /* the name of the declaration */
|
253 |
+
const xmlChar *id; /* Deprecated; not used */
|
254 |
+
const xmlChar *ref; /* Deprecated; not used */
|
255 |
+
const xmlChar *refNs; /* Deprecated; not used */
|
256 |
+
const xmlChar *typeName; /* the local name of the type definition */
|
257 |
+
const xmlChar *typeNs; /* the ns URI of the type definition */
|
258 |
+
xmlSchemaAnnotPtr annot;
|
259 |
+
|
260 |
+
xmlSchemaTypePtr base; /* Deprecated; not used */
|
261 |
+
int occurs; /* Deprecated; not used */
|
262 |
+
const xmlChar *defValue; /* The initial value of the value constraint */
|
263 |
+
xmlSchemaTypePtr subtypes; /* the type definition */
|
264 |
+
xmlNodePtr node;
|
265 |
+
const xmlChar *targetNamespace;
|
266 |
+
int flags;
|
267 |
+
const xmlChar *refPrefix; /* Deprecated; not used */
|
268 |
+
xmlSchemaValPtr defVal; /* The compiled value constraint */
|
269 |
+
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
|
270 |
+
};
|
271 |
+
|
272 |
+
/**
|
273 |
+
* xmlSchemaAttributeLink:
|
274 |
+
* Used to build a list of attribute uses on complexType definitions.
|
275 |
+
* WARNING: Deprecated; not used.
|
276 |
+
*/
|
277 |
+
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
|
278 |
+
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
|
279 |
+
struct _xmlSchemaAttributeLink {
|
280 |
+
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
|
281 |
+
struct _xmlSchemaAttribute *attr;/* the linked attribute */
|
282 |
+
};
|
283 |
+
|
284 |
+
/**
|
285 |
+
* XML_SCHEMAS_WILDCARD_COMPLETE:
|
286 |
+
*
|
287 |
+
* If the wildcard is complete.
|
288 |
+
*/
|
289 |
+
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
|
290 |
+
|
291 |
+
/**
|
292 |
+
* xmlSchemaCharValueLink:
|
293 |
+
* Used to build a list of namespaces on wildcards.
|
294 |
+
*/
|
295 |
+
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
|
296 |
+
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
|
297 |
+
struct _xmlSchemaWildcardNs {
|
298 |
+
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
|
299 |
+
const xmlChar *value;/* the value */
|
300 |
+
};
|
301 |
+
|
302 |
+
/**
|
303 |
+
* xmlSchemaWildcard.
|
304 |
+
* A wildcard.
|
305 |
+
*/
|
306 |
+
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
|
307 |
+
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
|
308 |
+
struct _xmlSchemaWildcard {
|
309 |
+
xmlSchemaTypeType type; /* The kind of type */
|
310 |
+
const xmlChar *id; /* Deprecated; not used */
|
311 |
+
xmlSchemaAnnotPtr annot;
|
312 |
+
xmlNodePtr node;
|
313 |
+
int minOccurs; /* Deprecated; not used */
|
314 |
+
int maxOccurs; /* Deprecated; not used */
|
315 |
+
int processContents;
|
316 |
+
int any; /* Indicates if the ns constraint is of ##any */
|
317 |
+
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
|
318 |
+
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
|
319 |
+
int flags;
|
320 |
+
};
|
321 |
+
|
322 |
+
/**
|
323 |
+
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
|
324 |
+
*
|
325 |
+
* The attribute wildcard has been built.
|
326 |
+
*/
|
327 |
+
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
|
328 |
+
/**
|
329 |
+
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
|
330 |
+
*
|
331 |
+
* The attribute group has been defined.
|
332 |
+
*/
|
333 |
+
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
|
334 |
+
/**
|
335 |
+
* XML_SCHEMAS_ATTRGROUP_MARKED:
|
336 |
+
*
|
337 |
+
* Marks the attr group as marked; used for circular checks.
|
338 |
+
*/
|
339 |
+
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
|
340 |
+
|
341 |
+
/**
|
342 |
+
* XML_SCHEMAS_ATTRGROUP_REDEFINED:
|
343 |
+
*
|
344 |
+
* The attr group was redefined.
|
345 |
+
*/
|
346 |
+
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
|
347 |
+
/**
|
348 |
+
* XML_SCHEMAS_ATTRGROUP_HAS_REFS:
|
349 |
+
*
|
350 |
+
* Whether this attr. group contains attr. group references.
|
351 |
+
*/
|
352 |
+
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
|
353 |
+
|
354 |
+
/**
|
355 |
+
* An attribute group definition.
|
356 |
+
*
|
357 |
+
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
|
358 |
+
* must be kept similar
|
359 |
+
*/
|
360 |
+
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
|
361 |
+
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
|
362 |
+
struct _xmlSchemaAttributeGroup {
|
363 |
+
xmlSchemaTypeType type; /* The kind of type */
|
364 |
+
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
|
365 |
+
const xmlChar *name;
|
366 |
+
const xmlChar *id;
|
367 |
+
const xmlChar *ref; /* Deprecated; not used */
|
368 |
+
const xmlChar *refNs; /* Deprecated; not used */
|
369 |
+
xmlSchemaAnnotPtr annot;
|
370 |
+
|
371 |
+
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
|
372 |
+
xmlNodePtr node;
|
373 |
+
int flags;
|
374 |
+
xmlSchemaWildcardPtr attributeWildcard;
|
375 |
+
const xmlChar *refPrefix; /* Deprecated; not used */
|
376 |
+
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
|
377 |
+
const xmlChar *targetNamespace;
|
378 |
+
void *attrUses;
|
379 |
+
};
|
380 |
+
|
381 |
+
/**
|
382 |
+
* xmlSchemaTypeLink:
|
383 |
+
* Used to build a list of types (e.g. member types of
|
384 |
+
* simpleType with variety "union").
|
385 |
+
*/
|
386 |
+
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
|
387 |
+
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
|
388 |
+
struct _xmlSchemaTypeLink {
|
389 |
+
struct _xmlSchemaTypeLink *next;/* the next type link ... */
|
390 |
+
xmlSchemaTypePtr type;/* the linked type */
|
391 |
+
};
|
392 |
+
|
393 |
+
/**
|
394 |
+
* xmlSchemaFacetLink:
|
395 |
+
* Used to build a list of facets.
|
396 |
+
*/
|
397 |
+
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
|
398 |
+
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
|
399 |
+
struct _xmlSchemaFacetLink {
|
400 |
+
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
|
401 |
+
xmlSchemaFacetPtr facet;/* the linked facet */
|
402 |
+
};
|
403 |
+
|
404 |
+
/**
|
405 |
+
* XML_SCHEMAS_TYPE_MIXED:
|
406 |
+
*
|
407 |
+
* the element content type is mixed
|
408 |
+
*/
|
409 |
+
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
|
410 |
+
/**
|
411 |
+
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
|
412 |
+
*
|
413 |
+
* the simple or complex type has a derivation method of "extension".
|
414 |
+
*/
|
415 |
+
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
|
416 |
+
/**
|
417 |
+
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
|
418 |
+
*
|
419 |
+
* the simple or complex type has a derivation method of "restriction".
|
420 |
+
*/
|
421 |
+
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
|
422 |
+
/**
|
423 |
+
* XML_SCHEMAS_TYPE_GLOBAL:
|
424 |
+
*
|
425 |
+
* the type is global
|
426 |
+
*/
|
427 |
+
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
|
428 |
+
/**
|
429 |
+
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
|
430 |
+
*
|
431 |
+
* the complexType owns an attribute wildcard, i.e.
|
432 |
+
* it can be freed by the complexType
|
433 |
+
*/
|
434 |
+
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */
|
435 |
+
/**
|
436 |
+
* XML_SCHEMAS_TYPE_VARIETY_ABSENT:
|
437 |
+
*
|
438 |
+
* the simpleType has a variety of "absent".
|
439 |
+
* TODO: Actually not necessary :-/, since if
|
440 |
+
* none of the variety flags occur then it's
|
441 |
+
* automatically absent.
|
442 |
+
*/
|
443 |
+
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
|
444 |
+
/**
|
445 |
+
* XML_SCHEMAS_TYPE_VARIETY_LIST:
|
446 |
+
*
|
447 |
+
* the simpleType has a variety of "list".
|
448 |
+
*/
|
449 |
+
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
|
450 |
+
/**
|
451 |
+
* XML_SCHEMAS_TYPE_VARIETY_UNION:
|
452 |
+
*
|
453 |
+
* the simpleType has a variety of "union".
|
454 |
+
*/
|
455 |
+
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
|
456 |
+
/**
|
457 |
+
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
|
458 |
+
*
|
459 |
+
* the simpleType has a variety of "union".
|
460 |
+
*/
|
461 |
+
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
|
462 |
+
/**
|
463 |
+
* XML_SCHEMAS_TYPE_FINAL_EXTENSION:
|
464 |
+
*
|
465 |
+
* the complexType has a final of "extension".
|
466 |
+
*/
|
467 |
+
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
|
468 |
+
/**
|
469 |
+
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
|
470 |
+
*
|
471 |
+
* the simpleType/complexType has a final of "restriction".
|
472 |
+
*/
|
473 |
+
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
|
474 |
+
/**
|
475 |
+
* XML_SCHEMAS_TYPE_FINAL_LIST:
|
476 |
+
*
|
477 |
+
* the simpleType has a final of "list".
|
478 |
+
*/
|
479 |
+
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
|
480 |
+
/**
|
481 |
+
* XML_SCHEMAS_TYPE_FINAL_UNION:
|
482 |
+
*
|
483 |
+
* the simpleType has a final of "union".
|
484 |
+
*/
|
485 |
+
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
|
486 |
+
/**
|
487 |
+
* XML_SCHEMAS_TYPE_FINAL_DEFAULT:
|
488 |
+
*
|
489 |
+
* the simpleType has a final of "default".
|
490 |
+
*/
|
491 |
+
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
|
492 |
+
/**
|
493 |
+
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
|
494 |
+
*
|
495 |
+
* Marks the item as a builtin primitive.
|
496 |
+
*/
|
497 |
+
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
|
498 |
+
/**
|
499 |
+
* XML_SCHEMAS_TYPE_MARKED:
|
500 |
+
*
|
501 |
+
* Marks the item as marked; used for circular checks.
|
502 |
+
*/
|
503 |
+
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
|
504 |
+
/**
|
505 |
+
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
|
506 |
+
*
|
507 |
+
* the complexType did not specify 'block' so use the default of the
|
508 |
+
* <schema> item.
|
509 |
+
*/
|
510 |
+
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
|
511 |
+
/**
|
512 |
+
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
|
513 |
+
*
|
514 |
+
* the complexType has a 'block' of "extension".
|
515 |
+
*/
|
516 |
+
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
|
517 |
+
/**
|
518 |
+
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
|
519 |
+
*
|
520 |
+
* the complexType has a 'block' of "restriction".
|
521 |
+
*/
|
522 |
+
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
|
523 |
+
/**
|
524 |
+
* XML_SCHEMAS_TYPE_ABSTRACT:
|
525 |
+
*
|
526 |
+
* the simple/complexType is abstract.
|
527 |
+
*/
|
528 |
+
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
|
529 |
+
/**
|
530 |
+
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
|
531 |
+
*
|
532 |
+
* indicates if the facets need a computed value
|
533 |
+
*/
|
534 |
+
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
|
535 |
+
/**
|
536 |
+
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
|
537 |
+
*
|
538 |
+
* indicates that the type was typefixed
|
539 |
+
*/
|
540 |
+
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
|
541 |
+
/**
|
542 |
+
* XML_SCHEMAS_TYPE_INTERNAL_INVALID:
|
543 |
+
*
|
544 |
+
* indicates that the type is invalid
|
545 |
+
*/
|
546 |
+
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
|
547 |
+
/**
|
548 |
+
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
|
549 |
+
*
|
550 |
+
* a whitespace-facet value of "preserve"
|
551 |
+
*/
|
552 |
+
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
|
553 |
+
/**
|
554 |
+
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
|
555 |
+
*
|
556 |
+
* a whitespace-facet value of "replace"
|
557 |
+
*/
|
558 |
+
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
|
559 |
+
/**
|
560 |
+
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
|
561 |
+
*
|
562 |
+
* a whitespace-facet value of "collapse"
|
563 |
+
*/
|
564 |
+
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
|
565 |
+
/**
|
566 |
+
* XML_SCHEMAS_TYPE_HAS_FACETS:
|
567 |
+
*
|
568 |
+
* has facets
|
569 |
+
*/
|
570 |
+
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
|
571 |
+
/**
|
572 |
+
* XML_SCHEMAS_TYPE_NORMVALUENEEDED:
|
573 |
+
*
|
574 |
+
* indicates if the facets (pattern) need a normalized value
|
575 |
+
*/
|
576 |
+
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
|
577 |
+
|
578 |
+
/**
|
579 |
+
* XML_SCHEMAS_TYPE_FIXUP_1:
|
580 |
+
*
|
581 |
+
* First stage of fixup was done.
|
582 |
+
*/
|
583 |
+
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
|
584 |
+
|
585 |
+
/**
|
586 |
+
* XML_SCHEMAS_TYPE_REDEFINED:
|
587 |
+
*
|
588 |
+
* The type was redefined.
|
589 |
+
*/
|
590 |
+
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
|
591 |
+
/**
|
592 |
+
* XML_SCHEMAS_TYPE_REDEFINING:
|
593 |
+
*
|
594 |
+
* The type redefines an other type.
|
595 |
+
*/
|
596 |
+
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */
|
597 |
+
|
598 |
+
/**
|
599 |
+
* _xmlSchemaType:
|
600 |
+
*
|
601 |
+
* Schemas type definition.
|
602 |
+
*/
|
603 |
+
struct _xmlSchemaType {
|
604 |
+
xmlSchemaTypeType type; /* The kind of type */
|
605 |
+
struct _xmlSchemaType *next; /* the next type if in a sequence ... */
|
606 |
+
const xmlChar *name;
|
607 |
+
const xmlChar *id ; /* Deprecated; not used */
|
608 |
+
const xmlChar *ref; /* Deprecated; not used */
|
609 |
+
const xmlChar *refNs; /* Deprecated; not used */
|
610 |
+
xmlSchemaAnnotPtr annot;
|
611 |
+
xmlSchemaTypePtr subtypes;
|
612 |
+
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
|
613 |
+
xmlNodePtr node;
|
614 |
+
int minOccurs; /* Deprecated; not used */
|
615 |
+
int maxOccurs; /* Deprecated; not used */
|
616 |
+
|
617 |
+
int flags;
|
618 |
+
xmlSchemaContentType contentType;
|
619 |
+
const xmlChar *base; /* Base type's local name */
|
620 |
+
const xmlChar *baseNs; /* Base type's target namespace */
|
621 |
+
xmlSchemaTypePtr baseType; /* The base type component */
|
622 |
+
xmlSchemaFacetPtr facets; /* Local facets */
|
623 |
+
struct _xmlSchemaType *redef; /* Deprecated; not used */
|
624 |
+
int recurse; /* Obsolete */
|
625 |
+
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
|
626 |
+
xmlSchemaWildcardPtr attributeWildcard;
|
627 |
+
int builtInType; /* Type of built-in types. */
|
628 |
+
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
|
629 |
+
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
|
630 |
+
const xmlChar *refPrefix; /* Deprecated; not used */
|
631 |
+
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
|
632 |
+
Could we use @subtypes for this? */
|
633 |
+
xmlRegexpPtr contModel; /* Holds the automaton of the content model */
|
634 |
+
const xmlChar *targetNamespace;
|
635 |
+
void *attrUses;
|
636 |
+
};
|
637 |
+
|
638 |
+
/*
|
639 |
+
* xmlSchemaElement:
|
640 |
+
* An element definition.
|
641 |
+
*
|
642 |
+
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
|
643 |
+
* structures must be kept similar
|
644 |
+
*/
|
645 |
+
/**
|
646 |
+
* XML_SCHEMAS_ELEM_NILLABLE:
|
647 |
+
*
|
648 |
+
* the element is nillable
|
649 |
+
*/
|
650 |
+
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
|
651 |
+
/**
|
652 |
+
* XML_SCHEMAS_ELEM_GLOBAL:
|
653 |
+
*
|
654 |
+
* the element is global
|
655 |
+
*/
|
656 |
+
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
|
657 |
+
/**
|
658 |
+
* XML_SCHEMAS_ELEM_DEFAULT:
|
659 |
+
*
|
660 |
+
* the element has a default value
|
661 |
+
*/
|
662 |
+
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
|
663 |
+
/**
|
664 |
+
* XML_SCHEMAS_ELEM_FIXED:
|
665 |
+
*
|
666 |
+
* the element has a fixed value
|
667 |
+
*/
|
668 |
+
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
|
669 |
+
/**
|
670 |
+
* XML_SCHEMAS_ELEM_ABSTRACT:
|
671 |
+
*
|
672 |
+
* the element is abstract
|
673 |
+
*/
|
674 |
+
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
|
675 |
+
/**
|
676 |
+
* XML_SCHEMAS_ELEM_TOPLEVEL:
|
677 |
+
*
|
678 |
+
* the element is top level
|
679 |
+
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
|
680 |
+
*/
|
681 |
+
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
|
682 |
+
/**
|
683 |
+
* XML_SCHEMAS_ELEM_REF:
|
684 |
+
*
|
685 |
+
* the element is a reference to a type
|
686 |
+
*/
|
687 |
+
#define XML_SCHEMAS_ELEM_REF 1 << 6
|
688 |
+
/**
|
689 |
+
* XML_SCHEMAS_ELEM_NSDEFAULT:
|
690 |
+
*
|
691 |
+
* allow elements in no namespace
|
692 |
+
* Obsolete, not used anymore.
|
693 |
+
*/
|
694 |
+
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
|
695 |
+
/**
|
696 |
+
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
|
697 |
+
*
|
698 |
+
* this is set when "type", "ref", "substitutionGroup"
|
699 |
+
* references have been resolved.
|
700 |
+
*/
|
701 |
+
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
|
702 |
+
/**
|
703 |
+
* XML_SCHEMAS_ELEM_CIRCULAR:
|
704 |
+
*
|
705 |
+
* a helper flag for the search of circular references.
|
706 |
+
*/
|
707 |
+
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
|
708 |
+
/**
|
709 |
+
* XML_SCHEMAS_ELEM_BLOCK_ABSENT:
|
710 |
+
*
|
711 |
+
* the "block" attribute is absent
|
712 |
+
*/
|
713 |
+
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
|
714 |
+
/**
|
715 |
+
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
|
716 |
+
*
|
717 |
+
* disallowed substitutions are absent
|
718 |
+
*/
|
719 |
+
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
|
720 |
+
/**
|
721 |
+
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
|
722 |
+
*
|
723 |
+
* disallowed substitutions: "restriction"
|
724 |
+
*/
|
725 |
+
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
|
726 |
+
/**
|
727 |
+
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
|
728 |
+
*
|
729 |
+
* disallowed substitutions: "substitution"
|
730 |
+
*/
|
731 |
+
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
|
732 |
+
/**
|
733 |
+
* XML_SCHEMAS_ELEM_FINAL_ABSENT:
|
734 |
+
*
|
735 |
+
* substitution group exclusions are absent
|
736 |
+
*/
|
737 |
+
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
|
738 |
+
/**
|
739 |
+
* XML_SCHEMAS_ELEM_FINAL_EXTENSION:
|
740 |
+
*
|
741 |
+
* substitution group exclusions: "extension"
|
742 |
+
*/
|
743 |
+
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
|
744 |
+
/**
|
745 |
+
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
|
746 |
+
*
|
747 |
+
* substitution group exclusions: "restriction"
|
748 |
+
*/
|
749 |
+
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
|
750 |
+
/**
|
751 |
+
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
|
752 |
+
*
|
753 |
+
* the declaration is a substitution group head
|
754 |
+
*/
|
755 |
+
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
|
756 |
+
/**
|
757 |
+
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
|
758 |
+
*
|
759 |
+
* this is set when the elem decl has been checked against
|
760 |
+
* all constraints
|
761 |
+
*/
|
762 |
+
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
|
763 |
+
|
764 |
+
typedef struct _xmlSchemaElement xmlSchemaElement;
|
765 |
+
typedef xmlSchemaElement *xmlSchemaElementPtr;
|
766 |
+
struct _xmlSchemaElement {
|
767 |
+
xmlSchemaTypeType type; /* The kind of type */
|
768 |
+
struct _xmlSchemaType *next; /* Not used? */
|
769 |
+
const xmlChar *name;
|
770 |
+
const xmlChar *id; /* Deprecated; not used */
|
771 |
+
const xmlChar *ref; /* Deprecated; not used */
|
772 |
+
const xmlChar *refNs; /* Deprecated; not used */
|
773 |
+
xmlSchemaAnnotPtr annot;
|
774 |
+
xmlSchemaTypePtr subtypes; /* the type definition */
|
775 |
+
xmlSchemaAttributePtr attributes;
|
776 |
+
xmlNodePtr node;
|
777 |
+
int minOccurs; /* Deprecated; not used */
|
778 |
+
int maxOccurs; /* Deprecated; not used */
|
779 |
+
|
780 |
+
int flags;
|
781 |
+
const xmlChar *targetNamespace;
|
782 |
+
const xmlChar *namedType;
|
783 |
+
const xmlChar *namedTypeNs;
|
784 |
+
const xmlChar *substGroup;
|
785 |
+
const xmlChar *substGroupNs;
|
786 |
+
const xmlChar *scope;
|
787 |
+
const xmlChar *value; /* The original value of the value constraint. */
|
788 |
+
struct _xmlSchemaElement *refDecl; /* This will now be used for the
|
789 |
+
substitution group affiliation */
|
790 |
+
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
|
791 |
+
xmlSchemaContentType contentType;
|
792 |
+
const xmlChar *refPrefix; /* Deprecated; not used */
|
793 |
+
xmlSchemaValPtr defVal; /* The compiled value constraint. */
|
794 |
+
void *idcs; /* The identity-constraint defs */
|
795 |
+
};
|
796 |
+
|
797 |
+
/*
|
798 |
+
* XML_SCHEMAS_FACET_UNKNOWN:
|
799 |
+
*
|
800 |
+
* unknown facet handling
|
801 |
+
*/
|
802 |
+
#define XML_SCHEMAS_FACET_UNKNOWN 0
|
803 |
+
/*
|
804 |
+
* XML_SCHEMAS_FACET_PRESERVE:
|
805 |
+
*
|
806 |
+
* preserve the type of the facet
|
807 |
+
*/
|
808 |
+
#define XML_SCHEMAS_FACET_PRESERVE 1
|
809 |
+
/*
|
810 |
+
* XML_SCHEMAS_FACET_REPLACE:
|
811 |
+
*
|
812 |
+
* replace the type of the facet
|
813 |
+
*/
|
814 |
+
#define XML_SCHEMAS_FACET_REPLACE 2
|
815 |
+
/*
|
816 |
+
* XML_SCHEMAS_FACET_COLLAPSE:
|
817 |
+
*
|
818 |
+
* collapse the types of the facet
|
819 |
+
*/
|
820 |
+
#define XML_SCHEMAS_FACET_COLLAPSE 3
|
821 |
+
/**
|
822 |
+
* A facet definition.
|
823 |
+
*/
|
824 |
+
struct _xmlSchemaFacet {
|
825 |
+
xmlSchemaTypeType type; /* The kind of type */
|
826 |
+
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
|
827 |
+
const xmlChar *value; /* The original value */
|
828 |
+
const xmlChar *id; /* Obsolete */
|
829 |
+
xmlSchemaAnnotPtr annot;
|
830 |
+
xmlNodePtr node;
|
831 |
+
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
|
832 |
+
int whitespace;
|
833 |
+
xmlSchemaValPtr val; /* The compiled value */
|
834 |
+
xmlRegexpPtr regexp; /* The regex for patterns */
|
835 |
+
};
|
836 |
+
|
837 |
+
/**
|
838 |
+
* A notation definition.
|
839 |
+
*/
|
840 |
+
typedef struct _xmlSchemaNotation xmlSchemaNotation;
|
841 |
+
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
|
842 |
+
struct _xmlSchemaNotation {
|
843 |
+
xmlSchemaTypeType type; /* The kind of type */
|
844 |
+
const xmlChar *name;
|
845 |
+
xmlSchemaAnnotPtr annot;
|
846 |
+
const xmlChar *identifier;
|
847 |
+
const xmlChar *targetNamespace;
|
848 |
+
};
|
849 |
+
|
850 |
+
/*
|
851 |
+
* TODO: Actually all those flags used for the schema should sit
|
852 |
+
* on the schema parser context, since they are used only
|
853 |
+
* during parsing an XML schema document, and not available
|
854 |
+
* on the component level as per spec.
|
855 |
+
*/
|
856 |
+
/**
|
857 |
+
* XML_SCHEMAS_QUALIF_ELEM:
|
858 |
+
*
|
859 |
+
* Reflects elementFormDefault == qualified in
|
860 |
+
* an XML schema document.
|
861 |
+
*/
|
862 |
+
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
|
863 |
+
/**
|
864 |
+
* XML_SCHEMAS_QUALIF_ATTR:
|
865 |
+
*
|
866 |
+
* Reflects attributeFormDefault == qualified in
|
867 |
+
* an XML schema document.
|
868 |
+
*/
|
869 |
+
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
|
870 |
+
/**
|
871 |
+
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
|
872 |
+
*
|
873 |
+
* the schema has "extension" in the set of finalDefault.
|
874 |
+
*/
|
875 |
+
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
|
876 |
+
/**
|
877 |
+
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
|
878 |
+
*
|
879 |
+
* the schema has "restriction" in the set of finalDefault.
|
880 |
+
*/
|
881 |
+
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
|
882 |
+
/**
|
883 |
+
* XML_SCHEMAS_FINAL_DEFAULT_LIST:
|
884 |
+
*
|
885 |
+
* the schema has "list" in the set of finalDefault.
|
886 |
+
*/
|
887 |
+
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
|
888 |
+
/**
|
889 |
+
* XML_SCHEMAS_FINAL_DEFAULT_UNION:
|
890 |
+
*
|
891 |
+
* the schema has "union" in the set of finalDefault.
|
892 |
+
*/
|
893 |
+
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
|
894 |
+
/**
|
895 |
+
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
|
896 |
+
*
|
897 |
+
* the schema has "extension" in the set of blockDefault.
|
898 |
+
*/
|
899 |
+
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
|
900 |
+
/**
|
901 |
+
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
|
902 |
+
*
|
903 |
+
* the schema has "restriction" in the set of blockDefault.
|
904 |
+
*/
|
905 |
+
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
|
906 |
+
/**
|
907 |
+
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
|
908 |
+
*
|
909 |
+
* the schema has "substitution" in the set of blockDefault.
|
910 |
+
*/
|
911 |
+
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
|
912 |
+
/**
|
913 |
+
* XML_SCHEMAS_INCLUDING_CONVERT_NS:
|
914 |
+
*
|
915 |
+
* the schema is currently including an other schema with
|
916 |
+
* no target namespace.
|
917 |
+
*/
|
918 |
+
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
|
919 |
+
/**
|
920 |
+
* _xmlSchema:
|
921 |
+
*
|
922 |
+
* A Schemas definition
|
923 |
+
*/
|
924 |
+
struct _xmlSchema {
|
925 |
+
const xmlChar *name; /* schema name */
|
926 |
+
const xmlChar *targetNamespace; /* the target namespace */
|
927 |
+
const xmlChar *version;
|
928 |
+
const xmlChar *id; /* Obsolete */
|
929 |
+
xmlDocPtr doc;
|
930 |
+
xmlSchemaAnnotPtr annot;
|
931 |
+
int flags;
|
932 |
+
|
933 |
+
xmlHashTablePtr typeDecl;
|
934 |
+
xmlHashTablePtr attrDecl;
|
935 |
+
xmlHashTablePtr attrgrpDecl;
|
936 |
+
xmlHashTablePtr elemDecl;
|
937 |
+
xmlHashTablePtr notaDecl;
|
938 |
+
|
939 |
+
xmlHashTablePtr schemasImports;
|
940 |
+
|
941 |
+
void *_private; /* unused by the library for users or bindings */
|
942 |
+
xmlHashTablePtr groupDecl;
|
943 |
+
xmlDictPtr dict;
|
944 |
+
void *includes; /* the includes, this is opaque for now */
|
945 |
+
int preserve; /* whether to free the document */
|
946 |
+
int counter; /* used to give anonymous components unique names */
|
947 |
+
xmlHashTablePtr idcDef; /* All identity-constraint defs. */
|
948 |
+
void *volatiles; /* Obsolete */
|
949 |
+
};
|
950 |
+
|
951 |
+
XMLPUBFUN void xmlSchemaFreeType (xmlSchemaTypePtr type);
|
952 |
+
XMLPUBFUN void xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
|
953 |
+
|
954 |
+
#ifdef __cplusplus
|
955 |
+
}
|
956 |
+
#endif
|
957 |
+
|
958 |
+
#endif /* LIBXML_SCHEMAS_ENABLED */
|
959 |
+
#endif /* __XML_SCHEMA_INTERNALS_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/threads.h
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Summary: interfaces for thread handling
|
3 |
+
* Description: set of generic threading related routines
|
4 |
+
* should work with pthreads, Windows native or TLS threads
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __XML_THREADS_H__
|
12 |
+
#define __XML_THREADS_H__
|
13 |
+
|
14 |
+
#include <libxml/xmlversion.h>
|
15 |
+
|
16 |
+
#ifdef __cplusplus
|
17 |
+
extern "C" {
|
18 |
+
#endif
|
19 |
+
|
20 |
+
/*
|
21 |
+
* xmlMutex are a simple mutual exception locks.
|
22 |
+
*/
|
23 |
+
typedef struct _xmlMutex xmlMutex;
|
24 |
+
typedef xmlMutex *xmlMutexPtr;
|
25 |
+
|
26 |
+
/*
|
27 |
+
* xmlRMutex are reentrant mutual exception locks.
|
28 |
+
*/
|
29 |
+
typedef struct _xmlRMutex xmlRMutex;
|
30 |
+
typedef xmlRMutex *xmlRMutexPtr;
|
31 |
+
|
32 |
+
XMLPUBFUN int
|
33 |
+
xmlCheckThreadLocalStorage(void);
|
34 |
+
|
35 |
+
XMLPUBFUN xmlMutexPtr
|
36 |
+
xmlNewMutex (void);
|
37 |
+
XMLPUBFUN void
|
38 |
+
xmlMutexLock (xmlMutexPtr tok);
|
39 |
+
XMLPUBFUN void
|
40 |
+
xmlMutexUnlock (xmlMutexPtr tok);
|
41 |
+
XMLPUBFUN void
|
42 |
+
xmlFreeMutex (xmlMutexPtr tok);
|
43 |
+
|
44 |
+
XMLPUBFUN xmlRMutexPtr
|
45 |
+
xmlNewRMutex (void);
|
46 |
+
XMLPUBFUN void
|
47 |
+
xmlRMutexLock (xmlRMutexPtr tok);
|
48 |
+
XMLPUBFUN void
|
49 |
+
xmlRMutexUnlock (xmlRMutexPtr tok);
|
50 |
+
XMLPUBFUN void
|
51 |
+
xmlFreeRMutex (xmlRMutexPtr tok);
|
52 |
+
|
53 |
+
/*
|
54 |
+
* Library wide APIs.
|
55 |
+
*/
|
56 |
+
XML_DEPRECATED
|
57 |
+
XMLPUBFUN void
|
58 |
+
xmlInitThreads (void);
|
59 |
+
XMLPUBFUN void
|
60 |
+
xmlLockLibrary (void);
|
61 |
+
XMLPUBFUN void
|
62 |
+
xmlUnlockLibrary(void);
|
63 |
+
XML_DEPRECATED
|
64 |
+
XMLPUBFUN int
|
65 |
+
xmlGetThreadId (void);
|
66 |
+
XML_DEPRECATED
|
67 |
+
XMLPUBFUN int
|
68 |
+
xmlIsMainThread (void);
|
69 |
+
XML_DEPRECATED
|
70 |
+
XMLPUBFUN void
|
71 |
+
xmlCleanupThreads(void);
|
72 |
+
|
73 |
+
/** DOC_DISABLE */
|
74 |
+
#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
|
75 |
+
defined(LIBXML_STATIC_FOR_DLL)
|
76 |
+
int
|
77 |
+
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
|
78 |
+
void *lpvReserved);
|
79 |
+
#endif
|
80 |
+
/** DOC_ENABLE */
|
81 |
+
|
82 |
+
#ifdef __cplusplus
|
83 |
+
}
|
84 |
+
#endif
|
85 |
+
|
86 |
+
|
87 |
+
#endif /* __XML_THREADS_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/tree.h
ADDED
@@ -0,0 +1,1362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: interfaces for tree manipulation
|
3 |
+
* Description: this module describes the structures found in an tree resulting
|
4 |
+
* from an XML or HTML parsing, as well as the API provided for
|
5 |
+
* various processing on that tree
|
6 |
+
*
|
7 |
+
* Copy: See Copyright for the status of this software.
|
8 |
+
*
|
9 |
+
* Author: Daniel Veillard
|
10 |
+
*/
|
11 |
+
|
12 |
+
#ifndef XML_TREE_INTERNALS
|
13 |
+
|
14 |
+
/*
|
15 |
+
* Emulate circular dependency for backward compatibility
|
16 |
+
*/
|
17 |
+
#include <libxml/parser.h>
|
18 |
+
|
19 |
+
#else /* XML_TREE_INTERNALS */
|
20 |
+
|
21 |
+
#ifndef __XML_TREE_H__
|
22 |
+
#define __XML_TREE_H__
|
23 |
+
|
24 |
+
#include <stdio.h>
|
25 |
+
#include <limits.h>
|
26 |
+
#include <libxml/xmlversion.h>
|
27 |
+
#include <libxml/xmlstring.h>
|
28 |
+
#include <libxml/xmlmemory.h>
|
29 |
+
#include <libxml/xmlregexp.h>
|
30 |
+
|
31 |
+
#ifdef __cplusplus
|
32 |
+
extern "C" {
|
33 |
+
#endif
|
34 |
+
|
35 |
+
/*
|
36 |
+
* Some of the basic types pointer to structures:
|
37 |
+
*/
|
38 |
+
/* xmlIO.h */
|
39 |
+
typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
|
40 |
+
typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
|
41 |
+
|
42 |
+
typedef struct _xmlOutputBuffer xmlOutputBuffer;
|
43 |
+
typedef xmlOutputBuffer *xmlOutputBufferPtr;
|
44 |
+
|
45 |
+
/* parser.h */
|
46 |
+
typedef struct _xmlParserInput xmlParserInput;
|
47 |
+
typedef xmlParserInput *xmlParserInputPtr;
|
48 |
+
|
49 |
+
typedef struct _xmlParserCtxt xmlParserCtxt;
|
50 |
+
typedef xmlParserCtxt *xmlParserCtxtPtr;
|
51 |
+
|
52 |
+
typedef struct _xmlSAXLocator xmlSAXLocator;
|
53 |
+
typedef xmlSAXLocator *xmlSAXLocatorPtr;
|
54 |
+
|
55 |
+
typedef struct _xmlSAXHandler xmlSAXHandler;
|
56 |
+
typedef xmlSAXHandler *xmlSAXHandlerPtr;
|
57 |
+
|
58 |
+
/* entities.h */
|
59 |
+
typedef struct _xmlEntity xmlEntity;
|
60 |
+
typedef xmlEntity *xmlEntityPtr;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* BASE_BUFFER_SIZE:
|
64 |
+
*
|
65 |
+
* default buffer size 4000.
|
66 |
+
*/
|
67 |
+
#define BASE_BUFFER_SIZE 4096
|
68 |
+
|
69 |
+
/**
|
70 |
+
* LIBXML_NAMESPACE_DICT:
|
71 |
+
*
|
72 |
+
* Defines experimental behaviour:
|
73 |
+
* 1) xmlNs gets an additional field @context (a xmlDoc)
|
74 |
+
* 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc.
|
75 |
+
*/
|
76 |
+
/* #define LIBXML_NAMESPACE_DICT */
|
77 |
+
|
78 |
+
/**
|
79 |
+
* xmlBufferAllocationScheme:
|
80 |
+
*
|
81 |
+
* A buffer allocation scheme can be defined to either match exactly the
|
82 |
+
* need or double it's allocated size each time it is found too small.
|
83 |
+
*/
|
84 |
+
|
85 |
+
typedef enum {
|
86 |
+
XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */
|
87 |
+
XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
|
88 |
+
XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer, deprecated */
|
89 |
+
XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
|
90 |
+
XML_BUFFER_ALLOC_HYBRID, /* exact up to a threshold, and doubleit thereafter */
|
91 |
+
XML_BUFFER_ALLOC_BOUNDED /* limit the upper size of the buffer */
|
92 |
+
} xmlBufferAllocationScheme;
|
93 |
+
|
94 |
+
/**
|
95 |
+
* xmlBuffer:
|
96 |
+
*
|
97 |
+
* A buffer structure, this old construct is limited to 2GB and
|
98 |
+
* is being deprecated, use API with xmlBuf instead
|
99 |
+
*/
|
100 |
+
typedef struct _xmlBuffer xmlBuffer;
|
101 |
+
typedef xmlBuffer *xmlBufferPtr;
|
102 |
+
struct _xmlBuffer {
|
103 |
+
xmlChar *content; /* The buffer content UTF8 */
|
104 |
+
unsigned int use; /* The buffer size used */
|
105 |
+
unsigned int size; /* The buffer size */
|
106 |
+
xmlBufferAllocationScheme alloc; /* The realloc method */
|
107 |
+
xmlChar *contentIO; /* in IO mode we may have a different base */
|
108 |
+
};
|
109 |
+
|
110 |
+
/**
|
111 |
+
* xmlBuf:
|
112 |
+
*
|
113 |
+
* A buffer structure, new one, the actual structure internals are not public
|
114 |
+
*/
|
115 |
+
|
116 |
+
typedef struct _xmlBuf xmlBuf;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* xmlBufPtr:
|
120 |
+
*
|
121 |
+
* A pointer to a buffer structure, the actual structure internals are not
|
122 |
+
* public
|
123 |
+
*/
|
124 |
+
|
125 |
+
typedef xmlBuf *xmlBufPtr;
|
126 |
+
|
127 |
+
/*
|
128 |
+
* A few public routines for xmlBuf. As those are expected to be used
|
129 |
+
* mostly internally the bulk of the routines are internal in buf.h
|
130 |
+
*/
|
131 |
+
XMLPUBFUN xmlChar* xmlBufContent (const xmlBuf* buf);
|
132 |
+
XMLPUBFUN xmlChar* xmlBufEnd (xmlBufPtr buf);
|
133 |
+
XMLPUBFUN size_t xmlBufUse (const xmlBufPtr buf);
|
134 |
+
XMLPUBFUN size_t xmlBufShrink (xmlBufPtr buf, size_t len);
|
135 |
+
|
136 |
+
/*
|
137 |
+
* LIBXML2_NEW_BUFFER:
|
138 |
+
*
|
139 |
+
* Macro used to express that the API use the new buffers for
|
140 |
+
* xmlParserInputBuffer and xmlOutputBuffer. The change was
|
141 |
+
* introduced in 2.9.0.
|
142 |
+
*/
|
143 |
+
#define LIBXML2_NEW_BUFFER
|
144 |
+
|
145 |
+
/**
|
146 |
+
* XML_XML_NAMESPACE:
|
147 |
+
*
|
148 |
+
* This is the namespace for the special xml: prefix predefined in the
|
149 |
+
* XML Namespace specification.
|
150 |
+
*/
|
151 |
+
#define XML_XML_NAMESPACE \
|
152 |
+
(const xmlChar *) "http://www.w3.org/XML/1998/namespace"
|
153 |
+
|
154 |
+
/**
|
155 |
+
* XML_XML_ID:
|
156 |
+
*
|
157 |
+
* This is the name for the special xml:id attribute
|
158 |
+
*/
|
159 |
+
#define XML_XML_ID (const xmlChar *) "xml:id"
|
160 |
+
|
161 |
+
/*
|
162 |
+
* The different element types carried by an XML tree.
|
163 |
+
*
|
164 |
+
* NOTE: This is synchronized with DOM Level1 values
|
165 |
+
* See http://www.w3.org/TR/REC-DOM-Level-1/
|
166 |
+
*
|
167 |
+
* Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
|
168 |
+
* be deprecated to use an XML_DTD_NODE.
|
169 |
+
*/
|
170 |
+
typedef enum {
|
171 |
+
XML_ELEMENT_NODE= 1,
|
172 |
+
XML_ATTRIBUTE_NODE= 2,
|
173 |
+
XML_TEXT_NODE= 3,
|
174 |
+
XML_CDATA_SECTION_NODE= 4,
|
175 |
+
XML_ENTITY_REF_NODE= 5,
|
176 |
+
XML_ENTITY_NODE= 6,
|
177 |
+
XML_PI_NODE= 7,
|
178 |
+
XML_COMMENT_NODE= 8,
|
179 |
+
XML_DOCUMENT_NODE= 9,
|
180 |
+
XML_DOCUMENT_TYPE_NODE= 10,
|
181 |
+
XML_DOCUMENT_FRAG_NODE= 11,
|
182 |
+
XML_NOTATION_NODE= 12,
|
183 |
+
XML_HTML_DOCUMENT_NODE= 13,
|
184 |
+
XML_DTD_NODE= 14,
|
185 |
+
XML_ELEMENT_DECL= 15,
|
186 |
+
XML_ATTRIBUTE_DECL= 16,
|
187 |
+
XML_ENTITY_DECL= 17,
|
188 |
+
XML_NAMESPACE_DECL= 18,
|
189 |
+
XML_XINCLUDE_START= 19,
|
190 |
+
XML_XINCLUDE_END= 20
|
191 |
+
/* XML_DOCB_DOCUMENT_NODE= 21 */ /* removed */
|
192 |
+
} xmlElementType;
|
193 |
+
|
194 |
+
/** DOC_DISABLE */
|
195 |
+
/* For backward compatibility */
|
196 |
+
#define XML_DOCB_DOCUMENT_NODE 21
|
197 |
+
/** DOC_ENABLE */
|
198 |
+
|
199 |
+
/**
|
200 |
+
* xmlNotation:
|
201 |
+
*
|
202 |
+
* A DTD Notation definition.
|
203 |
+
*/
|
204 |
+
|
205 |
+
typedef struct _xmlNotation xmlNotation;
|
206 |
+
typedef xmlNotation *xmlNotationPtr;
|
207 |
+
struct _xmlNotation {
|
208 |
+
const xmlChar *name; /* Notation name */
|
209 |
+
const xmlChar *PublicID; /* Public identifier, if any */
|
210 |
+
const xmlChar *SystemID; /* System identifier, if any */
|
211 |
+
};
|
212 |
+
|
213 |
+
/**
|
214 |
+
* xmlAttributeType:
|
215 |
+
*
|
216 |
+
* A DTD Attribute type definition.
|
217 |
+
*/
|
218 |
+
|
219 |
+
typedef enum {
|
220 |
+
XML_ATTRIBUTE_CDATA = 1,
|
221 |
+
XML_ATTRIBUTE_ID,
|
222 |
+
XML_ATTRIBUTE_IDREF ,
|
223 |
+
XML_ATTRIBUTE_IDREFS,
|
224 |
+
XML_ATTRIBUTE_ENTITY,
|
225 |
+
XML_ATTRIBUTE_ENTITIES,
|
226 |
+
XML_ATTRIBUTE_NMTOKEN,
|
227 |
+
XML_ATTRIBUTE_NMTOKENS,
|
228 |
+
XML_ATTRIBUTE_ENUMERATION,
|
229 |
+
XML_ATTRIBUTE_NOTATION
|
230 |
+
} xmlAttributeType;
|
231 |
+
|
232 |
+
/**
|
233 |
+
* xmlAttributeDefault:
|
234 |
+
*
|
235 |
+
* A DTD Attribute default definition.
|
236 |
+
*/
|
237 |
+
|
238 |
+
typedef enum {
|
239 |
+
XML_ATTRIBUTE_NONE = 1,
|
240 |
+
XML_ATTRIBUTE_REQUIRED,
|
241 |
+
XML_ATTRIBUTE_IMPLIED,
|
242 |
+
XML_ATTRIBUTE_FIXED
|
243 |
+
} xmlAttributeDefault;
|
244 |
+
|
245 |
+
/**
|
246 |
+
* xmlEnumeration:
|
247 |
+
*
|
248 |
+
* List structure used when there is an enumeration in DTDs.
|
249 |
+
*/
|
250 |
+
|
251 |
+
typedef struct _xmlEnumeration xmlEnumeration;
|
252 |
+
typedef xmlEnumeration *xmlEnumerationPtr;
|
253 |
+
struct _xmlEnumeration {
|
254 |
+
struct _xmlEnumeration *next; /* next one */
|
255 |
+
const xmlChar *name; /* Enumeration name */
|
256 |
+
};
|
257 |
+
|
258 |
+
/**
|
259 |
+
* xmlAttribute:
|
260 |
+
*
|
261 |
+
* An Attribute declaration in a DTD.
|
262 |
+
*/
|
263 |
+
|
264 |
+
typedef struct _xmlAttribute xmlAttribute;
|
265 |
+
typedef xmlAttribute *xmlAttributePtr;
|
266 |
+
struct _xmlAttribute {
|
267 |
+
void *_private; /* application data */
|
268 |
+
xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
|
269 |
+
const xmlChar *name; /* Attribute name */
|
270 |
+
struct _xmlNode *children; /* NULL */
|
271 |
+
struct _xmlNode *last; /* NULL */
|
272 |
+
struct _xmlDtd *parent; /* -> DTD */
|
273 |
+
struct _xmlNode *next; /* next sibling link */
|
274 |
+
struct _xmlNode *prev; /* previous sibling link */
|
275 |
+
struct _xmlDoc *doc; /* the containing document */
|
276 |
+
|
277 |
+
struct _xmlAttribute *nexth; /* next in hash table */
|
278 |
+
xmlAttributeType atype; /* The attribute type */
|
279 |
+
xmlAttributeDefault def; /* the default */
|
280 |
+
const xmlChar *defaultValue; /* or the default value */
|
281 |
+
xmlEnumerationPtr tree; /* or the enumeration tree if any */
|
282 |
+
const xmlChar *prefix; /* the namespace prefix if any */
|
283 |
+
const xmlChar *elem; /* Element holding the attribute */
|
284 |
+
};
|
285 |
+
|
286 |
+
/**
|
287 |
+
* xmlElementContentType:
|
288 |
+
*
|
289 |
+
* Possible definitions of element content types.
|
290 |
+
*/
|
291 |
+
typedef enum {
|
292 |
+
XML_ELEMENT_CONTENT_PCDATA = 1,
|
293 |
+
XML_ELEMENT_CONTENT_ELEMENT,
|
294 |
+
XML_ELEMENT_CONTENT_SEQ,
|
295 |
+
XML_ELEMENT_CONTENT_OR
|
296 |
+
} xmlElementContentType;
|
297 |
+
|
298 |
+
/**
|
299 |
+
* xmlElementContentOccur:
|
300 |
+
*
|
301 |
+
* Possible definitions of element content occurrences.
|
302 |
+
*/
|
303 |
+
typedef enum {
|
304 |
+
XML_ELEMENT_CONTENT_ONCE = 1,
|
305 |
+
XML_ELEMENT_CONTENT_OPT,
|
306 |
+
XML_ELEMENT_CONTENT_MULT,
|
307 |
+
XML_ELEMENT_CONTENT_PLUS
|
308 |
+
} xmlElementContentOccur;
|
309 |
+
|
310 |
+
/**
|
311 |
+
* xmlElementContent:
|
312 |
+
*
|
313 |
+
* An XML Element content as stored after parsing an element definition
|
314 |
+
* in a DTD.
|
315 |
+
*/
|
316 |
+
|
317 |
+
typedef struct _xmlElementContent xmlElementContent;
|
318 |
+
typedef xmlElementContent *xmlElementContentPtr;
|
319 |
+
struct _xmlElementContent {
|
320 |
+
xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
|
321 |
+
xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
|
322 |
+
const xmlChar *name; /* Element name */
|
323 |
+
struct _xmlElementContent *c1; /* first child */
|
324 |
+
struct _xmlElementContent *c2; /* second child */
|
325 |
+
struct _xmlElementContent *parent; /* parent */
|
326 |
+
const xmlChar *prefix; /* Namespace prefix */
|
327 |
+
};
|
328 |
+
|
329 |
+
/**
|
330 |
+
* xmlElementTypeVal:
|
331 |
+
*
|
332 |
+
* The different possibilities for an element content type.
|
333 |
+
*/
|
334 |
+
|
335 |
+
typedef enum {
|
336 |
+
XML_ELEMENT_TYPE_UNDEFINED = 0,
|
337 |
+
XML_ELEMENT_TYPE_EMPTY = 1,
|
338 |
+
XML_ELEMENT_TYPE_ANY,
|
339 |
+
XML_ELEMENT_TYPE_MIXED,
|
340 |
+
XML_ELEMENT_TYPE_ELEMENT
|
341 |
+
} xmlElementTypeVal;
|
342 |
+
|
343 |
+
/**
|
344 |
+
* xmlElement:
|
345 |
+
*
|
346 |
+
* An XML Element declaration from a DTD.
|
347 |
+
*/
|
348 |
+
|
349 |
+
typedef struct _xmlElement xmlElement;
|
350 |
+
typedef xmlElement *xmlElementPtr;
|
351 |
+
struct _xmlElement {
|
352 |
+
void *_private; /* application data */
|
353 |
+
xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
|
354 |
+
const xmlChar *name; /* Element name */
|
355 |
+
struct _xmlNode *children; /* NULL */
|
356 |
+
struct _xmlNode *last; /* NULL */
|
357 |
+
struct _xmlDtd *parent; /* -> DTD */
|
358 |
+
struct _xmlNode *next; /* next sibling link */
|
359 |
+
struct _xmlNode *prev; /* previous sibling link */
|
360 |
+
struct _xmlDoc *doc; /* the containing document */
|
361 |
+
|
362 |
+
xmlElementTypeVal etype; /* The type */
|
363 |
+
xmlElementContentPtr content; /* the allowed element content */
|
364 |
+
xmlAttributePtr attributes; /* List of the declared attributes */
|
365 |
+
const xmlChar *prefix; /* the namespace prefix if any */
|
366 |
+
#ifdef LIBXML_REGEXP_ENABLED
|
367 |
+
xmlRegexpPtr contModel; /* the validating regexp */
|
368 |
+
#else
|
369 |
+
void *contModel;
|
370 |
+
#endif
|
371 |
+
};
|
372 |
+
|
373 |
+
|
374 |
+
/**
|
375 |
+
* XML_LOCAL_NAMESPACE:
|
376 |
+
*
|
377 |
+
* A namespace declaration node.
|
378 |
+
*/
|
379 |
+
#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
|
380 |
+
typedef xmlElementType xmlNsType;
|
381 |
+
|
382 |
+
/**
|
383 |
+
* xmlNs:
|
384 |
+
*
|
385 |
+
* An XML namespace.
|
386 |
+
* Note that prefix == NULL is valid, it defines the default namespace
|
387 |
+
* within the subtree (until overridden).
|
388 |
+
*
|
389 |
+
* xmlNsType is unified with xmlElementType.
|
390 |
+
*/
|
391 |
+
|
392 |
+
typedef struct _xmlNs xmlNs;
|
393 |
+
typedef xmlNs *xmlNsPtr;
|
394 |
+
struct _xmlNs {
|
395 |
+
struct _xmlNs *next; /* next Ns link for this node */
|
396 |
+
xmlNsType type; /* global or local */
|
397 |
+
const xmlChar *href; /* URL for the namespace */
|
398 |
+
const xmlChar *prefix; /* prefix for the namespace */
|
399 |
+
void *_private; /* application data */
|
400 |
+
struct _xmlDoc *context; /* normally an xmlDoc */
|
401 |
+
};
|
402 |
+
|
403 |
+
/**
|
404 |
+
* xmlDtd:
|
405 |
+
*
|
406 |
+
* An XML DTD, as defined by <!DOCTYPE ... There is actually one for
|
407 |
+
* the internal subset and for the external subset.
|
408 |
+
*/
|
409 |
+
typedef struct _xmlDtd xmlDtd;
|
410 |
+
typedef xmlDtd *xmlDtdPtr;
|
411 |
+
struct _xmlDtd {
|
412 |
+
void *_private; /* application data */
|
413 |
+
xmlElementType type; /* XML_DTD_NODE, must be second ! */
|
414 |
+
const xmlChar *name; /* Name of the DTD */
|
415 |
+
struct _xmlNode *children; /* the value of the property link */
|
416 |
+
struct _xmlNode *last; /* last child link */
|
417 |
+
struct _xmlDoc *parent; /* child->parent link */
|
418 |
+
struct _xmlNode *next; /* next sibling link */
|
419 |
+
struct _xmlNode *prev; /* previous sibling link */
|
420 |
+
struct _xmlDoc *doc; /* the containing document */
|
421 |
+
|
422 |
+
/* End of common part */
|
423 |
+
void *notations; /* Hash table for notations if any */
|
424 |
+
void *elements; /* Hash table for elements if any */
|
425 |
+
void *attributes; /* Hash table for attributes if any */
|
426 |
+
void *entities; /* Hash table for entities if any */
|
427 |
+
const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
|
428 |
+
const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
|
429 |
+
void *pentities; /* Hash table for param entities if any */
|
430 |
+
};
|
431 |
+
|
432 |
+
/**
|
433 |
+
* xmlAttr:
|
434 |
+
*
|
435 |
+
* An attribute on an XML node.
|
436 |
+
*/
|
437 |
+
typedef struct _xmlAttr xmlAttr;
|
438 |
+
typedef xmlAttr *xmlAttrPtr;
|
439 |
+
struct _xmlAttr {
|
440 |
+
void *_private; /* application data */
|
441 |
+
xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
|
442 |
+
const xmlChar *name; /* the name of the property */
|
443 |
+
struct _xmlNode *children; /* the value of the property */
|
444 |
+
struct _xmlNode *last; /* NULL */
|
445 |
+
struct _xmlNode *parent; /* child->parent link */
|
446 |
+
struct _xmlAttr *next; /* next sibling link */
|
447 |
+
struct _xmlAttr *prev; /* previous sibling link */
|
448 |
+
struct _xmlDoc *doc; /* the containing document */
|
449 |
+
xmlNs *ns; /* pointer to the associated namespace */
|
450 |
+
xmlAttributeType atype; /* the attribute type if validating */
|
451 |
+
void *psvi; /* for type/PSVI information */
|
452 |
+
};
|
453 |
+
|
454 |
+
/**
|
455 |
+
* xmlID:
|
456 |
+
*
|
457 |
+
* An XML ID instance.
|
458 |
+
*/
|
459 |
+
|
460 |
+
typedef struct _xmlID xmlID;
|
461 |
+
typedef xmlID *xmlIDPtr;
|
462 |
+
struct _xmlID {
|
463 |
+
struct _xmlID *next; /* next ID */
|
464 |
+
const xmlChar *value; /* The ID name */
|
465 |
+
xmlAttrPtr attr; /* The attribute holding it */
|
466 |
+
const xmlChar *name; /* The attribute if attr is not available */
|
467 |
+
int lineno; /* The line number if attr is not available */
|
468 |
+
struct _xmlDoc *doc; /* The document holding the ID */
|
469 |
+
};
|
470 |
+
|
471 |
+
/**
|
472 |
+
* xmlRef:
|
473 |
+
*
|
474 |
+
* An XML IDREF instance.
|
475 |
+
*/
|
476 |
+
|
477 |
+
typedef struct _xmlRef xmlRef;
|
478 |
+
typedef xmlRef *xmlRefPtr;
|
479 |
+
struct _xmlRef {
|
480 |
+
struct _xmlRef *next; /* next Ref */
|
481 |
+
const xmlChar *value; /* The Ref name */
|
482 |
+
xmlAttrPtr attr; /* The attribute holding it */
|
483 |
+
const xmlChar *name; /* The attribute if attr is not available */
|
484 |
+
int lineno; /* The line number if attr is not available */
|
485 |
+
};
|
486 |
+
|
487 |
+
/**
|
488 |
+
* xmlNode:
|
489 |
+
*
|
490 |
+
* A node in an XML tree.
|
491 |
+
*/
|
492 |
+
typedef struct _xmlNode xmlNode;
|
493 |
+
typedef xmlNode *xmlNodePtr;
|
494 |
+
struct _xmlNode {
|
495 |
+
void *_private; /* application data */
|
496 |
+
xmlElementType type; /* type number, must be second ! */
|
497 |
+
const xmlChar *name; /* the name of the node, or the entity */
|
498 |
+
struct _xmlNode *children; /* parent->childs link */
|
499 |
+
struct _xmlNode *last; /* last child link */
|
500 |
+
struct _xmlNode *parent; /* child->parent link */
|
501 |
+
struct _xmlNode *next; /* next sibling link */
|
502 |
+
struct _xmlNode *prev; /* previous sibling link */
|
503 |
+
struct _xmlDoc *doc; /* the containing document */
|
504 |
+
|
505 |
+
/* End of common part */
|
506 |
+
xmlNs *ns; /* pointer to the associated namespace */
|
507 |
+
xmlChar *content; /* the content */
|
508 |
+
struct _xmlAttr *properties;/* properties list */
|
509 |
+
xmlNs *nsDef; /* namespace definitions on this node */
|
510 |
+
void *psvi; /* for type/PSVI information */
|
511 |
+
unsigned short line; /* line number */
|
512 |
+
unsigned short extra; /* extra data for XPath/XSLT */
|
513 |
+
};
|
514 |
+
|
515 |
+
/**
|
516 |
+
* XML_GET_CONTENT:
|
517 |
+
*
|
518 |
+
* Macro to extract the content pointer of a node.
|
519 |
+
*/
|
520 |
+
#define XML_GET_CONTENT(n) \
|
521 |
+
((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
|
522 |
+
|
523 |
+
/**
|
524 |
+
* XML_GET_LINE:
|
525 |
+
*
|
526 |
+
* Macro to extract the line number of an element node.
|
527 |
+
*/
|
528 |
+
#define XML_GET_LINE(n) \
|
529 |
+
(xmlGetLineNo(n))
|
530 |
+
|
531 |
+
/**
|
532 |
+
* xmlDocProperty
|
533 |
+
*
|
534 |
+
* Set of properties of the document as found by the parser
|
535 |
+
* Some of them are linked to similarly named xmlParserOption
|
536 |
+
*/
|
537 |
+
typedef enum {
|
538 |
+
XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */
|
539 |
+
XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */
|
540 |
+
XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */
|
541 |
+
XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */
|
542 |
+
XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */
|
543 |
+
XML_DOC_USERBUILT = 1<<5, /* Document was built using the API
|
544 |
+
and not by parsing an instance */
|
545 |
+
XML_DOC_INTERNAL = 1<<6, /* built for internal processing */
|
546 |
+
XML_DOC_HTML = 1<<7 /* parsed or built HTML document */
|
547 |
+
} xmlDocProperties;
|
548 |
+
|
549 |
+
/**
|
550 |
+
* xmlDoc:
|
551 |
+
*
|
552 |
+
* An XML document.
|
553 |
+
*/
|
554 |
+
typedef struct _xmlDoc xmlDoc;
|
555 |
+
typedef xmlDoc *xmlDocPtr;
|
556 |
+
struct _xmlDoc {
|
557 |
+
void *_private; /* application data */
|
558 |
+
xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
|
559 |
+
char *name; /* name/filename/URI of the document */
|
560 |
+
struct _xmlNode *children; /* the document tree */
|
561 |
+
struct _xmlNode *last; /* last child link */
|
562 |
+
struct _xmlNode *parent; /* child->parent link */
|
563 |
+
struct _xmlNode *next; /* next sibling link */
|
564 |
+
struct _xmlNode *prev; /* previous sibling link */
|
565 |
+
struct _xmlDoc *doc; /* autoreference to itself */
|
566 |
+
|
567 |
+
/* End of common part */
|
568 |
+
int compression;/* level of zlib compression */
|
569 |
+
int standalone; /* standalone document (no external refs)
|
570 |
+
1 if standalone="yes"
|
571 |
+
0 if standalone="no"
|
572 |
+
-1 if there is no XML declaration
|
573 |
+
-2 if there is an XML declaration, but no
|
574 |
+
standalone attribute was specified */
|
575 |
+
struct _xmlDtd *intSubset; /* the document internal subset */
|
576 |
+
struct _xmlDtd *extSubset; /* the document external subset */
|
577 |
+
struct _xmlNs *oldNs; /* Global namespace, the old way */
|
578 |
+
const xmlChar *version; /* the XML version string */
|
579 |
+
const xmlChar *encoding; /* actual encoding, if any */
|
580 |
+
void *ids; /* Hash table for ID attributes if any */
|
581 |
+
void *refs; /* Hash table for IDREFs attributes if any */
|
582 |
+
const xmlChar *URL; /* The URI for that document */
|
583 |
+
int charset; /* unused */
|
584 |
+
struct _xmlDict *dict; /* dict used to allocate names or NULL */
|
585 |
+
void *psvi; /* for type/PSVI information */
|
586 |
+
int parseFlags; /* set of xmlParserOption used to parse the
|
587 |
+
document */
|
588 |
+
int properties; /* set of xmlDocProperties for this document
|
589 |
+
set at the end of parsing */
|
590 |
+
};
|
591 |
+
|
592 |
+
|
593 |
+
typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
|
594 |
+
typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
|
595 |
+
|
596 |
+
/**
|
597 |
+
* xmlDOMWrapAcquireNsFunction:
|
598 |
+
* @ctxt: a DOM wrapper context
|
599 |
+
* @node: the context node (element or attribute)
|
600 |
+
* @nsName: the requested namespace name
|
601 |
+
* @nsPrefix: the requested namespace prefix
|
602 |
+
*
|
603 |
+
* A function called to acquire namespaces (xmlNs) from the wrapper.
|
604 |
+
*
|
605 |
+
* Returns an xmlNsPtr or NULL in case of an error.
|
606 |
+
*/
|
607 |
+
typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt,
|
608 |
+
xmlNodePtr node,
|
609 |
+
const xmlChar *nsName,
|
610 |
+
const xmlChar *nsPrefix);
|
611 |
+
|
612 |
+
/**
|
613 |
+
* xmlDOMWrapCtxt:
|
614 |
+
*
|
615 |
+
* Context for DOM wrapper-operations.
|
616 |
+
*/
|
617 |
+
struct _xmlDOMWrapCtxt {
|
618 |
+
void * _private;
|
619 |
+
/*
|
620 |
+
* The type of this context, just in case we need specialized
|
621 |
+
* contexts in the future.
|
622 |
+
*/
|
623 |
+
int type;
|
624 |
+
/*
|
625 |
+
* Internal namespace map used for various operations.
|
626 |
+
*/
|
627 |
+
void * namespaceMap;
|
628 |
+
/*
|
629 |
+
* Use this one to acquire an xmlNsPtr intended for node->ns.
|
630 |
+
* (Note that this is not intended for elem->nsDef).
|
631 |
+
*/
|
632 |
+
xmlDOMWrapAcquireNsFunction getNsForNodeFunc;
|
633 |
+
};
|
634 |
+
|
635 |
+
/**
|
636 |
+
* xmlRegisterNodeFunc:
|
637 |
+
* @node: the current node
|
638 |
+
*
|
639 |
+
* Signature for the registration callback of a created node
|
640 |
+
*/
|
641 |
+
typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node);
|
642 |
+
|
643 |
+
/**
|
644 |
+
* xmlDeregisterNodeFunc:
|
645 |
+
* @node: the current node
|
646 |
+
*
|
647 |
+
* Signature for the deregistration callback of a discarded node
|
648 |
+
*/
|
649 |
+
typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
|
650 |
+
|
651 |
+
/**
|
652 |
+
* xmlChildrenNode:
|
653 |
+
*
|
654 |
+
* Macro for compatibility naming layer with libxml1. Maps
|
655 |
+
* to "children."
|
656 |
+
*/
|
657 |
+
#ifndef xmlChildrenNode
|
658 |
+
#define xmlChildrenNode children
|
659 |
+
#endif
|
660 |
+
|
661 |
+
/**
|
662 |
+
* xmlRootNode:
|
663 |
+
*
|
664 |
+
* Macro for compatibility naming layer with libxml1. Maps
|
665 |
+
* to "children".
|
666 |
+
*/
|
667 |
+
#ifndef xmlRootNode
|
668 |
+
#define xmlRootNode children
|
669 |
+
#endif
|
670 |
+
|
671 |
+
/*
|
672 |
+
* Variables.
|
673 |
+
*/
|
674 |
+
|
675 |
+
/** DOC_DISABLE */
|
676 |
+
#define XML_GLOBALS_TREE \
|
677 |
+
XML_OP(xmlBufferAllocScheme, xmlBufferAllocationScheme, XML_DEPRECATED) \
|
678 |
+
XML_OP(xmlDefaultBufferSize, int, XML_DEPRECATED) \
|
679 |
+
XML_OP(xmlRegisterNodeDefaultValue, xmlRegisterNodeFunc, XML_DEPRECATED) \
|
680 |
+
XML_OP(xmlDeregisterNodeDefaultValue, xmlDeregisterNodeFunc, \
|
681 |
+
XML_DEPRECATED)
|
682 |
+
|
683 |
+
#define XML_OP XML_DECLARE_GLOBAL
|
684 |
+
XML_GLOBALS_TREE
|
685 |
+
#undef XML_OP
|
686 |
+
|
687 |
+
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
|
688 |
+
#define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme)
|
689 |
+
#define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize)
|
690 |
+
#define xmlRegisterNodeDefaultValue \
|
691 |
+
XML_GLOBAL_MACRO(xmlRegisterNodeDefaultValue)
|
692 |
+
#define xmlDeregisterNodeDefaultValue \
|
693 |
+
XML_GLOBAL_MACRO(xmlDeregisterNodeDefaultValue)
|
694 |
+
#endif
|
695 |
+
/** DOC_ENABLE */
|
696 |
+
|
697 |
+
/*
|
698 |
+
* Some helper functions
|
699 |
+
*/
|
700 |
+
XMLPUBFUN int
|
701 |
+
xmlValidateNCName (const xmlChar *value,
|
702 |
+
int space);
|
703 |
+
|
704 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
705 |
+
XMLPUBFUN int
|
706 |
+
xmlValidateQName (const xmlChar *value,
|
707 |
+
int space);
|
708 |
+
XMLPUBFUN int
|
709 |
+
xmlValidateName (const xmlChar *value,
|
710 |
+
int space);
|
711 |
+
XMLPUBFUN int
|
712 |
+
xmlValidateNMToken (const xmlChar *value,
|
713 |
+
int space);
|
714 |
+
#endif
|
715 |
+
|
716 |
+
XMLPUBFUN xmlChar *
|
717 |
+
xmlBuildQName (const xmlChar *ncname,
|
718 |
+
const xmlChar *prefix,
|
719 |
+
xmlChar *memory,
|
720 |
+
int len);
|
721 |
+
XMLPUBFUN xmlChar *
|
722 |
+
xmlSplitQName2 (const xmlChar *name,
|
723 |
+
xmlChar **prefix);
|
724 |
+
XMLPUBFUN const xmlChar *
|
725 |
+
xmlSplitQName3 (const xmlChar *name,
|
726 |
+
int *len);
|
727 |
+
|
728 |
+
/*
|
729 |
+
* Handling Buffers, the old ones see @xmlBuf for the new ones.
|
730 |
+
*/
|
731 |
+
|
732 |
+
XMLPUBFUN void
|
733 |
+
xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
|
734 |
+
XMLPUBFUN xmlBufferAllocationScheme
|
735 |
+
xmlGetBufferAllocationScheme(void);
|
736 |
+
|
737 |
+
XMLPUBFUN xmlBufferPtr
|
738 |
+
xmlBufferCreate (void);
|
739 |
+
XMLPUBFUN xmlBufferPtr
|
740 |
+
xmlBufferCreateSize (size_t size);
|
741 |
+
XMLPUBFUN xmlBufferPtr
|
742 |
+
xmlBufferCreateStatic (void *mem,
|
743 |
+
size_t size);
|
744 |
+
XMLPUBFUN int
|
745 |
+
xmlBufferResize (xmlBufferPtr buf,
|
746 |
+
unsigned int size);
|
747 |
+
XMLPUBFUN void
|
748 |
+
xmlBufferFree (xmlBufferPtr buf);
|
749 |
+
XMLPUBFUN int
|
750 |
+
xmlBufferDump (FILE *file,
|
751 |
+
xmlBufferPtr buf);
|
752 |
+
XMLPUBFUN int
|
753 |
+
xmlBufferAdd (xmlBufferPtr buf,
|
754 |
+
const xmlChar *str,
|
755 |
+
int len);
|
756 |
+
XMLPUBFUN int
|
757 |
+
xmlBufferAddHead (xmlBufferPtr buf,
|
758 |
+
const xmlChar *str,
|
759 |
+
int len);
|
760 |
+
XMLPUBFUN int
|
761 |
+
xmlBufferCat (xmlBufferPtr buf,
|
762 |
+
const xmlChar *str);
|
763 |
+
XMLPUBFUN int
|
764 |
+
xmlBufferCCat (xmlBufferPtr buf,
|
765 |
+
const char *str);
|
766 |
+
XMLPUBFUN int
|
767 |
+
xmlBufferShrink (xmlBufferPtr buf,
|
768 |
+
unsigned int len);
|
769 |
+
XMLPUBFUN int
|
770 |
+
xmlBufferGrow (xmlBufferPtr buf,
|
771 |
+
unsigned int len);
|
772 |
+
XMLPUBFUN void
|
773 |
+
xmlBufferEmpty (xmlBufferPtr buf);
|
774 |
+
XMLPUBFUN const xmlChar*
|
775 |
+
xmlBufferContent (const xmlBuffer *buf);
|
776 |
+
XMLPUBFUN xmlChar*
|
777 |
+
xmlBufferDetach (xmlBufferPtr buf);
|
778 |
+
XMLPUBFUN void
|
779 |
+
xmlBufferSetAllocationScheme(xmlBufferPtr buf,
|
780 |
+
xmlBufferAllocationScheme scheme);
|
781 |
+
XMLPUBFUN int
|
782 |
+
xmlBufferLength (const xmlBuffer *buf);
|
783 |
+
|
784 |
+
/*
|
785 |
+
* Creating/freeing new structures.
|
786 |
+
*/
|
787 |
+
XMLPUBFUN xmlDtdPtr
|
788 |
+
xmlCreateIntSubset (xmlDocPtr doc,
|
789 |
+
const xmlChar *name,
|
790 |
+
const xmlChar *ExternalID,
|
791 |
+
const xmlChar *SystemID);
|
792 |
+
XMLPUBFUN xmlDtdPtr
|
793 |
+
xmlNewDtd (xmlDocPtr doc,
|
794 |
+
const xmlChar *name,
|
795 |
+
const xmlChar *ExternalID,
|
796 |
+
const xmlChar *SystemID);
|
797 |
+
XMLPUBFUN xmlDtdPtr
|
798 |
+
xmlGetIntSubset (const xmlDoc *doc);
|
799 |
+
XMLPUBFUN void
|
800 |
+
xmlFreeDtd (xmlDtdPtr cur);
|
801 |
+
#ifdef LIBXML_LEGACY_ENABLED
|
802 |
+
XML_DEPRECATED
|
803 |
+
XMLPUBFUN xmlNsPtr
|
804 |
+
xmlNewGlobalNs (xmlDocPtr doc,
|
805 |
+
const xmlChar *href,
|
806 |
+
const xmlChar *prefix);
|
807 |
+
#endif /* LIBXML_LEGACY_ENABLED */
|
808 |
+
XMLPUBFUN xmlNsPtr
|
809 |
+
xmlNewNs (xmlNodePtr node,
|
810 |
+
const xmlChar *href,
|
811 |
+
const xmlChar *prefix);
|
812 |
+
XMLPUBFUN void
|
813 |
+
xmlFreeNs (xmlNsPtr cur);
|
814 |
+
XMLPUBFUN void
|
815 |
+
xmlFreeNsList (xmlNsPtr cur);
|
816 |
+
XMLPUBFUN xmlDocPtr
|
817 |
+
xmlNewDoc (const xmlChar *version);
|
818 |
+
XMLPUBFUN void
|
819 |
+
xmlFreeDoc (xmlDocPtr cur);
|
820 |
+
XMLPUBFUN xmlAttrPtr
|
821 |
+
xmlNewDocProp (xmlDocPtr doc,
|
822 |
+
const xmlChar *name,
|
823 |
+
const xmlChar *value);
|
824 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
|
825 |
+
defined(LIBXML_SCHEMAS_ENABLED)
|
826 |
+
XMLPUBFUN xmlAttrPtr
|
827 |
+
xmlNewProp (xmlNodePtr node,
|
828 |
+
const xmlChar *name,
|
829 |
+
const xmlChar *value);
|
830 |
+
#endif
|
831 |
+
XMLPUBFUN xmlAttrPtr
|
832 |
+
xmlNewNsProp (xmlNodePtr node,
|
833 |
+
xmlNsPtr ns,
|
834 |
+
const xmlChar *name,
|
835 |
+
const xmlChar *value);
|
836 |
+
XMLPUBFUN xmlAttrPtr
|
837 |
+
xmlNewNsPropEatName (xmlNodePtr node,
|
838 |
+
xmlNsPtr ns,
|
839 |
+
xmlChar *name,
|
840 |
+
const xmlChar *value);
|
841 |
+
XMLPUBFUN void
|
842 |
+
xmlFreePropList (xmlAttrPtr cur);
|
843 |
+
XMLPUBFUN void
|
844 |
+
xmlFreeProp (xmlAttrPtr cur);
|
845 |
+
XMLPUBFUN xmlAttrPtr
|
846 |
+
xmlCopyProp (xmlNodePtr target,
|
847 |
+
xmlAttrPtr cur);
|
848 |
+
XMLPUBFUN xmlAttrPtr
|
849 |
+
xmlCopyPropList (xmlNodePtr target,
|
850 |
+
xmlAttrPtr cur);
|
851 |
+
#ifdef LIBXML_TREE_ENABLED
|
852 |
+
XMLPUBFUN xmlDtdPtr
|
853 |
+
xmlCopyDtd (xmlDtdPtr dtd);
|
854 |
+
#endif /* LIBXML_TREE_ENABLED */
|
855 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
856 |
+
XMLPUBFUN xmlDocPtr
|
857 |
+
xmlCopyDoc (xmlDocPtr doc,
|
858 |
+
int recursive);
|
859 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
|
860 |
+
/*
|
861 |
+
* Creating new nodes.
|
862 |
+
*/
|
863 |
+
XMLPUBFUN xmlNodePtr
|
864 |
+
xmlNewDocNode (xmlDocPtr doc,
|
865 |
+
xmlNsPtr ns,
|
866 |
+
const xmlChar *name,
|
867 |
+
const xmlChar *content);
|
868 |
+
XMLPUBFUN xmlNodePtr
|
869 |
+
xmlNewDocNodeEatName (xmlDocPtr doc,
|
870 |
+
xmlNsPtr ns,
|
871 |
+
xmlChar *name,
|
872 |
+
const xmlChar *content);
|
873 |
+
XMLPUBFUN xmlNodePtr
|
874 |
+
xmlNewNode (xmlNsPtr ns,
|
875 |
+
const xmlChar *name);
|
876 |
+
XMLPUBFUN xmlNodePtr
|
877 |
+
xmlNewNodeEatName (xmlNsPtr ns,
|
878 |
+
xmlChar *name);
|
879 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
880 |
+
XMLPUBFUN xmlNodePtr
|
881 |
+
xmlNewChild (xmlNodePtr parent,
|
882 |
+
xmlNsPtr ns,
|
883 |
+
const xmlChar *name,
|
884 |
+
const xmlChar *content);
|
885 |
+
#endif
|
886 |
+
XMLPUBFUN xmlNodePtr
|
887 |
+
xmlNewDocText (const xmlDoc *doc,
|
888 |
+
const xmlChar *content);
|
889 |
+
XMLPUBFUN xmlNodePtr
|
890 |
+
xmlNewText (const xmlChar *content);
|
891 |
+
XMLPUBFUN xmlNodePtr
|
892 |
+
xmlNewDocPI (xmlDocPtr doc,
|
893 |
+
const xmlChar *name,
|
894 |
+
const xmlChar *content);
|
895 |
+
XMLPUBFUN xmlNodePtr
|
896 |
+
xmlNewPI (const xmlChar *name,
|
897 |
+
const xmlChar *content);
|
898 |
+
XMLPUBFUN xmlNodePtr
|
899 |
+
xmlNewDocTextLen (xmlDocPtr doc,
|
900 |
+
const xmlChar *content,
|
901 |
+
int len);
|
902 |
+
XMLPUBFUN xmlNodePtr
|
903 |
+
xmlNewTextLen (const xmlChar *content,
|
904 |
+
int len);
|
905 |
+
XMLPUBFUN xmlNodePtr
|
906 |
+
xmlNewDocComment (xmlDocPtr doc,
|
907 |
+
const xmlChar *content);
|
908 |
+
XMLPUBFUN xmlNodePtr
|
909 |
+
xmlNewComment (const xmlChar *content);
|
910 |
+
XMLPUBFUN xmlNodePtr
|
911 |
+
xmlNewCDataBlock (xmlDocPtr doc,
|
912 |
+
const xmlChar *content,
|
913 |
+
int len);
|
914 |
+
XMLPUBFUN xmlNodePtr
|
915 |
+
xmlNewCharRef (xmlDocPtr doc,
|
916 |
+
const xmlChar *name);
|
917 |
+
XMLPUBFUN xmlNodePtr
|
918 |
+
xmlNewReference (const xmlDoc *doc,
|
919 |
+
const xmlChar *name);
|
920 |
+
XMLPUBFUN xmlNodePtr
|
921 |
+
xmlCopyNode (xmlNodePtr node,
|
922 |
+
int recursive);
|
923 |
+
XMLPUBFUN xmlNodePtr
|
924 |
+
xmlDocCopyNode (xmlNodePtr node,
|
925 |
+
xmlDocPtr doc,
|
926 |
+
int recursive);
|
927 |
+
XMLPUBFUN xmlNodePtr
|
928 |
+
xmlDocCopyNodeList (xmlDocPtr doc,
|
929 |
+
xmlNodePtr node);
|
930 |
+
XMLPUBFUN xmlNodePtr
|
931 |
+
xmlCopyNodeList (xmlNodePtr node);
|
932 |
+
#ifdef LIBXML_TREE_ENABLED
|
933 |
+
XMLPUBFUN xmlNodePtr
|
934 |
+
xmlNewTextChild (xmlNodePtr parent,
|
935 |
+
xmlNsPtr ns,
|
936 |
+
const xmlChar *name,
|
937 |
+
const xmlChar *content);
|
938 |
+
XMLPUBFUN xmlNodePtr
|
939 |
+
xmlNewDocRawNode (xmlDocPtr doc,
|
940 |
+
xmlNsPtr ns,
|
941 |
+
const xmlChar *name,
|
942 |
+
const xmlChar *content);
|
943 |
+
XMLPUBFUN xmlNodePtr
|
944 |
+
xmlNewDocFragment (xmlDocPtr doc);
|
945 |
+
#endif /* LIBXML_TREE_ENABLED */
|
946 |
+
|
947 |
+
/*
|
948 |
+
* Navigating.
|
949 |
+
*/
|
950 |
+
XMLPUBFUN long
|
951 |
+
xmlGetLineNo (const xmlNode *node);
|
952 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
|
953 |
+
XMLPUBFUN xmlChar *
|
954 |
+
xmlGetNodePath (const xmlNode *node);
|
955 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
|
956 |
+
XMLPUBFUN xmlNodePtr
|
957 |
+
xmlDocGetRootElement (const xmlDoc *doc);
|
958 |
+
XMLPUBFUN xmlNodePtr
|
959 |
+
xmlGetLastChild (const xmlNode *parent);
|
960 |
+
XMLPUBFUN int
|
961 |
+
xmlNodeIsText (const xmlNode *node);
|
962 |
+
XMLPUBFUN int
|
963 |
+
xmlIsBlankNode (const xmlNode *node);
|
964 |
+
|
965 |
+
/*
|
966 |
+
* Changing the structure.
|
967 |
+
*/
|
968 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
969 |
+
XMLPUBFUN xmlNodePtr
|
970 |
+
xmlDocSetRootElement (xmlDocPtr doc,
|
971 |
+
xmlNodePtr root);
|
972 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
|
973 |
+
#ifdef LIBXML_TREE_ENABLED
|
974 |
+
XMLPUBFUN void
|
975 |
+
xmlNodeSetName (xmlNodePtr cur,
|
976 |
+
const xmlChar *name);
|
977 |
+
#endif /* LIBXML_TREE_ENABLED */
|
978 |
+
XMLPUBFUN xmlNodePtr
|
979 |
+
xmlAddChild (xmlNodePtr parent,
|
980 |
+
xmlNodePtr cur);
|
981 |
+
XMLPUBFUN xmlNodePtr
|
982 |
+
xmlAddChildList (xmlNodePtr parent,
|
983 |
+
xmlNodePtr cur);
|
984 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
985 |
+
XMLPUBFUN xmlNodePtr
|
986 |
+
xmlReplaceNode (xmlNodePtr old,
|
987 |
+
xmlNodePtr cur);
|
988 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
|
989 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
|
990 |
+
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
|
991 |
+
XMLPUBFUN xmlNodePtr
|
992 |
+
xmlAddPrevSibling (xmlNodePtr cur,
|
993 |
+
xmlNodePtr elem);
|
994 |
+
#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
|
995 |
+
XMLPUBFUN xmlNodePtr
|
996 |
+
xmlAddSibling (xmlNodePtr cur,
|
997 |
+
xmlNodePtr elem);
|
998 |
+
XMLPUBFUN xmlNodePtr
|
999 |
+
xmlAddNextSibling (xmlNodePtr cur,
|
1000 |
+
xmlNodePtr elem);
|
1001 |
+
XMLPUBFUN void
|
1002 |
+
xmlUnlinkNode (xmlNodePtr cur);
|
1003 |
+
XMLPUBFUN xmlNodePtr
|
1004 |
+
xmlTextMerge (xmlNodePtr first,
|
1005 |
+
xmlNodePtr second);
|
1006 |
+
XMLPUBFUN int
|
1007 |
+
xmlTextConcat (xmlNodePtr node,
|
1008 |
+
const xmlChar *content,
|
1009 |
+
int len);
|
1010 |
+
XMLPUBFUN void
|
1011 |
+
xmlFreeNodeList (xmlNodePtr cur);
|
1012 |
+
XMLPUBFUN void
|
1013 |
+
xmlFreeNode (xmlNodePtr cur);
|
1014 |
+
XMLPUBFUN void
|
1015 |
+
xmlSetTreeDoc (xmlNodePtr tree,
|
1016 |
+
xmlDocPtr doc);
|
1017 |
+
XMLPUBFUN void
|
1018 |
+
xmlSetListDoc (xmlNodePtr list,
|
1019 |
+
xmlDocPtr doc);
|
1020 |
+
/*
|
1021 |
+
* Namespaces.
|
1022 |
+
*/
|
1023 |
+
XMLPUBFUN xmlNsPtr
|
1024 |
+
xmlSearchNs (xmlDocPtr doc,
|
1025 |
+
xmlNodePtr node,
|
1026 |
+
const xmlChar *nameSpace);
|
1027 |
+
XMLPUBFUN xmlNsPtr
|
1028 |
+
xmlSearchNsByHref (xmlDocPtr doc,
|
1029 |
+
xmlNodePtr node,
|
1030 |
+
const xmlChar *href);
|
1031 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
|
1032 |
+
defined(LIBXML_SCHEMAS_ENABLED)
|
1033 |
+
XMLPUBFUN xmlNsPtr *
|
1034 |
+
xmlGetNsList (const xmlDoc *doc,
|
1035 |
+
const xmlNode *node);
|
1036 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
|
1037 |
+
|
1038 |
+
XMLPUBFUN void
|
1039 |
+
xmlSetNs (xmlNodePtr node,
|
1040 |
+
xmlNsPtr ns);
|
1041 |
+
XMLPUBFUN xmlNsPtr
|
1042 |
+
xmlCopyNamespace (xmlNsPtr cur);
|
1043 |
+
XMLPUBFUN xmlNsPtr
|
1044 |
+
xmlCopyNamespaceList (xmlNsPtr cur);
|
1045 |
+
|
1046 |
+
/*
|
1047 |
+
* Changing the content.
|
1048 |
+
*/
|
1049 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
|
1050 |
+
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
|
1051 |
+
XMLPUBFUN xmlAttrPtr
|
1052 |
+
xmlSetProp (xmlNodePtr node,
|
1053 |
+
const xmlChar *name,
|
1054 |
+
const xmlChar *value);
|
1055 |
+
XMLPUBFUN xmlAttrPtr
|
1056 |
+
xmlSetNsProp (xmlNodePtr node,
|
1057 |
+
xmlNsPtr ns,
|
1058 |
+
const xmlChar *name,
|
1059 |
+
const xmlChar *value);
|
1060 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
|
1061 |
+
defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
|
1062 |
+
XMLPUBFUN xmlChar *
|
1063 |
+
xmlGetNoNsProp (const xmlNode *node,
|
1064 |
+
const xmlChar *name);
|
1065 |
+
XMLPUBFUN xmlChar *
|
1066 |
+
xmlGetProp (const xmlNode *node,
|
1067 |
+
const xmlChar *name);
|
1068 |
+
XMLPUBFUN xmlAttrPtr
|
1069 |
+
xmlHasProp (const xmlNode *node,
|
1070 |
+
const xmlChar *name);
|
1071 |
+
XMLPUBFUN xmlAttrPtr
|
1072 |
+
xmlHasNsProp (const xmlNode *node,
|
1073 |
+
const xmlChar *name,
|
1074 |
+
const xmlChar *nameSpace);
|
1075 |
+
XMLPUBFUN xmlChar *
|
1076 |
+
xmlGetNsProp (const xmlNode *node,
|
1077 |
+
const xmlChar *name,
|
1078 |
+
const xmlChar *nameSpace);
|
1079 |
+
XMLPUBFUN xmlNodePtr
|
1080 |
+
xmlStringGetNodeList (const xmlDoc *doc,
|
1081 |
+
const xmlChar *value);
|
1082 |
+
XMLPUBFUN xmlNodePtr
|
1083 |
+
xmlStringLenGetNodeList (const xmlDoc *doc,
|
1084 |
+
const xmlChar *value,
|
1085 |
+
int len);
|
1086 |
+
XMLPUBFUN xmlChar *
|
1087 |
+
xmlNodeListGetString (xmlDocPtr doc,
|
1088 |
+
const xmlNode *list,
|
1089 |
+
int inLine);
|
1090 |
+
#ifdef LIBXML_TREE_ENABLED
|
1091 |
+
XMLPUBFUN xmlChar *
|
1092 |
+
xmlNodeListGetRawString (const xmlDoc *doc,
|
1093 |
+
const xmlNode *list,
|
1094 |
+
int inLine);
|
1095 |
+
#endif /* LIBXML_TREE_ENABLED */
|
1096 |
+
XMLPUBFUN void
|
1097 |
+
xmlNodeSetContent (xmlNodePtr cur,
|
1098 |
+
const xmlChar *content);
|
1099 |
+
#ifdef LIBXML_TREE_ENABLED
|
1100 |
+
XMLPUBFUN void
|
1101 |
+
xmlNodeSetContentLen (xmlNodePtr cur,
|
1102 |
+
const xmlChar *content,
|
1103 |
+
int len);
|
1104 |
+
#endif /* LIBXML_TREE_ENABLED */
|
1105 |
+
XMLPUBFUN void
|
1106 |
+
xmlNodeAddContent (xmlNodePtr cur,
|
1107 |
+
const xmlChar *content);
|
1108 |
+
XMLPUBFUN void
|
1109 |
+
xmlNodeAddContentLen (xmlNodePtr cur,
|
1110 |
+
const xmlChar *content,
|
1111 |
+
int len);
|
1112 |
+
XMLPUBFUN xmlChar *
|
1113 |
+
xmlNodeGetContent (const xmlNode *cur);
|
1114 |
+
|
1115 |
+
XMLPUBFUN int
|
1116 |
+
xmlNodeBufGetContent (xmlBufferPtr buffer,
|
1117 |
+
const xmlNode *cur);
|
1118 |
+
XMLPUBFUN int
|
1119 |
+
xmlBufGetNodeContent (xmlBufPtr buf,
|
1120 |
+
const xmlNode *cur);
|
1121 |
+
|
1122 |
+
XMLPUBFUN xmlChar *
|
1123 |
+
xmlNodeGetLang (const xmlNode *cur);
|
1124 |
+
XMLPUBFUN int
|
1125 |
+
xmlNodeGetSpacePreserve (const xmlNode *cur);
|
1126 |
+
#ifdef LIBXML_TREE_ENABLED
|
1127 |
+
XMLPUBFUN void
|
1128 |
+
xmlNodeSetLang (xmlNodePtr cur,
|
1129 |
+
const xmlChar *lang);
|
1130 |
+
XMLPUBFUN void
|
1131 |
+
xmlNodeSetSpacePreserve (xmlNodePtr cur,
|
1132 |
+
int val);
|
1133 |
+
#endif /* LIBXML_TREE_ENABLED */
|
1134 |
+
XMLPUBFUN xmlChar *
|
1135 |
+
xmlNodeGetBase (const xmlDoc *doc,
|
1136 |
+
const xmlNode *cur);
|
1137 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
|
1138 |
+
XMLPUBFUN void
|
1139 |
+
xmlNodeSetBase (xmlNodePtr cur,
|
1140 |
+
const xmlChar *uri);
|
1141 |
+
#endif
|
1142 |
+
|
1143 |
+
/*
|
1144 |
+
* Removing content.
|
1145 |
+
*/
|
1146 |
+
XMLPUBFUN int
|
1147 |
+
xmlRemoveProp (xmlAttrPtr cur);
|
1148 |
+
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
1149 |
+
XMLPUBFUN int
|
1150 |
+
xmlUnsetNsProp (xmlNodePtr node,
|
1151 |
+
xmlNsPtr ns,
|
1152 |
+
const xmlChar *name);
|
1153 |
+
XMLPUBFUN int
|
1154 |
+
xmlUnsetProp (xmlNodePtr node,
|
1155 |
+
const xmlChar *name);
|
1156 |
+
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
|
1157 |
+
|
1158 |
+
/*
|
1159 |
+
* Internal, don't use.
|
1160 |
+
*/
|
1161 |
+
XMLPUBFUN void
|
1162 |
+
xmlBufferWriteCHAR (xmlBufferPtr buf,
|
1163 |
+
const xmlChar *string);
|
1164 |
+
XMLPUBFUN void
|
1165 |
+
xmlBufferWriteChar (xmlBufferPtr buf,
|
1166 |
+
const char *string);
|
1167 |
+
XMLPUBFUN void
|
1168 |
+
xmlBufferWriteQuotedString(xmlBufferPtr buf,
|
1169 |
+
const xmlChar *string);
|
1170 |
+
|
1171 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
1172 |
+
XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
|
1173 |
+
xmlDocPtr doc,
|
1174 |
+
xmlAttrPtr attr,
|
1175 |
+
const xmlChar *string);
|
1176 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
1177 |
+
|
1178 |
+
#ifdef LIBXML_TREE_ENABLED
|
1179 |
+
/*
|
1180 |
+
* Namespace handling.
|
1181 |
+
*/
|
1182 |
+
XMLPUBFUN int
|
1183 |
+
xmlReconciliateNs (xmlDocPtr doc,
|
1184 |
+
xmlNodePtr tree);
|
1185 |
+
#endif
|
1186 |
+
|
1187 |
+
#ifdef LIBXML_OUTPUT_ENABLED
|
1188 |
+
/*
|
1189 |
+
* Saving.
|
1190 |
+
*/
|
1191 |
+
XMLPUBFUN void
|
1192 |
+
xmlDocDumpFormatMemory (xmlDocPtr cur,
|
1193 |
+
xmlChar **mem,
|
1194 |
+
int *size,
|
1195 |
+
int format);
|
1196 |
+
XMLPUBFUN void
|
1197 |
+
xmlDocDumpMemory (xmlDocPtr cur,
|
1198 |
+
xmlChar **mem,
|
1199 |
+
int *size);
|
1200 |
+
XMLPUBFUN void
|
1201 |
+
xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
|
1202 |
+
xmlChar **doc_txt_ptr,
|
1203 |
+
int * doc_txt_len,
|
1204 |
+
const char *txt_encoding);
|
1205 |
+
XMLPUBFUN void
|
1206 |
+
xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
|
1207 |
+
xmlChar **doc_txt_ptr,
|
1208 |
+
int * doc_txt_len,
|
1209 |
+
const char *txt_encoding,
|
1210 |
+
int format);
|
1211 |
+
XMLPUBFUN int
|
1212 |
+
xmlDocFormatDump (FILE *f,
|
1213 |
+
xmlDocPtr cur,
|
1214 |
+
int format);
|
1215 |
+
XMLPUBFUN int
|
1216 |
+
xmlDocDump (FILE *f,
|
1217 |
+
xmlDocPtr cur);
|
1218 |
+
XMLPUBFUN void
|
1219 |
+
xmlElemDump (FILE *f,
|
1220 |
+
xmlDocPtr doc,
|
1221 |
+
xmlNodePtr cur);
|
1222 |
+
XMLPUBFUN int
|
1223 |
+
xmlSaveFile (const char *filename,
|
1224 |
+
xmlDocPtr cur);
|
1225 |
+
XMLPUBFUN int
|
1226 |
+
xmlSaveFormatFile (const char *filename,
|
1227 |
+
xmlDocPtr cur,
|
1228 |
+
int format);
|
1229 |
+
XMLPUBFUN size_t
|
1230 |
+
xmlBufNodeDump (xmlBufPtr buf,
|
1231 |
+
xmlDocPtr doc,
|
1232 |
+
xmlNodePtr cur,
|
1233 |
+
int level,
|
1234 |
+
int format);
|
1235 |
+
XMLPUBFUN int
|
1236 |
+
xmlNodeDump (xmlBufferPtr buf,
|
1237 |
+
xmlDocPtr doc,
|
1238 |
+
xmlNodePtr cur,
|
1239 |
+
int level,
|
1240 |
+
int format);
|
1241 |
+
|
1242 |
+
XMLPUBFUN int
|
1243 |
+
xmlSaveFileTo (xmlOutputBufferPtr buf,
|
1244 |
+
xmlDocPtr cur,
|
1245 |
+
const char *encoding);
|
1246 |
+
XMLPUBFUN int
|
1247 |
+
xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
|
1248 |
+
xmlDocPtr cur,
|
1249 |
+
const char *encoding,
|
1250 |
+
int format);
|
1251 |
+
XMLPUBFUN void
|
1252 |
+
xmlNodeDumpOutput (xmlOutputBufferPtr buf,
|
1253 |
+
xmlDocPtr doc,
|
1254 |
+
xmlNodePtr cur,
|
1255 |
+
int level,
|
1256 |
+
int format,
|
1257 |
+
const char *encoding);
|
1258 |
+
|
1259 |
+
XMLPUBFUN int
|
1260 |
+
xmlSaveFormatFileEnc (const char *filename,
|
1261 |
+
xmlDocPtr cur,
|
1262 |
+
const char *encoding,
|
1263 |
+
int format);
|
1264 |
+
|
1265 |
+
XMLPUBFUN int
|
1266 |
+
xmlSaveFileEnc (const char *filename,
|
1267 |
+
xmlDocPtr cur,
|
1268 |
+
const char *encoding);
|
1269 |
+
|
1270 |
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
1271 |
+
/*
|
1272 |
+
* XHTML
|
1273 |
+
*/
|
1274 |
+
XMLPUBFUN int
|
1275 |
+
xmlIsXHTML (const xmlChar *systemID,
|
1276 |
+
const xmlChar *publicID);
|
1277 |
+
|
1278 |
+
/*
|
1279 |
+
* Compression.
|
1280 |
+
*/
|
1281 |
+
XMLPUBFUN int
|
1282 |
+
xmlGetDocCompressMode (const xmlDoc *doc);
|
1283 |
+
XMLPUBFUN void
|
1284 |
+
xmlSetDocCompressMode (xmlDocPtr doc,
|
1285 |
+
int mode);
|
1286 |
+
XMLPUBFUN int
|
1287 |
+
xmlGetCompressMode (void);
|
1288 |
+
XMLPUBFUN void
|
1289 |
+
xmlSetCompressMode (int mode);
|
1290 |
+
|
1291 |
+
/*
|
1292 |
+
* DOM-wrapper helper functions.
|
1293 |
+
*/
|
1294 |
+
XMLPUBFUN xmlDOMWrapCtxtPtr
|
1295 |
+
xmlDOMWrapNewCtxt (void);
|
1296 |
+
XMLPUBFUN void
|
1297 |
+
xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
|
1298 |
+
XMLPUBFUN int
|
1299 |
+
xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
|
1300 |
+
xmlNodePtr elem,
|
1301 |
+
int options);
|
1302 |
+
XMLPUBFUN int
|
1303 |
+
xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
|
1304 |
+
xmlDocPtr sourceDoc,
|
1305 |
+
xmlNodePtr node,
|
1306 |
+
xmlDocPtr destDoc,
|
1307 |
+
xmlNodePtr destParent,
|
1308 |
+
int options);
|
1309 |
+
XMLPUBFUN int
|
1310 |
+
xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
|
1311 |
+
xmlDocPtr doc,
|
1312 |
+
xmlNodePtr node,
|
1313 |
+
int options);
|
1314 |
+
XMLPUBFUN int
|
1315 |
+
xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
|
1316 |
+
xmlDocPtr sourceDoc,
|
1317 |
+
xmlNodePtr node,
|
1318 |
+
xmlNodePtr *clonedNode,
|
1319 |
+
xmlDocPtr destDoc,
|
1320 |
+
xmlNodePtr destParent,
|
1321 |
+
int deep,
|
1322 |
+
int options);
|
1323 |
+
|
1324 |
+
#ifdef LIBXML_TREE_ENABLED
|
1325 |
+
/*
|
1326 |
+
* 5 interfaces from DOM ElementTraversal, but different in entities
|
1327 |
+
* traversal.
|
1328 |
+
*/
|
1329 |
+
XMLPUBFUN unsigned long
|
1330 |
+
xmlChildElementCount (xmlNodePtr parent);
|
1331 |
+
XMLPUBFUN xmlNodePtr
|
1332 |
+
xmlNextElementSibling (xmlNodePtr node);
|
1333 |
+
XMLPUBFUN xmlNodePtr
|
1334 |
+
xmlFirstElementChild (xmlNodePtr parent);
|
1335 |
+
XMLPUBFUN xmlNodePtr
|
1336 |
+
xmlLastElementChild (xmlNodePtr parent);
|
1337 |
+
XMLPUBFUN xmlNodePtr
|
1338 |
+
xmlPreviousElementSibling (xmlNodePtr node);
|
1339 |
+
#endif
|
1340 |
+
|
1341 |
+
XMLPUBFUN xmlRegisterNodeFunc
|
1342 |
+
xmlRegisterNodeDefault (xmlRegisterNodeFunc func);
|
1343 |
+
XMLPUBFUN xmlDeregisterNodeFunc
|
1344 |
+
xmlDeregisterNodeDefault (xmlDeregisterNodeFunc func);
|
1345 |
+
XMLPUBFUN xmlRegisterNodeFunc
|
1346 |
+
xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func);
|
1347 |
+
XMLPUBFUN xmlDeregisterNodeFunc
|
1348 |
+
xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func);
|
1349 |
+
|
1350 |
+
XML_DEPRECATED XMLPUBFUN xmlBufferAllocationScheme
|
1351 |
+
xmlThrDefBufferAllocScheme (xmlBufferAllocationScheme v);
|
1352 |
+
XML_DEPRECATED XMLPUBFUN int
|
1353 |
+
xmlThrDefDefaultBufferSize (int v);
|
1354 |
+
|
1355 |
+
#ifdef __cplusplus
|
1356 |
+
}
|
1357 |
+
#endif
|
1358 |
+
|
1359 |
+
#endif /* __XML_TREE_H__ */
|
1360 |
+
|
1361 |
+
#endif /* XML_TREE_INTERNALS */
|
1362 |
+
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/uri.h
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Summary: library of generic URI related routines
|
3 |
+
* Description: library of generic URI related routines
|
4 |
+
* Implements RFC 2396
|
5 |
+
*
|
6 |
+
* Copy: See Copyright for the status of this software.
|
7 |
+
*
|
8 |
+
* Author: Daniel Veillard
|
9 |
+
*/
|
10 |
+
|
11 |
+
#ifndef __XML_URI_H__
|
12 |
+
#define __XML_URI_H__
|
13 |
+
|
14 |
+
#include <stdio.h>
|
15 |
+
#include <libxml/xmlversion.h>
|
16 |
+
#include <libxml/xmlstring.h>
|
17 |
+
|
18 |
+
#ifdef __cplusplus
|
19 |
+
extern "C" {
|
20 |
+
#endif
|
21 |
+
|
22 |
+
/**
|
23 |
+
* xmlURI:
|
24 |
+
*
|
25 |
+
* A parsed URI reference. This is a struct containing the various fields
|
26 |
+
* as described in RFC 2396 but separated for further processing.
|
27 |
+
*
|
28 |
+
* Note: query is a deprecated field which is incorrectly unescaped.
|
29 |
+
* query_raw takes precedence over query if the former is set.
|
30 |
+
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html#00127
|
31 |
+
*/
|
32 |
+
typedef struct _xmlURI xmlURI;
|
33 |
+
typedef xmlURI *xmlURIPtr;
|
34 |
+
struct _xmlURI {
|
35 |
+
char *scheme; /* the URI scheme */
|
36 |
+
char *opaque; /* opaque part */
|
37 |
+
char *authority; /* the authority part */
|
38 |
+
char *server; /* the server part */
|
39 |
+
char *user; /* the user part */
|
40 |
+
int port; /* the port number */
|
41 |
+
char *path; /* the path string */
|
42 |
+
char *query; /* the query string (deprecated - use with caution) */
|
43 |
+
char *fragment; /* the fragment identifier */
|
44 |
+
int cleanup; /* parsing potentially unclean URI */
|
45 |
+
char *query_raw; /* the query string (as it appears in the URI) */
|
46 |
+
};
|
47 |
+
|
48 |
+
/*
|
49 |
+
* This function is in tree.h:
|
50 |
+
* xmlChar * xmlNodeGetBase (xmlDocPtr doc,
|
51 |
+
* xmlNodePtr cur);
|
52 |
+
*/
|
53 |
+
XMLPUBFUN xmlURIPtr
|
54 |
+
xmlCreateURI (void);
|
55 |
+
XMLPUBFUN xmlChar *
|
56 |
+
xmlBuildURI (const xmlChar *URI,
|
57 |
+
const xmlChar *base);
|
58 |
+
XMLPUBFUN xmlChar *
|
59 |
+
xmlBuildRelativeURI (const xmlChar *URI,
|
60 |
+
const xmlChar *base);
|
61 |
+
XMLPUBFUN xmlURIPtr
|
62 |
+
xmlParseURI (const char *str);
|
63 |
+
XMLPUBFUN xmlURIPtr
|
64 |
+
xmlParseURIRaw (const char *str,
|
65 |
+
int raw);
|
66 |
+
XMLPUBFUN int
|
67 |
+
xmlParseURIReference (xmlURIPtr uri,
|
68 |
+
const char *str);
|
69 |
+
XMLPUBFUN xmlChar *
|
70 |
+
xmlSaveUri (xmlURIPtr uri);
|
71 |
+
XMLPUBFUN void
|
72 |
+
xmlPrintURI (FILE *stream,
|
73 |
+
xmlURIPtr uri);
|
74 |
+
XMLPUBFUN xmlChar *
|
75 |
+
xmlURIEscapeStr (const xmlChar *str,
|
76 |
+
const xmlChar *list);
|
77 |
+
XMLPUBFUN char *
|
78 |
+
xmlURIUnescapeString (const char *str,
|
79 |
+
int len,
|
80 |
+
char *target);
|
81 |
+
XMLPUBFUN int
|
82 |
+
xmlNormalizeURIPath (char *path);
|
83 |
+
XMLPUBFUN xmlChar *
|
84 |
+
xmlURIEscape (const xmlChar *str);
|
85 |
+
XMLPUBFUN void
|
86 |
+
xmlFreeURI (xmlURIPtr uri);
|
87 |
+
XMLPUBFUN xmlChar*
|
88 |
+
xmlCanonicPath (const xmlChar *path);
|
89 |
+
XMLPUBFUN xmlChar*
|
90 |
+
xmlPathToURI (const xmlChar *path);
|
91 |
+
|
92 |
+
#ifdef __cplusplus
|
93 |
+
}
|
94 |
+
#endif
|
95 |
+
#endif /* __XML_URI_H__ */
|
llmeval-env/lib/python3.10/site-packages/lxml/includes/libxml/xinclude.h
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Summary: implementation of XInclude
|
3 |
+
* Description: API to handle XInclude processing,
|
4 |
+
* implements the
|
5 |
+
* World Wide Web Consortium Last Call Working Draft 10 November 2003
|
6 |
+
* http://www.w3.org/TR/2003/WD-xinclude-20031110
|
7 |
+
*
|
8 |
+
* Copy: See Copyright for the status of this software.
|
9 |
+
*
|
10 |
+
* Author: Daniel Veillard
|
11 |
+
*/
|
12 |
+
|
13 |
+
#ifndef __XML_XINCLUDE_H__
|
14 |
+
#define __XML_XINCLUDE_H__
|
15 |
+
|
16 |
+
#include <libxml/xmlversion.h>
|
17 |
+
#include <libxml/tree.h>
|
18 |
+
|
19 |
+
#ifdef LIBXML_XINCLUDE_ENABLED
|
20 |
+
|
21 |
+
#ifdef __cplusplus
|
22 |
+
extern "C" {
|
23 |
+
#endif
|
24 |
+
|
25 |
+
/**
|
26 |
+
* XINCLUDE_NS:
|
27 |
+
*
|
28 |
+
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
|
29 |
+
*/
|
30 |
+
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
|
31 |
+
/**
|
32 |
+
* XINCLUDE_OLD_NS:
|
33 |
+
*
|
34 |
+
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
|
35 |
+
*/
|
36 |
+
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
|
37 |
+
/**
|
38 |
+
* XINCLUDE_NODE:
|
39 |
+
*
|
40 |
+
* Macro defining "include"
|
41 |
+
*/
|
42 |
+
#define XINCLUDE_NODE (const xmlChar *) "include"
|
43 |
+
/**
|
44 |
+
* XINCLUDE_FALLBACK:
|
45 |
+
*
|
46 |
+
* Macro defining "fallback"
|
47 |
+
*/
|
48 |
+
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
|
49 |
+
/**
|
50 |
+
* XINCLUDE_HREF:
|
51 |
+
*
|
52 |
+
* Macro defining "href"
|
53 |
+
*/
|
54 |
+
#define XINCLUDE_HREF (const xmlChar *) "href"
|
55 |
+
/**
|
56 |
+
* XINCLUDE_PARSE:
|
57 |
+
*
|
58 |
+
* Macro defining "parse"
|
59 |
+
*/
|
60 |
+
#define XINCLUDE_PARSE (const xmlChar *) "parse"
|
61 |
+
/**
|
62 |
+
* XINCLUDE_PARSE_XML:
|
63 |
+
*
|
64 |
+
* Macro defining "xml"
|
65 |
+
*/
|
66 |
+
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
|
67 |
+
/**
|
68 |
+
* XINCLUDE_PARSE_TEXT:
|
69 |
+
*
|
70 |
+
* Macro defining "text"
|
71 |
+
*/
|
72 |
+
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
|
73 |
+
/**
|
74 |
+
* XINCLUDE_PARSE_ENCODING:
|
75 |
+
*
|
76 |
+
* Macro defining "encoding"
|
77 |
+
*/
|
78 |
+
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
|
79 |
+
/**
|
80 |
+
* XINCLUDE_PARSE_XPOINTER:
|
81 |
+
*
|
82 |
+
* Macro defining "xpointer"
|
83 |
+
*/
|
84 |
+
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
|
85 |
+
|
86 |
+
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
|
87 |
+
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
|
88 |
+
|
89 |
+
/*
|
90 |
+
* standalone processing
|
91 |
+
*/
|
92 |
+
XMLPUBFUN int
|
93 |
+
xmlXIncludeProcess (xmlDocPtr doc);
|
94 |
+
XMLPUBFUN int
|
95 |
+
xmlXIncludeProcessFlags (xmlDocPtr doc,
|
96 |
+
int flags);
|
97 |
+
XMLPUBFUN int
|
98 |
+
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
|
99 |
+
int flags,
|
100 |
+
void *data);
|
101 |
+
XMLPUBFUN int
|
102 |
+
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
|
103 |
+
int flags,
|
104 |
+
void *data);
|
105 |
+
XMLPUBFUN int
|
106 |
+
xmlXIncludeProcessTree (xmlNodePtr tree);
|
107 |
+
XMLPUBFUN int
|
108 |
+
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
|
109 |
+
int flags);
|
110 |
+
/*
|
111 |
+
* contextual processing
|
112 |
+
*/
|
113 |
+
XMLPUBFUN xmlXIncludeCtxtPtr
|
114 |
+
xmlXIncludeNewContext (xmlDocPtr doc);
|
115 |
+
XMLPUBFUN int
|
116 |
+
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
|
117 |
+
int flags);
|
118 |
+
XMLPUBFUN void
|
119 |
+
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
|
120 |
+
XMLPUBFUN int
|
121 |
+
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
|
122 |
+
xmlNodePtr tree);
|
123 |
+
#ifdef __cplusplus
|
124 |
+
}
|
125 |
+
#endif
|
126 |
+
|
127 |
+
#endif /* LIBXML_XINCLUDE_ENABLED */
|
128 |
+
|
129 |
+
#endif /* __XML_XINCLUDE_H__ */
|