cpclib_runner/runner/assembler/
uz80.rs

1use std::fmt::Display;
2use std::sync::OnceLock;
3
4use crate::delegated::{
5    DownloadableInformation, ExecutableInformation, InternetStaticCompiledApplication,
6    MutiplatformUrls, StaticInformation
7};
8
9pub const UZ80_CMD: &str = "uz80";
10
11#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
12pub enum Uz80Version {
13    #[default]
14    V20240224
15}
16
17impl Display for Uz80Version {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        let v = match self {
20            Uz80Version::V20240224 => "20240224"
21        };
22
23        write!(f, "{v}")
24    }
25}
26
27impl StaticInformation for Uz80Version {
28    fn static_download_urls(&self) -> &'static crate::delegated::MutiplatformUrls {
29        static URL: OnceLock<MutiplatformUrls> = OnceLock::new();
30
31        URL.get_or_init(|| {
32            MutiplatformUrls::builder()
33                .linux("http://cngsoft.no-ip.org/uz80-20240224.zip")
34                .windows("http://cngsoft.no-ip.org/uz80-20240224.zip")
35                .build()
36        })
37    }
38}
39
40impl DownloadableInformation for Uz80Version {
41    fn target_os_archive_format(&self) -> crate::delegated::ArchiveFormat {
42        crate::delegated::ArchiveFormat::Zip
43    }
44}
45
46impl ExecutableInformation for Uz80Version {
47    fn target_os_folder(&self) -> &'static str {
48        static FOLDER: OnceLock<String> = OnceLock::new();
49        FOLDER.get_or_init(|| format!("uz80_{self}")).as_str()
50    }
51
52    fn target_os_exec_fname(&self) -> &'static str {
53        "UZ80.EXE"
54    }
55}
56
57impl InternetStaticCompiledApplication for Uz80Version {}