prescript 0.1.1

A library for parsing and executing Prescript scripts.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::*;

#[test]
fn pdf_func() {
    // two-in, one-out
    let script = b"{ add }";
    let func = PdfFunc::new(script.as_slice(), 1);
    let r = func.exec(&[1.0, 2.0]).unwrap();
    assert_eq!(r, vec![3.0]);

    // two-in, two-out
    let script = b"{ sub 2 }";
    let func = PdfFunc::new(script.as_slice(), 2);
    let r = func.exec(&[1.0, 2.0]).unwrap();
    assert_eq!(r, vec![-1.0, 2.0]);
}