Skip to content

Commit

Permalink
Fixed some formatting issues, and use c_char.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaveaux committed Oct 10, 2024
1 parent 05e1674 commit a1e08a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
8 changes: 4 additions & 4 deletions bindings/python/oxidd/bdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def export_dddmp(
dd_name: str,
filename: str,
function_name: str,
variables: List[Self],
variable_names: List[str],
variables: list[Self],
variable_names: list[str],
as_ascii: bool,
) -> None:
"""Export the decision diagram in to filename in DDDMP format"""
Expand All @@ -189,8 +189,8 @@ def export_dot(
self,
filename: str,
function_name: str,
variables: List[Self],
variable_names: List[str],
variables: list[Self],
variable_names: list[str],
):
"""Export the decision diagram in to filename in Graphviz dot format"""
tmp_variables = [var._func for var in variables]
Expand Down
22 changes: 10 additions & 12 deletions crates/oxidd-ffi/src/bdd.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use core::slice;
use std::ffi::CStr;
use std::ffi::{c_char, CStr};
use std::fs::File;
use std::hash::BuildHasherDefault;
use std::mem::ManuallyDrop;

use oxidd_dump::dot::dump_all;
use rustc_hash::FxHasher;

use oxidd::bdd::{BDDFunction, BDDManagerRef};
Expand All @@ -14,7 +13,8 @@ use oxidd::{
BooleanFunction, BooleanFunctionQuant, Edge, Function, FunctionSubst, Manager, ManagerRef,
RawFunction, RawManagerRef,
};
use oxidd_dump::{dddmp, dot};
use oxidd_dump::dot::dump_all;
use oxidd_dump::dddmp;

// We need to use the following items from `oxidd_core` since cbindgen only
// parses `oxidd_ffi` and `oxidd_core`:
Expand Down Expand Up @@ -486,15 +486,14 @@ pub unsafe extern "C" fn oxidd_bdd_ite(cond: bdd_t, then_case: bdd_t, else_case:
/// must be `vars.len()` names in the same order as in `vars`.
///
/// `ascii` indicates whether to use the ASCII or binary format.
///
#[no_mangle]
pub unsafe extern "C" fn oxidd_bdd_export_dddmp(
f: bdd_t,
filename: *const i8,
dd_name: *const i8,
function_name: *const i8,
filename: *const c_char,
dd_name: *const c_char,
function_name: *const c_char,
vars: *const bdd_t,
var_names: *const *const i8,
var_names: *const *const c_char,
num_vars: usize,
ascii: bool,
) {
Expand Down Expand Up @@ -565,14 +564,13 @@ pub unsafe extern "C" fn oxidd_bdd_export_dddmp(
///
/// `var_names` are the names of these variables. These must be `num_vars`
/// names.
///
#[no_mangle]
pub unsafe extern "C" fn oxidd_bdd_export_dot(
f: bdd_t,
filename: *const i8,
function_name: *const i8,
filename: *const c_char,
function_name: *const c_char,
vars: *const bdd_t,
var_names: *const *const i8,
var_names: *const *const c_char,
num_vars: usize,
) {
let file = File::create(
Expand Down

0 comments on commit a1e08a9

Please sign in to comment.