1use crate::abend::{Abend, AbendCode};
6use crate::vocab::Pos;
7use std::fmt::Display;
8
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub struct Refusal {
11 pub id: &'static str,
12 pub text: &'static str,
13}
14
15impl Refusal {
16 pub fn message(&self, text: impl Display) -> String {
18 format!("{}-S {text}", self.id)
19 }
20
21 pub fn abend(&self, text: impl Display, pos: Pos) -> Abend {
23 self.ending(AbendCode::Ironwork, text, pos)
24 }
25
26 pub fn ending(&self, code: AbendCode, text: impl Display, pos: Pos) -> Abend {
28 Abend { code, message: self.message(text), pos, file: None }
29 }
30}
31
32macro_rules! catalogue {
33 ($($id:ident $text:literal;)*) => {
34 $(pub const $id: Refusal = Refusal { id: stringify!($id), text: $text };)*
35 pub const RUNTIME: &[Refusal] = &[$($id),*];
37 };
38}
39
40catalogue! {
41 IWR0058 "EXEC CICS {command} is not supported yet";
42 IWR0059 "EXEC CICS FORMATTIME {option} is not supported";
43 IWR0060 "EXEC {kind} {command} was reached: ironwork for COBOL checks EXEC statements but does not run them yet";
44 IWR0061 "EXEC SQL {verb} was reached: ironwork for COBOL does not run {statement}";
45 IWR0062 "{what} was reached: {class} is a Java class, and ironwork for COBOL checks Java classes but has no JVM to run them";
46 IWR0063 "CALL {name} was reached: {service} is a JNI service, and ironwork for COBOL has no JVM to run it";
47 IWR0064 "FUNCTION {name} is not supported yet";
48 IWR0065 "FUNCTION LENGTH of this argument is not supported yet";
49 IWR0066 "DISPLAY of a floating-point value is not supported yet";
50 IWR0067 "DISPLAY of a pointer, index or object reference is not supported";
51 IWR0068 "ADVANCING {name} on {file}, whose FD has LINAGE, is not supported yet";
52 IWR0070 "this BY VALUE argument is not supported";
53 IWR0071 "this INVOKE argument is not supported";
54 IWR0072 "{statement}: {name} is a Language Environment callable service that ironwork for COBOL does not provide yet";
55 IWR0073 "the VM does not run {construct} yet; run it with --interpret";
56 IWR0074 "{file}, a GLOBAL file of {declarer}, is written as a print file in one of {declarer} and {program} and not the other, which is not supported yet";
57}