Fri, 14 Mar 2003 08:24:37 +0000
finished implementing page labels.
eric@104 | 1 | /* |
eric@125 | 2 | * tumble: build a PDF file from image files |
eric@104 | 3 | * |
eric@104 | 4 | * Semantic routines for spec file parser |
eric@131 | 5 | * $Id: semantics.h,v 1.14 2003/03/14 00:24:37 eric Exp $ |
eric@104 | 6 | * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> |
eric@104 | 7 | * |
eric@104 | 8 | * This program is free software; you can redistribute it and/or modify |
eric@104 | 9 | * it under the terms of the GNU General Public License version 2 as |
eric@104 | 10 | * published by the Free Software Foundation. Note that permission is |
eric@104 | 11 | * not granted to redistribute this program under the terms of any |
eric@104 | 12 | * other version of the General Public License. |
eric@104 | 13 | * |
eric@104 | 14 | * This program is distributed in the hope that it will be useful, |
eric@104 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
eric@104 | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
eric@104 | 17 | * GNU General Public License for more details. |
eric@104 | 18 | * |
eric@104 | 19 | * You should have received a copy of the GNU General Public License |
eric@104 | 20 | * along with this program; if not, write to the Free Software |
eric@104 | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA |
eric@104 | 22 | */ |
eric@104 | 23 | |
eric@104 | 24 | |
eric@18 | 25 | typedef struct |
eric@18 | 26 | { |
eric@18 | 27 | double width; |
eric@18 | 28 | double height; |
eric@18 | 29 | } page_size_t; |
eric@18 | 30 | |
eric@18 | 31 | typedef struct |
eric@18 | 32 | { |
eric@18 | 33 | int first; |
eric@18 | 34 | int last; |
eric@18 | 35 | } range_t; |
eric@18 | 36 | |
eric@18 | 37 | typedef struct |
eric@18 | 38 | { |
eric@18 | 39 | double left; |
eric@18 | 40 | double right; |
eric@18 | 41 | double top; |
eric@18 | 42 | double bottom; |
eric@18 | 43 | } crop_t; |
eric@18 | 44 | |
eric@25 | 45 | typedef struct |
eric@25 | 46 | { |
eric@25 | 47 | char *prefix; |
eric@25 | 48 | char style; |
eric@131 | 49 | /* the following fields are not filled by the parser: */ |
eric@131 | 50 | int page_index; |
eric@131 | 51 | int base; |
eric@131 | 52 | int count; |
eric@25 | 53 | } page_label_t; |
eric@25 | 54 | |
eric@18 | 55 | |
eric@18 | 56 | typedef enum |
eric@18 | 57 | { |
eric@18 | 58 | INPUT_MODIFIER_ALL, |
eric@18 | 59 | INPUT_MODIFIER_ODD, |
eric@18 | 60 | INPUT_MODIFIER_EVEN, |
eric@18 | 61 | INPUT_MODIFIER_TYPE_COUNT /* must be last */ |
eric@18 | 62 | } input_modifier_type_t; |
eric@18 | 63 | |
eric@18 | 64 | |
eric@24 | 65 | typedef struct bookmark_t |
eric@24 | 66 | { |
eric@24 | 67 | struct bookmark_t *next; |
eric@24 | 68 | int level; /* 1 is outermost */ |
eric@24 | 69 | char *name; |
eric@24 | 70 | } bookmark_t; |
eric@24 | 71 | |
eric@24 | 72 | |
eric@20 | 73 | extern int line; /* line number in spec file */ |
eric@24 | 74 | extern int bookmark_level; |
eric@16 | 75 | |
eric@16 | 76 | |
eric@16 | 77 | /* semantic routines for input statements */ |
eric@19 | 78 | void input_push_context (void); |
eric@16 | 79 | void input_pop_context (void); |
eric@19 | 80 | void input_set_modifier_context (input_modifier_type_t type); |
eric@16 | 81 | void input_set_file (char *name); |
eric@19 | 82 | void input_set_rotation (int rotation); |
eric@32 | 83 | void input_set_page_size (page_size_t size); |
eric@20 | 84 | void input_images (range_t range); |
eric@16 | 85 | |
eric@16 | 86 | /* semantic routines for output statements */ |
eric@24 | 87 | void output_push_context (void); |
eric@24 | 88 | void output_pop_context (void); |
eric@30 | 89 | |
eric@16 | 90 | void output_set_file (char *name); |
eric@30 | 91 | void output_set_author (char *author); |
eric@30 | 92 | void output_set_creator (char *creator); |
eric@30 | 93 | void output_set_title (char *title); |
eric@30 | 94 | void output_set_subject (char *subject); |
eric@30 | 95 | void output_set_keywords (char *keywords); |
eric@30 | 96 | |
eric@20 | 97 | void output_set_bookmark (char *name); |
eric@25 | 98 | void output_set_page_label (page_label_t label); |
eric@20 | 99 | void output_pages (range_t range); |
eric@26 | 100 | |
eric@26 | 101 | |
eric@26 | 102 | /* functions to be called from main program: */ |
eric@48 | 103 | bool parse_spec_file (char *fn); |
eric@48 | 104 | bool process_specs (void); |