From 5b1ba96cdf09ef7e3fe62a1c24d28da429bd6c4e Mon Sep 17 00:00:00 2001 From: karl Date: Thu, 25 May 2006 22:20:07 +0000 Subject: fixups from Ross Combs --- charspace/cmi.h | 43 +++++++++++++--------- charspace/main.c | 52 +++++++++++++-------------- doc/Makefile.in | 4 +-- fontconvert/main.c | 104 ++++++++++++++++++++++++++--------------------------- gf/gf_input.c | 58 +++++++++++++++--------------- imageto/main.c | 36 +++++++++---------- lib/now.c | 1 + tfm/tfm_input.c | 22 ++++++------ 8 files changed, 166 insertions(+), 154 deletions(-) diff --git a/charspace/cmi.h b/charspace/cmi.h index fa8378c..34c8613 100644 --- a/charspace/cmi.h +++ b/charspace/cmi.h @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 1.875. */ +/* A Bison parser, made by GNU Bison 2.2. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,13 +17,21 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -40,6 +50,7 @@ T_REAL = 266 }; #endif +/* Tokens. */ #define TR_CHAR 258 #define TR_CHAR_WIDTH 259 #define TR_CODINGSCHEME 260 @@ -53,15 +64,17 @@ -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE #line 37 "cmi.y" -typedef union YYSTYPE { +{ real realval; symval_type symval; string strval; -} YYSTYPE; -/* Line 1248 of yacc.c. */ -#line 64 "cmi.h" +} +/* Line 1528 of yacc.c. */ +#line 77 "cmi.h" + YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -69,5 +82,3 @@ typedef union YYSTYPE { extern YYSTYPE yylval; - - diff --git a/charspace/main.c b/charspace/main.c index 089b329..ec3cd78 100644 --- a/charspace/main.c +++ b/charspace/main.c @@ -76,21 +76,21 @@ static string *scan_string_list (string); value for most of the other side bearings can be determined (independent of the typeface) as a percentage of those ``control letters'' sidebearings. - + The basic strategy is to first read `common.cmi', which specifies the font-independent side bearing apportionments. Then we read font-specific CMI files to actually define the side bearing values, specify kerns, and so on. - + This defines a whole bunch of things in the symbol table (see `symtab.c'). We then resolve the side bearing information for all the characters we will output, after all the definitions have been read. - + Then we output the revised GF and TFM files. We read an existing TFM file and an encoding file, as well as accepting various options, to get lig/kern and other TFM information. */ - + int main (int argc, string argv[]) { @@ -125,7 +125,7 @@ main (int argc, string argv[]) /* Set the numeric counterpart of `dpi', for use in lots of places. */ dpi_real = atof (dpi); - + /* If the user didn't specify CMI files to read, then use `.cmi'. */ if (cmi_names == NULL) @@ -141,11 +141,11 @@ main (int argc, string argv[]) /* Read all the CMI information. */ read_cmi_file ("common.cmi", ""); read_cmi_file_list (cmi_names, dpi); - + /* Figure out the font encoding scheme. Must be done after reading the CMI files, since they can specify the codingscheme. */ encoding_info = read_encoding_info (encoding_name); - + /* The main loop: compute each character's information. */ for (code = starting_char; code <= ending_char; code++) { @@ -158,7 +158,7 @@ main (int argc, string argv[]) close_font (input_name); if (have_tfm) tfm_close_input_file (); - + return 0; } @@ -166,14 +166,14 @@ main (int argc, string argv[]) 1) USER_NAME (if it's non-null); 2) the value of `codingscheme' in the symbol table (if it's a string); 3) the codingscheme from an existing TFM file (if we have one). - + Otherwise, give a fatal error. */ static encoding_info_type read_encoding_info (string user_name) { encoding_info_type ei; - + if (user_name != NULL) ei = read_encoding_file (user_name); else @@ -187,16 +187,16 @@ read_encoding_info (string user_name) else if (SYMVAL_TAG (*sv) == symval_string) codingscheme = SYMVAL_STRING (*sv); - + else FATAL ("codingscheme: defined (in CMI file) as a non-string"); - + assert (codingscheme != NULL); - + enc_name = coding_scheme_to_filename (codingscheme); ei = read_encoding_file (enc_name); } - + return ei; } @@ -256,25 +256,25 @@ read_command_line (int argc, string argv[]) { "version", 0, (int *) &printed_version, 1 }, { "xheight-char", 1, 0, 0 }, { 0, 0, 0, 0 } }; - + while (true) { g = getopt_long_only (argc, argv, "", long_options, &option_index); - + if (g == EOF) break; if (g == '?') continue; /* Unknown option. */ - + assert (g == 0); /* We have no short option names. */ - + if (ARGUMENT_IS ("cmi-files")) cmi_names = scan_string_list (optarg); else if (ARGUMENT_IS ("dpi")) dpi = optarg; - + else if (ARGUMENT_IS ("encoding")) encoding_name = optarg; @@ -293,22 +293,22 @@ read_command_line (int argc, string argv[]) else if (ARGUMENT_IS ("range")) GET_RANGE (optarg, starting_char, ending_char); - + else if (ARGUMENT_IS ("version")) printf ("%s.\n", version_string); - + else if (ARGUMENT_IS ("xheight-char")) xheight_char = xparse_charcode (optarg); - + /* Else it was just a flag; getopt has already done the assignment. */ } - + FINISH_COMMAND_LINE (); } /* Take a string L consisting of unsigned strings separated by commas - and return a vector of the strings, as pointers. + and return a vector of the strings, as pointers. Append an element to the vector. */ static string * @@ -317,14 +317,14 @@ scan_string_list (string l) string map; unsigned length = 1; string *vector = xmalloc (sizeof (string)); - + for (map = strtok (l, ","); map != NULL; map = strtok (NULL, ",")) { length++; vector = xrealloc (vector, length * sizeof (string)); vector[length - 2] = map; } - + vector[length - 1] = NULL; return vector; } diff --git a/doc/Makefile.in b/doc/Makefile.in index 3b09d17..fa1c7f7 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -17,8 +17,8 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # For `install'. -prefix = /usr/local -infodir = $(prefix)/info +prefix = @prefix@ +infodir = @infodir@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ diff --git a/fontconvert/main.c b/fontconvert/main.c index 675fc49..73151f8 100644 --- a/fontconvert/main.c +++ b/fontconvert/main.c @@ -51,7 +51,7 @@ list_type fontname_list; string dpi = "300"; /* The design size which will affect both the GF and TFM output, unless - the tfm-header `designsize' option overrides it. (-designsize) + the tfm-header `designsize' option overrides it. (-designsize) `design_size_ratio' is the ratio of the input design size to the output design size. */ real design_size = 0.0; @@ -62,9 +62,9 @@ static real design_size_ratio; static encoding_info_type *encoding_info = NULL; /* If `omit[n]' is true for an element N, we throw away that character - in that output. (-omit) */ + in that output. (-omit) */ static boolean omit[MAX_CHARCODE + 1]; - + /* An explicitly specified output filename. (-output-file) */ const_string output_name = NULL; @@ -75,7 +75,7 @@ int ending_char = MAX_CHARCODE; /* The variable `translate' maps character codes in the input font to character codes in the output; by default, maps everything to - themselves. (-remap) */ + themselves. (-remap) */ charcode_type translate[MAX_CHARCODE + 1]; /* Says whether to output an EPS file for each character. (-epsf) */ @@ -128,10 +128,10 @@ main (int argc, string argv[]) beginning, which we will fill in with the main font name. */ fontname_list = list_init (); first_element = LIST_TAPPEND (&fontname_list, string); - + /* Read all the arguments. */ font_name = read_command_line (argc, argv); - + /* Put the main font name in the list. */ *first_element = font_name; @@ -153,7 +153,7 @@ main (int argc, string argv[]) epsf_start_output (output_name); if (wants_gf) gf_start_output (font_name, output_name, dpi, - BITMAP_FONT_COMMENT (f)); + BITMAP_FONT_COMMENT (f)); if (wants_tfm) tfm_start_output (font_name, output_name, design_size, BITMAP_FONT_DESIGN_SIZE (f)); @@ -161,9 +161,9 @@ main (int argc, string argv[]) /* Have to do this after `tfm_start_output', as it needs to know if design_size is set or not. */ - if (design_size == 0.0) + if (design_size == 0.0) design_size = BITMAP_FONT_DESIGN_SIZE (f); - + design_size_ratio = BITMAP_FONT_DESIGN_SIZE (f) / design_size; /* Go through each input font. */ @@ -174,9 +174,9 @@ main (int argc, string argv[]) if (wants_tfm) tfm_start_font (font_name); - + REPORT1 ("(%s", BITMAP_FONT_FILENAME (f)); - + /* The main loop: convert each character. */ for (code = starting_char; code <= ending_char; code++) { @@ -204,7 +204,7 @@ main (int argc, string argv[]) close_font (font_name); REPORT (")\n"); } - + if (wants_epsf) epsf_finish_output (); @@ -226,12 +226,12 @@ static void do_char (char_info_type c) { static boolean char_done_p[MAX_CHARCODE + 1]; - + charcode_type original_code = CHARCODE (c); /* Do the character code translation. */ charcode_type code = CHARCODE (c) = translate[original_code]; - + if (char_done_p[code]) { WARNING1 ("Character %d already output", CHARCODE (c)); @@ -259,7 +259,7 @@ do_char (char_info_type c) negative, we must subtract from it to make it ``larger''. */ CHAR_MIN_ROW (c) -= baseline_adjust[code]; CHAR_MAX_ROW (c) -= baseline_adjust[code]; - + /* Text output is already implemented in the library. */ if (wants_text) { @@ -278,7 +278,7 @@ do_char (char_info_type c) if (original_code != code) REPORT1 ("->%u", code); - + /* Free the space here, instead of in the caller, since we may change the bitmap. */ free_bitmap (&CHAR_BITMAP (c)); @@ -313,13 +313,13 @@ do_split_char (char_info_type c, int split[]) /* Take the chunk from the big bitmap. */ CHAR_BITMAP (split_char) = column_extract (CHAR_BITMAP (c), last_col, split_col); - + /* Move the right column over. */ diff = BITMAP_WIDTH (CHAR_BITMAP (c)) - BITMAP_WIDTH (CHAR_BITMAP (split_char)); CHAR_MAX_COL (split_char) -= diff; CHAR_SET_WIDTH (split_char) -= diff; - + /* Output it. */ do_char (split_char); @@ -345,18 +345,18 @@ column_extract (bitmap_type source, unsigned start, unsigned finish) unsigned this_row; dimensions_type d = { BITMAP_HEIGHT (source), finish - start }; bitmap_type answer = new_bitmap (d); - + /* Move to the given starting column. */ BITMAP_BITS (source) += start; - + for (this_row = 0; this_row < BITMAP_HEIGHT (source); this_row++) { one_byte *answer_row = BITMAP_ROW (answer, this_row); - + memcpy (answer_row, BITMAP_BITS (source), BITMAP_WIDTH (answer)); BITMAP_BITS (source) += BITMAP_WIDTH (source); } - + return answer; } @@ -472,24 +472,24 @@ read_command_line (int argc, string argv[]) while (true) { g = getopt_long_only (argc, argv, "", long_options, &option_index); - + if (g == EOF) break; if (g == '?') exit (1); /* Unknown option. */ - + assert (g == 0); /* We have no short option names. */ - + if (ARGUMENT_IS ("baseline-adjust")) scan_baseline_adjust (optarg); - + else if (ARGUMENT_IS ("column-split")) scan_column_split (optarg); - + else if (ARGUMENT_IS ("concat")) append_concat_list (&fontname_list, optarg); - + else if (ARGUMENT_IS ("designsize")) { design_size = atof (optarg); @@ -511,7 +511,7 @@ read_command_line (int argc, string argv[]) else if (ARGUMENT_IS ("filter-size")) filter_size = atou (optarg); - + else if (ARGUMENT_IS ("filter-threshold")) { filter_threshold = atof (optarg); @@ -519,7 +519,7 @@ read_command_line (int argc, string argv[]) FATAL1 ("The filter threshold should be positive, not %f", filter_threshold); } - + else if (ARGUMENT_IS ("fontdimens")) fontdimens = optarg; @@ -529,16 +529,16 @@ read_command_line (int argc, string argv[]) fprintf (stderr, USAGE); exit (0); } - + else if (ARGUMENT_IS ("omit")) scan_omit_list (optarg); - + else if (ARGUMENT_IS ("output-file")) output_name = optarg; - + else if (ARGUMENT_IS ("range")) GET_RANGE (optarg, starting_char, ending_char); - + else if (ARGUMENT_IS ("random")) random_max = atof (optarg); @@ -556,34 +556,34 @@ read_command_line (int argc, string argv[]) else if (ARGUMENT_IS ("version")) printf ("%s.\n", version_string); - + /* Else it was just a flag; getopt has already done the assignment. */ } - + FINISH_COMMAND_LINE (); } /* The string S specifies baseline adjustments for individual characters: `:,...'. We set the element of the global array `baseline_adjust' to the . */ - + static void scan_baseline_adjust (string s) { string spec; - + for (spec = strtok (s, ARG_SEP); spec != NULL; spec = strtok (NULL, ARG_SEP)) { string code; string adjust = strchr (spec, ':'); - + if (adjust == NULL) FATAL1 ("Baseline adjustments look like `:', not `%s'", spec); - + code = substring (spec, 0, adjust - spec - 1); - baseline_adjust[xparse_charspec (code, encoding_info)] + baseline_adjust[xparse_charspec (code, encoding_info)] = atoi (adjust + 1); } } @@ -599,14 +599,14 @@ scan_column_split (string s) { string code; string column_list = strchr (s, '@'); - + if (column_list == NULL) FATAL1 ("Column splits look like `@,,...', not `%s'", s); code = substring (s, 0, column_list - s - 1); - - column_split[xparse_charspec (code, encoding_info)] + + column_split[xparse_charspec (code, encoding_info)] = scan_unsigned_list (column_list + 1); } @@ -618,10 +618,10 @@ static void append_concat_list (list_type *concat_list, string s) { string name; - + /* The main routine must initialize CONCAT_LIST before we are called. */ assert (concat_list != NULL && LIST_SIZE (*concat_list) > 0); - + for (name = strtok (s, ARG_SEP); name != NULL; name = strtok (NULL, ARG_SEP)) { string *new = LIST_TAPPEND (concat_list, string); @@ -638,7 +638,7 @@ static void scan_omit_list (string l) { string map; - + for (map = strtok (l, ARG_SEP); map != NULL; map = strtok (NULL, ARG_SEP)) { charcode_type code = xparse_charspec (map, encoding_info); @@ -652,7 +652,7 @@ scan_omit_list (string l) code in the original font, and is the character code to write it as. No checking for remappings to or from the same character is done here. - + We set elements of the global array `translate' according to what we find. */ @@ -660,17 +660,17 @@ static void scan_remap_list (string l) { string map; /* A single remapping. */ - + for (map = strtok (l, ARG_SEP); map != NULL; map = strtok (NULL, ARG_SEP)) { one_byte original, target; string original_str, target_str; unsigned length = strlen (map); - + /* Ignore empty mappings, as in `a:b,,c:d'. */ if (length == 0) continue; - + else if (length < 3) { WARNING1 ("Mapping `%s' too short to be valid", map); @@ -698,7 +698,7 @@ scan_remap_list (string l) } original_str = substring (map, 0, length - 3); } - + else { /* Must have form `:'. */ target_str = strchr (map, ':'); diff --git a/gf/gf_input.c b/gf/gf_input.c index a5f6ace..caff3be 100644 --- a/gf/gf_input.c +++ b/gf/gf_input.c @@ -108,7 +108,7 @@ void gf_close_input_file () { unsigned code; - + assert (gf_input_file != NULL); xfclose (gf_input_file, gf_input_filename); @@ -116,7 +116,7 @@ gf_close_input_file () gf_input_filename = NULL; gf_input_file = NULL; private_postamble = NULL; - + for (code = 0; code <= MAX_CHARCODE; code++) char_list[code] = NULL; } @@ -213,7 +213,7 @@ get_postamble () scaled by 2^16. */ GF_H_RESOLUTION (*private_postamble) = GF_GET_FOUR (); GF_V_RESOLUTION (*private_postamble) = GF_GET_FOUR (); - + MIN_COL (GF_FONT_BB (*private_postamble)) = GF_GET_SIGNED_FOUR (); MAX_COL (GF_FONT_BB (*private_postamble)) = GF_GET_SIGNED_FOUR (); MIN_ROW (GF_FONT_BB (*private_postamble)) = GF_GET_SIGNED_FOUR (); @@ -348,10 +348,10 @@ get_full_boc (gf_char_type *gf_char) charcode); GF_CHARCODE (*gf_char) = charcode; - + back_pointer = GF_GET_SIGNED_FOUR (); if (back_pointer != -1) - WARNING2 ("Character %u has a non-null back pointer (to %d)", + WARNING2 ("Character %u has a non-null back pointer (to %d)", GF_CHARCODE (*gf_char), back_pointer); GF_CHAR_MIN_COL (*gf_char) = GF_GET_SIGNED_FOUR (); @@ -473,7 +473,7 @@ deblank (gf_char_type *gf_char) || white_on_top > 0 || white_on_bottom > 0) { bitmap_type condensed; - + if (white_on_left + white_on_right > width) { /* The character was entirely blank. */ BITMAP_WIDTH (condensed) = BITMAP_HEIGHT (condensed) = 0; @@ -510,7 +510,7 @@ deblank (gf_char_type *gf_char) /* The ``bitmap'' is a sequence of commands that describe it in terms of run-length encoding. - GF's row and column numbers are the lower left corner of a pixel. + GF's row and column numbers are the lower left corner of a pixel. GF (0,0) is the Cartesian unit square: 0 <= x (col) <= 1, 0 <= y (row) <= 1. Yes, it's <=, not <. What does this mean for the maxes and mins? Let's take the height first: if a character has @@ -521,8 +521,8 @@ deblank (gf_char_type *gf_char) if a character has min_row = 0 and max_row = 4, the current x starts at zero, we paint four pixels (let's say), and now the current x is four (the max possible), so we cannot paint any more. Thus there are - four (4 - 0) columns in which we might paint pixels. - + four (4 - 0) columns in which we might paint pixels. + Weird, huh? */ static void @@ -553,7 +553,7 @@ get_character_bitmap (gf_char_type *gf_char) = BITMAP_WIDTH (GF_BITMAP (*gf_char)) = 0; BITMAP_BITS (GF_BITMAP (*gf_char)) = NULL; - + /* The next non-NO_OP byte should be EOC. */ while ((b = GF_GET_BYTE ()) == NO_OP) /* do nothing */ ; @@ -562,7 +562,7 @@ get_character_bitmap (gf_char_type *gf_char) return; } - + DIMENSIONS_HEIGHT (matrix_dimensions) = height; DIMENSIONS_WIDTH (matrix_dimensions) = width; GF_BITMAP (*gf_char) = new_bitmap (matrix_dimensions); @@ -749,25 +749,25 @@ gf_get_raw_char (one_byte charcode) (void) gf_get_postamble (); assert (private_postamble != NULL); - + char_locator = GF_CHAR_LOC (*private_postamble, charcode); char_pointer = char_locator.char_pointer; /* If the character doesn't exist in the font, we're done. */ if (char_pointer == NULL_BYTE_PTR) return NULL; - + /* Save where we are in the file; we'll restore it when we're done. */ old_pos = GF_FTELL (); GF_FSEEK (char_pointer, SEEK_SET); - + raw_char = xmalloc (sizeof (raw_char_type)); *raw_char = new_raw_gf_char (char_locator); /* Unfortunately, the GF format doesn't tell us how many bytes long the character description is. So, we must decode it enough to figure out how much to read. */ - + /* The first step is the boc: it might be either the one-byte or four-byte variant. */ b = GF_GET_BYTE (); @@ -778,7 +778,7 @@ gf_get_raw_char (one_byte charcode) APPEND_BYTES (24); else /* b == BOC1 */ APPEND_BYTES (5); - + /* Read the character definition; exit when we get to EOC. */ while ((b = GF_GET_BYTE ()) != EOC) { @@ -789,51 +789,51 @@ gf_get_raw_char (one_byte charcode) || b == SKIP0 || (NEW_ROW_0 <= b && b <= NEW_ROW_164)) APPEND_BYTES (0); - + /* Now the ones with a one-byte parameter. */ else if (b == PAINT1 || b == SKIP1) APPEND_BYTES (1); - + /* A two-byte parameter. */ else if (b == PAINT2 || b == SKIP2) APPEND_BYTES (2); - + /* Three-byte. */ else if (b == PAINT3 || b == SKIP3) APPEND_BYTES (3); - + /* Four. */ else if (b == YYY) APPEND_BYTES (4); - + /* Commands with a variable-size parameter. */ else if (b == XXX1) { one_byte size = GF_GET_BYTE (); APPEND_VAR_BYTES (size); } - + else if (b == XXX2) { two_bytes size = GF_GET_TWO (); APPEND_VAR_BYTES (size); } - + else if (b == XXX3) { four_bytes size = gf_get_three (); APPEND_VAR_BYTES (size); } - + else if (b == XXX4) { four_bytes size = GF_GET_FOUR (); APPEND_VAR_BYTES (size); } - + else if (b == NO_OP) /* do nothing */; - + else FATAL1 ("gf_get_raw_char: Bad command byte %u", b); } @@ -889,16 +889,16 @@ static raw_char_type new_raw_gf_char (gf_char_locator_type locator) { raw_char_type c; - + RAW_CHAR_ALLOCATED (c) = 1; RAW_CHAR_BYTES (c) = xmalloc (RAW_CHAR_ALLOCATED (c)); RAW_CHAR_USED (c) = 0; - + GF_CHARCODE (c) = locator.charcode; GF_H_ESCAPEMENT (c) = locator.h_escapement; GF_TFM_WIDTH (c) = locator.tfm_width; GF_CHAR_BB (c) = GF_FONT_BB (*private_postamble); - + /* Since we don't want to interpret the bounding box information in the character, we just make our bounding box be the font bounding box. Since the only thing a raw character is good for is being diff --git a/imageto/main.c b/imageto/main.c index 07d9b37..f1228d3 100644 --- a/imageto/main.c +++ b/imageto/main.c @@ -81,12 +81,12 @@ static void set_pbm_input_format (void); 1) (normal) analyze the image and write out the ``true'' characters, 2) (-strips) takes a constant number of scanlines as each character, 3) (-epsf) write out the image as an Encapsulated PostScript file. - + The output name is, correspondingly, constructed differently: 1) if `output_name' was supplied, and has a suffix, that's it. 2) if `output_name' was supplied, but has no suffix, append `.eps' if we're doing EPSF, else append `.gf', where - is + is a) `sp', if we are doing strips; b) the design size, if not. 3) if `output_name' was not supplied, use the basename of the input @@ -102,11 +102,11 @@ main (int argc, string argv[]) input_name = read_command_line (argc, argv); writing_gf = !output_epsf; - - set_input_format (input_name); + + set_input_format (input_name); /* If the input format is PBM, then they must also tell us the dpi. */ - if (image_open_input_file == pbm_open_input_file + if (image_open_input_file == pbm_open_input_file && image_header.hres == 0) { fprintf (stderr, "If you use PBM format, you must supply the dpi.\n"); @@ -116,7 +116,7 @@ main (int argc, string argv[]) /* Open the main input file. */ (*image_open_input_file) (extend_filename (input_name, input_extension)); - + /* We need the horizontal resolution before we can make the GF name, so, at least for IMG input, have to read the header. */ (*image_get_header) (); @@ -179,7 +179,7 @@ main (int argc, string argv[]) } (*image_close_input_file) (); - + return 0; } @@ -193,12 +193,12 @@ print_scanline (one_byte line[], unsigned width) if (trace_scanlines) { printf ("%7d:", scanline_count++); - + /* If the line is entirely white, don't print anything. */ if (memchr (line, BLACK, width)) { unsigned c; - + for (c = 0; c < width; c++) { /* Compress eight consecutive spaces to a tab, if we're at the beginning of a tab mark. This handles the usual @@ -289,21 +289,21 @@ read_command_line (int argc, string argv[]) while (true) { g = getopt_long_only (argc, argv, "", long_options, &option_index); - + if (g == EOF) break; if (g == '?') exit (1); /* Unknown option. */ - + assert (g == 0); /* We have no short option names. */ - + if (ARGUMENT_IS ("baselines")) baseline_list = scan_unsigned_list (optarg); - + else if (ARGUMENT_IS ("designsize")) design_size = atof (optarg); - + else if (ARGUMENT_IS ("dpi")) { image_header.hres = (two_bytes) atou (optarg); @@ -346,13 +346,13 @@ read_command_line (int argc, string argv[]) else if (ARGUMENT_IS ("range")) GET_RANGE (optarg, starting_char, ending_char); - + else if (ARGUMENT_IS ("version")) printf ("%s.\n", version_string); /* Else it was a flag; getopt has already done the assignment. */ } - + if (do_strips && output_epsf) FATAL ("imageto: Sorry, -strips and -epsf are mutually exclusive"); @@ -367,7 +367,7 @@ static void set_input_format (string filename) { string input_extension; - + /* If it's already set, just return. */ if (image_open_input_file != NULL) return; @@ -380,7 +380,7 @@ set_input_format (string filename) else if (STREQ (input_extension, "pbm")) set_pbm_input_format (); - + else /* Can't guess it; quit. */ { fprintf (stderr, "You must supply an input format.\n"); diff --git a/lib/now.c b/lib/now.c index aabf718..88c165f 100644 --- a/lib/now.c +++ b/lib/now.c @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" +#include "c-time.h" /* Get the current date and time as a string. The 26 here is defined in diff --git a/tfm/tfm_input.c b/tfm/tfm_input.c index 8b56e4a..461539b 100644 --- a/tfm/tfm_input.c +++ b/tfm/tfm_input.c @@ -112,7 +112,7 @@ tfm_input_filename () { if (tfm_input_file == NULL) return NULL; - + return tfm_input_name; } @@ -124,10 +124,10 @@ tfm_global_info_type tfm_get_global_info () { assert (tfm_input_file != NULL); - + /* Only read the file once. */ - if (global_info != NULL) return *global_info; - + if (global_info != NULL) return *global_info; + global_info = XTALLOC1 (tfm_global_info_type); get_tfm_header (); get_tfm_params (); @@ -236,9 +236,9 @@ get_tfm_header () if (tracing_tfm_input) printf ("TFM checksum = %u, design_size = %fpt, coding scheme = `%s'.\n", - TFM_CHECKSUM (*global_info), - TFM_DESIGN_SIZE (*global_info), - TFM_CODING_SCHEME (*global_info)); + TFM_CHECKSUM (*global_info), + TFM_DESIGN_SIZE (*global_info), + TFM_CODING_SCHEME (*global_info)); } @@ -330,7 +330,7 @@ tfm_get_char (charcode_type code) if (code < global_info->first_charcode || code > global_info->last_charcode) return NULL; - + /* Move to the appropriate place in the `char_info' array. */ TFM_FSEEK (tfm_header.char_info_pos + (code - global_info->first_charcode) * 4, @@ -338,7 +338,7 @@ tfm_get_char (charcode_type code) /* Read the character. */ tfm_char_table[code] = get_char (); - + /* If it exists, return a pointer to it. We return a copy, so our information can't get corrupted. */ if (!TFM_CHAR_EXISTS (tfm_char_table[code])) @@ -346,7 +346,7 @@ tfm_get_char (charcode_type code) else { tfm_char_type *c = XTALLOC1 (tfm_char_type); - + TFM_CHARCODE (tfm_char_table[code]) = code; *c = tfm_char_table[code]; return c; @@ -405,7 +405,7 @@ get_char () { printf (" width = %f, height = %f, ", tfm_char.width, tfm_char.height); printf ("depth = %f, ic = %f.\n", tfm_char.depth, - tfm_char.italic_correction); + tfm_char.italic_correction); } if (tag == 1) -- cgit v1.2.1