// This file is part of Chorus . // Copyright (C) 2022-2022 Fuwn // // 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, version 3. // // 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 . // // Copyright (C) 2022-2022 Fuwn // SPDX-License-Identifier: GPL-3.0-only use std::error::Error; use shellfn::shell; #[derive(serde_derive::Deserialize)] pub struct GNUCobol { pub format: Option, pub options: Option>, pub std: Option, pub optimization: Option, } /// Compile an executable Chorus package in a single command #[shell] pub fn compile_executable_single( compiler: &str, flags: &str, files: &str, output: &str, ) -> Result> { r#"$COMPILER -x $FLAGS $FILES -o $OUTPUT"# } /// Compile an ordinary file into an object #[shell] pub fn compile_object( compiler: &str, flags: &str, file: &str, output: &str, ) -> Result> { r#"$COMPILER -c $FLAGS $FILE -o $OUTPUT"# } /// Compile an executable file into an object #[shell] pub fn compile_executable_object( compiler: &str, flags: &str, file: &str, output: &str, ) -> Result> { r#"$COMPILER -c -x $FLAGS $FILE -o $OUTPUT"# } /// Compile an ordinary file into a module #[shell] pub fn compile_module( compiler: &str, flags: &str, file: &str, output: &str, ) -> Result> { r#"$COMPILER -m $FLAGS $FILE -o $OUTPUT"# }