From xemacs-m  Fri Mar  7 15:57:47 1997
Received: from mail.cis.ohio-state.edu (mail.cis.ohio-state.edu [164.107.8.55])
	by xemacs.org (8.8.5/8.8.5) with SMTP id PAA22285
	for <xemacs-beta@xemacs.org>; Fri, 7 Mar 1997 15:57:47 -0600 (CST)
Received: from calico.cis.ohio-state.edu (calico.cis.ohio-state.edu [164.107.142.11]) by mail.cis.ohio-state.edu (8.6.7/8.6.4) with ESMTP id QAA17063; Fri, 7 Mar 1997 16:57:40 -0500
Received: (ware@localhost) by calico.cis.ohio-state.edu (8.8.0/8.6.4) id QAA26552; Fri, 7 Mar 1997 16:57:38 -0500 (EST)
To: xemacs-beta@xemacs.org
Subject: Patch for updating search path for bitmap directories and suffixes
From: Pete Ware <ware@cis.ohio-state.edu>
Date: 07 Mar 1997 16:57:34 -0500
Message-ID: <vwmwwrj2wmp.fsf@calico.cis.ohio-state.edu>
Lines: 208
X-Mailer: Gnus v5.4.17/XEmacs 19.15

Fri Mar  7 15:08:34 1997  Pete Ware  <ware@calico.cis.ohio-state.edu>

	* lisp/prim/startup.el (set-default-load-path): Added modification
 	to x-bitmap-file-path to add $PREFIX/etc and all possible pixmap
 	directories as stored under either $PREFIX/etc/images or
	$PREFIX/etc if the etc/images directory does not exist.

	* src/glyphs-x.c (locate_pixmap_file): Add suffix argument
	(potential_pixmap_file_instantiator): Add suffix and use it in
	call to locate_pixmap_file.
	(simple_image_type_normalize): Same
	(xbm_mask_file_munging): Use suffixes,
		"Mask:msk:.msk:.xbmMask:.xbmmsk",
	to find mask.
	(xbm_normalize): Use suffixes ":.xbm" and previous masks.
	(jpeg_normalize): Use suffixes ":.jpeg".
	(gif_normalize): Use suffixes ":.jif"
	(png_normalize): Use suffixes ":.png"
	(xpm_normalize): Use suffixes ":.xpm"
	(xface_normalize): Use suffixes ":.xface:.face" and mask suffixes
	"msk:Mask:.xface.msk:.msk"
	(autodetect_normalize): Use suffixes ":.xbm:.xpm:.gif:.jpeg".

diff -r -x *.elc -u old/xemacs-19.15-b97/lisp/prim/startup.el xemacs-19.15-b97/lisp/prim/startup.el
--- old/xemacs-19.15-b97/lisp/prim/startup.el	Sun Feb  2 00:06:09 1997
+++ xemacs-19.15-b97/lisp/prim/startup.el	Fri Mar  7 15:34:16 1997
@@ -1182,6 +1182,32 @@
 			       (list (file-name-as-directory file)))))
 	      (setq files (cdr files))))))
 
