From 950be12017c10ccb8105ef602cbbb3c25976f4ec Mon Sep 17 00:00:00 2001 From: Yuri Edward Date: Thu, 5 Dec 2024 21:16:49 +0100 Subject: [PATCH] Removed abandoned dbg project --- Cargo.lock | 31 +--- Cargo.toml | 3 +- dbg/Cargo.toml | 10 -- dbg/build.rs | 109 ------------- dbg/src/controller.rs | 105 ------------ dbg/src/debug/mod.rs | 112 ------------- dbg/src/debug/package.rs | 126 --------------- dbg/src/lib.rs | 33 ---- dbg/src/main.rs | 76 --------- dbg/src/render.rs | 86 ---------- dbg/src/render_backend/cli.rs | 217 ------------------------- dbg/src/render_backend/json/bpxsd.rs | 87 ---------- dbg/src/render_backend/json/mod.rs | 230 --------------------------- dbg/src/render_backend/mod.rs | 33 ---- 14 files changed, 3 insertions(+), 1255 deletions(-) delete mode 100644 dbg/Cargo.toml delete mode 100644 dbg/build.rs delete mode 100644 dbg/src/controller.rs delete mode 100644 dbg/src/debug/mod.rs delete mode 100644 dbg/src/debug/package.rs delete mode 100644 dbg/src/lib.rs delete mode 100644 dbg/src/main.rs delete mode 100644 dbg/src/render.rs delete mode 100644 dbg/src/render_backend/cli.rs delete mode 100644 dbg/src/render_backend/json/bpxsd.rs delete mode 100644 dbg/src/render_backend/json/mod.rs delete mode 100644 dbg/src/render_backend/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 9bba414..98b2225 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,34 +84,13 @@ dependencies = [ "tempfile", ] -[[package]] -name = "bpx" -version = "4.0.0-rc.12.0.0" -dependencies = [ - "bytesutil", - "elsa", - "libz-sys", - "lzma-sys", - "num_cpus", - "once_cell", - "tempfile", -] - -[[package]] -name = "bpxdbg" -version = "0.1.0" -dependencies = [ - "bpx 4.0.0-rc.12.0.0", - "json", -] - [[package]] name = "bpxdump" version = "0.1.0" dependencies = [ "assert_cmd", "bp3d-util", - "bpx 4.0.0-rc.10.0.1", + "bpx", "clap", "predicates", ] @@ -121,7 +100,7 @@ name = "bpxp" version = "0.1.0" dependencies = [ "assert_cmd", - "bpx 4.0.0-rc.10.0.1", + "bpx", "clap", "file_diff", "serial_test", @@ -247,12 +226,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "json" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" - [[package]] name = "lazy_static" version = "1.4.0" diff --git a/Cargo.toml b/Cargo.toml index 5eddfac..a243df4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,5 @@ [workspace] members = [ "dump", - "package", - "dbg" + "package" ] diff --git a/dbg/Cargo.toml b/dbg/Cargo.toml deleted file mode 100644 index 2b6ff76..0000000 --- a/dbg/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "bpxdbg" -version = "0.1.0" -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -bpx = { version = "4.0.0-beta-10.0.1", path = "../../bpx-rs", features = ["package", "shader", "sd-formatting"] } -json = "0.12.4" diff --git a/dbg/build.rs b/dbg/build.rs deleted file mode 100644 index 1cf16f1..0000000 --- a/dbg/build.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::fs::File; -use std::path::Path; -use std::io; -use std::io::BufWriter; -use std::io::Write; - -fn snake_case_to_pascal_case(mut name: &str) -> String { - let mut res = String::new(); - while let Some(index) = name.find('_') { - if name.len() > 1 { - res += &(name[0..1].to_uppercase() + &name[1..index]); - } - if index + 1 < name.len() { - name = &name[index + 1..]; - } - } - if name.len() > 1 { - res += &(name[0..1].to_uppercase() + &name[1..]); - } - res -} - -fn list_filters() -> io::Result> { - let path = Path::new("src/debug"); - let mut names = Vec::new(); - for v in std::fs::read_dir(path)? { - let entry = v?; - let fuckyourust = entry.file_name(); - let filter_file_name = fuckyourust.to_string_lossy(); - if filter_file_name == "mod.rs" { - continue; - } - if filter_file_name.ends_with(".rs") { - let filter_name = &filter_file_name[..filter_file_name.len() - 3]; - names.push(filter_name.into()); - } else if entry.file_type()?.is_dir() { - names.push(filter_file_name.into()); - } - } - Ok(names) -} - -fn write_file(filters: Vec, out_file: &Path) -> io::Result<()> { - let path = std::fs::canonicalize(Path::new("src/debug")).expect("Failed to get absolute path to source directory"); - let mut file = BufWriter::new(File::create(out_file)?); - let module_imports: Vec = filters.iter().map(|v| format!("#[path=\"{}.rs\"] mod {};", path.join(v).to_string_lossy(), v)).collect(); - let variants = filters.iter() - .map(|v| snake_case_to_pascal_case(v)) - .collect::>().join(","); - let variants_debugger: Vec = filters.iter() - .map(|v| (v, snake_case_to_pascal_case(v))) - .map(|(module, obj)| format!("{}({}::{}),", obj, module, obj)).collect(); - let variants_from_name: Vec = filters.iter() - .map(|v| (v, snake_case_to_pascal_case(v))) - .map(|(module, obj)| format!("<{}::{} as crate::debug::Debugger>::TYPE_CODE => Some(<{}::{} as crate::debug::New>::new(container).map(DynamicDebugger::{}))", module, obj, module, obj, obj)).collect(); - writeln!(file, "{}", module_imports.join("\n"))?; - writeln!(file, "pub enum DynamicDebugger {{")?; - writeln!(file, " {}", variants_debugger.join("\n"))?; - writeln!(file, "}}")?; - writeln!(file, "")?; - writeln!(file, "impl_debugger!({{ {} }});", variants)?; - writeln!(file, "")?; - writeln!(file, "impl DynamicDebugger {{")?; - writeln!(file, " pub fn from_type_code(type_code: u8, container: bpx::core::Container) -> Option, Error<'static>>> {{")?; - writeln!(file, " match type_code {{")?; - writeln!(file, " {},", variants_from_name.join(",\n"))?; - writeln!(file, " _ => None")?; - writeln!(file, " }}")?; - writeln!(file, " }}")?; - writeln!(file, "}}")?; - Ok(()) -} - -fn main() { - let out_file = std::env::var_os("OUT_DIR") - .map(|v| Path::new(&v).join("debuggers.rs")) - .expect("Could not obtain Cargo output directory"); - let filters = list_filters().expect("Failed to obtain the list of available debuggers"); - write_file(filters, &out_file).expect("Failed to generate debugger registry"); - println!("cargo:rustc-env=SRC_DEBUGGER_REGISTRY={}", out_file.to_string_lossy()); -} diff --git a/dbg/src/controller.rs b/dbg/src/controller.rs deleted file mode 100644 index f03afb9..0000000 --- a/dbg/src/controller.rs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::convert::TryFrom; -use std::fmt::{Display, Formatter}; -use std::fs::File; -use std::io::BufReader; -use std::path::Path; -use bpx::core::Container; -use crate::debug::{Debugger, DynamicDebugger}; -use crate::render::{Item, List, Render}; - -#[derive(Debug)] -pub enum Error<'a> { - UnknownTypeCode(u8), - Io(std::io::Error), - Bpx(bpx::core::error::Error), - Debugger(crate::debug::Error<'a>) -} - -impl<'a> Display for Error<'a> { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - Error::Io(e) => write!(f, "failed to open file: {}", e), - Error::Bpx(e) => write!(f, "failed to open BPX container: {}", e), - Error::Debugger(e) => write!(f, "debugger error: {}", e), - Error::UnknownTypeCode(code) => { - match char::try_from(*code as u32) { - Ok(v) => write!(f, "no debugger found for BPX type {}", v), - Err(_) => write!(f, "no debugger found for BPX type code 0x{:X}", code) - } - } - } - } -} - -impl<'a> std::error::Error for Error<'a> { } - -pub struct Controller { - debugger: DynamicDebugger>, - render: R -} - -impl Controller { - pub fn new(path: &Path, render: R) -> Result, Error<'static>> { - let file = File::open(path).map_err(Error::Io)?; - let container = Container::open(BufReader::new(file)) - .map_err(Error::Bpx)?; - let fuckingrust = container.main_header().ty; - let debugger = DynamicDebugger::from_type_code(fuckingrust, container) - .ok_or_else(|| Error::UnknownTypeCode(fuckingrust))?.map_err(Error::Debugger)?; - Ok(Controller { - debugger, - render - }) - } - - pub fn run<'a>(&mut self, command_line: &'a str) -> Result<(), Error<'a>> { - let mut args = command_line.split(" "); - if let Some(cmd) = args.next() { - let commands = self.debugger.available_commands(); - match cmd { - "help" => { - let mut list = self.render.list("Commands", commands.len()); - for cmd in commands { - list.item().value(cmd.cmd).description(cmd.usage).note(cmd.note); - } - }, - _ => { - if commands.iter().any(|v| v.cmd == cmd) { - self.debugger.on_command(&mut self.render, cmd, args).map_err(Error::Debugger)?; - } else { - self.render.text(format!("Unknown command '{}', type 'help' for help", cmd)); - } - } - } - } - Ok(()) - } -} diff --git a/dbg/src/debug/mod.rs b/dbg/src/debug/mod.rs deleted file mode 100644 index f5eccb3..0000000 --- a/dbg/src/debug/mod.rs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::fmt::{Display, Formatter}; -use std::io::{Read, Seek}; -use std::str::FromStr; -use crate::render::Render; - -#[derive(Debug)] -pub enum Error<'a> { - InvalidCommand { - msg: &'static str, - command: &'a str - }, - Other(Box) -} - -impl<'a> Display for Error<'a> { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - Error::InvalidCommand { msg, command } => write!(f, "invalid command {}: {}", command, msg), - Error::Other(e) => write!(f, "{}", e) - } - } -} - -impl<'a, T: std::error::Error + 'static> From for Error<'a> { - fn from(value: T) -> Self { - Error::Other(Box::new(value)) - } -} - -pub struct Command<'a> { - pub cmd: &'a str, - pub usage: &'a str, - pub note: &'a str -} - -pub trait Debugger { - const TYPE_CODE: u8; - fn available_commands(&self) -> &[Command]; - fn on_command<'a, R: Render>(&mut self, render: &mut R, cmd: &'a str, args: impl Iterator) -> Result<(), Error<'a>>; -} - -pub trait New: Debugger + Sized { - fn new(container: bpx::core::Container) -> Result>; -} - -pub fn check_arg<'a, I: Iterator, T: FromStr>(cmd: &'a str, args: &mut I) -> Result> { - let val = match args.next() { - Some(v) => v, - None => return Err(Error::InvalidCommand { - command: cmd, - msg: "Missing argument" - }) - }; - val.parse().map_err(|_| Error::InvalidCommand { - command: cmd, - msg: "Parse error" - }) -} - -macro_rules! impl_debugger { - ({ $($name: ident),* }) => { - impl Debugger for DynamicDebugger { - const TYPE_CODE: u8 = 0; - - fn available_commands(&self) -> &[Command] { - match self { - $( - Self::$name(v) => v.available_commands(), - )* - } - } - - fn on_command<'a, R: Render>(&mut self, render: &mut R, cmd: &'a str, args: impl Iterator) -> Result<(), Error<'a>> { - match self { - $( - Self::$name(v) => v.on_command(render, cmd, args), - )* - } - } - } - } -} - -include!(env!("SRC_DEBUGGER_REGISTRY")); diff --git a/dbg/src/debug/package.rs b/dbg/src/debug/package.rs deleted file mode 100644 index 8dad234..0000000 --- a/dbg/src/debug/package.rs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::convert::TryInto; -use std::io::{Read, Seek}; -use bpx::core::Container; -use crate::debug::{check_arg, Command, Debugger, Error, New}; -use crate::render::{ContentType, Group, Render, Row, Table}; - -pub struct Package { - package: bpx::package::Package -} - -impl Debugger for Package { - const TYPE_CODE: u8 = b'P'; - - fn available_commands(&self) -> &[Command] { - &[ - Command { - cmd: "settings", - usage: "settings", - note: "Display package settings", - }, - Command { - cmd: "metadata", - usage: "metadata", - note: "Display package metadata if any", - }, - Command { - cmd: "objects", - usage: "objects", - note: "Display the object table", - }, - Command { - cmd: "object", - usage: "object index:usize", - note: "Display the content of an object" - } - ] - } - - fn on_command<'a, R: Render>(&mut self, render: &mut R, cmd: &'a str, mut args: impl Iterator) -> Result<(), Error<'a>> { - match cmd { - "settings" => { - let settings = self.package.settings(); - render.group("Settings") - .valued("Architecture", settings.architecture) - .valued("Platform", settings.platform) - .valued("Type Code", settings.type_code); - Ok(()) - }, - "metadata" => { - let metadata = self.package.load_metadata()?; - if metadata.is_null() { - render.text("No metadata found in package"); - } else { - render.bpxsd(metadata); - } - Ok(()) - }, - "objects" => { - let objects = self.package.objects()?; - let mut table = render.table("Objects"); - table.col("Name", 48) - .col("Index", 5) - .col("Start", 5) - .col("Offset", 10) - .col("Size", 10); - for (index, header) in objects.iter().enumerate() { - table.row().value(objects.load_name(header)?).value(index) - .value(header.start).value(header.offset).value(header.size); - } - Ok(()) - }, - "object" => { - let index: usize = check_arg(cmd, &mut args)?; - let objects = self.package.objects()?; - match objects.iter().enumerate().find(|(i, _)| *i == index).map(|(_, v)| v) { - None => Err(Error::InvalidCommand { - command: cmd, - msg: "Unknown object index" - }), - Some(header) => { - let stream = render.raw(objects.load_name(header)?, ContentType::Unknown); - objects.load(header, stream)?; - Ok(()) - } - } - }, - _ => unreachable!() - } - } -} - -impl New for Package { - fn new(container: Container) -> Result> { - Ok(Self { - package: container.try_into()? - }) - } -} diff --git a/dbg/src/lib.rs b/dbg/src/lib.rs deleted file mode 100644 index 477f153..0000000 --- a/dbg/src/lib.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -mod controller; -mod debug; -pub mod render; - -pub use controller::{Controller, Error}; diff --git a/dbg/src/main.rs b/dbg/src/main.rs deleted file mode 100644 index 2d3ba4a..0000000 --- a/dbg/src/main.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::io::{BufRead, BufReader}; -use std::path::PathBuf; -use std::io::Write; -use bpxdbg::Controller; -use crate::render_backend::CliRender; - -mod render_backend; - -fn print_prompt() { - let mut lock = std::io::stdout().lock(); - write!(lock, "> ").unwrap(); - lock.flush().unwrap(); -} - -fn run(mut runtime: Controller) -> std::io::Result<()> { - let lines = BufReader::new(std::io::stdin()).lines(); - print_prompt(); - for line in lines { - let line = line?; - if let Err(e) = runtime.run(&line) { - println!("failed to run '{}': {}", line, e); - } - println!(); - print_prompt(); - } - Ok(()) -} - -fn main() { - let mut args = std::env::args_os(); - if args.len() != 2 { - eprintln!("USAGE: {:?} ", args.next()); - std::process::exit(1); - } - args.next(); - let path = args.next().map(PathBuf::from).unwrap(); - let runtime = match Controller::new(&path, CliRender) { - Ok(v) => v, - Err(e) => { - eprintln!("couldn't load target: {}", e); - std::process::exit(1); - } - }; - if let Err(e) = run(runtime) { - eprintln!("failed to read standard input: {}", e); - std::process::exit(1); - } -} diff --git a/dbg/src/render.rs b/dbg/src/render.rs deleted file mode 100644 index 3826a47..0000000 --- a/dbg/src/render.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::fmt::{Debug, Display}; -use std::io::Write; -use bpx::sd::Value; - -pub trait Row { - fn value(&mut self, val: T) -> &mut Self; - fn valued(&mut self, val: T) -> &mut Self; -} - -pub trait Table { - type Row<'a>: Row where Self: 'a; - - fn col>(&mut self, name: T, length: usize) -> &mut Self; - fn row(&mut self) -> Self::Row<'_>; -} - -pub trait Group { - fn value, T: Display>(&mut self, name: N, val: T) -> &mut Self; - fn valued, T: Debug>(&mut self, name: N, val: T) -> &mut Self; - fn bpxsd>(&mut self, name: N, value: &Value) -> &mut Self; -} - -pub trait Item { - fn value(&mut self, val: T) -> &mut Self; - fn valued(&mut self, val: T) -> &mut Self; - fn description>(&mut self, description: D) -> &mut Self; - fn note>(&mut self, note: N) -> &mut Self; -} - -pub trait List { - type Item<'a>: Item where Self: 'a; - - fn item(&mut self) -> Self::Item<'_>; -} - -#[derive(Eq, PartialEq, Copy, Clone, Debug)] -pub enum ContentType { - ImagePpm, - ImageJpeg, - ImagePng, - ImageUnknown, - Text, - Unknown -} - -pub trait Render { - type Table: Table; - type Group: Group; - type List: List; - type RawStream: Write; - - fn table>(&mut self, name: T) -> Self::Table; - fn group>(&mut self, name: T) -> Self::Group; - fn list>(&mut self, name: T, length: usize) -> Self::List; - fn text>(&mut self, text: T); - fn bpxsd(&mut self, value: &Value); - fn raw>(&mut self, name: T, content_type: ContentType) -> Self::RawStream; -} diff --git a/dbg/src/render_backend/cli.rs b/dbg/src/render_backend/cli.rs deleted file mode 100644 index d5901ca..0000000 --- a/dbg/src/render_backend/cli.rs +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::fmt::{Debug, Display}; -use std::io::Write; -use bpx::sd::formatting::{Format, IndentType}; -use bpx::sd::Value; -use bpxdbg::render; -use bpxdbg::render::ContentType; - -pub struct Render; -pub struct Item; -pub struct Table { - columns: Vec -} -pub struct Row<'a> { - columns: &'a [usize], - row_id: usize -} -pub enum RawStream { - Stdout, - Null -} - -impl<'a> render::Row for Row<'a> { - fn value(&mut self, val: T) -> &mut Self { - if self.row_id < self.columns.len() { - print!("| {: (&mut self, val: T) -> &mut Self { - if self.row_id < self.columns.len() { - print!("| {: = Row<'a>; - - fn col>(&mut self, name: T, length: usize) -> &mut Self { - self.columns.push(length); - print!("┌{:─^width$}┐", name.as_ref(), width=length); - self - } - - fn row(&mut self) -> Self::Row<'_> { - println!(); - Row { - columns: &self.columns, - row_id: 0 - } - } -} - -impl Drop for Table { - fn drop(&mut self) { - println!(); - for v in &*self.columns { - print!("└{:─^width$}┘", "", width=v); - } - println!(); - } -} - -impl render::Item for Item { - fn value(&mut self, val: T) -> &mut Self { - print!(" {}", val); - self - } - - fn valued(&mut self, val: T) -> &mut Self { - print!(" {:?}", val); - self - } - - fn description>(&mut self, description: D) -> &mut Self { - print!(" ({})", description.as_ref()); - self - } - - fn note>(&mut self, note: N) -> &mut Self { - print!(": {}", note.as_ref()); - self - } -} - -impl Drop for Item { - fn drop(&mut self) { - println!() - } -} - -impl render::List for Render { - type Item<'a> = Item; - - fn item(&mut self) -> Self::Item<'_> { - print!(" *"); - Item - } -} - -impl render::Group for Render { - fn value, T: Display>(&mut self, name: N, val: T) -> &mut Self { - println!(" {}: {}", name.as_ref(), val); - self - } - - fn valued, T: Debug>(&mut self, name: N, val: T) -> &mut Self { - println!(" {}: {:?}", name.as_ref(), val); - self - } - - fn bpxsd>(&mut self, name: N, value: &Value) -> &mut Self { - println!(" {}:", name.as_ref()); - match value.as_object() { - None => println!("No BPXSD object, is the version of BPX really supported?"), - Some(v) => println!("{}", v.format(IndentType::Spaces, 4)) - } - self - } -} - -impl Write for RawStream { - fn write(&mut self, buf: &[u8]) -> std::io::Result { - match self { - RawStream::Stdout => std::io::stdout().write(buf), - RawStream::Null => Ok(buf.len()) - } - } - - fn flush(&mut self) -> std::io::Result<()> { - match self { - RawStream::Stdout => std::io::stdout().flush(), - RawStream::Null => Ok(()) - } - } -} - -impl render::Render for Render { - type Table = Table; - type Group = Render; - type List = Render; - type RawStream = RawStream; - - fn table>(&mut self, name: T) -> Self::Table { - println!("{}:", name.as_ref()); - Table { - columns: Vec::new() - } - } - - fn group>(&mut self, name: T) -> Self::Group { - println!("{}:", name.as_ref()); - Self - } - - fn list>(&mut self, name: T, length: usize) -> Self::List { - if length > 0 { - println!("{} ({} item(s)):", name.as_ref(), length); - } else { - println!("{}:", name.as_ref()); - } - Self - } - - fn text>(&mut self, text: T) { - println!("{}", text.as_ref()); - } - - fn bpxsd(&mut self, value: &Value) { - match value.as_object() { - None => println!("No BPXSD object, is the version of BPX really supported?"), - Some(v) => println!("{}", v.format(IndentType::Spaces, 4)) - } - } - - fn raw>(&mut self, name: T, content_type: ContentType) -> Self::RawStream { - if content_type == ContentType::Text { - println!("{}: {:?} >", name.as_ref(), content_type); - RawStream::Stdout - } else { - println!("{}: {:?} (no preview available)", name.as_ref(), content_type); - RawStream::Null - } - } -} diff --git a/dbg/src/render_backend/json/bpxsd.rs b/dbg/src/render_backend/json/bpxsd.rs deleted file mode 100644 index 5cf951b..0000000 --- a/dbg/src/render_backend/json/bpxsd.rs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use bpx::sd::{Array, Object, Value}; -use bpx::sd::debug::Debugger; -use json::{JsonValue, object}; - -pub trait ValueExt { - fn to_json(&self) -> JsonValue; -} - -impl ValueExt for Array { - fn to_json(&self) -> JsonValue { - let mut val = JsonValue::new_array(); - for v in self { - val.push(v.to_json()).unwrap(); - } - val - } -} - -impl ValueExt for Object { - fn to_json(&self) -> JsonValue { - match Debugger::attach(self) { - Ok(dbg) => { - let mut val = JsonValue::new_array(); - for (name, hash, value) in &dbg { - let item = object! { - name: name, - hash: format!("{}", hash.into_inner()), - value: value.to_json() - }; - val.push(item).unwrap(); - } - val - }, - Err(e) => format!("invalid object: {}", e).into() - } - } -} - -impl ValueExt for Value { - fn to_json(&self) -> JsonValue { - match self { - Value::Null => object! { type: "null" }, - Value::Bool(v) => object! { type: "bool", value: format!("{}", v) }, - Value::Uint8(v) => object! { type: "u8", value: format!("{}", v) }, - Value::Uint16(v) => object! { type: "u16", value: format!("{}", v) }, - Value::Uint32(v) => object! { type: "u32", value: format!("{}", v) }, - Value::Uint64(v) => object! { type: "u64", value: format!("{}", v) }, - Value::Int8(v) => object! { type: "i8", value: format!("{}", v) }, - Value::Int16(v) => object! { type: "i16", value: format!("{}", v) }, - Value::Int32(v) => object! { type: "i32", value: format!("{}", v) }, - Value::Int64(v) => object! { type: "i64", value: format!("{}", v) }, - Value::Float(v) => object! { type: "f32", value: format!("{}", v) }, - Value::Double(v) => object! { type: "f64", value: format!("{}", v) }, - Value::String(v) => object! { type: "str", value: v.clone() }, - Value::Array(v) => object! { type: "array", value: v.to_json() }, - Value::Object(v) => object! { type: "object", value: v.to_json() } - } - } -} diff --git a/dbg/src/render_backend/json/mod.rs b/dbg/src/render_backend/json/mod.rs deleted file mode 100644 index b557e01..0000000 --- a/dbg/src/render_backend/json/mod.rs +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::fmt::{Debug, Display}; -use std::io::Write; -use bpx::sd::Value; -use bpxdbg::render::{ContentType}; -use bpxdbg::render; -use json::{JsonValue, object}; -use self::bpxsd::ValueExt; - -mod bpxsd; - -pub struct Render; -pub struct List(JsonValue); -pub struct Item<'a> { - items: &'a mut JsonValue, - item: JsonValue -} -pub struct Table(JsonValue); -pub struct Row<'a>(&'a mut JsonValue); -pub struct Group(JsonValue); -pub struct NullStream; - -impl Write for NullStream { - fn write(&mut self, buf: &[u8]) -> std::io::Result { - Ok(buf.len()) - } - - fn flush(&mut self) -> std::io::Result<()> { - Ok(()) - } -} - -impl<'a> render::Row for Row<'a> { - fn value(&mut self, val: T) -> &mut Self { - self.0.push(format!("{}", val)).unwrap(); - self - } - - fn valued(&mut self, val: T) -> &mut Self { - self.0.push(format!("{:?}", val)).unwrap(); - self - } -} - -impl render::Table for Table { - type Row<'a> = Row<'a>; - - fn col>(&mut self, name: T, length: usize) -> &mut Self { - let col = object! { - name: name.as_ref(), - length: length - }; - self.0["columns"].push(col).unwrap(); - self - } - - fn row(&mut self) -> Self::Row<'_> { - Row(&mut self.0["rows"]) - } -} - -impl Drop for Table { - fn drop(&mut self) { - println!("{}", self.0); - } -} - -impl render::Group for Group { - fn value, T: Display>(&mut self, name: N, val: T) -> &mut Self { - self.0["items"].push(object! { - name: name.as_ref(), - value: format!("{}", val) - }).unwrap(); - self - } - - fn valued, T: Debug>(&mut self, name: N, val: T) -> &mut Self { - self.0["items"].push(object! { - name: name.as_ref(), - value: format!("{:?}", val) - }).unwrap(); - self - } - - fn bpxsd>(&mut self, name: N, value: &Value) -> &mut Self { - self.0["items"].push(object! { - name: name.as_ref(), - value: value.to_json() - }).unwrap(); - self - } -} - -impl Drop for Group { - fn drop(&mut self) { - println!("{}", self.0) - } -} - -impl<'a> render::Item for Item<'a> { - fn value(&mut self, val: T) -> &mut Self { - self.item["value"] = format!("{}", val).into(); - self - } - - fn valued(&mut self, val: T) -> &mut Self { - self.item["value"] = format!("{:?}", val).into(); - self - } - - fn description>(&mut self, description: D) -> &mut Self { - self.item["description"] = description.as_ref().into(); - self - } - - fn note>(&mut self, note: N) -> &mut Self { - self.item["note"] = note.as_ref().into(); - self - } -} - -impl<'a> Drop for Item<'a> { - fn drop(&mut self) { - self.items.push(self.item.take()).unwrap(); - } -} - -impl render::List for List { - type Item<'a> = Item<'a>; - - fn item(&mut self) -> Self::Item<'_> { - Item { - items: &mut self.0["items"], - item: JsonValue::new_object() - } - } -} - -impl Drop for List { - fn drop(&mut self) { - println!("{}", self.0); - } -} - -impl render::Render for Render { - type Table = Table; - type Group = Group; - type List = List; - type RawStream = NullStream; - - fn table>(&mut self, name: T) -> Self::Table { - let val = object! { - type: "table", - name: name.as_ref(), - columns: [], - rows: [] - }; - Table(val) - } - - fn group>(&mut self, name: T) -> Self::Group { - let val = object! { - type: "group", - name: name.as_ref(), - items: [] - }; - Group(val) - } - - fn list>(&mut self, name: T, length: usize) -> Self::List { - let val = object! { - type: "list", - name: name.as_ref(), - length: length, - items: [] - }; - List(val) - } - - fn text>(&mut self, text: T) { - let val = object! { - type: "text", - text: text.as_ref() - }; - println!("{}", val); - } - - fn bpxsd(&mut self, value: &Value) { - println!("{}", value.to_json()); - } - - fn raw>(&mut self, name: T, content_type: ContentType) -> Self::RawStream { - let val = object! { - type: "stream", - name: name.as_ref(), - content: format!("{:?}", content_type), - port: 0 - }; - println!("{}", val); - //TODO: Implement upload to TcpStream. - NullStream - } -} diff --git a/dbg/src/render_backend/mod.rs b/dbg/src/render_backend/mod.rs deleted file mode 100644 index ef212ec..0000000 --- a/dbg/src/render_backend/mod.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2023, BlockProject 3D -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// * Neither the name of BlockProject 3D nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -mod cli; -mod json; - -pub use cli::Render as CliRender; -pub use self::json::Render as JsonRender;