-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
153 lines (150 loc) · 6.54 KB
/
Copy pathlib.rs
File metadata and controls
153 lines (150 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! dwg-rs · Apache-2.0 Rust reader for Autodesk DWG files (R13 → R2018 / AC1032).
//!
//! Implemented from the Open Design Alliance's freely-redistributable
//! *Open Design Specification for .dwg files* (v5.4.1). The crate does not
//! link against the Autodesk SDK or the ODA SDK, and no executable code
//! from GPL-licensed DWG readers was imported. See
//! [`CLEANROOM.md`](https://github.com/DrunkOnJava/dwg-rs/blob/main/CLEANROOM.md)
//! for the full source-provenance policy and the scope of what "clean-room"
//! means for a solo-developer project (spec-only, no-reference-source posture,
//! not a formal two-team clean-room protocol).
//!
//! # Quick start
//!
//! ```no_run
//! use dwg::DwgFile;
//!
//! let f = DwgFile::open("drawing.dwg")?;
//! println!("version: {}", f.version());
//! for s in f.sections() {
//! println!("{} ({} bytes at 0x{:x})", s.name, s.size, s.offset);
//! }
//! # Ok::<(), dwg::Error>(())
//! ```
//!
//! # Version coverage
//!
//! This crate is pre-alpha. Coverage below reflects what currently
//! parses end-to-end against measured corpora, not what the spec
//! describes. See `README.md` for the empirical decode-rate table.
//!
//! | Magic | Release | Status |
//! |----------|-------------------------|---------------------------------------------------------------------------------------------|
//! | `AC1014` | R14 | Identifier / header recognized; object-stream walker for this layout not yet implemented |
//! | `AC1015` | 2000 / 2000i / 2002 | Identifier / header recognized; object-stream walker not yet implemented |
//! | `AC1018` | 2004 / 2005 / 2006 | Container parsing works; end-to-end entity decode currently low on real corpora |
//! | `AC1021` | 2007 / 2008 / 2009 | **Deferred** — Sec_Mask layer-2 bookkeeping not yet implemented; section payloads error |
//! | `AC1024` | 2010 / 2011 / 2012 | Container parsing works; partial entity decode (see README for measured coverage) |
//! | `AC1027` | 2013 → 2017 | Container parsing works; best current entity coverage, still pre-alpha |
//! | `AC1032` | 2018 → 2025+ | Object walker works on sample; typed entity decode has known correctness gaps on real files |
//!
//! # Module map
//!
//! - [`bitcursor`] / [`bitwriter`] — bit-level primitives (spec §2)
//! - [`cipher`] — R2004+ XOR magic-sequence + Sec_Mask page masking
//! - [`crc`] — CRC-8 (spec §2.14.1) and CRC-32 (IEEE)
//! - [`lz77`] / [`lz77_encode`] — LZ77 de/compression (spec §4.7)
//! - [`reed_solomon`] — (255,239) FEC over GF(256), defensive-only
//! - [`header`] / [`header_vars`] — file-open header + `AcDb:Header` parse
//! - [`section`] / [`section_map`] / [`section_writer`] — page + section layer
//! - [`handle_map`] / [`classes`] — object-stream cross-ref tables
//! - [`metadata`] — SummaryInfo / AppInfo / Preview / FileDepList
//! - [`object`] / [`object_type`] / [`common_entity`] — object-stream walker
//! - [`entities`] — per-entity decoders (LINE, CIRCLE, TEXT, MTEXT, INSERT,
//! DIMENSION family, HATCH, MLEADER, VIEWPORT, ...)
//! - [`tables`] — symbol-table entries (LAYER, LTYPE, STYLE, VIEW, UCS,
//! VPORT, APPID, DIMSTYLE, BLOCK_RECORD)
//! - [`objects`] — DICTIONARY / XRECORD / `*_CONTROL`
//! - [`r2007`] — R2007-specific Sec_Mask two-layer obfuscation (layer 1 done)
//! - [`file_writer`] — scaffolded inverse of [`reader::DwgFile`]
//! - [`graph`] — Phase 5 handle-driven traversal helpers (owner / reactor
//! chains, layer / linetype / style / dimstyle resolution)
//!
//! See [`ARCHITECTURE.md`](https://github.com/DrunkOnJava/dwg-rs/blob/main/ARCHITECTURE.md)
//! for the full design document.
//!
//! # Safety
//!
//! The entire crate is `#![deny(unsafe_code)]`. All parsing returns
//! `Result<T, Error>` — no panics on malformed input. Defensive caps
//! bound runaway allocations from adversarial files. See
//! [`SECURITY.md`](https://github.com/DrunkOnJava/dwg-rs/blob/main/SECURITY.md)
//! for the threat model and private vulnerability reporting.
//!
//! # Legal posture
//!
//! "Autodesk", "AutoCAD", and "DWG" are trademarks of Autodesk, Inc.
//! This crate is not affiliated with, authorized by, or endorsed by
//! Autodesk. It is a spec-based interoperability implementation built
//! from the ODA's freely-redistributable *Open Design Specification
//! for .dwg files* (v5.4.1) — a document available separately from
//! the ODA's Drawings SDK license. No executable code from the
//! Autodesk SDK, the ODA SDK, or GPL-licensed DWG readers was
//! imported. One scoped exception is documented in `CLEANROOM.md`:
//! algorithm-description comments (not code) in the MIT-licensed
//! ACadSharp were consulted to resolve one LZ77 offset-encoding
//! ambiguity.
//!
//! Users with specific legal constraints should evaluate the project
//! with their own counsel. `NOTICE` summarizes the public authorities
//! that typically support independent file-format reverse engineering
//! for interoperability; nothing in this crate is offered as legal
//! advice.
#![forbid(unsafe_code)]
#![warn(missing_debug_implementations)]
pub mod api;
pub mod bitcursor;
pub mod bitwriter;
pub mod block_expansion;
pub mod cipher;
pub mod classes;
pub mod color;
pub mod common_entity;
pub mod crc;
pub mod curve;
pub mod dxf;
pub mod dxf_convert;
pub mod dxf_sections;
pub mod element_encoder;
pub mod entities;
pub mod entity_geometry;
pub mod error;
pub mod file_writer;
pub mod geometry;
pub mod gltf;
pub mod graph;
pub mod handle_allocator;
pub mod handle_map;
pub mod header;
pub mod header_vars;
pub mod limits;
pub mod lz77;
pub mod lz77_encode;
pub mod metadata;
pub mod object;
pub mod object_type;
pub mod objects;
pub mod python_stubs;
pub mod r2007;
pub mod reader;
pub mod reed_solomon;
pub mod reed_solomon_encode;
pub mod section;
pub mod section_map;
pub mod section_writer;
pub mod svg;
pub mod tables;
pub mod version;
pub use bitcursor::BitCursor;
pub use classes::{ClassDef, ClassMap};
pub use dxf::{DxfVersion, DxfWriter};
pub use error::{Error, Result};
pub use handle_map::{HandleEntry, HandleMap};
pub use header_vars::HeaderVars;
pub use limits::{ParseLimits, WalkerLimits};
pub use metadata::{AppInfo, FileDepList, FileDependency, Preview, SummaryInfo};
pub use object::{ObjectWalker, RawObject};
pub use object_type::ObjectType;
pub use reader::{DwgFile, ParseDiagnostics, SectionMapStatus, Summary};
pub use section::{Section, SectionKind};
pub use version::Version;