1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//! Places (lir.md ยง5): data references resolved at lowering, which an executor evaluates to a `Loc`.
use super::{DebugId, IntExpr, PlaceNumcheck, SymId, XmlRegister};
use crate::storage::Kind;
use crate::{codec_enum, codec_struct};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Place {
pub base: Base,
pub offset: u32,
/// One occurrence, before OCCURS DEPENDING ON and reference modification.
pub len: u32,
pub kind: Kind,
/// PICTURE P positions right of the item's digits: its value is its digits times ten to this.
pub scaling: u32,
/// The OCCURS DEPENDING ON tables ahead of the item in its record, not within it: each moves
/// the item back by its occurrences past the current count, evaluated before the subscripts.
pub moved: Vec<Odo>,
/// One per OCCURS level, outermost first.
pub subscripts: Vec<Subscript>,
/// The OCCURS DEPENDING ON tables within the item, other than one within another of them: each
/// leaves its occurrences past the current count out of the length.
pub odo: Vec<Odo>,
pub refmod: Option<RefMod>,
pub name: SymId,
pub at: DebugId,
pub numcheck: PlaceNumcheck,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Base {
Program,
Local,
Linkage(u16),
/// RETURN-CODE at run-unit offset 0, when the program declares none.
ReturnCode,
Eib,
SelfRef,
JniEnv,
/// An XML PARSE fragment register, the current event's text: `offset` and `len` are 0 and the
/// fragment gives both. Its reference modification is checked whatever `check` says, abending
/// IRONWORK "reference modification (s:l) of NAME is outside its N bytes".
Xml(XmlRegister),
}
/// `check` is the occurrence count, present only under SSRANGE.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Subscript {
pub stride: u32,
pub value: IntExpr,
pub check: Option<u32>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Odo {
pub object: IntExpr,
pub max: u32,
pub element: u32,
pub check: bool,
}
/// Start and length count character positions: two bytes each when the place's kind is national.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RefMod {
pub start: IntExpr,
pub length: Option<IntExpr>,
pub check: bool,
}
codec_struct!(Place { base, offset, len, kind, scaling, moved, subscripts, odo, refmod, name, at, numcheck });
codec_enum!(Base {
Program = 0,
Local = 1,
Linkage(record) = 2,
ReturnCode = 3,
Eib = 4,
SelfRef = 5,
JniEnv = 6,
Xml(register) = 7,
});
codec_struct!(Subscript { stride, value, check });
codec_struct!(Odo { object, max, element, check });
codec_struct!(RefMod { start, length, check });