taurus 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +8 -0
- data/CHANGELOG.md +518 -0
- data/CLAUDE.md +104 -0
- data/LICENSE.md +33 -0
- data/README.adoc +1529 -0
- data/Rakefile +7 -0
- data/TODO.impl/01-architecture.md +217 -0
- data/TODO.impl/02-ffi-declarations.md +236 -0
- data/TODO.impl/03-document-node-element-nodeset.md +382 -0
- data/TODO.impl/04-sax-parser.md +203 -0
- data/TODO.impl/05-serialize-c14n-memory-specs-css.md +276 -0
- data/benchmark/README.md +168 -0
- data/benchmark/taurus_vs_nokogiri.rb +105 -0
- data/docs/ARCHITECTURE.adoc +559 -0
- data/docs/BUILD.md +395 -0
- data/docs/ERROR_MESSAGES.md +458 -0
- data/docs/FFI_ARCHITECTURE.md +439 -0
- data/docs/FUTURE_VISION.md +303 -0
- data/docs/GITHUB_ACTIONS.md +293 -0
- data/docs/OPTIMIZATIONS_IMPLEMENTED.adoc +459 -0
- data/docs/PERFORMANCE.adoc +668 -0
- data/docs/PERFORMANCE.md +448 -0
- data/docs/RELEASE_NOTES_v1.0.0.md +515 -0
- data/docs/XPATH_SPEC_COMPLIANCE.md +298 -0
- data/docs/completion/taurus.bash +86 -0
- data/docs/completion/taurus.zsh +74 -0
- data/docs/man/taurus-format.1 +227 -0
- data/docs/man/taurus-parse.1 +178 -0
- data/docs/man/taurus-xpath.1 +312 -0
- data/docs/man/taurus.1 +160 -0
- data/docs/v0.9.0_PERFORMANCE_IMPROVEMENTS.md +217 -0
- data/docs/v0.9.0_RELEASE_SUMMARY.md +281 -0
- data/docs/v1.0.0_CONTINUATION_PLAN.md +172 -0
- data/docs/v1.0.0_CONTINUATION_PROMPT.md +382 -0
- data/docs/v1.0.0_SESSION_6_CONTINUATION.md +434 -0
- data/docs/v1.0.0_SESSION_6_PROMPT.md +231 -0
- data/docs/v1.0.0_STATUS_TRACKER.md +224 -0
- data/docs/v1.1.0_CONTINUATION_PLAN.md +299 -0
- data/docs/v1.1.0_FINAL_CONTINUATION_PLAN.md +201 -0
- data/docs/v1.1.0_SESSION_3_PROMPT.md +223 -0
- data/docs/v1.1.0_STATUS_TRACKER.md +355 -0
- data/docs/xml-performance.adoc +115 -0
- data/docs/xpath-performance.adoc +379 -0
- data/lib/taurus/version.rb +5 -0
- data/lib/taurus/xml/attr.rb +43 -0
- data/lib/taurus/xml/c14n.rb +23 -0
- data/lib/taurus/xml/cdata.rb +16 -0
- data/lib/taurus/xml/comment.rb +16 -0
- data/lib/taurus/xml/css_to_xpath.rb +177 -0
- data/lib/taurus/xml/doc_type.rb +54 -0
- data/lib/taurus/xml/document.rb +202 -0
- data/lib/taurus/xml/document_fragment.rb +42 -0
- data/lib/taurus/xml/element.rb +278 -0
- data/lib/taurus/xml/ffi.rb +420 -0
- data/lib/taurus/xml/namespace.rb +43 -0
- data/lib/taurus/xml/node.rb +221 -0
- data/lib/taurus/xml/node_set.rb +143 -0
- data/lib/taurus/xml/parse_options.rb +19 -0
- data/lib/taurus/xml/processing_instruction.rb +26 -0
- data/lib/taurus/xml/sax/document.rb +45 -0
- data/lib/taurus/xml/sax/parser.rb +148 -0
- data/lib/taurus/xml/sax.rb +12 -0
- data/lib/taurus/xml/searchable.rb +93 -0
- data/lib/taurus/xml/text.rb +16 -0
- data/lib/taurus/xml.rb +29 -0
- data/lib/taurus.rb +7 -0
- data/taurus.gemspec +42 -0
- metadata +157 -0
data/docs/BUILD.md
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
# Building Taurus
|
|
2
|
+
|
|
3
|
+
This guide explains how to build the Taurus C library and run tests.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
### Required
|
|
8
|
+
- **CMake** >= 3.15
|
|
9
|
+
- **C99 compiler** (GCC, Clang, or MSVC)
|
|
10
|
+
- **Make** or **Ninja** (build system)
|
|
11
|
+
|
|
12
|
+
### Optional
|
|
13
|
+
- **vcpkg** - For package management
|
|
14
|
+
- **pkg-config** - For library discovery
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### Build and Test
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Create build directory
|
|
22
|
+
mkdir build
|
|
23
|
+
cd build
|
|
24
|
+
|
|
25
|
+
# Configure
|
|
26
|
+
cmake ..
|
|
27
|
+
|
|
28
|
+
# Build
|
|
29
|
+
cmake --build .
|
|
30
|
+
|
|
31
|
+
# Run tests
|
|
32
|
+
ctest --output-on-failure
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Install to /usr/local (default)
|
|
39
|
+
sudo cmake --install build
|
|
40
|
+
|
|
41
|
+
# Or install to custom location
|
|
42
|
+
cmake --install build --prefix /opt/taurus
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Build Options
|
|
46
|
+
|
|
47
|
+
### CMake Options
|
|
48
|
+
|
|
49
|
+
Configure with custom options:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cmake .. \
|
|
53
|
+
-DBUILD_SHARED_LIBS=ON \
|
|
54
|
+
-DBUILD_TESTING=ON \
|
|
55
|
+
-DTAURUS_BUILD_CLI=OFF \
|
|
56
|
+
-DCMAKE_BUILD_TYPE=Release
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Available Options:**
|
|
60
|
+
|
|
61
|
+
| Option | Default | Description |
|
|
62
|
+
|--------|---------|-------------|
|
|
63
|
+
| `BUILD_SHARED_LIBS` | `ON` | Build shared libraries (.so/.dylib/.dll) |
|
|
64
|
+
| `BUILD_TESTING` | `ON` | Build C unit tests |
|
|
65
|
+
| `TAURUS_BUILD_CLI` | `OFF` | Build CLI tool (future) |
|
|
66
|
+
| `CMAKE_BUILD_TYPE` | - | Build type: `Debug`, `Release`, `RelWithDebInfo` |
|
|
67
|
+
| `CMAKE_INSTALL_PREFIX` | `/usr/local` | Installation directory |
|
|
68
|
+
|
|
69
|
+
### Build Types
|
|
70
|
+
|
|
71
|
+
**Release Build** (optimized):
|
|
72
|
+
```bash
|
|
73
|
+
cmake .. -DCMAKE_BUILD_TYPE=Release
|
|
74
|
+
cmake --build .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Debug Build** (with symbols):
|
|
78
|
+
```bash
|
|
79
|
+
cmake .. -DCMAKE_BUILD_TYPE=Debug
|
|
80
|
+
cmake --build .
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Static Library**:
|
|
84
|
+
```bash
|
|
85
|
+
cmake .. -DBUILD_SHARED_LIBS=OFF
|
|
86
|
+
cmake --build .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Platform-Specific Instructions
|
|
90
|
+
|
|
91
|
+
### macOS (Apple Silicon/Intel)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Using system compiler (Clang)
|
|
95
|
+
mkdir build && cd build
|
|
96
|
+
cmake ..
|
|
97
|
+
cmake --build .
|
|
98
|
+
ctest
|
|
99
|
+
|
|
100
|
+
# Install
|
|
101
|
+
sudo cmake --install .
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Linux (Ubuntu/Debian)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Install dependencies
|
|
108
|
+
sudo apt-get install build-essential cmake
|
|
109
|
+
|
|
110
|
+
# Build
|
|
111
|
+
mkdir build && cd build
|
|
112
|
+
cmake ..
|
|
113
|
+
cmake --build .
|
|
114
|
+
ctest
|
|
115
|
+
|
|
116
|
+
# Install
|
|
117
|
+
sudo cmake --install .
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Linux (Fedora/RHEL)
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Install dependencies
|
|
124
|
+
sudo dnf install gcc cmake make
|
|
125
|
+
|
|
126
|
+
# Build
|
|
127
|
+
mkdir build && cd build
|
|
128
|
+
cmake ..
|
|
129
|
+
cmake --build .
|
|
130
|
+
ctest
|
|
131
|
+
|
|
132
|
+
# Install
|
|
133
|
+
sudo cmake --install .
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Windows (MSVC)
|
|
137
|
+
|
|
138
|
+
```powershell
|
|
139
|
+
# Using Visual Studio Developer Command Prompt
|
|
140
|
+
mkdir build
|
|
141
|
+
cd build
|
|
142
|
+
cmake ..
|
|
143
|
+
cmake --build . --config Release
|
|
144
|
+
|
|
145
|
+
# Run tests
|
|
146
|
+
ctest -C Release
|
|
147
|
+
|
|
148
|
+
# Install (as Administrator)
|
|
149
|
+
cmake --install . --config Release
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Windows (MinGW)
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Using MinGW/MSYS2
|
|
156
|
+
mkdir build && cd build
|
|
157
|
+
cmake .. -G "MinGW Makefiles"
|
|
158
|
+
cmake --build .
|
|
159
|
+
ctest
|
|
160
|
+
|
|
161
|
+
# Install
|
|
162
|
+
cmake --install .
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Using vcpkg
|
|
166
|
+
|
|
167
|
+
### Install via vcpkg
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Clone taurus repository
|
|
171
|
+
git clone https://github.com/lutaml/taurus.git
|
|
172
|
+
|
|
173
|
+
# Install using local port
|
|
174
|
+
vcpkg install taurus --overlay-ports=./taurus/ports
|
|
175
|
+
|
|
176
|
+
# Or after submission to vcpkg registry:
|
|
177
|
+
vcpkg install taurus
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Use in CMake Project
|
|
181
|
+
|
|
182
|
+
```cmake
|
|
183
|
+
# Find taurus package
|
|
184
|
+
find_package(taurus CONFIG REQUIRED)
|
|
185
|
+
|
|
186
|
+
# Link to your target
|
|
187
|
+
target_link_libraries(your_app PRIVATE taurus::taurus)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Use with pkg-config
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Check installation
|
|
194
|
+
pkg-config --modversion taurus
|
|
195
|
+
pkg-config --cflags taurus
|
|
196
|
+
pkg-config --libs taurus
|
|
197
|
+
|
|
198
|
+
# Compile with pkg-config
|
|
199
|
+
gcc main.c $(pkg-config --cflags --libs taurus) -o myapp
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Running Tests
|
|
203
|
+
|
|
204
|
+
### All Tests
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
cd build
|
|
208
|
+
ctest --output-on-failure
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Specific Test
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
cd build
|
|
215
|
+
./test/test_lexer
|
|
216
|
+
./test/test_parser
|
|
217
|
+
./test/test_evaluator
|
|
218
|
+
./test/test_functions
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Test with Verbose Output
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
cd build
|
|
225
|
+
ctest --verbose
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Test Labels
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Run only unit tests
|
|
232
|
+
ctest -L unit
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Installed Files
|
|
236
|
+
|
|
237
|
+
After installation, the following files are available:
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
/usr/local/
|
|
241
|
+
├── include/
|
|
242
|
+
│ └── taurus/
|
|
243
|
+
│ └── taurus.h # Public API header
|
|
244
|
+
├── lib/
|
|
245
|
+
│ ├── libtaurus.so # Shared library (Linux)
|
|
246
|
+
│ ├── libtaurus.dylib # Shared library (macOS)
|
|
247
|
+
│ ├── libtaurus.a # Static library
|
|
248
|
+
│ ├── pkgconfig/
|
|
249
|
+
│ │ └── taurus.pc # pkg-config file
|
|
250
|
+
│ └── cmake/
|
|
251
|
+
│ └── taurus/
|
|
252
|
+
│ ├── taurus-config.cmake
|
|
253
|
+
│ ├── taurus-config-version.cmake
|
|
254
|
+
│ └── taurus-targets.cmake
|
|
255
|
+
└── share/
|
|
256
|
+
└── taurus/
|
|
257
|
+
└── copyright # License file
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Using Installed Library
|
|
261
|
+
|
|
262
|
+
### C Example
|
|
263
|
+
|
|
264
|
+
```c
|
|
265
|
+
#include <taurus/taurus.h>
|
|
266
|
+
#include <stdio.h>
|
|
267
|
+
|
|
268
|
+
int main() {
|
|
269
|
+
const char* xml = "<root><item>Hello</item></root>";
|
|
270
|
+
|
|
271
|
+
// Parse XML
|
|
272
|
+
struct taurus_document* doc = taurus_parse(xml, strlen(xml));
|
|
273
|
+
if (!doc) {
|
|
274
|
+
fprintf(stderr, "Parse failed\n");
|
|
275
|
+
return 1;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Get root element
|
|
279
|
+
struct taurus_element* root = taurus_document_root(doc);
|
|
280
|
+
printf("Root: %s\n", taurus_element_name(root));
|
|
281
|
+
|
|
282
|
+
// Evaluate XPath
|
|
283
|
+
struct taurus_xpath_result* result =
|
|
284
|
+
taurus_xpath_eval(doc, "//item", 6);
|
|
285
|
+
|
|
286
|
+
// Cleanup
|
|
287
|
+
taurus_xpath_result_free(result);
|
|
288
|
+
taurus_document_free(doc);
|
|
289
|
+
|
|
290
|
+
return 0;
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Compile Example
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Using pkg-config
|
|
298
|
+
gcc example.c $(pkg-config --cflags --libs taurus) -o example
|
|
299
|
+
|
|
300
|
+
# Using CMake find_package
|
|
301
|
+
# See CMakeLists.txt example above
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Troubleshooting
|
|
305
|
+
|
|
306
|
+
### Build Fails with "CMake not found"
|
|
307
|
+
|
|
308
|
+
Install CMake:
|
|
309
|
+
```bash
|
|
310
|
+
# macOS
|
|
311
|
+
brew install cmake
|
|
312
|
+
|
|
313
|
+
# Ubuntu/Debian
|
|
314
|
+
sudo apt-get install cmake
|
|
315
|
+
|
|
316
|
+
# Fedora/RHEL
|
|
317
|
+
sudo dnf install cmake
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Build Fails with "C compiler not found"
|
|
321
|
+
|
|
322
|
+
Install development tools:
|
|
323
|
+
```bash
|
|
324
|
+
# macOS
|
|
325
|
+
xcode-select --install
|
|
326
|
+
|
|
327
|
+
# Ubuntu/Debian
|
|
328
|
+
sudo apt-get install build-essential
|
|
329
|
+
|
|
330
|
+
# Fedora/RHEL
|
|
331
|
+
sudo dnf groupinstall "Development Tools"
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Tests Fail
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# Clean build directory
|
|
338
|
+
cd build
|
|
339
|
+
rm -rf *
|
|
340
|
+
|
|
341
|
+
# Reconfigure and rebuild
|
|
342
|
+
cmake ..
|
|
343
|
+
cmake --build .
|
|
344
|
+
|
|
345
|
+
# Run tests with verbose output
|
|
346
|
+
ctest --verbose --rerun-failed --output-on-failure
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Library Not Found After Installation
|
|
350
|
+
|
|
351
|
+
Update library cache:
|
|
352
|
+
```bash
|
|
353
|
+
# Linux
|
|
354
|
+
sudo ldconfig
|
|
355
|
+
|
|
356
|
+
# macOS - add to DYLD_LIBRARY_PATH
|
|
357
|
+
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Development Build
|
|
361
|
+
|
|
362
|
+
For development work:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
# Debug build with verbose output
|
|
366
|
+
mkdir build-debug && cd build-debug
|
|
367
|
+
cmake .. \
|
|
368
|
+
-DCMAKE_BUILD_TYPE=Debug \
|
|
369
|
+
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
|
370
|
+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
|
371
|
+
cmake --build . -- VERBOSE=1
|
|
372
|
+
|
|
373
|
+
# Run tests
|
|
374
|
+
ctest --verbose
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
The `compile_commands.json` file will be generated for IDE integration.
|
|
378
|
+
|
|
379
|
+
## Clean Build
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
# Remove build directory
|
|
383
|
+
rm -rf build
|
|
384
|
+
|
|
385
|
+
# Recreate and build
|
|
386
|
+
mkdir build && cd build
|
|
387
|
+
cmake ..
|
|
388
|
+
cmake --build .
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
## Support
|
|
392
|
+
|
|
393
|
+
- **Issues**: https://github.com/lutaml/taurus/issues
|
|
394
|
+
- **Documentation**: https://github.com/lutaml/taurus/tree/main/docs
|
|
395
|
+
- **License**: BSD-2-Clause
|