+    ;; 1197/3/7 by Pete Ware <ware@cis.ohio-state.edu>
+    ;; make x-bitmap-file-path contain all subdirectories of either
+    ;; $PREFIX/etc/images or $PREFIX/etc if the previous directory does
+    ;; not exist
+    (if etc
+	(progn
+	  ;; Make etc being on x-bitmap-file-path search path
+	  (or (member etc x-bitmap-file-path)
+	      (setq x-bitmap-file-path (append x-bitmap-file-path (list etc))))
+	  ;; Add any subdirectories.  If etc/images exist, then all
+	  ;; subdirectories there, otherwise all subdirectories if etc
+	  (let ((pixmap-base-dir (concat etc "/images")))
+	    (if (not (file-directory-p pixmap-base-dir))
+		(setq pixmap-base-dir etc))
+	    (let ((files (directory-files pixmap-base-dir nil "^[^-.]" nil 'dirs-only))
+		  file)
+	      (while files
+		(setq file (car files))
+		(if (and (not (member file '("RCS" "CVS" "SCCS")))
+			 (setq file (expand-file-name file pixmap-base-dir))
+			 (not (member file x-bitmap-file-path)))
+		    (setq x-bitmap-file-path
+			  (nconc x-bitmap-file-path
+				 (list (file-name-as-directory file)))))
+		(setq files (cdr files)))))))
+
     ;; 1996/12/6 by MORIOKA Tomohiko <morioka@jaist.ac.jp>
     ;;	define `default-load-path' for file-detect.el
     (setq default-load-path
diff -x *.o -u old/xemacs-19.15-b97/src/glyphs-x.c xemacs-19.15-b97/src/glyphs-x.c
--- old/xemacs-19.15-b97/src/glyphs-x.c	Sat Feb 22 17:08:39 1997
+++ xemacs-19.15-b97/src/glyphs-x.c	Thu Mar  6 19:27:49 1997
@@ -268,7 +268,7 @@
    otherwise, return Qnil. */
 
 static Lisp_Object
-locate_pixmap_file (Lisp_Object name)
+locate_pixmap_file (Lisp_Object name, CONST char *suffix)
 {
   /* This function can GC if IN_REDISPLAY is false */
   Display *display;
@@ -328,13 +328,13 @@
 
   {
     Lisp_Object found;
-    if (locate_file (Vx_bitmap_file_path, name, "", &found, R_OK) < 0)
+    if (locate_file (Vx_bitmap_file_path, name, suffix, &found, R_OK) < 0)
       {
 	Lisp_Object temp = list1 (Vdata_directory);
 	struct gcpro gcpro1;
 
 	GCPRO1 (temp);
-	locate_file (temp, name, "", &found, R_OK);
+	locate_file (temp, name, suffix, &found, R_OK);
 	UNGCPRO;
       }
 
@@ -354,7 +354,8 @@
 static Lisp_Object
 potential_pixmap_file_instantiator (Lisp_Object instantiator,
 				    Lisp_Object file_keyword,
-				    Lisp_Object data_keyword)
+				    Lisp_Object data_keyword,
+				    CONST char *suffix)
 {
   Lisp_Object file;
   Lisp_Object data;
@@ -366,7 +367,7 @@
 
   if (!NILP (file) && NILP (data))
     {
-      Lisp_Object retval = locate_pixmap_file (file);
+      Lisp_Object retval = locate_pixmap_file (file, suffix);
       if (!NILP (retval))
 	return retval;
       else
@@ -379,7 +380,7 @@
 
 static Lisp_Object
 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type,
-			     Lisp_Object image_type_tag)
+			     Lisp_Object image_type_tag, CONST char *suffix)
 {
   Lisp_Object file = Qnil;
   struct gcpro gcpro1, gcpro2;
@@ -395,7 +396,7 @@
      Note that if we cannot generate any regular inline data, we
      skip out. */
 
-  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
+  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, suffix);
 
   if (CONSP (file)) /* failure locating filename */
     signal_double_file_error ("Opening pixmap file",
@@ -749,10 +750,7 @@
       && !NILP (file))
     {
       mask_file =
-	locate_pixmap_file (concat2 (file, build_string ("Mask")));
-      if (NILP (mask_file))
-	mask_file =
-	  locate_pixmap_file (concat2 (file, build_string ("msk")));
+	locate_pixmap_file (file, "Mask:msk:.msk:.xbmMask:.xbmmsk");
     }
 
   if (!NILP (mask_file))
@@ -788,9 +786,10 @@
      Note that if we cannot generate any regular inline data, we
      skip out. */
 
-  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
+  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, ":.xbm");
   mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
-						  Q_mask_data);
+						  Q_mask_data,
+						  "msk:Mask:.msk:.Mask:.xbmmsk:.xbmMask");
 
   if (CONSP (file)) /* failure locating filename */
     signal_double_file_error ("Opening bitmap file",
@@ -1064,7 +1063,7 @@
 static Lisp_Object
 jpeg_normalize (Lisp_Object inst, Lisp_Object console_type)
 {
-  return simple_image_type_normalize (inst, console_type, Qjpeg);
+  return simple_image_type_normalize (inst, console_type, Qjpeg, ":.jpeg");
 }
 
 static int
@@ -1545,7 +1544,7 @@
 static Lisp_Object
 gif_normalize (Lisp_Object inst, Lisp_Object console_type)
 {
-  return simple_image_type_normalize (inst, console_type, Qgif);
+  return simple_image_type_normalize (inst, console_type, Qgif, ":.gif");
 }
 
 static int
@@ -1866,7 +1865,7 @@
 static Lisp_Object
 png_normalize (Lisp_Object inst, Lisp_Object console_type)
 {
-  return simple_image_type_normalize (inst, console_type, Qpng);
+  return simple_image_type_normalize (inst, console_type, Qpng, ":.png");
 }
 
 static int
@@ -2425,7 +2424,7 @@
      Note that if we cannot generate any regular inline data, we
      skip out. */
 
-  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
+  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, ":.xpm");
 
   if (CONSP (file)) /* failure locating filename */
     signal_double_file_error ("Opening pixmap file",
@@ -2923,9 +2922,11 @@
      Note that if we cannot generate any regular inline data, we
      skip out. */
 
-  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data);
+  file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
+					     ":.xface:.face");
   mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
-						  Q_mask_data);
+						  Q_mask_data,
+						  "msk:Mask:.xface.msk:.msk");
 
   if (CONSP (file)) /* failure locating filename */
     signal_double_file_error ("Opening bitmap file",
@@ -3068,7 +3069,7 @@
 
   alist = tagged_vector_to_alist (instantiator);
 
-  filename = locate_pixmap_file (file);
+  filename = locate_pixmap_file (file, ":.xbm:.xpm:.gif:.jpeg");
   if (!NILP (filename))
     {
       int xhot, yhot;

