From: Arun Persaud Date: Sun, 29 Sep 2013 18:04:19 +0000 (-0700) Subject: remove xpm from XBoard X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=7b739c3b0ba3187b11673c4b26e51a6e4af3c43e remove xpm from XBoard XBoard does not use xpm files anymore, apart as a fallback for desktop icons. Therefore, all references to libxpm was removed. Also zic2xpm was removed from XBoard, since it converted pieces is not that usefull anymore. --- diff --git a/configure.ac b/configure.ac index 4cf6a2f..4b679fa 100644 --- a/configure.ac +++ b/configure.ac @@ -56,7 +56,6 @@ AH_TEMPLATE([USE_PTYS],[template]) AH_TEMPLATE([X_WCHAR],[template]) AH_TEMPLATE([ATTENTION],[template]) AH_TEMPLATE([DEFINED_SYS_ERRLIST],[template]) -AH_TEMPLATE([HAVE_LIBXPM],[template]) AH_TEMPLATE([USE_XAW3D],[template]) AH_TEMPLATE([X_LOCALE],[template]) @@ -436,29 +435,6 @@ dnl| add some libs for OS X ;; esac -AC_ARG_ENABLE( [xpm], - [AS_HELP_STRING([--enable-xpm],[libXpm will be used if found (default)])], - [enable_xpm="$enableval"], - [enable_xpm="yes"]) - -if test x"$enable_xpm" != "xno"; then - save_cflags="$CFLAGS" - save_cppflags="$CPPFLAGS" - CFLAGS="$CFLAGS $X_CFLAGS" - CPPFLAGS="$CPPFLAGS $X_CFLAGS" - AC_CHECK_HEADERS(X11/xpm.h) - CFLAGS="$save_cflags" - CPPFLAGS="$save_cppflags" - if test "$ac_cv_header_X11_xpm_h" = "yes"; then - save_ldflags="$LDFLAGS" - LDFLAGS="$LDFLAGS $X_LIBS" - AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, - [X_PRE_LIBS="-lXpm $X_PRE_LIBS"; AC_DEFINE(HAVE_LIBXPM)], [], - [$X_PRE_LIBS -lX11 $X_EXTRA_LIBS]) - LDFLAGS="$save_ldflags" - fi -fi - AC_SUBST(PRE_XMULIB) AC_SUBST(POST_XMULIB) AC_SUBST(CONF_CFLAGS) @@ -543,7 +519,7 @@ CONFIGURE_OPTIONS="prefix=$prefix; datarootdir=$datarootdir; \ datadir=$datadir; gamedatadir=$GAMEDATADIR; desktopdir=$DESKTOPDIR; \ mimedir=$MIMEDIR; iconsdir=$ICONSDIR; svgiconsdir=$SVGICONSDIR; infodir=$infodir; \ sysconfigdir=$sysconfigdir; update_mimedb=$enable_mimedb; NLS=$USE_NLS; \ -GKT=$with_GTK; Xaw3d=$with_Xaw3d; Xaw=$with_Xaw; xpm=$enable_xpm; \ +GKT=$with_GTK; Xaw3d=$with_Xaw3d; Xaw=$with_Xaw; \ ptys=$enable_ptys; zippy=$enable_zippy; sigint=$enable_sigint" AC_SUBST(CONFIGURE_OPTIONS) @@ -579,7 +555,6 @@ echo " GTK: $with_GTK" echo " Xaw3d: $with_Xaw3d" echo " Xaw: $with_Xaw" echo "" -echo " xpm: $enable_xpm" echo " ptys: $enable_ptys" echo " zippy: $enable_zippy" echo " sigint: $enable_sigint" diff --git a/dialogs.c b/dialogs.c index 6f22fb2..cf94dc9 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2377,7 +2377,6 @@ static char *Extensions[] = { ".trn", ".bin", ".wav", -".xpm", ".ini", ".log", "", diff --git a/xaw/xboard.c b/xaw/xboard.c index b59b961..5b6501d 100644 --- a/xaw/xboard.c +++ b/xaw/xboard.c @@ -183,13 +183,6 @@ extern char *getenv(); // [HGM] bitmaps: put before incuding the bitmaps / pixmaps, to know how many piece types there are. #include "common.h" -#if HAVE_LIBXPM -#include -#define IMAGE_EXT "xpm" -#else -#define IMAGE_EXT "xim" -#endif - #include "bitmaps/icon_white.bm" #include "bitmaps/icon_black.bm" #include "bitmaps/checkmark.bm" @@ -429,128 +422,6 @@ String xboardResources[] = { /* Max possible square size */ #define MAXSQSIZE 256 -static int xpm_avail[MAXSQSIZE]; - -#ifdef HAVE_DIR_STRUCT - -/* Extract piece size from filename */ -static int -xpm_getsize (char *name, int len, char *ext) -{ - char *p, *d; - char buf[10]; - - if (len < 4) - return 0; - - if ((p=strchr(name, '.')) == NULL || - StrCaseCmp(p+1, ext) != 0) - return 0; - - p = name + 3; - d = buf; - - while (*p && isdigit(*p)) - *(d++) = *(p++); - - *d = 0; - return atoi(buf); -} - -/* Setup xpm_avail */ -static int -xpm_getavail (char *dirname, char *ext) -{ - DIR *dir; - struct dirent *ent; - int i; - - for (i=0; id_name, NAMLEN(ent), ext); - if (i > 0 && i < MAXSQSIZE) - xpm_avail[i] = 1; - } - - closedir(dir); - - return 0; -} - -void -xpm_print_avail (FILE *fp, char *ext) -{ - int i; - - fprintf(fp, _("Available '%s' sizes:\n"), ext); - for (i=1; i - // [HGM] bitmaps of some ICONS used in the engine-outut window static unsigned char CLEAR_14[28]; diff --git a/xboard.texi b/xboard.texi index 2a82bae..d631405 100644 --- a/xboard.texi +++ b/xboard.texi @@ -4147,7 +4147,6 @@ Here are some other programs you can use with XBoard * Fairy-Max:: The Fairy-Max chess engine. * HoiChess:: The HoiChess chess engine. * Crafty:: The Crafty chess engine. -* zic2xpm:: The program used to import chess sets from ZIICS. @end menu @node GNU Chess @@ -4204,45 +4203,6 @@ To use Crafty with XBoard, give the -fcp and -fd options as follows, where is the directory in which you installed Crafty and placed its book and other support files. -@node zic2xpm -@section zic2xpm - -The ``zic2xpm'' program is used to import chess sets from the ZIICS(*) -program into XBoard. ``zic2xpm'' is part of the XBoard distribution. -ZIICS is available from: - -ftp://ftp.freechess.org/pub/chess/DOS/ziics131.exe - -To import ZIICS pieces, do this: -@table @asis -@item 1. Unzip ziics131.exe into a directory: - -@example -unzip -L ziics131.exe -d ~/ziics -@end example -@item 2. Use zic2xpm to convert a set of pieces to XBoard format. - -For example, let's say you want to use the -FRITZ4 set. These files are named ``fritz4.*'' in the ZIICS distribution. - -@example -mkdir ~/fritz4 -cd ~/fritz4 -zic2xpm ~/ziics/fritz4.* -@end example -@item 3. Give XBoard the ``-pixmap'' option when starting up, e.g.: - -@example -xboard -pixmap ~/fritz4 -@end example -@end table - -(*) ZIICS is a separate copyrighted work of Andy McFarland. -The ``ZIICS pieces'' are copyrighted works of their respective -creators. Files produced by ``zic2xpm'' are for PERSONAL USE ONLY -and may NOT be redistributed without explicit permission from -the original creator(s) of the pieces. - @ifnottex @node Copyright @unnumbered Copyright diff --git a/zic2xpm.c b/zic2xpm.c deleted file mode 100644 index 2fdd078..0000000 --- a/zic2xpm.c +++ /dev/null @@ -1,597 +0,0 @@ -/* - zic2xpm.c - - Program to convert pieces from ZIICS format to XPM & XIM format. - (C version) By Frank McIngvale . - - Copyright (C) 1996, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. - - NOTICE: The piece images distributed with ZIICS are - copyrighted works of their original creators. Images - converted with zic2xpm may not be redistributed without - the permission of the copyright holders. Do not contact - the authors of zic2xpm or of ZIICS itself to request - permission. - - NOTICE: The format of the ZIICS piece file was gleaned from - SHOWSETS.PAS, a part of ZIICS. Thanks to Andy McFarland - (Zek on ICC) for making this source available! ZIICS is a - completely separate and copyrighted work of Andy - McFarland. Use and distribution of ZIICS falls under the - ZIICS license, NOT the GNU General Public License. - - NOTICE: The format of the VGA imageblocks was determined - by experimentation, and without access to any - of Borland Inc.'s BGI library source code. - - - GNU XBoard 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. - - GNU XBoard 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/. - - - ** If you find a bug in zic2xpm.c, please report it to me, - Frank McIngvale (frankm@hiwaay.net) so that I may fix it. ** -*/ - -/* - Usage: zic2xpm file1 [file2 ...] - - We split the ZIICS file(s) into 24 XPM & 24 XIM files with names: - - .(xpm|xim). - - Where: - piece = p, n, b, r, q, k - type = ll, ld, dl, dd - size = Piece size. - - Plus 4 files for the light & dark squares. - - This means that you can extract multiple SIZES in one directory - without name clashes. Extracting two sets of the SAME - size in a directory will cause the second to overwrite - the first. -*/ - -/* - Technical note: Yes, this file is huge. I made it by cramming - `zic2xpm' and `zic2xim' together. This should - be less confusing to use, though. -*/ - -#include "config.h" -#include -#if STDC_HEADERS -#include -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -/* - XIM file format: - - width byte - height byte - - Data (1 byte per pixel, row major) -*/ - -/* - Map colors from ZIICS -> XIM : - - 0 0 Dark piece - 2 1 Dark square - 15 2 Light piece - 14 3 Light square -*/ - -typedef struct { - int zval; /* ZIICS value */ - int xval; /* XIM value */ -} z2xim; - -/* Associate VGA color with XPM color/sym */ - -typedef struct { - int cval; /* VGA pixel value */ - char xchar; /* XPM character for this color */ - char *csym; /* Symbolic name */ - char *cdefault; /* Default color */ -} z2xpm; - -#define NR_ZIICS_COLORS 4 -#define BUFLEN 100 - -/* SHOWSETS.PAS (from ZIICS) states that images may only - use color numbers 0, 2, 14, and 15 */ - -z2xim z2xim_tab[NR_ZIICS_COLORS] = { - { 0, 0 }, - { 2, 1 }, - { 15, 2 }, - { 14, 3 } }; - -z2xpm z2xpm_tab[NR_ZIICS_COLORS] = { - { 15, 'X', "light_piece", "white" }, - { 0, ' ', "dark_piece", "black" }, - { 14, '*', "light_square", "gray" }, - { 2, '.', "dark_square", "green" } }; - -void -fatal (char *str) -{ - printf("Fatal error: %s\n", str ); - exit(1); -} - -z2xim * -lookup_xim_color (int color) -{ - int i; - - for( i=0; i 0; --i, --w ) - { - byte = 0; - - /* 1 bit from each plane */ - for( j=0; j<4; ++j ) - { - bit = b[j]; - bit &= (1 << i); - bit >>= i; - bit <<= 3-j; - byte |= bit; - } - - *(dest++) = byte; - } - - return dest; -} - -/* - W is width of image in PIXELS. - SRC is in packed pixel format. - DEST is filled with 1 BYTE per PIXEL. -*/ -unsigned char * -decode_line (unsigned char *dest, unsigned char *src, int w) -{ - unsigned int w8; - unsigned int bpp; - unsigned char b[4]; - int i; - unsigned char *p; - - p = src; - w8 = up8( w ); - - /* 4 planes, bpp BYTES per plane */ - /* Planes are MSB -> LSB */ - bpp = w8 >> 3; - - while( w > 0 ) - { - for( i=0; i<4; ++i ) - b[i] = p[i*bpp]; - - if ( w > 8 ) - dest = decode_byte( dest, b, 8 ); - else - dest = decode_byte( dest, b, w ); - - w -= 8; - ++p; - } - - return (src + bpp * 4); -} - -int -write_xim_header (FILE *fp, int w, int h) -{ - fputc( w, fp ); - fputc( h, fp ); - - return 0; -} - -int -write_xpm_header (FILE *fp, int w, int h) -{ - int i; - z2xpm *cv; - - fprintf(fp, "/* XPM */\n"); - fprintf(fp, "/* This file was automatically generated from the file %s\n", - src_name ); - fprintf(fp, "using the program ``zic2xpm''.\n"); - fprintf(fp, "\n %s\n %s\n %s\n %s\n %s\n %s */\n", - "NOTICE: The piece images distributed with ZIICS are", - " copyrighted works of their original creators. Images", - " converted with zic2xpm may not be redistributed without", - " the permission of the copyright holders. Do not contact", - " the authors of zic2xpm or of ZIICS itself to request", - " permission."); - fprintf( fp, "static char * image_name[] = {\n" ); - fprintf( fp, "\"%d %d %d 1\",\n", h, w, NR_ZIICS_COLORS ); - - cv = z2xpm_tab; - - for( i=0; ixchar, - cv->cdefault, cv->csym ); - } - - return 0; -} - -void -create_piece_xim (char *outname, FILE *fpin, int W, int H) -{ - FILE *fpout; - int w, h, i, j, c; - unsigned char *lump, *p, *line; - long size; - z2xim *ent; - - fpout = fopen( outname, "wb" ); - if ( !fpout ) - fatal( "Can't create output file."); - - /* Header is two ints -- Width then Height, x86 format */ - c = fgetc( fpin ); - w = (fgetc(fpin) << 8) | c; - - c = fgetc( fpin ); - h = (fgetc(fpin) << 8) | c; - - ++w; ++h; - - if ( w != W || h != H ) - fatal( "Bad header." ); - - size = vga_imagesize( w, h ) - 4; - lump = (unsigned char*)malloc( size ); - line = (unsigned char*)malloc( w ); - - if ( !lump || !line ) - fatal( "Out of memory." ); - - fread( lump, 1, size, fpin ); - - /* Write XIM header */ - write_xim_header( fpout, w, h ); - - p = lump; - - /* Write XIM data */ - for( i=0; ixval, fpout ); - } - } - - free( lump ); - free( line ); - fclose( fpout ); -} - -void -create_piece_xpm (char *outname, FILE *fpin, int W, int H) -{ - FILE *fpout; - int w, h, i, j, c; - unsigned char *lump, *p, *line; - long size; - z2xpm *cv; - - fpout = fopen( outname, "wb" ); - if ( !fpout ) - fatal( "Can't create output file."); - - /* Header is two ints -- Width then Height, x86 format */ - c = fgetc( fpin ); - w = (fgetc(fpin) << 8) | c; - - c = fgetc( fpin ); - h = (fgetc(fpin) << 8) | c; - - ++w; ++h; - - if ( w != W || h != H ) - fatal( "Bad header." ); - - size = vga_imagesize( w, h ) - 4; - lump = (unsigned char*)malloc( size ); - line = (unsigned char*)malloc( w ); - - if ( !lump || !line ) - fatal( "Out of memory." ); - - fread( lump, 1, size, fpin ); - - /* Write XPM header */ - write_xpm_header( fpout, w, h ); - - p = lump; - - /* Write XPM data */ - for( i=0; ixchar ); - } - fprintf( fpout, "\",\n" ); - } - - fprintf( fpout, "};\n" ); - - free( lump ); - free( line ); - fclose( fpout ); -} - -/* The order of the pieces in the ZIICS piece file (from SHOWSETS.PAS) */ -char *pieces = "prkqbn"; -char *pname[] = { "Pawn", "Rook", "King", "Queen", "Bishop", "Knight" }; - -/* The suborder - Light/Light, Light/Dark, etc. */ -char *prefixes[] = { "ll", "ld", "dl", "dd" }; - -int -process_file_xim (char *filename) -{ - int w, h, piece, kind, c; - int nr_pieces = 6; - int nr_kinds = 4; - FILE *fp; - char buf[BUFLEN]; - - src_name = filename; - - fp = fopen( filename, "rb" ); - if ( !fp ) - fatal( "Can't open input file." ); - - /* Header is two ints -- Width then Height, x86 format */ - c = fgetc( fp ); - w = (fgetc(fp) << 8) | c; - - c = fgetc( fp ); - h = (fgetc(fp) << 8) | c; - - ++w; ++h; - - if ( w != h ) - { - printf("ERROR: Can only convert square pieces.\n"); - printf(" (This set is %dx%d)\n", w, h ); - exit(1); - } - - printf("Creating XIM files...\n"); - printf("File: %s, W=%d, H=%d\n", filename, w, h ); - fseek( fp, 0, SEEK_SET ); - - /* Write .XIM files */ - for( piece = 0; piece < nr_pieces; ++piece ) - { - printf("%s ", pname[piece] ); - - for( kind = 0; kind < nr_kinds; ++kind ) - { - printf( "." ); - /* Form output filename -- .xim */ - snprintf(buf, BUFLEN, "%c%s%d.xim", pieces[piece], prefixes[kind], w); - create_piece_xim( buf, fp, w, h ); - } - printf("\n"); - } - - /* Write the light & dark squares */ - snprintf( buf, BUFLEN, "lsq%d.xim", w ); - printf("Light Square" ); - create_piece_xim( buf, fp, w, h ); - - snprintf( buf, BUFLEN, "dsq%d.xim", w ); - printf("\nDark Square" ); - create_piece_xim( buf, fp, w, h ); - printf("\n"); - - printf("Successfully converted!!\n" ); - - fclose( fp ); - - return 0; -} - -int -process_file_xpm (char *filename) -{ - int w, h, piece, kind, c; - int nr_pieces = 6; - int nr_kinds = 4; - FILE *fp; - char buf[BUFLEN]; - - src_name = filename; - - fp = fopen( filename, "rb" ); - if ( !fp ) - fatal( "Can't open input file." ); - - /* Header is two ints -- Width then Height, x86 format */ - c = fgetc( fp ); - w = (fgetc(fp) << 8) | c; - - c = fgetc( fp ); - h = (fgetc(fp) << 8) | c; - - ++w; ++h; - - if ( w != h ) - { - printf("ERROR: Can only convert square pieces.\n"); - printf(" (This set is %dx%d)\n", w, h ); - exit(1); - } - - printf("Creating XPM files...\n"); - printf("File: %s, W=%d, H=%d\n", filename, w, h ); - fseek( fp, 0, SEEK_SET ); - - /* Write .XPM files */ - for( piece = 0; piece < nr_pieces; ++piece ) - { - printf("%s ", pname[piece] ); - - for( kind = 0; kind < nr_kinds; ++kind ) - { - printf( "." ); - /* Form output filename -- .xpm */ - snprintf(buf, BUFLEN, "%c%s%d.xpm", pieces[piece], prefixes[kind], w); - create_piece_xpm( buf, fp, w, h ); - } - printf("\n"); - } - - /* Write the light & dark squares */ - snprintf( buf, BUFLEN, "lsq%d.xpm", w ); - printf("Light Square" ); - create_piece_xpm( buf, fp, w, h ); - - snprintf( buf, BUFLEN, "dsq%d.xpm", w ); - printf("\nDark Square" ); - create_piece_xpm( buf, fp, w, h ); - printf("\n"); - - printf("Successfully converted!!\n" ); - - fclose( fp ); - - return 0; -} - -int -main (int argc, char **argv) -{ - int i; - - if ( argc < 2 ) - { - printf("ZIC2XPM 2.01 - by Frank McIngvale (frankm@hiwaay.net)\n"); - printf("Copyright (C) 1996 Free Software Foundation, Inc.\n\n"); - printf("Usage: zic2xpm file1 [file2 ...]\n\n"); - printf(" Splits each file (ZIICS piece files) into 26 XPM & XIM files\n"); - printf(" suitable for use in XBoard 3.5 or later.\n"); - printf("\n* ZIICS is a copyrighted work of Andy McFarland (Zek on ICC) *\n"); - return 1; - } - - - setbuf( stdout, NULL ); - - for( i=1; i