Compare commits

..

No commits in common. "master" and "wip-experimental-rust-port2" have entirely different histories.

6 changed files with 3904 additions and 3865 deletions

32
Cargo.lock generated
View file

@ -185,6 +185,7 @@ dependencies = [
"libm",
"mupdf-sys",
"quick-xml",
"serde",
]
[[package]]
@ -209,6 +210,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c"
dependencies = [
"memchr",
"serde",
]
[[package]]
@ -255,6 +257,36 @@ version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
[[package]]
name = "serde"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
dependencies = [
"serde_core",
"serde_derive",
]
[[package]]
name = "serde_core"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.228"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "shlex"
version = "1.3.0"

View file

@ -14,4 +14,5 @@ rust-version = "1.89.0"
indexmap = "2.12.1"
libm = "0.2.15"
mupdf-sys = { version = "0.5.0", default-features = false }
quick-xml = "0.38.4"
quick-xml = { version = "0.38.4", features = ["serialize"] }
serde = { version = "1.0.228", features = ["derive"] }

View file

@ -4,35 +4,6 @@ See Notices.txt for copyright information
-->
parser for the OPF PowerISA 3.1C pdf to attempt to extract all instructions' pseudo-code including subscripts/superscripts and other formatting
# Using the new Rust code:
Usage:
* Download the OPF PowerISA 3.1C pdf (yes you need that exact version) from <https://openpower.foundation/specifications/isa/>
* Install Rust -- you need version 1.89.0 or later.
Getting it from https://rustup.rs/ is recommended.
* Install required build dependencies:
On Debian 12:
```bash
sudo apt update
sudo apt install build-essential clang unzip
```
* Compile and run:
```bash
cargo run -- path/to/downloaded/OPF_PowerISA_v3.1C.pdf > out.log
```
* This will spit out lots of errors and then successfully create
the output file -- `powerisa-instructions.xml` in the current directory.
# Using the old Python code:
Usage:
* Download the OPF PowerISA 3.1C pdf (yes you need that exact version) from <https://openpower.foundation/specifications/isa/>
* Obtain CPython 3.11 (the default `python3` in [Debian Bookworm](https://www.debian.org/releases/bookworm/))

3828
src/lib.rs

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -765,7 +765,6 @@ pub(crate) enum WriteMode {
}
impl<'a, 'ctx> TextSpanRef<'a, 'ctx> {
#[allow(dead_code)]
pub(crate) fn get(self) -> &'a UnsafeCell<fz_text_span> {
self.ptr
}
@ -803,7 +802,6 @@ pub(crate) struct FontRef<'a, 'ctx> {
}
impl<'a, 'ctx> FontRef<'a, 'ctx> {
#[allow(dead_code)]
pub(crate) fn get(self) -> &'a UnsafeCell<fz_font> {
self.ptr
}
@ -812,11 +810,9 @@ impl<'a, 'ctx> FontRef<'a, 'ctx> {
.to_str()
.expect("font name isn't valid UTF-8")
}
#[allow(dead_code)]
pub(crate) fn is_bold(self) -> bool {
unsafe { fz_font_is_bold(self.ctx.0.get(), self.ptr.get()) != 0 }
}
#[allow(dead_code)]
pub(crate) fn is_italic(self) -> bool {
unsafe { fz_font_is_italic(self.ctx.0.get(), self.ptr.get()) != 0 }
}
@ -828,7 +824,6 @@ impl<'a, 'ctx> FontRef<'a, 'ctx> {
}
}
#[allow(dead_code)]
pub(crate) fn transform_point(point: fz_point, m: fz_matrix) -> fz_point {
unsafe { fz_transform_point(point, m) }
}