2016-08-22 22:04:57 +00:00
|
|
|
use std::os::raw::c_char;
|
|
|
|
|
2016-09-10 11:11:50 +00:00
|
|
|
/// Return code: OK/error.
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum PsycRC {
|
|
|
|
PSYC_OK = 1,
|
|
|
|
PSYC_ERROR = -1,
|
|
|
|
}
|
|
|
|
|
2016-09-11 01:11:14 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub enum PsycBool {
|
|
|
|
PSYC_FALSE = 0,
|
|
|
|
PSYC_TRUE = 1,
|
|
|
|
}
|
|
|
|
|
2016-09-10 11:11:50 +00:00
|
|
|
#[derive(Debug)]
|
2016-08-22 22:04:57 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub struct PsycString {
|
|
|
|
pub length: usize,
|
|
|
|
pub data: *const c_char
|
|
|
|
}
|
|
|
|
|
2016-09-13 22:04:40 +00:00
|
|
|
//#[derive(Debug)]
|
|
|
|
//#[repr(C)]
|
|
|
|
//pub struct MutablePsycString {
|
|
|
|
// pub length: usize,
|
|
|
|
// pub data: *mut c_char
|
|
|
|
//}
|
|
|
|
|
2016-09-11 01:11:14 +00:00
|
|
|
impl PsycBool {
|
|
|
|
pub fn to_bool(self) -> bool {
|
|
|
|
match self {
|
|
|
|
PsycBool::PSYC_FALSE => false,
|
|
|
|
PsycBool::PSYC_TRUE => true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-05 21:37:46 +00:00
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum PsycOperator {
|
|
|
|
PSYC_OPERATOR_SET = ':' as _,
|
|
|
|
PSYC_OPERATOR_ASSIGN = '=' as _,
|
|
|
|
PSYC_OPERATOR_AUGMENT = '+' as _,
|
|
|
|
PSYC_OPERATOR_DIMINISH = '-' as _,
|
|
|
|
PSYC_OPERATOR_UPDATE = '@' as _,
|
|
|
|
PSYC_OPERATOR_QUERY = '?' as _,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum PsycStateOp {
|
|
|
|
PSYC_STATE_NOOP = 0,
|
|
|
|
PSYC_STATE_RESET = '=' as _,
|
|
|
|
PSYC_STATE_RESYNC = '?' as _,
|
|
|
|
}
|
|
|
|
|
|
|
|
|