From 87282580c22441255901899bc0db0a62e8f7b0f8 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Wed, 29 May 2024 10:06:46 +0800 Subject: [PATCH] add popexp function --- utshell-0.5/r_expr/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/utshell-0.5/r_expr/src/lib.rs b/utshell-0.5/r_expr/src/lib.rs index 68462352..a640b557 100644 --- a/utshell-0.5/r_expr/src/lib.rs +++ b/utshell-0.5/r_expr/src/lib.rs @@ -1205,4 +1205,34 @@ unsafe extern "C" fn pushexp() { expr_depth = expr_depth + 1; let ref mut fresh5 = *expr_stack.offset(fresh4 as isize); *fresh5 = context; +} + +#[no_mangle] +unsafe extern "C" fn popexp() { + let mut context: *mut EXPR_CONTEXT = 0 as *mut EXPR_CONTEXT; + if expr_depth <= 0 as libc::c_int { + lasttp = 0 as *mut libc::c_char; + expression = lasttp; + evalerror(dcgettext( + 0 as *const libc::c_char, + b"recursion stack underflow\0" as *const u8 as *const libc::c_char, + 5 as libc::c_int, + )); + } + expr_depth -= 1; + context = *expr_stack.offset(expr_depth as isize); + expression = (*context).expression; + curtok = (*context).curtok; + lasttok = (*context).lasttok; + tp = (*context).tp; + lasttp = (*context).lasttp; + tokval = (*context).tokval; + tokstr = (*context).tokstr; + noeval = (*context).noeval; + curlval = (*context).lval; + sh_xfree( + context as *mut libc::c_void, + b"../expr.c\0" as *const u8 as *const libc::c_char, + 299 as libc::c_int, + ); } \ No newline at end of file -- Gitee