Skip to content

Commit

Permalink
Apply cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty/Benediction committed Nov 11, 2024
1 parent 69b05de commit 6a14e4e
Show file tree
Hide file tree
Showing 18 changed files with 396 additions and 401 deletions.
1 change: 0 additions & 1 deletion cpclib-asm/src/implementation/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub fn ensure_orgams_type(e: ExprResult, env: &Env) -> Result<ExprResult, Assemb

/// ! Add all important methods to expresison-like structure sthat are not availalbe in the cpclib_tokens crate.

///
/// The result of expression (without taking into account the strings) is either a int (no complex mathematical expression) or a float (division/sinus and so on)

/// Evaluate an expression
Expand Down
6 changes: 3 additions & 3 deletions cpclib-bndbuild/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use crate::runners::imgconverter::ImgConverterRunner;
use crate::runners::rm::RmRunner;
use crate::runners::xfer::XferRunner;
use crate::task::{
is_amspirit_cmd, is_basm_cmd, is_cp_cmd, is_disc_cmd, is_echo_cmd,
is_emuctrl_cmd, is_extern_cmd, is_hideur_cmd, is_img2cpc_cmd, is_orgams_cmd,
is_rm_cmd, is_winape_cmd, is_xfer_cmd, Task
is_amspirit_cmd, is_basm_cmd, is_cp_cmd, is_disc_cmd, is_echo_cmd, is_emuctrl_cmd,
is_extern_cmd, is_hideur_cmd, is_img2cpc_cmd, is_orgams_cmd, is_rm_cmd, is_winape_cmd,
is_xfer_cmd, Task
};
use crate::{execute, init_project, BndBuilder, BndBuilderError, EXPECTED_FILENAMES};

Expand Down
39 changes: 31 additions & 8 deletions cpclib-bndbuild/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ use cpclib_common::clap;
use cpclib_common::clap::*;
use cpclib_common::itertools::Itertools;
use lazy_regex::regex_captures;
use task::{ACE_CMDS, AMSPIRIT_CMDS, BASM_CMDS, BNDBUILD_CMDS, CPCEC_CMDS, CP_CMDS, DISC_CMDS, ECHO_CMDS, EMUCTRL_CMDS, EXTERN_CMDS, FAP_CMDS, HIDEUR_CMDS, IMG2CPC_CMDS, IMPDISC_CMDS, MARTINE_CMDS, ORGAMS_CMDS, RASM_CMDS, RM_CMDS, SJASMPLUS_CMDS, SUGARBOX_CMDS, VASM_CMDS, WINAPE_CMDS, XFER_CMDS};
use task::{
ACE_CMDS, AMSPIRIT_CMDS, BASM_CMDS, BNDBUILD_CMDS, CPCEC_CMDS, CP_CMDS, DISC_CMDS, ECHO_CMDS,
EMUCTRL_CMDS, EXTERN_CMDS, FAP_CMDS, HIDEUR_CMDS, IMG2CPC_CMDS, IMPDISC_CMDS, MARTINE_CMDS,
ORGAMS_CMDS, RASM_CMDS, RM_CMDS, SJASMPLUS_CMDS, SUGARBOX_CMDS, VASM_CMDS, WINAPE_CMDS,
XFER_CMDS
};
use thiserror::Error;

use crate::executor::*;
Expand Down Expand Up @@ -39,15 +44,33 @@ pub fn process_matches(matches: &ArgMatches) -> Result<(), BndBuilderError> {

pub fn build_args_parser() -> clap::Command {
static COMMANDS_LIST: OnceLock<Vec<&str>> = OnceLock::new();
let commands_list = COMMANDS_LIST.get_or_init(||{
let commands_list = COMMANDS_LIST.get_or_init(|| {
let sources = [
EMUCTRL_CMDS, ACE_CMDS, WINAPE_CMDS, CPCEC_CMDS, AMSPIRIT_CMDS, SUGARBOX_CMDS,
BASM_CMDS, ORGAMS_CMDS, RASM_CMDS, SJASMPLUS_CMDS, VASM_CMDS,
BNDBUILD_CMDS, CP_CMDS, DISC_CMDS, ECHO_CMDS, EXTERN_CMDS, FAP_CMDS, IMG2CPC_CMDS, HIDEUR_CMDS,
IMPDISC_CMDS, MARTINE_CMDS, RM_CMDS, XFER_CMDS
EMUCTRL_CMDS,
ACE_CMDS,
WINAPE_CMDS,
CPCEC_CMDS,
AMSPIRIT_CMDS,
SUGARBOX_CMDS,
BASM_CMDS,
ORGAMS_CMDS,
RASM_CMDS,
SJASMPLUS_CMDS,
VASM_CMDS,
BNDBUILD_CMDS,
CP_CMDS,
DISC_CMDS,
ECHO_CMDS,
EXTERN_CMDS,
FAP_CMDS,
IMG2CPC_CMDS,
HIDEUR_CMDS,
IMPDISC_CMDS,
MARTINE_CMDS,
RM_CMDS,
XFER_CMDS
];



let mut list = Vec::with_capacity(sources.iter().map(|l| l.len()).sum());
for l in sources.into_iter() {
list.extend_from_slice(l);
Expand Down
4 changes: 2 additions & 2 deletions cpclib-bndbuild/src/runners/assembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ impl<E: EventObserver> Default for OrgamsRunner<E> {
}
}

impl<E: EventObserver +'static> RunnerWithClap for OrgamsRunner<E> {
impl<E: EventObserver + 'static> RunnerWithClap for OrgamsRunner<E> {
fn get_clap_command(&self) -> &Command {
&self.command
}
}

impl<E: EventObserver +'static> Runner for OrgamsRunner<E> {
impl<E: EventObserver + 'static> Runner for OrgamsRunner<E> {
type EventObserver = E;

fn inner_run<S: AsRef<str>>(&self, itr: &[S], o: &E) -> Result<(), String> {
Expand Down
9 changes: 3 additions & 6 deletions cpclib-bndbuild/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub enum Task {
Xfer(StandardTaskArguments)
}


// list of keywords; do not forget to add them to bndbuild/lib.rs
pub const EMUCTRL_CMDS: &[&str] = &[EMUCTRL_CMD, "emu", "emuctrl", "emucontrol"];
pub const ACE_CMDS: &[&str] = &[ACE_CMD, "acedl"];
Expand Down Expand Up @@ -193,11 +192,9 @@ impl<'de> Deserialize<'de> for Task {
}
else if is_vasm_cmd(code) {
Ok(Task::Assembler(
Assembler::Extern(
cpclib_runner::runner::assembler::ExternAssembler::Vasm(
Default::default()
)
),
Assembler::Extern(cpclib_runner::runner::assembler::ExternAssembler::Vasm(
Default::default()
)),
std
))
}
Expand Down
2 changes: 1 addition & 1 deletion cpclib-image/src/pixels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ pub mod mode0 {

/// Generate the needed table to write a masked sprite on screen when mask_pen corresponds to the pen of the background.
///
/// Code for the display
/// Code for the display
/// ld e, sprite byte to display
/// ld d, mask_table / 256
/// ld a, (de) ; get the mask
Expand Down
Loading

0 comments on commit 6a14e4e

Please sign in to comment.