semantics.h

Fri, 14 Mar 2003 08:24:37 +0000

author
eric
date
Fri, 14 Mar 2003 08:24:37 +0000
changeset 131
4b8c80d77f76
parent 125
e2ef1c2f9eca
child 134
313aba417199
permissions
-rw-r--r--

finished implementing page labels.

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