From 393d2d0f85f007381265339590dba1880ac1a2dd Mon Sep 17 00:00:00 2001 From: mjflick Date: Sun, 13 Jun 2004 18:30:45 +0000 Subject: checkpoint --- imageto/ifi.h | 2 +- imageto/image-header.h | 2 +- imageto/input-img.h | 2 +- imageto/input-pbm.h | 2 +- imageto/main.h | 2 +- imageto/out-chars.c | 5 +-- include/c-pathch.h | 5 +++ include/paths.h | 2 +- lib/GNUmakefile | 4 +- lib/find-suffix.c | 5 +-- lib/make-suffix.c | 4 +- lib/progname.c | 12 +++-- lib/rm-suffix.c | 2 +- lib/str-list.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/xcalloc.c | 2 +- lib/xfopen.c | 2 +- lib/xfseek.c | 2 +- lib/xftell.c | 2 +- 18 files changed, 146 insertions(+), 28 deletions(-) create mode 100644 lib/str-list.c diff --git a/imageto/ifi.h b/imageto/ifi.h index e013d26..770d454 100644 --- a/imageto/ifi.h +++ b/imageto/ifi.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef IFI_H #define IFI_H -#include +#include "types.h" /* See ifi.c. */ diff --git a/imageto/image-header.h b/imageto/image-header.h index 9d48a60..ffe2d40 100644 --- a/imageto/image-header.h +++ b/imageto/image-header.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef IMAGE_HEADER_H #define IMAGE_HEADER_H -#include +#include "types.h" /* The important general information about the image data. See `get_{img,pbm}_header' for the full details of the headers for diff --git a/imageto/input-img.h b/imageto/input-img.h index afbaaeb..a66e3e9 100644 --- a/imageto/input-img.h +++ b/imageto/input-img.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef INPUT_IMG_H #define INPUT_IMG_H -#include +#include "types.h" #include "image-header.h" diff --git a/imageto/input-pbm.h b/imageto/input-pbm.h index 522d2de..ad10302 100644 --- a/imageto/input-pbm.h +++ b/imageto/input-pbm.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef INPUT_PBM_H #define INPUT_PBM_H -#include +#include "types.h" #include "image-header.h" diff --git a/imageto/main.h b/imageto/main.h index 7d2f7c1..567d474 100644 --- a/imageto/main.h +++ b/imageto/main.h @@ -19,7 +19,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef MAIN_H #define MAIN_H -#include +#include "types.h" #include "image-header.h" diff --git a/imageto/out-chars.c b/imageto/out-chars.c index 9ab6cf9..2256baa 100644 --- a/imageto/out-chars.c +++ b/imageto/out-chars.c @@ -18,9 +18,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" -#include -#include -#include +#include "tex-file.h" +#include "paths.h" #include "bb-outline.h" #include "gf.h" diff --git a/include/c-pathch.h b/include/c-pathch.h index 78c3b24..2fcff11 100644 --- a/include/c-pathch.h +++ b/include/c-pathch.h @@ -43,6 +43,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif /* not VMS */ #endif /* not PATH_SEP */ +#define DIR_SEP ':' +#ifndef IS_DIR_SEP +#define IS_DIR_SEP(ch) ((ch) == DIR_SEP) +#endif + #ifndef IS_PATH_SEP #define IS_PATH_SEP(ch) ((ch) == PATH_SEP) #endif diff --git a/include/paths.h b/include/paths.h index 8988a70..25f9606 100644 --- a/include/paths.h +++ b/include/paths.h @@ -1,4 +1,4 @@ -/* Generated from paths.h.in (Tue May 25 00:54:31 EDT 2004). */ +/* Generated from paths.h.in (Wed Jun 9 19:59:13 EDT 2004). */ /* Paths. */ /* If the environment variable `FONTUTIL_LIB' isn't set, use this diff --git a/lib/GNUmakefile b/lib/GNUmakefile index fbfe941..32526d2 100644 --- a/lib/GNUmakefile +++ b/lib/GNUmakefile @@ -31,8 +31,8 @@ hexify identity integer-ok libfile line list logreport \ make-prefix math now numtoa pathsrch rand report safe-free scaled-num \ spline statistics str-lcase str-to-bit substring varstring vector \ xmessage xopendir xrename \ -atou concatn dir extend-fname find-suffix hash make-suffix progname rm-suffix \ -xcalloc xfopen xfseek xftell xmalloc xrealloc xstrdup +atou concatn dir extend-fname find-suffix hash make-suffix rm-suffix \ +xcalloc xfopen xfseek xftell xmalloc xrealloc xstrdup str-list include ../data/defs.make include ../data/defslib.make diff --git a/lib/find-suffix.c b/lib/find-suffix.c index cb0f9cf..e704c7b 100644 --- a/lib/find-suffix.c +++ b/lib/find-suffix.c @@ -34,9 +34,8 @@ find_suffix P1C(const_string, name) return NULL; for (slash_pos = name + strlen (name); - slash_pos > dot_pos && !IS_DIR_SEP (*slash_pos); - slash_pos--) - ; + slash_pos > dot_pos && !((*slash_pos) == '/' || (*slash_pos) == '\\'); + slash_pos--); return slash_pos > dot_pos ? NULL : dot_pos + 1; } diff --git a/lib/make-suffix.c b/lib/make-suffix.c index 1935c3f..3e16f57 100644 --- a/lib/make-suffix.c +++ b/lib/make-suffix.c @@ -16,8 +16,8 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include +#include "config.h" +#include "c-pathch.h" /* Return a new string: S suffixed with SUFFIX, regardless of what it was before. This returns a newly allocated string. */ diff --git a/lib/progname.c b/lib/progname.c index d269e2f..6ad803d 100644 --- a/lib/progname.c +++ b/lib/progname.c @@ -16,16 +16,14 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include -#include -#include -#include -#include +#include "config.h" +#include "c-pathch.h" +#include "c-stat.h" /* For kpse_reset_progname */ -#include +#include "tex-file.h" #ifdef WIN32 -#include +#include "c-pathmx.h" #endif /* NeXT does not define the standard macros, but has the equivalent. diff --git a/lib/rm-suffix.c b/lib/rm-suffix.c index 192fe10..6f7e917 100644 --- a/lib/rm-suffix.c +++ b/lib/rm-suffix.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" /* Generic const warning -- see extend-fname.c. */ diff --git a/lib/str-list.c b/lib/str-list.c new file mode 100644 index 0000000..90b99c2 --- /dev/null +++ b/lib/str-list.c @@ -0,0 +1,117 @@ +/* str-list.c: define routines for string lists. + +Copyright (C) 1993 Karl Berry. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This library 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "config.h" + +#include "str-list.h" + + +/* See the .h file for comments. */ + + +str_list_type +str_list_init P1H(void) +{ + str_list_type ret; + + STR_LIST_LENGTH (ret) = 0; + STR_LIST (ret) = NULL; + + return ret; +} + + +void +str_list_add P2C(str_list_type *, l, string, s) +{ + STR_LIST_LENGTH (*l)++; + XRETALLOC (STR_LIST (*l), STR_LIST_LENGTH (*l), string); + STR_LIST_LAST_ELT (*l) = s; +} + + +/* May as well save some reallocations and do everything in a chunk + instead of calling str_list_add on each element. */ + +void +str_list_concat P2C(str_list_type *, target, str_list_type, more) +{ + unsigned e; + unsigned prev_len = STR_LIST_LENGTH (*target); + + STR_LIST_LENGTH (*target) += STR_LIST_LENGTH (more); + XRETALLOC (STR_LIST (*target), STR_LIST_LENGTH (*target), string); + + for (e = 0; e < STR_LIST_LENGTH (more); e++) + STR_LIST_ELT (*target, prev_len + e) = STR_LIST_ELT (more, e); +} + + +/* Concatenate the elements of more to each element of target. This + _must_ be done with the first index varying fastest. */ +/* Note that we free the old elements of target as well. */ + +void +str_list_concat_elements P2C(str_list_type *, target, str_list_type, more) +{ + if (STR_LIST_LENGTH(more) == 0) { + return; + } else if (STR_LIST_LENGTH(*target) == 0) { + unsigned int i; + STR_LIST_LENGTH(*target) = STR_LIST_LENGTH(more); + STR_LIST(*target) = + (string*)xmalloc(STR_LIST_LENGTH(more)*sizeof(char*)); + for (i=0;i!=STR_LIST_LENGTH(more);++i) { + STR_LIST_ELT(*target,i)=xstrdup(STR_LIST_ELT(more,i)); + } + return; + } else { + unsigned new_len; + char ** new_list; + unsigned int i,j; + new_list = (string*)xmalloc(STR_LIST_LENGTH (*target) + * STR_LIST_LENGTH (more) * sizeof(char*)); + + new_len = 0; + for (j = 0; j != STR_LIST_LENGTH(more); ++j) { + for (i = 0; i != STR_LIST_LENGTH(*target); ++i) { + new_list[new_len] = concat(STR_LIST_ELT(*target,i), + STR_LIST_ELT(more,j)); + ++new_len; + } + } + for (i = 0; i != STR_LIST_LENGTH(*target); ++i) + free(STR_LIST_ELT(*target, i)); + free(STR_LIST(*target)); + STR_LIST_LENGTH(*target) = new_len; + STR_LIST(*target) = new_list; + } +} + + +/* Free the list (but not the elements within it). */ + +void +str_list_free P1C(str_list_type *, l) +{ + if (STR_LIST (*l)) + { + free (STR_LIST (*l)); + STR_LIST (*l) = NULL; + } +} diff --git a/lib/xcalloc.c b/lib/xcalloc.c index 0d2d52b..3f6231c 100644 --- a/lib/xcalloc.c +++ b/lib/xcalloc.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" address diff --git a/lib/xfopen.c b/lib/xfopen.c index 084e128..c27940d 100644 --- a/lib/xfopen.c +++ b/lib/xfopen.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" /* These routines just check the return status from standard library diff --git a/lib/xfseek.c b/lib/xfseek.c index b104383..25a1c8f 100644 --- a/lib/xfseek.c +++ b/lib/xfseek.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" void diff --git a/lib/xftell.c b/lib/xftell.c index 5b421c6..3af8954 100644 --- a/lib/xftell.c +++ b/lib/xftell.c @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include +#include "config.h" unsigned long -- cgit v1.2.1