pub(crate) unsafe fn check_outer_validity(input: &mut input_state_t, cs: &mut i32) -> bool {
    let mut spacer = false;
    if scanner_status != ScannerStatus::Normal {
        deletions_allowed = false;
        // Back up an outer control sequence so that it can be reread
        if *cs != 0 {
            if input.state == InputState::TokenList || input.name < 1 || input.name > 17 {
                let p = get_avail();
                MEM[p].b32.s0 = CS_TOKEN_FLAG + *cs;
                // prepare to read the control sequence again
                begin_token_list(input, Some(p), Btl::BackedUp);
            }
            spacer = true;
        }
        if scanner_status != ScannerStatus::Normal && scanner_status != ScannerStatus::Skipping {
            /*350:*/
            // Tell the user what has run away...
            // print a definition, argument, or preamble
            runaway();
            if *cs == 0 {
                t_eprint!("File ended");
            // File ended while scanning...
            } else {
                *cs = 0;
                t_eprint!("Forbidden control sequence found");
                // Forbidden control sequence...
            }
            // Print either "definition" or "use" or "preamble" or "text",
            // and insert tokens that should lead to recovery
            //
            // The recovery procedure can't be fully understood without knowing more
            // about the `\TeX` routines that should be aborted, but we can sketch the
            // ideas here:  For a runaway definition we will insert a right brace; for a
            // runaway preamble, we will insert a special `\cr` token and a right
            // brace; and for a runaway argument, we will set `long_state` to
            // `outer_call` and insert `\par`.
            let mut p = get_avail();
            match scanner_status {
                ScannerStatus::Defining => {
                    t_print!(" while scanning definition");
                    MEM[p].b32.s0 = RIGHT_BRACE_TOKEN + '}' as i32
                }
                ScannerStatus::Matching => {
                    t_print!(" while scanning use");
                    MEM[p].b32.s0 = par_token;
                    long_state = Cmd::OuterCall;
                }
                ScannerStatus::Aligning => {
                    t_print!(" while scanning preamble");
                    MEM[p].b32.s0 = RIGHT_BRACE_TOKEN + '}' as i32;
                    let q = p;
                    p = get_avail();
                    *LLIST_link(p) = Some(q).tex_int();
                    MEM[p].b32.s0 = CS_TOKEN_FLAG + FROZEN_CR as i32;
                    align_state = -1_000_000;
                }
                ScannerStatus::Absorbing => {
                    t_print!(" while scanning text");
                    MEM[p].b32.s0 = RIGHT_BRACE_TOKEN + '}' as i32
                }
                _ => unreachable!(), // there are no other cases
            }
            begin_token_list(input, Some(p), Btl::Inserted);
            t_print!(" of {:#}", Cs(warning_index));
            help!(
                "I suspect you have forgotten a `}\', causing me",
                "to read past where you wanted me to stop.",
                "I\'ll try to recover; but if the error is serious,",
                "you\'d better type `E\' or `X\' now and fix your file."
            );
            error();
        } else {
            // Tell the user what has run away and try to recover
            t_eprint!(
                "Incomplete {}; all text was ignored after line {}",
                CmdChr(Cmd::IfTest, cur_if as i32),
                skip_line
            );
            let help2 = if *cs != 0 {
                *cs = 0;
                &"A forbidden control sequence occurred in skipped text."[..]
            } else {
                &"The file ended while I was skipping conditional text."[..]
            };
            help!(
                help2,
                "This kind of error happens when you say `\\if...\' and forget",
                "the matching `\\fi\'. I\'ve inserted a `\\fi\'; this might work."
            );
            let tok = CS_TOKEN_FLAG + FROZEN_FI as i32;
            ins_error(input, tok);
        }
        deletions_allowed = true
    }
    spacer
}
/// Before getting into |get_next|, let's consider the subroutine that
/// is called when an `\outer` control sequence has been scanned or
/// when the end of a file has been reached. These two cases are distinguished
/// by `cur_cs`, which is zero at the end of a file.
Before getting into |get_next|, let's consider the subroutine that
is called when an `\outer` control sequence has been scanned or
when the end of a file has been reached. These two cases are distinguished
by `cur_cs`, which is zero at the end of a file.
Before getting into |get_next| let ' s consider the subroutine that is called when an ` \ outer ` control sequence has been scanned or when the end of a file has been reached . These two cases are distinguished by ` cur_cs ` which is zero at the end of a file .
pub(crate) unsafe fn check_outer_validity(input: &mut input_state_t, cs: &mut i32) -> bool {
    let mut spacer = false;
    if scanner_status != ScannerStatus::Normal {
        deletions_allowed = false;
        // Back up an outer control sequence so that it can be reread
        if *cs != 0 {
            if input.state == InputState::TokenList || input.name < 1 || input.name > 17 {
                let p = get_avail();
                MEM[p].b32.s0 = CS_TOKEN_FLAG + *cs;
                // prepare to read the control sequence again
                begin_token_list(input, Some(p), Btl::BackedUp);
            }
            spacer = true;
        }
        if scanner_status != ScannerStatus::Normal && scanner_status != ScannerStatus::Skipping {
            /*350:*/
            // Tell the user what has run away...
            // print a definition, argument, or preamble
            runaway();
            if *cs == 0 {
                t_eprint!("File ended");
            // File ended while scanning...
            } else {
                *cs = 0;
                t_eprint!("Forbidden control sequence found");
                // Forbidden control sequence...
            }
            // Print either "definition" or "use" or "preamble" or "text",
            // and insert tokens that should lead to recovery
            //
            // The recovery procedure can't be fully understood without knowing more
            // about the `\TeX` routines that should be aborted, but we can sketch the
            // ideas here:  For a runaway definition we will insert a right brace; for a
            // runaway preamble, we will insert a special `\cr` token and a right
            // brace; and for a runaway argument, we will set `long_state` to
            // `outer_call` and insert `\par`.
            let mut p = get_avail();
            match scanner_status {
                ScannerStatus::Defining => {
                    t_print!(" while scanning definition");
                    MEM[p].b32.s0 = RIGHT_BRACE_TOKEN + '}' as i32
                }
                ScannerStatus::Matching => {
                    t_print!(" while scanning use");
                    MEM[p].b32.s0 = par_token;
                    long_state = Cmd::OuterCall;
                }
                ScannerStatus::Aligning => {
                    t_print!(" while scanning preamble");
                    MEM[p].b32.s0 = RIGHT_BRACE_TOKEN + '}' as i32;
                    let q = p;
                    p = get_avail();
                    *LLIST_link(p) = Some(q).tex_int();
                    MEM[p].b32.s0 = CS_TOKEN_FLAG + FROZEN_CR as i32;
                    align_state = -1_000_000;
                }
                ScannerStatus::Absorbing => {
                    t_print!(" while scanning text");
                    MEM[p].b32.s0 = RIGHT_BRACE_TOKEN + '}' as i32
                }
                _ => unreachable!(), // there are no other cases
            }
            begin_token_list(input, Some(p), Btl::Inserted);
            t_print!(" of {:#}", Cs(warning_index));
            help!(
                "I suspect you have forgotten a `}\', causing me",
                "to read past where you wanted me to stop.",
                "I\'ll try to recover; but if the error is serious,",
                "you\'d better type `E\' or `X\' now and fix your file."
            );
            error();
        } else {
            // Tell the user what has run away and try to recover
            t_eprint!(
                "Incomplete {}; all text was ignored after line {}",
                CmdChr(Cmd::IfTest, cur_if as i32),
                skip_line
            );
            let help2 = if *cs != 0 {
                *cs = 0;
                &"A forbidden control sequence occurred in skipped text."[..]
            } else {
                &"The file ended while I was skipping conditional text."[..]
            };
            help!(
                help2,
                "This kind of error happens when you say `\\if...\' and forget",
                "the matching `\\fi\'. I\'ve inserted a `\\fi\'; this might work."
            );
            let tok = CS_TOKEN_FLAG + FROZEN_FI as i32;
            ins_error(input, tok);
        }
        deletions_allowed = true
    }
    spacer
}
pub ( crate ) unsafe fn check_outer_validity ( input : & mut input_state_t , cs : & mut i32 ) -> bool { let mut spacer = false ; if scanner_status != ScannerStatus :: Normal { deletions_allowed = false ; // Back up an outer control sequence so that it can be reread if * cs != 0 { if input . state == InputState :: TokenList || input . name < 1 || input . name > 17 { let p = get_avail ( ) ; MEM [ p ] . b32 . s0 = CS_TOKEN_FLAG + * cs ; // prepare to read the control sequence again begin_token_list ( input , Some ( p ) , Btl :: BackedUp ) ; } spacer = true ; } if scanner_status != ScannerStatus :: Normal && scanner_status != ScannerStatus :: Skipping { /*350:*/ // Tell the user what has run away... // print a definition, argument, or preamble runaway ( ) ; if * cs == 0 { t_eprint ! ( " " ) ; // File ended while scanning... } else { * cs = 0 ; t_eprint ! ( " " ) ; // Forbidden control sequence... } // Print either "definition" or "use" or "preamble" or "text", // and insert tokens that should lead to recovery // // The recovery procedure can't be fully understood without knowing more // about the `\TeX` routines that should be aborted, but we can sketch the // ideas here:  For a runaway definition we will insert a right brace; for a // runaway preamble, we will insert a special `\cr` token and a right // brace; and for a runaway argument, we will set `long_state` to // `outer_call` and insert `\par`. let mut p = get_avail ( ) ; match scanner_status { ScannerStatus :: Defining => { t_print ! ( " " ) ; MEM [ p ] . b32 . s0 = RIGHT_BRACE_TOKEN + '}' as i32 } ScannerStatus :: Matching => { t_print ! ( " " ) ; MEM [ p ] . b32 . s0 = par_token ; long_state = Cmd :: OuterCall ; } ScannerStatus :: Aligning => { t_print ! ( " " ) ; MEM [ p ] . b32 . s0 = RIGHT_BRACE_TOKEN + '}' as i32 ; let q = p ; p = get_avail ( ) ; * LLIST_link ( p ) = Some ( q ) . tex_int ( ) ; MEM [ p ] . b32 . s0 = CS_TOKEN_FLAG + FROZEN_CR as i32 ; align_state = - 1_000_000 ; } ScannerStatus :: Absorbing => { t_print ! ( " " ) ; MEM [ p ] . b32 . s0 = RIGHT_BRACE_TOKEN + '}' as i32 } _ => unreachable ! ( ) , // there are no other cases } begin_token_list ( input , Some ( p ) , Btl :: Inserted ) ; t_print ! ( " " Cs ( warning_index ) ) ; help ! ( " \' " " " " \' " " \' \' \' " ) ; error ( ) ; } else { // Tell the user what has run away and try to recover t_eprint ! ( " " CmdChr ( Cmd IfTest cur_if as i32 ) skip_line ) ; let help2 = if * cs != 0 { * cs = 0 ; & " " [ .. ] } else { & " " [ .. ] } ; help ! ( help2 " \\ \' " " \\ \' \' \\ \' " ) ; let tok = CS_TOKEN_FLAG + FROZEN_FI as i32 ; ins_error ( input , tok ) ; } deletions_allowed = true } spacer }
Before getting into |get_next|, let's consider the subroutine that
is called when an `\outer` control sequence has been scanned or
when the end of a file has been reached.
Before getting into |get_next| let ' s consider the subroutine that is called when an ` \ outer ` control sequence has been scanned or when the end of a file has been reached .
input
&mut input_state_t
cs
&mut i32