fn spc_read_dimtrns_pdfm(spe: &mut SpcEnv, ap: &mut SpcArg) -> Result<transform_info, ()> {
    let mut p = transform_info::new();
    let mut error: i32 = 0;
    let mut has_matrix = false;
    let mut has_rotate = has_matrix;
    let mut has_scale = has_rotate; /* default: do clipping */
    let mut has_yscale = has_scale;
    let mut has_xscale = has_yscale;
    let mut yscale = 1.0f64;
    let mut xscale = yscale;
    let mut rotate = 0.0f64;
    p.flags |= 1 << 3;
    p.flags &= !(1 << 4);
    ap.cur.skip_blank();
    while error == 0 && !ap.cur.is_empty() {
        if let Some(kp) = ap.cur.parse_c_ident() {
            ap.cur.skip_blank();
            match kp.as_str() {
                "width" => {
                    if let Ok(width) = ap.cur.read_length(&*spe) {
                        p.width = width;
                    } else {
                        error = -1;
                    }
                    p.flags |= 1 << 1;
                }
                "height" => {
                    if let Ok(height) = ap.cur.read_length(&*spe) {
                        p.height = height;
                    } else {
                        error = -1;
                    }
                    p.flags |= 1 << 2;
                }
                "depth" => {
                    if let Ok(depth) = ap.cur.read_length(&*spe) {
                        p.depth = depth;
                    } else {
                        error = -1;
                    }
                    p.flags |= 1 << 2;
                }
                "scale" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        yscale = vp;
                        xscale = yscale;
                        has_scale = true;
                    } else {
                        error = -1;
                    }
                }
                "xscale" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        xscale = vp;
                        has_xscale = true;
                    } else {
                        error = -1;
                    }
                }
                "yscale" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        yscale = vp;
                        has_yscale = true;
                    } else {
                        error = -1;
                    }
                }
                "rotate" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        rotate = PI * vp / 180.0f64;
                        has_rotate = true;
                    } else {
                        error = -1;
                    }
                }
                "bbox" => {
                    let v: ArrayVec<[_; 4]> = read_numbers(ap);
                    if v.len() != 4 {
                        error = -1;
                    } else {
                        p.bbox = Rect::new(point2(v[0], v[1]), point2(v[2], v[3]));
                        p.flags |= 1 << 0;
                    }
                }
                "matrix" => {
                    let v_0: ArrayVec<[_; 6]> = read_numbers(ap);
                    if v_0.len() != 6 {
                        error = -1;
                    } else {
                        let v_0 = v_0.as_slice().try_into().unwrap();
                        p.matrix = TMatrix::from_row_major_array(v_0);
                        has_matrix = true;
                    }
                }
                "clip" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        if vp != 0. {
                            p.flags |= 1 << 3;
                        } else {
                            p.flags &= !(1 << 3)
                        }
                    } else {
                        error = -1;
                    }
                }
                "hide" => p.flags |= 1 << 4,
                _ => error = -1,
            }
            if error != 0 {
                spc_warn!(
                    spe,
                    "Unrecognized key or invalid value for dimension/transformation: {}",
                    kp,
                );
            } else {
                ap.cur.skip_blank();
            }
        } else {
            break;
        }
    }
    if error == 0 {
        /* Check consistency */
        if has_xscale && p.flags & 1 << 1 != 0 {
            spc_warn!(spe, "Can\'t supply both width and xscale. Ignore xscale.");
            xscale = 1.0f64
        } else if has_yscale && p.flags & 1 << 2 != 0 {
            spc_warn!(
                spe,
                "Can\'t supply both height/depth and yscale. Ignore yscale."
            );
            yscale = 1.0f64
        } else if has_scale && (has_xscale || has_yscale) {
            spc_warn!(spe, "Can\'t supply overall scale along with axis scales.");
            error = -1
        } else if has_matrix && (has_scale || has_xscale || has_yscale || has_rotate) {
            spc_warn!(spe, "Can\'t supply transform matrix along with scales or rotate. Ignore scales and rotate.");
        }
    }
    if !has_matrix {
        make_transmatrix(&mut p.matrix, 0.0, 0.0, xscale, yscale, rotate);
    }
    if p.flags & 1 << 0 == 0 {
        p.flags &= !(1 << 3)
        /* no clipping needed */
    }
    if error == 0 {
        Ok(p)
    } else {
        Err(())
    }
}
/* "page" and "pagebox" are not dimension nor transformation nor
 * something acceptable to put into here.
 * PLEASE DONT ADD HERE!
 */
