pub struct RunUnit<'w, H, L: Loader<H>> {Show 21 fields
pub mem: Vec<u8>,
pub depth: usize,
pub programs: Vec<Loaded<H>>,
pub library: L,
pub dds: Dds,
pub sysin: Option<Box<dyn BufRead + 'w>>,
pub clock: Clock,
pub out: &'w mut dyn Write,
pub err: &'w mut dyn Write,
pub cics: Option<Task>,
pub eib: usize,
pub cics_files: HashMap<String, Open>,
pub sql: Option<Session<'w>>,
pub le: State,
pub oo: Objects<Rc<ClassCode<H>>>,
pub observer: Option<Observer<'w>>,
pub random: Option<u32>,
pub entries: Vec<Entry>,
pub statements: Option<StatementFilter>,
pub taint: Option<Taint>,
pub statement_limit: Option<u64>,
/* private fields */
}Fields§
§mem: Vec<u8>§depth: usizePERFORMs and CALLs in progress, across every program.
programs: Vec<Loaded<H>>§library: L§dds: Dds§sysin: Option<Box<dyn BufRead + 'w>>§clock: Clock§out: &'w mut dyn Write§err: &'w mut dyn Write§cics: Option<Task>The CICS task a harness run stands in for, with its EXEC interface block and open files.
eib: usize§cics_files: HashMap<String, Open>§sql: Option<Session<'w>>The database EXEC SQL statements reach, when the run has one.
le: StateLanguage Environment’s heap storage and message files.
oo: Objects<Rc<ClassCode<H>>>Classes, objects and the JNI environment of the run unit’s object-oriented programs.
observer: Option<Observer<'w>>Told what the run opens, closes and loads, when a caller keeps evidence of it.
random: Option<u32>FUNCTION RANDOM’s generator, one for the run unit, from the first reference on.
entries: Vec<Entry>The entries SET TO ENTRY has named, which function-pointers and procedure-pointers hold.
statements: Option<StatementFilter>The statements an observer is told of as each starts; None tells it of none.
taint: Option<Taint>Which bytes may hold input, when the run traces input.
statement_limit: Option<u64>How many more statements may start before the run ends with S322; None for no limit.
Implementations§
Source§impl<H, L: Loader<H>> RunUnit<'_, H, L>
impl<H, L: Loader<H>> RunUnit<'_, H, L>
Sourcepub fn write(&mut self, offset: usize, bytes: &[u8])
pub fn write(&mut self, offset: usize, bytes: &[u8])
Copies bytes into memory at offset; under taint they may hold input when the running
statement has read a byte that may. Every write of data to memory goes through here or
RunUnit::write_input, or marks its bytes with RunUnit::mark.
Sourcepub fn write_input(&mut self, offset: usize, bytes: &[u8])
pub fn write_input(&mut self, offset: usize, bytes: &[u8])
Copies input into memory at offset: bytes a READ, ACCEPT or row brought in.
Sourcepub fn mark(&mut self, offset: usize, len: usize)
pub fn mark(&mut self, offset: usize, len: usize)
Marks bytes written outside RunUnit::write as it would.
Sourcepub fn mark_input(&mut self, offset: usize, len: usize, input: bool)
pub fn mark_input(&mut self, offset: usize, len: usize, input: bool)
Marks bytes as input, or as holding none: initial values, which are constants.
Sourcepub fn taint_read(&mut self, loc: Loc)
pub fn taint_read(&mut self, loc: Loc)
A read of loc by the running statement.
Sourcepub fn writing(&mut self, on: bool) -> bool
pub fn writing(&mut self, on: bool) -> bool
Taint::writing, when the run traces input.
Sourcepub fn statement_starts(&mut self)
pub fn statement_starts(&mut self)
A statement with a position starts: its writes carry only what it reads.
Sourcepub fn take_input(&mut self)
pub fn take_input(&mut self)
Taint::take_input, when the run traces input.
Sourcepub fn holds_input(&self, offset: usize, len: usize) -> bool
pub fn holds_input(&self, offset: usize, len: usize) -> bool
Whether any byte of the range may hold input; false without taint.
Sourcepub fn pending(&self) -> bool
pub fn pending(&self) -> bool
Whether the running statement has read a byte that may hold input.
Sourcepub fn resume_statement(&mut self, read_before: bool)
pub fn resume_statement(&mut self, read_before: bool)
Taint::resume_statement, when the run traces input.
Sourcepub fn unfollowed(&mut self, what: &'static str)
pub fn unfollowed(&mut self, what: &'static str)
The run did what, which taint does not follow.
Sourcepub fn input_at_sink(&self) -> Option<bool>
pub fn input_at_sink(&self) -> Option<bool>
Whether an input byte may be in a sink’s operand; None without taint.
Source§impl<'w, H: Clone, L: Loader<H>> RunUnit<'w, H, L>
impl<'w, H: Clone, L: Loader<H>> RunUnit<'w, H, L>
pub fn new( library: L, dds: Dds, sysin: Option<Box<dyn BufRead + 'w>>, clock: Clock, out: &'w mut dyn Write, err: &'w mut dyn Write, ) -> Self
Sourcepub fn add_named(
&mut self,
compiled: Option<H>,
name: String,
files: usize,
size: usize,
) -> usize
pub fn add_named( &mut self, compiled: Option<H>, name: String, files: usize, size: usize, ) -> usize
Adds a program to the run unit under name and gives it its storage.
Sourcepub fn begin_cics_run_unit(&mut self)
pub fn begin_cics_run_unit(&mut self)
A CICS LINK or XCTL starts a run unit of its own (C145): every program starts in it in its
initial state, with storage of its own, it has no EXTERNAL data or files and an empty heap
(C126), FUNCTION RANDOM has not been referenced (C104) and RETURN-CODE is zero (C105), and
the state of the run unit that issued it is set aside until RunUnit::end_cics_run_unit.
Sourcepub fn end_cics_run_unit(&mut self, xctl: bool) -> Result<(), String>
pub fn end_cics_run_unit(&mut self, xctl: bool) -> Result<(), String>
Ends the run unit RunUnit::begin_cics_run_unit started, closing the files its programs
and its EXTERNAL files left open as Language Environment closes an enclave’s, and dropping
its programs’ storage, EXTERNAL data and heap: a program it loaded stays loaded, in its
initial state with no storage (C129), and the run unit set aside has everything back but,
after xctl, RETURN-CODE, the program XCTL started having taken the issuer’s place (C105).
Sourcepub fn load_entry(
&mut self,
name: &str,
copy: bool,
) -> Result<(usize, Option<usize>), LoadError>
pub fn load_entry( &mut self, name: &str, copy: bool, ) -> Result<(usize, Option<usize>), LoadError>
The program a CALL of name enters, and which of its ENTRY statements when name is not
its PROGRAM-ID: the one copy of the program, or with copy a copy of its own for the entry
name (crate::callee::entry_copy).
Sourcepub fn push_temporary(&mut self, bytes: &[u8]) -> usize
pub fn push_temporary(&mut self, bytes: &[u8]) -> usize
Storage for a BY CONTENT or BY VALUE argument, at the end of memory, written as
RunUnit::write writes.
Sourcepub fn release_temporaries(&mut self, mark: usize)
pub fn release_temporaries(&mut self, mark: usize)
Releases arguments pushed since mark, unless a program’s storage, heap storage or EXTERNAL
storage was placed behind them.
Sourcepub fn enter(&mut self, pos: Pos) -> Result<(), Abend>
pub fn enter(&mut self, pos: Pos) -> Result<(), Abend>
One more PERFORM or CALL in progress, refused past MAX_DEPTH rather than exhaust the stack.
Sourcepub fn activate(&mut self, me: usize, initial: bool) -> (usize, bool)
pub fn activate(&mut self, me: usize, initial: bool) -> (usize, bool)
Marks program me active: where its storage starts, and whether the activation starts from
fresh storage, as its first does, the first after a CANCEL, and every one of an INITIAL
program.
Sourcepub fn initialized(&mut self, me: usize)
pub fn initialized(&mut self, me: usize)
Program me’s storage holds its initial values, and its GO TOs go where they are written.
pub fn find(&self, name: &str) -> Option<usize>
Sourcepub fn load(&mut self, name: &str) -> Result<usize, LoadError>
pub fn load(&mut self, name: &str) -> Result<usize, LoadError>
The program CALL names, compiling and loading it the first time.
pub const fn observed(&self) -> bool
Sourcepub fn start_statement(&mut self, program: usize, pos: Pos) -> Result<(), Abend>
pub fn start_statement(&mut self, program: usize, pos: Pos) -> Result<(), Abend>
Whether a statement starting on line is told to the observer.
Counts the start of program’s statement at pos against the statement limit. Once it is
spent the run ends with S322, as z/OS ends a step that runs past its TIME=, at the next start
of the loop it is in, so the place does not depend on how many statements ran before the
loop (assumption C241).
pub fn traces(&self, line: u32) -> bool
pub fn notify(&mut self, event: Event<'_>)
Sourcepub fn close_all(&mut self, unclosed: bool) -> Result<(), String>
pub fn close_all(&mut self, unclosed: bool) -> Result<(), String>
Closes every file any program left open, as the runtime does when the run unit ends, normally
or by an abend under TRAP(ON). An abend TRAP(OFF) keeps from Language Environment closes
none (unclosed), and each VSAM data set stays marked open for output
(numeric::assumptions::TRAP_OFF_LEAVES_FILES_OPEN).
Sourcepub fn external(
&mut self,
name: &str,
file: bool,
size: usize,
dialect: Dialect,
) -> Result<usize, String>
pub fn external( &mut self, name: &str, file: bool, size: usize, dialect: Dialect, ) -> Result<usize, String>
Where EXTERNAL record name is, or EXTERNAL file name’s record area when file: storage
of size bytes, zeroed, the first time a program describes it. A description of another
size is refused (assumption C180), except under –dialect gnucobol a shorter record’s, which
shares the storage with a warning, as cobc’s does.
Sourcepub fn external_file(&mut self, name: &str) -> Connector
pub fn external_file(&mut self, name: &str) -> Connector
The run unit’s connector for EXTERNAL file name.
Sourcepub fn connect(&mut self, me: usize, k: usize, to: Connector)
pub fn connect(&mut self, me: usize, k: usize, to: Connector)
Program me’s file k is the connector to, for as long as the run unit lasts.
Sourcepub fn file(&mut self, me: usize, k: usize) -> &mut Option<Open>
pub fn file(&mut self, me: usize, k: usize) -> &mut Option<Open>
Program me’s file k, open or not: its own, or the connector it shares.
Sourcepub fn locked(&mut self, me: usize, k: usize) -> &mut bool
pub fn locked(&mut self, me: usize, k: usize) -> &mut bool
Whether program me’s file k, or the connector it shares, was closed WITH LOCK.