Skip to main content

ironwork_rt/
bms.rs

1//! The mapset model BMS map source describes: each map's fields with their positions, attributes
2//! and initial data, as SEND MAP and RECEIVE MAP use it.
3
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum Mode {
6    In,
7    Out,
8    InOut,
9}
10
11#[derive(Clone, Debug, PartialEq, Eq)]
12pub enum Initial {
13    Text(String),
14    Bytes(Vec<u8>),
15}
16
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18pub enum Protection {
19    Askip,
20    Prot,
21    Unprot,
22}
23
24#[derive(Clone, Copy, Debug, PartialEq, Eq)]
25pub enum Intensity {
26    Norm,
27    Brt,
28    Drk,
29}
30
31#[derive(Clone, Copy, Debug, PartialEq, Eq)]
32pub struct Attrb {
33    pub protection: Protection,
34    pub numeric: bool,
35    pub intensity: Intensity,
36    pub detectable: bool,
37    pub cursor: bool,
38    pub fset: bool,
39}
40
41#[derive(Clone, Debug, PartialEq, Eq)]
42pub struct Field {
43    /// Upper-cased label; None for an unlabelled field.
44    pub name: Option<String>,
45    /// 1-based position of the attribute byte within the map.
46    pub line: u16,
47    pub column: u16,
48    pub length: u16,
49    pub attrb: Attrb,
50    /// INITIAL or GINIT text, or XINIT's bytes.
51    pub initial: Option<Initial>,
52    pub picin: Option<String>,
53    pub picout: Option<String>,
54    pub occurs: u16,
55    pub group: Option<String>,
56    pub justify_right: bool,
57    pub fill_zero: bool,
58    pub color: Option<String>,
59    pub hilight: Option<String>,
60}
61
62#[derive(Clone, Debug, PartialEq, Eq)]
63pub struct Map {
64    pub name: String,
65    pub lines: u16,
66    pub columns: u16,
67    pub line: u16,
68    pub column: u16,
69    pub ctrl: Vec<String>,
70    pub tioapfx: bool,
71    pub dsatts: Vec<String>,
72    pub fields: Vec<Field>,
73}
74
75#[derive(Clone, Debug, PartialEq, Eq)]
76pub struct Mapset {
77    pub name: String,
78    pub mode: Mode,
79    pub ctrl: Vec<String>,
80    pub maps: Vec<Map>,
81}