"page" and "pagebox" are not dimension nor transformation nor
something acceptable to put into here.
PLEASE DONT ADD HERE!
" page " and " pagebox " are not dimension nor transformation nor something acceptable to put into here . PLEASE DONT ADD HERE!
fn spc_read_dimtrns_pdfm(spe: &mut SpcEnv, ap: &mut SpcArg) -> Result<transform_info, ()> {
    let mut p = transform_info::new();
    let mut error: i32 = 0;
    let mut has_matrix = false;
    let mut has_rotate = has_matrix;
    let mut has_scale = has_rotate; /* default: do clipping */
    let mut has_yscale = has_scale;
    let mut has_xscale = has_yscale;
    let mut yscale = 1.0f64;
    let mut xscale = yscale;
    let mut rotate = 0.0f64;
    p.flags |= 1 << 3;
    p.flags &= !(1 << 4);
    ap.cur.skip_blank();
    while error == 0 && !ap.cur.is_empty() {
        if let Some(kp) = ap.cur.parse_c_ident() {
            ap.cur.skip_blank();
            match kp.as_str() {
                "width" => {
                    if let Ok(width) = ap.cur.read_length(&*spe) {
                        p.width = width;
                    } else {
                        error = -1;
                    }
                    p.flags |= 1 << 1;
                }
                "height" => {
                    if let Ok(height) = ap.cur.read_length(&*spe) {
                        p.height = height;
                    } else {
                        error = -1;
                    }
                    p.flags |= 1 << 2;
                }
                "depth" => {
                    if let Ok(depth) = ap.cur.read_length(&*spe) {
                        p.depth = depth;
                    } else {
                        error = -1;
                    }
                    p.flags |= 1 << 2;
                }
                "scale" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        yscale = vp;
                        xscale = yscale;
                        has_scale = true;
                    } else {
                        error = -1;
                    }
                }
                "xscale" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        xscale = vp;
                        has_xscale = true;
                    } else {
                        error = -1;
                    }
                }
                "yscale" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        yscale = vp;
                        has_yscale = true;
                    } else {
                        error = -1;
                    }
                }
                "rotate" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        rotate = PI * vp / 180.0f64;
                        has_rotate = true;
                    } else {
                        error = -1;
                    }
                }
                "bbox" => {
                    let v: ArrayVec<[_; 4]> = read_numbers(ap);
                    if v.len() != 4 {
                        error = -1;
                    } else {
                        p.bbox = Rect::new(point2(v[0], v[1]), point2(v[2], v[3]));
                        p.flags |= 1 << 0;
                    }
                }
                "matrix" => {
                    let v_0: ArrayVec<[_; 6]> = read_numbers(ap);
                    if v_0.len() != 6 {
                        error = -1;
                    } else {
                        let v_0 = v_0.as_slice().try_into().unwrap();
                        p.matrix = TMatrix::from_row_major_array(v_0);
                        has_matrix = true;
                    }
                }
                "clip" => {
                    if let Some(vp) = ap.cur.parse_float_decimal_to_f64() {
                        if vp != 0. {
                            p.flags |= 1 << 3;
                        } else {
                            p.flags &= !(1 << 3)
                        }
                    } else {
                        error = -1;
                    }
                }
                "hide" => p.flags |= 1 << 4,
                _ => error = -1,
            }
            if error != 0 {
                spc_warn!(
                    spe,
                    "Unrecognized key or invalid value for dimension/transformation: {}",
                    kp,
                );
            } else {
                ap.cur.skip_blank();
            }
        } else {
            break;
        }
    }
    if error == 0 {
        /* Check consistency */
        if has_xscale && p.flags & 1 << 1 != 0 {
            spc_warn!(spe, "Can\'t supply both width and xscale. Ignore xscale.");
            xscale = 1.0f64
        } else if has_yscale && p.flags & 1 << 2 != 0 {
            spc_warn!(
                spe,
                "Can\'t supply both height/depth and yscale. Ignore yscale."
            );
            yscale = 1.0f64
        } else if has_scale && (has_xscale || has_yscale) {
            spc_warn!(spe, "Can\'t supply overall scale along with axis scales.");
            error = -1
        } else if has_matrix && (has_scale || has_xscale || has_yscale || has_rotate) {
            spc_warn!(spe, "Can\'t supply transform matrix along with scales or rotate. Ignore scales and rotate.");
        }
    }
    if !has_matrix {
        make_transmatrix(&mut p.matrix, 0.0, 0.0, xscale, yscale, rotate);
    }
    if p.flags & 1 << 0 == 0 {
        p.flags &= !(1 << 3)
        /* no clipping needed */
    }
    if error == 0 {
        Ok(p)
    } else {
        Err(())
    }
}
fn spc_read_dimtrns_pdfm ( spe : & mut SpcEnv , ap : & mut SpcArg ) -> Result < transform_info , ( ) > { let mut p = transform_info :: new ( ) ; let mut error : i32 = 0 ; let mut has_matrix = false ; let mut has_rotate = has_matrix ; let mut has_scale = has_rotate ; /* default: do clipping */ let mut has_yscale = has_scale ; let mut has_xscale = has_yscale ; let mut yscale = 1.0f64 ; let mut xscale = yscale ; let mut rotate = 0.0f64 ; p . flags |= 1 << 3 ; p . flags &= ! ( 1 << 4 ) ; ap . cur . skip_blank ( ) ; while error == 0 && ! ap . cur . is_empty ( ) { if let Some ( kp ) = ap . cur . parse_c_ident ( ) { ap . cur . skip_blank ( ) ; match kp . as_str ( ) { " " => { if let Ok ( width ) = ap . cur . read_length ( & * spe ) { p . width = width ; } else { error = - 1 ; } p . flags |= 1 << 1 ; } " " => { if let Ok ( height ) = ap . cur . read_length ( & * spe ) { p . height = height ; } else { error = - 1 ; } p . flags |= 1 << 2 ; } " " => { if let Ok ( depth ) = ap . cur . read_length ( & * spe ) { p . depth = depth ; } else { error = - 1 ; } p . flags |= 1 << 2 ; } " " => { if let Some ( vp ) = ap . cur . parse_float_decimal_to_f64 ( ) { yscale = vp ; xscale = yscale ; has_scale = true ; } else { error = - 1 ; } } " " => { if let Some ( vp ) = ap . cur . parse_float_decimal_to_f64 ( ) { xscale = vp ; has_xscale = true ; } else { error = - 1 ; } } " " => { if let Some ( vp ) = ap . cur . parse_float_decimal_to_f64 ( ) { yscale = vp ; has_yscale = true ; } else { error = - 1 ; } } " " => { if let Some ( vp ) = ap . cur . parse_float_decimal_to_f64 ( ) { rotate = PI * vp / 180.0f64 ; has_rotate = true ; } else { error = - 1 ; } } " " => { let v : ArrayVec < [ _ ; 4 ] > = read_numbers ( ap ) ; if v . len ( ) != 4 { error = - 1 ; } else { p . bbox = Rect :: new ( point2 ( v [ 0 ] , v [ 1 ] ) , point2 ( v [ 2 ] , v [ 3 ] ) ) ; p . flags |= 1 << 0 ; } } " " => { let v_0 : ArrayVec < [ _ ; 6 ] > = read_numbers ( ap ) ; if v_0 . len ( ) != 6 { error = - 1 ; } else { let v_0 = v_0 . as_slice ( ) . try_into ( ) . unwrap ( ) ; p . matrix = TMatrix :: from_row_major_array ( v_0 ) ; has_matrix = true ; } } " " => { if let Some ( vp ) = ap . cur . parse_float_decimal_to_f64 ( ) { if vp != 0. { p . flags |= 1 << 3 ; } else { p . flags &= ! ( 1 << 3 ) } } else { error = - 1 ; } } " " => p . flags |= 1 << 4 , _ => error = - 1 , } if error != 0 { spc_warn ! ( spe " " kp ) ; } else { ap . cur . skip_blank ( ) ; } } else { break ; } } if error == 0 { /* Check consistency */ if has_xscale && p . flags & 1 << 1 != 0 { spc_warn ! ( spe " \' " ) ; xscale = 1.0f64 } else if has_yscale && p . flags & 1 << 2 != 0 { spc_warn ! ( spe " \' " ) ; yscale = 1.0f64 } else if has_scale && ( has_xscale || has_yscale ) { spc_warn ! ( spe " \' " ) ; error = - 1 } else if has_matrix && ( has_scale || has_xscale || has_yscale || has_rotate ) { spc_warn ! ( spe " \' " ) ; } } if ! has_matrix { make_transmatrix ( & mut p . matrix , 0.0 , 0.0 , xscale , yscale , rotate ) ; } if p . flags & 1 << 0 == 0 { p . flags &= ! ( 1 << 3 ) /* no clipping needed */ } if error == 0 { Ok ( p ) } else { Err ( ( ) ) } }
"page" and "pagebox" are not dimension nor transformation nor
 something acceptable to put into here.
" page " and " pagebox " are not dimension nor transformation nor something acceptable to put into here .
spe
&mut SpcEnv
ap
&mut SpcArg