Skip to main content

RunUnit

Struct RunUnit 

Source
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: usize

PERFORMs 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: State

Language 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>

Source

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.

Source

pub fn write_input(&mut self, offset: usize, bytes: &[u8])

Copies input into memory at offset: bytes a READ, ACCEPT or row brought in.

Source

pub fn mark(&mut self, offset: usize, len: usize)

Marks bytes written outside RunUnit::write as it would.

Source

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.

Source

pub fn taint_read(&mut self, loc: Loc)

A read of loc by the running statement.

Source

pub fn writing(&mut self, on: bool) -> bool

Taint::writing, when the run traces input.

Source

pub fn statement_starts(&mut self)

A statement with a position starts: its writes carry only what it reads.

Source

pub fn take_input(&mut self)

Taint::take_input, when the run traces input.

Source

pub fn holds_input(&self, offset: usize, len: usize) -> bool

Whether any byte of the range may hold input; false without taint.

Source

pub fn pending(&self) -> bool

Whether the running statement has read a byte that may hold input.

Source

pub fn resume_statement(&mut self, read_before: bool)

Taint::resume_statement, when the run traces input.

Source

pub fn unfollowed(&mut self, what: &'static str)

The run did what, which taint does not follow.

Source

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>

Source

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

Source

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.

Source

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.

Source

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).

Source

pub fn load_entry( &mut self, name: &str, dynamic: 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. A static CALL of an entry name enters the one copy of the program; a dynamic CALL gets a copy of its own for each entry name (assumption C51).

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn initialized(&mut self, me: usize)

Program me’s storage holds its initial values, and its GO TOs go where they are written.

Source

pub fn find(&self, name: &str) -> Option<usize>

Source

pub fn load(&mut self, name: &str) -> Result<usize, LoadError>

The program CALL names, compiling and loading it the first time.

Source

pub const fn observed(&self) -> bool

Source

pub fn start_statement(&mut self, pos: Pos) -> Result<(), Abend>

Whether a statement starting on line is told to the observer. Counts the start of the statement at pos against the statement limit: once it is spent the run ends there with S322, as z/OS ends a step that runs past its TIME= (assumption C241).

Source

pub fn traces(&self, line: u32) -> bool

Source

pub fn notify(&mut self, event: Event<'_>)

Source

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).

Source

pub fn external( &mut self, name: &str, file: bool, size: usize, ) -> 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).

Source

pub fn external_file(&mut self, name: &str) -> Connector

The run unit’s connector for EXTERNAL file name.

Source

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.

Source

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.

Source

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.

Source

pub fn file_ref(&self, me: usize, k: usize) -> &Option<Open>

Source

pub fn return_code(&self) -> i16

Source

pub fn now(&self) -> (i64, u32)

The current time: seconds since the epoch, and hundredths.

Auto Trait Implementations§

§

impl<'w, H, L> !RefUnwindSafe for RunUnit<'w, H, L>

§

impl<'w, H, L> !Send for RunUnit<'w, H, L>

§

impl<'w, H, L> !Sync for RunUnit<'w, H, L>

§

impl<'w, H, L> !UnwindSafe for RunUnit<'w, H, L>

§

impl<'w, H, L> Freeze for RunUnit<'w, H, L>
where Vec<Loaded<H>>: Freeze, L: Freeze, Objects<Rc<ClassCode<H>>>: Freeze,

§

impl<'w, H, L> Unpin for RunUnit<'w, H, L>
where Vec<Loaded<H>>: Unpin, L: Unpin, Objects<Rc<ClassCode<H>>>: Unpin,

§

impl<'w, H, L> UnsafeUnpin for RunUnit<'w, H, L>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.