From 19c15f8aff62140b29dcc332ce9cc1653df1aff3 Mon Sep 17 00:00:00 2001 From: Myrddin Dundragon Date: Mon, 3 Mar 2025 02:07:54 -0500 Subject: [PATCH] [#1] Adjusted the library to use the new server. Removed the scribe and weave requirements. Scribe was only being used in the build, so it was switched to print statements. Weave was being used for error, but it was switched over to the Rust core and std error versions. --- Cargo.toml | 15 +++------------ build.rs | 17 +++++++++-------- src/c/errno.rs | 40 ++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 40 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d20c530..b104ceb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,26 +8,17 @@ repository = "https://gitlab.com/CyberMages/Core/pact.git" documentation = "" keywords = ["c", "libc", "binding", "ffi", "pact", "nostd"] build = "build.rs" -edition = "2018" +edition = "2021" [features] default = [] -use_std = ["scribe/use_std", "binding/use_std", "weave/use_std"] +use_std = ["binding/use_std"] rust_lib = [] no_mem_manip = [] weak = [] -[build-dependencies.scribe] -git = "ssh://git@gitlab.com/CyberMages/Core/scribe.git" - - -[dependencies.scribe] -git = "ssh://git@gitlab.com/CyberMages/Core/scribe.git" [dependencies.binding] -git = "ssh://git@gitlab.com/CyberMages/Core/binding.git" - -[dependencies.weave] -git = "ssh://git@gitlab.com/CyberMages/Core/weave.git" +git = "ssh://gitea@workshop.cybermages.tech:3022/CyberMages/binding.git" diff --git a/build.rs b/build.rs index 848878f..2138fa0 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,3 @@ -use scribe::{error, warn}; - - use std::env; use std::ffi::OsString; use std::path::PathBuf; @@ -58,7 +55,7 @@ fn determine_output_dir() -> PathBuf Err(error) => { // Then just default to "". - warn!("{}", error); + println!("WARN: {}", error); output_dir = PathBuf::new(); } } @@ -137,13 +134,15 @@ fn compile(src_files: &[PathBuf], output_name: &str) -> PathBuf { if output.status.success() == false { - error!("{:?}", output); + println!("ERROR: {:?}", output); + panic!(); } } Err(error) => { - error!("{}", error); + println!("ERROR: {}", error); + panic!(); } } @@ -164,13 +163,15 @@ fn run(executable: PathBuf, args: &[PathBuf]) { if output.status.success() == false { - error!("{:?}", output); + println!("ERROR: {:?}", output); + panic!(); } } Err(error) => { - error!("{}", error); + println!("ERROR: {}", error); + panic!(); } } } diff --git a/src/c/errno.rs b/src/c/errno.rs index 750cd96..5795e85 100644 --- a/src/c/errno.rs +++ b/src/c/errno.rs @@ -1,4 +1,4 @@ -use weave::Error; +//use weave::Error; use binding::CInt; @@ -96,20 +96,28 @@ impl CError } } -impl ::std::fmt::Debug for CError +impl std::fmt::Debug for CError { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - ::std::fmt::Display::fmt(self, f) + std::fmt::Display::fmt(self, f) } } -impl ::std::fmt::Display for CError +impl std::fmt::Display for CError { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { //write!(f, "{}", self.to_str()) - write!(f, "{}", self.get_description()) + match *self + { + CError::None => { write!(f, "{}", "There was no error") } + CError::Domain => { write!(f, "{}", "Math argument out of domain of function") } + CError::Range => { write!(f, "{}", "Math result not representable") } + CError::IllegalSequence => { write!(f, "{}", "Illegal byte sequence") } + CError::Unhandled { errno: _val } => + { write!(f, "{}", "Detected an Error not handled by CError") } + } } } @@ -143,20 +151,12 @@ impl Into for CError } } -impl Error for CError +impl std::error::Error for CError { - fn get_description(&self) -> &str - { - match *self - { - CError::None => { "There was no error" } - CError::Domain => { "Math argument out of domain of function" } - CError::Range => { "Math result not representable" } - CError::IllegalSequence => { "Illegal byte sequence" } - CError::Unhandled { errno: _val } => - { "Detected an Error not handled by CError" } - } - } + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> + { + None + } }