Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pdf_path & gs_stack with Vec #57

Merged
merged 7 commits into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dpx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "GPL"

[dependencies]
tectonic_bridge = { version = "0.0.1-dev", path = "../bridge" }
lazy_static = "1.4"
libc = "0.2"
libpng-sys = "1"
libz-sys = { version = "1", optional = true}
Expand Down
95 changes: 6 additions & 89 deletions dpx/src/dpx_cidtype0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,35 +218,10 @@ pub type rust_input_handle_t = *mut libc::c_void;
use super::dpx_cid::{cid_opt, CIDFont, CIDSysInfo};

use super::dpx_sfnt::sfnt;
use super::dpx_cs_type2::cs_ginfo;

#[derive(Copy, Clone)]
#[repr(C)]
pub struct cs_ginfo {
pub flags: i32,
pub wx: f64,
pub wy: f64,
pub bbox: C2RustUnnamed_0,
pub seac: C2RustUnnamed,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed {
pub asb: f64,
pub adx: f64,
pub ady: f64,
pub bchar: card8,
pub achar: card8,
}
pub type card8 = u8;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_0 {
pub llx: f64,
pub lly: f64,
pub urx: f64,
pub ury: f64,
}
use super::dpx_cff::cff_charsets;
pub type card8 = u8;
pub type card16 = u16;
pub type s_SID = u16;

Expand Down Expand Up @@ -315,32 +290,8 @@ use super::dpx_cmap::CMap;
/* Upper bounds of valid input code */

use super::dpx_agl::agl_name;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct t1_ginfo {
pub use_seac: i32,
pub wx: f64,
pub wy: f64,
pub bbox: C2RustUnnamed_7,
pub seac: C2RustUnnamed_6,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_6 {
pub asb: f64,
pub adx: f64,
pub ady: f64,
pub bchar: card8,
pub achar: card8,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_7 {
pub llx: f64,
pub lly: f64,
pub urx: f64,
pub ury: f64,
}
use super::dpx_t1_char::t1_ginfo;

/*
* CID-Keyed Font support:
*
Expand Down Expand Up @@ -2237,24 +2188,7 @@ unsafe extern "C" fn get_font_attr(mut font: *mut CIDFont, mut cffont: *mut cff_
b"lambda\x00" as *const u8 as *const i8,
0 as *const i8,
];
let mut gm: t1_ginfo = t1_ginfo {
use_seac: 0,
wx: 0.,
wy: 0.,
bbox: C2RustUnnamed_7 {
llx: 0.,
lly: 0.,
urx: 0.,
ury: 0.,
},
seac: C2RustUnnamed_6 {
asb: 0.,
adx: 0.,
ady: 0.,
bchar: 0,
achar: 0,
},
};
let mut gm = t1_ginfo::new();
defaultwidth = 500.0f64;
nominalwidth = 0.0f64;
/*
Expand Down Expand Up @@ -2837,24 +2771,7 @@ pub unsafe extern "C" fn CIDFont_type0_t1dofont(mut font: *mut CIDFont) {
0.0f64,
);
let mut cstring: *mut cff_index = 0 as *mut cff_index;
let mut gm: t1_ginfo = t1_ginfo {
use_seac: 0,
wx: 0.,
wy: 0.,
bbox: C2RustUnnamed_7 {
llx: 0.,
lly: 0.,
urx: 0.,
ury: 0.,
},
seac: C2RustUnnamed_6 {
asb: 0.,
adx: 0.,
ady: 0.,
bchar: 0,
achar: 0,
},
};
let mut gm = t1_ginfo::new();
let mut max: i32 = 0i32;
let mut widths: *mut f64 = 0 as *mut f64;
let mut w_stat: [i32; 1001] = [0; 1001];
Expand Down
18 changes: 1 addition & 17 deletions dpx/src/dpx_cidtype2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,27 +182,11 @@ use super::dpx_cid::{cid_opt, CIDFont, CIDSysInfo};

use super::dpx_cmap::CMap;
use super::dpx_tt_cmap::tt_cmap;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed {
pub minBytesIn: size_t,
pub maxBytesIn: size_t,
pub minBytesOut: size_t,
pub maxBytesOut: size_t,
}

/* 2 for CID, variable for Code.. */
/* CID (as 16-bit BE), Code ... */
/* Next Subtbl for LOOKUP_CONTINUE */

#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_0 {
pub num: u32,
pub max: u32,
pub ranges: *mut rangeDef,
}
use super::dpx_cmap::rangeDef;

use super::dpx_sfnt::sfnt;

pub type CID = u16;
Expand Down
17 changes: 1 addition & 16 deletions dpx/src/dpx_cmap_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,23 +90,8 @@ use super::dpx_cid::CIDSysInfo;
/* DEBUG */
/* Codespacerange */

use super::dpx_cmap::rangeDef;
use super::dpx_cmap::CMap;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed {
pub minBytesIn: size_t,
pub maxBytesIn: size_t,
pub minBytesOut: size_t,
pub maxBytesOut: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_0 {
pub num: u32,
pub max: u32,
pub ranges: *mut rangeDef,
}

pub type CID = u16;
#[derive(Copy, Clone)]
#[repr(C)]
Expand Down
16 changes: 1 addition & 15 deletions dpx/src/dpx_cmap_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,7 @@ use super::dpx_cid::CIDSysInfo;
use super::dpx_cmap::mapDef;
use super::dpx_cmap::rangeDef;
use super::dpx_cmap::CMap;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed {
pub minBytesIn: size_t,
pub maxBytesIn: size_t,
pub minBytesOut: size_t,
pub maxBytesOut: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_0 {
pub num: u32,
pub max: u32,
pub ranges: *mut rangeDef,
}

/*
* References:
*
Expand Down
24 changes: 24 additions & 0 deletions dpx/src/dpx_cs_type2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,30 @@ pub struct cs_ginfo {
pub bbox: C2RustUnnamed_0,
pub seac: C2RustUnnamed,
}

impl cs_ginfo {
pub fn new() -> Self {
Self {
flags: 0,
wx: 0.,
wy: 0.,
bbox: C2RustUnnamed_0 {
llx: 0.,
lly: 0.,
urx: 0.,
ury: 0.,
},
seac: C2RustUnnamed {
asb: 0.,
adx: 0.,
ady: 0.,
bchar: 0,
achar: 0,
},
}
}
}

#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed {
Expand Down
8 changes: 4 additions & 4 deletions dpx/src/dpx_dpxfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,10 @@ pub unsafe extern "C" fn dpx_delete_temp_file(mut tmp: *mut i8, mut force: i32)
*/
#[no_mangle]
pub unsafe extern "C" fn dpx_file_apply_filter(
mut cmdtmpl: *const i8,
mut input: *const i8,
mut output: *const i8,
mut version: u8,
mut _cmdtmpl: *const i8,
mut _input: *const i8,
mut _output: *const i8,
mut _version: u8,
) -> i32 {
/* Tectonic: defused */
-1i32
Expand Down
49 changes: 4 additions & 45 deletions dpx/src/dpx_dvi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,32 +341,8 @@ pub struct dvi_lr {
pub font: i32,
pub buf_index: u32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_3 {
pub llx: f64,
pub lly: f64,
pub urx: f64,
pub ury: f64,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct t1_ginfo {
pub use_seac: i32,
pub wx: f64,
pub wy: f64,
pub bbox: C2RustUnnamed_3,
pub seac: C2RustUnnamed_4,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_4 {
pub asb: f64,
pub adx: f64,
pub ady: f64,
pub bchar: card8,
pub achar: card8,
}

use super::dpx_t1_char::t1_ginfo;

use super::dpx_sfnt::sfnt;
use super::dpx_tt_table::{tt_head_table, tt_hhea_table, tt_maxp_table};
Expand Down Expand Up @@ -2306,7 +2282,7 @@ unsafe extern "C" fn do_glyphs(mut do_actual_text: i32) {
if (*font).rgba_color != 0xffffffffu32 {
let mut color: pdf_color = pdf_color {
num_components: 0,
spot_color_name: 0 as *mut i8,
spot_color_name: None,
values: [0.; 4],
};
pdf_color_rgbcolor(
Expand All @@ -2327,24 +2303,7 @@ unsafe extern "C" fn do_glyphs(mut do_actual_text: i32) {
let mut descent: f64 = (*font).descent as f64;
if !(*font).cffont.is_null() {
let mut cstrings: *mut cff_index = (*(*font).cffont).cstrings;
let mut gm: t1_ginfo = t1_ginfo {
use_seac: 0,
wx: 0.,
wy: 0.,
bbox: C2RustUnnamed_3 {
llx: 0.,
lly: 0.,
urx: 0.,
ury: 0.,
},
seac: C2RustUnnamed_4 {
asb: 0.,
adx: 0.,
ady: 0.,
bchar: 0,
achar: 0,
},
};
let mut gm = t1_ginfo::new();
/* If .notdef is not the 1st glyph in CharStrings, glyph_id given by
FreeType should be increased by 1 */
if (*(*font).cffont).is_notdef_notzero != 0 {
Expand Down
10 changes: 5 additions & 5 deletions dpx/src/dpx_epdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub type __off64_t = i64;
pub type size_t = u64;
pub type rust_input_handle_t = *mut libc::c_void;

use super::dpx_pdfdev::{pdf_coord, pdf_rect, pdf_tmatrix};
use super::dpx_pdfdev::{pdf_coord, pdf_tmatrix};

use crate::dpx_pdfximage::{load_options, pdf_ximage, xform_info};
pub const OP_CURVETO2: C2RustUnnamed_0 = 15;
Expand Down Expand Up @@ -1076,10 +1076,10 @@ pub unsafe extern "C" fn pdf_copy_clip(
} else {
let mut j: u32 = 0;
let mut T = pdf_tmatrix::new();
let mut p0: pdf_coord = pdf_coord::new();
let mut p1: pdf_coord = pdf_coord::new();
let mut p2: pdf_coord = pdf_coord::new();
let mut p3: pdf_coord = pdf_coord::new();
let mut p0 = pdf_coord::new();
let mut p1 = pdf_coord::new();
let mut p2 = pdf_coord::new();
let mut p3 = pdf_coord::new();
token = parse_ident(&mut clip_path, end_path);
j = 0_u32;
while (j as u64)
Expand Down
6 changes: 3 additions & 3 deletions dpx/src/dpx_mpost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3081,7 +3081,7 @@ unsafe extern "C" fn do_currentfont() -> i32 {
}
unsafe extern "C" fn do_show() -> i32 {
let mut font: *mut mp_font = 0 as *mut mp_font;
let mut cp: pdf_coord = pdf_coord::new();
let mut cp = pdf_coord::new();
let mut text_str: *mut pdf_obj = 0 as *mut pdf_obj;
let mut length: i32 = 0;
let mut strptr: *mut u8 = 0 as *mut u8;
Expand Down Expand Up @@ -3256,10 +3256,10 @@ unsafe extern "C" fn do_operator(mut token: *const i8, mut x_user: f64, mut y_us
let mut values: [f64; 12] = [0.; 12];
let mut tmp: *mut pdf_obj = 0 as *mut pdf_obj;
let mut matrix = pdf_tmatrix::new();
let mut cp: pdf_coord = pdf_coord::new();
let mut cp = pdf_coord::new();
let mut color: pdf_color = pdf_color {
num_components: 0,
spot_color_name: 0 as *mut i8,
spot_color_name: None,
values: [0.; 4],
};
opcode = get_opcode(token);
Expand Down
8 changes: 4 additions & 4 deletions dpx/src/dpx_otl_conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,10 +619,10 @@ unsafe extern "C" fn otl_read_conf(mut conf_name: *const i8) -> *mut pdf_obj {
static mut otl_confs: *mut pdf_obj = 0 as *const pdf_obj as *mut pdf_obj;
#[no_mangle]
pub unsafe extern "C" fn otl_find_conf(mut conf_name: *const i8) -> *mut pdf_obj {
let mut rule: *mut pdf_obj = 0 as *mut pdf_obj;
let mut script: *mut pdf_obj = 0 as *mut pdf_obj;
let mut language: *mut pdf_obj = 0 as *mut pdf_obj;
let mut options: *mut pdf_obj = 0 as *mut pdf_obj;
let mut _rule: *mut pdf_obj = 0 as *mut pdf_obj;
let mut _script: *mut pdf_obj = 0 as *mut pdf_obj;
let mut _language: *mut pdf_obj = 0 as *mut pdf_obj;
let mut _options: *mut pdf_obj = 0 as *mut pdf_obj;
0 as *mut pdf_obj
}
#[no_mangle]
Expand Down
Loading