mathtex-portable-engine-generated 0.1.2

Machine generated portable TeX engine core for mathtex, translated from the TeX, eTeX and XeTeX sources
Documentation
//! shared TeX core candidates auto-patched from TeX source when compatible (group `o`).
//! Generated by `cargo run -p mathtex-web2c-import --bin patch_engine`.

#![allow(dead_code, non_camel_case_types, non_snake_case, unused_assignments, unused_must_use, unused_mut, unused_variables)]

use crate::runtime::*;

impl<'resources> PortableTexEngine<'resources> {

    pub(crate) unsafe fn offsave(&mut self) -> EngineFlow<()> {
        let mut mem: *mut memoryword = self.state.zmem.as_mut_ptr();
        let mut p: halfword = 0;
        if self.state.curgroup as i32 == 0 as i32 {
            self.state.interaction as i32 == 3 as i32;
            if self.state.filelineerrorstylep != 0 {
                (&mut *(self as *mut PortableTexEngine<'_>)).printfileline();
            } else {
                (&mut *(self as *mut PortableTexEngine<'_>))
                    .zprintnl(65544 as i64 as strnumber);
            }
            (&mut *(self as *mut PortableTexEngine<'_>)).zprint(66168 as i64 as integer);
            (&mut *(self as *mut PortableTexEngine<'_>))
                .zprintcmdchr(self.state.curcmd as quarterword, self.state.curchr);
            self.state.helpptr = 1 as eightbits;
            self.state.helpline[0 as i32 as usize] = 66476 as i64 as strnumber;
            (&mut *(self as *mut PortableTexEngine<'_>)).error()?;
        } else {
            (&mut *(self as *mut PortableTexEngine<'_>)).backinput()?;
            p = (&mut *(self as *mut PortableTexEngine<'_>)).getavail()?;
            (*mem.offset((self.state.memtop as i32 - 3 as i32) as isize)).hh.v.RH = p;
            self.state.interaction as i32 == 3 as i32;
            if self.state.filelineerrorstylep != 0 {
                (&mut *(self as *mut PortableTexEngine<'_>)).printfileline();
            } else {
                (&mut *(self as *mut PortableTexEngine<'_>))
                    .zprintnl(65544 as i64 as strnumber);
            }
            (&mut *(self as *mut PortableTexEngine<'_>)).zprint(65958 as i64 as integer);
            match self.state.curgroup as i32 {
                14 => {
                    (*mem.offset(p as isize)).hh.v.LH = 34749083 as i64 as halfword;
                    (&mut *(self as *mut PortableTexEngine<'_>))
                        .zprintesc(65831 as i64 as strnumber);
                }
                15 => {
                    (*mem.offset(p as isize)).hh.v.LH = 6291492 as i64 as halfword;
                    (&mut *(self as *mut PortableTexEngine<'_>)).zprintchar(36 as i32);
                }
                16 => {
                    (*mem.offset(p as isize)).hh.v.LH = 34749084 as i64 as halfword;
                    (*mem.offset(p as isize)).hh.v.RH = (&mut *(self
                        as *mut PortableTexEngine<'_>))
                        .getavail()?;
                    p = (*mem.offset(p as isize)).hh.v.RH;
                    (*mem.offset(p as isize)).hh.v.LH = 25165870 as i64 as halfword;
                    (&mut *(self as *mut PortableTexEngine<'_>))
                        .zprintesc(66475 as i64 as strnumber);
                }
                _ => {
                    (*mem.offset(p as isize)).hh.v.LH = 4194429 as i64 as halfword;
                    (&mut *(self as *mut PortableTexEngine<'_>)).zprintchar(125 as i32);
                }
            }
            (&mut *(self as *mut PortableTexEngine<'_>)).zprint(65959 as i64 as integer);
            (&mut *(self as *mut PortableTexEngine<'_>))
                .zbegintokenlist(
                    (*mem.offset((self.state.memtop as i32 - 3 as i32) as isize))
                        .hh
                        .v
                        .RH,
                    5 as i32 as quarterword,
                )?;
            self.state.helpptr = 5 as eightbits;
            self.state.helpline[4 as i32 as usize] = 66470 as i64 as strnumber;
            self.state.helpline[3 as i32 as usize] = 66471 as i64 as strnumber;
            self.state.helpline[2 as i32 as usize] = 66472 as i64 as strnumber;
            self.state.helpline[1 as i32 as usize] = 66473 as i64 as strnumber;
            self.state.helpline[0 as i32 as usize] = 66474 as i64 as strnumber;
            (&mut *(self as *mut PortableTexEngine<'_>)).error()?;
        };
        Ok(())
    }
    pub(crate) unsafe fn omiterror(&mut self) -> EngineFlow<()> {
        self.state.interaction as i32 == 3 as i32;
        if self.state.filelineerrorstylep != 0 {
            (&mut *(self as *mut PortableTexEngine<'_>)).printfileline();
        } else {
            (&mut *(self as *mut PortableTexEngine<'_>))
                .zprintnl(65544 as i64 as strnumber);
        }
        (&mut *(self as *mut PortableTexEngine<'_>)).zprint(66549 as i64 as integer);
        (&mut *(self as *mut PortableTexEngine<'_>))
            .zprintesc(65851 as i64 as strnumber);
        self.state.helpptr = 2 as eightbits;
        self.state.helpline[1 as i32 as usize] = 66559 as i64 as strnumber;
        self.state.helpline[0 as i32 as usize] = 66558 as i64 as strnumber;
        (&mut *(self as *mut PortableTexEngine<'_>)).error()?;
        Ok(())
    }
    pub(crate) unsafe fn openorclosein(&mut self) -> EngineFlow<()> {
        let c_0 = self.state.curchr as eightbits;
        (&mut *(self as *mut PortableTexEngine<'_>)).scanfourbitint()?;
        let n = self.state.curval as eightbits;
        let slot = n as usize;
        if self.state.readopen[slot] as i32 != 2 as i32 {
            Self::boundary_close_file(self.state.readfile[slot]);
            self.state.readfile[slot] = core::ptr::null_mut();
            self.state.readopen[slot] = 2 as eightbits;
        }
        Ok(
            if c_0 as i32 != 0 {
                (&mut *(self as *mut PortableTexEngine<'_>)).scanoptionalequals()?;
                (&mut *(self as *mut PortableTexEngine<'_>)).scanfilename()?;
                (&mut *(self as *mut PortableTexEngine<'_>))
                    .zpackfilename(
                        self.state.curname,
                        self.state.curarea,
                        self.state.curext,
                    );
                if Self::boundary_open_input(
                    self as *mut PortableTexEngine<'_>,
                    &mut self.state.readfile[slot] as *mut unicodefile,
                    resource_format_tex_input,
                    FOPEN_RBIN_MODE.as_ptr(),
                ) != 0
                {
                    self.state.readopen[slot] = 1 as eightbits;
                }
            },
        )
    }
}