diff options
Diffstat (limited to 'pk/pk_input.c')
-rw-r--r-- | pk/pk_input.c | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/pk/pk_input.c b/pk/pk_input.c index ab7e083..336834d 100644 --- a/pk/pk_input.c +++ b/pk/pk_input.c @@ -1,25 +1,27 @@ -/* pk_input.c: read from any number of PK files. The basic idea is to - read the entire file into memory the first time the client asks for a - character. Since PK files tend to be quite small, this does not use - an enormous amount of memory. But we only bother to unpack a - character's bitmap when the client asks for that particular - character. - -Copyright (C) 1992, 2011 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 -the Free Software Foundation; either version 3, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -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., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# pk_input.c: read from any number of PK files. +# +# Copyright (C) 1992, 2011 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 +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# The basic idea is to +# read the entire file into memory the first time the client asks for a +# character. Since PK files tend to be quite small, this does not use +# an enormous amount of memory. But we only bother to unpack a +# character's bitmap when the client asks for that particular +# character. #include "config.h" @@ -101,7 +103,7 @@ typedef struct PACKED_DATA_LENGTH (*INTERNAL_PACKED_CHAR (f, c)) #define INTERNAL_PACKED_DATA(f, c) \ PACKED_DATA (*INTERNAL_PACKED_CHAR (f, c)) - + /* File I/O. */ static FILE *pk_input_file; /* The file we're currently reading. */ static string current_filename; /* Its pathname. */ @@ -143,7 +145,7 @@ static signed_4_bytes data_get_signed_n_byte_value (one_byte); static internal_font_type *find_internal_font (string); static void save_internal_font (string, FILE *); static void delete_internal_font (string); - + /* Prepare for reading FILENAME. Return false if it can't be opened. We allow the same file to be opened twice; I'm not sure if that's a good idea or not, but it doesn't seem to matter much. */ @@ -169,7 +171,7 @@ pk_close_input_file (string filename) { delete_internal_font (filename); } - + /* The PK preamble contains the fontwide information we are supposed to return. If FONT_NAME isn't open for reading, we give a fatal error. */ @@ -201,7 +203,7 @@ pk_get_preamble (string filename) return p; } - + /* Return the information for the character CODE in the font FILENAME, or null if the character doesn't exist in that font. */ @@ -514,7 +516,7 @@ get_bitmap (pk_char_type *pk_char) while (extra_bits-- > 0) (void) data_get_bit (); } - + /* Low-level routines that read from the disk file. */ static string @@ -543,7 +545,7 @@ pk_get_n_byte_value (unsigned n) return v; } - + /* These routines do not read from a disk file. Instead, they read from memory (where we have put each character's definition, directly from the file.) They use the semi-global `pk_input_data'. */ @@ -637,7 +639,7 @@ data_get_signed_n_byte_value (one_byte passed_n) return v; } - + /* We assign an index number to NAME, and store both NAME and the `internal_font_type' that we construct in parallel lists. The file F goes into the `internal_font_list'. */ |