1.1 diff -r 2cec996b38bc -r 3aac131058da parser.y 1.2 --- a/parser.y Tue Jan 01 06:17:39 2002 +0000 1.3 +++ b/parser.y Tue Jan 01 10:16:50 2002 +0000 1.4 @@ -59,9 +59,11 @@ 1.5 1.6 %type <fp> unit 1.7 1.8 - 1.9 +%type <fp> length 1.10 1.11 -%type <fp> length 1.12 +%type <integer> orientation 1.13 + 1.14 +%type <size> page_size 1.15 1.16 %% 1.17 1.18 @@ -96,9 +98,9 @@ 1.19 ROTATE INTEGER ';' { input_set_rotation ($2) } ; 1.20 1.21 unit: 1.22 - /* empty */ /* default to INCH */ { $$ = 25.4; } 1.23 - | CM { $$ = 1.0; } 1.24 - | INCH { $$ = 25.4; } ; 1.25 + /* empty */ /* default to INCH */ { $$ = 1.0; } 1.26 + | CM { $$ = (1.0 / 25.4); } 1.27 + | INCH { $$ = 1.0; } ; 1.28 1.29 length: 1.30 FLOAT unit { $$ = $1 * $2; } ; 1.31 @@ -110,13 +112,23 @@ 1.32 | CROP length ',' length ',' length ',' length ';' ; 1.33 1.34 orientation: 1.35 - PORTRAIT 1.36 - | LANDSCAPE ; 1.37 + PORTRAIT { $$ = 0; } 1.38 + | LANDSCAPE { $$ = 1; } ; 1.39 + 1.40 +page_size: 1.41 + PAGE_SIZE { $$ = $1; } 1.42 + | PAGE_SIZE orientation { if ($2) 1.43 + { 1.44 + $$.width = $1.height; 1.45 + $$.height = $1.width; 1.46 + } 1.47 + else 1.48 + $$ = $1; 1.49 + } 1.50 + | length ',' length { $$.width = $1; $$.height = $3; } ; 1.51 1.52 size_clause: 1.53 - SIZE PAGE_SIZE ';' 1.54 - | SIZE PAGE_SIZE orientation ';' 1.55 - | SIZE length ',' length ';' ; 1.56 + SIZE page_size ';' { input_set_page_size ($2); } ; 1.57 1.58 resolution_clause: 1.59 RESOLUTION FLOAT unit ;