RsBundle  Check-in [d86db8c998]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove dependency on `libc`, use `const_cstr` instead.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d86db8c998a8b3ac18bf02e28cff8716090e38a4
User & Date: fifr 2017-03-17 09:28:35.121
Context
2017-03-17
09:31
Remove duplicate `extern`. check-in: 8458c760ee user: fifr tags: trunk
09:28
Remove dependency on `libc`, use `const_cstr` instead. check-in: d86db8c998 user: fifr tags: trunk
2017-03-16
20:51
Use `const_cstr` for C-string literals. check-in: 30e5f0f086 user: fifr tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Cargo.toml.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[package]
name = "bundle"
version = "0.3.0"
authors = ["Frank Fischer <frank-fischer@shadow-soft.de>"]

[dependencies]
libc = "^0.2.6"
quick-error = "^1.1.0"
log = "^0.3.6"
const-cstr = "^0.1"
cplex-sys = { version = "^0.1", path = "../cplex-sys" }

[dev-dependencies]
env_logger = "^0.4.1"









|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
[package]
name = "bundle"
version = "0.3.0"
authors = ["Frank Fischer <frank-fischer@shadow-soft.de>"]

[dependencies]
libc = "^0.2.6"
quick-error = "^1.1.0"
log = "^0.3.6"
const-cstr = "^0.2.1"
cplex-sys = { version = "^0.1", path = "../cplex-sys" }

[dev-dependencies]
env_logger = "^0.4.1"
Changes to src/lib.rs.
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
// along with this program.  If not, see  <http://www.gnu.org/licenses/>
//

//! Proximal bundle method implementation.

#[macro_use]
extern crate quick_error;

extern crate libc;
#[macro_use]
extern crate const_cstr;

#[macro_use]
extern crate log;

/// Type used for real numbers throughout the library.







>
|







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// along with this program.  If not, see  <http://www.gnu.org/licenses/>
//

//! Proximal bundle method implementation.

#[macro_use]
extern crate quick_error;
#[macro_use]
extern crate const_cstr;
#[macro_use]
extern crate const_cstr;

#[macro_use]
extern crate log;

/// Type used for real numbers throughout the library.
Changes to src/master/cpx.rs.
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use master::UnconstrainedMasterProblem;

use cplex_sys::*;

use std::result;
use std::ffi::CString;
use std::ptr;
use libc::{c_char, c_int};
use std::f64::NEG_INFINITY;
use std::f64;

quick_error! {
    /// A solver error.
    #[derive(Debug)]
    pub enum Error {
        Cplex(err: CplexError) {
            cause(err)







|
<
|







20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
use master::UnconstrainedMasterProblem;

use cplex_sys::*;

use std::result;
use std::ffi::CString;
use std::ptr;
use std::os::raw::{c_char, c_int};

use std::f64::{self, NEG_INFINITY};

quick_error! {
    /// A solver error.
    #[derive(Debug)]
    pub enum Error {
        Cplex(err: CplexError) {
            cause(err)
Changes to src/master/grb.rs.
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
/*
 * Copyright (c) 2016 Frank Fischer <frank-fischer@shadow-soft.de>
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

use std::result;
use std::os::raw::c_char;
use std::ptr;
use std::ffi::{CString, CStr};

use libc::{c_int, c_double};

use {DVector, Real, Minorant};
use master::UnconstrainedMasterProblem;

enum GRBenv {}
enum GRBmodel {}

quick_error! {

|
















|
|


<
<







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
/*
 * Copyright (c) 2016, 2017 Frank Fischer <frank-fischer@shadow-soft.de>
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

use std::result;
use std::ptr;
use std::os::raw::{c_char, c_int, c_double};
use std::ffi::{CString, CStr};



use {DVector, Real, Minorant};
use master::UnconstrainedMasterProblem;

enum GRBenv {}
enum GRBmodel {}

quick_error! {
Changes to src/mcf/solver.rs.
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

use cplex_sys::*;

use std::ptr;
use std::ffi::CString;
use std::result;

use libc::{c_char, c_int, c_double, FILE};

quick_error! {
    #[derive(Debug)]
    pub enum Error {
        Cplex(err: CplexError) {
            cause(err)
                description(err.description())
                display("{}", err)
                from()
        }
    }
}

pub type Result<T> = result::Result<T, Error>;

pub struct Solver {
    net: *mut CPXNet,
    logfile: *mut FILE,
}


impl Drop for Solver {
    fn drop(&mut self) {
        unsafe {
            CPXNETfreeprob(env(), &mut self.net);







|

















|







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

use cplex_sys::*;

use std::ptr;
use std::ffi::CString;
use std::result;

use std::os::raw::{c_char, c_int, c_double};

quick_error! {
    #[derive(Debug)]
    pub enum Error {
        Cplex(err: CplexError) {
            cause(err)
                description(err.description())
                display("{}", err)
                from()
        }
    }
}

pub type Result<T> = result::Result<T, Error>;

pub struct Solver {
    net: *mut CPXNet,
    logfile: *mut CPXFile,
}


impl Drop for Solver {
    fn drop(&mut self) {
        unsafe {
            CPXNETfreeprob(env(), &mut self.net);