From 242b0b9591fa4fd5f8b4a45ec4c179f451c62c14 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 15 May 2022 23:44:53 -0700 Subject: feat: initial development release --- src/compilers/gnucobol.rs | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/compilers/gnucobol.rs (limited to 'src/compilers/gnucobol.rs') diff --git a/src/compilers/gnucobol.rs b/src/compilers/gnucobol.rs new file mode 100644 index 0000000..8b19e85 --- /dev/null +++ b/src/compilers/gnucobol.rs @@ -0,0 +1,73 @@ +// 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"# +} -- cgit v1.2.3